src/resources/dist/main.js
function guid(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function i18nParam(e,t){var n=i18n[e];return angular.forEach(t,function(e,t){n=n.replace("%"+t+"%",e)}),n}function typeCastValue(e){return angular.isNumber(e)?parseInt(e):e}angular.module("dnd",[]).factory("dndFactory",function(){return{data:{content:null,pos:null,element:null},getElement:function(){return this.data.element},setElement:function(e){this.data.element=e},setContent:function(e){this.data.content=e},getContent:function(){return this.data.content},setPos:function(e){this.data.pos=e},getPos:function(){return this.data.pos}}}).directive("dnd",["dndFactory","AdminClassService",function(r,e){return{restrict:"A",transclude:!1,replace:!1,template:!1,templateURL:!1,scope:{dndModel:"=",dndCss:"=",dndOndrop:"&",dndIsvalid:"&"},link:function(i,o,e){var a=!0,l=e.hasOwnProperty("dndDisableDragMiddle");e.hasOwnProperty("dndDragDisabled")||o.attr("draggable","true"),i.addClass=function(e){o.addClass(e)},i.removeClass=function(e,t){o.removeClass(e)},o.on("dragstart",function(e){if((e=e.originalEvent||e).stopPropagation(),"false"==o.attr("draggable"))return!0;a=!0,r.setContent(i.dndModel),r.setElement(o[0]),i.addClass(i.dndCss.onDrag);try{e.dataTransfer.setData("text","1")}catch(e){try{e.dataTransfer.setData("application/json","1")}catch(e){e.dataTransfer.setData("Text","1")}}}),o.on("dragend",function(e){e=e.originalEvent||e,i.removeClass(i.dndCss.onDrag),e.stopPropagation()}),o.on("dragover",function(e){e=e.originalEvent||e;try{e.dataTransfer.dropEffect="move"}catch(e){}if(e.preventDefault(),e.stopPropagation(),!i.dndIsvalid({hover:i.dndModel,dragged:r.getContent()}))return a=!1;var t=o[0].getBoundingClientRect(),n=100/t.height*(e.clientY-t.top);return l?n<=50?(i.addClass(i.dndCss.onHoverTop),i.removeClass(i.dndCss.onHoverMiddle),i.removeClass(i.dndCss.onHoverBottom),r.setPos("top")):(i.removeClass(i.dndCss.onHoverTop),i.removeClass(i.dndCss.onHoverMiddle),i.addClass(i.dndCss.onHoverBottom),r.setPos("bottom")):n<=25?(i.addClass(i.dndCss.onHoverTop),i.removeClass(i.dndCss.onHoverMiddle),i.removeClass(i.dndCss.onHoverBottom),r.setPos("top")):65<=n?(i.removeClass(i.dndCss.onHoverTop),i.removeClass(i.dndCss.onHoverMiddle),i.addClass(i.dndCss.onHoverBottom),r.setPos("bottom")):(i.removeClass(i.dndCss.onHoverTop),i.addClass(i.dndCss.onHoverMiddle),i.removeClass(i.dndCss.onHoverBottom),r.setPos("middle")),i.addClass(i.dndCss.onHover),!1}),o.on("dragenter",function(e){e=e.originalEvent||e,i.addClass(i.dndCss.onHover),e.preventDefault()}),o.on("dragleave",function(e){i.removeClass(i.dndCss.onHover,!0),i.removeClass(i.dndCss.onHoverTop,!0),i.removeClass(i.dndCss.onHoverMiddle,!0),i.removeClass(i.dndCss.onHoverBottom,!0)}),e.hasOwnProperty("dndDropDisabled")||o.on("drop",function(e){return(e=e.originalEvent||e).preventDefault(),e.stopPropagation(),i.removeClass(i.dndCss.onHover,!0),i.removeClass(i.dndCss.onHoverTop,!0),i.removeClass(i.dndCss.onHoverMiddle,!0),i.removeClass(i.dndCss.onHoverBottom,!0),!!a&&(i.$apply(function(){i.dndOndrop({dragged:r.getContent(),dropped:i.dndModel,position:r.getPos(),element:r.getElement()})}),!0)})}}}]);var zaa=angular.module("zaa",["ui.router","dnd","angular-loading-bar","ngFileUpload","ngWig","flow","angular.filter","720kb.datepicker","directive.ngColorwheel","uiCropper"]);zaa.config(["$httpProvider","$stateProvider","$controllerProvider","$urlMatcherFactoryProvider",function(e,t,n,i){e.interceptors.push("authInterceptor"),zaa.bootstrap=n,i.strictMode(!1),t.state("default",{url:"/default/:moduleId",templateUrl:function(e){return"admin/template/default"}}).state("default.route",{url:"/:moduleRouteId/:controllerId/:actionId",templateUrl:function(e){return e.moduleRouteId+"/"+e.controllerId+"/"+e.actionId},parent:"default",resolve:{adminServiceResolver:adminServiceResolver}}).state("custom",{url:"/template/:templateId",templateUrl:function(e){return e.templateId},resolve:{adminServiceResolver:adminServiceResolver,resolverProvider:["resolver",function(e){return e.then}]}}).state("home",{url:"",templateUrl:"admin/default/dashboard",controller:["$scope",function(e){e.$parent.currentItem={icon:"home",alias:i18n.menu_dashboard}}]}).state("default.route.detail",{url:"/:id",parent:"default.route",template:"<ui-view/>",controller:["$scope","$stateParams",function(e,t){e.crud=e.$parent,e.init=function(){e.crud.config.inline||e.crud.data.updateId!=t.id&&e.crud.toggleUpdate(t.id)},e.init()}]})}]),zaa.provider("resolver",[function(){var o=[];this.addCallback=function(e){o.push(e)},this.$get=["$injector","$q","$state",function(i,e,t){return e(function(e,t){for(var n in o)i.invoke(o[n])})}]}]),zaa.factory("LuyaLoading",["$timeout",function(t){var n=!1,i=null,o=null;return{start:function(e){i=null==e?i18n.js_zaa_server_proccess:e,t.cancel(o),n=!0,o=t(function(){n=!0},1e3)},stop:function(){t.cancel(o),n=!1},getStateMessage:function(){return i},getState:function(){return n}}}]),zaa.factory("AdminClassService",function(){var n=[];return n.vars={},n.getClassSpace=function(e){if(n.vars.hasOwnProperty(e))return n.vars[e]},n.hasClassSpace=function(e){return!!n.vars.hasOwnProperty(e)},n.setClassSpace=function(e,t){n.vars[e]=t},n.clearSpace=function(e){n.vars.hasOwnProperty(e)&&(n.vars[e]=null)},n.removeSpace=function(e){n.hasClassSpace(e)&&delete n.vars[e]},n.stack=0,n.modalStackPush=function(){n.stack+=1},n.modalStackRemove=function(){n.stack<=1?n.stack=0:n.stack-=1},n.modalStackRemoveAll=function(){n.stack=0},n.modalStackIsEmpty=function(){return 0==n.stack},n}),zaa.factory("CacheReloadService",["$http","$window",function(e,t){var n=[];return n.reload=function(){e.get("admin/api-admin-common/cache").then(function(e){t.location.reload()})},n}]),zaa.factory("authInterceptor",["$rootScope","$q","AdminToastService","AdminDebugBar",function(i,o,t,a){return{request:function(e){if(e.hasOwnProperty("ignoreLoadingBar")||(e.debugId=a.pushRequest(e)),e.hasOwnProperty("authToken"))var t=e.authToken;else t=i.luyacfg.authToken;e.headers=e.headers||{},e.headers.Authorization="Bearer "+t;var n=document.head.querySelector("[name=csrf-token]");return null!==n&&(e.headers["X-CSRF-Token"]=n.content),e||o.when(e)},response:function(e){return e.hasOwnProperty("ignoreLoadingBar")||a.pushResponse(e),e||o.when(e)},responseError:function(e){if(401==e.status||403==e.status||405==e.status)e.config.hasOwnProperty("authToken")||(window.location="admin/default/logout?autologout=1");else if(404==e.status){e.data.hasOwnProperty("message")?t.info(e.data.message,1e4):t.info("Response Error: "+e.status+" "+e.statusText,1e4)}else if(422!=e.status){e.data.hasOwnProperty("message")?t.error(e.data.message,1e4):t.error("Response Error: "+e.status+" "+e.statusText,1e4)}return o.reject(e)}}}]),adminServiceResolver=["ServiceFoldersData","ServiceFiltersData","ServiceLanguagesData","ServicePropertiesData","AdminLangService","ServiceFoldersDirectoryId",function(e,t,n,i,o,a){t.load(),e.load(),n.load(),i.load(),o.load(),a.load()}],zaa.factory("ServiceQueueWaiting",["$http","$q","$timeout",function(t,o,e){var a={ids:[],waitFor:function(i){return o(function(t,e){if(0==i.length)t();else{i.forEach(function(e){return a.ids.push(e)});var n=[];i.forEach(function(e){n.push(a.waitForJobId(e))}),o.all(n).then(function(e){t()})}})},waitForJobId:function(i){return o(function(n,e){t.get("admin/api-admin-common/queue-job?jobId="+i,{ignoreLoadingBar:!0}).then(function(e){if(e.data.is_done){var t=a.ids.indexOf(i);-1<t&&(a.ids.splice(t,1),n())}else setTimeout(function(){a.waitForJobId(i).then(function(e){n()})},500)})})}};return a}]),zaa.factory("ServiceAdminTags",["$http","$q","$rootScope",function(i,e,o){var a={data:null,load:function(n){return e(function(t,e){null!==a.data&&!0!==n?t(a.data):i.get("admin/api-admin-common/tags").then(function(e){a.data=e.data,o.$broadcast("service:AdminTags",a.data),t(a.data)})})}};return a}]),zaa.factory("ServiceFoldersData",["$http","$q","$rootScope",function(i,e,o){var a=[];return a.data=null,a.load=function(n){return e(function(t,e){null!==a.data&&!0!==n?t(a.data):i.get("admin/api-admin-storage/data-folders").then(function(e){a.data=e.data,o.$broadcast("service:FoldersData",a.data),t(a.data)})})},a}]),zaa.factory("ServiceFoldersDirectoryId",["$http","$q","$rootScope",function(i,e,o){var a=[];return a.folderId=!1,a.load=function(n){return e(function(t,e){!1!==a.folderId&&!0!==n?t(a.folderId):i.get("admin/api-admin-common/get-filemanager-folder-state").then(function(e){a.folderId=e.data,o.$broadcast("service:FoldersDirectoryId",a.folderId),t(a.folderId)})})},a}]),zaa.factory("ServiceImagesData",["$http","$q","$rootScope","$log",function(o,e,t,n){var a=[];return a.data={},a.getImage=function(t,i){return e(function(n,e){return 0==t?e(t):a.data.hasOwnProperty(t)&&!0!==i?n(a.data[t]):void o.get("admin/api-admin-storage/image-info?id="+t).then(function(e){var t=e.data;return a.data[t.id]=t,n(t)})})},a.loadImages=function(n){return e(function(t,e){if(0==n.length)return t();o.post("admin/api-admin-storage/images-info?expand=source,tinyCropImage",{ids:n}).then(function(e){return angular.forEach(e.data,function(e){a.data[e.id]=e}),t()})})},a}]),zaa.factory("ServiceFilesData",["$http","$q","$rootScope","$log",function(o,e,t,n){var a=[];return a.data={},a._promises={},a.getFile=function(e,t){if(a._promises.hasOwnProperty(e))return a._promises[e];var n=a.newPromise(e,t);return a._promises[e]=n},a.newPromise=function(i,t){return e(function(n,e){return 0==i?e(i):a.data.hasOwnProperty(i)&&!0!==t?n(a.data[i]):void o.get("admin/api-admin-storage/file-info?id="+i).then(function(e){var t=e.data;return a.data[t.id]=t,delete a._promises[i],n(t)})})},a}]),zaa.factory("ServiceFiltersData",["$http","$q","$rootScope",function(i,e,o){var a=[];return a.data=null,a.load=function(n){return e(function(t,e){null!==a.data&&!0!==n?t(a.data):i.get("admin/api-admin-storage/data-filters").then(function(e){a.data=e.data,o.$broadcast("service:FiltersData",a.data),t(a.data)})})},a}]),zaa.factory("ServiceLanguagesData",["$http","$q","$rootScope",function(i,e,o){var a=[];return a.data=[],a.load=function(n){return e(function(t,e){0<a.data.length&&!0!==n?t(a.data):i.get("admin/api-admin-common/data-languages").then(function(e){a.data=e.data,o.$broadcast("service:LanguagesData",a.data),t(a.data)})})},a}]),zaa.factory("ServicePropertiesData",["$http","$q","$rootScope",function(i,e,o){var a=[];return a.data=null,a.load=function(n){return e(function(t,e){null!==a.data&&!0!==n?t(a.data):i.get("admin/api-admin-common/data-properties").then(function(e){a.data=e.data,o.$broadcast("service:PropertiesData",a.data),t(a.data)})})},a}]),zaa.factory("CrudTabService",function(){var l=[];return l.tabs=[],l.remove=function(e,t){(l.tabs.splice(e,1),0<l.tabs.length)?l.tabs.slice(-1)[0].active=!0:t.switchTo(0)},l.addTab=function(e,t,n,i,o){var a={id:e,api:t,arrayIndex:n,active:!0,name:i,modelClass:o};angular.forEach(l.tabs,function(e){e.active=!1}),l.tabs.push(a)},l.clear=function(){l.tabs=[]},l}),zaa.factory("AdminLangService",["ServiceLanguagesData","$rootScope",function(e,n){var i=[];return i.data=[],i.selection=[],i.toggleSelection=function(e){var t=i.selection.indexOf(e.short_code);-1==t?(i.selection.push(e.short_code),n.$broadcast("service:LoadLanguage",e)):1<i.selection.length&&i.selection.splice(t,1)},i.isInSelection=function(e){return-1!=i.selection.indexOf(e)},i.resetDefault=function(){i.selection=[],angular.forEach(e.data,function(e,t){1==e.is_default&&(i.isInSelection(e.short_code)||i.toggleSelection(e))})},i.load=function(){e.load().then(function(e){i.data=e,angular.forEach(e,function(e){1==e.is_default&&(i.isInSelection(e.short_code)||i.toggleSelection(e))})})},i}]),zaa.factory("AdminDebugBar",function(){var i=[];return i.data=[],i.clear=function(){i.data=[]},i.pushRequest=function(e){return i.data.push({url:e.url,requestData:e.data,responseData:null,responseStatus:null,start:new Date,end:null,parseTime:null})},i.pushResponse=function(e){var t=e,n=i.data[t.config.debugId];return n&&(n.responseData=t.data,n.responseStatus=t.status,n.end=new Date,n.parseTime=new Date-n.start),e},i}),zaa.factory("AdminToastService",["$q","$timeout","$injector",function(e,o,a){var l=[];return l.notify=function(e,t,n){null==t&&(t=6e3);var i=guid();l.queue[i]={message:e,timeout:t,uuid:i,type:n,close:function(){delete l.queue[this.uuid]}},o(function(){delete l.queue[i]},t)},l.success=function(e,t){l.notify(e,t,"success")},l.info=function(e,t){l.notify(e,t,"info")},l.warning=function(e,t){l.notify(e,t,"warning")},l.error=function(e,t){l.notify(e,t,"error")},l.errorArray=function(e,n){angular.forEach(e,function(e,t){l.error(e.message,n)})},l.confirm=function(e,t,n){var i=guid();l.queue[i]={message:e,title:t,click:function(){var t=this,e=a.invoke(this.callback,this,{$toast:this});void 0!==e&&e.then(function(e){t.close()},function(e){t.close()},function(e){})},uuid:i,callback:n,type:"confirm",close:function(){delete l.queue[this.uuid]}}},l.queue={},l}]),zaa.factory("HtmlStorage",function(){var n={data:{},isLoaded:!1,loadData:function(){if(!n.isLoaded&&localStorage.getItem("HtmlStorage")){var e=angular.fromJson(localStorage.getItem("HtmlStorage"));n.data=e}},saveData:function(){localStorage.removeItem("HtmlStorage"),localStorage.setItem("HtmlStorage",angular.toJson(n.data))},getValue:function(e,t){return n.loadData(),n.data.hasOwnProperty(e)?n.data[e]:t},setValue:function(e,t){n.loadData(),n.data[e]=t,n.saveData()}};return n}),zaa.filter("filemanagerdirsfilter",function(){return function(e,n){var i=[];return angular.forEach(e,function(e,t){e.parentId==n&&i.push(e)}),i.sort(function(e,t){return e.name.toLowerCase()>t.name.toLowerCase()?1:-1}),i}}),zaa.filter("findthumbnail",function(){return function(e,n,i){var o=!1;return angular.forEach(e,function(e,t){o||e.fileId==n&&e.filterId==i&&(o=e)}),o}}),zaa.filter("findidfilter",function(){return function(e,n){var i=!1;return angular.forEach(e,function(e,t){e.id==n&&(i=e)}),i}}),zaa.filter("filemanagerfilesfilter",function(){return function(e,t,n){var i=[];return angular.forEach(e,function(e){n?e.folderId==t&&1==e.isImage&&i.push(e):e.folderId==t&&i.push(e)}),i}}),zaa.filter("trustAsUnsafe",["$sce",function(n){return function(e,t){return n.trustAsHtml(e)}}]),zaa.filter("srcbox",function(){return function(e,t){if(!e)return e;if(!t)return e;var o=(""+t).toLowerCase(),a={};return angular.forEach(e,function(n,i){angular.forEach(n,function(e,t){-1!==(""+e).toLowerCase().indexOf(o)&&(a[i]=n)})}),a}}),zaa.filter("trustAsResourceUrl",["$sce",function(n){return function(e,t){return t?n.trustAsResourceUrl(e):null}}]),zaa.filter("truncateMiddle",function(){return function(e,t,n){if(t=t||30,n=n||"...",e.length<=t)return e;var i=(t-n.length)/2;return e.substring(0,i)+n+e.substring(e.length-i,e.length)}}),zaa.directive("echarts",[function(){return{scope:{id:"@",theme:"@",data:"="},restrict:"E",template:'<div style="min-height:300px;height:auto;width:100%;"></div>',replace:!0,controller:["$scope",function(e){e.theme&&(e.theme="macarons")}],link:function(e){var t=echarts.init(document.getElementById(e.id),e.theme);e.$watch("data",function(e){e&&null!=e&&t.setOption(angular.fromJson(e))}),angular.element(window).bind("resize",function(){t.resize()})}}}]),zaa.directive("compileHtml",["$compile","$parse",function(o,a){return{restrict:"A",link:function(e,t,n){var i=a(n.ngBindHtml);e.$watch(function(){return(i(e)||"").toString()},function(){o(t,null,-9999)(e)})}}}]),zaa.directive("selectOnClick",function(){return function(e,t,n){t.bind("click",function(){this.select()})}}),zaa.directive("zaaEsc",["$document",function(i){return function(t,e,n){i.on("keyup",function(e){27==e.keyCode&&t.$apply(function(){t.$eval(n.zaaEsc)})})}}]),zaa.directive("linkObjectToString",function(){return{restrict:"E",relace:!0,scope:{link:"="},template:function(){return'<span><span ng-if="link.type==1"><show-internal-redirection nav-id="link.value" /></span><span ng-if="link.type==2">{{link.value}}</span><span ng-if="link.type==3"><storage-file-display file-id="{{link.value}}"></storage-file-display></span><span ng-if="link.type==4">{{link.value}}</span><span ng-if="link.type==5">{{link.value}}</span></span>'}}}),zaa.directive("tooltip",["$document","$http","$timeout",function(c,d,u){return{restrict:"A",scope:{tooltipText:"@",tooltipExpression:"=",tooltipPosition:"@",tooltipOffsetTop:"@",tooltipOffsetLeft:"@",tooltipPopupDelay:"@",tooltipImageUrl:"@",tooltipPreviewUrl:"@",tooltipDisabled:"="},link:function(i,o,e){function a(){var e={};e="function"==typeof s[i.tooltipPosition]?s[i.tooltipPosition]():s.right();var t=parseInt(i.tooltipOffsetTop);t&&(e.top=e.top+t);var n=parseInt(i.tooltipOffsetLeft);n&&(e.left=e.left+n),i.pop.css(e)}function t(){r&&(u.cancel(r),r=null)}var l=null,r=null,s={top:function(){var e=o[0].getBoundingClientRect();return{top:e.top-i.pop.outerHeight(),left:e.left+e.width/2-i.pop.outerWidth()/2}},bottom:function(){var e=o[0].getBoundingClientRect();return{top:e.top+e.height,left:e.left+e.width/2-i.pop.outerWidth()/2}},right:function(){var e=o[0].getBoundingClientRect();return{top:e.top+e.height/2-i.pop.outerHeight()/2,left:e.left+e.width}},left:function(){var e=o[0].getBoundingClientRect();return{top:e.top+e.height/2-i.pop.outerHeight()/2,left:e.left-i.pop.outerWidth()}}};o.on("mouseenter",function(){if(i.tooltipExpression&&(i.tooltipText=i.tooltipExpression),(!i.pop||l!=i.tooltipText)&&(void 0===i.tooltipDisabled||!1===i.tooltipDisabled)&&(i.tooltipText||i.tooltipImageUrl||i.tooltipPreviewUrl)){l=i.tooltipText;var e='<div class="tooltip tooltip-'+(i.tooltipPosition||"right")+(i.tooltipImageUrl?" tooltip-image":"")+'" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner">'+(i.tooltipText?'<span class="tooltip-text">'+i.tooltipText+"</span>":"")+"</div></div>",t=$(e);if(i.tooltipImageUrl){var n=new Image;n.onload=function(){a()},n.src=i.tooltipImageUrl,t.find(".tooltip-inner").append(n)}i.tooltipPreviewUrl&&d.get(i.tooltipPreviewUrl).then(function(e){t.find(".tooltip-inner").append('<div class="tooltip-preview">'+e.data+"</div>")}),i.pop=t,c.find("body").append(i.pop),i.pop.hide()}!i.pop||void 0!==i.tooltipDisabled&&!1!==i.tooltipDisabled||(a(),o.parents().on("scroll",a),isNaN(i.tooltipPopupDelay)?i.pop.show():r=u(function(){i.pop.show()},i.tooltipPopupDelay))}),o.on("mouseleave",function(){o.parents().off("scroll",a),t(),i.pop&&i.pop.hide()}),i.$on("$destroy",function(){t(),i.pop&&i.pop.remove()})}}}]),zaa.directive("convertToNumber",function(){return{require:"ngModel",link:function(e,t,n,i){i.$parsers.push(function(e){return null!=e?parseInt(e,10):null}),i.$formatters.push(function(e){return null!=e?""+e:null})}}}),zaa.directive("autoGrow",function(){return function(e,t,n){function i(){null==o&&(o=angular.element("<div></div>").css({position:"absolute",top:-1e4,left:-1e4,resize:"none"}),angular.element(document.body).append(o)),o.css({fontSize:t.css("font-size"),fontFamily:t.css("font-family"),lineHeight:t.css("line-height"),width:t.width(),paddingTop:t.css("padding-top"),paddingBottom:t.css("padding-bottom")});var e=t.val().replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/\n$/,"<br/> ").replace(/\n/g,"<br/>").replace(/\s{2,}/g,function(e){return function(e,t){for(var n=0,i="";n<t;n++)i+=e;return i}(" ",e.length-1)+" "});o.html(e),t.css("height",o.outerHeight()+10+"px")}var o=null;t.bind("keyup keydown keypress change click",i),t.bind("blur",function(){null!=o&&(o.remove(),o=null)}),i()}}),zaa.directive("resizer",["$document",function(a){return{scope:{trigger:"@"},link:function(e,t,i){function n(e){$(i.resizerCover).show();var t=e.pageX,n=window.innerWidth;t<600&&(t=600),n-400<t&&(t=n-400);$(i.resizerLeft).width(),$(i.resizerRight).width();$(i.resizerLeft).css({width:t+"px"}),$(i.resizerRight).css({width:n-t+"px"})}function o(){$(i.resizerCover).hide(),a.unbind("mousemove",n),a.unbind("mouseup",o)}e.$watch("trigger",function(e,t){0==e&&($(i.resizerLeft).removeAttr("style"),$(i.resizerRight).removeAttr("style"))}),t.on("mousedown",function(e){e.preventDefault(),a.on("mousemove",n),a.on("mouseup",o)})}}}]),zaa.directive("ngConfirmClick",function(){return{link:function(t,e,n){var i=n.ngConfirmClick||"Are you sure?",o=n.confirmedClick;e.bind("click",function(e){window.confirm(i)&&t.$eval(o)})}}}),zaa.directive("focusMe",["$timeout","$parse",function(o,a){return{link:function(e,t,n){var i=a(n.focusMe);e.$watch(i,function(e){!0===e&&o(function(){t[0].focus()})})}}}]),zaa.directive("clickPastePusher",["$rootScope","$compile",function(i,e){return{restrict:"A",replace:!1,link:function(e,t,n){t.bind("click",function(){i.$broadcast("insertPasteListener",n.clickPastePusher)})}}}]),zaa.directive("insertPasteListener",["$rootScope",function(r){return{restrict:"A",link:function(e,l,t){l.bind("focus",function(){r.lastElement=l[0];r.$on("insertPasteListener",function(e,t){var n=r.lastElement;if(n!=l[0]||!n)return!1;if(r.$$listeners.insertPasteListener=[],document.selection)n.focus(),document.selection.createRange().text=t,n.focus();else if(n.selectionStart||0===n.selectionStart){var i=n.selectionStart,o=n.selectionEnd,a=n.scrollTop;n.value=n.value.substring(0,i)+t+n.value.substring(o,n.value.length),n.focus(),n.selectionStart=i+t.length,n.selectionEnd=i+t.length,n.scrollTop=a}else n.value+=t,n.focus()})})}}}]),zaa.directive("modal",["$timeout",function(e){return{restrict:"E",scope:{isModalHidden:"=",title:"@modalTitle"},replace:!0,transclude:!0,templateUrl:"modal",controller:["$scope","AdminClassService",function(e,n){e.$watch("isModalHidden",function(e,t){e!==t&&(e?n.modalStackRemove():n.modalStackPush())}),e.escModal=function(){e.isModalHidden=!0,n.modalStackRemoveAll()}}],link:function(e,t){e.$on("$destroy",function(){t.remove()}),angular.element(document.body).append(t)}}}]),zaa.directive("collapseContainer",[function(){return{restrict:"E",scope:{title:"@",icon:"@"},replace:!0,transclude:!0,controller:["$scope",function(e){e.visible=!1,e.toggleVisibility=function(){e.visible=!e.visible}}],template:function(){return'<div class="card" ng-class="{\'card-closed\': !visible}"><div class="card-header" ng-click="toggleVisibility()"><span class="material-icons card-toggle-indicator">keyboard_arrow_down</span><i class="material-icons" ng-show="icon">{{icon}}</i><span>{{title}}</span></div><div class="card-body" ng-transclude></div></div>'}}}]),zaa.directive("crudLoader",["$http","$sce",function(t,i){return{restrict:"E",replace:!0,transclude:!1,scope:{api:"@",alias:"@",modelSelection:"@",modelSetter:"="},controller:["$scope",function(n){n.input={showWindow:!0},n.content=null,n.toggleWindow=function(){if(n.input.showWindow){if(-1<n.api.indexOf("?"))var e=n.api+"&inline=1";else e=n.api+"?inline=1";parseInt(n.modelSelection)&&(e=e+"&modelSelection="+n.modelSetter),t.get(e).then(function(e){n.content=i.trustAsHtml(e.data),n.input.showWindow=!1})}else"function"==typeof n.$parent.loadService&&n.$parent.loadService(),n.input.showWindow=!0},n.$watch("input.showWindow",function(e,t){e!==t&&1==e&&"function"==typeof n.$parent.loadService&&n.$parent.loadService()}),n.setModelValue=function(e,t){n.modelSetter=e,n.toggleWindow()}}],template:function(){return'<div class="crud-loader-tag"><button ng-click="toggleWindow()" type="button" class="btn btn-info btn-icon"><i class="material-icons">playlist_add</i></button><modal is-modal-hidden="input.showWindow" modal-title="{{alias}}"><div class="modal-body" compile-html ng-bind-html="content"></modal></div>'}}}]),zaa.directive("crudRelationLoader",["$http","$sce",function(n,i){return{restrict:"E",replace:!0,transclude:!1,scope:{api:"@api",arrayIndex:"@arrayIndex",modelClass:"@modelClass",id:"@id"},controller:["$scope",function(t){if(t.content=null,-1<t.api.indexOf("?"))var e=t.api+"&inline=1";else e=t.api+"?inline=1";n.get(e+"&relation="+t.id+"&arrayIndex="+t.arrayIndex+"&modelClass="+t.modelClass).then(function(e){t.content=i.trustAsHtml(e.data)})}],template:function(){return'<div compile-html ng-bind-html="content"></div>'}}}]),zaa.directive("storageFileDisplay",function(){return{restrict:"E",scope:{fileId:"@fileId"},controller:["$scope","$filter","ServiceFilesData",function(n,e,i){n.fileId=0,n.fileinfo=null,n.$watch("fileId",function(e,t){0!=e&&null!=e&&null!=e&&i.getFile(e).then(function(e){n.fileinfo=e},function(){n.fileinfo=null})})}],template:function(){return'<a ng-show="fileinfo" href="{{ fileinfo.source }}" target="_blank">{{ fileinfo.name_original }}</a>'}}}),zaa.directive("storageImageCrudList",function(){return{restrict:"E",scope:{imageId:"@imageId"},controller:["$scope","ServiceImagesData",function(n,t){n.imageSrc=null,n.$watch("imageId",function(e,t){e!=t&&(n.imageSrc=null),e&&n.evaluateImages()}),n.$on("requestImageSourceReady",function(){n.evaluateImages()}),n.evaluateImages=function(){0==n.imageId||n.imageSrc||t.getImage(n.imageId).then(function(e){e.tinyCropImage?n.imageSrc=e.tinyCropImage.source:t.getImage(n.imageId,!0).then(function(e){e.tinyCropImage&&(n.imageSrc=e.tinyCropImage.source)})})}}],template:function(){return'<img ng-show="imageSrc" ng-src="{{imageSrc}}" alt="{{imageSrc}}" class="img-fluid rounded border" />'}}}),zaa.directive("storageImageThumbnailDisplay",function(){return{restrict:"E",scope:{imageId:"@imageId"},controller:["$scope","$filter","ServiceImagesData","ServiceFilesData",function(n,e,i,t){n.$watch("imageId",function(e,t){e!=t&&(n.imageSrc=null)}),n.$watch(function(){return n.imageId},function(e,t){null==e&&null==e||i.getImage(e).then(function(e){n.imageSrc=e.tinyCropImage.source},function(){n.imageSrc=null})}),n.imageSrc=null}],template:function(){return'<div ng-show="imageSrc"><img ng-src="{{imageSrc}}" alt="{{imageSrc}}" class="img-fluid" /></div>'}}}),zaa.directive("storageFileUpload",function(){return{restrict:"E",scope:{ngModel:"="},controller:["$scope","$filter","ServiceFilesData",function(t,e,n){t.modal={state:1},t.modalContainer=!1,t.fileinfo=null,t.select=function(e){t.toggleModal(),t.ngModel=e},t.reset=function(){t.ngModel=0,t.fileinfo=null},t.toggleModal=function(){t.modalContainer=!t.modalContainer,t.modal.state=!t.modal.state},t.$watch(function(){return t.ngModel},function(e){if(null==e||!angular.isNumber(e))return null;n.getFile(e).then(function(e){t.fileinfo=e},function(){t.fileinfo=null})})}],templateUrl:"storageFileUpload"}}),zaa.directive("storageImageUpload",function(){return{restrict:"E",scope:{ngModel:"=",options:"="},controller:["$scope","$http","$filter","ServiceFiltersData","ServiceImagesData","AdminToastService","ServiceFilesData",function(n,i,o,e,a,l,t){n.filtersData=e.data,n.$on("service:FiltersData",function(e,t){n.filtersData=t}),n.noFilters=function(){if(n.options)return n.options.no_filter},n.thumbnailfilter=null,n.imageLoading=!1,n.fileId=0,n.filterId=0,n.imageinfo=null,n.imageNotFoundError=!1,n.thumb=!1,n.filterApply=function(){n.imageLoading=!0,t.getFile(n.fileId).then(function(e){var t=o("filter")(e.images,{filter_id:n.filterId});0==t.length?i.post("admin/api-admin-storage/image-filter",{fileId:n.fileId,filterId:n.filterId}).then(function(e){n.ngModel=e.data.id,l.success(i18n.js_dir_image_upload_ok),n.imageLoading=!1},function(e){l.error(i18n.js_dir_image_filter_error),n.imageLoading=!1}):(n.ngModel=t[0].id,n.imageLoading=!1)},function(){n.imageinfo=null,n.thumb=!1,n.ngModel=0})},n.changeFilter=function(){n.filterApply()},n.$watch(function(){return n.fileId},function(e,t){null!=e&&n.filterApply()}),n.$watch(function(){return n.ngModel},function(e,t){null!=e&&0!==e&&a.getImage(e).then(function(e){n.applyImageDetails(e),n.fileId=e.file_id,n.filterId=e.filter_id},function(){n.fileId=0,n.filterId=0,n.imageinfo=null,n.thumb=!1})}),n.applyImageDetails=function(e){n.imageinfo=e,n.thumb=e}}],templateUrl:"storageImageUpload"}}),zaa.directive("storageFileManager",function(){return{restrict:"E",transclude:!1,scope:{allowSelection:"@selection",onlyImages:"@onlyImages"},controller:["$scope","$http","$filter","$timeout","$q","HtmlStorage","cfpLoadingBar","Upload","ServiceFoldersData","ServiceFilesData","LuyaLoading","AdminToastService","ServiceFoldersDirectoryId","ServiceAdminTags","ServiceQueueWaiting",function(o,a,t,e,l,r,n,i,s,c,d,u,p,f,m){o.foldersData=s.data,o.$on("service:FoldersData",function(e,t){o.foldersData=t}),o.foldersDataReload=function(){return s.load(!0)},o.tags=[],f.load().then(function(e){o.tags=e}),o.filesData=[],o.totalFiles=0,o.pageCount=0,o.currentPageId=parseInt(r.getValue("filemanager.pageId",1)),o.$watch("currentPageId",function(e,t){void 0!==e&&e!=t&&o.getFilesForCurrentPage()},!0),o.$watch("currentFolderId",function(e,t){void 0!==e&&(o.generateFolderInheritance(e),o.getFilesForPageAndFolder(e,1))},!0),o.folderInheritance=[],o.generateFolderInheritance=function(e){o.folderInheritance=[],o.findFolderInheritance(e)},o.findFolderInheritance=function(e){if(o.foldersData&&o.foldersData.hasOwnProperty(e)){var t=o.foldersData[e];o.folderInheritance.push(t),t&&t.parentId&&o.findFolderInheritance(t.parentId)}},o.hasFolderActiveChild=function(t){var n=!1;return angular.forEach(o.folderInheritance,function(e){e.id==t&&(n=!0)}),n},o.getFilesForPageAndFolder=function(n,i){return l(function(t,e){a.get(o.createUrl(n,i,o.sortField,o.searchQuery)).then(function(e){return r.setValue("filemanager.sortField",o.sortField),r.setValue("filemanager.pageId",parseInt(i)),o.filesResponseToVars(e),t(!0)})})},o.createUrl=function(e,t,n,i){return"admin/api-admin-storage/data-files?folderId="+e+"&page="+t+"&expand=createThumbnail,createThumbnailMedium,isImage,sizeReadable&sort="+n+"&search="+i},o.filesResponseToVars=function(e){o.filesData=e.data,o.pageCount=e.headers("X-Pagination-Page-Count"),o.currentPageId=parseInt(e.headers("X-Pagination-Current-Page")),o.totalFiles=e.headers("X-Pagination-Total-Count")},o.filesMetaToPagination=function(e){o.pageCount=e.totalPages},o.getFilesForCurrentPage=function(){return o.getFilesForPageAndFolder(o.currentFolderId,o.currentPageId)},o.currentFolderId=p.folderId,o.foldersDirectoryIdReload=function(){return p.load(!0)},o.folderCountMessage=function(e){return i18nParam("js_filemanager_count_files_overlay",{count:e.filesCount})},o.errorMsg=null,o.replaceFile=function(e,t){(o.replaceFiled=e)&&(d.start(),i.upload({url:"admin/api-admin-storage/file-replace",data:{file:e,fileId:o.fileDetail.id,pageId:o.currentPageId}}).then(function(e){d.stop(),200==e.status&&(o.getFilesForCurrentPage().then(function(){u.success(i18n.js_dir_manager_file_replace_ok)}),o.openFileDetail(o.fileDetail,!0))},function(){d.stop()}))},o.$watch("uploadingfiles",function(e){if(null!=e){o.uploadResults=0,d.start(i18n.js_dir_upload_wait);for(var t=0;t<e.length;t++)o.errorMsg=null,n=e[t],o.uploadUsingUpload(n)}var n}),o.$watch("uploadResults",function(e,t){null!=o.uploadingfiles&&e==o.uploadingfiles.length&&null==o.errorMsg&&o.getFilesForCurrentPage().then(function(){u.success(i18n.js_dir_manager_upload_image_ok),d.stop()})}),o.pasteUpload=function(e){for(var t=0;t<e.originalEvent.clipboardData.items.length;t++){var n=e.originalEvent.clipboardData.items[t];"file"==n.kind&&(d.start(i18n.js_dir_upload_wait),i.upload({url:"admin/api-admin-storage/files-upload",fields:{folderId:o.currentFolderId},file:n.getAsFile()}).then(function(e){e.data.upload?m.waitFor(e.data.queueIds).then(function(e){o.getFilesForCurrentPage().then(function(){u.success(i18n.js_dir_manager_upload_image_ok),o.foldersDataReload(),d.stop()})}):(u.error(e.data.message),d.stop())},function(e){u.error(e.data.message),d.stop()}))}},o.uploadUsingUpload=function(n){n.upload=i.upload({url:"admin/api-admin-storage/files-upload",fields:{folderId:o.currentFolderId},file:n}),n.upload.then(function(t){e(function(){m.waitFor(t.data.queueIds).then(function(e){o.uploadResults++,n.processed=!0,n.result=t.data,n.result.upload||(u.error(n.result.message),d.stop(),o.errorMsg=!0),o.foldersDataReload()})})},function(e){n=e.data,u.error(n.message),d.stop(),o.errorMsg=!0}),n.upload.progress(function(e){n.processed=!1,n.progress=Math.min(100,parseInt(100*e.loaded/e.total))})},o.selectedFiles=[],o.toggleSelectionAll=function(){o.filesData.forEach(function(e,t){o.toggleSelection(e)})},o.toggleSelection=function(e){if("true"!=o.allowSelection){var t=o.selectedFiles.indexOf(e.id);-1<t?o.selectedFiles.splice(t,1):o.selectedFiles.push(e.id)}else o.$parent.select(e.id)},o.inSelection=function(e){return-1!=o.selectedFiles.indexOf(e.id)},o.showFolderForm=!1,o.createNewFolder=function(e){e&&a.post("admin/api-admin-storage/folder-create",{folderName:e,parentFolderId:o.currentFolderId}).then(function(e){var t=e.data;o.foldersDataReload().then(function(e){o.folderFormToggler(),o.newFolderName=null,o.changeCurrentFolderId(t)})})},o.folderFormToggler=function(){o.showFolderForm=!o.showFolderForm},o.searchQuery="",o.searchPromise=null,o.searchLoading=!1,o.runSearch=function(){0<o.searchQuery.length?(o.searchLoading=!0,n.start(),e.cancel(o.searchPromise),o.searchPromise=e(function(){o.getFilesForCurrentPage().then(function(){o.searchLoading=!1,n.complete()})},1e3)):o.getFilesForCurrentPage().then(function(){o.searchLoading=!1})},o.sortField=r.getValue("filemanager.sortField","name_original"),o.changeSortField=function(e){o.sortField=e,o.getFilesForCurrentPage()},o.changeCurrentFolderId=function(e,t){o.searchQuery="";var n=o.currentFolderId;o.currentFolderId=e,o.currentPageId=1,o.selectedFiles=[],!0!==t&&n!=e&&(p.folderId=e,a.post("admin/api-admin-common/save-filemanager-folder-state",{folderId:e},{ignoreLoadingBar:!0}))},o.toggleFolderItem=function(e){null==e.toggle_open?e.toggle_open=1:e.toggle_open=!e.toggle_open,a.post("admin/api-admin-common/filemanager-foldertree-history",{data:e},{ignoreLoadingBar:!0})},o.folderUpdateForm=!1,o.folderDeleteForm=!1,o.folderDeleteConfirmForm=!1,o.updateFolder=function(e){a.post("admin/api-admin-storage/folder-update?folderId="+e.id,{name:e.name}).then(function(e){u.success(i18n.js_dir_manager_rename_success)})},o.isFolderMoveModalHidden=!0,o.currentEditFolder=null,o.cancelFolderEdit=function(e,t){e.name=t,o.isFolderMoveModalHidden=!0},o.moveFolderTo=function(t,e){a.post("admin/api-admin-storage/folder-update?folderId="+t.id,{parent_id:e}).then(function(e){u.success(i18nParam("js_ngrest_toggler_success",{field:t.name})),o.isFolderMoveModalHidden=!0,o.foldersDataReload()})},o.deleteFolder=function(i){a.post("admin/api-admin-storage/is-folder-empty?folderId="+i.id,{name:i.name}).then(function(e){var t=e.data.empty,n=e.data.count;t?a.post("admin/api-admin-storage/folder-delete?folderId="+i.id,{name:i.name}).then(function(e){o.foldersDataReload().then(function(){o.currentFolderId=0})}):u.confirm(i18nParam("layout_filemanager_remove_dir_not_empty",{folderName:i.name,count:n}),i18n.js_dir_manager_rm_folder_confirm_title,["$timeout","$toast",function(e,t){a.post("admin/api-admin-storage/folder-delete?folderId="+i.id,{name:i.name}).then(function(){o.foldersDataReload().then(function(){o.currentFolderId=0,t.close()})})}])})},o.removeFiles=function(){u.confirm(i18n.js_dir_manager_rm_file_confirm,i18n.js_dir_manager_rm_file_confirm_title,["$timeout","$toast",function(e,t){a.post("admin/api-admin-storage/filemanager-remove-files",{ids:o.selectedFiles,pageId:o.currentPageId,folderId:o.currentFolderId}).then(function(e){o.getFilesForCurrentPage().then(function(){t.close(),u.success(i18n.js_dir_manager_rm_file_ok),o.selectedFiles=[],o.closeFileDetail(),o.foldersDataReload()})})}])},o.moveFilesTo=function(e){a.post("admin/api-admin-storage/filemanager-move-files",{fileIds:o.selectedFiles,toFolderId:e,currentPageId:o.currentPageId,currentFolderId:o.currentFolderId}).then(function(e){o.getFilesForCurrentPage().then(function(){o.selectedFiles=[],o.showFoldersToMove=!1})})},o.getFolderData=function(e){return t("filemanagerdirsfilter")(o.foldersData,e)},o.getFilesForCurrentPage(),o.fileDetail=!1,o.showFoldersToMove=!1,o.largeImagePreviewState=!0,o.fileDetailFull=!1,o.nameEditMode=!1,o.fileDetailFolder=!1,o.detailLoading=!1,o.openFileDetail=function(e,t){o.fileDetail.id==e.id&&!0!==t?o.closeFileDetail():(n.start(),o.detailLoading=!0,c.getFile(e.id,t).then(function(e){o.fileDetailFull=e,o.fileDetailFolder=o.foldersData[e.folder_id],o.detailLoading=!1,n.complete()},function(){}),o.fileDetail=e)},o.saveTagRelation=function(e,t){a.post("admin/api-admin-storage/toggle-file-tag",{tagId:e.id,fileId:t.id}).then(function(e){o.fileDetailFull.tags=e.data})},o.fileHasTag=function(t){var n=!1;return angular.forEach(o.fileDetailFull.tags,function(e){e.id==t.id&&(n=!0)}),n},o.updateFileData=function(){a.put("admin/api-admin-storage/file-update?id="+o.fileDetailFull.id+"&pageId="+o.currentPageId,o.fileDetailFull).then(function(e){t("findidfilter")(o.filesData,o.fileDetail.id,!0).name=e.data.name_original,o.nameEditMode=!1})},o.closeFileDetail=function(){o.fileDetail=!1,o.fileDetailFull=!1,o.nameEditMode=!1},o.removeFile=function(e){o.selectedFiles=[],o.toggleSelection(e),o.removeFiles()},o.isFileEditHidden=!0,o.editFile=function(e){o.isFileEditHidden=!o.isFileEditHidden},o.cropSuccess=function(){o.isFileEditHidden=!0,o.getFilesForCurrentPage().then(function(){u.success(i18n.crop_success)}),o.openFileDetail(o.fileDetail,!0)},o.storeFileCaption=function(e){a.post("admin/api-admin-storage/filemanager-update-caption",{id:e.id,captionsText:e.captionArray,pageId:o.currentPageId}).then(function(e){u.success(i18n.file_caption_success)})},o.selectedFileFromParent=null,o.init=function(){o.$parent.fileinfo&&(o.selectedFileFromParent=o.$parent.fileinfo,o.changeCurrentFolderId(o.selectedFileFromParent.folder_id,!0))},o.init()}],templateUrl:"storageFileManager"}}),zaa.directive("hasEnoughSpace",["$window","$timeout",function(o,a){return{restrict:"A",scope:{loadingCondition:"=",isFlexBox:"="},link:function(n,i,e){n.elementWidth=0;function t(){a(function(){n.elementOriginalWidth||(n.elementOriginalWidth=function(){var e=i.clone().insertAfter(i);e.css({position:"fixed",top:0,left:0,visibility:"hidden"}),"none"===e.css("display")&&e.css("display",n.isFlexBox?"flex":"block");var t=e.outerWidth();return e.remove(),t}()),i.hasClass("not-enough-space")&&(i.removeClass("not-enough-space"),i.addClass("has-enough-space")),i.parent().outerWidth()<n.elementOriginalWidth?i.removeClass("has-enough-space").addClass("not-enough-space"):i.removeClass("not-enough-space").addClass("has-enough-space")})}angular.element(o).on("resize",function(){t()}),n.$watch("loadingCondition",function(e){1==e&&t()})}}}]),zaa.directive("activeClass",function(){return{restrict:"A",scope:{activeClass:"@"},link:function(e,t){t.on("mouseenter",function(){t.addClass(e.activeClass)}),t.on("mouseleave",function(){t.removeClass(e.activeClass)}),t.on("click",function(){t.toggleClass(e.activeClass)})}}}),zaa.directive("imageEdit",function(){return{restrict:"E",scope:{fileId:"=",onSuccess:"&"},controller:["$scope","$http","$timeout",function(t,e,n){t.file,t.cropperImage,t.cropperConfig={distUrl:"",areaType:"rectangle",ratio:null,resultImageSize:"max",resultImageFormat:"image/jpeg",resultImageQuality:1,areaInitSize:200,canvasScalemode:"full-width"},t.changeQuality=function(e){t.cropperConfig.resultImageQuality=e},t.isCurrentQuality=function(e){return t.cropperConfig.resultImageQuality==e},e.get("/admin/api-admin-storage/file-info?id="+t.fileId).then(function(e){t.file=e.data,t.cropperConfig.resultImageFormat=t.file.mime_type,t.cropperImage=t.file.file.href}),t.saveAsCopy=!0,t.isCurrentRatio=function(e){return t.cropperConfig.ratio==e},t.changeRatio=function(e){t.cropperImage=!1,t.cropperConfig.ratio=e,n(function(){t.cropperImage=t.file.source})},t.save=function(){e.post("/admin/api-admin-storage/file-crop",{distImage:t.cropperConfig.distUrl,fileName:t.file.name_new_compound,extension:t.file.extension,saveAsCopy:t.saveAsCopy,fileId:t.file.id}).then(function(e){t.onSuccess()})}}],template:'\n <div class="row">\n <div class="col-md-8">\n <p class="lead">'+i18n.crop_source_image+'</p>\n <div class="bg-light rounded pt-3 pl-3 pr-3 pb-2">\n <ui-cropper\n ng-if="cropperImage" \n image="cropperImage" \n result-image="cropperConfig.distUrl"\n result-image-format="{{cropperConfig.resultImageFormat}}"\n result-image-quality="cropperConfig.resultImageQuality"\n result-image-size="cropperConfig.resultImageSize"\n area-type="{{cropperConfig.areaType}}" \n area-init-size="cropperConfig.areaInitSize"\n chargement="\'Loading\'"\n canvas-scalemode="{{cropperConfig.canvasScalemode}}"\n aspect-ratio="cropperConfig.ratio"\n ></ui-cropper>\n </div>\n <ul class="list-group list-group-horizontal justify-content-center mt-3">\n <li class="list-group-item text-center" ng-class="{\'active\':isCurrentRatio(null)}" ng-click="changeRatio(null)"><i class="material-icons">crop_free</i><br /><small>'+i18n.crop_size_free+'</small></li>\n <li class="list-group-item text-center" ng-class="{\'active\':isCurrentRatio(\'1\')}" ng-click="changeRatio(\'1\')"><i class="material-icons">crop_square</i><br /><small>'+i18n.crop_size_1to1+'</small></li>\n <li class="list-group-item text-center" ng-class="{\'active\':isCurrentRatio(\'1.7\')}" ng-click="changeRatio(\'1.7\')"><i class="material-icons">crop_16_9</i><br /><small>'+i18n.crop_size_desktop+'</small></li>\n <li class="list-group-item text-center" ng-class="{\'active\':isCurrentRatio(\'0.5\')}" ng-click="changeRatio(\'0.5\')"><i class="material-icons">crop_portrait</i><br /><small>'+i18n.crop_size_mobile+'</small></li>\n </ul>\n </div>\n <div class="col-md-4" ng-show="cropperImage">\n <p class="lead">'+i18n.crop_preview+'</p>\n <img ng-src="{{cropperConfig.distUrl}}" ng-show="cropperConfig.distUrl" class="img-fluid border" />\n\n <ul class="list-group list-group-horizontal justify-content-center mt-3">\n <li class="list-group-item text-center" ng-class="{\'active\':isCurrentQuality(1.0)}" ng-click="changeQuality(1.0)"><i class="material-icons">looks_one</i><br /><small>'+i18n.crop_quality_high+'</small></li>\n <li class="list-group-item text-center" ng-class="{\'active\':isCurrentQuality(0.8)}" ng-click="changeQuality(0.8)"><i class="material-icons">looks_two</i><br /><small>'+i18n.crop_quality_medium+'</small></li>\n <li class="list-group-item text-center" ng-class="{\'active\':isCurrentQuality(0.5)}" ng-click="changeQuality(0.5)"><i class="material-icons">looks_3</i><br /><small>'+i18n.crop_quality_low+'</small></li>\n </ul>\n\n <div class="form-check mt-3 rounded border p-2" ng-click="saveAsCopy=!saveAsCopy" ng-class="{\'bg-light\':saveAsCopy}">\n <input class="form-check-input" type="checkbox" ng-model="saveAsCopy">\n <label class="form-check-label">\n '+i18n.crop_btn_as_copy+'\n </label>\n <small class="text-muted">'+i18n.crop_btn_as_copy_hint+'</small>\n </div>\n\n <button type="button" ng-show="saveAsCopy" class="mt-3 btn btn-lg btn-icon btn-save" ng-click="save()">'+i18n.crop_btn_save_copy+'</button>\n <button type="button" ng-show="!saveAsCopy" class="mt-3 btn btn-lg btn-icon btn-save" ng-click="save()">'+i18n.crop_btn_save_replace+"</button>\n </div>\n </div>\n "}}),zaa.directive("pagination",function(){return{restrict:"E",scope:{currentPage:"=",pageCount:"="},controller:["$scope","$timeout",function(t,e){t.pageNumberInputVal=t.currentPage,t.$watch("currentPage",function(e){t.pageNumberInputVal=e}),t.$watch("pageNumberInputVal",function(){t.inputWidth=25+10*(t.pageNumberInputVal.toString().length<=0?1:t.pageNumberInputVal.toString().length)});var n=null;t.pageNumberInputChange=function(){n&&e.cancel(n),n=e(function(){isNaN(t.pageNumberInputVal)?t.pageNumberInputVal=t.currentPage:parseInt(t.pageNumberInputVal)>parseInt(t.pageCount)||parseInt(t.pageNumberInputVal)<=0?t.pageNumberInputVal=t.currentPage:t.currentPage=t.pageNumberInputVal},500)},t.next=function(){t.currentPage<t.pageCount&&(t.currentPage+=1)},t.prev=function(){1<t.currentPage&&(t.currentPage-=1)},t.first=function(){t.currentPage=1},t.last=function(){t.currentPage=t.pageCount}}],template:'\n <div class="pagination" ng-show="pageCount > 1">\n <button class="pagination-btn pagination-btn-first btn btn-icon btn-first-page" ng-click="first()" ng-disabled="currentPage == 1"></button>\n <button class="pagination-btn pagination-btn-prev btn btn-icon btn-prev" ng-click="prev()" ng-disabled="currentPage == 1"></button>\n <div class="pagination-page">\n <input ng-style="{\'max-width\': inputWidth + \'px\'}" class="form-control pagination-input" type="text" ng-model="pageNumberInputVal" ng-change="pageNumberInputChange()" />\n <span class="pagination-delimiter">/</span>\n <span class="pagination-number-of-pages">{{pageCount}}</span>\n </div>\n <button class="pagination-btn pagination-btn-next btn btn-icon btn-next" ng-click="next()" ng-disabled="currentPage == pageCount"></button>\n <button class="pagination-btn pagination-btn-last btn btn-icon btn-last-page" ng-click="last()" ng-disabled="currentPage == pageCount"></button>\n </div>\n '}}),zaa.directive("selectArrayGently",function(){return{restrict:"E",scope:{model:"=",options:"=",optionsvalue:"@optionsvalue",optionslabel:"@optionslabel"},controller:["$rootScope","$scope",function(e,n){void 0===n.optionsvalue&&(n.optionsvalue="value"),void 0===n.optionslabel&&(n.optionslabel="label"),n.getSelectedLabel=function(){var t=n.model;return angular.forEach(n.options,function(e){n.model===e[n.optionsvalue]&&(t=e[n.optionslabel])}),t}}],template:function(){return"<span>{{getSelectedLabel()}}</span>"}}}),zaa.directive("zaaInjector",["$compile",function(i){return{restrict:"E",replace:!0,transclude:!1,scope:{dir:"=",model:"=",options:"=",label:"@",grid:"@",fieldid:"@",placeholder:"@",initvalue:"@",autocomplete:"@",optionsvalue:"@",optionslabel:"@"},link:function(e,t){var n=i(angular.element("<"+e.dir+' options="options" initvalue="{{initvalue}}" fieldid="{{fieldid}}" placeholder="{{placeholder}}" autocomplete="{{autocomplete}}" model="model" label="{{label}}" i18n="{{grid}}" optionsvalue="{{optionsvalue}}" optionslabel="{{optionslabel}}"/>'))(e);t.replaceWith(n)}}}]),zaa.directive("zaaSortRelationArray",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid"},controller:["$scope","$filter",function(e,t){void 0===e.model&&(e.model=[])}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-sort-relation-array ng-model="model" options="options.sourceData"></luya-sort-relation-array></div></div>'}}}),zaa.directive("luyaSortRelationArray",function(){return{restrict:"E",scope:{model:"=ngModel",options:"="},controller:["$scope","$filter",function(o,e){o.searchString,o.sourceData=[],o.dropdownOpen=!1,o.$watch(function(){return o.model},function(e,t){void 0===e&&(o.model=[])}),o.$watch(function(){return o.options},function(e,t){null!=e&&(o.sourceData=e)}),o.getSourceOptions=function(){return o.sourceData},o.getModelItems=function(){return o.model},o.addToModel=function(n){var i=!1;angular.forEach(o.model,function(e,t){e.value==n.value&&(i=!0)}),i||o.model.push({value:n.value,label:n.label})},o.removeFromModel=function(e){o.model.splice(e,1)},o.moveUp=function(e){e=parseInt(e);var t=o.model[e];o.model[e]=o.model[e-1],o.model[e-1]=t},o.moveDown=function(e){e=parseInt(e);var t=o.model[e];o.model[e]=o.model[e+1],o.model[e+1]=t},o.elementInModel=function(n){var i=!1;return angular.forEach(o.model,function(e,t){e.value==n.value&&(i=!0)}),!i}}],template:function(){return'<div class="list"><div class="list-item" ng-repeat="(key, item) in getModelItems() track by key"><div class="list-buttons"><i ng-show="!$first" ng-click="moveUp(key)" class="material-icons" style="transform: rotate(270deg);">play_arrow</i><i ng-show="!$last" ng-click="moveDown(key)" class="material-icons" style="transform: rotate(90deg);">play_arrow</i></div><span>{{item.label}}</span><div class="float-right"><i ng-click="removeFromModel(key)" class="material-icons">delete</i></div></div><div class="list-item" ng-show="sourceData.length != model.length"><input class="form-control" type="search" ng-model="searchString" ng-focus="dropdownOpen = true" /><ul class="list-group"><li class="list-group-item list-group-item-action" ng-repeat="option in getSourceOptions() | filter:searchString" ng-show="dropdownOpen && elementInModel(option)" ng-click="addToModel(option)"><i class="material-icons">add_circle</i><span>{{ option.label }}</span></li></ul><div class="list-chevron"><i ng-click="dropdownOpen=!dropdownOpen" class="material-icons" ng-show="dropdownOpen">arrow_drop_up</i><i ng-click="dropdownOpen=!dropdownOpen" class="material-icons" ng-show="!dropdownOpen">arrow_drop_down</i></div></div></div>'}}}),zaa.directive("zaaTagArray",function(){return{restrict:"E",scope:{model:"=",label:"@",i18n:"@",id:"@fieldid"},controller:["$scope","$http",function(n,e){n.tags=[],e.get("admin/api-admin-common/tags").then(function(e){angular.forEach(e.data,function(e){e.id=parseInt(e.id),n.tags.push(e)})}),void 0===n.model?n.model=[]:angular.forEach(n.model,function(e,t){n.model[t]=parseInt(e)}),n.isInSelection=function(e){return e=parseInt(e),-1!==n.model.indexOf(e)},n.toggleSelection=function(e){var t=n.model.indexOf(e);-1<t?n.model.splice(t,1):n.model.push(e)}}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><span ng-click="toggleSelection(tag.id)" ng-repeat="tag in tags" ng-class="{\'badge-primary\' : isInSelection(tag.id), \'badge-secondary\' : !isInSelection(tag.id)}" class="badge badge-pill mx-1 mb-2">{{tag.name}}</span></div></div>'}}}),zaa.directive("zaaLink",["$filter",function(t){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid"},controller:["$scope",function(n){n.unset=function(){n.model=!1,n.data.model=null},n.data={modalState:1,model:null},n.$watch("model",function(e,t){e&&(n.data.model=e)},!0),n.$watch("data.model",function(e,t){e&&(n.model=e)},!0),n.isEmpty=function(e){return!e||t("isEmpty")(e)}}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><div ng-if="!isEmpty(data.model)"><div class="link-selector"><div class="link-selector-actions"><div class="link-selector-btn btn btn-secondary" ng-click="data.modalState=0"><i class="material-icons left">insert_link</i><span>'+i18n.js_link_change_value+'</span></div><span ng-hide="model | isEmpty" class="link-selector-reset" ng-click="unset()"><i class="material-icons">remove_circle</i></span></div><link-object-to-string class="ml-2" link="model"></link-object-to-string></div></div><div ng-if="isEmpty(data.model)"><div class="link-selector"><div class="link-selector-actions"><div class="link-selector__btn btn btn-secondary" ng-click="data.modalState=0"><i class="material-icons left">insert_link</i><span>'+i18n.js_link_set_value+'</span></div><span style="margin-left:10px;">'+i18n.js_link_not_set+'</span></div></div></div><modal is-modal-hidden="data.modalState" modal-title="{{label}}"><form ng-submit="data.modalState=1"><zaa-link-options data="data.model" uid="id" ng-if="!data.modalState"></zaa-link-options><button ng-click="data.modalState=1" class="btn btn-icon btn-save" type="submit">'+i18n.js_link_set_value+"</button></form></modal></div></div>"}}}]),zaa.directive("zaaLinkOptions",function(){return{restrict:"EA",scope:{data:"=",uid:"="},templateUrl:"linkoptions.html",controller:["$scope",function(n){n.$watch(function(){return n.data},function(e,t){angular.isArray(e)&&(n.data={})})}]}}),zaa.directive("zaaSlug",function(){return{restrict:"E",scope:{model:"=",options:"=",listener:"=",label:"@",i18n:"@",id:"@fieldid",placeholder:"@"},template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-slug fieldid="{{id}}" provider="listener" ng-model="model" placeholder="{{placeholder}}"></luya-slug></div></div>'}}}),zaa.directive("luyaSlug",function(){return{restrict:"E",scope:{model:"=ngModel",provider:"=",id:"@fieldid",placeholder:"@"},controller:["$scope","$filter",function(n,i){n.$watch("provider",function(e,t){void 0!==e&&(n.model=i("slugify")(e))}),n.$watch("model",function(e,t){e!==t&&(n.model=i("slugify")(e))})}],template:function(){return'<input id="{{id}}" insert-paste-listener ng-model="model" type="text" class="form-control" placeholder="{{placeholder}}" />'}}}),zaa.directive("zaaColor",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid",initvalue:"@"},controller:["$scope",function(n){function i(){if(void 0===n.model||!n.model)return n.initvalue?n.initvalue:"#000";var e=n.model;if("string"==typeof n.model&&(e=e.substr(1)),3===e.length){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,n,i){return t+t+n+n+i+i})}return 6!==e.length?"#000":128<=(299*parseInt(e.substr(0,2),16)+587*parseInt(e.substr(2,2),16)+114*parseInt(e.substr(4,2),16))/1e3?"#000":"#fff"}void 0!==n.model&&n.model||(n.initvalue?n.model=n.initvalue:n.model="#000000"),n.textColor=i(),n.$watch(function(){return n.model},function(e,t){n.textColor=i()})}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><div class="colorwheel"><div class="colorwheel-background" style="background-color: {{model}};"><input class="colorwheel-input" type="text" ng-model="model" style="color: {{textColor}}; border-color: {{textColor}};" maxlength="7" /></div><div class="colorwheel-wheel"><div ng-colorwheel="{ size: 150, segments: 120 }" ng-model="model"></div></div></div></div>'}}}),zaa.directive("zaaWysiwyg",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid",placeholder:"@"},template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><ng-wig ng-disabled="false" ng-model="model" buttons="bold, italic, link, list1, list2" source-mode-allowed placeholder="{{placeholder}}"></ng-wig></div></div>'}}}),zaa.directive("stringToInteger",function(){return{require:"ngModel",link:function(e,t,n,i){i.$formatters.push(function(e){return parseInt(e)})}}}),zaa.directive("stringToFloat",function(){return{require:"ngModel",link:function(e,t,n,i){i.$formatters.push(function(e){return parseFloat(e)})}}}),zaa.directive("zaaNumber",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid",placeholder:"@",initvalue:"@",min:"@"},template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-number ng-model="model" fieldid="{{id}}" min="{{min}}" placeholder="{{placeholder}}" initvalue="{{initvalue}}"></luya-number></div></div>'}}}),zaa.directive("luyaNumber",function(){return{restrict:"E",scope:{model:"=ngModel",id:"@fieldid",placeholder:"@",initvalue:"@",min:"@",max:"@"},link:function(n){n.$watch(function(){return n.model},function(e,t){void 0===e&&(n.model=parseInt(n.initvalue)),n.model==parseInt(e)&&(n.model=parseInt(e)),n.isValid=!!angular.isNumber(n.model)})},template:function(){return'<input string-to-integer id="{{id}}" ng-model="model" type="number" min="{{min}}" max="{{max}}" class="form-control" ng-class="{\'invalid\' : !isValid }" placeholder="{{placeholder}}" />'}}}),zaa.directive("zaaDecimal",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid",placeholder:"@"},controller:["$scope",function(e){void 0===e.options||null===e.options?e.steps=.01:e.steps=e.options.steps}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-decimal ng-model="model" fieldid="{{id}}" min="0" placeholder="{{placeholder}}" step="{{steps}}"></luya-decimal></div></div>'}}}),zaa.directive("luyaDecimal",function(){return{restrict:"E",scope:{model:"=ngModel",id:"@fieldid",placeholder:"@",step:"@",min:"@",max:"@"},controller:["$scope",function(e){void 0!==e.step&&null!==e.step||(e.step=.01)}],link:function(n){n.$watch(function(){return n.model},function(e,t){n.model==parseFloat(e)&&(n.model=parseFloat(e)),n.isValid=!!angular.isNumber(n.model)})},template:function(){return'<input string-to-float id="{{id}}" ng-model="model" type="number" min="{{min}}" max="{{max}}" step="{{step}}" class="form-control" ng-class="{\'invalid\' : !isValid }" placeholder="{{placeholder}}" />'}}}),zaa.directive("zaaText",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid",placeholder:"@",autocomplete:"@"},template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-text ng-model="model" fieldid="{{id}}" autocomplete="{{autocomplete}}" placeholder="{{placeholder}}"></luya-text></div></div>'}}}),zaa.directive("luyaText",function(){return{restrict:"E",scope:{model:"=ngModel",id:"@fieldid",autocomplete:"@",placeholder:"@"},template:function(){return'<input id="{{id}}" insert-paste-listener ng-model="model" type="text" class="form-control" autocomplete="{{autocomplete}}" placeholder="{{placeholder}}" />'}}}),zaa.directive("zaaReadonly",function(){return{restrict:"E",scope:{model:"=",label:"@",i18n:"@",id:"@fieldid"},template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-readonly ng-model="model" fieldid="{{id}}"></luya-readonly></div></div>'}}}),zaa.directive("luyaReadonly",function(){return{restrict:"E",scope:{model:"=ngModel",id:"@fieldid"},template:function(){return'<span id="{{id}}" class="text-muted form-control-plaintext">{{model}}</span>'}}}),zaa.directive("zaaAsyncValue",function(){return{restrict:"E",scope:{model:"=",api:"@",fields:"=",label:"@",i18n:"@",id:"@fieldid"},controller:["$scope","$timeout","$http",function(e,t,n){e.resetValue=function(){e.model=0,e.value=null}}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-async-value ng-model="model" api="{{api}}" fields="fields" fieldid="{{id}}" ng-show="model"></luya-async-value><button type="button" class="btn btn-icon btn-cancel" ng-click="resetValue()" ng-show="model"></button></div></div>'}}}),zaa.directive("luyaAsyncValue",function(){return{restrict:"E",scope:{model:"=ngModel",api:"@",fields:"=",id:"@fieldid"},controller:["$scope","$timeout","$http",function(n,e,i){e(function(){n.$watch("model",function(e,t){e&&(n.value="",i.get(n.api+"/"+e+"?fields="+n.fields.join()).then(function(e){angular.forEach(e.data,function(e){e&&(n.value=n.value+e+" ")})}))})})}],template:function(){return'<span id="{{id}}" ng-bind="value"></span>'}}}),zaa.directive("asyncValue",function(){return{restrict:"E",scope:{model:"=",fields:"=",api:"@"},controller:["$scope","$timeout","$http",function(n,e,i){e(function(){n.$watch("model",function(e,t){e&&(n.value="",i.get(n.api+"/"+e+"?fields="+n.fields.join()).then(function(e){n.value,angular.forEach(e.data,function(e){e&&(n.value=n.value+e+" ")})}))})})}],template:function(){return'<span ng-bind="value"></span>'}}}),zaa.directive("zaaTextarea",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid",placeholder:"@"},template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-textarea ng-model="model" fieldid="{{id}}" placeholder="{{placeholder}}"></luya-textarea></div></div>'}}}),zaa.directive("luyaTextarea",function(){return{restrict:"E",scope:{model:"=ngModel",id:"@fieldid",placeholder:"@"},template:function(){return'<textarea id="{{id}}" insert-paste-listener ng-model="model" type="text" class="form-control" auto-grow placeholder="{{placeholder}}"></textarea>'}}}),zaa.directive("zaaPassword",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid",autocomplete:"@",inputmode:"@"},template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-password ng-model="model" fieldid="{{id}}" autocomplete="{{autocomplete}}" inputmode="{{inputmode}}"></luya-password></div></div>'}}}),zaa.directive("luyaPassword",function(){return{restrict:"E",scope:{model:"=ngModel",id:"@fieldid",autocomplete:"@",inputmode:"@"},controller:["$scope","$timeout",function(e,t){void 0!==e.autocomplete&&""!==e.autocomplete||(e.autocomplete="on"),void 0!==e.inputmode&&""!==e.inputmode||(e.inputmode="verbatim")}],template:function(){return'<input id="{{id}}" ng-model="model" type="password" class="form-control" autocomplete="{{autocomplete}}" inputmode="{{inputmode}}" />'}}}),zaa.directive("zaaRadio",function(){return{restrict:"E",scope:{model:"=",options:"=",optionsvalue:"@",optionslabel:"@",label:"@",i18n:"@",id:"@fieldid",initvalue:"@",inline:"@"},controller:["$scope","$timeout",function(e,t){t(function(){void 0!==e.optionsvalue&&""!==e.optionsvalue||(e.optionsvalue="value"),void 0!==e.optionslabel&&""!==e.optionslabel||(e.optionslabel="label")})}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-radio ng-model="model" options="options" fieldid="{{id}}" initvalue="{{initvalue}}" optionsvalue="{{optionsvalue}}" optionslabel="{{optionslabel}}" ng-attr-inline="{{inline}}"></luya-radio></div></div>'}}}),zaa.directive("luyaRadio",function(){return{restrict:"E",scope:{model:"=ngModel",options:"=",optionsvalue:"@",optionslabel:"@",id:"@fieldid",initvalue:"@",inline:"@"},controller:["$scope","$timeout",function(t,e){t.setModelValue=function(e){t.model=e},t.init=function(){void 0!==t.model&&null!==t.model||(t.model=typeCastValue(t.initvalue)),void 0!==t.id&&null!==t.id&&""!==t.id||(t.id=Math.random().toString(36).substring(7))},e(function(){void 0!==t.optionsvalue&&""!==t.optionsvalue||(t.optionsvalue="value"),void 0!==t.optionslabel&&""!==t.optionslabel||(t.optionslabel="label"),t.init()})}],template:function(){return'<div ng-repeat="(key, item) in options" class="form-check" ng-class="{\'form-check-inline\': inline}"><input value="{{item[optionsvalue]}}" type="radio" ng-click="setModelValue(item[optionsvalue])" ng-checked="item[optionsvalue] == model" name="{{id}}" class="form-check-input" id="{{id}}_{{key}}"><label class="form-check-label" for="{{id}}_{{key}}">{{item[optionslabel]}}</label></div>'}}}),zaa.directive("zaaSelect",function(){return{restrict:"E",scope:{model:"=",options:"=",optionsvalue:"@",optionslabel:"@",label:"@",i18n:"@",id:"@fieldid",initvalue:"@",clearable:"@",placeholder:"@"},controller:["$scope","$timeout","$rootScope",function(e,t,n){t(function(){void 0===e.optionsvalue&&(e.optionsvalue="value"),void 0===e.optionslabel&&(e.optionslabel="label"),e.clearable=!("false"===e.clearable||"0"===e.clearable)})}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-select ng-model="model" options="options" fieldid="{{id}}" clearable="{{clearable}}" placeholder="{{placeholder}}" optionsvalue="{{optionsvalue}}" optionslabel="{{optionslabel}}" initvalue="{{initvalue}}"></luya-select></div></div>'}}}),zaa.directive("luyaSelect",function(){return{restrict:"E",scope:{model:"=ngModel",options:"=",optionsvalue:"@",optionslabel:"@",id:"@fieldid",initvalue:"@",placeholder:"@",clearable:"@",ngChange:"&"},controller:["$scope","$timeout","$rootScope",function(i,t,e){i.isOpen=0,i.isDefault=1,angular.isNumber(i.model)&&(i.model=typeCastValue(i.model)),i.$on("closeAllSelects",function(){i.isOpen&&i.closeSelect()}),t(function(){i.$watch(function(){return i.model},function(e,t){null!=e&&""!==e||(angular.isNumber(i.initvalue)&&(i.initvalue=typeCastValue(i.initvalue)),i.valueExistsInOptions(e)||(i.model=i.initvalue))}),void 0!==i.optionsvalue&&""!==i.optionsvalue||(i.optionsvalue="value"),void 0!==i.optionslabel&&""!==i.optionslabel||(i.optionslabel="label"),i.clearable=!("false"===i.clearable||"0"===i.clearable)}),i.valueExistsInOptions=function(t){var n=!1;return angular.forEach(i.options,function(e){t==e[i.optionsvalue]&&(n=!0)}),n},i.toggleIsOpen=function(){i.isOpen||e.$broadcast("closeAllSelects"),i.isOpen=!i.isOpen},i.closeSelect=function(){i.isOpen=0},i.setModelValue=function(e){i.model=angular.isObject(e)?e[i.optionsvalue]:e,t(i.ngChange,0),i.closeSelect()},i.getSelectedLabel=function(){i.isDefault=1;var t=i18n.ngrest_select_no_selection;return i.placeholder&&(t=i.placeholder),angular.forEach(i.options,function(e){i.model==e[i.optionsvalue]&&(t=e[i.optionslabel],i.isDefault=0)}),t},i.hasSelectedValue=function(){var e=i.model;return i.valueExistsInOptions(e)&&e!==i.initvalue}}],template:function(){return'<div class="zaaselect" ng-class="{\'open\':isOpen, \'selected\':hasSelectedValue()}"><select class="zaaselect-select" ng-model="model" id="{{id}}"><option ng-repeat="opt in options" ng-value="opt[optionsvalue]">{{opt[optionslabel]}}</option></select><div class="zaaselect-selected"><span class="zaaselect-selected-text" ng-class="{\'text-muted\':(placeholder && isDefault)}" ng-click="toggleIsOpen()">{{getSelectedLabel()}}</span><i class="material-icons zaaselect-clear-icon" ng-show="clearable" ng-click="setModelValue(initvalue)">clear</i><i class="material-icons zaaselect-dropdown-icon" ng-click="toggleIsOpen()">keyboard_arrow_down</i></div><div class="zaaselect-dropdown"><div class="zaaselect-search"><input class="zaaselect-search-input" type="search" focus-me="isOpen" ng-model="searchQuery" /></div><div class="zaaselect-overflow" ng-if="isOpen"><div class="zaaselect-item" ng-repeat="opt in options | filter:searchQuery"><span class="zaaselect-label" ng-class="{\'zaaselect-label-active\': opt[optionsvalue] == model}" ng-click="opt[optionsvalue] == model ? false : setModelValue(opt)">{{opt[optionslabel]}}</span></div></div></div></div>'}}}),zaa.directive("zaaAsyncApiSelect",function(){return{restrict:"E",scope:{model:"=",api:"@",optionsvalue:"@",optionslabel:"@",label:"@",i18n:"@",id:"@fieldid",initvalue:"@",placeholder:"@"},controller:["$scope","$http","$timeout",function(n,t,e){n.options=[],e(function(){void 0===n.optionsvalue&&(n.optionsvalue="id"),void 0===n.optionslabel&&(n.optionslabel="title")}),n.$watch("api",function(e){t.get(e).then(function(e){var t=[];angular.forEach(e.data,function(e){t.push({label:e[n.optionslabel],value:e[n.optionsvalue]})}),n.options=t})})}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-select ng-model="model" options="options" id="{{id}}" placeholder="{{placeholder}}" initvalue="{{initvalue}}"></luya-select></div></div>'}}}),zaa.directive("zaaSelectCrud",function(){return{restrict:"E",scope:{model:"=",options:"=",api:"@api",label:"@",i18n:"@",id:"@fieldid",initvalue:"@"},template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-async-value ng-model="model" api="{{options.api}}" fields="options.fields"></luya-async-value><crud-loader api="{{options.route}}" model-setter="model" model-selection="1" alias="{{label}}"></crud-loader></div></div>'}}}),zaa.directive("zaaCheckbox",function(){return{restrict:"E",scope:{model:"=",options:"=",i18n:"@",id:"@fieldid",initvalue:"@",label:"@",checkboxlabel:"@",ngChange:"&"},controller:["$scope",function(e){null===e.options||void 0===e.options?(e.valueTrue=1,e.valueFalse=0):(e.valueTrue=e.options["true-value"],e.valueFalse=e.options["false-value"])}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><luya-checkbox ng-model="model" fieldid="{{id}}" truevalue="{{valueTrue}}" falsevalue="{{valueFalse}}" initvalue="{{initvalue}}" label="{{checkboxlabel}}" ng-change="ng-change"></luya-checkbox></div></div>'}}}),zaa.directive("luyaCheckbox",function(){return{restrict:"E",scope:{model:"=ngModel",label:"@",truevalue:"@",falsevalue:"@",id:"@fieldid",initvalue:"@",ngChange:"&"},controller:["$scope","$timeout",function(e,t){e.init=function(){void 0!==e.truevalue&&""!==e.truevalue||(e.truevalue=1),void 0!==e.falsevalue&&""!==e.falsevalue||(e.falsevalue=0),void 0!==e.initvalue&&""!==e.initvalue||(e.initvalue=e.falsevalue),void 0!==e.model&&null!==e.model||(e.model=e.initvalue),void 0!==e.id&&null!==e.id&&""!==e.id||(e.id=Math.random().toString(36).substring(7))},t(function(){e.init()}),e.clicker=function(){e.model==e.truevalue?e.model=e.falsevalue:e.model=e.truevalue,t(e.ngChange,0)}}],template:function(){return'<div class="form-check"><input id="{{id}}" type="checkbox" class="form-check-input-standalone" ng-click="clicker()" ng-checked="model == truevalue"/><label for="{{id}}">{{label}}</label></div>'}}}),zaa.directive("zaaCheckboxArray",function(){return{restrict:"E",scope:{model:"=",options:"=",i18n:"@",id:"@fieldid",label:"@",preselect:"@",inline:"@"},controller:["$scope","$filter",function(l,e){void 0===l.model&&(l.model=[]),l.toggleAll=function(){if(0<l.model.length)l.model=[];else{var e=!0,t=!1,n=void 0;try{for(var i,o=l.options.items[Symbol.iterator]();!(e=(i=o.next()).done);e=!0){var a=i.value;l.model.push({value:a.value})}}catch(e){t=!0,n=e}finally{try{e||null==o.return||o.return()}finally{if(t)throw n}}}}}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label for="{{id}}">{{label}}</label></div><div class="form-side"><button ng-click="toggleAll()" type="button" class="zaa-checkbox-array-toggle-all btn btn-info btn-icon"><i class="material-icons">done_all</i></button><luya-checkbox-array ng-model="model" options="options.items" preselectall="{{preselect}}" ng-attr-inline="{{inline}}"></luya-checkbox-array></div></div>'}}}),zaa.directive("luyaCheckboxArray",function(){return{restrict:"E",scope:{model:"=ngModel",options:"=",preselectall:"@",inline:"@"},controller:["$scope","$filter",function(n,i){void 0===n.model&&(n.model=[]),n.preselectOptionValuesToModel=function(e){angular.forEach(e,function(e){n.model.push({value:e.value})})},n.searchString="",n.$watch("options",function(e,t){void 0!==e&&(n.items=i("orderBy")(e,"label"),n.preselectall&&n.preselectOptionValuesToModel(e))}),n.filtering=function(){n.items=i("filter")(n.options,n.searchString)},n.toggleSelection=function(e){for(var t in void 0===n.model&&(n.model=[]),n.model)if(n.model[t].value==e.value)return void n.model.splice(t,1);n.model.push({value:e.value})},n.isChecked=function(e){for(var t in n.model)if(n.model[t].value==e.value)return!0;return!1}}],link:function(e){e.random=Math.random().toString(36).substring(7)},template:function(){return'<div class="position-relative mb-3"><div class="input-group"><div class="input-group-prepend"><div class="input-group-text"><i class="material-icons">search</i></div></div><input class="form-control" type="text" ng-change="filtering()" ng-model="searchString" placeholder="'+i18n.ngrest_crud_search_text+'"></div><span class="zaa-checkbox-array-counter badge badge-secondary">{{items.length}} '+i18n.js_dir_till+' {{options.length}}</span></div><div ng-repeat="(k, item) in items track by k" class="form-check" ng-class="{\'form-check-inline\': inline}"><input type="checkbox" class="form-check-input" ng-checked="isChecked(item)" id="{{random}}_{{k}}" ng-click="toggleSelection(item)" /><label for="{{random}}_{{k}}">{{item.label}}</label></div>'}}}),zaa.directive("zaaDatetime",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",id:"@fieldid",i18n:"@",resetable:"@resetable"},controller:["$scope","$filter",function(i,o){i.isNumeric=function(e){return!isNaN(e)},i.$watch(function(){return i.model},function(e,t){if(null!=e){var n=new Date(1e3*e);i.pickerPreselect=n,i.date=o("date")(n,"dd.MM.yyyy"),i.hour=o("date")(n,"HH"),i.min=o("date")(n,"mm")}else i.date=null,i.model=null}),i.refactor=function(e){if(i.isNumeric(i.hour)&&""!==i.hour||(i.hour="0"),i.isNumeric(i.min)&&""!==i.min||(i.min="0"),"Invalid Date"===e||""===e||"NaN"===e)i.date=null,i.model=null;else{var t=e.split(".");if(3===t.length&&4===t[2].length){23<parseInt(i.hour)&&(i.hour=23),59<parseInt(i.min)&&(i.min=59);var n=t[1]+"/"+t[0]+"/"+t[2]+" "+i.hour+":"+i.min;i.model=Date.parse(n)/1e3,i.datePickerToggler=!1}}},i.$watch(function(){return i.date},function(e,t){e!==t&&null!=e&&i.refactor(e)}),i.autoRefactor=function(){i.refactor(i.date)},i.datePickerToggler=!1,i.toggleDatePicker=function(){i.datePickerToggler=!i.datePickerToggler},i.openDatePicker=function(){i.datePickerToggler=!0},i.closeDatePicker=function(){i.datePickerToggler=!1},i.hour="0",i.min="0",i.reset=function(){i.model=null},i.getIsResetable=function(){return!i.resetable||parseInt(i.resetable)}}],template:function(){return'<div class="form-group form-side-by-side zaa-datetime" ng-class="{\'input--hide-label\': i18n, \'input--with-time\': model!=null && date!=null}"><div class="form-side form-side-label"><label>{{label}}</label></div><div class="form-side form-inline datepicker-wrapper"><datepicker class="input-group input-group--append-clickable" date-set="{{pickerPreselect.toString()}}" date-week-start-day="1" datepicker-toggle="false" datepicker-show="{{datePickerToggler}}" date-format="dd.MM.yyyy"><input class="form-control datepicker-date-input" ng-model="date" type="text" ng-focus="openDatePicker()" /><div class="input-group-append" ng-click="toggleDatePicker()"><div class="input-group-text"><i class="material-icons" ng-hide="datePickerToggler">date_range</i><i class="material-icons" ng-show="datePickerToggler">close</i></div></div></datepicker><div ng-show="model!=null && date!=null" class="hour-selection"><div class="input-group"><input class="form-control zaa-datetime-hour-input" type="text" ng-model="hour" ng-change="autoRefactor()" /></div><div class="input-group"><div class="input-group-prepend zaa-datetime-time-colon"><div class="input-group-text">:</div></div><input class="form-control form-control--force-border zaa-datetime-minute-input" type="text" ng-model="min" ng-change="autoRefactor()" /></div></div><div ng-show="model && getIsResetable()"><button type="button" ng-click="reset()" class="ml-2 btn btn-icon btn-cancel"></button></div></div></div>'}}}),zaa.directive("zaaDate",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",id:"@fieldid",i18n:"@",resetable:"@resetable"},controller:["$scope","$filter",function(i,o){i.$watch(function(){return i.model},function(e,t){if(null!=e){var n=new Date(1e3*e);i.pickerPreselect=n,i.date=o("date")(n,"dd.MM.yyyy")}else i.date=null,i.model=null}),i.refactor=function(e){if("Invalid Date"===e||""===e)i.date=null,i.model=null;else{var t=e.split(".");if(3===t.length&&4===t[2].length){var n=t[1]+"/"+t[0]+"/"+t[2];i.model=Date.parse(n)/1e3,i.datePickerToggler=!1}}},i.$watch(function(){return i.date},function(e,t){e!==t&&null!=e&&i.refactor(e)}),i.autoRefactor=function(){i.refactor(i.date)},i.datePickerToggler=!1,i.toggleDatePicker=function(){i.datePickerToggler=!i.datePickerToggler},i.openDatePicker=function(){i.datePickerToggler=!0},i.closeDatePicker=function(){i.datePickerToggler=!1},i.reset=function(){i.model=null},i.getIsResetable=function(){return!i.resetable||parseInt(i.resetable)}}],template:function(){return'<div class="form-group form-side-by-side zaa-date" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label>{{label}}</label></div><div class="form-side form-inline datepicker-wrapper"><datepicker class="input-group input-group--append-clickable" date-set="{{pickerPreselect.toString()}}" date-week-start-day="1" datepicker-toggle="false" datepicker-show="{{datePickerToggler}}" date-format="dd.MM.yyyy"><input class="form-control datepicker-date-input" ng-model="date" type="text" ng-focus="openDatePicker()" /><div class="input-group-append" ng-click="toggleDatePicker()"><div class="input-group-text"><i class="material-icons" ng-hide="datePickerToggler">date_range</i><i class="material-icons" ng-show="datePickerToggler">close</i></div></div></datepicker><div ng-show="model && getIsResetable()"><button type="button" ng-click="reset()" class="ml-2 btn btn-icon btn-cancel"></button></div></div></div>'}}}),zaa.directive("zaaTable",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid"},controller:["$scope",function(i){void 0===i.model&&(i.model=[{0:""}]),i.addColumn=function(){var e=0;for(var t in i.model[0])e++;for(var n in i.model)i.model[n][e]=""},i.addRow=function(){var e=i.model[0],t={};for(var n in e)t[n]="";i.model.push(t)},i.removeColumn=function(e){for(var t in i.model){var n=i.model[t];n instanceof Array?n.splice(e,1):delete n[e]}},i.moveLeft=function(e){for(var t in e=parseInt(e),i.model){var n=i.model[t][e];i.model[t][e]=i.model[t][e-1],i.model[t][e-1]=n}},i.moveRight=function(e){for(var t in e=parseInt(e),i.model){var n=i.model[t][e];i.model[t][e]=i.model[t][e+1],i.model[t][e+1]=n}},i.moveUp=function(e){e=parseInt(e);var t=i.model[e];i.model[e]=i.model[e-1],i.model[e-1]=t},i.moveDown=function(e){e=parseInt(e);var t=i.model[e];i.model[e]=i.model[e+1],i.model[e+1]=t},i.removeRow=function(e){i.model.splice(e,1)},i.showRightButton=function(e){return parseInt(e)<Object.keys(i.model[0]).length-1},i.showDownButton=function(e){return parseInt(e)<Object.keys(i.model).length-1}}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label ng-if="label">{{label}}</label><label ng-if="!label">Table</label></div><div class="form-side"><div class="zaa-table-wrapper"><table class="zaa-table table table-bordered"><tbody><tr><th scope="col" width="35px"></th><th scope="col" data-ng-repeat="(hk, hr) in model[0] track by hk" class="zaa-table-buttons"><div class="btn-group" role="group"><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveLeft(hk)" ng-if="hk > 0"><i class="material-icons">keyboard_arrow_left</i></button><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveRight(hk)" ng-if="showRightButton(hk)"><i class="material-icons">keyboard_arrow_right</i></button><button type="button" class="btn btn-sm btn-outline-danger" ng-click="removeColumn(hk)"><i class="material-icons">remove</i></button></div></th></tr><tr data-ng-repeat="(key, row) in model track by key"><td width="35px" scope="row" class="zaa-table-buttons"><div class="btn-group-vertical" role="group"><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveUp(key)" ng-if="key > 0"><i class="material-icons">keyboard_arrow_up</i></button><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveDown(key)" ng-if="showDownButton(key)"><i class="material-icons">keyboard_arrow_down</i></button><button type="button" class="btn btn-sm btn-outline-danger" ng-click="removeRow(key)"><i class="material-icons">remove</i></button></div></td><td data-ng-repeat="(field,value) in row track by field"><textarea ng-model="model[key][field]" class="zaa-table__textarea"></textarea></td></tr></tbody></table><button ng-click="addRow()" type="button" class="zaa-table-add-row btn btn-sm btn-success"><i class="material-icons">add</i></button><button ng-click="addColumn()" type="button" class="zaa-table-add-column btn btn-sm btn-success"><i class="material-icons">add</i></button></div></div></div>'}}}),zaa.directive("zaaFileUpload",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid"},template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label>{{label}}</label></div><div class="form-side"><storage-file-upload ng-model="model"></storage-file-upload></div></div>'}}}),zaa.directive("zaaImageUpload",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid"},template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label>{{label}}</label></div><div class="form-side"><storage-image-upload options="options" ng-model="model"></storage-image-upload></div></div>'}}}),zaa.directive("zaaImageArrayUpload",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid"},link:function(e,n,t){e.$watch("model",function(e,t){e&&1<=e.length?$(n).removeClass("is-empty").addClass("is-not-empty"):$(n).removeClass("is-not-empty").addClass("is-empty")},!0)},controller:["$scope",function(n){void 0===n.model&&(n.model=[]),n.add=function(){null!==n.model&&""!==n.model&&void 0!==n.model||(n.model=[]),n.model.push({imageId:0,caption:""})},n.remove=function(e){n.model.splice(e,1)},n.moveUp=function(e){e=parseInt(e);var t=n.model[e];n.model[e]=n.model[e-1],n.model[e-1]=t},n.moveDown=function(e){e=parseInt(e);var t=n.model[e];n.model[e]=n.model[e+1],n.model[e+1]=t},n.showDownButton=function(e){return parseInt(e)<Object.keys(n.model).length-1},n.isDescriptionEnabled=function(){return!n.options||!n.options.hasOwnProperty("description")||n.options.description},n.noFiltersOption=function(){return!(!n.options||!n.options.hasOwnProperty("filter"))&&!n.options.filter}}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label>{{label}}</label></div><div class="form-side"><div class="list zaa-file-array-upload"><p class="alert alert-info" ng-hide="model.length > 0">'+i18n.js_dir_no_selection+'</p><div ng-repeat="(key,image) in model track by key" class="list-item"><div class="list-section"><div class="list-left"><storage-image-upload ng-model="image.imageId" options="{no_filter: noFiltersOption()}"></storage-image-upload></div><div class="list-right" ng-show="isDescriptionEnabled()"><div class="form-group"><label for="{{image.id}}">'+i18n.js_dir_image_description+'</label><textarea ng-model="image.caption" id="{{image.id}}" class="zaa-file-array-upload-description form-control" auto-grow></textarea></div></div></div><div class="list-buttons"><div class="btn-group" role="group"><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveUp(key)" ng-if="key > 0"><i class="material-icons">keyboard_arrow_up</i></button><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveDown(key)" ng-if="showDownButton(key)"><i class="material-icons">keyboard_arrow_down</i></button><button type="button" class="btn btn-sm btn-outline-danger" ng-click="remove(key)"><i class="material-icons">remove</i></button></div></div></div><button ng-click="add()" type="button" class="btn btn-sm btn-success list-add-button"><i class="material-icons">add</i></button></div></div></div>'}}}),zaa.directive("zaaFileArrayUpload",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid"},controller:["$scope","$element","$timeout",function(n,e,t){void 0===n.model&&(n.model=[]),n.add=function(){null!==n.model&&""!==n.model&&void 0!==n.model||(n.model=[]),n.model.push({fileId:0,caption:""})},n.remove=function(e){n.model.splice(e,1)},n.moveUp=function(e){e=parseInt(e);var t=n.model[e];n.model[e]=n.model[e-1],n.model[e-1]=t},n.moveDown=function(e){e=parseInt(e);var t=n.model[e];n.model[e]=n.model[e+1],n.model[e+1]=t},n.showDownButton=function(e){return parseInt(e)<Object.keys(n.model).length-1}}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label>{{label}}</label></div><div class="form-side"><div class="list zaa-file-array-upload"><p class="alert alert-info" ng-hide="model.length > 0">'+i18n.js_dir_no_selection+'</p><div ng-repeat="(key,file) in model track by key" class="list-item"><div class="list-section" ng-if="file.hiddenStorageUploadSource"><a ng-href="{{file.hiddenStorageUploadSource}}" target="_blank" class="btn btn-primary">{{file.hiddenStorageUploadName}}</a></div><div class="list-section" ng-if="!file.hiddenStorageUploadSource"><div class="list-left"><storage-file-upload ng-model="file.fileId"></storage-file-upload></div><div class="list-right"><div class="form-group"><label for="{{file.id}}">'+i18n.js_dir_image_description+'</label><textarea ng-model="file.caption" id="{{file.id}}" class="zaa-file-array-upload-description form-control" auto-grow></textarea></div></div></div><div class="list-buttons" ng-if="!file.hiddenStorageUploadSource"><div class="btn-group" role="group"><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveUp(key)" ng-if="key > 0"><i class="material-icons">keyboard_arrow_up</i></button><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveDown(key)" ng-if="showDownButton(key)"><i class="material-icons">keyboard_arrow_down</i></button><button type="button" class="btn btn-sm btn-outline-danger" ng-click="remove(key)"><i class="material-icons">remove</i></button></div></div></div></div><button ng-click="add()" type="button" class="btn btn-sm btn-success list-add-button"><i class="material-icons">add</i></button></div></div>'}}}),zaa.directive("zaaMultipleInputs",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid",controls:"@"},controller:["$scope","$timeout",function(n,e){n.init=function(){void 0===n.model||null===n.model?n.model=[]:angular.forEach(n.model,function(e,t){0===Object.keys(e).length&&(n.model[t]={})})},n.add=function(){null!==n.model&&""!==n.model&&void 0!==n.model||(n.model=[]),n.model.push({})},n.remove=function(e){n.model.splice(e,1)},n.moveUp=function(e){e=parseInt(e);var t=n.model[e];n.model[e]=n.model[e-1],n.model[e-1]=t},n.moveDown=function(e){e=parseInt(e);var t=n.model[e];n.model[e]=n.model[e+1],n.model[e+1]=t},n.showDownButton=function(e){return parseInt(e)<Object.keys(n.model).length-1},n.hasControls=function(){return!n.controls||0!=n.controls},e(function(){n.init()})}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label>{{label}}</label></div><div class="form-side"><div class="list zaa-multiple-inputs"><p class="alert alert-info" ng-hide="model.length > 0">'+i18n.js_dir_no_selection+'</p><div ng-repeat="(msortKey,row) in model track by msortKey" class="list-item" ng-init="ensureRow(row)"><div ng-repeat="(mutliOptKey,opt) in options track by mutliOptKey"><zaa-injector dir="opt.type" options="opt.options" fieldid="id-{{msortKey}}-{{mutliOptKey}}" placeholder="{{opt.placeholder}}" initvalue="{{opt.initvalue}}" label="{{opt.label}}" model="row[opt.var]"></zaa-injector></div><div class="list-buttons" ng-show="hasControls()"><div class="btn-group" role="group"><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveUp(msortKey)" ng-if="msortKey > 0"><i class="material-icons">keyboard_arrow_up</i></button><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveDown(msortKey)" ng-if="showDownButton(msortKey)"><i class="material-icons">keyboard_arrow_down</i></button><button type="button" class="btn btn-sm btn-outline-danger" ng-click="remove(msortKey)"><i class="material-icons">remove</i></button></div></div></div><button ng-show="hasControls()" ng-click="add()" type="button" class="btn btn-sm btn-success list-add-button"><i class="material-icons">add</i></button></div></div></div>'}}}),zaa.directive("zaaJsonObject",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid"},controller:["$scope",function(t){t.$watch("model",function(e){angular.isArray(e)&&(t.model={}),null==e&&(t.model={})}),t.add=function(e){t.model[e]=""},t.remove=function(e){delete t.model[e]}}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label>{{label}}</label></div><div class="form-side"><div class="list zaa-json-array"><div ng-repeat="(key,value) in model" class="list-item"><div class="input-group"><div class="input-group-prepend border-right"><div class="input-group-text text-muted">{{key}}</div></div><input class="form-control" type="text" ng-model="model[key]" /></div><div class="list-buttons"><div class="btn-group" role="group"><button type="button" class="btn btn-sm btn-outline-danger" ng-click="remove(key)"><i class="material-icons">remove</i></button></div></div></div><div class="input-group input-group--append-clickable"><input type="text" class="form-control" placeholder="'+i18n.js_jsonobject_newkey+'" aria-label="'+i18n.js_jsonobject_newkey+'" ng-model="newKey"><div class="input-group-append"><div class="input-group-text" ng-click="add(newKey);newKey=null;"><i class="material-icons">add</i></div></div></div></div></div></div>'}}}),zaa.directive("zaaListArray",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@",i18n:"@",id:"@fieldid"},controller:["$scope","$element","$timeout",function(n,t,e){n.init=function(){void 0!==n.model&&null!==n.model||(n.model=[])},n.add=function(){null!==n.model&&""!==n.model&&void 0!==n.model||(n.model=[]),n.model.push({value:""}),n.setFocus()},n.remove=function(e){n.model.splice(e,1)},n.refactor=function(e,t){e!==n.model.length-1&&""===t.value&&n.remove(e)},n.setFocus=function(){e(function(){var e=t.children(".list").children(".list__item:last-of-type").children(".list__left").children("input");1===e.length&&e[0].focus()},50)},n.moveUp=function(e){e=parseInt(e);var t=n.model[e];n.model[e]=n.model[e-1],n.model[e-1]=t},n.moveDown=function(e){e=parseInt(e);var t=n.model[e];n.model[e]=n.model[e+1],n.model[e+1]=t},n.showDownButton=function(e){return parseInt(e)<Object.keys(n.model).length-1},n.init()}],template:function(){return'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}"><div class="form-side form-side-label"><label>{{label}}</label></div><div class="form-side"><div class="list zaa-file-array-upload"><p class="alert alert-info" ng-hide="model.length > 0">'+i18n.js_dir_no_selection+'</p><div ng-repeat="(key,row) in model track by key" class="list-item"><input class="form-control list-input" type="text" ng-model="row.value" /><div class="list-buttons"><div class="btn-group" role="group"><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveUp(key)" ng-if="key > 0"><i class="material-icons">keyboard_arrow_up</i></button><button type="button" class="btn btn-sm btn-outline-info" ng-click="moveDown(key)" ng-if="showDownButton(key)"><i class="material-icons">keyboard_arrow_down</i></button><button type="button" class="btn btn-sm btn-outline-danger" ng-click="remove(key)"><i class="material-icons">remove</i></button></div></div></div><button ng-click="add()" type="button" class="btn btn-sm btn-success list-add-button"><i class="material-icons">add</i></button></div></div></div>'}}}),zaa.controller("DefaultDashboardObjectController",["$scope","$http","$sce",function(t,n,e){t.data,t.loadData=function(e){n.get(e).then(function(e){t.data=e.data})}}]),zaa.controller("CrudController",["cfpLoadingBar","$scope","$rootScope","$filter","$http","$sce","$state","$timeout","$injector","$q","AdminLangService","AdminToastService","CrudTabService","ServiceImagesData","$parse",function(t,r,e,n,s,i,o,a,l,c,d,u,p,f,m){r.toast=u,r.AdminLangService=d,r.tabService=p,r.clearData=function(){u.confirm(i18n.ngrest_delete_all_button_confirm_message,i18n.ngrest_delete_all_button_label,function(){var e=this;s.get(r.config.apiEndpoint+"/truncate").then(function(){e.close(),r.loadList()})})},r.crudSwitchType=0,r.switchToTab=function(e){angular.forEach(r.tabService.tabs,function(e){e.active=!1}),e.active=!0,r.switchTo(4)},r.addAndswitchToTab=function(e,t,n,i,o){r.tabService.addTab(e,t,n,i,o),r.switchTo(4)},r.closeTab=function(e,t){r.tabService.remove(t,r)},r.switchTo=function(e,t){r.config.relationCall?r.crudSwitchType=e:(t&&r.resetData(),0==e&&s.get(r.config.apiEndpoint+"/unlock",{ignoreLoadingBar:!0}),0!=e&&1!=e||r.config.inline||o.go("default.route"),4===(r.crudSwitchType=e)||r.config.inline||angular.forEach(r.tabService.tabs,function(e){e.active=!1}))},r.closeUpdate=function(){r.switchTo(0,!0)},r.closeCreate=function(){r.switchTo(0,!0)},r.activeWindowModal=!0,r.openActiveWindow=function(){r.activeWindowModal=!1},r.closeActiveWindow=function(){r.activeWindowModal=!0},r.changeGroupByField=function(){0==r.config.groupByField?r.config.groupBy=0:r.config.groupBy=1},r.isSettingsVisible=!1,r.toggleSettingsMenu=function(){r.isSettingsVisible=!r.isSettingsVisible},r.hiddeSettingsMenu=function(){r.isSettingsVisible=!1},r.isExportModalHidden=!0,r.exportdata={header:1,type:"xlsx"},r.toggleExportModal=function(){r.exportdata.filter=r.config.filter,r.isExportModalHidden=!r.isExportModalHidden},r.exportResponse=!1,r.generateExport=function(){s.post(r.config.apiEndpoint+"/export?"+r.config.apiExportQueryString,r.exportdata).then(function(e){r.exportResponse=e.data})},r.downloadExport=function(){var e=r.exportResponse.url;return r.exportResponse=!1,window.open(e),!1},r.applySaveCallback=function(){r.config.saveCallback&&l.invoke(r.config.saveCallback,this)},r.isOrderBy=function(e){return e==r.config.orderBy},r.changeOrder=function(e,t){r.config.orderBy=t+e,s.post("admin/api-admin-common/ngrest-order",{apiEndpoint:r.config.apiEndpoint,sort:t,field:e},{ignoreLoadingBar:!0}),r.loadList()},r.callActiveButton=function(e,t,n){var i=angular.element(n.currentTarget);i.addClass("crud-buttons-button-loading"),s.get(r.config.apiEndpoint+"/active-button?hash="+e+"&id="+t.join()).then(function(e){i.removeClass("crud-buttons-button-loading"),i.addClass("crud-buttons-button-success"),a(function(){i.removeClass("crud-buttons-button-success")},5e3),angular.forEach(e.data.events,function(e){"loadList"==e&&r.loadList()}),u.success(e.data.message)},function(e){i.removeClass("crud-buttons-button-loading"),i.addClass("crud-buttons-button-danger"),a(function(){i.removeClass("crud-buttons-button-danger")},5e3),u.error(e.data.message)})},r.reloadActiveWindow=function(){r.getActiveWindow(r.data.aw.hash,r.data.aw.itemId)},r.getActiveWindow=function(t,n,e){s.post(r.config.activeWindowRenderUrl,{itemId:n,activeWindowHash:t,ngrestConfigHash:r.config.ngrestConfigHash}).then(function(e){r.openActiveWindow(),r.data.aw.itemId=n,r.data.aw.configCallbackUrl=r.config.activeWindowCallbackUrl,r.data.aw.configHash=r.config.ngrestConfigHash,r.data.aw.hash=t,r.data.aw.content=i.trustAsHtml(e.data.content),r.data.aw.title=e.data.title,r.$broadcast("awloaded",{id:t})})},r.getActiveWindowCallbackUrl=function(e){return r.data.aw.configCallbackUrl+"?activeWindowCallback="+e+"&ngrestConfigHash="+r.data.aw.configHash+"&activeWindowHash="+r.data.aw.hash},r.sendActiveWindowCallback=function(e,t){t=t||{};return s.post(r.getActiveWindowCallbackUrl(e),$.param(t),{headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}})},r.searchPromise=null,r.$watch("config.searchQuery",function(e,t){e!=t&&null!=e&&null!=e&&r.applySearchQuery(e)}),r.applySearchQuery=function(e){null!=e&&null!=e&&(a.cancel(r.searchPromise),0==e.length?r.loadList(1):(t.start(),r.searchPromise=a(function(){r.reloadCrudList(1)},700)))},r.generateSearchPromise=function(e,t){return s.post(r.generateUrlWithParams("search",t),{query:e}).then(function(e){r.parseResponseQueryToListArray(e)})},r.selectedItems=[],r.isInSelection=function(e){var t=r.getRowPrimaryValue(e);return-1!=this.selectedItems.indexOf(t)},r.toggleSelection=function(e){var t=r.getRowPrimaryValue(e),n=this.selectedItems.indexOf(t);-1==n?this.selectedItems.push(t):this.selectedItems.splice(n,1)},r.sendActiveSelection=function(e){s.post(r.config.apiEndpoint+"/active-selection?index="+e,{ids:this.selectedItems}).then(function(e){angular.forEach(e.data.events,function(e){"loadList"==e&&r.loadList()}),u.success(e.data.message)},function(e){u.error(e.data.message)})},r.parentSelectInline=function(e){r.$parent.$parent.$parent.setModelValue(r.getRowPrimaryValue(e),e)},r.checkIfFieldExistsInPopulateCondition=function(e){var t=r.config.pools;if(t.hasOwnProperty(e))return t[e];if(r.config.relationCall){var n=r.$parent.$parent.config.relations[parseInt(r.config.relationCall.arrayIndex)].relationLink;if(null!==n&&n.hasOwnProperty(e))return parseInt(r.config.relationCall.id)}return!1},r.relationItems=[],r.deleteItem=function(e,t){u.confirm(i18n.js_ngrest_rm_page,i18n.ngrest_button_delete,["$toast",function(t){s.delete(r.config.apiEndpoint+"/"+e).then(function(e){r.loadList(),t.close(),u.success(i18n.js_ngrest_rm_confirm)},function(e){r.printErrors(e.data)})}])},r.toggleUpdate=function(n){r.resetData(),s.get(r.config.apiEndpoint+"/"+n+"?"+r.config.apiUpdateQueryString).then(function(e){var t=e.data;r.data.update=t,r.config.relationCall?r.crudSwitchType=2:r.switchTo(2),r.config.inline||o.go("default.route.detail",{id:n}),r.data.updateId=n},function(e){u.error(i18n.js_ngrest_error)})},r.highlightPkValue=null,r.highlightTimeout=5e3,r.isRowHighlighted=function(e){return r.getRowPrimaryValue(e)==r.highlightPkValue};r.getParsedCellColor=function(e,t){if(function(e){var t=document.createElement("div");return t.style.color="rgb(0, 0, 0)",t.style.color=e,"rgb(0, 0, 0)"!==t.style.color||(t.style.color="rgb(255, 255, 255)",t.style.color=e,"rgb(255, 255, 255)"!==t.style.color)}(t))return t;try{var n=m(t)(e)}catch(e){return!1}return n},r.submitUpdate=function(t){var e=r.config.activePool;s.put(r.config.apiEndpoint+"/"+r.data.updateId+"?pool="+e,angular.toJson(r.data.update,!0)).then(function(e){u.success(i18n.js_ngrest_rm_update),r.loadList(r.pager.currentPage).then(function(){r.applySaveCallback(),t&&r.switchTo(0,!0),r.highlightPkValue=r.getRowPrimaryValue(e.data),a(function(){r.highlightPkValue=null},r.highlightTimeout)})},function(e){r.printErrors(e.data)})},r.submitCreate=function(i,o){s.post(r.config.apiEndpoint,angular.toJson(r.data.create,!0)).then(function(t){u.success(i18n.js_ngrest_rm_success),r.loadList().then(function(){r.applySaveCallback(),i&&r.switchTo(0,!0);var e=r.data.create;if(r.resetData(),r.highlightPkValue=r.getRowPrimaryValue(t.data),a(function(){r.highlightPkValue=null},r.highlightTimeout),o)r.toggleUpdate(t.data.id);else{var n={};angular.forEach(e,function(e,t){r.checkIfFieldExistsInPopulateCondition(t)&&(n[t]=e)}),r.data.create=n}})},function(e){r.printErrors(e.data)})},r.printErrors=function(e){angular.forEach(e,function(e,t){u.error(e.message)})},r.resetData=function(){r.data.create=angular.copy({}),r.data.update=angular.copy({})},r.changeNgRestFilter=function(){s.post("admin/api-admin-common/ngrest-filter",{apiEndpoint:r.config.apiEndpoint,filterName:r.config.filter},{ignoreLoadingBar:!0}),r.loadList(1)},r.pager={currentPage:1,pageCount:1,perPage:0,totalItems:0},r.$watch("pager.currentPage",function(e,t){e===t||null==e||null==e||r.loadList(e)},!0),r.setPagination=function(e,t,n,i){r.totalRows=i,r.pager={currentPage:parseInt(e),pageCount:t,perPage:n,totalItems:i}},r.toggleStatus=function(t,n,i,e){var o=!e?1:0,a=t[r.config.pk],l={};l[n]=o,s.put(r.config.apiEndpoint+"/"+a+"?ngrestCallType=update&fields="+n,angular.toJson(l,!0)).then(function(e){t[n]=o,u.success(i18nParam("js_ngrest_toggler_success",{field:i}))},function(e){r.printErrors(e.data)})},r.inlineEditSubmit=function(e,t,n){var i=r.getRowPrimaryValue(e),o=e[t],a={};a[t]=o,s.put(r.config.apiEndpoint+"/"+i+"?ngrestCallType=update&fields="+t,angular.toJson(a,!0)).then(function(){u.success(i18nParam("js_ngrest_toggler_success",{field:n}))},function(e){r.printErrors(e.data)})},r.sortableUp=function(e,t,n){var i=parseInt(t[n])-1;r.updateSortableIndexPosition(t,n,i)},r.sortableDown=function(e,t,n){var i=parseInt(t[n])+1;r.updateSortableIndexPosition(t,n,i)},r.updateSortableIndexPosition=function(e,t,n){var i=r.config.activePool,o={};o[t]=n;var a=r.getRowPrimaryValue(e);s.put(r.config.apiEndpoint+"/"+a+"?ngrestCallType=update&pool="+i+"&fields="+t,angular.toJson(o,!0)).then(function(){r.loadList()})},r.loadService=function(){r.initServiceAndConfig()},r.evalSettings=function(e){e.hasOwnProperty("order")&&(r.config.orderBy=e.order),e.hasOwnProperty("filterName")&&r.config.filters.hasOwnProperty(e.filterName)&&(r.config.filter=e.filterName)},r.getRowPrimaryValue=function(t){var e=r.config.pk;if(angular.isArray(e)){var n=[];return angular.forEach(e,function(e){n.push(t[e])}),n.join()}return t[r.config.pk]},r.tagsFilterIds=[],r.isTagFilterActive=function(e){return-1!=r.tagsFilterIds.indexOf(e)},r.toggleTagFilter=function(e){var t=r.tagsFilterIds.indexOf(e);-1==t?r.tagsFilterIds.push(e):r.tagsFilterIds.splice(t,1),r.loadList()},r.initServiceAndConfig=function(){var t=c.defer();return s.get(r.config.apiEndpoint+"/services?"+r.config.apiServicesQueryString).then(function(e){r.service=e.data.service,r.serviceResponse=e.data,r.evalSettings(e.data._settings),r.$parent.notifications&&r.$parent.notifications.hasOwnProperty(r.serviceResponse._authId)&&delete r.$parent.notifications[r.serviceResponse._authId],t.resolve()}),t.promise},r.toggleNotificationMute=function(){s.post(r.config.apiEndpoint+"/toggle-notification",{mute:!r.serviceResponse._notifcation_mute_state}).then(function(e){r.initServiceAndConfig()})},r.getFieldHelp=function(e){return!!(r.serviceResponse&&r.serviceResponse._hints&&r.serviceResponse._hints.hasOwnProperty(e))&&r.serviceResponse._hints[e]},r.loadList=function(e){return null==e&&r.pager?r.reloadCrudList(r.pager.currentPage):r.reloadCrudList(e)},r.totalRows=0,r.requestedImages=[],r.parseResponseQueryToListArray=function(n){r.setPagination(n.headers("X-Pagination-Current-Page"),n.headers("X-Pagination-Page-Count"),n.headers("X-Pagination-Per-Page"),n.headers("X-Pagination-Total-Count")),r.data.listArray=n.data,r.requestedImages=[],angular.forEach(r.service,function(e,t){e.hasOwnProperty("lazyload_images")&&angular.forEach(n.data,function(e){r.requestedImages.push(e[t])})}),a(function(){f.loadImages(r.requestedImages).then(function(){r.$broadcast("requestImageSourceReady"),r.requestedImages=[]})})},r.generateUrlWithParams=function(e,t){var n=r.config.apiEndpoint+"/"+e+"?"+r.config.apiListQueryString;r.config.orderBy&&(n=n+"&sort="+r.config.orderBy.replace("+","")),void 0!==t&&(n=n+"&page="+t);var i=r.config.searchQuery;i&&(n=n+"&query="+i);var o=r.tagsFilterIds.join(",");return o&&(n=n+"&tags="+o),n},r.reloadCrudList=function(e){var t=c.defer();if(0==parseInt(r.config.filter)||null===r.config.filter){if(r.config.relationCall){n=(n=r.generateUrlWithParams("relation-call",e))+"&arrayIndex="+r.config.relationCall.arrayIndex+"&id="+r.config.relationCall.id+"&modelClass="+r.config.relationCall.modelClass}else{if(r.config.searchQuery)return r.generateSearchPromise(r.config.searchQuery,e);var n=r.generateUrlWithParams("list",e)}s.get(n).then(function(e){t.resolve(e),r.parseResponseQueryToListArray(e)})}else{n=(n=r.generateUrlWithParams("filter",e))+"&filterName="+r.config.filter,s.get(n).then(function(e){r.parseResponseQueryToListArray(e),t.resolve(e)})}return t.promise},r.service=!1,r.$on("secondMenuClick",function(){r.isInitalized&&(r.loadList(),r.switchTo(0,!0))}),r.data={create:{},update:{},aw:{},list:{},updateId:0},r.isInitalized=!1,r.$watch("config",function(e,t){a(function(){r.initServiceAndConfig().then(function(){r.isInitalized=!0,r.loadList()})})})}]),zaa.controller("ActiveWindowTagController",["$scope","$http","AdminToastService",function(n,e,i){n.crud=n.$parent,n.tags=[],n.relation={},n.newTagName=null,n.loadTags=function(){e.get(n.crud.getActiveWindowCallbackUrl("LoadTags")).then(function(e){n.tags=e.data})},n.loadRelations=function(){e.get(n.crud.getActiveWindowCallbackUrl("LoadRelations")).then(function(e){n.relation={},e.data.forEach(function(e,t){n.relation[e.tag_id]=1})})},n.saveTag=function(){var t=n.newTagName;""!==t&&n.crud.sendActiveWindowCallback("SaveTag",{tagName:t}).then(function(e){e.data?(n.tags.push({id:e.data,name:t}),i.success(t+" wurde gespeichert.")):i.error(t+" "+i18n.js_tag_exists),n.newTagName=null})},n.saveRelation=function(t,e){n.crud.sendActiveWindowCallback("SaveRelation",{tagId:t.id,value:e}).then(function(e){n.relation[t.id]=e.data,i.success(i18n.js_tag_success)})},n.$watch(function(){return n.data.aw.itemId},function(e,t){n.loadRelations()}),n.loadTags()}]),zaa.controller("ActiveWindowGalleryController",["$scope","$http","$filter",function(a,e,t){a.crud=a.$parent,a.files=[],a.select=function(e){0==t("filter")(a.files,{fileId:e},!0).length&&a.crud.sendActiveWindowCallback("AddImageToIndex",{fileId:e}).then(function(e){var t=e.data;a.files.push(t)})},a.loadImages=function(){e.get(a.crud.getActiveWindowCallbackUrl("loadAllImages")).then(function(e){a.files=e.data})},a.changePosition=function(e,t,n){t=parseInt(t);var i=a.files[t];"up"==n?(a.files[t]=a.files[t-1],a.files[t-1]=i):"down"==n&&(a.files[t]=a.files[t+1],a.files[t+1]=i);var o=a.files[t];a.crud.sendActiveWindowCallback("ChangeSortIndex",{new:o,old:i})},a.moveUp=function(e,t){a.changePosition(e,t,"up")},a.moveDown=function(e,t){a.changePosition(e,t,"down")},a.remove=function(e,t){a.crud.sendActiveWindowCallback("RemoveFromIndex",{imageId:e.originalImageId}).then(function(e){a.files.splice(t,1)})},a.$watch(function(){return a.data.aw.itemId},function(e,t){a.loadImages()})}]),zaa.controller("ActiveWindowGroupAuth",["$scope","$http","CacheReloadService",function(n,e,t){n.crud=n.$parent,n.reload=function(){t.reload()},n.rights=[],n.auths=[],n.save=function(e){n.crud.sendActiveWindowCallback("saveRights",{data:e}).then(function(e){n.getRights(),n.reload()})},n.clearModule=function(e){angular.forEach(e,function(e){n.rights[e.id]={base:0,create:0,update:0,delete:0}})},n.toggleModule=function(e){angular.forEach(e,function(e){n.rights[e.id]={base:1,create:1,update:1,delete:1}})},n.toggleGroup=function(e){objectGroup=n.rights[e],1==objectGroup.base?(objectGroup.create=1,objectGroup.update=1,objectGroup.delete=1):0==objectGroup.base&&(objectGroup.create=0,objectGroup.update=0,objectGroup.delete=0)},n.toggleAll=function(){angular.forEach(n.auths,function(e){angular.forEach(e,function(e){n.rights[e.id]={base:1,create:1,update:1,delete:1}})})},n.untoggleAll=function(){angular.forEach(n.auths,function(e){angular.forEach(e,function(e){n.rights[e.id]={base:0,create:0,update:0,delete:0}})})},n.getRights=function(){e.get(n.crud.getActiveWindowCallbackUrl("getRights")).then(function(e){n.rights=e.data.rights,n.auths=e.data.auths})},n.$on("awloaded",function(e,t){n.getRights()}),n.$watch(function(){return n.data.aw.itemId},function(e,t){n.getRights()})}]),zaa.controller("DefaultController",["$scope","$http","$state","$stateParams","CrudTabService",function(o,t,n,i,a){o.moduleId=n.params.moduleId,o.loadDashboard=function(){return o.currentItem=null,o.getDashboard(o.moduleId),n.go("default",{moduleId:o.moduleId})},o.isOpenModulenav=!1,o.items=[],o.itemRoutes=[],o.currentItem=null,o.dashboard=[],o.itemAdd=function(e,t){for(var n in o.items.push({name:e,items:t}),t){var i=t[n];o.itemRoutes[i.route]={alias:i.alias,icon:i.icon}}},o.getDashboard=function(e){t.get("admin/api-admin-menu/dashboard",{params:{nodeId:e}}).then(function(e){o.dashboard=e.data})},o.init=function(){o.get(),o.getDashboard(o.moduleId)},o.resolveCurrentItem=function(){if(!o.currentItem&&("default.route"==n.current.name||"default.route.detail"==n.current.name)){var e=[i.moduleRouteId,i.controllerId,i.actionId].join("/");o.itemRoutes.indexOf(e)&&(o.currentItem=o.itemRoutes[e],o.currentItem.route=e)}},o.routeSplitter=function(e){var t=e.route.split("/");return{moduleRouteId:t[0],controllerId:t[1],actionId:t[2]}},o.click=function(e){o.isOpenModulenav=!1,o.currentItem=e,a.clear(),o.$broadcast("secondMenuClick",{item:e})},o.get=function(){t.get("admin/api-admin-menu/items",{params:{nodeId:o.moduleId}}).then(function(e){var t=e.data;for(var n in t.groups){var i=t.groups[n];o.itemAdd(i.name,i.items)}o.resolveCurrentItem()})},o.hasSubUnreadNotificaton=function(e){return o.$parent.notifications&&o.$parent.notifications.hasOwnProperty(e.authId)?o.$parent.notifications[e.authId]:0},o.$on("topMenuClick",function(e){o.currentItem=null}),o.init()}]),zaa.controller("DashboardController",["$scope",function(e){e.logItemOpen=!1}]),zaa.filter("lockFilter",function(){return function(e,t,n){var i=!1;return angular.forEach(e,function(e){e.lock_table==t&&e.lock_pk==n&&(i=e)}),i}}),zaa.controller("LayoutMenuController",["$scope","$document","$http","$state","$timeout","$window","$filter","HtmlStorage","CacheReloadService","AdminDebugBar","LuyaLoading","AdminToastService","AdminClassService",function(o,e,n,a,i,t,l,r,s,c,d,u,p){o.AdminClassService=p,o.AdminDebugBar=c,o.LuyaLoading=d,o.toastQueue=u.queue,o.reload=function(){s.reload()},o.reload=function(e){0==e?t.location.reload():s.reload()},o.reloadButtonCall=function(e){n.get("admin/api-admin-common/reload-button-call?key="+e).then(function(e){u.success(e.data.message)})},o.isHover=r.getValue("sidebarToggleState",!1),o.toggleMainNavSize=function(){o.isHover=!o.isHover,r.setValue("sidebarToggleState",o.isHover)},o.profile={},o.settings={},o.packages=[],o.getProfileAndSettings=function(){n.get("admin/api-admin-user/session").then(function(e){o.profile=e.data.user,o.settings=e.data.settings,o.packages=e.data.packages})},o.browser=null,o.detectBrowser=function(){o.browser=[bowser.name.replace(" ","-").toLowerCase()+"-"+bowser.version,bowser.mac?"mac-os-"+(bowser.osversion?bowser.osversion:""):"windows-"+(bowser.osversion?bowser.osversion:"")].join(" ")},o.detectBrowser(),o.getProfileAndSettings(),o.debugDetail=null,o.debugDetailKey=null,o.loadDebugDetail=function(e,t){o.debugDetail=e,o.debugDetailKey=t},o.closeDebugDetail=function(){o.debugDetail=null,o.debugDetailKey=null},o.notify=null,o.forceReload=0,o.showOnlineContainer=!1,o.searchDetailClick=function(t,i){"custom"===t.type?o.click(t.menuItem,!0).then(function(){if(t.stateProvider){var n={};angular.forEach(t.stateProvider.params,function(e,t){n[t]=i[e]}),a.go(t.stateProvider.state,n).then(function(){o.closeSearchInput()})}else o.closeSearchInput()}):o.click(t.menuItem.module,!0).then(function(){var e=t.menuItem.route.split("/");a.go("default.route",{moduleRouteId:e[0],controllerId:e[1],actionId:e[2]}).then(function(){if(t.stateProvider){var n={};angular.forEach(t.stateProvider.params,function(e,t){n[t]=i[e]}),a.go(t.stateProvider.state,n).then(function(){o.closeSearchInput()})}else o.closeSearchInput()})})},o.visibleAdminReloadDialog=!1,o.lastKeyStroke=Date.now(),e.bind("keyup",function(e){o.lastKeyStroke=Date.now()}),o.notifications=[],function t(){n.post("admin/api-admin-timestamp",{lastKeyStroke:o.lastKeyStroke},{ignoreLoadingBar:!0}).then(function(e){o.forceReload=e.data.forceReload,o.notifications=e.data.notifications,o.forceReload&&!o.visibleAdminReloadDialog&&(o.visibleAdminReloadDialog=!0,u.confirm(i18n.js_admin_reload,i18n.layout_btn_reload,function(){o.reload(),o.visibleAdminReloadDialog=!1})),o.locked=e.data.locked,o.notify=e.data.useronline,o.idleStrokeDashoffset=e.data.idleStrokeDashoffset,o.idleTimeRelative=e.data.idleTimeRelative,i(t,2e4)})}(),o.isLocked=function(e,t){return l("lockFilter")(o.locked,e,t)},o.getLockedName=function(e,t){var n=o.isLocked(e,t);return n?n.firstname:""},o.searchQuery=null,o.searchInputOpen=!1,o.escapeSearchInput=function(){o.searchInputOpen&&o.closeSearchInput()},o.toggleSearchInput=function(){o.searchInputOpen=!o.searchInputOpen},o.openSearchInput=function(){o.searchInputOpen=!0},o.closeSearchInput=function(){o.searchInputOpen=!1},o.searchResponse=null,o.hasUnreadNotificaton=function(e){var t=e.authIds,n=0;return angular.forEach(t,function(e){e&&o.notifications.hasOwnProperty(e)&&(n+=parseInt(o.notifications[e]))}),n},o.$watch(function(){return o.searchQuery},function(e,t){e!==t&&(2<e.length?n.get("admin/api-admin-search",{params:{query:e}}).then(function(e){o.searchResponse=e.data}):o.searchResponse=null)}),o.items=[],o.currentItem={},o.isOpen=!1,o.click=function(e,t){if(o.isOpen=!1,o.$broadcast("topMenuClick",{menuItem:e}),t)return e.template?a.go("custom",{templateId:e.template}):a.go("default",{moduleId:e.id})},o.isActive=function(e){if(e.template){if(a.params.templateId==e.template)return o.currentItem=e,!0}else if(a.params.moduleId==e.id)return o.currentItem=e,!0},o.get=function(){n.get("admin/api-admin-menu").then(function(e){o.items=e.data})},o.get()}]),zaa.controller("AccountController",["$scope","$http","$window","AdminToastService",function(t,n,i,o){t.pass={},t.changePassword=function(){n.post("admin/api-admin-user/change-password",t.pass).then(function(e){o.success(i18n.aws_changepassword_succes),t.pass={}},function(e){o.errorArray(e.data),t.pass={}})},t.changeSettings=function(e){n.post("admin/api-admin-user/change-settings",e).then(function(e){i.location.reload()})},t.removeDevice=function(e){n.post("admin/api-admin-user/remove-device",{deviceId:e.id}).then(function(){o.success(i18n.js_account_update_profile_success),t.getProfile()})},t.profile={},t.settings={},t.activities={},t.email={},t.devices=[],t.twoFa={},t.twoFaBackupCode=!1,t.getProfile=function(){n.get("admin/api-admin-user/session").then(function(e){t.profile=e.data.user,t.settings=e.data.settings,t.activities=e.data.activities,t.devices=e.data.devices,t.twoFa=e.data.twoFa})},t.changePersonData=function(e){n.put("admin/api-admin-user/session-update",e).then(function(e){o.success(i18n.js_account_update_profile_success),t.getProfile()},function(e){o.errorArray(e.data)})},t.changeEmail=function(){n.put("admin/api-admin-user/change-email",{token:t.email.token}).then(function(e){o.success(i18n.js_account_update_profile_success),t.getProfile()},function(e){o.errorArray(e.data)})},t.registerTwoFa=function(){n.post("admin/api-admin-user/register-twofa",{secret:t.twoFa.secret,verification:t.twoFa.verification}).then(function(e){t.twoFaBackupCode=e.data.backupCode,o.success(i18n.js_account_update_profile_success),t.getProfile()},function(e){o.errorArray(e.data)})},t.disableTwoFa=function(){n.post("admin/api-admin-user/disable-twofa").then(function(){o.success(i18n.js_account_update_profile_success),t.getProfile()})},t.getProfile()}]),zaa.directive("luyaSchedule",function(){return{restrict:"E",relace:!0,scope:{value:"=",attributeValues:"=",primaryKeyValue:"=",modelClass:"@",attributeName:"@",onlyIcon:"@",title:"@"},controller:["$scope","$http","$timeout","AdminToastService",function(i,t,n,o){i.getFirstAttributeKeyAsDefaultValue=function(){return i.attributeValues[0].value},i.newvalue=i.getFirstAttributeKeyAsDefaultValue(),i.isVisible=!1,i.upcomingAccordionOpen=!0,i.archiveAccordionOpen=!1,i.showDatepicker=!1,i.modalPositionClass="",i.$watch("showDatepicker",function(e){if(0===e){var t=new Date;i.timestamp=t.getTime()/1e3}}),i.toggleWindow=function(){i.isVisible=!i.isVisible,i.isVisible?i.getLogTable():i.hideInlineModal()},i.escModal=function(){i.isVisible&&(i.isVisible=!1,i.hideInlineModal())},i.getUniqueFormId=function(e){return e+i.primaryKeyValue+"_"+i.attributeName},i.logs={upcoming:[],archived:[]},i.getLogTable=function(e){t.get("admin/api-admin-common/scheduler-log?model="+i.modelClass+"&pk="+i.primaryKeyValue+"&target="+i.attributeName).then(function(e){i.logs.archived=[],i.logs.upcoming=[],e.data.forEach(function(e){e.is_done?i.logs.archived.push(e):i.logs.upcoming.push(e)}),angular.forEach(i.logs.archived,function(e,t){e.id==i.latestId&&(i.value=e.new_attribute_value)}),n(function(){i.showInlineModal()})})},i.valueToLabel=function(t){var n;return angular.forEach(i.attributeValues,function(e){e.value==t&&(n=e.label)}),n};var e=(new Date).getTime()/1e3;i.latestId,i.timestamp=parseInt(e),i.saveNewJob=function(){t.post("admin/api-admin-common/scheduler-add",{model_class:i.modelClass,primary_key:i.primaryKeyValue,target_attribute_name:i.attributeName,new_attribute_value:i.newvalue,schedule_timestamp:i.timestamp}).then(function(e){i.latestId=e.data.id,i.getLogTable()},function(e){o.errorArray(e.data)})},i.deleteJob=function(e){t.delete("admin/api-admin-common/scheduler-delete?id="+e.id).then(function(e){i.getLogTable()})}}],link:function(l,r,e){var s=r.find(".inlinemodal"),a=r.find(".inlinemodal-arrow"),c=r.find(".scheduler-btn");l.alignModal=function(){var e=$(document).width(),t=(r.parents(".luya-content")[0].scrollHeight||$(document).height(),c[0].getBoundingClientRect()),n=e-(t.left+t.width+30),i=t.left-30,o=500<=n||i<=n,a=i<300&&n<300;s.removeClass("inlinemodal--left inlinemodal--right inlinemodal--full"),a?(s.addClass("inlinemodal--full"),s.css({display:"block",left:15,right:15,top:15,bottom:15})):o?(s.addClass("inlinemodal--right"),s.css({display:"block",left:t.left+t.width+15,right:15,width:"auto"})):(s.addClass("inlinemodal--left"),s.css({display:"block",left:1e3<t.left?"auto":15,right:e+15-t.left,width:1e3<t.left?"100%":"auto"})),l.alignModalArrow()},l.alignModalArrow=function(){var e=s[0].getBoundingClientRect(),t=c[0].getBoundingClientRect(),n=a.outerHeight(),i=t.top-15-n/2,o=e.height-15-n/2-10;i<=10?i=10:(0<o?o:5e3)<=i&&(i=o),a.css({top:i})},l.showInlineModal=function(){l.alignModal()},l.hideInlineModal=function(){s.css({display:"none"})},angular.element(window).bind("resize",function(){l.isVisible&&l.alignModal()}),$(window).on("scroll",function(){l.isVisible&&l.alignModalArrow()}),r.parents().on("scroll",function(){l.isVisible&&l.alignModalArrow()})},template:function(){return'<div class="scheduler" ng-class="{\'inlinemodal--open\' : isVisible}"><button ng-click="toggleWindow()" type="button" class="scheduler-btn btn btn-link"><i class="material-icons">schedule</i><span ng-hide="onlyIcon">{{valueToLabel(value)}}</span></button><div class="inlinemodal" style="display: none;" ng-class="modalPositionClass" zaa-esc="escModal()"><div class="inlinemodal-inner"><div class="inlinemodal-head clearfix"><div class="modal-header"><h5 class="modal-title">{{title}}</h5><div class="modal-close"><button type="button" class="close" aria-label="Close" ng-click="toggleWindow()"><span aria-hidden="true"><span class="modal-esc">ESC</span> ×</span></button></div></div></div><div class="inlinemodal-content"><div class="clearfix"><zaa-select model="newvalue" options="attributeValues" label="'+i18n.js_scheduler_new_value+'"></zaa-select><zaa-checkbox model="showDatepicker" fieldid="{{getUniqueFormId(\'datepicker\')}}" label="'+i18n.js_scheduler_show_datepicker+'"></zaa-checkbox><zaa-datetime ng-show="showDatepicker" model="timestamp" label="'+i18n.js_scheduler_time+'"></zaa-datetime><button type="button" class="btn btn-save btn-icon float-right" ng-click="saveNewJob()">'+i18n.js_scheduler_save+'</button></div><div class="card mt-4" ng-class="{\'card-closed\': !upcomingAccordionOpen}" ng-hide="logs.upcoming.length <= 0"><div class="card-header" ng-click="upcomingAccordionOpen=!upcomingAccordionOpen"><span class="material-icons card-toggle-indicator">keyboard_arrow_down</span><i class="material-icons">alarm</i> <span> '+i18n.js_scheduler_title_upcoming+'</span><span class="badge badge-secondary float-right">{{logs.upcoming.length}}</span></div><div class="card-body p-2"><div class="table-responsive"><table class="table table-hover table-align-middle"><thead><tr><th>'+i18n.js_scheduler_table_newvalue+"</th><th>"+i18n.js_scheduler_table_timestamp+'</th><th></th></tr></thead><tbody><tr ng-repeat="log in logs.upcoming"><td>{{valueToLabel(log.new_attribute_value)}}</td><td>{{log.schedule_timestamp*1000 | date:\'short\'}}</td><td style="width: 60px;"><button type="button" class="btn btn-delete btn-icon" ng-click="deleteJob(log)"></button></td></tr></tbody></table></div></div></div><div class="card mt-3" ng-class="{\'card-closed\': !archiveAccordionOpen}" ng-hide="logs.archived.length <= 0"><div class="card-header" ng-click="archiveAccordionOpen=!archiveAccordionOpen"><span class="material-icons card-toggle-indicator">keyboard_arrow_down</span><i class="material-icons">alarm_on</i> <span> '+i18n.js_scheduler_title_completed+'</span><span class="badge badge-secondary float-right">{{logs.archived.length}}</span></div><div class="card-body p-2"><div class="table-responsive"><table class="table table-hover table-align-middle"><thead><tr><th>'+i18n.js_scheduler_table_newvalue+"</th><th>"+i18n.js_scheduler_table_timestamp+'</th></tr></thead><tbody><tr ng-repeat="log in logs.archived"><td>{{valueToLabel(log.new_attribute_value)}}</td><td>{{log.schedule_timestamp*1000 | date:\'short\'}}</td></tr></tbody></table></div></div></div></div></div><div class="inlinemodal-arrow"></div></div></div>'}}});