angular.module("app").controller("MainViewCtrl",["$scope","$templateCache","core","state","delta","editWindow","bootstrap","utils",function(e,n,t,o,i,a,r,c){var load=function(){c.Drops.activateDrop(null)};t.fn.onReload(load),load(),window.mainViewScope=e,e.core=t,e.utils=c,e.state=o,n.removeAll(),o.saveInProgress=!1;!function(){$(document).off("keydown.dropper"),$(document).off("keyup.dropper");let e=null,n=!1;$(document).on("keydown.dropper",(function(t){!0!==t.ctrlKey&&!0!==t.metaKey||83!==t.keyCode||t.originalEvent.repeat||(t.preventDefault(),t.stopPropagation(),clearTimeout(e),e=setTimeout((function(){let e=window.prompt("Gebe eine Notiz zu dem Speicherpunkt an:");null!==e&&(o.saveSettings(e).then((function(){n=!1})),n=!0)}),500))})),$(document).on("keyup.dropper",(function(t){if(!(!0!==t.ctrlKey&&!0!==t.metaKey||83!==t.keyCode||t.originalEvent.repeat)){if(clearTimeout(e),t.preventDefault(),t.stopPropagation(),n)return n=!1,!1;o.saveSettings()}}))}(),window.jtlIconsAdded||($("div#menu").append('<a class="btn btn-menu" href="'+t.shopURL+'?fromAdmin=yes" target="_blank"><small><i class="icon-shopping-cart icon-white"></i> Shop</small></a>'),$("div#menu").append('<a class="btn btn-menu" href="'+t.adminBackendURL+'" target="_blank"><small><i class="icon-home icon-white"></i> Admin</small></a>'),window.jtlIconsAdded=!0),window.keepSessionAliveRegistered||(setInterval((function(){$.ajax({url:t.adminBackendURL,success:function(){},error:function(){}})}),3e5),window.keepSessionAliveRegistered=!0),function(){if(!window.confirmNavigations){window.confirmNavigations=!0;var e=!1;$(document).keydown((function(n){8==n.which&&(e=!0)})),$(document).keyup((function(n){8==n.which&&(e=!1)})),$(window).on("beforeunload",(function(){if(e)return e=!1,"Du bist dabei Dropper zu verlassen. Möchtest du das wirklich?"}))}}(),r.rebind(),t.dropperLicense.hasLicense&&t.dropperLicense.isValid&&(o.verifyChanges(),t.fn.onReload((function(){o.verifyChanges()})));var s=null;e.$watch("state.activeDrop",(function(){o.activeDrop&&o.activeDrop===s?o.saveInProgress||(console.log("active drop:",o.activeDrop),t.fn.trigger("activeDropDataChanged",[o.activeDrop]),i.setChanged(o.activeDrop)):(o.activeDrop?o.hideDashboard():a.closeAll(),t.fn.trigger("activeDropChanged",[o.activeDrop])),s=o.activeDrop}),!0),e.$watchCollection("core.settings.drops",(function(e,n){n!==e&&o.setDirtySaveState(!0),t.settings.drops.indexOf(o.activeDrop)<0&&c.Drops.activateDrop(null)})),e.$watch("core.settings.lang",(function(e,n){n&&angular.toJson(e)!==angular.toJson(n)&&o.setDirtySaveState(!0)}),!0)}]);