From f2cb48ef0e83b5e11e07f456ff2cd643dd116008 Mon Sep 17 00:00:00 2001 From: Bob Builder Date: Mon, 12 Jun 2017 13:50:45 +0000 Subject: [PATCH] release version 1.0.12-b430 --- dist/mw-uikit.js | 47 ++++++++++++++++++++++++++++++++--- dist/mw-uikit.min.js | 8 +++--- dist/mw-uikit.relution.js | 8 ++++++ dist/mw-uikit.relution.min.js | 4 +-- 4 files changed, 58 insertions(+), 9 deletions(-) diff --git a/dist/mw-uikit.js b/dist/mw-uikit.js index 4e2ab5ae..5395b313 100644 --- a/dist/mw-uikit.js +++ b/dist/mw-uikit.js @@ -41,7 +41,7 @@ //Will be replaced with the actual version number duringh the build process; //DO NOT TOUCH - root.mwUI.VERSION = '1.0.11-bv1.0.11'; + root.mwUI.VERSION = '1.0.12-b430'; angular.module("mwUI").run(["$templateCache", function($templateCache) { 'use strict'; @@ -1592,18 +1592,24 @@ mwUI.Backbone.Filterable = function (collectionInstance, options) { return _sortOrder; }; - this.setFilters = function (filterMap) { + this.setFilters = function (filterMap, options) { + options = options || {}; _.forEach(filterMap, function (value, key) { if (_.has(this.filterValues, key)) { this.filterValues[key] = value; + var filterValue = {}; + filterValue[key] = value; + if(_.isUndefined(options.silent) || !options.silent){ + collectionInstance.trigger('change:filterValue', filterValue); + } } else { throw new Error('Filter named \'' + key + '\' not found, did you add it to filterValues of the model?'); } }, this); + this.setPage(1); this.filterIsSet = true; - }; this.getFilters = function () { @@ -1905,6 +1911,37 @@ mwUI.Backbone.Selectable.Collection = function (collectionInstance, options) { }; + this.setCollectionFromSelection = function (collection) { + var selected = this.getSelected(); + if (collection instanceof mwUI.Backbone.Collection) { + collection.replace(selected.toJSON()); + } else { + throw new Error('[Selectable] The passed collection is not an instance of mwUI.Backbone.Collection'); + } + return collection; + }; + + this.setModelFromSelection = function (model) { + var selected = this.getSelected(); + if (model instanceof Backbone.Model) { + if (selected.length === 0) { + model.clear(); + } else { + model.set(selected.first().toJSON()); + } + } else { + throw new Error('[Selectable] The passed model is not an instance of Backbone.Model'); + } + return model; + }; + + this.useSelectionFor = function (modelOrCollection) { + if (modelOrCollection instanceof Backbone.Model) { + return this.setModelFromSelection(modelOrCollection); + } else if(modelOrCollection instanceof Backbone.Collection){ + return this.setCollectionFromSelection(modelOrCollection); + } + }; var main = function () { if (!(_collection instanceof Backbone.Collection)) { @@ -3912,6 +3949,10 @@ angular.module('mwUI.List') var newOffset; var throttledScrollFn = _.throttle(function () { + if(!el.is(':visible')){ + return; + } + if (!newOffset) { var headerOffset, headerHeight, diff --git a/dist/mw-uikit.min.js b/dist/mw-uikit.min.js index de74d6c3..078764c4 100644 --- a/dist/mw-uikit.min.js +++ b/dist/mw-uikit.min.js @@ -1,4 +1,4 @@ -!function(a,b){"use strict";b.module("mwUI",["mwUI.Backbone","mwUI.ExceptionHandler","mwUI.Form","mwUI.Inputs","mwUI.i18n","mwUI.Layout","mwUI.List","mwUI.Menu","mwUI.Modal","mwUI.ResponseHandler","mwUI.Toast","mwUI.ResponseToastHandler","mwUI.Utils","mwUI.UiComponents"]).config(["i18nProvider","mwIconProvider",function(a,b){a.addLocale("de_DE","Deutsch","de_DE.json"),a.addLocale("en_US","English (US)","en_US.json"),b.addIconSet({id:"mwUI",classPrefix:"fa",iconsUrl:"uikit/mw_ui_icons.json"},!0)}]).run(["i18n",function(a){a.setLocale("en_US")}]),window.mCAP=window.mCAP||{},a.mwUI={},a.mwUI.VERSION="1.0.11-bv1.0.11",b.module("mwUI").run(["$templateCache",function(a){a.put("uikit/mw-exception-handler/modals/templates/mw_exception_modal.html",'

