PHP Classes

File: public/build/js/bundle.js

Recommend this page to a friend!
  Classes of Fabrice Fesch   Melis CMS   public/build/js/bundle.js   Download  
File: public/build/js/bundle.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Melis CMS
Content management system that provides its tools
Author: By
Last change:
Date: 1 year ago
Size: 259,276 bytes
 

Contents

Class file image Download
var melisCms=function(){var e,t=$("body"),i=($("document"),[]);function a(e,t,i){0===e?($("#"+i+" .form-group label").css("color","#686868"),$.each(t,function(e,t){$("#"+i+" .form-control[name='"+e+"']").prev("label").css("color","red")})):$("#"+i+" .form-group label").css("color","#686868")}function s(e){var t="string"==typeof e?e:$(this).data("pagenumber"),i=$(this).data("fatherpageid"),s=$("#"+t+"_id_meliscms_page form").serializeArray();if($("#"+t+"_id_page_taxonomy").length){var n=$("#"+t+"_id_page_taxonomy").data("tags").toString();s.push({name:"page_taxonomy",value:n})}s=$.param(s),$.ajax({type:"POST",url:"/melis/MelisCms/Page/savePage?idPage="+t+"&fatherPageId="+i,data:s,dataType:"json",encode:!0}).done(function(e){if(1===e.success){o(e.datas.idPage),melisHelper.melisOkNotification(e.textTitle,e.textMessage,"#72af46"),a(e.success,e.errors,e.datas.item_zoneid);var i=e.datas.item_zoneid;if("0_id_meliscms_page"===i){melisHelper.tabClose(i);var s=e.datas.idPage+i.substring(1,i.length),n=""!==e.datas.item_icon?e.datas.item_icon:"fa-file-o",r=e.datas.idPage+" - "+e.datas.item_name;melisHelper.tabOpen(r,n,s,e.datas.item_melisKey,{idPage:e.datas.idPage})}else melisHelper.zoneReload(t+"_id_meliscms_page","meliscms_page",{idPage:t},()=>{window.parent.loader.addActivePageEditionLoading(t+"_id_meliscms_page")})}else melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors,"#000"),a(e.success,e.errors,e.datas.item_zoneid);melisCore.flashMessenger()}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})}function n(e){var t="string"==typeof e?e:$(this).data("pagenumber"),s=$("#"+t+"_id_meliscms_page form").serializeArray();if($("#"+t+"_id_page_taxonomy").length){var n=$("#"+t+"_id_page_taxonomy").data("tags").toString();s.push({name:"page_taxonomy",value:n})}s=$.param(s),$.ajax({type:"POST",url:"/melis/MelisCms/Page/publishPage?idPage="+t,data:s,dataType:"json",encode:!0}).done(function(e){1===e.success?(o(e.datas.idPage),$('.page-publishunpublish[data-pagenumber="'+t+'"]').bootstrapSwitch("setState",!0,!0),melisHelper.melisOkNotification(e.textTitle,e.textMessage,"#72af46"),a(e.success,e.errors,e.datas.item_zoneid),melisCore.flashMessenger(),$("#"+e.datas.item_zoneid+" .page-title h1:not('span')").text(e.datas.item_name),$(".tabsbar a[data-id='"+e.datas.item_zoneid+"'] .navtab-pagename").text(t+" - "+e.datas.item_name),$("#"+e.datas.item_zoneid+" .page-title .saved-version-notif").fadeOut(),melisHelper.zoneReload(t+"_id_meliscms_page","meliscms_page",{idPage:t},()=>{window.parent.loader.addActivePageEditionLoading(t+"_id_meliscms_page")}),i.push(e.datas.idPage)):(melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors,"#000"),a(e.success,e.errors,e.datas.item_zoneid)),melisCore.flashMessenger()}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})}function r(e){var t="string"==typeof e?e:$(this).data("pagenumber");$.ajax({type:"GET",url:"/melis/MelisCms/Page/unpublishPage?idPage="+t,dataType:"json",encode:!0}).done(function(e){1===e.success?(o(t),melisHelper.melisOkNotification(e.textTitle,e.textMessage,"#72af46"),melisCore.flashMessenger(),i.push(t)):melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors,"#000"),melisCore.flashMessenger(),melisHelper.zoneReload(t+"_id_meliscms_page","meliscms_page",{idPage:t},()=>{window.parent.loader.addActivePageEditionLoading(t+"_id_meliscms_page")})}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})}function o(e,t){optionalArg=void 0===t?0:t,$.ajax({url:"/melis/MelisCms/TreeSites/getPageIdBreadcrumb?idPage="+e+"&includeSelf="+optionalArg,encode:!0,dataType:"json"}).done(function(e){var t=[];$.each(e,function(e,i){t.push("/"+i),0===e&&i}),t=(t=t.toString()).replace(/,/g,"");var i=$("#id-mod-menu-dynatree").fancytree("getTree");i.reload({url:"/melis/MelisCms/TreeSites/get-tree-pages-by-page-id"}).done(function(){i.loadKeyPath(t,function(e,t){"ok"==t&&e.setActive(!0).done(function(){e.setExpanded(!0)})}).done(function(){i.clearFilter(),!1===$("#id-mod-menu-dynatree .ui-fancytree > li:last-child").hasClass("fancytree-lastsib")&&$("#id-mod-menu-dynatree .ui-fancytree > li:last-child").remove()})})}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})}function l(e){var t=$(this).val().length,i=$(this).prev("label"),a=e.data.limit;i.find("span").length?0===t?(i.removeClass("limit"),i.find("span").remove()):(i.find("span").html('<i class="fa fa-text-width"></i>('+t+")"),t>a?(i.addClass("limit"),i.find("span").addClass("limit")):(i.removeClass("limit"),i.find("span").removeClass("limit"))):0!==t&&(i.find(".label-text").append("<span class='text-counter-indicator'><i class='fa fa-text-width'></i>("+t+")</span>"),t>a&&(i.addClass("limit"),i.find("span").addClass("limit")))}function d(e){$("#"+e+"_id_meliscms_page_action_tabs").removeClass("relative"),$("#"+e+"_id_meliscms_page_action_tabs li.btn-disabled").remove(),$("#"+e+"_id_meliscms_page .overlay-switch").remove()}return window.scrollToViewTinyMCE=function(t,i){if(e=$(window).scrollTop(),!t||!i)return e;var a=i/2-t;$("html, body").animate({scrollTop:a},300)},window.scrollOffsetTinyMCE=function(){return e},$(".sub-section").on("click",function(){var e=$(this);e.next(".cms-next").is(":visible")?e.next(".cms-next").hide():e.next(".cms-next").show()}),t.on("click",".tox-tbtn",function(){if($("#mce-modal-block").length)if($("iframe.melis-iframe").length){$("iframe.melis-iframe").position().top,$("iframe.melis-iframe").height();var e=screen.height;bodyOffsetTop=$(window)[0].scrollHeight;var t=$(".mce-window").outerHeight(),i=bodyOffsetTop+e-t;$(".mce-floatpanel.mce-window").css("top",i),$("html, body").animate({scrollTop:i},300)}else $("#mce-modal-block").css("z-index",1049),$(".mce-floatpanel.mce-window").css("z-index",1050)}),melisCore.screenSize>=768&&(jQuery(window).scroll(function(){var e=0;$("body").hasClass("sidebar-mini")||(e=$("#id_meliscore_leftmenu").outerWidth());var i=$("#"+activeTabId+" div.page-title").outerHeight();jQuery(window).scrollTop()>i&&melisCore.screenSize>1120?($("#"+activeTabId+" .page-head-container").css("padding-top","72px"),$("#"+activeTabId+" .page-head-container > .innerAll").addClass("sticky-pageactions"),$("#"+activeTabId+" .page-head-container > .innerAll").css({width:t.width()-e,left:e})):($("#"+activeTabId+" .page-head-container").removeAttr("style"),$("#"+activeTabId+" .page-head-container > .innerAll").removeClass("sticky-pageactions"),$("#"+activeTabId+" .page-head-container > .innerAll").removeAttr("style"))}),$("body.show-breadcrumb.show-nav-tabs").scroll(function(){var e=0;$("body").hasClass("sidebar-mini")||(e=$("#id_meliscore_leftmenu").outerWidth());var i=$("#"+activeTabId+" div.page-title"),a=$("#"+activeTabId+" div[data-meliskey='meliscms_pagehead_title']");i.length&&(i=Math.abs(i.offset().top)),a.length&&(a=$("#"+activeTabId+" div[data-meliskey='meliscms_pagehead_title']").offset().top);$("#"+activeTabId+" div.page-title").outerHeight();a<=0&&melisCore.screenSize>1120?($("#"+activeTabId+" .page-head-container").css("padding-top","61px"),$("#"+activeTabId+" .page-head-container > .innerAll").addClass("sticky-pageactions"),$("#"+activeTabId+" .page-head-container > .innerAll").css({width:t.width()-e,left:e})):($("#"+activeTabId+" .page-head-container").removeAttr("style"),$("#"+activeTabId+" .page-head-container > .innerAll").removeClass("sticky-pageactions"),$("#"+activeTabId+" .page-head-container > .innerAll").removeAttr("style"))})),t.on("click",".melis-newpage",function(){var e=$(this).data("pagenumber");melisHelper.tabClose("0_id_meliscms_page"),melisHelper.tabOpen(translations.tr_meliscms_page_creation,"fa-file-o","0_id_meliscms_page","meliscms_page_creation",{idPage:0,idFatherPage:e})}),t.on("click",".melis-savepage",s),t.on("click",".melis-clearpage",function(){var e=$(this).data(),t=e.pagenumber,i=(activeTabId,e.confirmmsg);melisCoreTool.confirm(translations.tr_meliscms_page_action_clear,translations.tr_meliscms_menu_cancel,translations.tr_meliscms_delete_saved_page_title,i,function(){$.ajax({type:"GET",url:"/melis/MelisCms/Page/clearSavedPage?idPage="+t,encode:!0}).done(function(e){1===e.success?(melisHelper.melisOkNotification(e.textTitle,e.textMessage,"#72af46"),melisCms.refreshTreeview(t),melisCore.flashMessenger(),melisHelper.zoneReload(t+"_id_meliscms_page","meliscms_page",{idPage:t},()=>{window.parent.loader.addActivePageEditionLoading(t+"_id_meliscms_page")})):melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors,"#000")}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})})}),t.on("click",".melis-publishpage",n),t.on("click",".melis-unpublishpage",r),t.on("click",".melis-deletepage",function(){var e=$(this).data().pagenumber,t=activeTabId,i=$(this).attr("disabled");void 0!==i&&!1!==i||melisCoreTool.confirm(translations.tr_meliscms_menu_delete,translations.tr_meliscms_menu_cancel,translations.tr_meliscms_delete_confirmation,translations.tr_meliscms_delete_confirmation_msg,function(){melisCms.refreshTreeview(e),$.ajax({url:"/melis/MelisCms/Page/deletePage?idPage="+e,encode:!0}).done(function(e){1===e.success?(melisHelper.tabClose(t),melisHelper.melisOkNotification(e.textTitle,e.textMessage,"#72af46"),melisCore.flashMessenger()):melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors,"#000")}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})})}),t.on("click",".display-settings",function(){var e=0,t=$(this).data("display");$(".displaysettingsicon span.fa").removeClass(),$(".displaysettingsicon span:first-child").addClass(t),e="fa fa-desktop"===t?"100%":"fa fa-tablet"===t?"980px":"480px",$(this).parents(".page-head-container").next(".page-content-container").find(".melis-iframe").animate({width:e},300,function(){$("#"+activeTabId+" .melis-iframe").css("height","1000px");var e=$("#"+activeTabId+" .melis-iframe").contents().height()+50;$("#"+activeTabId+" .melis-iframe").css("height",e)})}),t.on("switch-change",".page-publishunpublish",function(e,t){var i=$(this).data("pagenumber").toString();!0===t.value?n(i):r(i)}),t.on("keyup keydown change","form[name='pageseo'] input[name='pseo_meta_title']",{limit:70},l),t.on("keyup keydown change","form[name='pageseo'] textarea[name='pseo_meta_description']",{limit:160},l),t.on("shown.bs.tab",".page-content-container .widget-head.nav ul li a",function(){$("form[name='pageseo'] input[name='pseo_meta_title']").trigger("keyup"),$("form[name='pageseo'] input[textarea='pseo_meta_description']").trigger("keyup");var e=$("#"+activeTabId+" .melis-iframe").contents().height();$("#"+activeTabId+" .melis-iframe").css("height",e)}),t.on("shown.bs.tab",".melis-refreshPageTable",function(){var e=$(this).parents(".melis-page-table-cont"),t=e.attr("id"),i=e.data("meliskey"),a=e.data("page-id");melisHelper.zoneReload(t,i,{idPage:a})}),t.on("click",".page-content-container .widget-head.nav ul li a.history, .page-content-container .widget-head.nav ul li a.more_windows",function(){var e=$(this).attr("href"),t=$(e);melisCore.screenSize<=767&&t.find(".melis-refreshPageTable").trigger("click")}),t.on("#melis-id-nav-bar-tabs [data-tool-meliskey='meliscms_page'] .tab-element",function(){var e=$(this),t=$("#"+e.data("id")).find(".iframe-container .tab-content .melis-iframe"),i=t.contents()[0].body.scrollHeight;t.css("height",i)}),{savePage:s,publishPage:n,unpublishPage:r,refreshTreeview:o,disableCmsButtons:function(e){$("#"+e+"_id_meliscms_page .page-publishunpublish").append("<div class='overlay-switch' style='width: 100%;height: 100%;position: absolute;top: 0;left: 0;z-index: 99999999;cursor: wait; '></div>"),$("#"+e+"_id_meliscms_page_action_tabs").addClass("relative").prepend("<li class='btn-disabled'></li>")},enableCmsButtons:d,iframeLoad:function(e){$("body");var t=$("#"+e+"_id_meliscms_page").find(".melis-iframe"),a=t.contents().height();t.closest(".meliscms-page-tab-edition").find("#loader"),t.css("height",a),t.css("min-height","700px"),d(e),window.parent.loader.removeActivePageEditionLoading(e+"_id_meliscms_page"),i=[],$.ajax({url:"/melis/MelisCms/TreeSites/canEditPages",encode:!0}).done(function(e){var t=$("#id-mod-menu-dynatree").fancytree("getTree");0===e.edit?($(".meliscms-search-box.sidebar-treeview-search").hide(),$("#id-mod-menu-dynatree").prepend("<div class='create-newpage'><span class='no-access'>"+translations.tr_meliscms_no_access+"</span></div>")):0===t.count()?($(".meliscms-search-box.sidebar-treeview-search").hide(),$("#id-mod-menu-dynatree").prepend("<div class='create-newpage'><span class='btn btn-success'>"+translations.tr_meliscms_create_page+"</span></div>")):($(".meliscms-search-box.sidebar-treeview-search").show(),$("#id-mod-menu-dynatree .create-newpage").remove())}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)}),$.ajax({url:"/melis/MelisCms/Page/isActionActive?actionwanted=save",encode:!0}).done(function(e){0===e.active?$("body").addClass("disable-create"):$("body").removeClass("disable-create")}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)}),$.ajax({url:"/melis/MelisCms/Page/isActionActive?actionwanted=delete",encode:!0}).done(function(e){0===e.active?$("body").addClass("disable-delete"):$("body").removeClass("disable-delete")}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})},pageTabOpenCallback:function(e){i.push(e)}}}();$(function(){$("#pageIdRootMenu").parents(".form-group").find("label").addClass("d-flex flex-row justify-content-between")}),function(e,t,i){var a=e("body");e(t).on("load",function(){t.mainTree=function(t){var i,a=e("#tab-arrow-top");i=melisCore.screenSize<=767?["contextMenu","filter","glyph"]:["contextMenu","dnd","filter","glyph","persist"],e("#id-mod-menu-dynatree").fancytree({extensions:i,glyph:{map:{loading:"fa fa-spinner fa-pulse"}},persist:{cookiePrefix:"fancytree-1-",expandLazy:!0,overrideSource:!0,store:"auto"},activeVisible:!1,debugLevel:0,autoScroll:!0,generateIds:!0,idPrefix:"mt_",tabindex:"",toggleEffect:{height:"toggle",duration:250},source:{url:"/melis/MelisCms/TreeSites/get-tree-pages-by-page-id",cache:!0},contextMenu:{menu:{new:{name:translations.tr_meliscms_menu_new,icon:"paste"},edit:{name:translations.tr_meliscms_menu_edit,icon:"edit"},delete:{name:translations.tr_meliscms_menu_delete,icon:"delete"},dupe:{name:translations.tr_meliscms_menu_dupe,icon:"copy"},export:{name:translations.tr_melis_cms_tree_export_page,icon:"export"},import:{name:translations.tr_melis_cms_page_tree_import,icon:"import"}},actions:function(t,i,a){if("new"===i){var s=t.data;melisHelper.tabClose("0_id_meliscms_page"),melisHelper.tabOpen(translations.tr_meliscms_page_creation,"fa-file-text-o","0_id_meliscms_page","meliscms_page_creation",{idPage:0,idFatherPage:s.melisData.page_id})}if("edit"===i){s=t.data;melisHelper.tabOpen(s.melisData.page_title,s.iconTab,s.melisData.item_zoneid,s.melisData.item_melisKey,{idPage:s.melisData.page_id})}if("delete"===i){var n=(s=t.data).melisData.item_zoneid,r=s.melisData.page_id,o="root_1"==t.getParent().key?-1:t.getParent().key,l=(e("#leftResetTreeView"),e(".tabsbar a[data-id='"+n+"']").parent("li"));melisCoreTool.confirm(translations.tr_meliscms_menu_delete,translations.tr_meliscms_menu_cancel,translations.tr_meliscms_delete_confirmation,translations.tr_meliscms_delete_confirmation_msg,function(){melisCms.refreshTreeview(o,1),e.ajax({url:"/melis/MelisCms/Page/deletePage?idPage="+r,encode:!0}).done(function(e){1===e.success?(1===l.length&&melisHelper.tabClose(n),melisHelper.melisOkNotification(e.textTitle,e.textMessage,"#72af46"),melisCore.flashMessenger()):melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors,"#000")}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})})}if("dupe"===i){s=t.data;n="id_meliscms_tools_tree_modal_form_handler",melisKey="meliscms_tools_tree_modal_form_handler",d="melis/MelisCms/TreeSites/renderTreeSitesModalContainer",melisHelper.createModal(n,melisKey,!1,{sourcePageId:s.melisData.page_id},d,function(){})}if("export"===i||"import"===i){var d="/melis/MelisCms/Page/renderPageExportImportModalHandler";s=t.data;"export"===i?melisHelper.createModal("id_meliscms_page_export_modal","meliscms_page_export_modal",!0,{pageId:s.melisData.page_id},d,function(){}):melisHelper.createModal("id_meliscms_page_import_modal","meliscms_page_import_modal",!0,{pageId:s.melisData.page_id},d,function(){})}}},lazyLoad:function(e,t){var i=t.node.data.melisData.page_id;t.result={url:"/melis/MelisCms/TreeSites/get-tree-pages-by-page-id?nodeId="+i,data:{mode:"children",parent:t.node.key},cache:!1}},create:function(t,i){melisHelper.loadingZone(e("#treeview-container"))},init:function(t,i,a){melisHelper.removeLoadingZone(e("#treeview-container")),e("input[name=left_tree_search]").trigger("focus"),0===e("#id-mod-menu-dynatree").fancytree("getTree").count()?(e(".meliscms-search-box.sidebar-treeview-search").hide(),e.get("/melis/MelisCms/TreeSites/checkUserPageTreeAccress",{idPage:-1},function(t){t.isAccessible&&e("#id-mod-menu-dynatree").prepend("<div class='create-newpage'><span class='btn btn-success'>"+translations.tr_meliscms_create_page+"</span></div>")})):(e(".meliscms-search-box.sidebar-treeview-search").show(),e("#id-mod-menu-dynatree .create-newpage").remove())},click:function(t,i){if(targetType=i.targetType,"title"===targetType&&(i.node.setExpanded(),melisCore.screenSize<=1024)){var s=(i=i.node.data).melisData.page_id+" - "+i.melisData.page_title;melisHelper.tabOpen(s,i.iconTab,i.melisData.item_zoneid,i.melisData.item_melisKey,{idPage:i.melisData.page_id},null,()=>{melisCms.pageTabOpenCallback(i.melisData.page_id),loader.addActivePageEditionLoading(i.melisData.item_zoneid)})}e(".hasNiceScroll").getNiceScroll().resize(),a.length&&a.removeClass("hide-arrow")},dblclick:function(t,i){var a=(i=i.node.data).melisData.page_id+" - "+i.melisData.page_title;return melisHelper.tabOpen(a,i.iconTab,i.melisData.item_zoneid,i.melisData.item_melisKey,{idPage:i.melisData.page_id},null,()=>{melisCms.pageTabOpenCallback(i.melisData.page_id),loader.addActivePageEditionLoading(i.melisData.item_zoneid)}),e(".hasNiceScroll").getNiceScroll().resize(),!1},loadChildren:function(e,t){},renderNode:function(t,i){e(i.node.span).find(".fancytree-icon").addClass(i.node.data.iconTab).removeClass("fancytree-icon"),"loading"!==i.node.statusNodeType&&(0===i.node.data.melisData.page_is_online&&e(i.node.span).find(".fancytree-title, .fa").css("color","#686868"),1===i.node.data.melisData.page_has_saved_version&&0==e(i.node.span).children("span").hasClass("unpublish")&&e(i.node.span).find(".fancytree-title").before("<span class='unpublish'></span>"))},dnd:{autoExpandMS:400,smartRevert:!0,refreshPositions:!0,draggable:{zIndex:1e3,scroll:!1,appendTo:"body"},dragStart:function(t,i){var a=e("#leftLockDragDropTreeView .fa-lock").length;return melisCore.screenSize>=1024&&0===a&&!!i.node.data.dragdrop},dragEnter:function(e,t){return!0},dragOver:function(e,t){},dragLeave:function(e,t){},dragStop:function(e,t){},dragDrop:function(t,i){t.setExpanded(!0).always(function(){var a=i.otherNode.getParent().key.toString().includes("root")?-1:i.otherNode.getParent().key;i.otherNode.moveTo(t,i.hitMode);e("#id-mod-menu-dynatree").fancytree("getTree");var s=i.otherNode.key,n=t.getParent().key.toString().includes("root")?-1:t.getParent().key;"over"==i.hitMode&&(n=i.node.key);var r={idPage:s,oldFatherIdPage:a,newFatherIdPage:n,newPositionIdPage:i.otherNode.getIndex()+1};e.ajax({url:"/melis/MelisCms/Page/movePage",data:r,encode:!0}).done(function(e){}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})})}}})},mainTree()}),a.on("click","#id-mod-menu-dynatree .create-newpage .btn",function(){melisHelper.tabOpen(translations.tr_meliscms_page_creation,"fa-file-text-o","0_id_meliscms_page","meliscms_page_creation",{idPage:0,idFatherPage:"-1"})}),a.on("click","#sourcePageIdFindPageTree .input-button-hover-pointer",function(){melisLinkTree.createInputTreeModal("#sourcePageId")}),a.on("click","#destinationPageIdFindPageTree .input-button-hover-pointer",function(){melisLinkTree.createInputTreeModal("#destinationPageId")}),a.on("click",'button[data-inputid="#destinationPageId"]',function(){e('[name="use_root"]').each(function(){e(this).is(":checked")&&e(this).prop("checked",!1)}),e(".remember-me-cont .cbmask-inner").removeClass("cb-active"),e("#destinationPageId").prop("disabled",!1)}),a.on("change",'[name="use_root"]',function(){e('[name="use_root"]:checked').length?(e("#destinationPageId").val(""),e("#destinationPageId").prop("disabled",!0)):e("#destinationPageId").prop("disabled",!1)}),t.treeCallBack=function(){0==e("#id-mod-menu-dynatree").children().length&&mainTree()},a.on("click","#duplicatePageTree",function(){var t=e("#duplicatePageTreeForm").serializeArray(),i=e('#duplicatePageTreeForm input[name="destinationPageId"]').val();melisCoreTool.pending("#duplicatePageTree"),e("#duplicatePageTree").find("i").removeClass(),e("#duplicatePageTree").find("i").addClass("fa fa-spinner fa-spin"),e.ajax({type:"POST",url:"/melis/MelisCms/TreeSites/duplicateTreePage",data:t,dataType:"json",encode:!0}).done(function(t){t.success?(e("#id_meliscms_tools_tree_modal_form_handler_container").modal("hide"),melisCms.refreshTreeview(i,1),melisHelper.melisOkNotification(t.textTitle,t.textMessage)):(melisHelper.melisKoNotification(t.textTitle,t.textMessage,t.errors),melisCoreTool.highlightErrors(t.success,t.errors,"duplicatePageTreeForm")),melisCore.flashMessenger(),melisCoreTool.done("#duplicatePageTree"),e("#duplicatePageTree").find("i").removeClass(),e("#duplicatePageTree").find("i").addClass("fa fa-save")}).fail(function(){alert(translations.tr_meliscore_error_message)})})}(jQuery,window),$(document).ready(function(){var e=$("body");e.on("click",".btnEditTemplates",function(){var e=$(this).parents("tr").attr("id");melisCoreTool.hideAlert("#templateupdateformalert"),melisCoreTool.showOnlyTab("#modal-template-manager-actions","#id_modal_tool_template_edit"),toolTemplate.retrieveTemplateData(e)}),e.on("click",".btnDelTemplate",function(){var e=$(this).parents("tr").attr("id");toolTemplate.deleteTemplate(e)}),e.on("click","#id_meliscms_tool_templates_header_add",function(){melisCoreTool.hideAlert("#templateaddformalert"),melisCoreTool.resetLabels("#id_modal_tool_template_add #id_tool_template_generic_form")}),e.on("click","#btnTemplateUpdate",function(){toolTemplate.updateTemplate()}),e.on("click",".btnMelisTemplatesExport",function(){var e=$("input[type='search'][aria-controls='tableToolTemplateManager']").val(),t=$("#templatesSiteSelect").val();melisCoreTool.isTableEmpty("tableToolTemplateManager")||melisCoreTool.exportData("/melis/MelisCms/ToolTemplate/exportToCsv?filter="+e+"&site="+t)}),e.on("change","#templatesSiteSelect",function(){var e=$(this).parents().eq(6).find("table").attr("id");$("#"+e).DataTable().ajax.reload()})});var toolTemplate={table:function(){return"#tableToolTemplate"},initTool:function(){melisCoreTool.initTable(toolTemplate.table())},refreshTable:function(){melisCoreTool.switchTab("#id_modal_tool_template_add"),melisHelper.zoneReload("id_meliscms_tool_templates","meliscms_tool_templates")},addNewTemplate:function(){var e=$("#id_modal_tool_template_add #id_tool_template_generic_form").serialize();melisCoreTool.pending("#btnTemplateAdd"),$.ajax({type:"POST",url:"/melis/MelisCms/ToolTemplate/newTemplateData",data:e,dataType:"json",encode:!0}).done(function(e){e.success?($("#modal-template-manager-actions").modal("hide"),toolTemplate.refreshTable(),melisCoreTool.clearForm("id_tool_template_generic_form"),melisHelper.melisOkNotification(e.textTitle,e.textMessage)):(melisCoreTool.alertDanger("#templateaddformalert","",e.textMessage),melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors),melisCoreTool.highlightErrors(e.success,e.errors,"id_modal_tool_template_add #id_tool_template_generic_form")),melisCore.flashMessenger(),melisCoreTool.done("#btnTemplateAdd")}).fail(function(){alert(translations.tr_meliscore_error_message)})},updateTemplate:function(){var e=$("#id_modal_tool_template_edit #id_tool_template_generic_form").serializeArray();e.push({name:"tpl_id",value:$("#tplid").html()}),e=$.param(e),melisCoreTool.resetLabels("#id_modal_tool_template_edit #id_tool_template_generic_form"),melisCoreTool.pending("#btnTemplateEdit"),$.ajax({type:"POST",url:"/melis/MelisCms/ToolTemplate/updateTemplateData",data:e,dataType:"json",encode:!0}).done(function(e){e.success?($("#modal-template-manager-actions").modal("hide"),toolTemplate.refreshTable(),melisCoreTool.clearForm("id_tool_template_generic_form"),melisCoreTool.resetLabels("#id_tool_template_generic_form"),melisHelper.melisOkNotification(e.textTitle,e.textMessage)):(melisCoreTool.alertDanger("#templateupdateformalert","",e.textMessage),melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors),melisCoreTool.highlightErrors(e.success,e.errors,"id_tool_template_generic_form")),melisCore.flashMessenger(),melisCoreTool.done("#btnTemplateEdit")}).fail(function(){alert(translations.tr_meliscore_error_message)})},retrieveTemplateData:function(e){var t="#id_modal_tool_template_edit form#id_tool_template_generic_form ";melisCoreTool.resetLabels(t),$.ajax({type:"POST",url:"/melis/MelisCms/ToolTemplate/getTemplateDataById",data:{templateId:e},dataType:"json",encode:!0}).done(function(e){$.each(e,function(e,i){if($(t+" input, "+t+" select").each(function(e){var a=$(this).attr("name");$(t+" #"+$(this).attr("id")).val(i[a]),$("#tplid").html(i.tpl_id)}),i.tpl_type_KO){var a=$("#id_modal_tool_template_edit #tpl-type-error");a.show(),a.parent("label").css("color","rgb(255, 0, 0)")}})}).fail(function(){alert(translations.tr_meliscore_error_message)})},deleteTemplate:function(e){melisCoreTool.confirm(translations.tr_meliscore_common_yes,translations.tr_meliscore_common_no,translations.tr_tool_template_fm_delete_title,translations.tr_tool_template_fm_delete_confirm,function(){$.ajax({type:"POST",url:"/melis/MelisCms/ToolTemplate/deleteTemplateData",data:{templateId:e},dataType:"json",encode:!0}).done(function(e){melisCoreTool.pending(".delTemplate"),e.success&&(toolTemplate.refreshTable(),melisCore.flashMessenger(),melisHelper.melisOkNotification(e.textTitle,e.textMessage)),melisCoreTool.done(".delTemplate")}).fail(function(){alert(translations.tr_meliscore_error_message)})})}};window.initTemplateList=function(e,t){var i=$("#templatesSiteSelect");i.length&&(e.tpl_site_id=i.val())},$(function(){var e="#formplatformedit form#idformlang";function t(e,t){$("body").on("click",e,t)}t("#btn_cms_new_lang",function(){melisCoreTool.showOnlyTab("#modal-language-cms","#id_meliscms_tool_language_modal_content_new"),melisCoreTool.clearForm("idformlang")}),t("#btnLangCmsAdd",function(){var e=$(this).parent().find("#idformlang").serialize();melisCoreTool.pending("#btnLangCmsAdd"),melisCoreTool.processing(),$.ajax({type:"POST",url:"/melis/MelisCms/Language/addLanguage",data:e,dataType:"json",encode:!0}).done(function(e){e.success?($("#modal-language-cms").modal("hide"),melisHelper.zoneReload("id_meliscms_tool_language","meliscms_tool_language"),melisHelper.melisOkNotification(e.textTitle,e.textMessage)):(melisCoreTool.alertDanger("#languagealert","",e.textMessage),melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors),melisCoreTool.highlightErrors(e.success,e.errors,"idformlang")),melisCoreTool.done("#btnLangCmsAdd"),melisCore.flashMessenger(),melisCoreTool.processDone()}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})}),t("#btnLangCmsEdit",function(){melisCoreTool.showOnlyTab("#modal-language-cms","#id_meliscms_tool_language_modal_content_edit");var t=$(this).parents("tr").attr("id");$.ajax({type:"POST",url:"/melis/MelisCms/Language/getLanguageById",data:{id:t},dataType:"json",encode:!0}).done(function(t){melisCoreTool.pending(".btn"),$(e+" input[type='text']").each(function(e){var i=$(this).attr("name");$("input#"+$(this).attr("id")).val(t.language[i]),$("span#platformupdateid").html(t.language.lang_cms_id)}),melisCoreTool.done(".btn")}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})}),t("#btnLangEdit",function(){var t=$(e).serializeArray();t.push({name:"id",value:$("#platformupdateid").html()}),t=$.param(t),melisCoreTool.pending("#btnLangEdit"),melisCoreTool.processing(),$.ajax({type:"POST",url:"/melis/MelisCms/Language/editLanguage",data:t,dataType:"json",encode:!0}).done(function(e){e.success?($("#modal-language-cms").modal("hide"),melisHelper.zoneReload("id_meliscms_tool_language","meliscms_tool_language"),melisHelper.melisOkNotification(e.textTitle,e.textMessage)):(melisCoreTool.alertDanger("#langeditalert","",e.textMessage),melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors),melisCoreTool.highlightErrors(e.success,e.errors,"formplatformedit form#idformlang")),melisCoreTool.done("#btnLangEdit"),melisCore.flashMessenger(),melisCoreTool.processDone()}).fail(function(){alert(translations.tr_meliscore_error_message)})}),t("#btnLangCmsDelete",function(){var e=$(this).parents("tr").attr("id");melisCoreTool.confirm(translations.tr_meliscms_common_yes,translations.tr_meliscore_common_no,translations.tr_meliscms_tool_language,translations.tr_meliscms_tool_language_delete_confirm,function(){$.ajax({type:"POST",url:"/melis/MelisCms/Language/deleteLanguage",data:{id:e},dataType:"json",encode:!0}).done(function(e){melisCoreTool.pending(".btn-danger"),e.success?(melisHelper.zoneReload("id_meliscms_tool_language_content","meliscms_tool_language_content"),melisHelper.zoneReload("id_meliscms_header_language","meliscms_header_language"),melisHelper.melisOkNotification(e.textTitle,e.textMessage)):melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors),melisCore.flashMessenger(),melisCoreTool.done(".btn-danger")}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})})})}),window.initLangJs=function(){$('#tableLanguages td:nth-child(3):contains("'+melisLangId+'")').siblings(":last").html("-")},$(function(){var e=$("body");e.on("click",".btnCmsPlatfomEdit",function(){var e=$(this).parents("tr").attr("id");modalId="platform_tool_modal",platform_modal_content="meliscms_tool_platform_ids_modal_content",modalUrl="/melis/MelisCms/Platform/renderPlatformModal",melisHelper.createModal(modalId,platform_modal_content,!1,{id:e},modalUrl)}),e.on("click",".btnSavePlatfomrRange",function(){var e=$(this).data("id"),t=$("#idformplatform").serializeArray();t.push({name:"pids_id",value:e}),t=$.param(t),$("#cmsPlatformAlert").addClass("hidden"),$.ajax({type:"POST",url:"/melis/MelisCms/Platform/savePlatformIdsRange",data:t,dataType:"json",encode:!0}).done(function(e){e.success?($("#platform_tool_modal_container").modal("hide"),melisHelper.zoneReload("id_meliscms_tool_platform_ids","meliscms_tool_platform_ids"),melisHelper.melisOkNotification(e.textTitle,e.textMessage)):(melisCoreTool.alertDanger("#cmsPlatformAlert","",e.textMessage),melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors)),melisCore.flashMessenger(),melisCoreTool.highlightErrors(e.success,e.errors,"idformplatform")}).fail(function(e,t,i){alert("ERROR !! Status = "+t+"\n Error = "+i+"\n xhr = "+e.statusText)})}),e.on("click","#id_meliscms_tool_platform_ids_add_button",function(){modalId="platform_tool_modal",platform_modal_content="meliscms_tool_platform_ids_modal_content",modalUrl="/melis/MelisCms/Platform/renderPlatformModal",melisHelper.createModal(modalId,platform_modal_content,!1,null,modalUrl)}),e.on("click",".btnCmsPlatformIdsDelete",function(){var e=$(this).parents("tr").attr("id"),t=new Array;t.push({name:"pid_id",value:e}),melisCoreTool.confirm(translations.tr_meliscore_common_yes,translations.tr_meliscore_common_no,translations.tr_meliscms_tool_platform_ids,translations.tr_meliscms_tool_platform_ids_confirm_msg,function(){$.ajax({type:"POST",url:"/melis/MelisCms/Platform/deletePlatformId",data:t,dataType:"json",encode:!0}).done(function(e){melisHelper.zoneReload("id_meliscms_tool_platform_ids","meliscms_tool_platform_ids"),melisHelper.melisOkNotification(e.textTitle,e.textMessage),melisCore.flashMessenger()}).fail(function(){alert(translations.tr_meliscore_error_message)})})}),window.initPlatformIdTbl=function(){$("#platformToolTable").find(".noPlatformIdDeleteBtn").each(function(){var e="#"+$(this).attr("id");$("#platformToolTable").find(e).find(".btnCmsPlatformIdsDelete").remove()})}}),$(function(){var e=$("body");e.on("click",".addRedirectSite",function(){var e=$(this).data("s301id");createSite301Modal(e)}),e.on("click",".editRedirectSite",function(){var e=$(this).parents("tr").attr("id");createSite301Modal(e)}),e.on("click",".saveSiteRedirect",function(){$(this).data("s301id");var e=new Array;e=$("#siteRedirectForm").serializeArray(),$.ajax({type:"POST",url:"/melis/MelisCms/SiteRedirect/saveSiteRedirect",data:e,dataType:"json",encode:!0}).done(function(e){e.success?($("#id_meliscms_tool_site_301_generic_form_container").modal("hide"),melisHelper.melisOkNotification(e.textTitle,e.textMessage),melisHelper.zoneReload("id_meliscms_tool_site_301_content","meliscms_tool_site_301_content")):melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors),melisCore.flashMessenger(),melisCoreTool.highlightErrors(e.success,e.errors,"siteRedirectForm")}).fail(function(){alert(translations.tr_meliscore_error_message)})}),e.on("click",".deleteRedirectSite",function(){var e=$(this).parents("tr").attr("id");melisCoreTool.confirm(translations.tr_meliscms_common_yes,translations.tr_meliscms_common_no,translations.tr_meliscms_tool_site_301_delete_site_redirect,translations.meliscms_tool_site_301_delete_confirm_msg,function(){$.ajax({type:"POST",url:"/melis/MelisCms/SiteRedirect/deleteSiteRedirect",data:{s301Id:e},dataType:"json",encode:!0}).done(function(e){e.success?(melisHelper.melisOkNotification(e.textTitle,e.textMessage),melisHelper.zoneReload("id_meliscms_tool_site_301_content","meliscms_tool_site_301_content")):melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors),melisCore.flashMessenger()}).fail(function(){alert(translations.tr_meliscore_error_message)})})}),e.on("click",".testRedirectSite",function(){var e=$(this).parents("tr").attr("id"),t=$("#tableToolSite301 tr#"+e+" td:nth-child(4)").text();""!==t?window.open(t,"_blank"):alert(translations.tr_meliscore_error_message)}),e.on("change","#redirectSiteSelect",function(){var e=$(this).parents().eq(6).find("table").attr("id");$("#"+e).DataTable().ajax.reload()})}),window.createSite301Modal=function(e){void 0===e&&(e=null),zoneId="id_meliscms_tool_site_301_generic_form",melisKey="meliscms_tool_site_301_generic_form",modalUrl="/melis/MelisCms/SiteRedirect/renderToolSiteRedirectModal",melisHelper.createModal(zoneId,melisKey,!1,{s301Id:e},modalUrl)},window.initRedirectTemplateList=function(e,t){$("#redirectSiteSelect").length&&(e.s301_site_id=$("#redirectSiteSelect").val())};var melisLinkTree=function(e,t){var i=e("body");function a(){var t=e("input[name=tree_search]").val(),i=e("#find-page-dynatree").fancytree("getTree"),a=i.filterNodes,s={};i.clearFilter(),e("#find-page-dynatree").fancytree("getRootNode").visit(function(e){e.resetLazy()}),e("input[name=tree_search]").prop("disabled",!0);var n=e("input[name=tree_search]").closest(".meliscms-search-box");n.addClass("searching"),e.ajax({type:"POST",url:"melis/MelisCms/Page/searchTreePages",data:{name:"value",value:t},dataType:"json",encode:!0}).done(function(r){if(e.trim(r)){var o=e.map(r,function(e){return e});i.loadKeyPath(o,function(e,n){if(!e.isVisible())switch(n){case"loaded":case"ok":e.makeVisible()}a.call(i,t,s)}).done(function(){e("input[name=tree_search]").prop("disabled",!1),n.removeClass("searching")})}else n.append("<div class='melis-search-overlay'>Not Found</div>").hide().fadeIn(600),setTimeout(function(){e(".melis-search-overlay").fadeOut(600,function(){e(this).remove()}),e("input[name=tree_search]").prop("disabled",!1),e("input[name=tree_search]").trigger("focus")},1e3)}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})}function s(i){var a=e("body"),s=a.find(".tox-dialog"),n=a.find("#mce-link-tree"),r=t.parent.$(".melis-iframe"),o=r.contents().find(".tox-dialog"),l=r.contents().find("#mce-link-tree");o.length&&l.parent().find("input").val(i),s.length&&n.parent().find("input").val(i)}function n(){zoneId="id_meliscms_find_page_tree",melisKey="meliscms_find_page_tree",modalUrl="melis/MelisCms/Page/renderPageModal",e("#id_meliscms_find_page_tree_container").length&&e("#id_meliscms_find_page_tree_container").parent().remove(),t.parent.melisHelper.createModal(zoneId,melisKey,!1,{},modalUrl,function(){}),e("#mce-link-tree").closest(".tox-dialog").css("z-index",1049),e(".tox-tinymce-aux").css("z-index",1048),e(".tox-tinymce-aux").find(".tox-dialog-wrap__backdrop").css("z-index",1047)}return i.on("click","#mce-link-tree",n),e(document).on("keyup","input[name=tree_search]",function(e){"13"==(e.keyCode?e.keyCode:e.which)&&a()}).focus(),i.on("click","#searchTreeView",function(e){a()}),i.on("click","#resetTreeView",function(t){melisHelper.loadingZone(e(".page-evolution-content")),e("input[name=tree_search]").val(""),e("#find-page-dynatree").fancytree("getTree").clearFilter(),e("#find-page-dynatree").fancytree("getRootNode").visit(function(e){e.setExpanded(!1)}),setTimeout(function(){melisHelper.removeLoadingZone(e(".page-evolution-content"))},2e3)}),i.on("click","#generateTreePageLink",function(){melisCoreTool.pending("#generateTreePageLink");var t=e("#find-page-dynatree .fancytree-active").parent("li").attr("id").split("_")[1];e.ajax({type:"GET",url:"melis/MelisCms/Page/getPageLink",data:{idPage:t},dataType:"json",encode:!0}).done(function(t){s(t.link),e("#id_meliscms_find_page_tree_container").modal("hide")}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)}),melisCoreTool.done("#generateTreePageLink")}),i.on("click","#generateTreePageId",function(){melisCoreTool.pending("#generateTreePageLink");var t=e("#find-page-dynatree .fancytree-active").parent("li").attr("id").split("_")[1],i=e("#generateTreePageId").data("inputid");e(i).val(t),e("#id_meliscms_input_page_tree_container").modal("hide"),melisCoreTool.done("#generateTreePageLink")}),{createTreeModal:n,createInputTreeModal:function(i){zoneId="id_meliscms_input_page_tree",melisKey="meliscms_input_page_tree",modalUrl="melis/MelisCms/Page/renderPageModal",e("#id_meliscms_input_page_tree_container").length&&e("#id_meliscms_input_page_tree_container").parent().remove(),t.parent.melisHelper.createModal(zoneId,melisKey,!1,{pageTreeInputId:i},modalUrl,function(){})},findPageMainTree:function(){e("#find-page-dynatree").fancytree({extensions:["filter"],keyboard:!0,generateIds:!0,idPrefix:"pageid_",source:{url:"/melis/MelisCms/TreeSites/get-tree-pages-by-page-id",cache:!0},lazyLoad:function(e,t){var i=t.node.data.melisData.page_id;t.result={url:"/melis/MelisCms/TreeSites/get-tree-pages-by-page-id?nodeId="+i,data:{mode:"children",parent:t.node.key},cache:!1}},renderNode:function(t,i){e(i.node.span).find(".fancytree-icon").addClass(i.node.data.iconTab).removeClass("fancytree-icon"),"loading"!==i.node.statusNodeType&&1===i.node.data.melisData.page_has_saved_version&&0==e(i.node.span).children("span").hasClass("unpublish")&&e(i.node.span).find(".fancytree-title").before("<span class='unpublish'></span>")},filter:{autoApply:!0,autoExpand:!1,counter:!0,fuzzy:!1,hideExpandedCounter:!0,hideExpanders:!1,highlight:!0,leavesOnly:!1,nodata:!0,mode:"dimm"}})},checkBtn:function(){i.find(".mce-has-open").prev().text(),i.find(".mce-has-open")[0],i.find(".mce-widget.mce-label").each(function(){if("Url"===e(this).text()){var t,a=i.find(".mce-btn.mce-open"),s=a.width()+1,n=e(this).next(),r=n.children(".mce-textbox");a.length?(t=r.width()-s,a.css({left:"0"}),r.css({width:t}),i.find(".mce-has-open").append('<div id="mce-link-tree" class="mce-btn mce-open" style="position: absolute; right: 0; width: 32px; height: 28px;"><button><i class="icon icon-sitemap fa fa-sitemap" style="font-family: FontAwesome; position: relative; top: 2px; font-size: 16px;"></i></button></div>')):(t=r.width()-32,r.css({width:t}),n.append('<div id="mce-link-tree" class="mce-btn mce-open" style="position: absolute; right: 0; width: 32px; height: 28px;"><button><i class="icon icon-sitemap fa fa-sitemap" style="font-family: FontAwesome; position: relative; top: 2px; font-size: 16px;"></i></button></div>'))}})},showUrl:s}}(jQuery,window);$(function(){$("body").on("click","a.melis-pageduplicate",function(){var e=$(this).data().pagenumber;$.ajax({type:"POST",url:"/melis/MelisCms/PageDuplication/duplicate-page",data:{id:e},dataType:"json",encode:!0}).done(function(e){if(e.success){if(melisCms.refreshTreeview(e.response.pageId),e.response.openPageAfterDuplicate){var t=e.response.pageId+" - "+e.response.name;melisHelper.tabOpen(t,e.response.icon,e.response.pageId+"_id_meliscms_page","meliscms_page",{idPage:e.response.pageId},null,()=>{loader.addActivePageEditionLoading(e.response.pageId+"_id_meliscms_page")})}melisHelper.melisOkNotification(e.textTitle,e.textMessage)}else melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors,0);melisCore.flashMessenger()}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})})});var melisSearchPageTree=function(e,t){var i=e("body");function a(){var t=e.trim(e("input[name=left_tree_search]").val()),i=e("#id-mod-menu-dynatree").fancytree("getTree"),a=i.filterNodes;if(t.length){var s={};e(".meliscms-search-box.sidebar-treeview-search").append("<div class='melis-overlay-loading'></div>"),i.clearFilter(),e("#id-mod-menu-dynatree").fancytree("getRootNode").visit(function(e){e.isExpanded()&&e.resetLazy()}),e("input[name=left_tree_search]").prop("disabled",!0);var n=e("input[name=left_tree_search]").closest(".meliscms-search-box");e.ajax({type:"POST",url:"melis/MelisCms/Page/searchTreePages",data:{name:"value",value:t},dataType:"json",encode:!0}).done(function(r){if(e.trim(r)){var o=e.map(r,function(e){return e});i.loadKeyPath(o,function(e,n){switch(n){case"loaded":case"ok":e.makeVisible()}a.call(i,t,s)}).done(function(){e("input[name=left_tree_search]").prop("disabled",!1),e(".meliscms-search-box.sidebar-treeview-search .melis-overlay-loading").remove(),e("input[name=left_tree_search]").focus()})}else n.append("<div class='melis-search-overlay'>"+translations.tr_meliscms_form_search_not_found+"</div>").hide().fadeIn(600),setTimeout(function(){e(".melis-search-overlay").fadeOut(600,function(){e(this).remove()}),e("input[name=left_tree_search]").prop("disabled",!1),e("input[name=left_tree_search]").focus(),e(".meliscms-search-box.sidebar-treeview-search .melis-overlay-loading").remove()},1e3)}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})}}i.on("click","#leftSearchTreeView",function(e){a()}),i.on("click","#leftLockDragDropTreeView",function(){var t,i=e(this),a=e("#leftResetTreeView"),s=i.find(".fa.fa-lock"),n=i.find(".fa.fa-unlock");a.trigger("click"),s.length&&(s.removeClass("fa-lock").addClass("fa-unlock"),i.attr("title",translations.tr_meliscms_menu_treeview_page_unlock),t=setInterval(function(){var i=e("#leftLockDragDropTreeView"),a=i.find(".fa.fa-unlock");a.length&&(setTimeout(function(){a.removeClass("fa-unlock").addClass("fa-lock"),i.attr("title",translations.tr_meliscms_menu_treeview_page_lock)},3e5),clearInterval(t))},3e4)),n.length&&(n.removeClass("fa-unlock").addClass("fa-lock"),i.attr("title",translations.tr_meliscms_menu_treeview_page_lock))}),e(document).on("keyup","input[name=left_tree_search]",function(e){"13"==(e.keyCode?e.keyCode:e.which)&&a()}),i.on("click","#leftResetTreeView",function(t){e("input[name=left_tree_search]").val(""),e("#id-mod-menu-dynatree").fancytree("destroy"),mainTree()}),e("#leftLockDragDropTreeView").attr("title",translations.tr_meliscms_menu_treeview_page_lock)}(jQuery,window);$(function(){var e=$("body");e.on("click",".pageLangCreate",function(){var e=$(this),t=e.data("pageid"),i=e.data("formid"),a=$("#"+i).serializeArray();e.attr("disabled",!0),$.ajax({type:"POST",url:"/melis/MelisCms/PageLanguages/createNewPageLangVersion",data:a,dataType:"json",encode:!0}).done(function(a){a.success?($.isEmptyObject(a.pageInfo)||(melisHelper.tabOpen(a.pageInfo.pageid+" - "+a.pageInfo.name,a.pageInfo.tabicon,a.pageInfo.id,a.pageInfo.meliskey,{idPage:a.pageInfo.pageid}),melisCms.refreshTreeview(a.pageInfo.pageid)),melisHelper.zoneReload(t+"_id_meliscms_page","meliscms_page",{idPage:t}),melisHelper.melisOkNotification(a.textTitle,a.textMessage)):(melisCoreTool.alertDanger("#cmsPlatformAlert","",a.textMessage),melisHelper.melisKoNotification(a.textTitle,a.textMessage,a.errors)),melisCore.flashMessenger(),melisCoreTool.highlightErrors(a.success,a.errors,i),e.attr("disabled",!1)}).fail(function(t,i,a){e.attr("disabled",!1),alert(translations.tr_meliscore_error_message)})}),e.on("click",".open-page-from-lan-tab",function(){var e=$(this).data();$.isEmptyObject(e)||melisHelper.tabOpen(e.pageid+" - "+e.name,e.tabicon,e.id,e.meliskey,{idPage:e.pageid})})}),$(function(){var e=$("body");e.on("click","#id_meliscms_tool_styles_header_add",function(){melisStyleTool.openToolModal(0)}),e.on("click",".btnEditStyles",function(){var e=$(this).closest("tr").attr("id");melisStyleTool.openToolModal(e)}),e.on("click","#saveStyleDetails",function(){$(this).data("style-id");var e=$("#stylesForm").serializeArray();melisStyleTool.saveStyleDetails(e)}),e.on("click",".btnDelStyle",function(){var e=$(this).closest("tr").attr("id");melisStyleTool.deleteStyle(e)}),e.on("click","#styleInputFindPageTree span",function(){melisLinkTree.createInputTreeModal("#id_style_page_id")})});var melisStyleTool=function(e,t){return{openToolModal:function(e){zoneId="id_meliscms_tool_styles_modal_form_handler",melisKey="meliscms_tool_styles_modal_form_handler",modalUrl="melis/MelisCms/ToolStyle/renderToolStyleModalContainer",melisHelper.createModal(zoneId,melisKey,!1,{styleId:e},modalUrl,function(){})},saveStyleDetails:function(t){melisCoreTool.pending("#saveStyleDetails"),e.ajax({type:"POST",url:"/melis/MelisCms/ToolStyle/saveStyleDetails",data:t,dataType:"json",encode:!0}).done(function(t){t.success?(e("#id_meliscms_tool_styles_modal_form_handler_container").modal("hide"),melisStyleTool.refreshTable(),melisHelper.melisOkNotification(t.textTitle,t.textMessage)):(melisHelper.melisKoNotification(t.textTitle,t.textMessage,t.errors),melisCoreTool.highlightErrors(t.success,t.errors,"stylesForm")),melisCore.flashMessenger(),melisCoreTool.done("#saveStyleDetails")}).fail(function(){alert(translations.tr_meliscore_error_message)})},deleteStyle:function(t){var i={styleId:t};melisCoreTool.pending(".btnDelStyle"),melisCoreTool.confirm(translations.tr_meliscms_common_yes,translations.tr_meliscms_common_no,translations.tr_meliscms_tool_styles_delete_title,translations.tr_meliscms_tool_styles_delete_details,function(){e.ajax({type:"POST",url:"/melis/MelisCms/ToolStyle/deleteStyle",data:i,dataType:"json",encode:!0}).done(function(e){melisCoreTool.done(".btnDelStyle"),e.success?(melisHelper.melisOkNotification(e.textTitle,e.textMessage),melisStyleTool.refreshTable()):melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors),melisCore.flashMessenger()}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})})},refreshTable:function(){melisHelper.zoneReload("id_meliscms_tool_styles_content","meliscms_tool_styles_content")}}}(jQuery,window);function formatBytes(e,t){if(0===e)return"0 Bytes";const i=t<0?0:t,a=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,a)).toFixed(i))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][a]}function waitForEl(e,t){var i=setInterval(function(){$jObject=$(e),$jObject.length<1||(clearInterval(i),t($jObject))},100)}$(function(){var e=$("body");e.on("change","#id_mcgdprbanner_site_id",function(){melisCoreTool.highlightErrors(1,null,"id_melis_cms_gdpr_banner_header"),melisHelper.zoneReload("id_melis_cms_gdpr_banner_details","melis_cms_gdpr_banner_details",{siteId:this.value}),this.value>0?e.find(".cms-gdpr-save").show():e.find(".cms-gdpr-save").hide()}),e.on("click",".cms-gdpr-save",function(){if(void 0===e.find(this).attr("disabled")){melisCoreTool.pending(".cms-gdpr-save");var t={},i=[],a=e.find("#cms_gdpr_banner_site_filter_form");a.length>0&&(t.filters={siteId:a.serializeArray()}),e.find(".mcms-gdpr-banner-language").each(function(t,a){i.push(e.find(a).data("langId"))});for(var s=[],n={},r=0;r<i.length;r++)(s=e.find("#id-cms-gdpr-banner-content-form-"+i[r])).length>0&&(n[i[r]]=s.serializeArray());t.bannerContent=n,$.ajax({type:"POST",url:"/melis/MelisCms/GdprBanner/saveBanner",data:t,dataType:"json",encode:!0}).done(function(t){t.success?(melisHelper.melisOkNotification(t.textTitle,t.textMessage),e.find("#id_mcgdprbanner_site_id").trigger("change")):(melisHelper.melisKoNotification(t.textTitle,t.textMessage,t.errors),melisCoreTool.highlightErrors(0,t.errors,"id_melis_cms_gdpr_banner")),melisCore.flashMessenger(),melisCoreTool.done(".cms-gdpr-save")}).fail(function(e,t,i){melisCoreTool.done(".cms-gdpr-save")})}})}),$(document).ready(function(){var e,t,i=$("body"),a="";function s(e){$(".page-export-progress prog_percent").text(e),$("div#exportImportProgressbar").attr("arial-valuenow",e).css("width",e+"%").parent().parent().removeClass("hidden")}i.on("click","#btn-export-pages",function(){var e=!0;melisCoreTool.pending("#btn-export-pages"),s(0),$(".page-export-form").addClass("hidden");var t=$("#pageExportForm").serializeArray();$.ajax({url:"/melis/MelisCms/PageExport/exportPage",data:t,type:"POST",dataType:"text",mimeType:"text/plain; charset=x-user-defined",beforeSend:function(){setTimeout(function(){s(20)},100)}}).done(function(t,a,n){var r;try{r=JSON.parse(t)}catch(i){e=!1,s(100);for(var o=n.getResponseHeader("fileName"),l=n.getResponseHeader("Content-Type"),d="",c=0;c<t.length;c++)d+=String.fromCharCode(255&t.charCodeAt(c));var _=new Uint8Array(d.length);for(c=0;c<d.length;c++)_[c]=d.charCodeAt(c);var m=new Blob([_],{type:l});saveAs(m,o),melisCore.flashMessenger(),melisHelper.melisOkNotification(translations.tr_melis_cms_tree_export_title,translations.tr_melis_cms_tree_export_notification_message,"#72af46")}e&&melisHelper.melisKoNotification(translations.tr_melis_cms_tree_export_page,"",[r.message]),i.find("#btn-export-pages").siblings("button.btn.btn-danger.pull-left").trigger("click"),melisCoreTool.done("#btn-export-pages")}).fail(function(e){melisCoreTool.done("#btn-export-pages")})}),i.on("click","#page-tree-import-test",function(){var t;melisCoreTool.pending("#page-tree-import-test"),a=i.find(".bootstrap-filestyle.input-group input").val(),(t=$("#id_meliscms_tree_sites_import_page_form")).unbind("submit"),t.on("submit",function(t){t.preventDefault();var s=new FormData(this);$.ajax({type:"POST",url:"/melis/MelisCms/PageImport/checkImportForm",data:s,cache:!1,contentType:!1,processData:!1,beforeSend:function(){i.find("#pageImportConsole").text(""),i.find("#pageImportConsole").css("display",""),i.find("#pageImportConsole").append("<p>"+translations.tr_melis_cms_page_tree_import_name_of_file+": "+a+"</p>"),i.find("#pageImportConsole").append("<p>"+translations.tr_melis_cms_page_tree_import_validated+': <span style="color: red;">'+translations.tr_meliscms_common_no+"</span></p>"),i.find("#pageImportConsole").append('<div id="pageImportProcessing"><p>'+translations.tr_melis_cms_page_tree_import_modal_processing+' <i class="fa fa-spinner fa-spin"></i></p></div>')}}).done(function(t){var a;t.success?(a=t.result,$.ajax({type:"POST",url:"/melis/MelisCms/PageImport/importTest",data:{formData:JSON.stringify(a)},beforeSend:function(){i.find("#pageImportConsole").animate({scrollTop:i.find("#pageImportConsole").get(0).scrollHeight},2e3)}}).done(function(e){if(e.success){i.find("#importPageForm").css("display","none"),i.find("#importPageValidated").css("display",""),i.find("#importPageValidated .tab-content .tab-pane").append("<p>"+translations.tr_melis_cms_page_tree_import_name_of_file+": "+a.page_tree_import.name+"</p>"),i.find("#importPageValidated .tab-content .tab-pane").append("<p>"+translations.tr_melis_cms_page_tree_import_validated+': <span style="color: green;">'+translations.tr_meliscms_common_yes+"</span></p>");var t='<button type="button" data-dismiss="modal" class="btn btn-danger pull-left">'+translations.tr_meliscms_tool_sites_cancel+"</button>",s='<button type="button" class="btn btn-success" id="page-tree-import">'+translations.tr_melis_cms_page_tree_import_file+"</button>";i.find("#importPageValidated .btn-container").append(t),i.find("#importPageValidated .btn-container").append(s)}else i.find("#pageImportConsole #pageImportProcessing").text(""),i.find("#pageImportConsole #pageImportProcessing").append("<p>"+translations.tr_melis_cms_page_tree_import_modal_processing_done+' <i style="color: green;" class="fa fa-check-circle"></i></p>'),i.find("#pageImportConsole").append('<p style="color: red;">'+translations.tr_melis_cms_page_tree_import_modal_errors+":</p>"),$.each(e.errors,function(e,t){i.find("#pageImportConsole").append('<p style="color: red;"> - '+t+"</p>")}),i.find("#pageImportConsole").animate({scrollTop:i.find("#pageImportConsole").get(0).scrollHeight},2e3);melisCoreTool.done("#page-tree-import-test")}).fail(function(e){melisCoreTool.done("#page-tree-import-test")}),e=t.result):(melisHelper.melisKoNotification(translations.tr_melis_cms_page_tree_import,"",t.errors),melisCoreTool.done("#page-tree-import-test"))}).fail(function(e){melisCoreTool.done("#page-tree-import-test")})}),t.submit()}),i.on("change","input[name=page_tree_import]",function(){var e=i.find("#page-import-max-file-size").val(),t=this.files[0].size;parseInt(t)>parseInt(e)?(melisCoreTool.pending("#page-tree-import-test"),melisHelper.melisKoNotification(translations.tr_melis_cms_page_tree_import,translations.tr_melis_cms_page_tree_error_file_size_exceeded+function(e,t){if(0===e)return"0 Bytes";const i=t<0?0:t,a=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,a)).toFixed(i))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][a]}(e,2),[])):melisCoreTool.done("#page-tree-import-test")}),i.on("click","#page-tree-import",function(){var a=$(this).closest("#id_meliscms_page_import_modal").data("pageid");melisCoreTool.confirm(translations.tr_melis_cms_page_tree_import_continue_and_import,translations.tr_meliscms_tool_sites_cancel,translations.tr_melis_cms_page_tree_import_modal_are_you_sure,translations.tr_melis_cms_page_tree_import_modal_are_you_sure_content,function(){melisCoreTool.pending("#page-tree-import"),$.ajax({type:"POST",url:"/melis/MelisCms/PageImport/importPage",data:{formData:JSON.stringify(e),pageid:a},beforeSend:function(){i.find("#pageImportConsole").css("display",""),i.find("#pageImportConsole").append("<p>"+translations.tr_melis_cms_page_tree_import_name_of_file+": "+e.page_tree_import.name+"</p>"),i.find("#pageImportConsole").append("<p>"+translations.tr_melis_cms_page_tree_import_validated+': <span style="color: red;">'+translations.tr_meliscms_common_no+"</span></p>"),i.find("#pageImportConsole").append('<div id="pageImportProcessing"><p>'+translations.tr_melis_cms_page_tree_import_modal_processing+' <i class="fa fa-spinner fa-spin"></i></p></div>')}}).done(function(a){var s,n,r='<button type="button" id="importPageDoneClose" data-dismiss="modal" class="btn btn-danger pull-left" style="margin-top: -15px; margin-left: -15px;">'+translations.tr_melis_cms_page_tree_import_close+"</button>";if(i.find("#importPageValidated").css("display","none"),i.find("#importPageDone").css("display",""),a.success){t=a.idsMap,i.find("#importPageDone .tab-content .tab-pane .main-error").append("<p>"+translations.tr_melis_cms_page_tree_import_name_of_file+": "+e.page_tree_import.name+"</p>"),i.find("#importPageDone .tab-content .tab-pane .main-error").append("<p>"+translations.tr_melis_cms_page_tree_import_result+': <span style="color: green;">'+translations.tr_melis_cms_page_tree_import_success+"</span></p>"),i.find("#importPageDone .tab-content .tab-pane .main-error").append("</br>");var o=translations.tr_melis_cms_page_tree_import_modal_done+"<br/>"+a.pagesCount+translations.tr_melis_cms_page_tree_import_modal_done2_p+" "+i.find(".pageImportModal").data("pagename")+" ("+i.find(".pageImportModal").data("pageid")+")";1==a.pagesCount&&(o=translations.tr_melis_cms_page_tree_import_modal_done+"<br/>"+a.pagesCount+translations.tr_melis_cms_page_tree_import_modal_done2_s+" "+i.find(".pageImportModal").data("pagename")+" ("+i.find(".pageImportModal").data("pageid")+")"),i.find("#importPageDone .tab-content .tab-pane .main-error").append(o),i.find("#importPageDone .tab-content .tab-pane .main-error").append("</br>"),i.find("#importPageDone .tab-content .tab-pane .main-error").append("</br>"),a.keepIds?i.find("#importPageDone .tab-content .tab-pane .main-error").append('<p><i style="color:red;">NOTE : </i>'+translations.tr_melis_cms_page_tree_import_file_final_message_csv_keep_ids+"</p>"):i.find("#importPageDone .tab-content .tab-pane .main-error").append('<p><i style="color:red;">NOTE : </i>'+translations.tr_melis_cms_page_tree_import_file_final_message_csv+"</p>"),i.find("#importPageDone .btn-container").append(r),melisCore.flashMessenger(),melisHelper.melisOkNotification(translations.tr_melis_cms_page_tree_import_title,translations.tr_melis_cms_page_tree_import_notification_message,"#72af46"),s=a.firstPage,optionalArg=void 0===n?0:n,$.ajax({url:"/melis/MelisCms/TreeSites/getPageIdBreadcrumb?idPage="+s+"&includeSelf="+optionalArg,encode:!0,dataType:"json"}).done(function(e){var t=[];$.each(e,function(e,i){t.push("/"+i)}),t=(t=t.toString()).replace(/,/g,"");var i=$("#id-mod-menu-dynatree").fancytree("getTree");i.reload({url:"/melis/MelisCms/TreeSites/get-tree-pages-by-page-id"}).done(function(){i.loadKeyPath(t,function(e,t){"ok"==t&&e.setActive(!0).done(function(){e.setExpanded(!0)})}).done(function(){i.clearFilter(),!1===$("#id-mod-menu-dynatree .ui-fancytree > li:last-child").hasClass("fancytree-lastsib")&&$("#id-mod-menu-dynatree .ui-fancytree > li:last-child").remove()})})}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)}),0!=t&&$.ajax({type:"POST",url:"/melis/MelisCms/PageImport/exportCsv",data:{idsMap:t},success:function(e,t,i){if(e){var a=i.getResponseHeader("fileName"),s=i.getResponseHeader("Content-Type"),n=new Blob([i.responseText],{type:s});saveAs(n,a)}}})}else i.find("#importPageDone .tab-content .tab-pane .main-error").append("<p>"+translations.tr_melis_cms_page_tree_import_name_of_file+": "+e.page_tree_import.name+"</p>"),i.find("#importPageDone .tab-content .tab-pane .main-error").append("<p>"+translations.tr_melis_cms_page_tree_import_result+': <span style="color: red;">'+translations.tr_melis_cms_page_tree_import_failed+"</span></p>"),i.find("#importPageDone .tab-content .tab-pane .main-error").append("</br>"),i.find("#importPageDone .tab-content .tab-pane .main-error").append(translations.tr_melis_cms_page_tree_import_modal_unexpected_errors+translations.tr_melis_cms_page_tree_import_modal_unexpected_errors2+"</br>"+translations.tr_melis_cms_page_tree_import_modal_unexpected_error_detail+"</br>"),i.find("#pageImportDoneConsole").css("display",""),$.each(a.errors,function(e,t){i.find("#importPageDone #pageImportDoneConsole").append('<p style="color: red;"> - '+t+"</p>")}),i.find("#importPageDone .btn-container").append(r);melisCoreTool.done("#page-tree-import")}).fail(function(){melisCoreTool.done("#page-tree-import")})})}),i.on("click",".page-import-cont input[type=checkbox]",function(){var e=$(this);e.is(":checked")?(e.prop("checked",!0),e.prev("span").find(".cbmask-inner").addClass("cb-active")):(e.not(".requried-module").prop("checked",!1),e.parents(".page-import-cont").find(".cbmask-inner").removeClass("cb-active"))})}),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e,t){"use strict";if(!e.jstree){var i,a,s=0,n=!1,r=!1,o=!1,l=[],d=e("script:last").attr("src"),c=window.document,_=c.createElement("LI");_.setAttribute("role","treeitem"),(i=c.createElement("I")).className="jstree-icon jstree-ocl",i.setAttribute("role","presentation"),_.appendChild(i),(i=c.createElement("A")).className="jstree-anchor",i.setAttribute("href","#"),i.setAttribute("tabindex","-1"),(a=c.createElement("I")).className="jstree-icon jstree-themeicon",a.setAttribute("role","presentation"),i.appendChild(a),_.appendChild(i),i=a=null,e.jstree={version:"3.3.2",defaults:{plugins:[]},plugins:{},path:d&&-1!==d.indexOf("/")?d.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},e.jstree.create=function(t,i){var a=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&&(a=a.plugin(t,i[t]))}),e(t).data("jstree",a),a.init(t,i),a},e.jstree.destroy=function(){e(".jstree:jstree").jstree("destroy"),e(c).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,a=null;if(!t||!t.id||t.tagName&&t.nodeType||(t=t.id),!a||!a.length)try{a=e(t)}catch(e){}if(!a||!a.length)try{a=e("#"+t.replace(e.jstree.idregex,"\\$&"))}catch(e){}return a&&a.length&&(a=a.closest(".jstree")).length&&(a=a.data("jstree"))?i=a:e(".jstree").each(function(){var a=e(this).data("jstree");return a&&a._model.data[t]?(i=a,!1):void 0}),i},e.fn.jstree=function(i){var a="string"==typeof i,s=Array.prototype.slice.call(arguments,1),n=null;return!(!0===i&&!this.length)&&(this.each(function(){var r=e.jstree.reference(this),o=a&&r?r[i]:null;return n=a&&o?o.apply(r,s):null,r||a||i!==t&&!e.isPlainObject(i)||e.jstree.create(this,i),(r&&!a||!0===i)&&(n=r||!1),(null===n||n===t)&&void 0}),null!==n&&n!==t?n:this)},e.expr.pseudos.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 a=e.jstree.plugins[t];return a?(this._data[t]={},a.prototype=this,new a(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,a=0;this.element.on("dblclick.jstree",function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;if(c.selection&&c.selection.empty)c.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(),a=+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!==c.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,a=[];for(t=0,i=this._data.core.selected.length;i>t;t++)a=a.concat(this._model.data[this._data.core.selected[t]].parents);for(t=0,i=(a=e.vakata.array_unique(a)).length;i>t;t++)this.open_node(a[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(a){if(a.target.tagName&&"input"===a.target.tagName.toLowerCase())return!0;i&&clearTimeout(i),i=setTimeout(function(){t=""},500);var s=String.fromCharCode(a.which).toLowerCase(),n=this.element.find(".jstree-anchor").filter(":visible"),r=n.index(c.activeElement)||0,o=!1;if((t+=s).length>1){if(n.slice(r).each(e.proxy(function(i,a){return 0===e(a).text().toLowerCase().indexOf(t)?(e(a).focus(),o=!0,!1):void 0},this)),o)return;if(n.slice(0,r).each(e.proxy(function(i,a){return 0===e(a).text().toLowerCase().indexOf(t)?(e(a).focus(),o=!0,!1):void 0},this)),o)return}if(new RegExp("^"+s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(t)){if(n.slice(r+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,r+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-a>500&&!this._data.core.focused){a=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(c).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){var a;t&&t.id&&(t=t.id);try{if(this._model.data[t])t=this._model.data[t];else if("string"==typeof t&&this._model.data[t.replace(/^#/,"")])t=this._model.data[t.replace(/^#/,"")];else if("string"==typeof t&&(a=e("#"+t.replace(e.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[a.closest(".jstree-node").attr("id")])t=this._model.data[a.closest(".jstree-node").attr("id")];else if((a=e(t,this.element)).length&&this._model.data[a.closest(".jstree-node").attr("id")])t=this._model.data[a.closest(".jstree-node").attr("id")];else{if(!(a=e(t,this.element)).length||!a.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,a){if(!(t=t.parents?t:this.get_node(t))||t.id===e.jstree.root||!t.parents)return!1;var s,n,r=[];for(r.push(a?t.id:t.text),s=0,n=t.parents.length;n>s;s++)r.push(a?t.parents[s]:this.get_text(t.parents[s]));return r=r.reverse().slice(1),i?r.join(i):r},get_next_dom:function(t,i){var a;if((t=this.get_node(t,!0))[0]===this.element[0]){for(a=this._firstChild(this.get_container_ul()[0]);a&&0===a.offsetHeight;)a=this._nextSibling(a);return!!a&&e(a)}if(!t||!t.length)return!1;if(i){a=t[0];do{a=this._nextSibling(a)}while(a&&0===a.offsetHeight);return!!a&&e(a)}if(t.hasClass("jstree-open")){for(a=this._firstChild(t.children(".jstree-children")[0]);a&&0===a.offsetHeight;)a=this._nextSibling(a);if(null!==a)return e(a)}a=t[0];do{a=this._nextSibling(a)}while(a&&0===a.offsetHeight);return null!==a?e(a):t.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(t,i){var a;if((t=this.get_node(t,!0))[0]===this.element[0]){for(a=this.get_container_ul()[0].lastChild;a&&0===a.offsetHeight;)a=this._previousSibling(a);return!!a&&e(a)}if(!t||!t.length)return!1;if(i){a=t[0];do{a=this._previousSibling(a)}while(a&&0===a.offsetHeight);return!!a&&e(a)}a=t[0];do{a=this._previousSibling(a)}while(a&&0===a.offsetHeight);if(null!==a){for(t=e(a);t.hasClass("jstree-open");)t=t.children(".jstree-children").first().children(".jstree-node:visible:last");return t}return!(!(a=t[0].parentNode.parentNode)||!a.className||-1===a.className.indexOf("jstree-node"))&&e(a)},get_parent:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.parent},get_children_dom:function(e){return(e=this.get_node(e,!0))[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):!(!e||!e.length)&&e.children(".jstree-children").children(".jstree-node")},is_parent:function(e){return(e=this.get_node(e))&&(!1===e.state.loaded||e.children.length>0)},is_loaded:function(e){return(e=this.get_node(e))&&e.state.loaded},is_loading:function(e){return(e=this.get_node(e))&&e.state&&e.state.loading},is_open:function(e){return(e=this.get_node(e))&&e.state.opened},is_closed:function(e){return(e=this.get_node(e))&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(t,i){var a,s,n,r,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,r=t.parents.length;r>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(a=0,s=t.children_d.length;s>a;a++)this._model.data[t.children_d[a]].state.selected&&(o=!0),delete this._model.data[t.children_d[a]];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]).state.loading=!1,t.state.loaded=e,t.state.failed=!t.state.loaded;var a,s=this.get_node(t,!0),n=0,r=this._model.data,o=!1;for(n=0,a=t.children.length;a>n;n++)if(r[t.children[n]]&&!r[t.children[n]].state.hidden){o=!0;break}t.state.loaded&&s&&s.length&&(s.removeClass("jstree-closed jstree-open jstree-leaf"),o?"#"!==t.id&&s.addClass(t.state.opened?"jstree-open":"jstree-closed"):s.addClass("jstree-leaf")),s.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,a){var s,n,r=!0,o=function(){this._load_nodes(e,t,!0)},l=this._model.data,d=[];for(s=0,n=e.length;n>s;s++)l[e[s]]&&(!l[e[s]].state.loaded&&!l[e[s]].state.failed||!i&&a)&&(this.is_loading(e[s])||this.load_node(e[s],o),r=!1);if(r){for(s=0,n=e.length;n>s;s++)l[e[s]]&&l[e[s]].state.loaded&&d.push(e[s]);t&&!t.done&&(t.call(this,d),t.done=!0)}},load_all:function(t,i){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var a,s,n=[],r=this._model.data,o=r[t.id].children_d;for(t.state&&!t.state.loaded&&n.push(t.id),a=0,s=o.length;s>a;a++)r[o[a]]&&r[o[a]].state&&!r[o[a]].state.loaded&&n.push(o[a]);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 a,s=this.settings.core.data,n=function(){return 3!==this.nodeType&&8!==this.nodeType};return s?e.isFunction(s)?s.call(this,t,e.proxy(function(a){!1===a?i.call(this,!1):this["string"==typeof a?"_append_html_data":"_append_json_data"](t,"string"==typeof a?e(e.parseHTML(a)).filter(n):a,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(a,s,r){var o=r.getResponseHeader("Content-Type");return o&&-1!==o.indexOf("json")||"object"==typeof a?this._append_json_data(t,a,function(e){i.call(this,e)}):o&&-1!==o.indexOf("html")||"string"==typeof a?this._append_html_data(t,e(e.parseHTML(a)).filter(n),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:r})},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))):(a=e.isArray(s)||e.isPlainObject(s)?JSON.parse(JSON.stringify(s)):s,t.id===e.jstree.root?this._append_json_data(t,a,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(n),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,a){(t=this.get_node(t)).children=[],t.children_d=[];var s,n,r,o=i.is("ul")?i.children():i,l=t.id,d=[],c=[],_=this._model.data,m=_[l],h=this._data.core.selected.length;for(o.each(e.proxy(function(t,i){(s=this._parse_model_from_html(e(i),l,m.parents.concat()))&&(d.push(s),c.push(s),_[s].children_d.length&&(c=c.concat(_[s].children_d)))},this)),m.children=d,m.children_d=c,n=0,r=m.parents.length;r>n;n++)_[m.parents[n]].children_d=_[m.parents[n]].children_d.concat(c);this.trigger("model",{nodes:c,parent:l}),l!==e.jstree.root?(this._node_changed(l),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==h&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),a.call(this,!0)},_append_json_data:function(t,i,a,s){if(null!==this.element){(t=this.get_node(t)).children=[],t.children_d=[],i.d&&("string"==typeof(i=i.d)&&(i=JSON.parse(i))),e.isArray(i)||(i=[i]);var n=null,r={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,a,s,n,r=e.dat,o=e.par,l=[],d=[],c=[],_=e.df,m=e.t_id,h=e.t_cnt,p=e.m,g=p[o],u=e.sel,f=function(e,i,a){a=a?a.concat():[],i&&a.unshift(i);var s,n,r,o,l=e.id.toString(),d={id:l,text:e.text||"",icon:e.icon===t||e.icon,parent:i,parents:a,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(s in _)_.hasOwnProperty(s)&&(d.state[s]=_[s]);if(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.li_attr.id=l),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]);for(e&&e.children&&!0===e.children&&(d.state.loaded=!1,d.children=[],d.children_d=[]),p[d.id]=d,s=0,n=d.children.length;n>s;s++)r=f(p[d.children[s]],d.id,a),o=p[r],d.children_d.push(r),o.children_d.length&&(d.children_d=d.children_d.concat(o.children_d));return delete e.data,delete e.children,p[d.id].original=e,d.state.selected&&c.push(d.id),d.id},v=function(e,i,a){a=a?a.concat():[],i&&a.unshift(i);var s,n,r,o,l,d=!1;do{d="j"+m+"_"+ ++h}while(p[d]);for(s in l={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:i,parents:a,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},_)_.hasOwnProperty(s)&&(l.state[s]=_[s]);if(e&&e.id&&(l.id=e.id.toString()),e&&e.text&&(l.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(l.icon=e.data.jstree.icon),(l.icon===t||null===l.icon||""===l.icon)&&(l.icon=!0),e&&e.data&&(l.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(l.state[s]=e.data.jstree[s]);if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(l.state[s]=e.state[s]);if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(l.li_attr[s]=e.li_attr[s]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=d),l.li_attr.id||(l.li_attr.id=l.id),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(l.a_attr[s]=e.a_attr[s]);if(e&&e.children&&e.children.length){for(s=0,n=e.children.length;n>s;s++)r=v(e.children[s],l.id,a),o=p[r],l.children.push(r),o.children_d.length&&(l.children_d=l.children_d.concat(o.children_d));l.children_d=l.children_d.concat(l.children)}return e&&e.children&&!0===e.children&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete e.data,delete e.children,l.original=e,p[l.id]=l,l.state.selected&&c.push(l.id),l.id};if(r.length&&r[0].id!==t&&r[0].parent!==t){for(a=0,s=r.length;s>a;a++)r[a].children||(r[a].children=[]),p[r[a].id.toString()]=r[a];for(a=0,s=r.length;s>a;a++)p[r[a].parent.toString()].children.push(r[a].id.toString()),g.children_d.push(r[a].id.toString());for(a=0,s=g.children.length;s>a;a++)i=f(p[g.children[a]],o,g.parents.concat()),d.push(i),p[i].children_d.length&&(d=d.concat(p[i].children_d));for(a=0,s=g.parents.length;s>a;a++)p[g.parents[a]].children_d=p[g.parents[a]].children_d.concat(d);n={cnt:h,mod:p,sel:u,par:o,dpc:d,add:c}}else{for(a=0,s=r.length;s>a;a++)(i=v(r[a],o,g.parents.concat()))&&(l.push(i),d.push(i),p[i].children_d.length&&(d=d.concat(p[i].children_d)));for(g.children=l,g.children_d=d,a=0,s=g.parents.length;s>a;a++)p[g.parents[a]].children_d=p[g.parents[a]].children_d.concat(d);n={cnt:h,mod:p,sel:u,par:o,dpc:d,add:c}}return"undefined"!=typeof window&&void 0!==window.document?n:void postMessage(n)},l=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 r,o=t.add,l=t.sel,d=this._data.core.selected.slice();if(n=this._model.data,l.length!==d.length||e.vakata.array_unique(l.concat(d)).length!==l.length){for(s=0,r=l.length;r>s;s++)-1===e.inArray(l[s],o)&&-1===e.inArray(l[s],d)&&(n[l[s]].state.selected=!1);for(s=0,r=d.length;r>s;s++)-1===e.inArray(d[s],l)&&(n[d[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}),a.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)).onmessage=e.proxy(function(e){l.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),r.par?n.postMessage(r):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,a,!0])}catch(e){l.call(this,o(r),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else l.call(this,o(r),!1)}},_parse_model_from_html:function(i,a,s){s=s?[].concat(s):[],a&&s.unshift(a);var n,r,o,l,d,c=this._model.data,_={id:!1,text:!1,icon:!0,parent:a,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)&&(_.state[o]=this._model.default_state[o]);if(l=e.vakata.attributes(i,!0),e.each(l,function(t,i){return!(i=e.trim(i)).length||(_.li_attr[t]=i,void("id"===t&&(_.id=i.toString())))}),(l=i.children("a").first()).length&&(l=e.vakata.attributes(l,!0),e.each(l,function(t,i){(i=e.trim(i)).length&&(_.a_attr[t]=i)})),(l=i.children("a").first().length?i.children("a").first().clone():i.clone()).children("ins, i, ul").remove(),l=l.html(),l=e("<div />").html(l),_.text=this.settings.core.force_text?l.text():l.html(),l=i.data(),_.data=l?e.extend(!0,{},l):null,_.state.opened=i.hasClass("jstree-open"),_.state.selected=i.children("a").hasClass("jstree-clicked"),_.state.disabled=i.children("a").hasClass("jstree-disabled"),_.data&&_.data.jstree)for(o in _.data.jstree)_.data.jstree.hasOwnProperty(o)&&(_.state[o]=_.data.jstree[o]);(l=i.children("a").children(".jstree-themeicon")).length&&(_.icon=!l.hasClass("jstree-themeicon-hidden")&&l.attr("rel")),_.state.icon!==t&&(_.icon=_.state.icon),(_.icon===t||null===_.icon||""===_.icon)&&(_.icon=!0),l=i.children("ul").children("li");do{d="j"+this._id+"_"+ ++this._cnt}while(c[d]);return _.id=_.li_attr.id?_.li_attr.id.toString():d,l.length?(l.each(e.proxy(function(t,i){n=this._parse_model_from_html(e(i),_.id,s),r=this._model.data[n],_.children.push(n),r.children_d.length&&(_.children_d=_.children_d.concat(r.children_d))},this)),_.children_d=_.children_d.concat(_.children)):i.hasClass("jstree-closed")&&(_.state.loaded=!1),_.li_attr.class&&(_.li_attr.class=_.li_attr.class.replace("jstree-closed","").replace("jstree-open","")),_.a_attr.class&&(_.a_attr.class=_.a_attr.class.replace("jstree-clicked","").replace("jstree-disabled","")),c[_.id]=_,_.state.selected&&this._data.core.selected.push(_.id),_.id},_parse_model_from_flat_json:function(e,i,a){a=a?a.concat():[],i&&a.unshift(i);var s,n,r,o,l=e.id.toString(),d=this._model.data,c=this._model.default_state,_={id:l,text:e.text||"",icon:e.icon===t||e.icon,parent:i,parents:a,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(s in c)c.hasOwnProperty(s)&&(_.state[s]=c[s]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(_.icon=e.data.jstree.icon),(_.icon===t||null===_.icon||""===_.icon)&&(_.icon=!0),e&&e.data&&(_.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(_.state[s]=e.data.jstree[s]);if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(_.state[s]=e.state[s]);if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(_.li_attr[s]=e.li_attr[s]);if(_.li_attr.id||(_.li_attr.id=l),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(_.a_attr[s]=e.a_attr[s]);for(e&&e.children&&!0===e.children&&(_.state.loaded=!1,_.children=[],_.children_d=[]),d[_.id]=_,s=0,n=_.children.length;n>s;s++)o=d[r=this._parse_model_from_flat_json(d[_.children[s]],_.id,a)],_.children_d.push(r),o.children_d.length&&(_.children_d=_.children_d.concat(o.children_d));return delete e.data,delete e.children,d[_.id].original=e,_.state.selected&&this._data.core.selected.push(_.id),_.id},_parse_model_from_json:function(e,i,a){a=a?a.concat():[],i&&a.unshift(i);var s,n,r,o,l,d=!1,c=this._model.data,_=this._model.default_state;do{d="j"+this._id+"_"+ ++this._cnt}while(c[d]);for(s in l={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:i,parents:a,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},_)_.hasOwnProperty(s)&&(l.state[s]=_[s]);if(e&&e.id&&(l.id=e.id.toString()),e&&e.text&&(l.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(l.icon=e.data.jstree.icon),(l.icon===t||null===l.icon||""===l.icon)&&(l.icon=!0),e&&e.data&&(l.data=e.data,e.data.jstree))for(s in e.data.jstree)e.data.jstree.hasOwnProperty(s)&&(l.state[s]=e.data.jstree[s]);if(e&&"object"==typeof e.state)for(s in e.state)e.state.hasOwnProperty(s)&&(l.state[s]=e.state[s]);if(e&&"object"==typeof e.li_attr)for(s in e.li_attr)e.li_attr.hasOwnProperty(s)&&(l.li_attr[s]=e.li_attr[s]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=d),l.li_attr.id||(l.li_attr.id=l.id),e&&"object"==typeof e.a_attr)for(s in e.a_attr)e.a_attr.hasOwnProperty(s)&&(l.a_attr[s]=e.a_attr[s]);if(e&&e.children&&e.children.length){for(s=0,n=e.children.length;n>s;s++)o=c[r=this._parse_model_from_json(e.children[s],l.id,a)],l.children.push(r),o.children_d.length&&(l.children_d=l.children_d.concat(o.children_d));l.children_d=l.children_d.concat(l.children)}return e&&e.children&&!0===e.children&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete e.data,delete e.children,l.original=e,c[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var t,i,a,s=this._model.force_full_redraw?this._model.data[e.jstree.root].children.concat([]):this._model.changed.concat([]),n=c.createElement("UL"),r=this._data.core.focused;for(i=0,a=s.length;a>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!==r&&((t=this.get_node(r,!0))&&t.length&&t.children(".jstree-anchor")[0]!==c.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),a=!1,s=!1,n=!1,r=c;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=r.createElement("UL")).setAttribute("role","group"),n.className="jstree-children",a=0,s=i.children.length;s>a;a++)n.appendChild(this.redraw_node(i.children[a],!0,!0));t.appendChild(n)}},redraw_node:function(t,i,a,s){var n=this.get_node(t),r=!1,o=!1,l=!1,d=!1,m=!1,h=!1,p="",g=c,u=this._model.data,f=!1,v=null,b=0,y=0,k=!1,j=!1;if(!n)return!1;if(n.id===e.jstree.root)return this.redraw(!0);if(i=i||0===n.children.length,t=c.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,"\\$&"))):c.getElementById(n.id))t=e(t),a||((r=t.parent().parent()[0])===this.element[0]&&(r=null),o=t.index()),i||!n.children.length||t.children(".jstree-children").length||(i=!0),i||(l=t.children(".jstree-children")[0]),f=t.children(".jstree-anchor")[0]===c.activeElement,t.remove();else if(i=!0,!a){if(!(null===(r=n.parent!==e.jstree.root?e("#"+n.parent.replace(e.jstree.idregex,"\\$&"),this.element)[0]:null)||r&&u[n.parent].state.opened))return!1;o=e.inArray(n.id,null===r?u[e.jstree.root].children:u[n.parent].children)}for(d in t=_.cloneNode(!0),p="jstree-node ",n.li_attr)if(n.li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"!==d?t.setAttribute(d,n.li_attr[d]):p+=n.li_attr[d]}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),d=0,m=n.children.length;m>d;d++)if(!u[n.children[d]].state.hidden){k=!0;break}if(null!==n.parent&&u[n.parent]&&!n.state.hidden&&(d=e.inArray(n.id,u[n.parent].children),j=n.id,-1!==d))for(d++,m=u[n.parent].children.length;m>d&&(u[u[n.parent].children[d]].state.hidden||(j=u[n.parent].children[d]),j===n.id);d++);for(m in n.state.hidden&&(p+=" jstree-hidden"),n.state.loaded&&!k?p+=" jstree-leaf":(p+=n.state.opened&&n.state.loaded?" jstree-open":" jstree-closed",t.setAttribute("aria-expanded",n.state.opened&&n.state.loaded)),j===n.id&&(p+=" jstree-last"),t.id=n.id,t.className=p,p=(n.state.selected?" jstree-clicked":"")+(n.state.disabled?" jstree-disabled":""),n.a_attr)if(n.a_attr.hasOwnProperty(m)){if("href"===m&&"#"===n.a_attr[m])continue;"class"!==m?t.childNodes[1].setAttribute(m,n.a_attr[m]):p+=" "+n.a_attr[m]}if(p.length&&(t.childNodes[1].className="jstree-anchor "+p),(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(g.createTextNode(n.text)):t.childNodes[1].innerHTML+=n.text,i&&n.children.length&&(n.state.opened||s)&&n.state.loaded){for((h=g.createElement("UL")).setAttribute("role","group"),h.className="jstree-children",d=0,m=n.children.length;m>d;d++)h.appendChild(this.redraw_node(n.children[d],i,!0));t.appendChild(h)}if(l&&t.appendChild(l),!a){for(r||(r=this.element[0]),d=0,m=r.childNodes.length;m>d;d++)if(r.childNodes[d]&&r.childNodes[d].className&&-1!==r.childNodes[d].className.indexOf("jstree-children")){v=r.childNodes[d];break}v||((v=g.createElement("UL")).setAttribute("role","group"),v.className="jstree-children",r.appendChild(v)),o<(r=v).childNodes.length?r.insertBefore(t,r.childNodes[o]):r.appendChild(t),f&&(b=this.element[0].scrollTop,y=this.element[0].scrollLeft,t.childNodes[1].focus(),this.element[0].scrollTop=b,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,a,s){var n,r,o,l;if(e.isArray(i)){for(n=0,r=(i=i.slice()).length;r>n;n++)this.open_node(i[n],a,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),l=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="",l.element&&l.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,a&&a.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,a,s)},this),500):void this.load_node(i,function(e,t){return t?this.open_node(e,a,s):!!a&&a.call(this,e,!1)}):(a&&a.call(this,i,!1),!1))},_open_to:function(t){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var i,a,s=t.parents;for(i=0,a=s.length;a>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,a){var s,n,r,o;if(e.isArray(i)){for(s=0,n=(i=i.slice()).length;n>s;s++)this.close_node(i[s],a);return!0}return!(!(i=this.get_node(i))||i.id===e.jstree.root)&&(!this.is_closed(i)&&(a=a===t?this.settings.core.animation:a,r=this,o=this.get_node(i,!0),i.state.opened=!1,this.trigger("close_node",{node:i}),void(o.length?a?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(a,function(){this.style.display="",o.children(".jstree-children").remove(),r.element&&r.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,a;if(e.isArray(t)){for(i=0,a=(t=t.slice()).length;a>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,a){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var s,n,r,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})}a=a||o,r=this,(o=this.is_closed(t)?o.find(".jstree-closed").addBack():o.find(".jstree-closed")).each(function(){r.open_node(this,function(e,t){t&&this.is_parent(e)&&this.open_all(e,i,a)},i||0)}),0===a.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(a)})},close_all:function(t,i){if(t||(t=e.jstree.root),!(t=this.get_node(t)))return!1;var a,s,n=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0),r=this;for(n.length&&(n=this.is_open(t)?n.find(".jstree-open").addBack():n.find(".jstree-open"),e(n.get().reverse()).each(function(){r.close_node(this,i||0)})),a=0,s=t.children_d.length;s>a;a++)this._model.data[t.children_d[a]].state.opened=!1;this.trigger("close_all",{node:t})},is_disabled:function(e){return(e=this.get_node(e))&&e.state&&e.state.disabled},enable_node:function(t){var i,a;if(e.isArray(t)){for(i=0,a=(t=t.slice()).length;a>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,a;if(e.isArray(t)){for(i=0,a=(t=t.slice()).length;a>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!0===(e=this.get_node(e)).state.hidden},hide_node:function(t,i){var a,s;if(e.isArray(t)){for(a=0,s=(t=t.slice()).length;s>a;a++)this.hide_node(t[a],!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 a,s;if(e.isArray(t)){for(a=0,s=(t=t.slice()).length;s>a;a++)this.show_node(t[a],!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,a=this._model.data,s=[];for(i in a)a.hasOwnProperty(i)&&i!==e.jstree.root&&!a[i].state.hidden&&(a[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,a=this._model.data,s=[];for(i in a)a.hasOwnProperty(i)&&i!==e.jstree.root&&a[i].state.hidden&&(a[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 a,s,n=this.get_node(e).id,r=this._data.core.last_clicked.id,o=this.get_node(this._data.core.last_clicked.parent).children,l=!1;for(a=0,s=o.length;s>a;a+=1)o[a]===n&&(l=!l),o[a]===r&&(l=!l),this.is_disabled(o[a])||!l&&o[a]!==n&&o[a]!==r?this.deselect_node(o[a],!0,i):this.is_hidden(o[a])||this.select_node(o[a],!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,a,s){var n,r,o;if(e.isArray(t)){for(r=0,o=(t=t.slice()).length;o>r;r++)this.select_node(t[r],i,a,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),a||(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,a){var s,n,r;if(e.isArray(t)){for(s=0,n=(t=t.slice()).length;n>s;s++)this.deselect_node(t[s],i,a);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(r=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),r.length&&r.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:t,selected:this._data.core.selected,event:a}),i||this.trigger("changed",{action:"deselect_node",node:t,selected:this._data.core.selected,event:a}))))},select_all:function(t){var i,a,s=this._data.core.selected.concat([]);for(this._data.core.selected=this._model.data[e.jstree.root].children_d.concat(),i=0,a=this._data.core.selected.length;a>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,a=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:a}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:a})},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,a,s,n,r=this.get_selected(!0),o={};for(i=0,a=r.length;a>i;i++)o[r[i].id]=r[i];for(i=0,a=r.length;a>i;i++)for(s=0,n=r[i].children_d.length;n>s;s++)o[r[i].children_d[s]]&&delete o[r[i].children_d[s]];for(i in r=[],o)o.hasOwnProperty(i)&&r.push(i);return t?e.map(r,e.proxy(function(e){return this.get_node(e)},this)):r},get_bottom_selected:function(t){var i,a,s=this.get_selected(!0),n=[];for(i=0,a=s.length;a>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,a){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,a)}):(delete i.core.open,this.set_state(i,a)),!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,a),!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,a),!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,a),!1}return!e.isEmptyObject(i)||(i=null,a&&a.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 a=this.get_container_ul()[0].className;t||(this.element.html("<ul class='"+a+"' 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=a,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=[],a=[],s=this._data.core.selected.concat([]);a.push(t.id),!0===t.state.opened&&i.push(t.id),this.get_node(t,!0).find(".jstree-open").each(function(){a.push(this.id),i.push(this.id)}),this._load_nodes(a,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 a,s,n=this._model.data,r=t.id;for(i=i.toString(),n[t.parent].children[e.inArray(t.id,n[t.parent].children)]=i,a=0,s=t.parents.length;s>a;a++)n[t.parents[a]].children_d[e.inArray(t.id,n[t.parents[a]].children_d)]=i;for(a=0,s=t.children.length;s>a;a++)n[t.children[a]].parent=i;for(a=0,s=t.children_d.length;s>a;a++)n[t.children_d[a]].parents[e.inArray(t.id,n[t.children_d[a]].parents)]=i;return-1!==(a=e.inArray(t.id,this._data.core.selected))&&(this._data.core.selected[a]=i),(a=this.get_node(t.id,!0))&&(a.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:r}),!0},get_text:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.text},set_text:function(t,i){var a,s;if(e.isArray(t)){for(a=0,s=(t=t.slice()).length;s>a;a++)this.set_text(t[a],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,a){if(!(t=this.get_node(t||e.jstree.root)))return!1;i&&i.flat&&!a&&(a=[]);var s,n,r={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?r.parent=t.parent:r.children=[],i&&i.no_state)delete r.state;else for(s in t.state)t.state.hasOwnProperty(s)&&(r.state[s]=t.state[s]);if(i&&i.no_li_attr&&delete r.li_attr,i&&i.no_a_attr&&delete r.a_attr,i&&i.no_id&&(delete r.id,r.li_attr&&r.li_attr.id&&delete r.li_attr.id,r.a_attr&&r.a_attr.id&&delete r.a_attr.id),i&&i.flat&&t.id!==e.jstree.root&&a.push(r),!i||!i.no_children)for(s=0,n=t.children.length;n>s;s++)i&&i.flat?this.get_json(t.children[s],i,a):r.children.push(this.get_json(t.children[s],i));return i&&i.flat?a:t.id===e.jstree.root?r.children:r},create_node:function(i,a,s,n,r){if(null===i&&(i=e.jstree.root),!(i=this.get_node(i)))return!1;if(!(s=s===t?"last":s).toString().match(/^(before|after)$/)&&!r&&!this.is_loaded(i))return this.load_node(i,function(){this.create_node(i,a,s,n,!0)});var o,l,d,c;switch(a||(a={text:this.get_string("New node")}),"string"==typeof a&&(a={text:a}),a.text===t&&(a.text=this.get_string("New node")),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),a.id||(a.id=!0),!this.check("create_node",a,i,s))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!0===a.id&&delete a.id,!(a=this._parse_model_from_json(a,i.id,i.parents.concat())))return!1;for(o=this.get_node(a),(l=[]).push(a),l=l.concat(o.children_d),this.trigger("model",{nodes:l,parent:i.id}),i.children_d=i.children_d.concat(l),d=0,c=i.parents.length;c>d;d++)this._model.data[i.parents[d]].children_d=this._model.data[i.parents[d]].children_d.concat(l);for(a=o,o=[],d=0,c=i.children.length;c>d;d++)o[d>=s?d+1:d]=i.children[d];return o[s]=a.id,i.children=o,this.redraw_node(i,!0),n&&n.call(this,this.get_node(a)),this.trigger("create_node",{node:this.get_node(a),parent:i.id,position:s}),a.id},rename_node:function(t,i){var a,s,n;if(e.isArray(t)){for(a=0,s=(t=t.slice()).length;s>a;a++)this.rename_node(t[a],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,a,s,n,r,o,l,d,c,_,m,h;if(e.isArray(t)){for(i=0,a=(t=t.slice()).length;a>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),_=!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)),(r=t.children_d.concat([])).push(t.id),o=0,l=t.parents.length;l>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,r)});for(d=0,c=r.length;c>d;d++)if(this._model.data[r[d]].state.selected){_=!0;break}for(_&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,function(t){return-1===e.inArray(t,r)})),this.trigger("delete_node",{node:t,parent:s.id}),_&&this.trigger("changed",{action:"delete_node",node:t,selected:this._data.core.selected,parent:s.id}),d=0,c=r.length;c>d;d++)delete this._model.data[r[d]];return-1!==e.inArray(this._data.core.focused,r)&&(this._data.core.focused=null,m=this.element[0].scrollTop,h=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=m,this.element[0].scrollLeft=h),this.redraw_node(s,!0),!0},check:function(t,i,a,s,n){i=i&&i.id?i:this.get_node(i),a=a&&a.id?a:this.get_node(a);var r=t.match(/^move_node|copy_node|create_node$/i)?a:i,o=this.settings.core.check_callback;return"move_node"!==t&&"copy_node"!==t||n&&n.is_multi||i.id!==a.id&&("move_node"!==t||e.inArray(i.id,a.children)!==s)&&-1===e.inArray(a.id,i.children_d)?(r&&r.data&&(r=r.data),r&&r.functions&&(!1===r.functions[t]||!0===r.functions[t])?(!1===r.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:!(!a||!a.id)&&a.id})}),r.functions[t]):!(!1===o||e.isFunction(o)&&!1===o.call(this,t,i,a,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:!(!a||!a.id)&&a.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:!(!a||!a.id)&&a.id})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(i,a,s,n,r,o,l){var d,c,_,m,h,p,g,u,f,v,b,y,k,j;if(a=this.get_node(a),s=s===t?0:s,!a)return!1;if(!s.toString().match(/^(before|after)$/)&&!r&&!this.is_loaded(a))return this.load_node(a,function(){this.move_node(i,a,s,n,!0,!1,l)});if(e.isArray(i)){if(1!==i.length){for(d=0,c=i.length;c>d;d++)(f=this.move_node(i[d],a,s,n,r,!1,l))&&(a=f,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(_=(i.parent||e.jstree.root).toString(),h=s.toString().match(/^(before|after)$/)&&a.id!==e.jstree.root?this.get_node(a.parent):a,g=!(p=l||(this._model.data[i.id]?this:e.jstree.reference(i.id)))||!p._id||this._id!==p._id,m=p&&p._id&&_&&p._model.data[_]&&p._model.data[_].children?e.inArray(i.id,p._model.data[_].children):-1,p&&p._id&&(i=p._model.data[i.id]),g)return!!(f=this.copy_node(i,a,s,n,r,!1,l))&&(p&&p.delete_node(i),f);switch(a.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(a.id,h.children);break;case"after":s=e.inArray(a.id,h.children)+1;break;case"inside":case"first":s=0;break;case"last":s=h.children.length;break;default:s||(s=0)}if(s>h.children.length&&(s=h.children.length),!this.check("move_node",i,h,s,{core:!0,origin:l,is_multi:p&&p._id&&p._id!==this._id,is_foreign:!p||!p._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(i.parent===h.id){for(u=h.children.concat(),-1!==(f=e.inArray(i.id,u))&&(u=e.vakata.array_remove(u,f),s>f&&s--),f=[],v=0,b=u.length;b>v;v++)f[v>=s?v+1:v]=u[v];f[s]=i.id,h.children=f,this._node_changed(h.id),this.redraw(h.id===e.jstree.root)}else{for((f=i.children_d.concat()).push(i.id),v=0,b=i.parents.length;b>v;v++){for(u=[],y=0,k=(j=p._model.data[i.parents[v]].children_d).length;k>y;y++)-1===e.inArray(j[y],f)&&u.push(j[y]);p._model.data[i.parents[v]].children_d=u}for(p._model.data[_].children=e.vakata.array_remove_item(p._model.data[_].children,i.id),v=0,b=h.parents.length;b>v;v++)this._model.data[h.parents[v]].children_d=this._model.data[h.parents[v]].children_d.concat(f);for(u=[],v=0,b=h.children.length;b>v;v++)u[v>=s?v+1:v]=h.children[v];for(u[s]=i.id,h.children=u,h.children_d.push(i.id),h.children_d=h.children_d.concat(i.children_d),i.parent=h.id,(f=h.parents.concat()).unshift(h.id),j=i.parents.length,i.parents=f,f=f.concat(),v=0,b=i.children_d.length;b>v;v++)this._model.data[i.children_d[v]].parents=this._model.data[i.children_d[v]].parents.slice(0,-1*j),Array.prototype.push.apply(this._model.data[i.children_d[v]].parents,f);(_===e.jstree.root||h.id===e.jstree.root)&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(_),this._node_changed(h.id)),o||this.redraw()}return n&&n.call(this,i,h,s),this.trigger("move_node",{node:i,parent:h.id,position:s,old_parent:_,old_position:m,is_multi:p&&p._id&&p._id!==this._id,is_foreign:!p||!p._id,old_instance:p,new_instance:this}),i.id},copy_node:function(i,a,s,n,r,o,l){var d,c,_,m,h,p,g,u,f,v;if(a=this.get_node(a),s=s===t?0:s,!a)return!1;if(!s.toString().match(/^(before|after)$/)&&!r&&!this.is_loaded(a))return this.load_node(a,function(){this.copy_node(i,a,s,n,!0,!1,l)});if(e.isArray(i)){if(1!==i.length){for(d=0,c=i.length;c>d;d++)(m=this.copy_node(i[d],a,s,n,r,!0,l))&&(a=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;switch(u=(i.parent||e.jstree.root).toString(),f=s.toString().match(/^(before|after)$/)&&a.id!==e.jstree.root?this.get_node(a.parent):a,!(v=l||(this._model.data[i.id]?this:e.jstree.reference(i.id)))||!v._id||this._id!==v._id,v&&v._id&&(i=v._model.data[i.id]),a.id===e.jstree.root&&("before"===s&&(s="first"),"after"===s&&(s="last")),s){case"before":s=e.inArray(a.id,f.children);break;case"after":s=e.inArray(a.id,f.children)+1;break;case"inside":case"first":s=0;break;case"last":s=f.children.length;break;default:s||(s=0)}if(s>f.children.length&&(s=f.children.length),!this.check("copy_node",i,f,s,{core:!0,origin:l,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(!(g=v?v.get_json(i,{no_id:!0,no_data:!0,no_state:!0}):i))return!1;if(!0===g.id&&delete g.id,!(g=this._parse_model_from_json(g,f.id,f.parents.concat())))return!1;for(m=this.get_node(g),i&&i.state&&!1===i.state.loaded&&(m.state.loaded=!1),(_=[]).push(g),_=_.concat(m.children_d),this.trigger("model",{nodes:_,parent:f.id}),h=0,p=f.parents.length;p>h;h++)this._model.data[f.parents[h]].children_d=this._model.data[f.parents[h]].children_d.concat(_);for(_=[],h=0,p=f.children.length;p>h;h++)_[h>=s?h+1:h]=f.children[h];return _[s]=m.id,f.children=_,f.children_d.push(m.id),f.children_d=f.children_d.concat(m.children_d),f.id===e.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(f.id),o||this.redraw(f.id===e.jstree.root),n&&n.call(this,m,f,s),this.trigger("copy_node",{node:m,original:i,parent:f.id,position:s,old_parent:u,old_position:v&&v._id&&u&&v._model.data[u]&&v._model.data[u].children?e.inArray(i.id,v._model.data[u].children):-1,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id,old_instance:v,new_instance:this}),m.id},cut:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var i,a,s,l=[];for(a=0,s=t.length;s>a;a++)(i=this.get_node(t[a]))&&i.id&&i.id!==e.jstree.root&&l.push(i);return!!l.length&&(n=l,o=this,r="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,a,s,l=[];for(a=0,s=t.length;s>a;a++)(i=this.get_node(t[a]))&&i.id&&i.id!==e.jstree.root&&l.push(i);return!!l.length&&(n=l,o=this,r="copy_node",void this.trigger("copy",{node:t}))},get_buffer:function(){return{mode:r,node:n,inst:o}},can_paste:function(){return!1!==r&&!1!==n},paste:function(e,t){return!!((e=this.get_node(e))&&r&&r.match(/^(copy_node|move_node)$/)&&n)&&(this[r](n,e,t,!1,!1,!1,o)&&this.trigger("paste",{parent:e.id,node:n,mode:r}),n=!1,r=!1,void(o=!1))},clear_buffer:function(){n=!1,r=!1,o=!1,this.trigger("clear_buffer")},edit:function(t,i,a){var s,n,r,o,l,d,_,m,h,p=!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):(h=t,i="string"==typeof i?i:t.text,this.set_text(t,""),t=this._open_to(t),h.text=i,s=this._data.core.rtl,n=this.element.width(),this._data.core.focused=h.id,r=t.children(".jstree-anchor").focus(),o=e("<span>"),l=i,d=e("<div />",{css:{position:"absolute",top:"-200px",left:s?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),_=e("<input />",{value:l,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").val(),c=this.settings.core.force_text;""===n&&(n=l),d.remove(),o.replaceWith(r),o.remove(),l=c?l:e("<div></div>").append(e.parseHTML(l)).html(),this.set_text(t,l),(s=!!this.rename_node(t,c?e("<div></div>").text(n).text():e("<div></div>").append(e.parseHTML(n)).html()))||this.set_text(t,l),this._data.core.focused=h.id,setTimeout(e.proxy(function(){var e=this.get_node(h.id,!0);e.length&&(this._data.core.focused=h.id,e.children(".jstree-anchor").focus())},this),0),a&&a.call(this,h,s,p),_=null},this),keydown:function(e){var t=e.which;27===t&&(p=!0,this.value=l),(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){_.width(Math.min(d.text("pW"+this.value).width(),n))},keypress:function(e){return 13!==e.which&&void 0}}),m={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")||""},o.attr("class",r.attr("class")).append(r.contents().clone()).append(_),r.replaceWith(o),d.css(m),_.css(m).width(Math.min(d.text("pW"+_[0].value).width(),n))[0].select(),void e(c).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(t){_&&t.target!==_&&e(_).blur()})))},set_theme:function(t,i){if(!t)return!1;if(!0===i){var a=this.settings.core.themes.dir;a||(a=e.jstree.path+"/themes"),i=a+"/"+t+"/style.css"}i&&-1===e.inArray(i,l)&&(e("head").append('<link rel="stylesheet" href="'+i+'" type="text/css" />'),l.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,a){var s,n,r,o;if(e.isArray(i)){for(s=0,n=(i=i.slice()).length;n>s;s++)this.set_icon(i[s],a);return!0}return!(!(i=this.get_node(i))||i.id===e.jstree.root)&&(o=i.icon,i.icon=!0===a||null===a||a===t||""===a||a,r=this.get_node(i,!0).children(".jstree-anchor").children(".jstree-themeicon"),!1===a?this.hide_icon(i):!0===a||null===a||a===t||""===a?(r.removeClass("jstree-themeicon-custom "+o).css("background","").removeAttr("rel"),!1===o&&this.show_icon(i)):-1===a.indexOf("/")&&-1===a.indexOf(".")?(r.removeClass(o).css("background",""),r.addClass(a+" jstree-themeicon-custom").attr("rel",a),!1===o&&this.show_icon(i)):(r.removeClass(o).css("background",""),r.addClass("jstree-themeicon-custom").css("background","url('"+a+"') center center no-repeat").attr("rel",a),!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,a;if(e.isArray(t)){for(i=0,a=(t=t.slice()).length;a>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,a,s;if(e.isArray(t)){for(i=0,a=(t=t.slice()).length;a>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 a=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?a[s.name]=s.value:a.push(s.name))}),a},e.vakata.array_unique=function(e){var i,a,s=[],n={};for(i=0,a=e.length;a>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 a=e.inArray(i,t);return-1!==a?e.vakata.array_remove(t,a):t},e.vakata.array_filter=function(e,t,i,a,s){if(e.filter)return e.filter(t,i);for(s in a=[],e)~~s+""==s+""&&s>=0&&t.call(i,e[s],+s,e)&&a.push(e[s]);return a},e.jstree.plugins.changed=function(e,t){var i=[];this.trigger=function(e,a){var s,n;if(a||(a={}),"changed"===e.replace(".jstree","")){a.changed={selected:[],deselected:[]};var r={};for(s=0,n=i.length;n>s;s++)r[i[s]]=1;for(s=0,n=a.selected.length;n>s;s++)r[a.selected[s]]?r[a.selected[s]]=2:a.changed.selected.push(a.selected[s]);for(s=0,n=i.length;n>s;s++)1===r[i[s]]&&a.changed.deselected.push(i[s]);i=a.selected.slice()}t.trigger.call(this,e,a)},this.refresh=function(e,a){return i=[],t.refresh.apply(this,arguments)}};var m,h,p=c.createElement("I");p.className="jstree-icon jstree-checkbox",p.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,a){this.bind=function(){a.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,a,s=this._model.data,n=(s[t.parent],t.nodes);for(i=0,a=n.length;a>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 a,s,n,r,o,l,d=this._model.data,c=d[i.parent],_=i.nodes,m=[],h=this.settings.checkbox.cascade,p=this.settings.checkbox.tie_selection;if(-1!==h.indexOf("down"))if(c.state[p?"selected":"checked"]){for(s=0,n=_.length;n>s;s++)d[_[s]].state[p?"selected":"checked"]=!0;this._data[p?"core":"checkbox"].selected=this._data[p?"core":"checkbox"].selected.concat(_)}else for(s=0,n=_.length;n>s;s++)if(d[_[s]].state[p?"selected":"checked"]){for(r=0,o=d[_[s]].children_d.length;o>r;r++)d[d[_[s]].children_d[r]].state[p?"selected":"checked"]=!0;this._data[p?"core":"checkbox"].selected=this._data[p?"core":"checkbox"].selected.concat(d[_[s]].children_d)}if(-1!==h.indexOf("up")){for(s=0,n=c.children_d.length;n>s;s++)d[c.children_d[s]].children.length||m.push(d[c.children_d[s]].parent);for(r=0,o=(m=e.vakata.array_unique(m)).length;o>r;r++)for(c=d[m[r]];c&&c.id!==e.jstree.root;){for(a=0,s=0,n=c.children.length;n>s;s++)a+=d[c.children[s]].state[p?"selected":"checked"];if(a!==n)break;c.state[p?"selected":"checked"]=!0,this._data[p?"core":"checkbox"].selected.push(c.id),(l=this.get_node(c,!0))&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(p?"jstree-clicked":"jstree-checked"),c=this.get_node(c.parent)}}this._data[p?"core":"checkbox"].selected=e.vakata.array_unique(this._data[p?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",e.proxy(function(t,i){var a,s,n,r,o=i.node,l=this._model.data,d=this.get_node(o.parent),c=this.get_node(o,!0),_=this.settings.checkbox.cascade,m=this.settings.checkbox.tie_selection,h={},p=this._data[m?"core":"checkbox"].selected;for(a=0,s=p.length;s>a;a++)h[p[a]]=!0;if(-1!==_.indexOf("down"))for(a=0,s=o.children_d.length;s>a;a++)h[o.children_d[a]]=!0,(r=l[o.children_d[a]]).state[m?"selected":"checked"]=!0,r&&r.original&&r.original.state&&r.original.state.undetermined&&(r.original.state.undetermined=!1);if(-1!==_.indexOf("up"))for(;d&&d.id!==e.jstree.root;){for(n=0,a=0,s=d.children.length;s>a;a++)n+=l[d.children[a]].state[m?"selected":"checked"];if(n!==s)break;d.state[m?"selected":"checked"]=!0,h[d.id]=!0,(r=this.get_node(d,!0))&&r.length&&r.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),d=this.get_node(d.parent)}for(a in p=[],h)h.hasOwnProperty(a)&&p.push(a);this._data[m?"core":"checkbox"].selected=p,-1!==_.indexOf("down")&&c.length&&c.find(".jstree-anchor").addClass(m?"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 a,s,n,r=this.get_node(e.jstree.root),o=this._model.data;for(a=0,s=r.children_d.length;s>a;a++)(n=o[r.children_d[a]])&&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 a,s,n,r=i.node,o=this.get_node(r,!0),l=this.settings.checkbox.cascade,d=this.settings.checkbox.tie_selection,c=this._data[d?"core":"checkbox"].selected,_={};if(r&&r.original&&r.original.state&&r.original.state.undetermined&&(r.original.state.undetermined=!1),-1!==l.indexOf("down"))for(a=0,s=r.children_d.length;s>a;a++)(n=this._model.data[r.children_d[a]]).state[d?"selected":"checked"]=!1,n&&n.original&&n.original.state&&n.original.state.undetermined&&(n.original.state.undetermined=!1);if(-1!==l.indexOf("up"))for(a=0,s=r.parents.length;s>a;a++)(n=this._model.data[r.parents[a]]).state[d?"selected":"checked"]=!1,n&&n.original&&n.original.state&&n.original.state.undetermined&&(n.original.state.undetermined=!1),(n=this.get_node(r.parents[a],!0))&&n.length&&n.attr("aria-selected",!1).children(".jstree-anchor").removeClass(d?"jstree-clicked":"jstree-checked");for(_={},a=0,s=c.length;s>a;a++)-1!==l.indexOf("down")&&-1!==e.inArray(c[a],r.children_d)||-1!==l.indexOf("up")&&-1!==e.inArray(c[a],r.parents)||(_[c[a]]=!0);for(a in c=[],_)_.hasOwnProperty(a)&&c.push(a);this._data[d?"core":"checkbox"].selected=c,-1!==l.indexOf("down")&&o.length&&o.find(".jstree-anchor").removeClass(d?"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 a,s,n,r,o=this.get_node(i.parent),l=this._model.data,d=this.settings.checkbox.tie_selection;o&&o.id!==e.jstree.root&&!o.state[d?"selected":"checked"];){for(n=0,a=0,s=o.children.length;s>a;a++)n+=l[o.children[a]].state[d?"selected":"checked"];if(!(s>0&&n===s))break;o.state[d?"selected":"checked"]=!0,this._data[d?"core":"checkbox"].selected.push(o.id),(r=this.get_node(o,!0))&&r.length&&r.attr("aria-selected",!0).children(".jstree-anchor").addClass(d?"jstree-clicked":"jstree-checked"),o=this.get_node(o.parent)}},this)).on("move_node.jstree",e.proxy(function(t,i){var a,s,n,r,o,l=i.is_multi,d=i.old_parent,c=this.get_node(i.parent),_=this._model.data,m=this.settings.checkbox.tie_selection;if(!l)for(a=this.get_node(d);a&&a.id!==e.jstree.root&&!a.state[m?"selected":"checked"];){for(s=0,n=0,r=a.children.length;r>n;n++)s+=_[a.children[n]].state[m?"selected":"checked"];if(!(r>0&&s===r))break;a.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(a.id),(o=this.get_node(a,!0))&&o.length&&o.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),a=this.get_node(a.parent)}for(a=c;a&&a.id!==e.jstree.root;){for(s=0,n=0,r=a.children.length;r>n;n++)s+=_[a.children[n]].state[m?"selected":"checked"];if(s===r)a.state[m?"selected":"checked"]||(a.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(a.id),(o=this.get_node(a,!0))&&o.length&&o.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"));else{if(!a.state[m?"selected":"checked"])break;a.state[m?"selected":"checked"]=!1,this._data[m?"core":"checkbox"].selected=e.vakata.array_remove_item(this._data[m?"core":"checkbox"].selected,a.id),(o=this.get_node(a,!0))&&o.length&&o.attr("aria-selected",!1).children(".jstree-anchor").removeClass(m?"jstree-clicked":"jstree-checked")}a=this.get_node(a.parent)}},this))},this._undetermined=function(){if(null!==this.element){var i,a,s,n,r={},o=this._model.data,l=this.settings.checkbox.tie_selection,d=this._data[l?"core":"checkbox"].selected,c=[],_=this;for(i=0,a=d.length;a>i;i++)if(o[d[i]]&&o[d[i]].parents)for(s=0,n=o[d[i]].parents.length;n>s&&r[o[d[i]].parents[s]]===t;s++)o[d[i]].parents[s]!==e.jstree.root&&(r[o[d[i]].parents[s]]=!0,c.push(o[d[i]].parents[s]));for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var l,d=_.get_node(this);if(d.state.loaded){for(i=0,a=d.children_d.length;a>i;i++)if(!(l=o[d.children_d[i]]).state.loaded&&l.original&&l.original.state&&l.original.state.undetermined&&!0===l.original.state.undetermined)for(r[l.id]===t&&l.id!==e.jstree.root&&(r[l.id]=!0,c.push(l.id)),s=0,n=l.parents.length;n>s;s++)r[l.parents[s]]===t&&l.parents[s]!==e.jstree.root&&(r[l.parents[s]]=!0,c.push(l.parents[s]))}else if(d.original&&d.original.state&&d.original.state.undetermined&&!0===d.original.state.undetermined)for(r[d.id]===t&&d.id!==e.jstree.root&&(r[d.id]=!0,c.push(d.id)),s=0,n=d.parents.length;n>s;s++)r[d.parents[s]]===t&&d.parents[s]!==e.jstree.root&&(r[d.parents[s]]=!0,c.push(d.parents[s]))}),this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),i=0,a=c.length;a>i;i++)o[c[i]].state[l?"selected":"checked"]||(d=this.get_node(c[i],!0))&&d.length&&d.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(t,i,s,n){if(t=a.redraw_node.apply(this,arguments)){var r,o,l=null,d=null;for(r=0,o=t.childNodes.length;o>r;r++)if(t.childNodes[r]&&t.childNodes[r].className&&-1!==t.childNodes[r].className.indexOf("jstree-anchor")){l=t.childNodes[r];break}l&&(!this.settings.checkbox.tie_selection&&this._model.data[t.id].state.checked&&(l.className+=" jstree-checked"),d=p.cloneNode(!1),this._model.data[t.id].state.checkbox_disabled&&(d.className+=" jstree-checkbox-disabled"),l.insertBefore(d,l.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,a,s=this.settings.checkbox.cascade,n=this.settings.checkbox.tie_selection,r=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,a=t.children_d.length;a>i;i++)if(-1!==e.inArray(t.children_d[i],r)||!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,a,s;if(e.isArray(t)){for(i=0,a=(t=t.slice()).length;a>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,a,s;if(e.isArray(t)){for(i=0,a=(t=t.slice()).length;a>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")?a.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 a,s,n;if(e.isArray(t)){for(s=0,n=(t=t.slice()).length;n>s;s++)this.check_node(t[s],i);return!0}return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&(a=this.get_node(t,!0),void(t.state.checked||(t.state.checked=!0,this._data.checkbox.selected.push(t.id),a&&a.length&&a.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 a,s,n;if(e.isArray(t)){for(a=0,s=(t=t.slice()).length;s>a;a++)this.uncheck_node(t[a],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,a,s,n,r=this.get_checked(!0),o={};for(i=0,a=r.length;a>i;i++)o[r[i].id]=r[i];for(i=0,a=r.length;a>i;i++)for(s=0,n=r[i].children_d.length;n>s;s++)o[r[i].children_d[s]]&&delete o[r[i].children_d[s]];for(i in r=[],o)o.hasOwnProperty(i)&&r.push(i);return t?e.map(r,e.proxy(function(e){return this.get_node(e)},this)):r},this.get_bottom_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(t);var i,a,s=this.get_checked(!0),n=[];for(i=0,a=s.length;a>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,r;if(!e.isArray(t)&&!this.settings.checkbox.tie_selection&&((r=this.get_node(t))&&r.state.loaded))for(s=0,n=r.children_d.length;n>s;s++)this._model.data[r.children_d[s]].state.checked&&(!0,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,r.children_d[s]));return a.load_node.apply(this,arguments)},this.get_state=function(){var e=a.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=a.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=[]),a.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),a=i.get_node(t.reference);i.create_node(a,{},"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),a=i.get_node(t.reference);i.edit(a)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(t){var i=e.jstree.reference(t.reference),a=i.get_node(t.reference);i.is_selected(a)?i.delete_node(i.get_selected()):i.delete_node(a)}},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),a=i.get_node(t.reference);i.is_selected(a)?i.cut(i.get_top_selected()):i.cut(a)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(t){var i=e.jstree.reference(t.reference),a=i.get_node(t.reference);i.is_selected(a)?i.copy(i.get_top_selected()):i.copy(a)}},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),a=i.get_node(t.reference);i.paste(a)}}}}}}},e.jstree.plugins.contextmenu=function(i,a){this.bind=function(){a.bind.call(this);var t,i,s=0,n=null;this.element.on("contextmenu.jstree",".jstree-anchor",e.proxy(function(e,t){"input"!==e.target.tagName.toLowerCase()&&(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(a){a.originalEvent&&a.originalEvent.changedTouches&&a.originalEvent.changedTouches[0]&&(t=a.originalEvent.changedTouches[0].clientX,i=a.originalEvent.changedTouches[0].clientY,n=setTimeout(function(){e(a.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.originalEvent.changedTouches[0].clientX)>50||Math.abs(i-e.originalEvent.changedTouches[0].clientY)>50)&&clearTimeout(n)}).on("touchend.vakata.jstree",function(e){n&&clearTimeout(n)}),e(c).on("context_hide.vakata.jstree",e.proxy(function(t,i){this._data.contextmenu.visible=!1,e(i.reference).removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),a.teardown.call(this)},this.show_contextmenu=function(i,a,s,n){if(!(i=this.get_node(i))||i.id===e.jstree.root)return!1;var r=this.settings.contextmenu,o=this.get_node(i,!0).children(".jstree-anchor"),l=!1,d=!1;(r.show_at_node||a===t||s===t)&&(l=o.offset(),a=l.left,s=l.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(i)&&this.activate_node(i,n),d=r.items,e.isFunction(d)&&(d=d.call(this,i,e.proxy(function(e){this._show_contextmenu(i,a,s,e)},this))),e.isPlainObject(d)&&this._show_contextmenu(i,a,s,d)},this._show_contextmenu=function(t,i,a,s){var n=this.get_node(t,!0).children(".jstree-anchor");e(c).one("context_show.vakata.jstree",e.proxy(function(t,i){var a="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";e(i.element).addClass(a),n.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,e.vakata.context.show(n,{x:i,y:a},s),this.trigger("show_contextmenu",{node:t,x:i,y:a})}},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(c).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,a){if(!t)return!1;a||(i.html="",i.items=[]);var s,n="",r=!1;return a&&(n+="<ul>"),e.each(t,function(t,a){return!a||(i.items.push(a),!r&&a.separator_before&&(n+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>"),r=!1,n+="<li class='"+(a._class||"")+(!0===a._disabled||e.isFunction(a._disabled)&&a._disabled({item:a,reference:i.reference,element:i.element})?" vakata-contextmenu-disabled ":"")+"' "+(a.shortcut?" data-shortcut='"+a.shortcut+"' ":"")+">",n+="<a href='#' rel='"+(i.items.length-1)+"' "+(a.title?"title='"+a.title+"'":"")+">",e.vakata.context.settings.icons&&(n+="<i ",a.icon&&(n+=-1!==a.icon.indexOf("/")||-1!==a.icon.indexOf(".")?" style='background:url(\""+a.icon+"\") center center no-repeat' ":" class='"+a.icon+"' "),n+="></i><span class='vakata-contextmenu-sep'>&#160;</span>"),n+=(e.isFunction(a.label)?a.label({item:t,reference:i.reference,element:i.element}):a.label)+(a.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+a.shortcut+'">'+(a.shortcut_label||"")+"</span>":"")+"</a>",a.submenu&&((s=e.vakata.context._parse(a.submenu,!0))&&(n+=s)),n+="</li>",void(a.separator_after&&(n+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>",r=!0)))}),n=n.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),a&&(n+="</ul>"),a||(i.html=n,e.vakata.context._trigger("parse")),n.length>10&&n},_show_submenu:function(i){if((i=e(i)).length&&i.children("ul").length){var a=i.children("ul"),s=i.offset().left,n=s+i.outerWidth(),r=i.offset().top,o=a.width(),l=a.height(),d=e(window).width()+e(window).scrollLeft(),c=e(window).height()+e(window).scrollTop();t?i[n-(o+10+i.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):i[n+o>d&&s>d-n?"addClass":"removeClass"]("vakata-context-right"),r+l+10>c&&a.css("bottom","-1px"),i.hasClass("vakata-context-right")?o>s&&a.css("margin-right",s-o):o>d-n&&a.css("margin-left",d-n-o),a.show()}},show:function(a,s,n){var r,o,l,d,c,_,m,h;switch(i.element&&i.element.length&&i.element.width(""),!0){case!s&&!a:return!1;case!!s&&!!a:i.reference=a,i.position_x=s.x,i.position_y=s.y;break;case!s&&!!a:i.reference=a,r=a.offset(),i.position_x=r.left+a.outerHeight(),i.position_y=r.top;break;case!!s&&!a:i.position_x=s.x,i.position_y=s.y}a&&!n&&e(a).data("vakata_contextmenu")&&(n=e(a).data("vakata_contextmenu")),e.vakata.context._parse(n)&&i.element.html(i.html),i.items.length&&(i.element.appendTo("body"),o=i.element,l=i.position_x,d=i.position_y,c=o.width(),_=o.height(),m=e(window).width()+e(window).scrollLeft(),h=e(window).height()+e(window).scrollTop(),t&&((l-=o.outerWidth()-e(a).outerWidth())<e(window).scrollLeft()+20&&(l=e(window).scrollLeft()+20)),l+c+20>m&&(l=m-(c+20)),d+_+20>h&&(d=h-(_+20)),i.element.css({left:l,top:d}).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 a=!1;i.element=e("<ul class='vakata-context'></ul>"),i.element.on("mouseenter","li",function(t){t.stopImmediatePropagation(),e.contains(this,t.relatedTarget)||(a&&clearTimeout(a),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&&(a=setTimeout(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 a=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&&((a=i.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first()).length||(a=i.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),a.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&&((a=i.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first()).length||(a=i.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),a.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(c).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,a){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},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 c.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),a=this.is_selected(i)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,s=a>1?a+" "+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,a>1?this.get_top_selected(!0):[i],t))){if(m={jstree:!0,origin:this,obj:this.get_node(i,!0),nodes:a>1?this.get_top_selected():[i.id]},h=t.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(t,m,'<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:h,data:m})}},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:h,data:m}),!1}).on("drop.jstree",e.proxy(function(t){return t.preventDefault(),e.vakata.dnd._trigger("stop",t,{helper:e(),element:h,data:m}),!1},this))},this.redraw_node=function(e,t,a,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,r,o=null;for(n=0,r=e.childNodes.length;r>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,a=!1,s=!1,n=!1,r=e('<div id="jstree-marker">&#160;</div>').hide();e(c).on("dnd_start.vakata.jstree",function(e,t){i=!1,s=!1,t&&t.data&&t.data.jstree&&r.appendTo("body")}).on("dnd_move.vakata.jstree",function(o,l){if(n&&(l.event&&"dragover"===l.event.type&&l.event.target===s.target||clearTimeout(n)),l&&l.data&&l.data.jstree&&(!l.event.target.id||"jstree-marker"!==l.event.target.id)){s=l.event;var d,c,_,m,h,p,g,u,f,v,b,y,k,j,x,T,w=e.jstree.reference(l.event.target),$=!1,C=!1,M=!1;if(w&&w._data&&w._data.dnd)if(r.attr("class","jstree-"+w.get_theme()+(w.settings.core.themes.responsive?" jstree-dnd-responsive":"")),x=l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey)),l.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()[x?"show":"hide"](),l.event.target!==w.element[0]&&l.event.target!==w.get_container_ul()[0]||0!==w.get_container_ul().children().length){if(($=w.settings.dnd.large_drop_target?e(l.event.target).closest(".jstree-node").children(".jstree-anchor"):e(l.event.target).closest(".jstree-anchor"))&&$.length&&$.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(C=$.offset(),M=(l.event.pageY!==t?l.event.pageY:l.event.originalEvent.pageY)-C.top,_=$.outerHeight(),p=_/3>M?["b","i","a"]:M>_-_/3?["a","i","b"]:M>_/2?["i","a","b"]:["i","b","a"],e.each(p,function(t,s){switch(s){case"b":d=C.left-6,c=C.top,m=w.get_parent($),h=$.parent().index();break;case"i":k=w.settings.dnd.inside_pos,j=w.get_node($.parent()),d=C.left-2,c=C.top+_/2+1,m=j.id,h="first"===k?0:"last"===k?j.children.length:Math.min(k,j.children.length);break;case"a":d=C.left-6,c=C.top+_,m=w.get_parent($),h=$.parent().index()+1}for(g=!0,u=0,f=l.data.nodes.length;f>u;u++)if(v=l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey))?"copy_node":"move_node",b=h,"move_node"===v&&"a"===s&&l.data.origin&&l.data.origin===w&&m===w.get_parent(l.data.nodes[u])&&(y=w.get_node(m),b>e.inArray(l.data.nodes[u],y.children)&&(b-=1)),!(g=g&&(w&&w.settings&&w.settings.dnd&&!1===w.settings.dnd.check_while_dragging||w.check(v,l.data.origin&&l.data.origin!==w?l.data.origin.get_node(l.data.nodes[u]):l.data.nodes[u],m,b,{dnd:!0,ref:w.get_node($.parent()),pos:s,origin:l.data.origin,is_multi:l.data.origin&&l.data.origin!==w,is_foreign:!l.data.origin})))){w&&w.last_error&&(a=w.last_error());break}return"i"===s&&$.parent().is(".jstree-closed")&&w.settings.dnd.open_timeout&&(n=setTimeout(function(e,t){return function(){e.open_node(t)}}(w,$),w.settings.dnd.open_timeout)),g?((T=w.get_node(m,!0)).hasClass(".jstree-dnd-parent")||(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),T.addClass("jstree-dnd-parent")),i={ins:w,par:m,pos:"i"!==s||"last"!==k||0!==h||w.is_loaded(j)?h:"last"},r.css({left:d+"px",top:c+"px"}).show(),l.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),l.event.originalEvent&&l.event.originalEvent.dataTransfer&&(l.event.originalEvent.dataTransfer.dropEffect=x?"copy":"move"),a={},p=!0,!1):void 0}),!0===p))return}else{for(g=!0,u=0,f=l.data.nodes.length;f>u&&(g=g&&w.check(l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey))?"copy_node":"move_node",l.data.origin&&l.data.origin!==w?l.data.origin.get_node(l.data.nodes[u]):l.data.nodes[u],e.jstree.root,"last",{dnd:!0,ref:w.get_node(e.jstree.root),pos:"i",origin:l.data.origin,is_multi:l.data.origin&&l.data.origin!==w,is_foreign:!l.data.origin}));u++);if(g)return i={ins:w,par:e.jstree.root,pos:"last"},r.hide(),l.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(l.event.originalEvent&&l.event.originalEvent.dataTransfer&&(l.event.originalEvent.dataTransfer.dropEffect=x?"copy":"move"))}e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),i=!1,l.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),l.event.originalEvent&&l.event.originalEvent.dataTransfer&&(l.event.originalEvent.dataTransfer.dropEffect="none"),r.hide()}}).on("dnd_scroll.vakata.jstree",function(e,t){t&&t.data&&t.data.jstree&&(r.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(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),n&&clearTimeout(n),o&&o.data&&o.data.jstree){r.hide().detach();var l,d,c=[];if(i){for(l=0,d=o.data.nodes.length;d>l;l++)c[l]=o.data.origin?o.data.origin.get_node(o.data.nodes[l]):o.data.nodes[l];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"](c,i.par,i.pos,!1,!1,!1,o.data.origin)}else(l=e(o.event.target).closest(".jstree")).length&&a&&a.error&&"check"===a.error&&((l=l.jstree(!0))&&l.settings.core.error.call(this,a));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,a=!1,s=!1,n=!1,r.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,a,s){s===t&&(s=e.vakata.dnd._get()),s.event=a,e(c).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(c).off("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(c).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 a=i.scroll_e.scrollTop(),s=i.scroll_e.scrollLeft();i.scroll_e.scrollTop(a+i.scroll_t*e.vakata.dnd.settings.scroll_speed),i.scroll_e.scrollLeft(s+i.scroll_l*e.vakata.dnd.settings.scroll_speed),(a!==i.scroll_e.scrollTop()||s!==i.scroll_e.scrollLeft())&&e.vakata.dnd._trigger("scroll",i.scroll_e)},start:function(t,a,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=c.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=a,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(c).on("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(c).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=c.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(i.target).one("click.vakata",!1),e.vakata.dnd._trigger("start",t)}var a=!1,s=!1,n=!1,r=!1,o=!1,l=!1,d=!1,_=!1,m=!1,h=!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 a=e(this),s=a.offset();return this.scrollHeight>this.offsetHeight&&(s.top+a.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+a.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||(a=e(c),s=e(window),n=a.height(),r=s.height(),o=a.width(),l=s.width(),d=a.scrollTop(),_=a.scrollLeft(),n>r&&t.pageY-d<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=-1),n>r&&r-(t.pageY-d)<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=1),o>l&&t.pageX-_<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=-1),o>l&&l-(t.pageX-_)<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=1),(i.scroll_t||i.scroll_l)&&(i.scroll_e=a)),i.scroll_e&&e.vakata.dnd._scroll(!0),i.helper&&(m=parseInt(t.pageY+e.vakata.dnd.settings.helper_top,10),h=parseInt(t.pageX+e.vakata.dnd.settings.helper_left,10),n&&m+25>n&&(m=n-50),o&&h+i.helper_w>o&&(h=o-(i.helper_w+2)),i.helper.css({left:h+"px",top:m+"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=c.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),i.is_drag)t.target!==i.target&&e(i.target).off("click.vakata"),e.vakata.dnd._trigger("stop",t);else if("touchend"===t.type&&t.target===i.target){var a=setTimeout(function(){e(t.target).click()},100);e(t.target).one("click",function(){a&&clearTimeout(a)})}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,a,s,n){var r,o,l,d=this.settings.massload,c=(JSON.stringify(t),[]),_=this._model.data;if(!s){for(r=0,o=t.length;o>r;r++)(!_[t[r]]||!_[t[r]].state.loaded&&!_[t[r]].state.failed||n)&&(c.push(t[r]),(l=this.get_node(t[r],!0))&&l.length&&l.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},c.length){if(e.isFunction(d))return d.call(this,c,e.proxy(function(e){var r,o;if(e)for(r in e)e.hasOwnProperty(r)&&(this._data.massload[r]=e[r]);for(r=0,o=t.length;o>r;r++)(l=this.get_node(t[r],!0))&&l.length&&l.removeClass("jstree-loading").attr("aria-busy",!1);i._load_nodes.call(this,t,a,s,n)},this));if("object"==typeof d&&d&&d.url)return d=e.extend(!0,{},d),e.isFunction(d.url)&&(d.url=d.url.call(this,c)),e.isFunction(d.data)&&(d.data=d.data.call(this,c)),e.ajax(d).done(e.proxy(function(e,r,o){var d,c;if(e)for(d in e)e.hasOwnProperty(d)&&(this._data.massload[d]=e[d]);for(d=0,c=t.length;c>d;d++)(l=this.get_node(t[d],!0))&&l.length&&l.removeClass("jstree-loading").attr("aria-busy",!1);i._load_nodes.call(this,t,a,s,n)},this)).fail(e.proxy(function(e){i._load_nodes.call(this,t,a,s,n)},this))}}return i._load_nodes.call(this,t,a,s,n)},this._load_node=function(t,a){var s,n=this._data.massload[t.id],r=null;return n?(r=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){a.call(this,e)}),(s=this.get_node(t.id,!0))&&s.length&&s.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[t.id],r):i._load_node.call(this,t,a)}},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,a){this.bind=function(){a.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 a,s,n,r,o=this._model.data,l=[];for(a=0,s=i.res.length;s>a;a++)if(o[i.res[a]]&&!o[i.res[a]].state.hidden&&(l.push(i.res[a]),l=l.concat(o[i.res[a]].parents),this._data.search.smc))for(n=0,r=o[i.res[a]].children_d.length;r>n;n++)o[o[i.res[a]].children_d[n]]&&!o[o[i.res[a]].children_d[n]].state.hidden&&l.push(o[i.res[a]].children_d[n]);l=e.vakata.array_remove_item(e.vakata.array_unique(l),e.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(l,!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,a,s,n,r,o){if(!1===i||""===e.trim(i.toString()))return this.clear_search();n=(n=this.get_node(n))&&n.id?n.id:null,i=i.toString();var l,d,c=this.settings.search,_=!!c.ajax&&c.ajax,m=this._model.data,h=null,p=[],g=[];if(this._data.search.res.length&&!r&&this.clear_search(),s===t&&(s=c.show_only_matches),o===t&&(o=c.show_only_matches_children),!a&&!1!==_)return e.isFunction(_)?_.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,r)})},this),n):((_=e.extend({},_)).data||(_.data={}),_.data.str=i,n&&(_.data.inside=n),e.ajax(_).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(_)},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,r)})},this)));if(r||(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),h=new e.vakata.search(i,!0,{caseSensitive:c.case_sensitive,fuzzy:c.fuzzy}),e.each(m[n||e.jstree.root].children_d,function(e,t){var a=m[t];a.text&&!a.state.hidden&&(!c.search_leaves_only||a.state.loaded&&0===a.children.length)&&(c.search_callback&&c.search_callback.call(this,i,a)||!c.search_callback&&h.search(a.text).isMatch)&&(p.push(t),g=g.concat(a.parents))}),p.length){for(l=0,d=(g=e.vakata.array_unique(g)).length;d>l;l++)g[l]!==e.jstree.root&&m[g[l]]&&!0===this.open_node(g[l],null,0)&&this._data.search.opn.push(g[l]);r?(this._data.search.dom=this._data.search.dom.add(e(this.element[0].querySelectorAll("#"+e.map(p,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(p))):(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(p,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=p),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=a.redraw_node.apply(this,arguments))&&-1!==e.inArray(t.id,this._data.search.res)){var r,o,l=null;for(r=0,o=t.childNodes.length;o>r;r++)if(t.childNodes[r]&&t.childNodes[r].className&&-1!==t.childNodes[r].className.indexOf("jstree-anchor")){l=t.childNodes[r];break}l&&(l.className+=" jstree-search")}return t}},function(e){e.vakata.search=function(t,i,a){a=a||{},!1!==(a=e.extend({},e.vakata.search.defaults,a)).fuzzy&&(a.fuzzy=!0),t=a.caseSensitive?t:t.toLowerCase();var s,n,r,o,l=a.location,d=a.distance,c=a.threshold,_=t.length;return _>32&&(a.fuzzy=!1),a.fuzzy&&(s=1<<_-1,n=function(){var e={},i=0;for(i=0;_>i;i++)e[t.charAt(i)]=0;for(i=0;_>i;i++)e[t.charAt(i)]|=1<<_-i-1;return e}(),r=function(e,t){var i=e/_,a=Math.abs(l-t);return d?i+a/d:a?1:i}),o=function(e){if(e=a.caseSensitive?e:e.toLowerCase(),t===e||-1!==e.indexOf(t))return{isMatch:!0,score:0};if(!a.fuzzy)return{isMatch:!1,score:1};var i,o,d,m,h,p,g,u,f,v=e.length,b=c,y=e.indexOf(t,l),k=_+v,j=1,x=[];for(-1!==y&&(b=Math.min(r(0,y),b),-1!==(y=e.lastIndexOf(t,l+_))&&(b=Math.min(r(0,y),b))),y=-1,i=0;_>i;i++){for(d=0,m=k;m>d;)r(i,l+m)<=b?d=m:k=m,m=Math.floor((k-d)/2+d);for(k=m,p=Math.max(1,l-m+1),g=Math.min(l+m,v)+_,(u=new Array(g+2))[g+1]=(1<<i)-1,o=g;o>=p;o--)if(f=n[e.charAt(o-1)],u[o]=0===i?(u[o+1]<<1|1)&f:(u[o+1]<<1|1)&f|(h[o+1]|h[o])<<1|1|h[o+1],u[o]&s&&b>=(j=r(i,o-1))){if(b=j,y=o-1,x.push(y),!(y>l))break;p=Math.max(1,2*l-y)}if(r(i+1,l)>b)break;h=u}return{isMatch:y>=0,score:j}},!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 a,s;if((t=this.get_node(t))&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),i))for(a=0,s=t.children_d.length;s>a;a++)this.sort(t.children_d[a],!1)}};var g=!1;e.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1},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(){g&&clearTimeout(g),g=setTimeout(e.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this);this.element.on("ready.jstree",e.proxy(function(e,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,a){a.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,a){this.init=function(i,s){var n,r;if(s&&s.types&&s.types.default)for(n in s.types)if("default"!==n&&n!==e.jstree.root&&s.types.hasOwnProperty(n))for(r in s.types.default)s.types.default.hasOwnProperty(r)&&s.types[n][r]===t&&(s.types[n][r]=s.types.default[r]);a.init.call(this,i,s),this._model.data[e.jstree.root].type=e.jstree.root},this.refresh=function(t,i){a.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,a){var s,n,r,o=this._model.data,l=a.nodes,d=this.settings.types,c="default";for(s=0,n=l.length;n>s;s++){if(c="default",o[l[s]].original&&o[l[s]].original.type&&d[o[l[s]].original.type]&&(c=o[l[s]].original.type),o[l[s]].data&&o[l[s]].data.jstree&&o[l[s]].data.jstree.type&&d[o[l[s]].data.jstree.type]&&(c=o[l[s]].data.jstree.type),o[l[s]].type=c,!0===o[l[s]].icon&&d[c].icon!==t&&(o[l[s]].icon=d[c].icon),d[c].li_attr!==t&&"object"==typeof d[c].li_attr)for(r in d[c].li_attr)if(d[c].li_attr.hasOwnProperty(r)){if("id"===r)continue;o[l[s]].li_attr[r]===t?o[l[s]].li_attr[r]=d[c].li_attr[r]:"class"===r&&(o[l[s]].li_attr.class=d[c].li_attr.class+" "+o[l[s]].li_attr.class)}if(d[c].a_attr!==t&&"object"==typeof d[c].a_attr)for(r in d[c].a_attr)if(d[c].a_attr.hasOwnProperty(r)){if("id"===r)continue;o[l[s]].a_attr[r]===t?o[l[s]].a_attr[r]=d[c].a_attr[r]:"href"===r&&"#"===o[l[s]].a_attr[r]?o[l[s]].a_attr.href=d[c].a_attr.href:"class"===r&&(o[l[s]].a_attr.class=d[c].a_attr.class+" "+o[l[s]].a_attr.class)}}o[e.jstree.root].type=e.jstree.root},this)),a.bind.call(this)},this.get_json=function(t,i,s){var n,r,o=this._model.data,l=i?e.extend(!0,{},i,{no_id:!1}):{},d=a.get_json.call(this,t,l,s);if(!1===d)return!1;if(e.isArray(d))for(n=0,r=d.length;r>n;n++)d[n].type=d[n].id&&o[d[n].id]&&o[d[n].id].type?o[d[n].id].type:"default",i&&i.no_id&&(delete d[n].id,d[n].li_attr&&d[n].li_attr.id&&delete d[n].li_attr.id,d[n].a_attr&&d[n].a_attr.id&&delete d[n].a_attr.id);else d.type=d.id&&o[d.id]&&o[d.id].type?o[d.id].type:"default",i&&i.no_id&&(d=this._delete_ids(d));return d},this._delete_ids=function(t){if(e.isArray(t)){for(var i=0,a=t.length;a>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,r,o){if(!1===a.check.call(this,i,s,n,r,o))return!1;s=s&&s.id?s:this.get_node(s),n=n&&n.id?n:this.get_node(n);var l,d,c,_,m=s&&s.id?o&&o.origin?o.origin:e.jstree.reference(s.id):null;switch(m=m&&m._model&&m._model.data?m._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((l=this.get_rules(n)).max_children!==t&&-1!==l.max_children&&l.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:r,obj:!(!s||!s.id)&&s.id,par:!(!n||!n.id)&&n.id})},!1;if(l.valid_children!==t&&-1!==l.valid_children&&-1===e.inArray(s.type||"default",l.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:r,obj:!(!s||!s.id)&&s.id,par:!(!n||!n.id)&&n.id})},!1;if(m&&s.children_d&&s.parents){for(d=0,c=0,_=s.children_d.length;_>c;c++)d=Math.max(d,m[s.children_d[c]].parents.length);d=d-s.parents.length+1}(0>=d||d===t)&&(d=1);do{if(l.max_depth!==t&&-1!==l.max_depth&&l.max_depth<d)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:r,obj:!(!s||!s.id)&&s.id,par:!(!n||!n.id)&&n.id})},!1;n=this.get_node(n.parent),l=this.get_rules(n),d++}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,a){var s,n,r,o,l,d,c,_,m=this._model.data;if(e.isArray(i)){for(n=0,r=(i=i.slice()).length;r>n;n++)this.set_type(i[n],a);return!0}if(s=this.settings.types,i=this.get_node(i),!s[a]||!i)return!1;if((c=this.get_node(i,!0))&&c.length&&(_=c.children(".jstree-anchor")),o=i.type,l=this.get_icon(i),i.type=a,(!0===l||s[o]&&s[o].icon!==t&&l===s[o].icon)&&this.set_icon(i,s[a].icon===t||s[a].icon),s[o].li_attr!==t&&"object"==typeof s[o].li_attr)for(d in s[o].li_attr)if(s[o].li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"===d?(m[i.id].li_attr.class=(m[i.id].li_attr.class||"").replace(s[o].li_attr[d],""),c&&c.removeClass(s[o].li_attr[d])):m[i.id].li_attr[d]===s[o].li_attr[d]&&(m[i.id].li_attr[d]=null,c&&c.removeAttr(d))}if(s[o].a_attr!==t&&"object"==typeof s[o].a_attr)for(d in s[o].a_attr)if(s[o].a_attr.hasOwnProperty(d)){if("id"===d)continue;"class"===d?(m[i.id].a_attr.class=(m[i.id].a_attr.class||"").replace(s[o].a_attr[d],""),_&&_.removeClass(s[o].a_attr[d])):m[i.id].a_attr[d]===s[o].a_attr[d]&&("href"===d?(m[i.id].a_attr[d]="#",_&&_.attr("href","#")):(delete m[i.id].a_attr[d],_&&_.removeAttr(d)))}if(s[a].li_attr!==t&&"object"==typeof s[a].li_attr)for(d in s[a].li_attr)if(s[a].li_attr.hasOwnProperty(d)){if("id"===d)continue;m[i.id].li_attr[d]===t?(m[i.id].li_attr[d]=s[a].li_attr[d],c&&("class"===d?c.addClass(s[a].li_attr[d]):c.attr(d,s[a].li_attr[d]))):"class"===d&&(m[i.id].li_attr.class=s[a].li_attr[d]+" "+m[i.id].li_attr.class,c&&c.addClass(s[a].li_attr[d]))}if(s[a].a_attr!==t&&"object"==typeof s[a].a_attr)for(d in s[a].a_attr)if(s[a].a_attr.hasOwnProperty(d)){if("id"===d)continue;m[i.id].a_attr[d]===t?(m[i.id].a_attr[d]=s[a].a_attr[d],_&&("class"===d?_.addClass(s[a].a_attr[d]):_.attr(d,s[a].a_attr[d]))):"href"===d&&"#"===m[i.id].a_attr[d]?(m[i.id].a_attr.href=s[a].a_attr.href,_&&_.attr("href",s[a].a_attr.href)):"class"===d&&(m[i.id].a_attr.class=s[a].a_attr.class+" "+m[i.id].a_attr.class,_&&_.addClass(s[a].a_attr[d]))}return!0}},e.jstree.defaults.unique={case_sensitive:!1,duplicate:function(e,t){return e+" ("+t+")"}},e.jstree.plugins.unique=function(i,a){this.check=function(t,i,s,n,r){if(!1===a.check.call(this,t,i,s,n,r))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,l,d="rename_node"===t?n:i.text,c=[],_=this.settings.unique.case_sensitive,m=this._model.data;for(o=0,l=s.children.length;l>o;o++)c.push(_?m[s.children[o]].text:m[s.children[o]].text.toLowerCase());switch(_||(d=d.toLowerCase()),t){case"delete_node":return!0;case"rename_node":return(o=-1===e.inArray(d,c)||i.text&&i.text[_?"toString":"toLowerCase"]()===d)||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+d+" 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(d,c))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+d+" 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(d,c))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+d+" 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&&(!r||!r.is_multi)||-1===e.inArray(d,c))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+d+" 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,r,o){if(!s||s.text===t){if(null===i&&(i=e.jstree.root),!(i=this.get_node(i)))return a.create_node.call(this,i,s,n,r,o);if(!(n=n===t?"last":n).toString().match(/^(before|after)$/)&&!o&&!this.is_loaded(i))return a.create_node.call(this,i,s,n,r,o);s||(s={});var l,d,c,_,m,h=this._model.data,p=this.settings.unique.case_sensitive,g=this.settings.unique.duplicate;for(d=l=this.get_string("New node"),c=[],_=0,m=i.children.length;m>_;_++)c.push(p?h[i.children[_]].text:h[i.children[_]].text.toLowerCase());for(_=1;-1!==e.inArray(p?d:d.toLowerCase(),c);)d=g.call(this,l,++_).toString();s.text=d}return a.create_node.call(this,i,s,n,r,o)}};var u=c.createElement("DIV");if(u.setAttribute("unselectable","on"),u.setAttribute("role","presentation"),u.className="jstree-wholerow",u.innerHTML="&#160;",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,a,s=!1;for(i=0,a=t.selected.length;a>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,a,s,n){if(t=i.redraw_node.apply(this,arguments)){var r=u.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(r.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===t.id&&(r.className+=" jstree-wholerow-hovered"),t.insertBefore(r,t.childNodes[0])}return t}},c.registerElement&&Object&&Object.create){var f=Object.create(HTMLElement.prototype);f.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{c.registerElement("vakata-jstree",{prototype:f})}catch(e){}}}}),$(function(){function e(e,t,i){$.ajax({type:"POST",url:"/melis/MelisCms/Sites/saveSite?siteId="+t,data:e,dataType:"json",encode:!0,beforeSend:function(){melisCoreTool.pending("#btn-save-meliscms-tool-sites")}}).done(function(e){if(1===e.success)melisHelper.melisOkNotification(e.textTitle,e.textMessage,"#72af46"),melisCore.flashMessenger(),melisCoreTool.done("#btn-save-meliscms-tool-sites"),melisHelper.zoneReload(t+"_id_meliscms_tool_sites_edit_site","meliscms_tool_sites_edit_site",{siteId:t,moduleName:i,cpath:"meliscms_tool_sites_edit_site"}),$("#tableToolSites").DataTable().ajax.reload(),$("input[name=left_tree_search]").val(""),$("#id-mod-menu-dynatree").fancytree("destroy"),mainTree();else{var a=t+"_id_meliscms_tool_sites_edit_site",s=function(e,t){var i={};return $.each(e,function(e,a){var s=$("#"+t+" #"+e),n=s.data("lang"),r=s.siblings("label").text(),o=r.substr(r.length-1),l=e.split("_");null!=n?(r=s.closest("div").siblings("label").text().slice(0,-1),i[n+" "+r]=a):""===r?(r=s.closest("div").siblings("label").text().slice(0,-2),i[r]=a):("*"===o&&(r=s.siblings("label").text().slice(0,-2)),"sdom"===l[1]&&(r="*"===o?s.siblings("label").text().slice(0,-2)+"("+l[0]+")":s.siblings("label").text()+"("+l[0]+")"),i[r]=a)}),i}(e.errors,a);!function(e,t,i){0===e||!1===e?($("#"+i+" .form-group label").css("color","#686868"),$.each(t,function(e,t){$("#"+i+" .form-control[name='"+e+"']").parents(".form-group").children("label").css("color","red")})):$("#"+i+" .form-group label").css("color","#686868")}(e.success,e.errors,a),melisHelper.melisKoNotification(e.textTitle,e.textMessage,s),melisCoreTool.done("#btn-save-meliscms-tool-sites")}melisCore.flashMessenger(),melisCoreTool.done("#btn-save-meliscms-tool-sites")}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})}$body=$("body"),$body.on("click","#btn-save-meliscms-tool-sites",function(){var t=activeTabId.split("_")[0],i=$("#"+t+"_id_meliscms_tool_sites_edit_site form").serializeArray(),a=[];$.each(i,function(e,t){str1=t.name,str2="moduleLoad",-1!=str1.indexOf(str2)&&a.push(str1.replace("moduleLoad",""))});var s=$("#"+t+"_currentEnabledModule").val(),n=$("#"+t+"_sitesUsingModules").val();s=jQuery.parseJSON(s),n=jQuery.parseJSON(n);var r="";$.each(n,function(e,t){r+="<br>- "+t});var o=function(e,t){var i=[];if(null!=e&&e.length>0){for(var a=0;a<e.length;a++)t[a]!==e[a]&&i.push(e[a]);if(i.length<1)for(var a=0;a<t.length;a++)t[a]!==e[a]&&i.push(e[a])}return i}(s,a),l=$("#"+t+"_siteModuleName").val(),d=$("#not-admin-notice").length<1;o.length>0&&d?melisCoreTool.confirm(translations.tr_meliscms_common_save,translations.tr_meliscms_tool_sites_cancel,translations.tr_meliscms_tool_site_module_load_update_title,translations.tr_meliscms_tool_site_module_load_update_confirm.replace(/%s/g,r),function(){e(i=$.param(i),t,l)}):e(i=$.param(i),t,l)}),$body.on("click",".btnEditSites",function(){var e=$(this),t=e.closest("tr").attr("id"),i=e.closest("tr").find("td:nth-child(2)").text(),a=e.closest("tr").find("td:nth-child(4)").text(),s=e.closest("tr").find("td:nth-child(3)").text();v(b(e.closest("tr").attr("id"),i,s,a),t,s)});var t={},i="",a="",s=!0,n=!0,r=null,o="",l="",d="",c=[],_=!1,m="";$body.on("click","#tableToolSites .btnDeleteSite",function(e){var t=$(this).parents("tr").attr("id");melisCoreTool.confirm(translations.tr_meliscore_common_yes,translations.tr_meliscore_common_no,translations.tr_meliscms_tool_site_delete_confirm_title,translations.tr_meliscms_tool_site_delete_confirm,function(){$.ajax({type:"POST",url:"/melis/MelisCms/Sites/deleteSite",data:{siteId:t},dataType:"json",encode:!0}).done(function(e){melisCoreTool.pending(".btnDeleteSite"),e.success?(melisHelper.tabClose(t+"_id_meliscms_tool_sites_edit_site"),melisHelper.melisOkNotification(e.textTitle,e.textMessage),$("#tableToolSites").DataTable().ajax.reload()):melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors,0),melisCore.flashMessenger(),melisCoreTool.done(".btnDeleteSite")}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})})});var h="/melis/MelisCms/Sites/renderToolSitesModalContainer";function p(e,t){var i={},a={};return $.each(e,function(e,s){if("site_selected_lang"==this.name){var n=this.value.split("-");t=n[2],i[n[1]]=n[0]}else i[s.name]=s.value;a.data=i,a.langDetails=t}),a}function g(e){var t="";return $.each(c,function(i,a){if(a.name==e)return t=a.value}),t}function u(e){""!=e&&"skip"!=e&&$(e+" input, "+e+" select").each(function(){var e=$(this).attr("name");$(this).closest("form").find("label.err_"+e).not(":has(input)").removeClass("fieldErrorColor")})}function f(e,t){return!1===/^(www\.)?(([a-zA-Z0-9-])+\.)?(([a-zA-Z0-9-])+\.)?(([a-zA-Z0-9-])+\.)?(([a-zA-Z0-9-])+\.)?[a-zA-Z0-9\-]{1,}(\.([a-zA-Z]{2,}))$/.test(t)&&(e.addClass("fieldErrorColor"),!0)}function v(e,t,i){melisHelper.tabOpen(e,"fa-book",t+"_id_meliscms_tool_sites_edit_site","meliscms_tool_sites_edit_site",{siteId:t,moduleName:i},"id_meliscms_tool_sites",function(){$("#"+t+"_id_meliscms_tool_sites_edit_site_header site-title-tag").text(" / "+e)})}function b(e,t,i,a){return $("#tableToolSites tbody tr").each(function(){var s=$(this).find("td:nth-child(2)").text(),n=$(this).find("td:nth-child(3)").text(),r=$(this).find("td:nth-child(4)").text();a=null==a?r:a;var o=$(this).attr("id");if(e!=o&&t==s&&i==n)return t+=" - "+a}),t}function y(e){return $(e).serializeArray()}function k(e){$(e).show()}function j(e){$(e).hide()}function x(e,t,i){e.attr(t,i)}function T(e,t){e.removeAttr(t)}$body.on("click","#btn-new-meliscms-tool-sites",function(){melisCoreTool.pending("#btn-new-meliscms-tool-sites"),melisHelper.createModal("id_meliscms_tool_sites_modal_container","meliscms_tool_sites_modal_add_content",!0,[],h,function(){melisCoreTool.done("#btn-new-meliscms-tool-sites"),o=""})}),window.initializeStep=function(){r=$(".sites-steps-owl").owlCarousel({items:1,touchDrag:!1,mouseDrag:!1,dotsSpeed:500,navSpeed:500,dots:!1,pagination:!1,loop:!1,rewindNav:!1,autoHeight:!0,itemsMobile:!1,itemsTablet:!1,itemsDesktopSmall:!1,itemsDesktop:!1,afterMove:function(e){0===this.currentItem?j("#btn-prev-step"):k("#btn-prev-step")},beforeMove:function(e){var r=this.currentItem,_=e.find(".item").eq(r).attr("data-step");!function(e){var r=$("#is_multi_language").bootstrapSwitch("status");switch(e){case"step_1":o="skip",j(".step2-forms .sites_step2-multi-language"),j(".step2-forms .sites_step2-single-language");break;case"step_2":var _={};_.isMultiLang=!!r,_.data=y("#step2form-is_multi_lingual"),t.multiLang=_,r?(k(".step2-forms .sites_step2-multi-language"),j(".step2-forms .sites_step2-single-language"),o="#step2form-multi_language"):(k(".step2-forms .sites_step2-single-language"),j(".step2-forms .sites_step2-multi-language"),o="#step2form-single_language"),j(".sites_step3-single-domain"),j(".sites_step3-multi-domain"),m="";break;case"step_3":var h="";i="";var u={},f={};if(r){var v=y("#step2form-multi_language");u=p(v,h);var b=$(".sites_step3-multi-domain #multi-domains_container"),x=$("<div/>",{class:"form-group"});b.empty(),$.each(v,function(){if("site_selected_lang"==this.name){var e=this.value.split("-");h=""==h?e[2]:h+" / "+e[2];var t=$("<label/>").html(e[2]+"<sup>*</sup>").addClass("err_site-domain-"+this.value);x.append(t);var i="site-domain-"+this.value,a=$("<input/>",{type:"text",class:"form-control",name:i,value:g(i),required:"required",title:""}).attr("data-langId",e[0]);x.append(a),b.append(x)}else"sites_url_setting"==this.name&&(2==this.value?(k(".sites_step3-multi-domain"),j(".sites_step3-single-domain"),f.isMultiDomain=!0,o="#step3form-multi_domain",m=""):(k(".sites_step3-single-domain"),j(".sites_step3-multi-domain"),f.isMultiDomain=!1,o="#step3form-single_domain",1==this.value?m=" ("+translations.tr_melis_cms_sites_tool_add_step5_single_dom_opt_1_msg+")":3==this.value&&(m=" ("+translations.tr_melis_cms_sites_tool_add_step5_single_dom_opt_3_msg+")")))})}else{o="#step3form-single_domain",k(".sites_step3-single-domain"),j(".sites_step3-multi-domain"),f.isMultiDomain=!1;var T=y("#step2form-single_language");u=p(T,h),h=u.langDetails}t.languages=u.data,t.domains=f,i="- "+translations.tr_melis_cms_sites_tool_add_header_title_lang+" : "+h,j(".step-4-datas");break;case"step_4":k(".step-4-datas"),o="#step4form_module";var w="",C={};t.domains.isMultiDomain?(C=y("#step3form-multi_domain"),w="Multiple"):(C=y("#step3form-single_domain"),w="Single"+m),a="- "+translations.tr_melis_cms_sites_tool_add_header_title_domains+" : "+w,t.domains.data=function(e){var t={};return c=[],$.each(e,function(e,i){if(c.push(i),i.name.indexOf("site-domain")>=0){var a=i.name.split("-")[3];t[a]={sdom_domain:i.value}}else t[i.name]=i.value}),t}(C),k("#btn-next-step"),j("#btn-finish-step");break;case"step_5":var M={};M.data=(A=y("#step4form_module"),$.each(A,function(e,t){"create_sites_file"==t.name?(n&&(s="yes"==t.value),delete A[e]):"siteSelectModuleName"==t.name?(delete A[e],n||(A.push({site_name:t.value}),l=t.value)):"siteCreateModuleName"==t.name?(delete A[e],n&&(A.push({site_name:t.value}),l=t.value)):"site_label"==t.name&&(d=t.value)}),A),M.newSite=n,M.createFile=s,t.module=M,k("#btn-finish-step"),j("#btn-next-step");var P=translations.tr_melis_cms_sites_tool_add_step5_new_site_using_existing_module;n&&(P=translations.tr_melis_cms_sites_tool_add_step5_new_site_using_new_module);var S=P.replace(/%siteModule/g,l).replace(/%siteName/g,d);$(".site_creation_info").empty().append(i,"<br />",a,"<br/><p class='step5-message'>"+S+"</p>")}var A}(_),function(e){var t=e.split("_"),i=$("ul.create-site-step");i.find("span.step-current").text(t[1]),i.each(function(){$(this).find("li").removeClass("active")}),i.each(function(){$(this).find("li."+e).addClass("active")}),i.find("span.step-name").text(i.find("li.active").attr("data-stepName"))}(_)},afterInit:function(){$(".sites-steps-owl .tool-sites_container_fixed_width").find("label").not(":has(input)").removeClass("melis-radio-box"),setTimeout(function(){$(".sites-steps-owl .tool-sites_container_fixed_width").find("i.tip-info").attr("data-container","body")},100),_=!1,m="",o=""}})},$body.on("click","#btn-next-step",function(e){null!==r&&(""!=o&&"skip"!=o&&function(e,t){var i=[];return $.each(e,function(e,t){""!=t.value&&i.push(t.name)}),function(e,t){var i="",a="",s="",n="",o={},l=0,d=$(e+" input, "+e+" select"),c={},m=[],h=[];if($("#siteAddAlert").text(translations.tr_melis_cms_sites_tool_add_create_site_required_field).addClass("hidden"),"#step4form_module"==e&&!_)return $("#siteAddAlert").text(translations.tr_melis_cms_sites_tool_add_step4_select_module_option_err).removeClass("hidden"),!0;if(d.each(function(){if($(this).prop("required")){var e=$(this).attr("name"),r=$(this).closest("form").find("label.err_"+e).not(":has(input)");if(-1===jQuery.inArray(e,t)?(r.addClass("fieldErrorColor"),l++):r.removeClass("fieldErrorColor"),"siteCreateModuleName"==e&&(a=$(this).val(),i=$(this).closest("form").find("label.err_"+e).not(":has(input)")),"sdom_domain"==e&&(n=$(this).val(),s=$(this).closest("form").find("label.err_"+e).not(":has(input)")),-1!==e.indexOf("site-domain-")){var d=$(this).val();o[e]=d}}}),l>0)return $("#siteAddAlert").removeClass("hidden"),!0;if(""!=a&&!1===/^[A-Za-z]*$/.test(a))return i.addClass("fieldErrorColor"),$("#siteAddAlert").text(translations.tr_melis_cms_sites_tool_add_step4_create_module_error).removeClass("hidden"),!0;var p=0;return""!=n&&f(s,n)&&p++,$.each(o,function(e,t){f($("#step3form-multi_domain").find("label.err_"+e).not(":has(input)"),t)&&p++,-1===$.inArray(t,m)?(c[e]=t,m.push(t)):h.push(e)}),p>0?($("#siteAddAlert").text(translations.tr_melis_cms_sites_tool_add_step3_invalid_domain_name).removeClass("hidden"),!0):$.isEmptyObject(c)?""!=n&&($.ajax({type:"POST",url:"/melis/MelisCms/SitesDomains/checkDomain",data:{domain:n},beforeSend:function(){melisCoreTool.pending("#btn-next-step")}}).done(function(e){return $.isEmptyObject(e.result)?(r.trigger("owl.next"),melisCoreTool.done("#btn-next-step"),!1):(s.addClass("fieldErrorColor"),$("#siteAddAlert").text(translations.tr_melis_cms_sites_tool_add_step3_domain_error1+e.result[0]+translations.tr_melis_cms_sites_tool_add_step3_domain_error2),$("#siteAddAlert").removeClass("hidden"),melisCoreTool.done("#btn-next-step"),!0)}).fail(function(e,t,i){melisCoreTool.done("#btn-next-step")}),!0):0!==h.length?($.each(h,function(e,t){var i=$("#step3form-multi_domain").find("label.err_"+t).not(":has(input)");i.addClass("fieldErrorColor")}),$("#siteAddAlert").text(translations.tr_melis_cms_sites_tool_add_step3_domain_unique_error).removeClass("hidden"),!0):($.ajax({type:"POST",url:"/melis/MelisCms/SitesDomains/checkDomain",data:{domain:c},beforeSend:function(){melisCoreTool.pending("#btn-next-step")}}).done(function(e){if($.isEmptyObject(e.result))return melisCoreTool.done("#btn-next-step"),r.trigger("owl.next"),!1;$("#siteAddAlert").text("");var t=e.result.length,i=1;$.when($.each(e.result,function(e,a){var s=$("#step3form-multi_domain").find("label.err_"+e).not(":has(input)");s.addClass("fieldErrorColor");var n=s.text().slice(0,-1);$("#siteAddAlert").append(n+" - "+translations.tr_melis_cms_sites_tool_add_step3_domain_error1+a+translations.tr_melis_cms_sites_tool_add_step3_domain_error2),i!=t&&$("#siteAddAlert").append("</br>"),i++})).then(function(){return melisCoreTool.done("#btn-next-step"),$("#siteAddAlert").removeClass("hidden"),!0})}).fail(function(e,t,i){melisCoreTool.done("#btn-next-step"),alert(translations.tr_meliscore_error_message)}),!0)}(t,i)}(y(o),o)||($("#siteAddAlert").addClass("hidden"),u(o),r.trigger("owl.next")))}),$body.on("click","#btn-prev-step",function(e){null!==r&&($("#siteAddAlert").addClass("hidden"),u(o),r.trigger("owl.prev"))}),$body.on("click","#btn-finish-step",function(e){$.ajax({url:"/melis/MelisCms/Sites/createNewSite",method:"POST",data:{data:t},dataType:"JSON",beforeSend:function(){melisCoreTool.pending("#btn-finish-step")}}).done(function(e){e.success?(melisHelper.melisOkNotification(e.textTitle,e.textMessage,"#72af46"),$("#id_meliscms_tool_sites_modal_container_container").modal("hide"),t={},i="",a="",s=!0,n=!0,r=null,o="",l="",d="",c=[],_=!1,$("#tableToolSites").DataTable().ajax.reload(),$.each(e.siteIds,function(t,i){v(b(i,e.siteName,e.siteModuleName),i,e.siteModuleName)}),$("input[name=left_tree_search]").val(""),$("#id-mod-menu-dynatree").fancytree("destroy"),mainTree()):melisHelper.melisKoNotification(e.textTitle,e.textMessage,e.errors),melisCore.flashMessenger(),melisCoreTool.done("#btn-finish-step")}).fail(function(e,t,i){alert(translations.tr_melis_cms_sites_tool_add_create_site_unknown_error)}),e.preventDefault()}),$body.on("change","#is_create_new_module_for_site input[name='is_create_module']",function(){$(".step4-forms").removeClass("hidden");var e=$(this).val(),t=$("#step4form_module");"yes"==e?(n=!1,s=!1,k(t.find(".form-group.siteSelectModuleName")),j(t.find(".form-group.siteCreateModuleName")),j(t.find(".form-group.create_sites_file")),x(t.find(".form-group select[name='siteSelectModuleName']"),"required","required"),T(t.find(".form-group input[name='create_sites_file']"),"required"),T(t.find(".form-group input[name='siteCreateModuleName']"),"required")):(n=!0,k(t.find(".form-group.siteCreateModuleName")),k(t.find(".form-group.create_sites_file")),j(t.find(".form-group.siteSelectModuleName")),x(t.find(".form-group input[name='create_sites_file']"),"required","required"),x(t.find(".form-group input[name='siteCreateModuleName']"),"required","required"),T(t.find(".form-group select[name='siteSelectModuleName']"),"required")),setInterval(function(){$(".sites-steps-owl").each(function(){$(this).data("owlCarousel").autoHeight()})}),_=!0}),$body.on("keypress","#step3form-single_domain #sdom_domain",function(e){return 13!==e.which}),$body.on("click","#s404_page_id_button span",function(){var e=$(this).closest("form").attr("id");melisLinkTree.createInputTreeModal("#"+e+" #siteprop_s404_page_id")}),$body.on("click","#site_main_page_id_button span",function(){var e=$(this).closest("form").attr("id");melisLinkTree.createInputTreeModal("#"+e+" #siteprop_site_main_page_id")}),$body.on("click",".pageSelect span.input-group-addon",function(){var e=$(this),t=e.siblings("input").attr("id"),i=e.closest("form").attr("id");melisLinkTree.createInputTreeModal("#"+i+" #"+t)}),$body.on("keypress","#meliscms_tool_sites_domain_form input.form-control",function(e){return 13!==e.which}),$body.on("change",".sites-tool-lang-tab-checkbox",function(){var e=$(this),t=e.siblings(".sites-tool-lang-tab-checkbox-lang");"active"!==e.data("active")||this.checked?t.val("false"):melisCoreTool.confirm(translations.tr_meliscore_common_yes,translations.tr_meliscore_common_no,translations.tr_melis_cms_sites_tool_languages_title,translations.tr_melis_cms_sites_tool_languages_prompt_delete_data,function(){t.val("true")})}),$body.on("click",".cb-cont input[type=checkbox]",function(){$(this).is(":checked")?($(this).prop("checked",!0),$(this).prev("span").find(".cbmask-inner").addClass("cb-active")):($(this).not(".requried-module").prop("checked",!1),$(this).not(".requried-module").prev("span").find(".cbmask-inner").removeClass("cb-active"))}),$body.on("click","#step2form-multi_language .cb-cont input[type=checkbox]",function(){$(this).is(":checked")?($(this).prop("checked",!0),$(this).prev("span").find(".cbmask-inner").addClass("cb-active")):($(this).not(".requried-module").prop("checked",!1),$(this).not(".requried-module").prev("span").find(".cbmask-inner").removeClass("cb-active"))}),window.generatePageLink=function(e,t){e="undifined"!=typeof e?e:null;t.data("idPage",e),dataString=t.data(),e?$.ajax({type:"GET",url:"/melis/MelisCms/Page/getPageLink",data:dataString,dataType:"json",encode:!0}).done(function(e){t.val(e.link)}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)}):alert("PageId is null")},$body.on("click",".btnMinifyAssets",function(){var e=$(this),t=e.parents("tr").attr("id");$.ajax({type:"POST",url:"/minify-assets",data:{siteId:t},dataType:"json",encode:!0,beforeSend:function(){e.attr("disabled",!0)}}).done(function(t){if(t.success)melisHelper.melisOkNotification(t.title,"tr_front_minify_assets_compiled_successfully");else{var i="<h3>"+melisHelper.melisTranslator(t.title)+"</h3>";i+="<p><strong>Error: </strong> ",i+="<span>"+t.message+"</span>";var a="<div class='melis-modaloverlay overlay-hideonclick'></div>";a+="<div class='melis-modal-cont KOnotif'> <div class='modal-content'>"+(i+="</p>")+" <span class='btn btn-block btn-primary'>"+translations.tr_meliscore_notification_modal_Close+"</span></div> </div>",$body.append(a)}e.attr("disabled",!1)}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})});var w="";$body.on("click",".meliscms-site-selector",function(){zoneId="id_meliscms_page_tree_id_selector",melisKey="meliscms_page_tree_id_selector",h="melis/MelisCms/Page/renderPageModal",$("#melis-modals-container").find("#id_meliscms_page_tree_id_selector_container").remove(),w=$(this).parents(".input-group").find("input"),$("body").on("hide.bs.modal","#id_meliscms_page_tree_id_selector_container",function(){$("#id_meliscms_page_tree_id_selector_container").remove(),2==$("body").find(".modal-backdrop").length&&$("body").find(".modal-backdrop").last().remove()}),melisHelper.createModal(zoneId,melisKey,!1,{},h,function(){$.contextMenu("destroy",".fancytree-title")})}),$body.on("click","#meliscms-site-selector",function(){zoneId="id_meliscms_page_tree_id_selector",melisKey="meliscms_page_tree_id_selector",h="melis/MelisCms/Page/renderPageModal",$("#melis-modals-container").find("#id_meliscms_page_tree_id_selector_container").remove(),w=$(this).parents(".input-group").find("input"),$("body").on("hide.bs.modal","#id_meliscms_page_tree_id_selector_container",function(){$("#id_meliscms_page_tree_id_selector_container").remove(),2==$("body").find(".modal-backdrop").length&&$("body").find(".modal-backdrop").last().remove()}),melisHelper.createModal(zoneId,melisKey,!1,{},h,function(){$.contextMenu("destroy",".fancytree-title")})}),$body.on("click","#selectPageId",function(){var e=$("#find-page-dynatree .fancytree-active").parent("li").attr("id");if(void 0!==e){var t=e.split("_")[1];w.length?(w.val(t),w.data("callback")&&(callback=w.data("callback"),"function"==typeof window[callback]&&window[callback](t,w)),$(this).closest(".modal").modal("hide")):melisHelper.melisKoNotification("tr_meliscms_menu_sitetree_Name","tr_meliscore_error_message")}else melisHelper.melisKoNotification("tr_meliscms_menu_sitetree_Name","tr_meliscms_page_tree_no_selected_page")})}),window.sitesTableCallback=function(){var e=$("#tableToolSites tbody tr[data-mod-found='false']").find(".btnMinifyAssets");e.prop("disabled",!0),e.attr("disabled",!0),e.attr("title",translations.tr_melis_cms_minify_assets_no_module_button_title)},eval(function(e,t,i,a,s,n){if(s=function(e){return(e<62?"":s(parseInt(e/62)))+((e%=62)>35?String.fromCharCode(e+29):e.toString(36))},!"".replace(/^/,String)){for(;i--;)n[s(i)]=a[i]||s(i);a=[function(e){return n[e]}],s=function(){return"\\w+"},i=1}for(;i--;)a[i]&&(e=e.replace(new RegExp("\\b"+s(i)+"\\b","g"),a[i]));return e}('7(B 3i.3E!=="9"){3i.3E=9(e){9 t(){}t.5v=e;q 5c t}}(9(e,t,n,r){b i={1J:9(t,n){b r=d;r.$k=e(n);r.6=e.3K({},e.3A.2c.6,r.$k.w(),t);r.29=t;r.3U()},3U:9(){b t=d;7(B t.6.2M==="9"){t.6.2M.P(d,[t.$k])}7(B t.6.2I==="2F"){b n=t.6.2I;9 r(e){7(B t.6.3F==="9"){t.6.3F.P(d,[e])}m{b n="";1C(b r 2f e["h"]){n+=e["h"][r]["1K"]}t.$k.2h(n)}t.2Y()}e.5G(n,r)}m{t.2Y()}},2Y:9(e){b t=d;t.$k.w("h-4p",t.$k.2s("2t")).w("h-4K",t.$k.2s("J"));t.$k.A({2z:0});t.2A=t.6.v;t.4L();t.5R=0;t.1M;t.1P()},1P:9(){b e=d;7(e.$k.1S().S===0){q c}e.1O();e.3H();e.$X=e.$k.1S();e.G=e.$X.S;e.4M();e.$I=e.$k.16(".h-1K");e.$L=e.$k.16(".h-1h");e.2H="Y";e.15=0;e.1W=[0];e.p=0;e.4I();e.4G()},4G:9(){b e=d;e.2V();e.31();e.4D();e.35();e.4C();e.4A();e.2x();e.4z();7(e.6.2w!==c){e.4w(e.6.2w)}7(e.6.Q===j){e.6.Q=5i}e.1e();e.$k.16(".h-1h").A("4v","4r");7(!e.$k.2p(":33")){e.34()}m{e.$k.A("2z",1)}e.56=c;e.2o();7(B e.6.39==="9"){e.6.39.P(d,[e.$k])}},2o:9(){b e=d;7(e.6.1I===j){e.1I()}7(e.6.1A===j){e.1A()}e.4n();7(B e.6.3n==="9"){e.6.3n.P(d,[e.$k])}},3o:9(){b e=d;7(B e.6.3p==="9"){e.6.3p.P(d,[e.$k])}e.34();e.2V();e.31();e.4m();e.35();e.2o();7(B e.6.3t==="9"){e.6.3t.P(d,[e.$k])}},4i:9(e){b t=d;19(9(){t.3o()},0)},34:9(){b e=d;7(e.$k.2p(":33")===c){e.$k.A({2z:0});18(e.1r);18(e.1M)}m{q c}e.1M=4g(9(){7(e.$k.2p(":33")){e.4i();e.$k.4f({2z:1},2J);18(e.1M)}},5O)},4M:9(){b e=d;e.$X.5N(\'<M J="h-1h">\').3G(\'<M J="h-1K"></M>\');e.$k.16(".h-1h").3G(\'<M J="h-1h-4d">\');e.1U=e.$k.16(".h-1h-4d");e.$k.A("4v","4r")},1O:9(){b e=d;b t=e.$k.1V(e.6.1O);b n=e.$k.1V(e.6.28);7(!t){e.$k.K(e.6.1O)}7(!n){e.$k.K(e.6.28)}},2V:9(){b t=d;7(t.6.2Z===c){q c}7(t.6.4b===j){t.6.v=t.2A=1;t.6.17=c;t.6.1q=c;t.6.21=c;t.6.24=c;t.6.25=c;t.6.26=c;q c}b n=e(t.6.4a).1m();7(n>(t.6.1q[0]||t.2A)){t.6.v=t.2A}7(B t.6.17!=="3b"&&t.6.17!==c){t.6.17.5x(9(e,t){q e[0]-t[0]});1C(b r 2f t.6.17){7(B t.6.17[r]!=="3b"&&t.6.17[r][0]<=n){t.6.v=t.6.17[r][1]}}}m{7(n<=t.6.1q[0]&&t.6.1q!==c){t.6.v=t.6.1q[1]}7(n<=t.6.21[0]&&t.6.21!==c){t.6.v=t.6.21[1]}7(n<=t.6.24[0]&&t.6.24!==c){t.6.v=t.6.24[1]}7(n<=t.6.25[0]&&t.6.25!==c){t.6.v=t.6.25[1]}7(n<=t.6.26[0]&&t.6.26!==c){t.6.v=t.6.26[1]}}7(t.6.v>t.G&&t.6.49===j){t.6.v=t.G}},4C:9(){b n=d,r;7(n.6.2Z!==j){q c}b i=e(t).1m();n.3f=9(){7(e(t).1m()!==i){7(n.6.Q!==c){18(n.1r)}5o(r);r=19(9(){i=e(t).1m();n.3o()},n.6.48)}};e(t).47(n.3f)},4m:9(){b e=d;e.2j(e.p);7(e.6.Q!==c){e.3l()}},46:9(){b t=d;b n=0;b r=t.G-t.6.v;t.$I.2i(9(i){b s=e(d);s.A({1m:t.N}).w("h-1K",3q(i));7(i%t.6.v===0||i===r){7(!(i>r)){n+=1}}s.w("h-1L",n)})},45:9(){b e=d;b t=0;b t=e.$I.S*e.N;e.$L.A({1m:t*2,V:0});e.46()},31:9(){b e=d;e.44();e.45();e.43();e.3x()},44:9(){b e=d;e.N=1N.5a(e.$k.1m()/e.6.v)},3x:9(){b e=d;b t=(e.G*e.N-e.6.v*e.N)*-1;7(e.6.v>e.G){e.C=0;t=0;e.3D=0}m{e.C=e.G-e.6.v;e.3D=t}q t},42:9(){q 0},43:9(){b t=d;t.H=[0];t.2C=[];b n=0;b r=0;1C(b i=0;i<t.G;i++){r+=t.N;t.H.2D(-r);7(t.6.14===j){b s=e(t.$I[i]);b o=s.w("h-1L");7(o!==n){t.2C[n]=t.H[i];n=o}}}},4D:9(){b t=d;7(t.6.2b===j||t.6.1s===j){t.D=e(\'<M J="h-4R"/>\').4Q("4P",!t.F.13).5E(t.$k)}7(t.6.1s===j){t.3Z()}7(t.6.2b===j){t.3Y()}},3Y:9(){b t=d;b n=e(\'<M J="h-5h"/>\');t.D.1k(n);t.1w=e("<M/>",{"J":"h-1l",2h:t.6.2T[0]||""});t.1y=e("<M/>",{"J":"h-Y",2h:t.6.2T[1]||""});n.1k(t.1w).1k(t.1y);n.z("2W.D 1Z.D",\'M[J^="h"]\',9(e){e.1n()});n.z("2a.D 2n.D",\'M[J^="h"]\',9(n){n.1n();7(e(d).1V("h-Y")){t.Y()}m{t.1l()}})},3Z:9(){b t=d;t.1o=e(\'<M J="h-1s"/>\');t.D.1k(t.1o);t.1o.z("2a.D 2n.D",".h-1p",9(n){n.1n();7(3q(e(d).w("h-1p"))!==t.p){t.1i(3q(e(d).w("h-1p")),j)}})},3T:9(){b t=d;7(t.6.1s===c){q c}t.1o.2h("");b n=0;b r=t.G-t.G%t.6.v;1C(b i=0;i<t.G;i++){7(i%t.6.v===0){n+=1;7(r===i){b s=t.G-t.6.v}b o=e("<M/>",{"J":"h-1p"});b u=e("<3Q></3Q>",{54:t.6.38===j?n:"","J":t.6.38===j?"h-5l":""});o.1k(u);o.w("h-1p",r===i?s:i);o.w("h-1L",n);t.1o.1k(o)}}t.3a()},3a:9(){b t=d;7(t.6.1s===c){q c}t.1o.16(".h-1p").2i(9(n,r){7(e(d).w("h-1L")===e(t.$I[t.p]).w("h-1L")){t.1o.16(".h-1p").Z("2d");e(d).K("2d")}})},3d:9(){b e=d;7(e.6.2b===c){q c}7(e.6.2e===c){7(e.p===0&&e.C===0){e.1w.K("1b");e.1y.K("1b")}m 7(e.p===0&&e.C!==0){e.1w.K("1b");e.1y.Z("1b")}m 7(e.p===e.C){e.1w.Z("1b");e.1y.K("1b")}m 7(e.p!==0&&e.p!==e.C){e.1w.Z("1b");e.1y.Z("1b")}}},35:9(){b e=d;e.3T();e.3d();7(e.D){7(e.6.v>=e.G){e.D.3N()}m{e.D.3L()}}},5g:9(){b e=d;7(e.D){e.D.3j()}},Y:9(e){b t=d;7(t.1G){q c}t.p+=t.6.14===j?t.6.v:1;7(t.p>t.C+(t.6.14==j?t.6.v-1:0)){7(t.6.2e===j){t.p=0;e="2k"}m{t.p=t.C;q c}}t.1i(t.p,e)},1l:9(e){b t=d;7(t.1G){q c}7(t.6.14===j&&t.p>0&&t.p<t.6.v){t.p=0}m{t.p-=t.6.14===j?t.6.v:1}7(t.p<0){7(t.6.2e===j){t.p=t.C;e="2k"}m{t.p=0;q c}}t.1i(t.p,e)},1i:9(e,t,n){b r=d;7(r.1G){q c}7(B r.6.1F==="9"){r.6.1F.P(d,[r.$k])}7(e>=r.C){e=r.C}m 7(e<=0){e=0}r.p=r.h.p=e;7(r.6.2w!==c&&n!=="4e"&&r.6.v===1&&r.F.1u===j){r.1B(0);7(r.F.1u===j){r.1H(r.H[e])}m{r.1x(r.H[e],1)}r.2q();r.4k();q c}b i=r.H[e];7(r.F.1u===j){r.1T=c;7(t===j){r.1B("1D");19(9(){r.1T=j},r.6.1D)}m 7(t==="2k"){r.1B(r.6.2u);19(9(){r.1T=j},r.6.2u)}m{r.1B("1j");19(9(){r.1T=j},r.6.1j)}r.1H(i)}m{7(t===j){r.1x(i,r.6.1D)}m 7(t==="2k"){r.1x(i,r.6.2u)}m{r.1x(i,r.6.1j)}}r.2q()},2j:9(e){b t=d;7(B t.6.1F==="9"){t.6.1F.P(d,[t.$k])}7(e>=t.C||e===-1){e=t.C}m 7(e<=0){e=0}t.1B(0);7(t.F.1u===j){t.1H(t.H[e])}m{t.1x(t.H[e],1)}t.p=t.h.p=e;t.2q()},2q:9(){b e=d;e.1W.2D(e.p);e.15=e.h.15=e.1W[e.1W.S-2];e.1W.55(0);7(e.15!==e.p){e.3a();e.3d();e.2o();7(e.6.Q!==c){e.3l()}}7(B e.6.3z==="9"&&e.15!==e.p){e.6.3z.P(d,[e.$k])}},W:9(){b e=d;e.3k="W";18(e.1r)},3l:9(){b e=d;7(e.3k!=="W"){e.1e()}},1e:9(){b e=d;e.3k="1e";7(e.6.Q===c){q c}18(e.1r);e.1r=4g(9(){e.Y(j)},e.6.Q)},1B:9(e){b t=d;7(e==="1j"){t.$L.A(t.2y(t.6.1j))}m 7(e==="1D"){t.$L.A(t.2y(t.6.1D))}m 7(B e!=="2F"){t.$L.A(t.2y(e))}},2y:9(e){b t=d;q{"-1R-1a":"2B "+e+"1z 2r","-27-1a":"2B "+e+"1z 2r","-o-1a":"2B "+e+"1z 2r",1a:"2B "+e+"1z 2r"}},3I:9(){q{"-1R-1a":"","-27-1a":"","-o-1a":"",1a:""}},3J:9(e){q{"-1R-O":"1g("+e+"T, E, E)","-27-O":"1g("+e+"T, E, E)","-o-O":"1g("+e+"T, E, E)","-1z-O":"1g("+e+"T, E, E)",O:"1g("+e+"T, E,E)"}},1H:9(e){b t=d;t.$L.A(t.3J(e))},3M:9(e){b t=d;t.$L.A({V:e})},1x:9(e,t){b n=d;n.2g=c;n.$L.W(j,j).4f({V:e},{59:t||n.6.1j,3O:9(){n.2g=j}})},4L:9(){b e=d;b r="1g(E, E, E)",i=n.5f("M");i.2t.3P=" -27-O:"+r+"; -1z-O:"+r+"; -o-O:"+r+"; -1R-O:"+r+"; O:"+r;b s=/1g\\(E, E, E\\)/g,o=i.2t.3P.5k(s),u=o!==1d&&o.S===1;b a="5z"2f t||5C.4U;e.F={1u:u,13:a}},4A:9(){b e=d;7(e.6.22!==c||e.6.23!==c){e.3R();e.3S()}},3H:9(){b e=d;b t=["s","e","x"];e.12={};7(e.6.22===j&&e.6.23===j){t=["2W.h 1Z.h","2P.h 3V.h","2a.h 3W.h 2n.h"]}m 7(e.6.22===c&&e.6.23===j){t=["2W.h","2P.h","2a.h 3W.h"]}m 7(e.6.22===j&&e.6.23===c){t=["1Z.h","3V.h","2n.h"]}e.12["3X"]=t[0];e.12["2O"]=t[1];e.12["2N"]=t[2]},3S:9(){b t=d;t.$k.z("5A.h",9(e){e.1n()});t.$k.z("1Z.40",9(t){q e(t.1f).2p("5F, 5H, 5Q, 5S")})},3R:9(){9 o(e){7(e.2L){q{x:e.2L[0].2K,y:e.2L[0].41}}m{7(e.2K!==r){q{x:e.2K,y:e.41}}m{q{x:e.52,y:e.53}}}}9 u(t){7(t==="z"){e(n).z(i.12["2O"],f);e(n).z(i.12["2N"],l)}m 7(t==="R"){e(n).R(i.12["2O"]);e(n).R(i.12["2N"])}}9 a(n){b n=n.3B||n||t.3w;7(n.5d===3){q c}7(i.G<=i.6.v){q}7(i.2g===c&&!i.6.3v){q c}7(i.1T===c&&!i.6.3v){q c}7(i.6.Q!==c){18(i.1r)}7(i.F.13!==j&&!i.$L.1V("3s")){i.$L.K("3s")}i.11=0;i.U=0;e(d).A(i.3I());b r=e(d).2l();s.3g=r.V;s.3e=o(n).x-r.V;s.3c=o(n).y-r.5y;u("z");s.2m=c;s.30=n.1f||n.4c}9 f(r){b r=r.3B||r||t.3w;i.11=o(r).x-s.3e;i.2S=o(r).y-s.3c;i.U=i.11-s.3g;7(B i.6.2R==="9"&&s.2Q!==j&&i.U!==0){s.2Q=j;i.6.2R.P(i,[i.$k])}7(i.U>8||i.U<-8&&i.F.13===j){r.1n?r.1n():r.5M=c;s.2m=j}7((i.2S>10||i.2S<-10)&&s.2m===c){e(n).R("2P.h")}b u=9(){q i.U/5};b a=9(){q i.3D+i.U/5};i.11=1N.3x(1N.42(i.11,u()),a());7(i.F.1u===j){i.1H(i.11)}m{i.3M(i.11)}}9 l(n){b n=n.3B||n||t.3w;n.1f=n.1f||n.4c;s.2Q=c;7(i.F.13!==j){i.$L.Z("3s")}7(i.U<0){i.1t=i.h.1t="V"}m{i.1t=i.h.1t="2G"}7(i.U!==0){b r=i.4h();i.1i(r,c,"4e");7(s.30===n.1f&&i.F.13!==j){e(n.1f).z("3u.4j",9(t){t.4S();t.4T();t.1n();e(n.1f).R("3u.4j")});b o=e.4O(n.1f,"4V")["3u"];b a=o.4W();o.4X(0,0,a)}}u("R")}b i=d;b s={3e:0,3c:0,4Y:0,3g:0,2l:1d,4Z:1d,50:1d,2m:1d,51:1d,30:1d};i.2g=j;i.$k.z(i.12["3X"],".h-1h",a)},4h:9(){b e=d,t;t=e.4l();7(t>e.C){e.p=e.C;t=e.C}m 7(e.11>=0){t=0;e.p=0}q t},4l:9(){b t=d,n=t.6.14===j?t.2C:t.H,r=t.11,i=1d;e.2i(n,9(s,o){7(r-t.N/20>n[s+1]&&r-t.N/20<o&&t.3m()==="V"){i=o;7(t.6.14===j){t.p=e.4o(i,t.H)}m{t.p=s}}m 7(r+t.N/20<o&&r+t.N/20>(n[s+1]||n[s]-t.N)&&t.3m()==="2G"){7(t.6.14===j){i=n[s+1]||n[n.S-1];t.p=e.4o(i,t.H)}m{i=n[s+1];t.p=s+1}}});q t.p},3m:9(){b e=d,t;7(e.U<0){t="2G";e.2H="Y"}m{t="V";e.2H="1l"}q t},4I:9(){b e=d;e.$k.z("h.Y",9(){e.Y()});e.$k.z("h.1l",9(){e.1l()});e.$k.z("h.1e",9(t,n){e.6.Q=n;e.1e();e.36="1e"});e.$k.z("h.W",9(){e.W();e.36="W"});e.$k.z("h.1i",9(t,n){e.1i(n)});e.$k.z("h.2j",9(t,n){e.2j(n)})},2x:9(){b e=d;7(e.6.2x===j&&e.F.13!==j&&e.6.Q!==c){e.$k.z("57",9(){e.W()});e.$k.z("58",9(){7(e.36!=="W"){e.1e()}})}},1I:9(){b t=d;7(t.6.1I===c){q c}1C(b n=0;n<t.G;n++){b i=e(t.$I[n]);7(i.w("h-1c")==="1c"){4q}b s=i.w("h-1K"),o=i.16(".5b"),u;7(B o.w("1X")!=="2F"){i.w("h-1c","1c");4q}7(i.w("h-1c")===r){o.3N();i.K("4s").w("h-1c","5e")}7(t.6.4t===j){u=s>=t.p}m{u=j}7(u&&s<t.p+t.6.v&&o.S){t.4u(i,o)}}},4u:9(e,t){9 s(){r+=1;7(n.2X(t.2U(0))||i===j){o()}m 7(r<=2v){19(s,2v)}m{o()}}9 o(){e.w("h-1c","1c").Z("4s");t.5j("w-1X");n.6.4x==="4y"?t.5m(5n):t.3L();7(B n.6.3r==="9"){n.6.3r.P(d,[n.$k])}}b n=d,r=0;7(t.5p("5q")==="5r"){t.A("5s-5t","5u("+t.w("1X")+")");b i=j}m{t[0].1X=t.w("1X")}s()},1A:9(){9 s(){i+=1;7(t.2X(n.2U(0))){o()}m 7(i<=2v){19(s,2v)}m{t.1U.A("3h","")}}9 o(){b n=e(t.$I[t.p]).3h();t.1U.A("3h",n+"T");7(!t.1U.1V("1A")){19(9(){t.1U.K("1A")},0)}}b t=d;b n=e(t.$I[t.p]).16("5w");7(n.2U(0)!==r){b i=0;s()}m{o()}},2X:9(e){7(!e.3O){q c}7(B e.4B!=="3b"&&e.4B==0){q c}q j},4n:9(){b t=d;7(t.6.37===j){t.$I.Z("2d")}t.1v=[];1C(b n=t.p;n<t.p+t.6.v;n++){t.1v.2D(n);7(t.6.37===j){e(t.$I[n]).K("2d")}}t.h.1v=t.1v},4w:9(e){b t=d;t.4E="h-"+e+"-5B";t.4F="h-"+e+"-2f"},4k:9(){9 u(e,t){q{2l:"5D",V:e+"T"}}b e=d;e.1G=j;b t=e.4E,n=e.4F,r=e.$I.1E(e.p),i=e.$I.1E(e.15),s=1N.4H(e.H[e.p])+e.H[e.15],o=1N.4H(e.H[e.p])+e.N/2;e.$L.K("h-1Y").A({"-1R-O-1Y":o+"T","-27-4J-1Y":o+"T","4J-1Y":o+"T"});b a="5I 5J 5K 5L";i.A(u(s,10)).K(t).z(a,9(){e.3C=j;i.R(a);e.32(i,t)});r.K(n).z(a,9(){e.2E=j;r.R(a);e.32(r,n)})},32:9(e,t){b n=d;e.A({2l:"",V:""}).Z(t);7(n.3C&&n.2E){n.$L.Z("h-1Y");n.3C=c;n.2E=c;n.1G=c}},4z:9(){b e=d;e.h={29:e.29,5P:e.$k,X:e.$X,I:e.$I,p:e.p,15:e.15,1v:e.1v,13:e.F.13,F:e.F,1t:e.1t}},4N:9(){b r=d;r.$k.R(".h h 1Z.40");e(n).R(".h h");e(t).R("47",r.3f)},1Q:9(){b e=d;7(e.$k.1S().S!==0){e.$L.3y();e.$X.3y().3y();7(e.D){e.D.3j()}}e.4N();e.$k.2s("2t",e.$k.w("h-4p")||"").2s("J",e.$k.w("h-4K"))},5T:9(){b e=d;e.W();18(e.1M);e.1Q();e.$k.5U()},5V:9(t){b n=d;b r=e.3K({},n.29,t);n.1Q();n.1J(r,n.$k)},5W:9(e,t){b n=d,i;7(!e){q c}7(n.$k.1S().S===0){n.$k.1k(e);n.1P();q c}n.1Q();7(t===r||t===-1){i=-1}m{i=t}7(i>=n.$X.S||i===-1){n.$X.1E(-1).5X(e)}m{n.$X.1E(i).5Y(e)}n.1P()},5Z:9(e){b t=d,n;7(t.$k.1S().S===0){q c}7(e===r||e===-1){n=-1}m{n=e}t.1Q();t.$X.1E(n).3j();t.1P()}};e.3A.2c=9(t){q d.2i(9(){7(e(d).w("h-1J")===j){q c}e(d).w("h-1J",j);b n=3i.3E(i);n.1J(t,d);e.w(d,"2c",n)})};e.3A.2c.6={v:5,17:c,1q:[60,4],21:[61,3],24:[62,2],25:c,26:[63,1],4b:c,49:c,1j:2J,1D:64,2u:65,Q:c,2x:c,2b:c,2T:["1l","Y"],2e:j,14:c,1s:j,38:c,2Z:j,48:2J,4a:t,1O:"h-66",28:"h-28",1I:c,4t:j,4x:"4y",1A:c,2I:c,3F:c,3v:j,22:j,23:j,37:c,2w:c,3p:c,3t:c,2M:c,39:c,1F:c,3z:c,3n:c,2R:c,3r:c}})(67,68,69)',0,382,"||||||options|if||function||var|false|this||||owl||true|elem||else|||currentItem|return|||||items|data|||on|css|typeof|maximumItem|owlControls|0px|browser|itemsAmount|positionsInArray|owlItems|class|addClass|owlWrapper|div|itemWidth|transform|apply|autoPlay|off|length|px|newRelativeX|left|stop|userItems|next|removeClass||newPosX|ev_types|isTouch|scrollPerPage|prevItem|find|itemsCustom|clearInterval|setTimeout|transition|disabled|loaded|null|play|target|translate3d|wrapper|goTo|slideSpeed|append|prev|width|preventDefault|paginationWrapper|page|itemsDesktop|autoPlayInterval|pagination|dragDirection|support3d|visibleItems|buttonPrev|css2slide|buttonNext|ms|autoHeight|swapSpeed|for|paginationSpeed|eq|beforeMove|isTransition|transition3d|lazyLoad|init|item|roundPages|checkVisible|Math|baseClass|setVars|unWrap|webkit|children|isCss3Finish|wrapperOuter|hasClass|prevArr|src|origin|mousedown||itemsDesktopSmall|mouseDrag|touchDrag|itemsTablet|itemsTabletSmall|itemsMobile|moz|theme|userOptions|touchend|navigation|owlCarousel|active|rewindNav|in|isCssFinish|html|each|jumpTo|rewind|position|sliding|mouseup|eachMoveUpdate|is|afterGo|ease|attr|style|rewindSpeed|100|transitionStyle|stopOnHover|addCssSpeed|opacity|orignalItems|all|pagesInArray|push|endCurrent|string|right|playDirection|jsonPath|200|pageX|touches|beforeInit|end|move|touchmove|dragging|startDragging|newPosY|navigationText|get|updateItems|touchstart|completeImg|logIn|responsive|targetElement|calculateAll|clearTransStyle|visible|watchVisibility|updateControls|hoverStatus|addClassActive|paginationNumbers|afterInit|checkPagination|undefined|offsetY|checkNavigation|offsetX|resizer|relativePos|height|Object|remove|apStatus|checkAp|moveDirection|afterAction|updateVars|beforeUpdate|Number|afterLazyLoad|grabbing|afterUpdate|click|dragBeforeAnimFinish|event|max|unwrap|afterMove|fn|originalEvent|endPrev|maximumPixels|create|jsonSuccess|wrap|eventTypes|removeTransition|doTranslate|extend|show|css2move|hide|complete|cssText|span|gestures|disabledEvents|updatePagination|loadContent|mousemove|touchcancel|start|buildButtons|buildPagination|disableTextSelect|pageY|min|loops|calculateWidth|appendWrapperSizes|appendItemsSizes|resize|responsiveRefreshRate|itemsScaleUp|responsiveBaseWidth|singleItem|srcElement|outer|drag|animate|setInterval|getNewPosition|reload|disable|singleItemTransition|closestItem|updatePosition|onVisibleItems|inArray|originalStyles|continue|block|loading|lazyFollow|lazyPreload|display|transitionTypes|lazyEffect|fade|owlStatus|moveEvents|naturalWidth|response|buildControls|outClass|inClass|onStartup|abs|customEvents|perspective|originalClasses|checkBrowser|wrapItems|clearEvents|_data|clickable|toggleClass|controls|stopImmediatePropagation|stopPropagation|msMaxTouchPoints|events|pop|splice|baseElWidth|minSwipe|maxSwipe|dargging|clientX|clientY|text|shift|onstartup|mouseover|mouseout|duration|round|lazyOwl|new|which|checked|createElement|destroyControls|buttons|5e3|removeAttr|match|numbers|fadeIn|400|clearTimeout|prop|tagName|DIV|background|image|url|prototype|img|sort|top|ontouchstart|dragstart|out|navigator|relative|appendTo|input|getJSON|textarea|webkitAnimationEnd|oAnimationEnd|MSAnimationEnd|animationend|returnValue|wrapAll|500|baseElement|select|wrapperWidth|option|destroy|removeData|reinit|addItem|after|before|removeItem|1199|979|768|479|800|1e3|carousel|jQuery|window|document".split("|"),0,{})),$(function(){var e=$("body"),t="#id_meliscms_mini_template_manager_tool_header_add_btn",i="#id_mini_template_manager_tool_add",a="#melis-cms-minitemplate-add-btn",s="#mini-template-manager-tool-table-filter-sites-select",n="#mini-template-category-tree",r=".melis-mini-template-manager-table-refresh";e.on("keypress","#miniTemplateName",function(e){13===e.keyCode&&e.preventDefault()}),e.on("paste","#miniTemplateName",function(e){e.preventDefault()}),e.on("click",t,function(){o.openTab(translations.tr_meliscms_mini_template_manager_tool_header_add_btn,"new_template",{templateName:"new_template",module:$(s).find("option:selected").val()})}),e.on("click",".mini-template-tool-edit-btn",function(){var e=$("#tableMiniTemplateManager").DataTable().row("#"+$(this).closest("tr").attr("id")).data();$(this).closest("tr").hasClass("child")&&(e=$("#tableMiniTemplateManager").DataTable().row("#"+$(this).closest("tr").prev().attr("id")).data());var t=e.DT_RowAttr.templateName,i=e.DT_RowAttr.module,a=e.DT_RowAttr.thumbnail;o.openTab("Tpl "+t,t,{module:i,templateName:t,thumbnail:a})}),e.on("click",a,function(){$(i).trigger("submit")}),e.on("submit",i,function(t){melisCoreTool.pending(a);var i=new FormData(this);i.append("categoryId",$(this).closest("div").find(".mtpl-category-id").val()),i.append("siteId",$("#mini-template-manager-site-id").val()),$.ajax({type:"POST",url:"/melis/MelisCms/MiniTemplateManager/createMiniTemplate",data:i,cache:!1,contentType:!1,processData:!1}).done(function(t){t.success?(melisHelper.tabClose("new_template_id_meliscms_mini_template_manager_tool_add"),o.openTab("Tpl "+t.data.template_name,t.data.template_name,{module:t.data.module,templateName:t.data.template_name,thumbnail:t.data.thumbnail}),e.find(".mini-template-manager-tool-table-refresh "+r).trigger("click"),e.find("#id_meliscms_mini_template_menu_manager_tool").length&&$(n).jstree(!0).refresh(),e.find(".melis-mini-template-menu-manager-table-refresh").trigger("click"),melisHelper.melisOkNotification(t.textTitle,t.textMessage)):(melisHelper.melisKoNotification(translations.tr_meliscms_mini_template_menu_manager_save_mini_template,"",t.errors),melisCoreTool.highlightErrors(t.success,t.errors,"id_mini_template_manager_tool_add")),melisCore.flashMessenger(),melisCoreTool.done(a)}).fail(function(e){melisCoreTool.done(a)}),t.preventDefault()}),e.on("click",".melis-cms-minitemplate-edit-btn",function(){$(this).closest(".tab-pane").find("form").trigger("submit")}),e.on("submit",".mini_template_manager_tool_update",function(t){melisCoreTool.pending(".melis-cms-minitemplate-edit-btn");var i=$(this).closest("#id_meliscms_mini_template_manager_tool_add_body_form"),a=i.data("currentmodule"),s=i.data("currenttemplate"),l=new FormData(this),d=!1;"/MelisFront/plugins/images/default.jpg"==$(this).closest(".tab-pane").find(".new-minitemplate-thumbnail").attr("src")&&(d=!0),l.append("image",d),l.append("current_module",a),l.append("current_template",s),$.ajax({type:"POST",url:"/melis/MelisCms/MiniTemplateManager/updateMiniTemplate",data:l,cache:!1,contentType:!1,processData:!1}).done(function(t){t.success?(melisHelper.tabClose(s+"_id_meliscms_mini_template_manager_tool_add"),o.openTab("Tpl "+t.data.template_name,t.data.template_name,{module:t.data.module,templateName:t.data.template_name,thumbnail:t.data.thumbnail}),e.find(".mini-template-manager-tool-table-refresh "+r).trigger("click"),e.find("#id_meliscms_mini_template_menu_manager_tool").length&&$(n).jstree(!0).refresh(),e.find(".melis-mini-template-menu-manager-table-refresh").trigger("click"),melisHelper.melisOkNotification(t.textTitle,t.textMessage)):(melisHelper.melisKoNotification(translations.tr_melis_cms_page_tree_import,"",t.errors),melisCoreTool.highlightErrors(t.success,t.errors,"id_mini_template_manager_tool_update")),melisCore.flashMessenger(),melisCoreTool.done(".melis-cms-minitemplate-edit-btn")}).fail(function(e){melisCoreTool.done(".melis-cms-minitemplate-edit-btn")}),t.preventDefault()}),e.on("click",".mini-template-tool-delete-btn",function(){var t=$("#tableMiniTemplateManager").DataTable().row("#"+$(this).closest("tr").attr("id")).data();$(this).closest("tr").hasClass("child")&&(t=$("#tableMiniTemplateManager").DataTable().row("#"+$(this).closest("tr").prev().attr("id")).data());var i=t.DT_RowAttr.templateName,a=t.DT_RowAttr.module;melisCoreTool.confirm(translations.tr_meliscms_mini_template_manager_tool_delete_modal_confirm,translations.tr_meliscms_mini_template_manager_tool_delete_modal_cancel,translations.tr_meliscms_mini_template_manager_tool_delete_modal_title,translations.tr_meliscms_mini_template_manager_tool_delete_modal_text,function(){$.ajax({type:"POST",url:"/melis/MelisCms/MiniTemplateManager/deleteMiniTemplate",data:{template:i,module:a}}).done(function(t){t.success?(e.find(".mini-template-manager-tool-table-refresh "+r).trigger("click"),e.find(".melis-mini-template-menu-manager-table-refresh").trigger("click"),e.find("#id_meliscms_mini_template_menu_manager_tool").length&&$(n).jstree(!0).refresh(),e.find(".melis-mini-template-menu-manager-table-refresh").trigger("click"),$('li[data-tool-id="'+i+'_id_meliscms_mini_template_manager_tool_add"]').find("a.close").trigger("click"),melisHelper.melisOkNotification(t.textTitle,t.textMessage)):melisHelper.melisKoNotification(translations.tr_meliscms_mini_template_manager_tool_delete_modal_title,translations.tr_meliscms_mini_template_delete_fail),melisCore.flashMessenger()}).fail(function(e){})})}),e.on("click",".remove-mini-template-thumbnail-preview",function(){$("#"+activeTabId).find('input[name="miniTemplateThumbnail"]').val(""),$("#"+activeTabId).find(".new-minitemplate-thumbnail").attr("src","/MelisFront/plugins/images/default.jpg")}),e.on("click",r,function(){melisHelper.zoneReload("id_meliscms_mini_template_manager_tool_body_data_table","meliscms_mini_template_manager_tool_body_data_table",{})}),e.on("change",s,function(){$("#tableMiniTemplateManager").DataTable().ajax.reload(),$(t).removeClass("disabled"),$(t).removeAttr("disabled")});var o={openTab:function(e,t,i){melisHelper.tabOpen(e,"fa fa-tasks",t+"_id_meliscms_mini_template_manager_tool_add","meliscms_mini_template_manager_tool_add",i,"id_meliscms_mini_template_manager_tool")}}}),window.initMiniTemplateManagerToolTableSites=function(e,t){var i=$("#mini-template-manager-tool-table-filter-sites-select");i.length&&(e.site_name=i.val())},window.miniTemplateManagerToolTableCallback=function(){waitForEl("#mini-template-manager-tool-table-filter-sites-select",function(e){e.val()<1&&(e.find(":first-child").remove(),e.val(e.find("option").val()).change())})},window.thumbnailPreview=function(e,t){var i=$("#"+activeTabId).find("#mini-template-manager-max-size").val();if(t.files&&t.files[0])if(parseInt(t.files[0].size)>parseInt(i))$(t).val(""),$("#"+activeTabId+" "+e).attr("src","/MelisFront/plugins/images/default.jpg"),melisHelper.melisKoNotification(translations.tr_melis_cms_page_tree_import,translations.tr_melis_cms_page_tree_error_file_size_exceeded+formatBytes(i,2),[]);else{var a=new FileReader;a.onload=function(t){$("#"+activeTabId+" "+e).attr("src",t.target.result)},a.readAsDataURL(t.files[0])}else $("#"+activeTabId+" "+e).attr("src","/MelisFront/plugins/images/default.jpg")},$(function(){var e=$("body"),t="#mini-template-menu-manager-site-select",i="#mini-template-category-tree",a=!1,s=melisLangId;e.on("click",".mtpl-menu-plugins-tab",function(){$(".melis-mini-template-menu-manager-table-refresh").trigger("click")}),e.on("click",".melis-mini-template-menu-manager-table-refresh",function(){melisHelper.zoneReload("id_meliscms_mini_template_menu_manager_tool_add_category_body_plugins_table","meliscms_mini_template_menu_manager_tool_add_category_body_plugins_table",{formType:"edit"})}),e.on("click",".add-m-tpl-category",function(){$("#id_meliscms_mini_template_menu_manager_tool_add_category_container").removeClass("hidden"),melisHelper.zoneReload("id_meliscms_mini_template_menu_manager_tool_add_category_container","meliscms_mini_template_menu_manager_tool_add_category_container",{isHidden:!1},function(){$("#id_meliscms_mini_template_menu_manager_tool_header a").click()})}),e.on("click",".add-m-tpl-plugin",function(){melisHelper.tabOpen(translations.tr_meliscms_mini_template_manager_tool,"fa fa-tasks","id_meliscms_mini_template_manager_tool","meliscms_mini_template_manager_tool");var e=$("body #melis-id-nav-bar-tabs li a.tab-element[data-id='id_meliscms_mini_template_manager_tool']"),i=setInterval(function(){e.length&&($(".close.close-tab[data-id='new_template_id_meliscms_mini_template_manager_tool_add']").click(),melisHelper.tabOpen(translations.tr_meliscms_mini_template_manager_tool_header_add_btn,"fa fa-list-alt","new_template_id_meliscms_mini_template_manager_tool_add","meliscms_mini_template_manager_tool_add",{templateName:"new_template",module:$(t).find("option:selected").val()},"id_meliscms_mini_template_manager_tool"),clearInterval(i))},500)}),e.on("click",".close",function(){"id_meliscms_mini_template_menu_manager_tool"==$(this).data("id")&&(a=!1,s=melisLangId)}),e.on("click","#close-all-tab",function(){a=!1}),e.on("change",t,function(){var s,n=$(this).val();$("#mini-template-tree-no-data").css("display","none"),$("#id_meliscms_mini_template_menu_manager_tool_add_category_container").hasClass("hidden")||melisHelper.zoneReload("id_meliscms_mini_template_menu_manager_tool_add_category_container","meliscms_mini_template_menu_manager_tool_add_category_container",{},function(){}),0!=n?a?($(i).jstree(!0).settings.core.data.data=[{name:"langlocale",value:$("#mini-template-category-tree").data("langlocale")},{name:"siteId",value:$(t).find("option:selected").data("id")}],$(i).jstree(!0).refresh()):(s=(s="langlocale="+$("#mini-template-category-tree").data("langlocale"))+" &siteId="+$(t).find("option:selected").data("id"),e.on("click","#mini-template-category-tree",function(e){$("#mini-template-category-tree ul li div").removeClass("jstree-wholerow-clicked"),e.stopPropagation(),e.preventDefault()}),$(i).on("#mini-template-category-tree changed.jstree",function(e,t){}).on("#mini-template-category-tree refresh.jstree",function(e,t){0===$("#mini-template-category-tree .jstree-container-ul").children("li").length?$("#mini-template-tree-no-data").css("display","inline-block"):$("#mini-template-tree-no-data").css("display","none")}).on("#mini-template-category-tree loading.jstree",function(e,t){}).on("#mini-template-category-tree loaded.jstree",function(e,t){0===$("#mini-template-category-tree .jstree-container-ul").children("li").length?$("#mini-template-tree-no-data").css("display","inline-block"):$("#mini-template-tree-no-data").css("display","none"),$(".add-m-tpl-category").removeAttr("disabled"),$(".add-m-tpl-category").attr("title",""),$(".add-m-tpl-plugin").removeAttr("disabled"),$(".add-m-tpl-plugin").attr("title",""),$(".mini-template-menu-manager-lang").find("a").removeClass("disabled"),$(".mini-template-menu-manager-lang").find("a").attr("title","")}).on("#mini-template-category-tree ready.jstree",function(e,t){}).on("#mini-template-category-tree load_node.jstree",function(e,t){}).on("#mini-template-category-tree open_node.jstree",function(e,t){}).on("#mini-template-category-tree after_open.jstree",function(e,t){}).on("#mini-template-category-tree dblclick.jstree",function(e,t){var a=$(i).jstree().get_selected(!0)[0];if("category"==a.type)$("#id_meliscms_mini_template_menu_manager_tool_add_category_container").removeClass("hidden"),melisHelper.zoneReload("id_meliscms_mini_template_menu_manager_tool_add_category_container","meliscms_mini_template_menu_manager_tool_add_category_container",{isHidden:!1,id:a.id,formType:"edit",status:a.original.status},function(){$("#id_meliscms_mini_template_menu_manager_tool_header a").click()});else if("mini-template"==a.type){melisHelper.tabOpen(translations.tr_meliscms_mini_template_manager_tool,"fa fa-tasks","id_meliscms_mini_template_manager_tool","meliscms_mini_template_manager_tool");var s=$("body #melis-id-nav-bar-tabs li a.tab-element[data-id='id_meliscms_mini_template_manager_tool']"),n=setInterval(function(){s.length&&(melisHelper.tabOpen("Tpl "+a.original.id,"fa fa-tasks",a.original.id+"_id_meliscms_mini_template_manager_tool_add","meliscms_mini_template_manager_tool_add",{module:a.original.module,templateName:a.original.id,thumbnail:a.original.imgSource},"id_meliscms_mini_template_manager_tool"),clearInterval(n))},500)}}).on("#mini-template-category-tree move_node.jstree",function(e,a){var s=$(i).jstree(!0).get_json("#",{flat:!0});$.ajax({type:"POST",url:"/melis/MelisCms/MiniTemplateMenuManager/saveTree",data:{tree_data:JSON.stringify(s),site_id:$(t).find("option:selected").data("id")}}).done(function(e){e.success&&$(".melis-mini-template-menu-manager-table-refresh").trigger("click")}).fail(function(e){})}).on("#mini-template-category-tree select_node.jstree",function(e,t){}).jstree({contextmenu:{items:function(e){var a={add_category_template:{label:translations.tr_meliscms_mini_template_menu_manager_tool_jstree_add_minitemplate,icon:"fa fa-plus",action:function(i){melisHelper.tabOpen(translations.tr_meliscms_mini_template_manager_tool,"fa fa-tasks","id_meliscms_mini_template_manager_tool","meliscms_mini_template_manager_tool");var a=$("body #melis-id-nav-bar-tabs li a.tab-element[data-id='id_meliscms_mini_template_manager_tool']"),s=setInterval(function(){a.length&&($(".close.close-tab[data-id='new_template_id_meliscms_mini_template_manager_tool_add']").click(),melisHelper.tabOpen(translations.tr_meliscms_mini_template_manager_tool_header_add_btn,"fa fa-tasks","new_template_id_meliscms_mini_template_manager_tool_add","meliscms_mini_template_manager_tool_add",{templateName:"new_template",siteId:$(t).find("option:selected").data("id"),module:$(t).find("option:selected").val(),categoryId:e.original.categoryId},"id_meliscms_mini_template_manager_tool"),clearInterval(s))},500)}},edit_category:{label:translations.tr_meliscms_mini_template_menu_manager_tool_jstree_edit_category,icon:"fa fa-edit",action:function(t){parseInt(e.id),e.children.length,$("#id_meliscms_mini_template_menu_manager_tool_add_category_container").removeClass("hidden"),melisHelper.zoneReload("id_meliscms_mini_template_menu_manager_tool_add_category_container","meliscms_mini_template_menu_manager_tool_add_category_container",{isHidden:!1,id:e.id,formType:"edit",status:e.original.status},function(){$("#id_meliscms_mini_template_menu_manager_tool_header a").click()})}},delete_category:{label:translations.tr_meliscms_mini_template_menu_manager_tool_jstree_delete_category,icon:"fa fa-trash-o",action:function(t){0==e.children.length?melisCoreTool.confirm(translations.tr_meliscms_mini_template_manager_tool_delete_modal_confirm,translations.tr_meliscms_mini_template_manager_tool_delete_modal_cancel,translations.tr_meliscms_mini_template_menu_manager_tool_jstree_delete_category_title,translations.tr_meliscms_mini_template_menu_manager_tool_jstree_delete_category_text,function(){$.ajax({type:"POST",url:"/melis/MelisCms/MiniTemplateMenuManager/deleteCategory",data:{id:e.id}}).done(function(e){e.success?($(i).jstree(!0).refresh(),melisHelper.melisOkNotification(e.textTitle,e.textMessage)):melisHelper.melisKoNotification(translations.tr_meliscms_mini_template_menu_manager_tool_jstree_delete_category_title,translations.tr_meliscms_mini_template_menu_manager_category_delete_fail),melisCore.flashMessenger()}).fail(function(e){})}):melisHelper.melisKoNotification(translations.tr_meliscms_mini_template_menu_manager_tool_jstree_delete_category_title,translations.tr_meliscms_mini_template_menu_manager_tool_jstree_delete_category_error_children,[])}},edit_plugin:{label:translations.tr_meliscms_mini_template_menu_manager_tool_jstree_edit_minitemplate,icon:"fa fa-edit",action:function(t){melisHelper.tabOpen(translations.tr_meliscms_mini_template_manager_tool,"fa fa-tasks","id_meliscms_mini_template_manager_tool","meliscms_mini_template_manager_tool");var i=$("body #melis-id-nav-bar-tabs li a.tab-element[data-id='id_meliscms_mini_template_manager_tool']"),a=setInterval(function(){i.length&&(melisHelper.tabOpen("Tpl "+e.original.id,"fa fa-tasks",e.original.id+"_id_meliscms_mini_template_manager_tool_add","meliscms_mini_template_manager_tool_add",{module:e.original.module,templateName:e.original.id,thumbnail:e.original.imgSource},"id_meliscms_mini_template_manager_tool"),clearInterval(a))},500)}}};return"category"==e.original.type&&(delete a.edit_plugin,delete a.delete_plugin),"mini-template"==e.original.type&&(delete a.edit_category,delete a.delete_category,delete a.add_category_template),a}},core:{multiple:!1,check_callback:function(e,t,i,a,s){},animation:500,themes:{name:"proton",responsive:!1},dblclick_toggle:!1,data:{cache:!1,url:"/melis/MelisCms/MiniTemplateMenuManager/getTree?"+s},strings:{"Loading ...":translations.tr_meliscms_mini_template_menu_manager_js_tree_loading}},types:{"#":{valid_children:["mini-template","category"]},category:{valid_children:["mini-template"]},"mini-template":{valid_children:["none"]}},plugins:["contextmenu","changed","dnd","search","types"]}),a=!0):($(i).jstree(!0).destroy(),a=!1,$(".add-m-tpl-category").attr("disabled","disabled"),$(".add-m-tpl-category").attr("title",translations.tr_meliscms_mini_template_menu_manager_select_site_first_btn_title),$(".add-m-tpl-plugin").attr("disabled","disabled"),$(".add-m-tpl-plugin").attr("title",translations.tr_meliscms_mini_template_menu_manager_select_site_first_btn_title),$(".mini-template-menu-manager-lang").find("a").addClass("disabled"),$(".mini-template-menu-manager-lang").find("a").attr("title",translations.tr_meliscms_mini_template_menu_manager_select_site_first_btn_title))}),e.on("click",".mini-template-menu-manager-lang-select li a",function(){var e=$(this),a=e.text();s=e.data("locale"),$(".mini-template-menu-manager-lang a span.filter-key").text(a),$(i).data("langlocale",s),$(i).jstree(!0).settings.core.data.data=[{name:"langlocale",value:s},{name:"module",value:$(t).val()}],$(i).jstree(!0).refresh()}),e.on("click","#id_meliscms_mini_template_menu_manager_save_btn",function(){var e=$("#mtpl-category-status").find(".switch-on");e=e.length?1:0;var a=$("#id_meliscms_mini_template_menu_manager_tool_add_category_body_properties_form form").serializeArray();a.push({name:"site_id",value:$(t).find("option:selected").data("id")}),a.push({name:"cat_id",value:$("#menu-manager-category-id").data("id")}),a.push({name:"status",value:e}),a.push({name:"status",value:e}),a.push({name:"currentLocale",value:melisLangId}),melisCoreTool.pending("#id_meliscms_mini_template_menu_manager_save_btn"),$.ajax({type:"POST",url:"/melis/MelisCms/MiniTemplateMenuManager/saveCategory",data:a}).done(function(t){if(t.success)$(i).jstree(!0).refresh(),melisHelper.zoneReload("id_meliscms_mini_template_menu_manager_tool_add_category_container","meliscms_mini_template_menu_manager_tool_add_category_container",{isHidden:!1,id:t.id+"-"+t.categoryName,formType:"edit",status:e},function(){$("#id_meliscms_mini_template_menu_manager_tool_header a").hasClass("collapsed")&&$("#id_meliscms_mini_template_menu_manager_tool_header a").click()}),melisHelper.melisOkNotification(t.textTitle,t.textMessage);else{var a={};$.each(t.errors,function(e,t){if(t.error===translations.tr_meliscms_mini_template_error_category_atleast_one_provided)return a[e]=t,!1;a[e]=t}),melisHelper.melisKoNotification(translations.tr_meliscms_mini_template_menu_manager_save_category,"",a);var s=$("#id_meliscms_mini_template_menu_manager_tool_add_category_body_properties_form form").serializeArray(),n="_id_menu_manager_tool_site_add_category",r="-mini-template-menu-manager-category";void 0!==$("#menu-manager-category-id").data("id")&&(n="_id_menu_manager_tool_site_update_category"),$.each(s,function(e,i){var a=1,s=i.name.split("_",1),o={},l=0;$.each(t.errors,function(e,t){i.name==e&&(a=0,o[s+"_category_name"]=t,$('a[href="#'+s+r+'"] span.mm-lang-name').addClass("mm-tab-error-color"),l++)}),0==l&&$('a[href="#'+s+r+'"] span.mm-lang-name').removeClass("mm-tab-error-color"),melisCoreTool.highlightErrors(a,o,s+n)})}melisCore.flashMessenger(),melisCoreTool.done("#id_meliscms_mini_template_menu_manager_save_btn")}).fail(function(e){melisCoreTool.done("#id_meliscms_mini_template_menu_manager_save_btn")})}),e.on("click",".menu-mini-template-tool-edit-btn",function(){var e=$("#tableMiniTemplateMenuManagerPlugins").DataTable().row("#"+$(this).closest("tr").attr("id")).data();$(this).closest("tr").hasClass("child")&&(e=$("#tableMiniTemplateMenuManagerPlugins").DataTable().row("#"+$(this).closest("tr").prev().attr("id")).data());var t=e.DT_RowAttr.templateName,i=e.DT_RowAttr.module,a=e.DT_RowAttr.thumbnail;melisHelper.tabOpen(translations.tr_meliscms_mini_template_manager_tool,"fa fa-tasks","id_meliscms_mini_template_manager_tool","meliscms_mini_template_manager_tool");var s=$("body #melis-id-nav-bar-tabs li a.tab-element[data-id='id_meliscms_mini_template_manager_tool']"),n=setInterval(function(){s.length&&(melisHelper.tabOpen("Tpl "+t,"fa fa-tasks",t+"_id_meliscms_mini_template_manager_tool_add","meliscms_mini_template_manager_tool_add",{module:i,templateName:t,thumbnail:a},"id_meliscms_mini_template_manager_tool"),clearInterval(n))},500)}),e.on("click",".menu-mini-template-tool-delete-btn",function(){var a=$("#tableMiniTemplateMenuManagerPlugins").DataTable().row("#"+$(this).closest("tr").attr("id")).data();$(this).closest("tr").hasClass("child")&&(a=$("#tableMiniTemplateMenuManagerPlugins").DataTable().row("#"+$(this).closest("tr").prev().attr("id")).data());var s=a.DT_RowAttr.templateName;melisCoreTool.confirm(translations.tr_meliscms_mini_template_manager_tool_delete_modal_confirm,translations.tr_meliscms_mini_template_manager_tool_delete_modal_cancel,translations.tr_meliscms_mini_template_menu_manager_remove_plugin,translations.tr_meliscms_mini_template_menu_manager_remove_plugin_text,function(){$.ajax({type:"POST",url:"/melis/MelisCms/MiniTemplateMenuManager/removePluginFromCategory",data:{template:s,siteId:$(t).find("option:selected").data("id")}}).done(function(t){t.success?(e.find(".melis-mini-template-menu-manager-table-refresh").trigger("click"),e.find("#id_meliscms_mini_template_menu_manager_tool").length&&$(i).jstree(!0).refresh(),$('li[data-tool-id="'+s+'_id_meliscms_mini_template_manager_tool_add"]').find("a.close").trigger("click")):melisHelper.melisKoNotification(translations.tr_meliscms_mini_template_manager_tool_delete_modal_title,translations.tr_meliscms_mini_template_delete_fail)}).fail(function(e){})})})}),window.initMiniTemplateMenuManagerPluginTables=function(e,t){e.id=$("#menu-manager-category-id").data("id"),$("#tableMiniTemplateMenuManagerPlugins").on("row-reorder.dt",function(e,t,i){i.triggerRow.data()[1];for(var a=0,s=t.length;a<s;a++){$("#tableMiniTemplateMenuManagerPlugins").DataTable().row(t[a].node).data()[1]+" updated to be in position "+t[a].newData+" (was "+t[a].oldData+")<br>"}if(!$.isEmptyObject(t)){var n=new Array,r=new Array;$.each(t,function(){r.push(this.node.id+"-"+this.newPosition)}),n.push({name:"data",value:r.join()}),n=$.param(n),$.ajax({type:"POST",url:"/melis/MelisCms/MiniTemplateMenuManager/reorderMiniTemplates",data:n,dataType:"json",encode:!0,beforeSend:function(){$("#tableMiniTemplateMenuManagerPlugins").addClass("loading-changes"),$("#tableMiniTemplateMenuManagerPlugins").DataTable().rowReorder.disable()}}).done(function(e){$("#mini-template-category-tree").jstree(!0).refresh(),$("#tableMiniTemplateMenuManagerPlugins").DataTable().rowReorder.enable(),$("#tableMiniTemplateMenuManagerPlugins").removeClass("loading-changes")}).fail(function(){})}})},$(function(){function e(e,t){var i=activeTabId.split("_")[0];$('div[data-siteModule-name="'+e+'"].'+i+"_module_switch").find("div.switch-animate").removeClass("switch-on switch-off").addClass("switch-"+t),"on"===t?$("div[data-siteModule-name="+e+"]."+i+"_module_switch>div>input").attr("checked",!0):$("div[data-siteModule-name="+e+"]."+i+"_module_switch>div>input").removeAttr("checked")}$body=$("body"),$body.on("switch-change","#site-select-deselect-all-module",function(t,i){var a=activeTabId.split("_")[0],s="";s=!1===i.value?"off":"on",$("."+a+"_module_switch").each(function(t,i){e($(i).attr("data-siteModule-name"),s)})});var t="",i=!1,a=!1,s=!1;$body.on("switch-change","div[data-siteModule-name]",function(n,r){var o=$(this),l=activeTabId.split("_")[0],d=o.attr("data-siteModule-name"),c=r.value;t=d,!1===c&&(!1===s&&(i=!0),$("h4#meliscore-tool-module-content-title").html(translations.tr_meliscore_module_management_checking_dependencies),$("."+l+"_module_switch").bootstrapSwitch("setActive",!1),$.ajax({type:"POST",url:"/melis/MelisCms/SitesModuleLoader/getDependents",data:{module:d},dataType:"json",encode:!0}).done(function(t){var i="<br/><br/><div class='container'><div class='row'><div class='col-lg-12'><ul>%s</ul></div></div></div>",s="";$.each(t.modules,function(e,t){s+="<li>"+t+"</li>"}),i=i.replace("%s",s),t.success?melisCoreTool.confirm(translations.tr_meliscore_common_yes,translations.tr_meliscore_common_nope,translations.tr_meliscms_tool_site_module_load_deactivation_title,t.message+i+translations.tr_melis_cms_sites_module_loading_deactivate_module_with_prerequisites_notice_confirmation,function(){$.each(t.modules,function(t,i){e(i,"off")}),a=!0},function(){e(d,"off"),a=!0}):e(d,"off"),$("."+l+"_module_switch").bootstrapSwitch("setActive",!0),$("h4#meliscore-tool-module-content-title").html(translations.tr_meliscore_module_management_modules),setTimeout(function(){$("body").find(".confirm-modal-header").addClass("module-modal-dependency-checker")},200)}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})),!0===c&&(!1===s&&(i=!1),$("h4#meliscore-tool-module-content-title").html(translations.tr_meliscore_module_management_checking_dependencies),$("."+l+"_module_switch").bootstrapSwitch("setActive",!1),$.ajax({type:"POST",url:"/melis/MelisCms/SitesModuleLoader/getRequiredDependencies?siteId="+l,data:{module:d},dataType:"json",encode:!0}).done(function(t){var i="<br/><br/><div class='container'><div class='row'><div class='col-lg-12'><ul>%s</ul></div></div></div>",s="";$.each(t.modules,function(e,t){s+="<li>"+t+"</li>"}),i=i.replace("%s",s),t.success?melisCoreTool.confirm(translations.tr_meliscore_common_yes,translations.tr_meliscore_common_nope,translations.tr_meliscms_tool_site_module_load_activation_title,t.message+i+translations.tr_melis_cms_sites_module_loading_activate_module_with_prerequisites_notice_confirmation,function(){$.each(t.modules,function(t,i){e(i,"on"),a=!0}),e(d,"on")},function(){e(d,"on"),a=!0}):e(d,"on"),$("."+l+"_module_switch").bootstrapSwitch("setActive",!0),$("h4#meliscore-tool-module-content-title").html(translations.tr_meliscore_module_management_modules),setTimeout(function(){$("body").find(".confirm-modal-header").addClass("module-modal-dependency-checker")},200)}).fail(function(e,t,i){alert(translations.tr_meliscore_error_message)})),s=!0}),$(document).on("hidden.bs.modal",".module-modal-dependency-checker",function(){!1===a&&e(t,!0===i?"on":"off"),a=!1,i=!1,t="",s=!1}),window.moduleLoadJsCallback=function(){setOnOff(),$("#not-admin-notice").length>0&&$(".has-switch").bootstrapSwitch("setActive",!1)}});var sitesTranslationLoadedTblLists=[];$(function(){var e=$("body"),t=0,i="meliscms_tool_sites_site_translations";e.on("change",".transLangFilter",function(){var e=$(this).parents().eq(6).find("table").attr("id");$("#"+e).DataTable().ajax.reload()}),e.on("click",".mt-tr-refresh",function(){var e=activeTabId.split("_")[0];melisHelper.zoneReload(e+"_id_meliscms_tool_sites_site_translations",i,{siteId:e},function(){$("#"+e+"_id_meliscms_tool_sites_site_translations").addClass("active")})}),e.on("click",".btnEditSiteTranslation",function(){var e=$(this),t=e.closest("tr").attr("data-lang-id"),i=e.closest("tr").attr("data-site-id"),a=e.closest("tr").find("td:nth-child(2)").text();e.closest("tr").attr("data-mstt-id"),e.closest("tr").attr("data-mst-id");melisHelper.createModal("id_meliscms_tool_sites_site_translations_modal_edit","meliscms_tool_sites_site_translations_modal_edit",!0,{translationKey:a,langId:t,siteId:i},"/melis/MelisCms/SitesTranslation/renderToolSitesSiteTranslationModal")}),e.on("click","#btnDeleteSiteTranslation",function(e){var t=activeTabId.split("_")[0],a=$(this).closest("tr").attr("data-mst-id"),s=($(this).closest("tr").attr("data-mstt-id"),$(this).closest("tr").attr("data-site-id")),n={};n.mst_id=a,n.siteId=s,0!=a&&""!=a&&melisCoreTool.confirm(translations.tr_meliscore_common_yes,translations.tr_meliscore_common_no,translations.tr_melis_site_translation_name,translations.tr_melis_site_translation_delete_confirm,function(){$.ajax({type:"POST",url:"/melis/MelisCms/SitesTranslation/deleteTranslation",data:$.param(n)}).done(function(e){e.success&&(melisHelper.melisOkNotification(translations.tr_meliscore_common_success,translations.tr_melis_site_translation_delete_success),melisHelper.zoneReload(t+"_id_meliscms_tool_sites_site_translations",i,{siteId:t},function(){$("#"+t+"_id_meliscms_tool_sites_site_translations").addClass("active")}))})}),e.preventDefault()}),e.on("click",".btnSaveSiteTranslation",function(e){var a=activeTabId.split("_")[0],s=$("form[name='sitestranslationform']").serializeArray();$.ajax({type:"POST",url:"/melis/MelisCms/SitesTranslation/saveTranslation",data:$.param(s)}).done(function(e){e.success?(0==t?melisHelper.melisOkNotification(translations.tr_meliscore_common_success,translations.tr_melis_site_translation_inserting_success):melisHelper.melisOkNotification(translations.tr_meliscore_common_success,translations.tr_melis_site_translation_update_success),$("#modal-site-translation").modal("hide"),melisHelper.zoneReload(a+"_id_meliscms_tool_sites_site_translations",i,{siteId:a},function(){t=0,0,$("#"+a+"_id_meliscms_tool_sites_site_translations").addClass("active")})):(melisHelper.melisKoNotification(translations.tr_melis_site_translations,translations.tr_melis_site_translation_save_failed,e.errors),$.each(e.langErrorIds,function(t,i){melisCoreTool.highlightErrors(0,e.errors,i+"_site-translation-form")}))}),e.preventDefault()}),e.on("shown.bs.tab",".sites-tool-tabs a[data-toggle='tab']",function(){if($(window).width()<=768){var e=$(this).attr("href"),t=(e=e.replace("#","")).replace(/\d+/g,"");if(""!=e){var i=e.split("_");"_id_meliscms_tool_sites_site_translations"==t&&$("#"+i[0]+"_tableMelisSiteTranslation").DataTable().columns.adjust().responsive.recalc()}}})}),window.siteTransTableCallBack=function(e,t){var i=activeTabId.split("_")[0];$("#"+i+"_tableMelisSiteTranslation tbody tr[data-mst-id='0']").find("#btnDeleteSiteTranslation").remove()},window.initAdditionalTransParam=function(e){var t=activeTabId.split("_")[0];e.site_translation_language_name=$("#"+t+"_siteTranslationLanguageName").val(),e.siteId=t};