{{\'ExceptionHandler.mwExceptionModal.unknownError\' | i18n}}

{{exception}}

{{\'ExceptionHandler.mwExceptionModal.userMessage\' | i18n}}

{{\'ExceptionHandler.mwExceptionModal.thanks\' | i18n}}
'),a.put("uikit/mw-form/directives/templates/mw_checkbox_wrapper.html",'
'),a.put("uikit/mw-form/directives/templates/mw_error_messages.html",'
'),a.put("uikit/mw-form/directives/templates/mw_form_actions.html",'
'),a.put("uikit/mw-form/directives/templates/mw_input_wrapper.html","
'),a.put("uikit/mw-inputs/directives/templates/mw_checkbox_group.html",'
'),a.put("uikit/mw-inputs/directives/templates/mw_radio_group.html",'
'),a.put("uikit/mw-inputs/directives/templates/mw_select_box.html",''),a.put("uikit/mw-inputs/directives/templates/mw_toggle.html",'
'),a.put("uikit/mw-layout/directives/templates/mw_footer.html",''),a.put("uikit/mw-layout/directives/templates/mw_header.html",'

{{title}}

'),a.put("uikit/mw-layout/directives/templates/mw_sidebar.html",'
'),a.put("uikit/mw-layout/directives/templates/mw_sub_nav.html",'
'),a.put("uikit/mw-layout/directives/templates/mw_sub_nav_pill.html",'
  • '),a.put("uikit/mw-layout/directives/templates/mw_ui.html",'
    '),a.put("uikit/mw-list/directives/templates/mw_list_body_row_checkbox.html",' '),a.put("uikit/mw-list/directives/templates/mw_list_footer.html",'

    {{ \'List.mwListFooter.noneFound\' | i18n }}

    '),a.put("uikit/mw-list/directives/templates/mw_list_head.html",'
    {{\'List.mwListHead.notAvailable\' | i18n}} {{getModelAttribute(item)}}
    '),a.put("uikit/mw-list/directives/templates/mw_list_header.html",' '),a.put("uikit/mw-menu/directives/templates/mw_menu_divider.html",'
    '),a.put("uikit/mw-menu/directives/templates/mw_menu_entry.html",'
    '),a.put("uikit/mw-menu/directives/templates/mw_menu_top_bar.html",''),a.put("uikit/mw-menu/directives/templates/mw_menu_top_drop_down_item.html",''),a.put("uikit/mw-menu/directives/templates/mw_menu_top_entries.html",''),a.put("uikit/mw-menu/directives/templates/mw_menu_top_item.html",'
    {{entry.get(\'label\')}}
    '),a.put("uikit/mw-menu/directives/templates/mw_sidebar_menu.html",'
    '),a.put("uikit/mw-modal/directives/templates/mw_modal.html",''),a.put("uikit/mw-modal/directives/templates/mw_modal_body.html",''),a.put("uikit/mw-modal/directives/templates/mw_modal_confirm.html",'
    '),a.put("uikit/mw-modal/directives/templates/mw_modal_footer.html",''),a.put("uikit/mw-toast/directives/templates/mw_toasts.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_alert.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_arrow_link.html",''),a.put("uikit/mw-ui-components/directives/templates/mw_badge.html",''),a.put("uikit/mw-ui-components/directives/templates/mw_bread_crumb.html",'
    {{title}}
    '),a.put("uikit/mw-ui-components/directives/templates/mw_bread_crumbs_holder.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_collapsible.html",'
    {{title}}
    '),a.put("uikit/mw-ui-components/directives/templates/mw_hide_on_request.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_icon.html",' '),a.put("uikit/mw-ui-components/directives/templates/mw_indefinite_loading.html",'
    {{\'UiComponents.mwIndefiniteLoading.loading\' | i18n | uppercase}}
    '),a.put("uikit/mw-ui-components/directives/templates/mw_option_group.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_panel.html",'

    {{title}}

    '),a.put("uikit/mw-ui-components/directives/templates/mw_spinner.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_star_rating.html",''),a.put("uikit/mw-ui-components/directives/templates/mw_tab_bar.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_tab_pane.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_text_collapsible.html",'
    {{ text() }} {{ showLessOrMore() | i18n }}
    '),a.put("uikit/mw-ui-components/directives/templates/mw_timeline.html",'

    '),a.put("uikit/mw-ui-components/directives/templates/mw_timeline_entry.html",'
  • '),a.put("uikit/mw-ui-components/directives/templates/mw_timeline_fieldset.html",'
    {{mwTitle}}
    {{ hiddenEntriesText() | i18n:{count:entries.length} }}
    '),a.put("uikit/mw-ui-components/directives/templates/mw_view_change_loader.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_wizard.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_wizard_navigation.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_wizard_progress.html",'
    '),a.put("uikit/mw-ui-components/directives/templates/mw_wizard_step.html",'
    '),a.put("uikit/mw-utils/modals/templates/mw_leave_confirmation_modal.html",'

    {{ text }}

    '),a.put("uikit/templates/mwSidebarBb/mwSidebarInput.html",'
    '),a.put("uikit/mw-exception-handler/i18n/de_DE.json",'{ "ExceptionHandler": { "mwExceptionModal": { "title": "Es ist etwas schiefgelaufen", "unknownError": "Leider ist ein unvorhergesehener Fehler aufgetreten. Sie können uns einen Fehlerbericht senden, sodass wir diesen schnellst möglich beseitigen können. Vielen Dank.", "userMessage": "Sie können uns zusätzlich ihre letzten Schritte beschreiben, sodass wir den Fehler schneller nachstellen können.", "userMessagePlaceholder": "(Optional)", "report": "Fehler melden", "thanks": "Vielen Dank für Ihre Rückmeldung. Wir werden uns umgehend um diesen Fehler kümmern." } } }'),a.put("uikit/mw-exception-handler/i18n/en_US.json",'{ "ExceptionHandler": { "mwExceptionModal": { "title": "Something went wrong", "unknownError": "Unfortunatly something went wrong. You can report this error so we can fix it. Thank you.", "userMessage": "You can leave some additional information to make it easier for us to reproduce the error", "userMessagePlaceholder": "(Optional)", "report": "Report error", "thanks": "Thanks for your feedback. We will have a look at this error as soon as possible." } } }'),a.put("uikit/mw-form/i18n/de_DE.json",'{ "mwForm": { "leaveConfirmation": "Ihre Änderungen wurden noch nicht gespeichert. Wenn Sie diese Seite verlassen gehen diese verloren!", "formActions": { "save": "Speichern", "cancel": "Abbrechen" } }, "mwErrorMessages": { "required": "ist ein Pflichtfeld", "hasToBeValidEmail": "muss eine valide E-Mail Adresse sein", "hasToMatchPattern": "muss dem Muster entsprechen", "hasToBeValidUrl": "muss eine valide URL sein", "hasToBeValidPhoneNumber": "muss eine gültige Telefonnummer sein", "hasToBeMin": "muss mindestens {{min}} sein", "hasToBeMinLength": "muss mindestens {{ngMinlength}} Zeichen haben", "hasToBeSmaller": "darf maximal {{max}} sein", "hasToBeSmallerLength": "darf maximal {{ngMaxlength}} Zeichen haben" } }'),a.put("uikit/mw-form/i18n/en_US.json",'{ "mwForm": { "leaveConfirmation": "Your changes haven\'t been saved yet. If you leave this page all changes will be discarded!", "formActions": { "save": "Save", "cancel": "Cancel" } }, "mwErrorMessages": { "required": "is required", "hasToBeValidEmail": "has to be a valid e-mail", "hasToMatchPattern": "has to match the pattern", "hasToBeValidUrl": "has to be a valid URL", "hasToBeValidPhoneNumber": "has to be a valid phone number", "hasToBeMin": "has to be at least {{min}}", "hasToBeMinLength": "has to have a least {{ngMinlength}} chars", "hasToBeSmaller": "must not be greater than {{max}}", "hasToBeSmallerLength": "must not have more chars than {{ngMaxlength}}" } }'),a.put("uikit/mw-inputs/i18n/de_DE.json",'{ "mwSelectBox": { "pleaseSelect": "Option auswählen" } }'),a.put("uikit/mw-inputs/i18n/en_US.json",'{ "mwSelectBox": { "pleaseSelect": "Select an option" } }'),a.put("uikit/mw-list/i18n/de_DE.json",'{ "List": { "mwListHead": { "items": "Einträge", "selectAll": "Alle selektieren", "clearSelection": "Selektion aufheben", "itemSelected": "{{name}} ist selektiert", "itemsSelected": "{{count}} {{name}} sind selektiert", "itemAmount": "{{count}} {{name}}", "searchFor": "{{name}} suchen", "notAvailable": "N/V", "notAvailableTooltip": "Der Eintrag ist nicht verfügbar. Eventuell wurde dieser gelöscht." }, "mwListFooter": { "noneFound": "Es wurden keine Einträge gefunden" } } }'),a.put("uikit/mw-list/i18n/en_US.json",'{ "List": { "mwListHead": { "items": "Items", "selectAll": "Select all", "clearSelection": "Clear selection", "itemSelected": "{{name}} is selected", "itemsSelected": "{{count}} {{name}} are selected", "itemAmount": "{{count}} {{name}}", "searchFor": "Search for {{name}}", "notAvailable": "N/V", "notAvailableTooltip": "The entry is not available anymore. Maybe is has been deleted." }, "mwListFooter": { "noneFound": "No entries have been found." } } }'),a.put("uikit/mw-modal/i18n/de_DE.json",'{ "Modal": { "mwModalConfirm": { "areYouSure": "Sind Sie sich sicher?" } } }'),a.put("uikit/mw-modal/i18n/en_US.json",'{ "Modal": { "mwModalConfirm": { "areYouSure": "Are you sure?" } } }'),a.put("uikit/mw-ui-components/i18n/de_DE.json",'{ "UiComponents": { "mwToggle": { "on": "An", "off": "Aus" }, "mwTimelineFieldset": { "entriesHiddenSingular": "1 Eintrag ist ausgeblendet", "entriesHiddenPlural": "{{count}} Einträge sind ausgeblendet" }, "mwTextCollapsible": { "showMore": "mehr anzeigen", "showLess": "weniger anzeigen" }, "mwButtonHelp": { "isDisabledBecause": "Dieser Button ist deaktiviert weil:" }, "mwIndefiniteLoading": { "loading": "Lade Daten..." } } }'),a.put("uikit/mw-ui-components/i18n/en_US.json",'{ "UiComponents": { "mwToggle": { "on": "On", "off": "Off" }, "mwTimelineFieldset": { "entriesHiddenSingular": "One entry is hidden", "entriesHiddenPlural": "{{count}} entries are hidden" }, "mwTextCollapsable": { "showMore": "show more", "showLess": "show less" }, "mwButtonHelp": { "isDisabledBecause": "This button is currently disabled because:" }, "mwIndefiniteLoading": { "loading": "Loading data..." } } }'),a.put("uikit/mw-utils/i18n/de_DE.json",'{ "Utils": { "ok": "Ok", "cancel": "Abbrechen", "mwLeaveConfirmationModal": { "title": "Möchten Sie wirklich die aktuelle Seite verlassen?", "continue": "Fortfahren", "stay": "Auf Seite bleiben" } } }'),a.put("uikit/mw-utils/i18n/en_US.json",'{ "Utils": { "ok": "Ok", "cancel": "Cancel", "mwLeaveConfirmationModal": { "title": "Do you really want to leave the current page?", "continue": "Continue", "stay": "Stay on this page" } } }'),a.put("uikit/mw_ui_icons.json",'{ "check": "fa-check", "angleLeft": "fa-angle-left", "angleRight": "fa-angle-right", "angleUp": "fa-angle-up", "angleDown": "fa-angle-down", "caretRight": "fa-caret-right", "sort": "fa-sort", "sortAsc": "fa-sort-asc", "sortDesc": "fa-sort-desc", "warning": "fa-warning", "cross": "fa-times", "chevronUpCircle": "fa-chevron-circle-up", "chevronDownCircle": "fa-chevron-circle-down", "question": "fa-question", "questionCircle": "fa-question-circle-o" }')}]),b.module("mwUI.Utils",["mwUI.i18n","mwUI.Modal"]),window.mwUI.Utils={},window.mwUI.Utils.shims={},b.module("mwUI.Utils").directive("mwAppendRouteClass",function(){return{link:function(a,b){ -var c=b.attr("class"),d=function(){b.attr("class",c)};a.$on("$routeChangeSuccess",function(a,c){d(),c&&c.cssClasses&&b.addClass(c.cssClasses)})}}}),b.module("mwUI.Utils").directive("mwDraggable",["$timeout",function(a){return{restrict:"A",scope:{mwDragData:"=",mwDragstart:"&",mwDragend:"&",mwDropEffect:"@"},link:function(b,c){c.attr("draggable",!0),c.addClass("draggable",!0),b.mwDragstart&&c.on("dragstart",function(c){c.originalEvent.dataTransfer.setData("text",JSON.stringify(b.mwDragData)),c.originalEvent.dataTransfer.effectAllowed=b.mwDropEffect,a(function(){b.mwDragstart({event:c,dragData:b.mwDragData})})}),c.on("dragend",function(c){b.mwDragend&&a(function(){b.mwDragend({event:c})})})}}}]),b.module("mwUI.Utils").directive("mwDroppable",["$timeout",function(a){return{restrict:"A",scope:{mwDropData:"=",mwDragenter:"&",mwDragleave:"&",mwDragover:"&",mwDrop:"&",disableDrop:"="},link:function(b,c){c.addClass("droppable");var d=function(a){var b=a.originalEvent.dataTransfer.getData("text");return b?JSON.parse(b):void 0};b.mwDragenter&&c.on("dragenter",function(d){b.disableDrop!==!0&&c.addClass("drag-over"),a(function(){b.mwDragenter({event:d})})}),b.mwDragleave&&c.on("dragleave",function(d){c.removeClass("drag-over"),a(function(){b.mwDragleave({event:d})})}),b.mwDrop&&c.on("drop",function(e){c.removeClass("drag-over"),e.stopPropagation&&e.stopPropagation();var f=d(e);return a(function(){b.mwDrop({event:e,dragData:f,dropData:b.mwDropData})}),!1});var e=function(a){return b.disableDrop!==!0?(a.preventDefault&&a.preventDefault(),!1):void 0};c.on("dragover",e),b.mwDragover&&c.on("dragover",function(c){a(function(){b.mwDragover({event:c})})}),b.$on("$destroy",function(){c.off()})}}}]),b.module("mwUI.Utils").directive("mwInfiniteScroll",["$window",function(a){return{restrict:"A",link:function(c,d,e){var f,g,h,i,j=!1,k=0;if(e.mwListCollection?f=c.$eval(e.mwListCollection).getCollection():e.collection?f=c.$eval(e.collection):console.warn("No collection was found for the infinite scroll pleas pass it as scope attribute"),f&&(!f||f.filterable)){var l=function(){return!j&&f.filterable.hasNextPage()?(j=!0,k++,f.filterable.loadNextPage().then(function(){j=!1})):void 0},m=function(){var a=4,b=9;return Math.min(a+k,b)/10},n=function(){var a=i[0].clientHeight||i.height(),b=a-h.height(),c=m();h.scrollTop()/b>c&&l()};if(e.scrollContainerSelector||e.scrollContentSelector){if(e.scrollContainerSelector&&d.parents(e.scrollContainerSelector).length>0)h=d.parents(e.scrollContainerSelector).first();else{if(e.scrollContainerSelector&&0===d.parents(e.scrollContainerSelector).length)throw new Error("No parent of the infinite scroll element with the selector "+e.scrollContainerSelector+" could be found!");h=d}if(e.scrollContentSelector&&d.find(e.scrollContentSelector).length>0)i=d.find(e.scrollContentSelector).first();else{if(e.scrollContentSelector&&0===d.find(e.scrollContentSelector).length)throw new Error("No child of the infinite scroll element with the selector "+e.scrollContentSelector+" could be found!");i=d}}else d.parents(".modal").length?(h=d.parents("*[mw-modal-body]"),i=d.parents(".modal-body")):(h=b.element(a),i=b.element(document));if(h===i)throw new Error("The scrollContainerElement can not be the same as the actual scrollContentElement");g=_.throttle(n,500),h.on("scroll",g),c.$on("$destroy",function(){h.off("scroll",g)})}}}}]),b.module("mwUI.Utils").directive("mwLeaveConfirmation",["$window","$rootScope","LeaveConfirmationModal",function(a,c,d){return{scope:{alertBeforeLeave:"=mwLeaveConfirmation",text:"@"},link:function(e){var f=new d,g=function(a){f.setScopeAttributes({nextUrl:a,text:e.text,leaveCallback:function(){e.changeLocationOff()},stayCallback:function(){}}),f.show()};if(e.changeLocationOff=c.$on("$locationChangeStart",function(a,b){e.alertBeforeLeave&&(a.preventDefault(),g(b))}),a.onbeforeunload=function(){return e.alertBeforeLeave?e.text:void 0},!b.isDefined(e.text))throw new Error("Please specify a text in the text attribute");e.$on("$destroy",e.changeLocationOff)}}}]),b.module("mwUI.Utils").directive("mwPreventDefault",function(){return{restrict:"A",link:function(a,b,c){if(!c.mwPreventDefault)throw new Error('Directive mwPreventDefault: This directive must have an event name as attribute e.g. mw-prevent-default="click"');b.on(c.mwPreventDefault,function(a){a.preventDefault()})}}}),b.module("mwUI.Utils").directive("mwStopPropagation",function(){return{restrict:"A",link:function(a,b,c){if(!c.mwStopPropagation)throw new Error('Directive mwStopPropagation: This directive must have an event name as attribute e.g. mw-stop-propagation="keyup"');b.on(c.mwStopPropagation,function(a){a.stopPropagation()})}}}),b.module("mwUI.Utils").filter("reduceStringTo",function(){return function(a,b){return b&&a&&a.length>b?a.substr(0,b)+"...":a}}),b.module("mwUI.Utils").factory("LeaveConfirmationModal",["Modal",function(a){return a.prepare({templateUrl:"uikit/mw-utils/modals/templates/mw_leave_confirmation_modal.html",controller:"LeaveConfirmationModalController"})}]).controller("LeaveConfirmationModalController",["$scope",function(a){a.stay=function(){a.stayCallback(),a.hideModal()},a["continue"]=function(){if(!a.nextUrl)throw new Error("NextUrl has to be set!");a.leaveCallback(),a.hideModal().then(function(){document.location.href=a.nextUrl})}}]),b.module("mwUI.Utils").provider("BrowserTitleHandler",function(){var a=!0,c="",d=null,e=function(){var a=b.element("head title");a&&!d&&(d=a.text())};this.setNewTitle=function(a){var c=b.element("head title");c&&c.text(a),d||(d=a)},this.setKeepOriginalTitle=function(b){a=b};var f=this;this.$get=function(){return{getOriginalTitle:function(){return d||e(),d},setTitle:function(a){c=a,f.setNewTitle(this.getTitle())},getTitle:function(){return c?a?this.getOriginalTitle()+"—"+c:c:this.getOriginalTitle()}}}}),b.module("mwUI.Utils").service("callbackHandler",["$injector",function(a){return{execFn:function(a,c,d){return c&&b.isArray(c)?a.apply(d,c):a.call(d,c)},getFn:function(c){if(b.isString(c))return a.get(c);if(b.isFunction(c))return c;throw new Error("First argument has to be either a valid service or function")},exec:function(a,b,c){return this.execFn(this.getFn(a),b,c)}}}]);var c=function(a,b){for(var d in b)if(d in a&&_.isObject(a[d])&&_.isObject(b[d]))c(a[d],b[d]);else{if(_.isObject(a[d])&&!_.isObject(b[d]))throw new Error("Target["+d+"] is an object but source["+d+"] is from type "+typeof b[d]+"! You can not overwrite an object with type "+typeof b[d]);a[d]=b[d]}return a};window.mwUI.Utils.shims.deepExtendObject=c,window.mwUI.Utils.shims.domObserver=function(a,c,d){var e=new MutationObserver(function(a){c.call(this,a)}),f=a instanceof b.element?a[0]:a;return d=d||{attributes:!0,childList:!0,characterData:!0},e.observe(f,d),e},window.mwUI.Utils.shims.routeToRegExp=function(a){var b=/\((.*?)\)/g,c=/(\(\?)?:\w+/g,d=/\*\w?/g,e=/[\-{}\[\]+?.,\\\^$|#\s]/g;if(!_.isString(a))throw new Error("The route "+JSON.stringify(a)+"has to be a URL");return a=a.replace(e,"\\$&").replace(b,"(?:$1)?").replace(c,function(a,b){return b?a:"([^/?]+)"}).replace(d,"([^?]*?)"),new RegExp("^"+a+"(?:\\?([\\s\\S]*))?$")};var d=[],e=function(a){-1===d.indexOf(a)&&(console.warn(a),d.push(a))};window.mwUI.Utils.shims.deprecationWarning=e,b.module("mwUI.Utils").config(["i18nProvider",function(a){a.addResource("mw-utils/i18n","uikit")}]),window.mwUI.Backbone={hostName:"",basePath:"",Selectable:{},Utils:{},use$http:!0},b.module("mwUI.Backbone",[]),mwUI.Backbone.Utils.concatUrlParts=function(){var a=_.toArray(arguments),b=[];return a=_.compact(a),_.each(a,function(a,c){a=0===c?a.replace(/\/$/g,""):a.replace(/^\/|\/$/g,""),b.push(a)}),b.join("/")},mwUI.Backbone.Utils.getUrl=function(a){var b,c,d;if(!(a instanceof mwUI.Backbone.Model||a instanceof mwUI.Backbone.Collection))throw new Error("An instance of a collection or a model has to be passed as argument to the function");if(b=_.result(a,"hostName")||"",c=_.result(a,"basePath")||"",d=_.result(a,"endpoint"),!d||0===d.length)throw new Error("An endpoint has to be specified");return window.mwUI.Backbone.Utils.concatUrlParts(b,c,d)},mwUI.Backbone.Utils.request=function(a,b,c,d){c=c||{};var e,f={url:a,type:b};return d&&(f.instance=d),a&&!a.match(/\/\//)&&(e=d instanceof mwUI.Backbone.Model||d instanceof mwUI.Backbone.Collection?_.result(d,"hostName"):mwUI.Backbone.hostName||"",f.url=mwUI.Backbone.Utils.concatUrlParts(e,a)),Backbone.ajax(_.extend(f,c))},mwUI.Backbone.NestedModel=Backbone.NestedModel=Backbone.Model.extend({nested:function(){return{}},_prepare:function(){var a=this.nested(),b={};for(var c in a){if("function"!=typeof a[c])throw new Error("Nested attribute "+c+" is not a valid constructor. Do not set an instance as nested attribute.");var d=new a[c];d.parent=this,b[c]=d}return b},_setNestedModel:function(a,b){if(_.isObject(b))this.get(a).set(b);else{var c=this.get(a).idAttribute;this.get(a).set(c,b)}},_setNestedCollection:function(a,b){if(_.isObject(b)&&!_.isArray(b))this.get(a).add(b);else if(_.isArray(b))b.forEach(function(b){this._setNestedCollection(a,b)}.bind(this));else{var c=this.get(a).model.prototype.idAttribute,d={};d[c]=b,this.get(a).add(d)}},_setNestedAttributes:function(a){for(var b in a){var c=this.nested(),d=a[b],e=c[b];!e||d instanceof e||!this.get(b)||(this.get(b)instanceof Backbone.Model?this._setNestedModel(b,d):this.get(b)instanceof Backbone.Collection&&this._setNestedCollection(b,d),delete a[b])}return a},_nestedModelToJson:function(a){var b;return b=a instanceof Backbone.NestedModel?a._prepareDataForServer():a.toJSON()},_prepareDataForServer:function(){var a=_.extend({},this.attributes),b=this.nested();for(var c in b){var d=this.get(c);if(d instanceof Backbone.Model)a[c]=this._nestedModelToJson(d);else if(d instanceof Backbone.Collection){var e=[];d.each(function(a){e.push(this._nestedModelToJson(a))}.bind(this)),a[c]=e}}return this.compose(a)},constructor:function(a,b){return b=b||{},b.parse&&(a=this.parse(a),b.parse=!1),this.attributes=this._prepare(),this.set(a),a=this.attributes,Backbone.Model.prototype.constructor.call(this,a,b)},set:function(a,b){var c={};return _.isString(a)?c[a]=b:_.isObject(a)&&(c=a),_.isObject(b)||(b=null),c=this._setNestedAttributes(c),Backbone.Model.prototype.set.call(this,c,b)},compose:function(a){return a},toJSON:function(a){return a?this._prepareDataForServer():Backbone.Model.prototype.toJSON.apply(this,arguments)},clear:function(a){var b={};for(var c in this.attributes)this.get(c)instanceof Backbone.Model?this.get(c).clear():this.get(c)instanceof Backbone.Collection?this.get(c).reset():b[c]=void 0;return this.set(b,_.extend({},a,{unset:!0}))}}),mwUI.Backbone.Selectable.Model=function(a,b){var c=a,d=b.selected||!1;this.isInCollection=!1,this.hasDisabledFn="function"==typeof b.isDisabled||!1,this.isDisabled=function(){return this.hasDisabledFn?b.isDisabled.apply(a,arguments):!1},this.isSelected=function(){return d},this.select=function(b){b=b||{},this.isDisabled()&&!b.force||this.isSelected()||(d=!0,b.silent||this.trigger("change change:select",a,this))},this.unSelect=function(b){b=b||{},this.isSelected()&&(d=!1,b.silent||this.trigger("change change:unselect",a,this))},this.toggleSelect=function(){this.isSelected()?this.unSelect():this.select()};var e=function(){if(!(c instanceof Backbone.Model))throw new Error("First parameter has to be the instance of a model")};e.call(this)},_.extend(mwUI.Backbone.Selectable.Model.prototype,Backbone.Events),mwUI.Backbone.SelectableModel=Backbone.SelectableModel=Backbone.Model.extend({selectable:!0,selectableOptions:function(){return{selected:!1,isDisabled:null}},selectableModelConstructor:function(a){this.selectable&&(this.selectable=new mwUI.Backbone.Selectable.Model(this,this.selectableOptions.call(this,a))),this.on("destroy",function(){this.collection&&this.collection.filterable&&this.collection.filterable.getTotalAmount()>0&&this.collection.filterable.setTotalAmount(this.collection.filterable.getTotalAmount()-1)})},constructor:function(a,b){var c=Backbone.Model.prototype.constructor.call(this,a,b);return this.selectableModelConstructor(b),c}}),mwUI.Backbone.Model=mwUI.Backbone.NestedModel.extend({selectable:!0,hostName:function(){return mwUI.Backbone.hostName},basePath:function(){return mwUI.Backbone.basePath},endpoint:null,selectableOptions:mwUI.Backbone.SelectableModel.prototype.selectableOptions,urlRoot:function(){return mwUI.Backbone.Utils.getUrl(this)},constructor:function(){var a=mwUI.Backbone.NestedModel.prototype.constructor.apply(this,arguments);return mwUI.Backbone.SelectableModel.prototype.selectableModelConstructor.apply(this,arguments),a},getEndpoint:function(){return this.urlRoot()},setEndpoint:function(a){this.endpoint=a},sync:function(a,b,c){return c.instance=this,mwUI.Backbone.NestedModel.prototype.sync.call(this,a,b,c)},request:function(a,b,c){return mwUI.Backbone.Utils.request(a,b,c,this)}}),mwUI.Backbone.Filter=function(){var a=function(a,b){return _.isUndefined(a)||null===a||""===a||0===a.length||_.isArray(a)&&0===_.compact(a).length?null:b},b=function(b,c){var d=!1;if(!_.isObject(b))throw console.log(b),new Error("The argument values has to be an object");for(var e in b)a(b[e],!0)?d=!0:delete c[e];return d?c:null};return{containsString:function(b,c){return a(c,{type:"containsString",fieldName:b,contains:c})},string:function(b,c){return a(c,{type:"string",fieldName:b,value:c})},and:function(a){return this.logOp(a,"AND")},nand:function(a){return this.logOp(a,"NAND")},or:function(a){return this.logOp(a,"OR")},logOp:function(a,b){return a=_.without(a,null),0===a.length?null:{type:"logOp",operation:b,filters:a}},"boolean":function(b,c){return a(c,{type:"boolean",fieldName:b,value:c})},stringMap:function(b,c,d){return"%%"===d&&(d=""),a(d,{type:"stringMap",fieldName:b,value:d,key:c})},stringEnum:function(b,c){return a(c,{type:"stringEnum",fieldName:b,values:_.flatten(c)})},"long":function(b,c){return a(c,{type:"long",fieldName:b,value:c})},like:function(b,c){return a(c,{type:"like",fieldName:b,like:c})},notNull:function(b){return a(!0,{type:"null",fieldName:b})},dateRange:function(a,c,d){return c=c?+new Date(c):null,d=d?+new Date(d):null,b({min:c,max:d},{type:"dateRange",fieldName:a,min:c,max:d})},longRange:function(a,c,d){return b({min:c,max:d},{type:"longRange",fieldName:a,min:c,max:d})}}},mwUI.Backbone.Filterable=function(a,b){b=b||{};var c,d,e=a,f=b.limit,g=f?b.offset:!1,h=b.page||1,i=b.perPage||30,j=b.customUrlParams||{},k=b.filterValues||{},l=b.filterDefinition,m=b.sortOrder,n=function(a){return JSON.parse(JSON.stringify(a))};this.filterValues={},this.customUrlParams={},this.fields=b.fields,this.filterIsSet=!1,this.hasFilterChanged=function(a){return JSON.stringify(a)!==JSON.stringify(d)},this.getRequestParams=function(a){a=a||{},a.params=a.params||{};var b=this.getFilters();return b&&(a.params.filter=b),this.hasFilterChanged(b)&&(h=1),i&&h&&(f||_.isUndefined(f))&&(a.params.limit=i,a.params.offset=h>1?i*(h-1):0),m&&m.length>0&&(a.params.sortOrder=m),(f||g)&&(a.params.limit=f,a.params.offset=g),f===!1&&delete a.params.limit,this.fields&&this.fields.length>0&&(a.params.field=this.fields),this.customUrlParams&&_.extend(a.params,_.result(this,"customUrlParams")),a.params.getNonpagedCount=!0,d=b,a.params},this.getInitialFilterValues=function(){return k},this.setInitialFilterValues=function(a){for(var b in a)this.filterValues[b]===k[b]&&(this.filterValues[b]=a[b]);_.extend(k,a),this.filterValues=_.extend({},k,this.filterValues)},this.setLimit=function(a){f=a,g=g||0},this.setTotalAmount=function(a){c=a},this.getTotalAmount=function(){return c},this.loadPreviousPage=function(){return h-=1,e.fetch({remove:!1})},this.hasPreviousPage=function(){return h>=1},this.loadNextPage=function(){return h+=1,e.fetch({remove:!1})},this.hasNextPage=function(){return c&&c>e.length},this.getPage=function(){return h},this.setPage=function(a){h=a},this.getTotalPages=function(){return Math.floor(c/i)},this.setSortOrder=function(b){h=1,m=b,a.trigger("change:sortOrder",b)},this.getSortOrder=function(){return m},this.setFilters=function(a){_.forEach(a,function(a,b){if(!_.has(this.filterValues,b))throw new Error("Filter named '"+b+"' not found, did you add it to filterValues of the model?");this.filterValues[b]=a},this),this.filterIsSet=!0},this.getFilters=function(){return _.isFunction(l)?l.apply(this):void 0},this.resetFilters=function(){this.filterValues=n(k),this.customUrlParams=j,this.filterIsSet=!1},function(){if(!(e instanceof Backbone.Collection))throw new Error("First parameter has to be the instance of a collection");b.filterValues&&(k=n(b.filterValues)),this.resetFilters()}.bind(this)()},mwUI.Backbone.FilterableCollection=Backbone.FilterableCollection=Backbone.Collection.extend({selectable:!0,filterableOptions:function(){return{limit:void 0,offset:!1,page:1,perPage:30,filterValues:{},customUrlParams:{},filterDefinition:function(){},fields:[],sortOrder:""}},filterableCollectionConstructor:function(a){this.filterable&&(this.filterable=new mwUI.Backbone.Filterable(this,this.filterableOptions.call(this,a)))},constructor:function(a,b){var c=Backbone.Collection.prototype.constructor.call(this,a,b);return this.filterableCollectionConstructor(b),c},fetch:function(a){if(a=a||{},this.filterable){var b=this.filterable.getRequestParams(a);window.mwUI.Backbone.use$http?(a.params=a.params||{},_.extend(a.params,b)):(a.data=a.data||{},_.extend(a.data,b))}return Backbone.Collection.prototype.fetch.call(this,a)}}),mwUI.Backbone.Selectable.Collection=function(a,b){var c=a,d=b||{},e=!0,f=d.isSingleSelection||!1,g=d.addPreSelectedToCollection||!1,h=d.unSelectOnRemove,i=b.preSelected,j=!!b.preSelected,k=new(mwUI.Backbone.Collection.extend({selectable:!1,filterable:!1})),l=function(){if(i instanceof Backbone.Model)f=!0,this.preSelectModel(i);else{if(!(i instanceof Backbone.Collection))throw new Error("The option preSelected has to be either a Backbone Model or Collection");f=!1,this.preSelectCollection(i)}},m=function(a){k.get(a)||this.select(a)},n=function(a){k.get(a)&&this.unSelect(a)},o=function(a,b){b=b||{},(b.unset||!a.id||a.id.length<1)&&this.unSelect(a)},p=function(a){a.selectable.off("change:select",m,this),a.selectable.on("change:select",m,this)},q=function(a){a.selectable.off("change:unselect",n,this),a.selectable.on("change:unselect",n,this)},r=function(a,b){if(a&&a.selectable){var d=k.get(a);d?(c.get(a)?(a.selectable.isInCollection=!0,d.selectable.isInCollection=!0):(a.selectable.isInCollection=!1,d.selectable.isInCollection=!1),a.selectable.select(b),d.selectable.select(b)):a.selectable.unSelect(b),p.call(this,a),q.call(this,a)}},s=function(a,b){j&&(this.isSingleSelection()?i=b:(i.remove(a,{silent:!0}),i.add(b,{silent:!0})))},t=function(a){var b=this.getSelected().get(a);b&&(this.unSelect(b,{silent:!0}),this.select(a,{silent:!0}),s.call(this,b,a),r.call(this,b,{silent:!0}))};this.getSelected=function(){return k},this.getDisabled=function(){var a=new Backbone.Collection;return e&&c.each(function(b){b.selectable&&b.selectable.isDisabled()&&a.add(b)}),a},this.select=function(a,b){if(b=b||{},!(a instanceof Backbone.Model))throw new Error("The first argument has to be a Backbone Model");a instanceof c.model||(a=new c.model(a.toJSON())),!a.selectable||a.selectable.isDisabled()&&!b.force||(f&&this.unSelectAll(),c.get(a)&&(a=c.get(a)),a.on("change",o,this),k.add(a,b),r.call(this,a,b),b.silent||this.trigger("change change:add",a,this))},this.selectAll=function(){c.each(function(a){this.select(a)},this)},this.unSelect=function(a,b){b=b||{},a.off("change",o,this),k.remove(a,b),r.call(this,a,b),b.silent||this.trigger("change change:remove",a,this)},this.unSelectAll=function(){this.getSelected().secureEach(function(a){this.unSelect(a)},this)},this.toggleSelectAll=function(){this.allSelected()?this.unSelectAll():this.selectAll()},this.allSelected=function(){var a=this.getDisabled().length;return this.getSelected().length===c.length-a},this.allDisabled=function(){return this.getDisabled().length===c.length},this.isSingleSelection=function(){return f},this.reset=function(){this.unSelectAll(),l.call(this)},this.preSelectModel=function(a){a.id&&(j=!0,!c.get(a)&&g?c.add(a):c.get(a)&&(a=c.get(a)),this.select(a,{force:!0,silent:!0}))},this.preSelectCollection=function(a){a.each(function(a){this.preSelectModel(a)},this),a.on("add",function(a){this.preSelectModel(a)},this),a.on("remove",function(a){this.unSelect(a)},this)};var u=function(){if(!(c instanceof Backbone.Collection))throw new Error("The first parameter has to be from type Backbone.Collection");c.on("add",function(a){e=a.selectable.hasDisabledFn,r.call(this,a),t.call(this,a)},this),c.on("remove",function(a){h?this.unSelect(a):r.call(this,a)},this),c.on("reset",function(){h?this.unSelectAll():this.getSelected().each(function(a){r.call(this,a)},this)},this),j&&l.call(this)};u.call(this)},_.extend(mwUI.Backbone.Selectable.Collection.prototype,Backbone.Events),mwUI.Backbone.SelectableCollection=Backbone.SelectableCollection=Backbone.Collection.extend({selectable:!0,selectableOptions:function(){return{isSingleSelection:!1,addPreSelectedToCollection:!1,unSelectOnRemove:!1,preSelected:new Backbone.Collection}},selectableCollectionConstructor:function(a){this.selectable&&(this.selectable=new mwUI.Backbone.Selectable.Collection(this,this.selectableOptions.call(this,a)))},constructor:function(a,b){var c=Backbone.Collection.prototype.constructor.call(this,a,b);return this.selectableCollectionConstructor(b),c}}),mwUI.Backbone.Collection=Backbone.Collection.extend({selectable:!0,filterable:!0,hostName:function(){return mwUI.Backbone.hostName},basePath:function(){return mwUI.Backbone.basePath},endpoint:null,selectableOptions:mwUI.Backbone.SelectableCollection.prototype.selectableOptions,filterableOptions:mwUI.Backbone.FilterableCollection.prototype.filterableOptions,model:mwUI.Backbone.Model,secureEach:function(a,b){_.pluck(this.models,"cid").forEach(function(c,d){var e=this.get(c,d);a.call(b,e,d,this.models)}.bind(this))},url:function(){return window.mwUI.Backbone.Utils.getUrl(this)},getEndpoint:function(){return this.url()},setEndpoint:function(a){this.endpoint=a},replace:function(a){this.reset(a),this.trigger("replace",this)},constructor:function(){var a=Backbone.Collection.prototype.constructor.apply(this,arguments);return mwUI.Backbone.SelectableCollection.prototype.selectableCollectionConstructor.apply(this,arguments),mwUI.Backbone.FilterableCollection.prototype.filterableCollectionConstructor.apply(this,arguments),a},fetch:function(){return mwUI.Backbone.FilterableCollection.prototype.fetch.apply(this,arguments)},request:function(a,b,c){return window.mwUI.Backbone.Utils.request(a,b,c,this)}}),b.module("mwUI.Backbone").directive("mwCollection",function(){return{require:["?ngModel","?^form"],link:function(a,b,c,d){var e,f,g;d.length>0&&(f=d[0]),d.length>1&&(g=d[1]);var h=function(){e.length>0?(f.$setViewValue(e),f.$render()):(f.$setViewValue(null),f.$render())},i=function(){e=a.$eval(c.mwCollection),e&&(h(),e.on("add remove reset",h),f.$setPristine(),g&&g.$setPristine(f))};if(f)if(a.mwModel)i();else var j=a.$watch("mwCollection",function(){j(),i()})}}}),b.module("mwUI.Backbone").directive("mwModel",function(){return{require:["?ngModel","?^form"],link:function(a,c,d,e){var f,g,h,i;e.length>0&&(h=e[0]),e.length>1&&(i=e[1]);var j=function(){var a=f.get(g);h.$formatters.forEach(function(b){a=b(a)}),h.$setViewValue(a),h.$render()},k=function(){var a={};a[g]=h.$modelValue,f.set(a,{fromNgModel:!0})},l=function(){var a=d.mwModelAttr,c=d.ngModel;return a&&a.length>0?a:b.isUndefined(a)&&c?c.split(".").pop():void 0},m=function(){if(f=a.$eval(d.mwModel),g=l(),h&&f&&g){if(f.on("change:"+g,function(a,b,c){c.fromNgModel||j()}),h.$viewChangeListeners.push(k),h.$parsers.push(function(a){return k(),a}),f.get(g)&&h.$modelValue&&f.get(g)!==h.$modelValue)throw new Error("The ng-model and the backbone model can not have different values during initialization!");f.get(g)?(j(),h.$setPristine(),i&&i.$setPristine(h)):h.$modelValue&&k()}};if(a.mwModel&&l())m();else var n=a.$watch("mwModel",function(){n(),m()}),o=a.$watch("mwModelAttr",function(){o(),m()})}}});var f,g,h=Backbone.ajax,i=Backbone.sync;b.module("mwUI.Backbone").run(["$http","$q",function(a,b){f=a,g=b}]),Backbone.ajax=function(a){return mwUI.Backbone.use$http&&f?(a.method=a.type,f.apply(b,arguments).then(function(b){return a.success&&"function"==typeof a.success&&a.success(b),b},function(b){return a.error&&"function"==typeof a.error&&a.error(b),g.reject(b)})):h.apply(this,arguments)},Backbone.sync=function(a,b,c){return c=c||{},_.isUndefined(c.wait)&&(c.wait=!0),i.call(Backbone,a,b,c).then(function(){return b})},b.module("mwUI.ExceptionHandler",["mwUI.Modal","mwUI.i18n","mwUI.UiComponents","mwUI.Utils"]),b.module("mwUI.ExceptionHandler").factory("ExceptionModal",["Modal",function(a){return a.prepare({templateUrl:"uikit/mw-exception-handler/modals/templates/mw_exception_modal.html",controller:"ExceptionModalController"})}]).controller("ExceptionModalController",["$scope","$q","Wizard",function(a,b,c){a.exception=null,a.wizard=c.createWizard("exception"),a.report=function(){b.when(a.successCallback()).then(function(){a.wizard.next()})},a.cancel=function(){a.errorCallback?b.when(a.errorCallback()).then(function(){a.hideModal()}):a.hideModal()},a.close=function(){a.hideModal()}}]),b.module("mwUI.ExceptionHandler").provider("$exceptionHandler",function(){var a=[];return{registerHandler:function(b){a.push(b)},$get:["callbackHandler","$log",function(b,c){return function(d,e){d=d||"",e=e||"";try{a.forEach(function(a){b.exec(a,[d.toString(),e.toString()])})}catch(f){c.error(f)}c.error(d)}}]}}),b.module("mwUI.ExceptionHandler").provider("exceptionHandlerModal",function(){var a=!0,c={displayException:!1,userCanEnterMessage:!1,successCallback:null,errorCallback:null};return{disableExceptionModal:function(){a=!1},setModalOptions:function(a){_.extend(c,a)},$get:["callbackHandler","ExceptionModal",function(d,e){var f=new e,g=function(){var a=b.element.find("div[ng-view]");a&&b.element(a).hide()};return function(b,e){if(a){if(c.successCallback){var h=c.successCallback;c.successCallback=function(){return d.exec(h,[b.toString(),e.toString()])}}if(c.errorCallback){var i=c.errorCallback;c.errorCallback=function(){d.exec(i,[b.toString(),e.toString()])}}f.setScopeAttributes(_.extend({},c,{exception:b.toString(),cause:e})),g(),f.show()}}}]}}),b.module("mwUI.ExceptionHandler").config(["$exceptionHandlerProvider","i18nProvider",function(a,b){a.registerHandler("exceptionHandlerModal"),b.addResource("mw-exception-handler/i18n","uikit")}]),b.module("mwUI.Form",["mwUI.i18n","mwUI.Modal","mwUI.Utils"]),b.module("mwUI.Form").directive("mwFormActions",["$route",function(a){return{scope:{save:"&",cancel:"&",showSave:"=",showCancel:"="},templateUrl:"uikit/mw-form/directives/templates/mw_form_actions.html",link:function(c,d,e){c.form=d.inheritedData("$formController"),c.viewModel={isLoading:!1,hasSave:b.isDefined(e.save),hasCancel:b.isDefined(e.cancel),showSave:!0,showCancel:!0},c.$watch("showSave",function(a){b.isDefined(a)&&(c.viewModel.showSave=a)}),c.$watch("showCancel",function(a){b.isDefined(a)&&(c.viewModel.showCancel=a)});var f=function(){c.viewModel.isLoading=!0},g=function(){c.viewModel.isLoading=!1},h=function(a){c.form&&c.form.$setPristine();var b=c.$eval(a);b&&b.then&&(f(),b.then(g,g))};c.saveFacade=function(){h(c.save)},c.cancelFacade=function(){h(b.isDefined(e.cancel)?c.cancel:function(){return a.reload()})}}}}]),b.module("mwUI.Form").directive("mwErrorMessages",["mwValidationMessages",function(a){return{require:"^ngModelErrors",templateUrl:"uikit/mw-form/directives/templates/mw_error_messages.html",link:function(b,c,d,e){b.errors=e.getErrors,b.getMessageForError=function(b){return a.getMessageFor(b.get("error"),b.get("attrs"))}}}}]);var j=function(){return{restrict:"E",link:function(a,b){b.addClass("form-horizontal"),b.attr("novalidate","true")}}};b.module("mwUI.Form").directive("form",j),b.module("mwUI.Form").directive("mwFormLeaveConfirmation",["$compile",function(a){return{require:"^form",link:function(b,c,d,e){var f=a('
    ')(b),g=!0;b.showConfirmation=function(){return e.$dirty&&g},c.on("submit",function(){g=!1}),c.on("input",function(){g=!0}),c.append(f),b.$on("$destroy",function(){g=!1})}}}]),b.module("mwUI.Form").directive("mwCheckboxWrapper",function(){return{transclude:!0,scope:{label:"@",tooltip:"@"},templateUrl:"uikit/mw-form/directives/templates/mw_checkbox_wrapper.html"}}),b.module("mwUI.Form").directive("mwInputWrapper",function(){return{transclude:!0,scope:{label:"@",tooltip:"@",hideErrors:"="},templateUrl:"uikit/mw-form/directives/templates/mw_input_wrapper.html",controller:function(){var a={dirty:!0,valid:!0,touched:!1},c={required:!1,focused:!1},d="text",e=function(a,c){if(!b.isObject(c))throw new Error("State has to be an object");_.extend(a,c)};this.setModelState=function(b){e(a,b)},this.getModelState=function(){return a},this.setInputState=function(a){e(c,a)},this.getInputState=function(){return c},this.setType=function(a){d=a},this.getType=function(){return d}},link:function(a,b,c,d){a.isValid=function(){return d.getModelState().valid},a.isDirty=function(){return d.getModelState().dirty},a.isTouched=function(){return d.getModelState().touched},a.isRequired=function(){return d.getInputState().required},a.isFocused=function(){return d.getInputState().focused},a.hasError=function(){return!a.hideErrors&&!a.isValid()&&a.isDirty()},a.hasRequiredError=function(){return a.isRequired()&&!a.isValid()},a.getType=d.getType}}}),b.module("mwUI.Form").directive("ngModel",function(){return{require:["ngModel","?^ngModelErrors","?^mwInputWrapper"],link:function(a,c,d,e){var f=e[0],g=e[1],h=e[2],i=_.uniqueId("input_el"),j=function(a,b){var c=_.keys(a),e=_.keys(b),f=_.difference(e,c);g.addErrorsForInput(c,i,_.clone(d)),g.removeErrorsForInput(f,i,_.clone(d))},k=function(){h.setModelState({dirty:f.$dirty,valid:f.$valid,touched:f.$touched})},l=function(){a.$watch(function(){return f.$error},function(a,b){j(a,b)},!0)},m=function(){a.$watch(function(){return f.$error},k,!0),a.$watch(function(){return f.$touched},k),d.$observe("required",function(){h.setInputState({required:b.isDefined(c.attr("required"))})}),c.on("focus blur",function(a){h.setInputState({focused:"focus"===a.type})}),a.$on("$destroy",c.off.bind(c))};g&&l(),h&&m()}}}),b.module("mwUI.Form").directive("ngModelErrors",function(){return{scope:!0,controller:function(){var a=mwUI.Backbone.Model.extend({idAttribute:"error",nested:function(){return{inputIds:Backbone.Collection}}}),b=Backbone.Collection.extend({model:a}),c=new b,d=function(a,b,d){var e=c.get(a);if(e){var f=e.get("inputIds");_.extend(e.get("attrs"),d),f.add({id:b})}else c.add({error:a,inputIds:[b],attrs:d})},e=function(a,b){var d=c.get(a);if(d){var e=d.get("inputIds"),f=e.get(b);f&&(e.remove(f),0===e.length&&c.remove(d))}};this.addErrorsForInput=function(a,b,c){a.forEach(function(a){d(a,b,c)})},this.removeErrorsForInput=function(a,b){a.forEach(function(a){e(a,b)})},this.getErrors=function(){return c}}}}),b.module("mwUI.Form").provider("mwValidationMessages",function(){var a={},b={},c={},d=function(c,d){if("function"==typeof d)b[c]=d;else if("string"==typeof d)a[c]=d;else if(d)throw new Error("The validation has to be either a string or a function. String can be also a reference to i18n")};this.registerValidator=function(c,e){if(a[c]||b[c])throw new Error("The key "+c+" has already been registered");d(c,e)},this.$get=["$rootScope","i18n",function(e,f){var g=function(b,c){var d=a[b];return f.translationIsAvailable(d)?f.get(d,c):d},h=function(a,c){return b[a](f,c)};return{getRegisteredValidators:function(){return _.extend(a,c)},getMessageFor:function(c,d){return b[c]?h(c,d):a[c]?g(c,d):void 0},updateMessage:function(c,e){if(!a[c]&&!b[c])throw new Error("The key "+c+" is not available. You have to register it first via the provider"); -d(c,e)}}}]}),b.module("mwUI.Form").config(["i18nProvider","mwValidationMessagesProvider",function(a,b){a.addResource("mw-form/i18n","uikit"),b.registerValidator("required","mwErrorMessages.required"),b.registerValidator("email","mwErrorMessages.hasToBeValidEmail"),b.registerValidator("pattern","mwErrorMessages.hasToMatchPattern"),b.registerValidator("url","mwErrorMessages.hasToBeValidUrl"),b.registerValidator("phone","mwErrorMessages.hasToBeValidPhoneNumber"),b.registerValidator("min","mwErrorMessages.hasToBeMin"),b.registerValidator("minlength","mwErrorMessages.hasToBeMinLength"),b.registerValidator("max","mwErrorMessages.hasToBeSmaller"),b.registerValidator("maxlength","mwErrorMessages.hasToBeSmallerLength")}]),b.module("mwUI.i18n",["mwUI.Backbone"]),b.module("mwUI.i18n").provider("i18n",function(){var a=[],c=[],d={},e=!1,f=null,g=null,h=function(){return _.findWhere(c,{active:!0})},i=function(a){var b=h(),d=_.findWhere(c,{id:a});if(!d)throw new Error("You can not set a locale that has not been registered. Please register the locale first by calling addLocale()");b&&(b.active=!1),d.active=!0},j=function(a){var c=f||h();if(c&&d&&d[c.id]){var e=d[c.id];return b.forEach(a.split("."),function(a){e=e?e[a]:null}),e}return!1},k=function(a){var b;return _.each(c,function(c){!b&&a[c.id]&&(b=a[c.id])}),b||(b=_.values(a)[0]),b},l=function(a){for(var b,c=/{{\s*([a-zA-Z0-9$_]+)\s*}}/g,d=[];null!==(b=c.exec(a));)b.index===c.lastIndex&&c.lastIndex++,d.push(b[1]);return d},m=function(a,b){if(b){var c=l(a);c.forEach(function(c){var d=c.replace(/[$_]/g,"\\$&"),e=new RegExp("{{\\s*"+d+"\\s*}}");a=a.replace(e,b[c])})}return a};this.addLocale=function(a,b,e,f){e=e||a+".json";var h=_.findWhere(c,{id:a});h?(h.name=b,h.fileExtension=e,h.basePath=f):(c.push({id:a,name:b,active:a===g,basePath:f||"",fileExtension:e}),d[a]={})},this.addResource=function(b,c){c=c||"";var d=_.findWhere(a,{path:b});d?d.basePath=c:a.push({path:b,basePath:c})},this.setDefaultLocale=function(a){g=a,_.findWhere(c,{id:a})&&i(a)},this.$get=["$templateRequest","$q","$rootScope",function(l,n,o){return{_loadResource:function(b){var c=_.findWhere(a,{path:b}),e=this.getActiveLocale(),f="";return c&&e?(f=mwUI.Backbone.Utils.concatUrlParts(e.basePath,c.basePath,c.path,e.fileExtension),l(f).then(function(a){return _.extend(d[e.id],JSON.parse(a)),a})):n.reject("Resource not available or no locale has been set")},getLocales:function(){return c},getActiveLocale:function(){return h()},get:function(a,b){var c=j(a);return c?m(c,b):e?"...":"MISSING TRANSLATION "+this.getActiveLocale().id+": "+a},setLocale:function(b){var c=[];return o.$broadcast("i18n:loadResourcesStart"),e=!0,f=this.getActiveLocale(),i(b),_.each(a,function(a){c.push(this._loadResource(a.path))},this),n.all(c).then(function(){return e=!1,o.$broadcast("i18n:loadResourcesSuccess"),f=null,o.$broadcast("i18n:localeChanged",b),b})},translationIsAvailable:function(a){return!!j(a)},localize:function(a){var c=this.getActiveLocale(),d=a[c.id];return b.isDefined(d)&&""!==d?d:a[g]||k(a)},extendForLocale:function(a,b){if(!a)throw new Error("Locale is a required argument!");if(!_.isObject(b))throw new Error("The translations argument is of type "+typeof b+" but it has to be an object!");if(!_.findWhere(c,{id:a}))throw new Error("The locale "+a+" does not exist! Make sure you have registered it.");e||mwUI.Utils.shims.deepExtendObject(d[a],b),o.$on("i18n:loadResourcesSuccess",function(){mwUI.Utils.shims.deepExtendObject(d[a],b)})},extend:function(a){if(!_.isObject(a))throw new Error("The localesWithTranslations argument is from type "+typeof a+" but it has to be an object!");for(var b in a)this.extendForLocale(b,a[b])}}}]}),b.module("mwUI.i18n").filter("i18n",["i18n",function(a){function b(b,c){return _.isString(b)?a.get(b,c):_.isObject(b)?a.localize(b):void 0}return b.$stateful=!0,b}]),b.module("mwUI.Inputs",["mwUI.i18n","mwUI.Backbone"]),b.module("mwUI.Inputs").directive("input",function(){return{restrict:"E",link:function(a,c,d){var e=function(){var a=b.element(''),d=b.element(''),e=b.element('');c.wrap(a),d.insertAfter(c),e.insertAfter(d)},f=function(){a.$on("$destroy",function(){c.off(),c.parent(".mw-checkbox").remove()}),e()};"checkbox"===d.type&&f()}}}),b.module("mwUI.Inputs").directive("mwCheckboxGroup",["i18n",function(a){return{restrict:"A",scope:{mwCollection:"=",mwOptionsCollection:"=",mwOptionsLabelKey:"@",mwOptionsLabelI18nPrefix:"@",mwRequired:"=",mwDisabled:"="},templateUrl:"uikit/mw-inputs/directives/templates/mw_checkbox_group.html",link:function(b){var c=function(){return b.mwCollection.model.prototype.idAttribute};if(b.getLabel=function(c){var d=c.get(b.mwOptionsLabelKey);return d?b.mwOptionsLabelI18nPrefix?a.get(b.mwOptionsLabelI18nPrefix+"."+d):d:void 0},b.isOptionDisabled=function(a){return a.selectable.isDisabled()},b.isSelected=function(a){return!!b.mwCollection.get(a.get(c()))},b.toggleModel=function(a){var c=b.mwCollection.findWhere(a.toJSON());c?b.mwCollection.remove(c):b.mwCollection.add(a.toJSON())},!(b.mwCollection instanceof Backbone.Collection))throw new Error("[mwCheckboxGroup] The attribute mwCollection is required and has to be an instanceof Backbone Collection");if(!(b.mwOptionsCollection instanceof Backbone.Collection))throw new Error("[mwCheckboxGroup] The attribute mwOptionsCollection is required and has to be an instanceof Backbone Collection")}}}]);var k=function(){return{restrict:"E",require:"?^mwInputWrapper",link:function(a,b,c,d){var e=["radio","checkbox"];-1===e.indexOf(c.type)&&b.addClass("form-control"),d&&(c.type?d.setType(c.type):b[0].tagName&&d.setType(b[0].tagName.toLowerCase()))}}};b.module("mwUI.Inputs").directive("select",k).directive("input",k).directive("textarea",k),b.module("mwUI.Inputs").directive("input",function(){return{restrict:"E",link:function(a,c,d){var e=function(){var a=b.element(''),d=b.element(''),e=b.element('');c.wrap(a),d.insertAfter(c),e.insertAfter(d)},f=function(){a.$on("$destroy",function(){c.off(),c.parent(".mw-radio").remove()}),e()};"radio"===d.type&&f()}}}),b.module("mwUI.Inputs").directive("mwRadioGroup",["i18n",function(a){return{restrict:"A",scope:{mwModel:"=",mwModelAttr:"@",mwOptionsCollection:"=",mwOptionsKey:"@",mwOptionsLabelKey:"@",mwOptionsLabelI18nPrefix:"@",mwRequired:"=",mwDisabled:"="},templateUrl:"uikit/mw-inputs/directives/templates/mw_radio_group.html",link:function(b){b.radioGroupId=_.uniqueId("radio_");var c=function(a){b.mwModelAttr?b.mwModel.set(b.mwModelAttr,a.get(b.mwOptionsKey)):b.mwModel.set(a.toJSON())},d=function(){b.mwModelAttr?b.mwModel.unset(b.mwModelAttr):b.mwModel.clear()};if(b.getLabel=function(c){var d=c.get(b.mwOptionsLabelKey);return d?b.mwOptionsLabelI18nPrefix?a.get(b.mwOptionsLabelI18nPrefix+"."+d):d:void 0},b.isOptionDisabled=function(a){return a.selectable.isDisabled()},b.getModelAttribute=function(){return b.mwModelAttr||b.mwModel.idAttribute},b.isChecked=function(a){return b.mwModelAttr?a.get(b.mwOptionsKey)===b.mwModel.get(b.mwModelAttr):a.id===b.mwModel.id},b.selectOption=function(a){b.isChecked(a)?d():c(a)},b.mwModelAttr&&!b.mwOptionsKey)throw new Error("[mwRadioGroup] When using mwModelAttr the attribute mwOptionsKey is required!")}}}]),b.module("mwUI.Inputs").directive("select",function(){return{link:function(a,c){var d=b.element(''),e=function(){c.wrap(d),c.addClass("custom")};e()}}}),b.module("mwUI.Inputs").directive("mwSelectBox",["i18n",function(a){return{restrict:"A",scope:{mwModel:"=",mwModelAttr:"@",mwOptionsCollection:"=",mwOptionsKey:"@",mwOptionsLabelKey:"@",mwOptionsLabelI18nPrefix:"@",mwPlaceholder:"@",mwRequired:"=",mwDisabled:"="},templateUrl:"uikit/mw-inputs/directives/templates/mw_select_box.html",link:function(b){b.viewModel={};var c=function(a){b.mwModelAttr?b.mwModel.set(b.mwModelAttr,a.get(b.mwOptionsKey)):b.mwModel.set(a.toJSON())},d=function(){b.mwModelAttr?b.mwModel.unset(b.mwModelAttr):b.mwModel.clear()},e=function(){b.mwModel.id&&(b.viewModel.selected=b.mwModel.id.toString())},f=function(){b.mwOptionsCollection.each(function(a){if(!a.id)throw new Error("[mwSelectBox] Each model of the options collection must have an id. Make sure you set the correct model and modelId attribute!")})},g=function(){d(),b.viewModel.selected=null};if(b.getLabel=function(c){var d=c.get(b.mwOptionsLabelKey);return d?b.mwOptionsLabelI18nPrefix?a.get(b.mwOptionsLabelI18nPrefix+"."+d):d:void 0},b.hasPlaceholder=function(){return b.mwPlaceholder||b.mwRequired},b.getPlaceholder=function(){return b.mwPlaceholder?b.mwPlaceholder:b.mwRequired?a.get("mwSelectBox.pleaseSelect"):void 0},b.isOptionDisabled=function(a){return a.selectable.isDisabled()},b.getModelAttribute=function(){return b.mwModelAttr||b.mwModel.idAttribute},b.isChecked=function(a){return b.mwModelAttr&&b.mwModel instanceof Backbone.Model?a.get(b.mwOptionsKey)===b.mwModel.get(b.mwModelAttr):a.id===b.mwModel.id},b.select=function(a){a?b.selectOption(b.mwOptionsCollection.get(a)):g()},b.selectOption=function(a){b.isChecked(a)||c(a)},b.mwModel){if(!(b.mwModel instanceof Backbone.Model))throw new Error("[mwSelectBox] The attribute mw-model is from type "+typeof b.mwModel+" but has to be a Backbone Model!");b.mwModel.on("change:"+b.mwModel.idAttribute,e),e(),b.mwModel.on("change",function(a){(b.mwModelAttr&&!a.get(b.mwModelAttr)||!b.mwModelAttr&&!a.id)&&g()})}if(b.mwModelAttr&&!b.mwOptionsKey)throw new Error("[mwSelectBox] When using mwModelAttr the attribute mwOptionsKey is required!");if(!(b.mwOptionsCollection&&b.mwOptionsCollection instanceof Backbone.Collection))throw new Error("[mwSelectBox] An options collection is required. Make sure you set the attribute mw-options-collection and that it is a backbone collection!");f(),b.mwOptionsCollection.on("add",f)}}}]),b.module("mwUI.Inputs").directive("mwToggle",["$timeout",function(a){return{scope:{mwModel:"=",mwDisabled:"=",mwIconOn:"@",mwIconOff:"@",mwChange:"&"},replace:!0,templateUrl:"uikit/mw-inputs/directives/templates/mw_toggle.html",link:function(b){b.toggle=function(c){b.mwModel!==c&&(b.mwModel=!b.mwModel,a(function(){b.mwChange({value:b.mwModel})}))}}}}]),b.module("mwUI.Inputs").config(["i18nProvider",function(a){a.addResource("mw-inputs/i18n","uikit")}]),b.module("mwUI.Layout",["mwUI.Utils"]),b.module("mwUI.Layout").directive("mwUi",["Modal",function(a){return{transclude:!0,templateUrl:"uikit/mw-layout/directives/templates/mw_ui.html",link:function(b){b.displayToasts=function(){return 0===a.getOpenedModals().length}}}}]),b.module("mwUI.Layout").directive("mwHeader",["$rootScope","$route","$location","BrowserTitleHandler",function(a,b,c,d){return{transclude:!0,scope:{title:"@",url:"@",mwTitleIcon:"@",showBackButton:"=",mwBreadCrumbs:"="},templateUrl:"uikit/mw-layout/directives/templates/mw_header.html",link:function(e,f,g,h,i){a.siteTitleDetails=e.title,d.setTitle(e.title),i(function(a){a&&0!==a.length||e.showBackButton||f.find(".mw-header").addClass("no-buttons")}),e.refresh=function(){b.reload()},!e.url&&e.mwBreadCrumbs&&e.mwBreadCrumbs.length>0?(e.url=e.mwBreadCrumbs[e.mwBreadCrumbs.length-1].url,e.url=e.url.replace("#","")):!e.url&&e.showBackButton&&console.error("Url attribute in header is missing!!"),e.back=function(){c.path(e.url)}}}}]),b.module("mwUI.Layout").directive("mwSidebar",function(){return{transclude:!0,templateUrl:"uikit/mw-layout/directives/templates/mw_sidebar.html",link:function(a,c){var d=c.find(".mw-sidebar"),e=b.element(".mw-footer"),f=b.element(".mw-header"),g=b.element(".mw-menu-top-bar"),h=function(){var a=b.element(window).innerHeight(),c=a;f.length&&(c-=f.height()),g.length&&(c-=g.height()),e.length&&(c-=e.height()),d.css("maxHeight",c)},i=_.throttle(h,100);h(),b.element(window).on("resize",i)}}}),b.module("mwUI.Layout").directive("mwFooter",function(){return{transclude:!0,scope:{type:"@mwFooter"},templateUrl:"uikit/mw-layout/directives/templates/mw_footer.html"}}),b.module("mwUI.Layout").directive("mwSubNav",function(){return{restrict:"A",scope:{justified:"="},transclude:!0,replace:!0,templateUrl:"uikit/mw-layout/directives/templates/mw_sub_nav.html"}}),b.module("mwUI.Layout").directive("mwSubNavPill",["$location",function(a){return{restrict:"A",scope:{url:"@mwSubNavPill",mwDisabled:"="},transclude:!0,replace:!0,templateUrl:"uikit/mw-layout/directives/templates/mw_sub_nav_pill.html",link:function(b,c){var d=function(a){b.url&&a===b.url.slice(1)?c.addClass("active"):c.removeClass("active")};b.$watch("url",function(b){b&&d(a.$$path)}),b.navigate=function(c){b.mwDisabled||(c=c.replace(/#\//,""),a.path(c),a.replace())},d(a.$$path)}}}]),b.module("mwUI.List",["mwUI.i18n","mwUI.Backbone","mwUI.UiComponents"]),b.module("mwUI.List").directive("mwListableBb",function(){return{scope:{collection:"=",mwListCollection:"="},compile:function(a){return a.append(""),function(a,b){b.addClass("table table-striped mw-list")}},controller:["$scope",function(a){var b=a.columns=[],c=null,d=null;this.actionColumns=[],this.registerColumn=function(a){b.push(a)},this.unRegisterColumn=function(a){if(a&&a.$id){var c=_.findWhere(b,{$id:a.$id}),d=_.indexOf(b,c);d>-1&&b.splice(d,1)}},this.getColumns=function(){return b},this.getCollection=function(){return c},this.isSingleSelection=function(){return c&&c.selectable?c.selectable.isSingleSelection():!1},a.$on("$destroy",function(){this.actionColumns=[]}.bind(this)),a.mwListCollection?(c=a.mwListCollection.getCollection(),d=a.mwListCollection.getMwListCollectionFilter()):a.collection&&(c=a.collection)}]}}),b.module("mwUI.List").directive("mwListableBodyRowBb",["$timeout",function(a){return{require:"^mwListableBb",compile:function(c){return c.prepend(''),function(c,d,e,f){var g="selected";if(c.collection=f.getCollection(),!c.item)throw new Error('No item available in the list! Please make sure to use ng-repeat="item in collection"');c.item&&c.item.selectable&&!c.item.selectable.isDisabled()?d.addClass("selectable clickable"):f.actionColumns&&f.actionColumns.length>0&&d.addClass("clickable"),d.on("click",function(){c.item&&c.item.selectable&&!c.item.selectable.isDisabled()&&a(function(){c.item.selectable.toggleSelect()})}),d.on("dblclick",function(){if(f.actionColumns&&b.isNumber(c.$index)){var a=_.findWhere(f.actionColumns,{id:c.$index});a&&(document.location.href=a.link)}}),c.$watch("item.selectable.isSelected()",function(a){a?d.addClass(g):d.removeClass(g)})}}}}]),b.module("mwUI.List").directive("mwListBodyRowCheckbox",function(){return{restrict:"A",require:"^mwListableBb",scope:{item:"="},templateUrl:"uikit/mw-list/directives/templates/mw_list_body_row_checkbox.html",link:function(a,b,c,d){a.isSingleSelection=d.isSingleSelection(),a.click=function(a,b){b.stopPropagation(),a.selectable&&a.selectable.toggleSelect()},a.$watch("item.selectable.isDisabled()",function(b){b&&a.item.selectable.unSelect()})}}}),b.module("mwUI.List").directive("mwListableFooterBb",function(){return{require:"^mwListableBb",templateUrl:"uikit/mw-list/directives/templates/mw_list_footer.html",link:function(a,b,c,d){a.collection=d.getCollection(),a.columns=d.getColumns(),a.collection.on("request",function(){a.isSynchronising=!0}),a.collection.on("sync error",function(){a.isSynchronising=!1}),a.showSpinner=function(){return a.isSynchronising&&a.collection.filterable.hasNextPage()}}}}),b.module("mwUI.List").directive("mwListableHead2",["$window","$document","i18n",function(a,c,d){return{scope:{collection:"=",affix:"=",affixOffset:"=",collectionName:"@",nameFn:"&",nameAttribute:"@",localizeName:"@",nameI18nPrefix:"@",nameI18nSuffix:"@",searchAttribute:"@"},transclude:!0,templateUrl:"uikit/mw-list/directives/templates/mw_list_head.html",link:function(c,e,f,g,h){var i,j=b.element("body"),k=e.parents("*[mw-modal-body]"),l=b.element("*[mw-header]"),m=!1,n=b.isDefined(c.affix)?c.affix:!0,o=b.element(a);c.selectable=!1,c.selectedAmount=0,c.collectionName=c.collectionName||d.get("List.mwListHead.items"),c.isModal=k.length>0,c.isLoadingModelsNotInCollection=!1,c.hasFetchedModelsNotInCollection=!1,c.isLoadingModelsNotInCollection=!1,c.hasFetchedModelsNotInCollection=!1;var p,q=_.throttle(function(){if(!p){var a,b,d,f,g;if(c.isModal){var h=e.parents(".modal-content").find(".modal-header");a=h.offset().top,b=h.innerHeight(),g=0}else{if(!l.length)return;a=l.last().offset().top,b=l.last().innerHeight(),g=5}d=a+b,f=e.offset().top,p=f-d-g}var j=i.scrollTop();j>p&&n?(e.find(".mw-listable-header").css("top",j-p),e.addClass("affixed")):n?(e.find(".mw-listable-header").css("top","initial"),e.removeClass("affixed")):i.off("scroll",q)},10),r=_.throttle(function(){e.find(".mw-listable-header").css("top","initial"),p=null}),s=function(){if(!c.hasFetchedModelsNotInCollection){var a=[];if(c.selectable.getSelected().each(function(b){b.selectable.isInCollection||c.getModelAttribute(b)||a.push(b)}),0!==a.length){var b=c.collection.constructor.extend({filterableOptions:function(){return{filterDefinition:function(){var b=new window.mCAP.Filter,c=[];return a.forEach(function(a){a.id&&c.push(b.string(a.idAttribute,a.id))}),b.or(c)}}}}),d=new b;d.url=c.collection.url(),c.isLoadingModelsNotInCollection=!0,d.fetch().then(function(b){c.hasFetchedModelsNotInCollection=!0;var d=c.selectable.getSelected();b.each(function(a){d.get(a.id).set(a.toJSON())});var e=_.difference(_.pluck(a,"id"),b.pluck("uuid"));e.forEach(function(a){d.get(a).selectable.isDeletedItem=!0}),c.isLoadingModelsNotInCollection=!1})}}};c.showSelected=function(){m=!0,s(),setTimeout(function(){var d;c.isModal?(d=k.height()+(k.offset().top-e.find(".selected-items").offset().top)+25,k.css("overflow","hidden")):(d=b.element(a).height()-e.find(".selected-items").offset().top+i.scrollTop()-25,j.css("overflow","hidden")),e.find(".selected-items").css("height",d),e.find(".selected-items").css("bottom",-1*d)})},c.hideSelected=function(){c.isModal?k.css("overflow","auto"):j.css("overflow","inherit"),m=!1},c.canShowSelected=function(){return c.selectable&&m&&c.selectedAmount>0},c.unSelect=function(a){a.selectable.unSelect()},c.toggleSelectAll=function(){c.selectable.toggleSelectAll()},c.getTotalAmount=function(){return c.collection.filterable&&c.collection.filterable.getTotalAmount()?c.collection.filterable.getTotalAmount():c.collection.length},c.toggleShowSelected=function(){m?c.hideSelected():c.showSelected()},c.getModelAttribute=function(a){if(c.nameAttribute){var e=a.get(c.nameAttribute);if(c.nameI18nPrefix||c.nameI18nSuffix){var f=c.nameI18nPrefix||"",g=c.nameI18nSuffix||"";return d.get(f+"."+e+"."+g)}return b.isDefined(c.localizeName)?d.localize(e):e}return c.nameFn({item:a})};var t=function(){c.selectable=c.collection.selectable,i=c.isModal?k:o,i.on("scroll",q),i.on("resize",r),c.$on("$destroy",function(){i.off("scroll",q)}),c.$on("$destroy",function(){i.off("resize",r)}),e.on("focus","input[type=text]",function(){e.find(".search-bar").addClass("focused")}),e.on("blur","input[type=text]",function(){e.find(".search-bar").removeClass("focused")})};h(function(a){a&&a.length>0&&e.addClass("has-extra-content")}),c.$watch(function(){return c.selectable?c.selectable.getSelected().length:0},function(a){c.selectedAmount=a,1>a&&c.hideSelected()}),c.$watch("collection",function(a){a&&t()})}}}]),b.module("mwUI.List").directive("mwListableHeaderBb",function(){return{require:"^mwListableBb",scope:{property:"@sort"},transclude:!0,replace:!0,templateUrl:"uikit/mw-list/directives/templates/mw_list_header.html",link:function(a,c,d,e){var f="+",g="-",h=e.getCollection(),i=function(){return h&&h.filterable?h.filterable.getSortOrder():!1},j=function(a,b){var c=b+a;return h.filterable.setSortOrder(c),h.fetch()};a.canBeSorted=function(){return b.isString(a.property)&&a.property.length>0&&!!h.filterable},a.toggleSortOrder=function(){if(a.canBeSorted()){var b=f;i()===f+a.property&&(b=g),j(a.property,b)}},a.isSelected=function(b){var c=i();return c&&b?c===b+a.property:c&&!b?c==="+"+a.property||c==="-"+a.property:void 0},e.registerColumn(a),a.$on("$destroy",function(){e.unRegisterColumn(a)})}}}),b.module("mwUI.List").directive("mwListableHeaderRowBb",function(){return{require:"^mwListableBb",scope:!0,compile:function(a){return a.prepend(''),a.append(''),function(a,c,d,e){a.hasCollection=!1;var f=e.getCollection();f&&(a.hasCollection=b.isDefined(f.length)&&f.selectable),a.actionColumns=e.actionColumns}}}}),b.module("mwUI.List").directive("mwListableLinkShowBb",function(){return{restrict:"A",require:"^mwListableBb",template:'',link:function(a,b,c,d){var e=function(b){if(_.isNumber(a.$index)&&b){var c=_.findWhere(d.actionColumns,{id:a.$index});c?c.link=b:d.actionColumns.push({id:a.$index,link:b})}a.link=b},f=function(){if(a.$index){var b=_.findWhere(d.actionColumns,{id:a.$index});if(b){var c=_.indexOf(d.actionColumns,b);d.actionColumns.splice(c,1)}}};a.linkTarget=c.linkTarget,e(c.mwListableLinkShowBb),c.$observe("mwListableLinkShowBb",e),a.$on("$destroy",f)}}}),b.module("mwUI.List").config(["i18nProvider",function(a){a.addResource("mw-list/i18n","uikit")}]),b.module("mwUI.Menu",[]),window.mwUI.Menu={};var l=mwUI.Utils.shims.routeToRegExp,m=window.mwUI.Backbone.NestedModel.extend({idAttribute:"id",defaults:function(){return{url:null,label:null,icon:null,activeUrls:[],order:null}},nested:function(){return{subEntries:window.mwUI.Menu.MwMenuSubEntries}},_throwMissingIdError:function(a){throw new Error("No id is specified for the entry",a)},_throwNoTypeCouldBeDeterminedError:function(a){throw new Error("No type could be determinded for the given entry: ",a)},_throwNotValidEntryError:function(a){throw new Error("Is not a valid entry",a)},_determineType:function(a){return a.type||(a.url||a.subEntries&&0!==a.subEntries.length||a.label||a.icon?a.url||a.subEntries&&a.subEntries.length>0&&(a.label||a.icon)?a.type="ENTRY":this._throwNoTypeCouldBeDeterminedError():a.type="DIVIDER"),a},_missingLabel:function(a){return"ENTRY"===a.type&&!a.label&&!a.icon},_urlsAreMatching:function(a,b){return b.match("#")&&(b=b.split("#")[1]),a.match(l(b))},validate:function(a){a&&_.isObject(a)&&(a=this._determineType(a),a.id||this._throwMissingIdError(),this.isValidEntry(a)||this._throwNotValidEntryError(a))},set:function(a,b){return b=b||{},_.isUndefined(b.validate)&&this.validate(a),window.mwUI.Backbone.NestedModel.prototype.set.call(this,a,b)},isValidEntry:function(a){return a.type?!this._missingLabel(a):!1},ownUrlIsActiveForUrl:function(a){return this.get("url")?this._urlsAreMatching(a,this.get("url")):!1},activeUrlIsActiveForUrl:function(a){var b=!1;return this.get("activeUrls").forEach(function(c){b||(b=this._urlsAreMatching(a,c))}.bind(this)),b},isSubEntry:function(){return this.collection&&this.collection.parent?!0:!1},hasSubEntries:function(){return this.get("subEntries").length>0},isActiveForUrl:function(a){return this.ownUrlIsActiveForUrl(a)||this.activeUrlIsActiveForUrl(a)},getActiveSubEntryForUrl:function(a){return this.get("subEntries").getActiveEntryForUrl(a)},hasActiveSubEntryOrIsActiveForUrl:function(a){return"ENTRY"===this.get("type")&&(!!this.getActiveSubEntryForUrl(a)||this.isActiveForUrl(a))},constructor:function(a,b){return b=b||{},b.validate=a?!0:!1,window.mwUI.Backbone.NestedModel.prototype.constructor.call(this,a,b)}});window.mwUI.Menu.MwMenuEntry=m;var n=Backbone.Collection.extend({model:window.mwUI.Menu.MwMenuEntry,comparator:"order",_isAlreadyRegistered:function(a){return this.get(a.id)||a.url&&this.findWhere({url:a.url})},_throwIsAlreadyRegisteredError:function(a){throw a.url?new Error("The entry with the id "+a.id+" and the url "+a.url+" has already been registered"):new Error("The entry with the id "+a.id+" has already been registered")},add:function(a){return _.isArray(a)?a.forEach(function(a){this._isAlreadyRegistered(a)&&this._throwIsAlreadyRegisteredError(a)}.bind(this)):this._isAlreadyRegistered(a)&&this._throwIsAlreadyRegisteredError(a),Backbone.Collection.prototype.add.apply(this,arguments)},addEntry:function(a,b,c,d){d=d||{};var e={id:a,url:b,label:c,icon:d.icon,activeUrls:d.activeUrls||[],order:d.order,subEntries:d.subEntries||[],type:"ENTRY"};return this.add(e)},addDivider:function(a,b){b=b||{};var c={id:a,label:b.label,order:b.order,type:"DIVIDER"};return this.add(c)},getActiveEntryForUrl:function(a){var b=!1,c=null;return this.each(function(d){!b&&d.hasActiveSubEntryOrIsActiveForUrl(a)&&(b=!0,c=d)}),c}});window.mwUI.Menu.MwMenuEntries=n;var o=window.mwUI.Menu.MwMenuEntries.extend({});window.mwUI.Menu.MwMenuSubEntries=o;var p=window.mwUI.Menu.MwMenuEntries.extend({});window.mwUI.Menu.MwMenu=p,b.module("mwUI.Menu").directive("mwMenuTopBar",function(){return{transclude:{brand:"?img",entries:"?div"},templateUrl:"uikit/mw-menu/directives/templates/mw_menu_top_bar.html"}}),b.module("mwUI.Menu").directive("mwMenuTopEntries",["$rootScope","$timeout",function(a,b){return{scope:{menu:"=mwMenuTopEntries",right:"="},transclude:!0,templateUrl:"uikit/mw-menu/directives/templates/mw_menu_top_entries.html",controller:["$scope",function(a){var b=a.menu||new mwUI.Menu.MwMenu;this.getMenu=function(){return b}}],link:function(c,d,e,f){c.entries=f.getMenu(),c.unCollapse=function(){var a=d.find(".navbar-collapse");a.hasClass("in")&&a.collapse("hide")},a.$on("$locationChangeSuccess",function(){c.unCollapse()}),c.$on("mw-menu:triggerReorder",_.throttle(function(){b(function(){c.$broadcast("mw-menu:reorder")})})),c.$on("mw-menu:triggerResort",_.throttle(function(){b(function(){c.$broadcast("mw-menu:resort"),c.entries.sort()})})),c.entries.on("add remove reset",_.throttle(function(){b(function(){c.$broadcast("mw-menu:reorder")})}))}}}]),b.module("mwUI.Menu").directive("mwMenuTopDropDownItem",function(){return{scope:{entry:"=mwMenuTopDropDownItem"},templateUrl:"uikit/mw-menu/directives/templates/mw_menu_top_drop_down_item.html"}}),b.module("mwUI.Menu").directive("mwMenuTopItem",function(){return{scope:{entry:"=mwMenuTopItem"},templateUrl:"uikit/mw-menu/directives/templates/mw_menu_top_item.html",link:function(a){a.executeAction=function(){var b=a.entry.get("action");b&&"function"==typeof b&&b()}}}}),b.module("mwUI.Menu").directive("mwMenuEntry",["$timeout",function(a){return{scope:{id:"@",url:"@",icon:"@",label:"@",type:"@","class":"@styleClass",order:"=",activeUrls:"=",action:"&"},templateUrl:"uikit/mw-menu/directives/templates/mw_menu_entry.html",require:["mwMenuEntry","?^^mwMenuEntry","?^mwMenuTopEntries"],transclude:!0,controller:function(){var a;this.setMenuEntry=function(b){a=b},this.getMenuEntry=function(){return a}},link:function(b,c,d,e){var f,g=e[0],h=e[1],i=e[2],j=new mwUI.Menu.MwMenuEntry,k=function(){for(var a=c;;){if(0!==a.parent(".mw-menu-entry").length||0!==a.parent(".mw-menu-entries").length)break;a=a.parent()}return a.index()+1},l=function(){if(h){if(!h.getMenuEntry())throw new Error("Menu entry is not available, so registration failed!");f=h.getMenuEntry().get("subEntries")}else i&&(f=i.getMenu());f&&!f.get(j)&&f.add(j)},m=function(){j.set({id:b.id||b.url||b.label||b.$id,label:b.label,url:b.url,icon:b.icon,type:b.type||"ENTRY",order:b.order||k(),activeUrls:b.activeUrls||[],"class":b["class"],action:b.action?function(){b.$eval(b.action)}:null})};m(),b.menuEntry=j,a(l),g.setMenuEntry(j),j.get("subEntries").on("add remove reset change:order",function(){b.$emit("mw-menu:triggerReorder")}),j.on("change:order",function(){b.$emit("mw-menu:triggerResort")}),b.$on("mw-menu:reorder",function(){b.order||j.set("order",k())}),b.$on("mw-menu:resort",function(){j.get("subEntries").sort()}),b.$on("$destroy",function(){f&&f.remove(j)}),b.$watchGroup(["id","label","url","icon","class","order"],m)}}}]),b.module("mwUI.Menu").directive("mwMenuDivider",function(){return{scope:{id:"@",label:"@",icon:"@",order:"="},templateUrl:"uikit/mw-menu/directives/templates/mw_menu_divider.html"}}),b.module("mwUI.Menu").directive("mwMenuToggleActiveClass",["$rootScope","$location","$timeout",function(a,b,c){return{scope:{entry:"=mwMenuToggleActiveClass"},link:function(d,e){var f=function(){c(function(){var a=b.url();d.entry.hasActiveSubEntryOrIsActiveForUrl(a)?e.addClass("active"):e.removeClass("active")})};f(),a.$on("$locationChangeSuccess",f),a.$on("$routeChangeError",f)}}}]),b.module("mwUI.Modal",["mwUI.i18n","mwUI.Toast"]),b.module("mwUI.Modal").directive("mwModal",["mwModalTmpl",function(a){return{restrict:"A",scope:{title:"@"},transclude:!0,templateUrl:"uikit/mw-modal/directives/templates/mw_modal.html",link:function(b){b.$emit("COMPILE:FINISHED"),b.mwModalTmpl=a}}}]),b.module("mwUI.Modal").directive("mwModalBody",function(){return{transclude:!0,templateUrl:"uikit/mw-modal/directives/templates/mw_modal_body.html"}}),b.module("mwUI.Modal").directive("mwModalConfirm",function(){return{restrict:"A",transclude:!0,scope:!0,templateUrl:"uikit/mw-modal/directives/templates/mw_modal_confirm.html",link:function(a,c,d){b.forEach(["ok","cancel"],function(b){a[b]=function(){a.$eval(d[b])}})}}}),b.module("mwUI.Modal").directive("mwModalFooter",function(){return{transclude:!0,templateUrl:"uikit/mw-modal/directives/templates/mw_modal_footer.html"}}),b.module("mwUI.Modal").service("Modal",["$rootScope","$templateCache","$document","$compile","$controller","$injector","$q","$templateRequest","$timeout","mwModalOptions","Toast",function(a,c,d,e,f,g,h,i,j,k,l){var m=[],n=function(c,d){var n,o,p,q,r=c.templateUrl,s=c.scope||a,t=c.scopeAttributes||{},u=c.resolve||{},v=c.controller,w=_.extend(k.getOptions(),c),x=_.extend(w.bootStrapModalOptions,d),y=[],z=!1,A=this,B=s.$new(),C=function(a,b){if(_.isObject(b)&&_.isObject(a))for(var c in b)a[c]=b[c]},D=function(a){if(C(B,t),v){a.$scope=B,a.modalId=r;var b=f(v,a,!0,w.controllerAs);C(b.instance,t),o=b()}},E=function(){if(!r)throw new Error("Modal service: templateUrl options is required.");return i(r)},F=function(){p.on("hidden.bs.modal",function(){A.destroy()})},G=function(){var b=a.$on("$locationChangeStart",function(a,c){p&&z?(a.preventDefault(),A.hide().then(function(){document.location.href=c,b()})):b()})},H=function(){y.forEach(function(a){B.$watch(a.expression,a.callback)})},I=function(){var a=b.extend({},u);return b.forEach(a,function(c,d){a[d]=b.isString(c)?g.get(c):g.invoke(c,null,null,d)}),a.$template=E(),h.all(a)},J=function(a){return D(a),e(a.$template)(B)},K=function(){var a=h.defer();return I().then(function(b){H(),t.hideModal=function(){return A.hide()},n=J(b),B.$on("COMPILE:FINISHED",function(){if(n.addClass("mw-modal"),n.addClass(w.styleClass),p=n.find(".modal"),x.show=!1,w.dismissible||(x.backdrop="static",x.keyboard=!1),p.modal(x),p.data()){var b=p.data()["bs.modal"],c=b.backdrop;b.backdrop=function(a){c.call(b,a,$(w.holderEl).find(".modal"))}}F(),G(),a.resolve()})}.bind(this),function(b){a.reject(b)}),a.promise};this.id=r,this.getScope=function(){return B},this.watchScope=function(a,b){y.push({expression:a,callback:b})},this.show=function(){var c=h.defer(),d=b.element(w.holderEl);if(!d||0===d.length)throw new Error("[Modal] no element could be found for the selector string "+w.holderEl+". Make sure that the element exists");return l.clear(),q=b.element(document.activeElement),a.$broadcast("$modalOpenStart"),a.$broadcast("$modalResolveDependenciesStart"),K.call(this).then(function(){a.$broadcast("$modalResolveDependenciesSuccess"),b.element(w.holderEl).append(n),p.modal("show"),z=!0,m.push(this),p.on("shown.bs.modal",function(){b.element(this).find("input:text:visible:first").focus(),a.$broadcast("$modalOpenSuccess"),c.resolve()}),q&&p.on("hidden.bs.modal",function(){q.focus()})}.bind(this),function(b){a.$broadcast("$modalOpenError",b), -c.reject(b)}),c.promise},this.setScopeAttributes=function(a){C(t,a),j(function(){B&&C(B,a),o&&C(o,a)})},this.hide=function(){var b=h.defer();return a.$broadcast("$modalCloseStart"),p&&z?(p.one("hidden.bs.modal",function(){p.off(),A.destroy(),z=!1,a.$broadcast("$modalCloseSuccess"),b.resolve()}),p.modal("hide")):b.resolve(),b.promise},this.toggle=function(){p.modal("toggle")},this.destroy=function(){m=_.without(m,this);var a=l.getToasts();a.forEach(function(a){+new Date-a.initDate>500&&l.removeToast(a.id)}),j(function(){n&&(n.remove(),z=!1),B&&(B.$destroy(),B=s.$new()),t=c.scopeAttributes||{}}.bind(this))},function(){E(),s.$on("$destroy",function(){A.hide()})}()};this.create=function(a,b){return a&&a.el&&(a.holderEl=a.el,window.mwUI.Utils.shims.deprecationWarning("[Modal] The modal options property el was renamed to holderEl")),a&&a["class"]&&(a.styleClass=a["class"],window.mwUI.Utils.shims.deprecationWarning("[Modal] The modal options property class was renamed to styleClass")),new n(a,b)},this.prepare=function(a,b){return this.create.bind(this,a,b)},this.getOpenedModals=function(){return m}}]),b.module("mwUI.Modal").provider("mwModalOptions",function(){var a={controllerAs:"$ctrl",styleClass:"",holderEl:"body",dismissible:!0,bootStrapModalOptions:{}};this.config=function(b){_.isObject(b)&&_.extend(a,b)},this.$get=function(){return{getOptions:function(){return _.clone(a)}}}}),b.module("mwUI.Modal").provider("mwModalTmpl",function(){var a;this.setLogoPath=function(b){a=b},this.$get=function(){return{getLogoPath:function(){return a}}}}),$.fn.modal.Constructor.prototype.backdrop=function(a,b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=$.support.transition&&c;if(this.$backdrop=$('