pip-webui
Version:
HTML5 UI for LOB applications
2 lines • 54 kB
JavaScript
!function(){"use strict";angular.module("pipCore",["pipUtils","pipErrors","pipTransactions","pipTranslate","pipState","pipTimer","pipAssert","pipDebug","pipDateFormat","pipDateTimeFilters","pipTranslateFilters","pipClearErrors","pipTheme","pipFocused","pipSelected","pipInfiniteScroll","pipDraggable","pipUnsavedChanges","pipFabTooltipVisibility"])}(),function(){"use strict";var e=angular.module("pipClearErrors",[]);e.directive("pipClearErrors",function(){return{restrict:"A",require:["ngModel","^?form"],link:function(e,t,r,n){function a(){var e=o.$error;for(var t in e)e.hasOwnProperty(t)&&"ERROR_"==t.substring(0,6)&&o.$setValidity(t,!0)}function i(){u.$serverError={}}var o=n[0],u=n[1];e.$watch(r.ngModel,function(e){a(),i()})}}})}(),function(){"use strict";var e=angular.module("pipDraggable",["pipUtils"]);e.service("pipDraggable",function(){var e=this;e.inputEvent=function(e){return angular.isDefined(e.touches)?e.touches[0]:angular.isDefined(e.originalEvent)&&angular.isDefined(e.originalEvent.touches)?e.originalEvent.touches[0]:e}}),e.directive("pipDrag",["$rootScope","$parse","$document","$window","pipDraggable","pipUtils",function(e,t,r,n,a,i){return{restrict:"A",link:function(o,u,l){o.value=l.ngDrag;var s,c,p,f,d,g,m,h,v=!1,_="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,D="touchstart mousedown",b="touchmove mousemove",T="touchend mouseup",S=o.$id,E=null,y=null,M=!1,O=null,A=t(l.pipDragStart)||null,w=t(l.pipDragStop)||null,$=t(l.pipDragSuccess)||null,N=!!angular.isDefined(l.allowTransform)&&o.$eval(l.allowTransform),P=t(l.pipDragData),H=i.toBoolean(l.pipVerticalScroll)||!0,C=i.toBoolean(l.pipHorizontalScroll)||!0,L=parseFloat(l.pipActivationDistance)||75,R=parseFloat(l.pipScrollDistance)||50,k=!1,U=angular.element(window),F=t(l.pipScrollContainer),Y=angular.noop,x=function(){if(u.attr("pip-draggable","false"),u[0].querySelectorAll)var e=angular.element(u[0].querySelectorAll("[pip-drag-handle]"));else var e=u.find("[pip-drag-handle]");e.length&&(h=e),I(!0),U=k?angular.element($element.parent()):l.pipScrollContainer?angular.element(F(o)):angular.element(window)},I=function(e){e&&(o.$on("$destroy",G),o.$watch(l.pipDrag,W),o.$watch(l.pipCenterAnchor,B),h?h.on(D,q):u.on(D,q),_||"img"!=u[0].nodeName.toLowerCase()||u.on("mousedown",function(){return!1}))},G=function(e){I(!1)},W=function(e,t){M=e},B=function(e,t){angular.isDefined(e)&&(v=e||"true")},j=function(e){return angular.isDefined(angular.element(e.target).attr("pip-cancel-drag"))},q=function(e){M&&(j(e)||"mousedown"==e.type&&0!=e.button||(_?(K(),O=setTimeout(function(){K(),V(e)},100),r.on(b,K),r.on(T,K)):V(e)))},K=function(){clearTimeout(O),r.off(b,K),r.off(T,K)},V=function(t){M&&(t.preventDefault(),s=u[0].getBoundingClientRect(),y=N?s:{left:document.body.scrollLeft,top:document.body.scrollTop},u.centerX=u[0].offsetWidth/2,u.centerY=u[0].offsetHeight/2,c=a.inputEvent(t).pageX,p=a.inputEvent(t).pageY,g=c-s.left,m=p-s.top,v?(f=c-u.centerX-n.pageXOffset,d=p-u.centerY-n.pageYOffset):(f=c-g-n.pageXOffset,d=p-m-n.pageYOffset),r.on(b,z),r.on(T,J),Y=e.$on("draggable:_triggerHandlerMove",function(e,t){z(t)}))},z=function(t){M&&(t.preventDefault(),u.hasClass("pip-dragging")||(E=P(o),u.addClass("pip-dragging"),e.$broadcast("draggable:start",{x:c,y:p,tx:f,ty:d,event:t,element:u,data:E}),A&&o.$apply(function(){A(o,{$data:E,$event:t})})),c=a.inputEvent(t).pageX,p=a.inputEvent(t).pageY,(C||H)&&ee(),v?(f=c-u.centerX-y.left,d=p-u.centerY-y.top):(f=c-g-y.left,d=p-m-y.top),Z(f,d),e.$broadcast("draggable:move",{x:c,y:p,tx:f,ty:d,event:t,element:u,data:E,uid:S,dragOffset:y}))},J=function(t){M&&(t.preventDefault(),e.$broadcast("draggable:end",{x:c,y:p,tx:f,ty:d,event:t,element:u,data:E,callback:X,uid:S}),u.removeClass("pip-dragging"),u.parent().find(".pip-drag-enter").removeClass("pip-drag-enter"),Q(),r.off(b,z),r.off(T,J),w&&o.$apply(function(){w(o,{$data:E,$event:t})}),Y())},X=function(e){$&&o.$apply(function(){$(o,{$data:E,$event:e})})},Q=function(){N?u.css({transform:"","z-index":"","-webkit-transform":"","-ms-transform":""}):u.css({position:"",top:"",left:"","z-index":"",width:""})},Z=function(e,t){var r=u.css("width");N?u.css({transform:"matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, "+e+", "+t+", 0, 1)","z-index":99999,"-webkit-transform":"matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, "+e+", "+t+", 0, 1)","-ms-transform":"matrix(1, 0, 0, 1, "+e+", "+t+")"}):u.css({left:e+"px",top:t+"px",position:"fixed","z-index":100,width:r})},ee=function(){var e=0,t=0,r=function(e){return e.offset()||{left:0,top:0}};if(C){var n=r(U).left,a=U.innerWidth(),i=n+a;c-n<L?e=-R:i-c<L&&(e=R)}if(H){var o=r(U).top,u=U.innerHeight(),l=o+u;p-o<L?t=-R+30:l-p<L&&(t=R-30)}if(0!==e||0!==t){var s=U.scrollLeft(),f=U.scrollTop();U.scrollLeft(s+e),U.scrollTop(f+t)}};x()}}}]),e.directive("pipDrop",["$parse","$timeout","$window","$document","pipDraggable",function(e,t,r,n,a){return{restrict:"A",link:function(r,a,i){r.value=i.pipDrop,r.isTouching=!1;var o=null,u=r.$id,l=!1,s=e(i.pipDropSuccess),c=e(i.pipDragStart),p=e(i.pipDragStop),f=e(i.pipDragMove),d=function(){g(!0)},g=function(e){e&&(r.$watch(i.pipDrop,h),r.$on("$destroy",m),r.$on("draggable:start",v),r.$on("draggable:move",_),r.$on("draggable:end",D))},m=function(e){g(!1)},h=function(e,t){l=e},v=function(e,n){l&&(b(n.x,n.y,n.element),i.pipDragStart&&t(function(){c(r,{$data:n.data,$event:n})}))},_=function(e,n){l&&(b(n.x,n.y,n.element),i.pipDragMove&&t(function(){f(r,{$data:n.data,$event:n})}))},D=function(e,n){return l&&u!==n.uid?(b(n.x,n.y,n.element)&&(n.callback&&n.callback(n),i.pipDropSuccess&&t(function(){s(r,{$data:n.data,$event:n,$target:r.$eval(r.value)})})),i.pipDragStop&&t(function(){p(r,{$data:n.data,$event:n})}),void T(!1,n.element)):void T(!1,n.element)},b=function(e,t,n){var i=S(e,t);return r.isTouching=i,i&&(o=a),T(i,n),i},T=function(e,t){e?(a.addClass("pip-drag-enter"),t.addClass("pip-drag-over")):o==a&&(o=null,a.removeClass("pip-drag-enter"),t.removeClass("pip-drag-over"))},S=function(e,t){var r=a[0].getBoundingClientRect();return e-=n[0].body.scrollLeft+n[0].documentElement.scrollLeft,t-=n[0].body.scrollTop+n[0].documentElement.scrollTop,e>=r.left&&e<=r.right&&t<=r.bottom&&t>=r.top};d()}}}]),e.directive("pipPreventDrag",["$parse","$timeout",function(e,t){return{restrict:"A",link:function(e,t,r){var n=function(){t.attr("pip-draggable","false"),a(!0)},a=function(e){e&&t.on("mousedown touchstart touchmove touchend touchcancel",i)},i=function(e){var t=e.originalEvent;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1};n()}}}]),e.directive("pipCancelDrag",function(){return{restrict:"A",link:function(e,t,r){t.find("*").attr("pip-cancel-drag","pip-cancel-drag")}}})}(),function(){"use strict";var e=angular.module("pipFabTooltipVisibility",[]);e.directive("pipFabTooltipVisibility",["$parse","$timeout",function(e,t){return{restrict:"A",scope:!1,controller:["$scope","$attrs",function(r,n){var a=e(n.pipFabTooltipVisibility),i=e(n.pipFabShowTooltip),o=i.assign;r.$watch(a,function(e){e?t(function(){o(r,e)},600):o(r,e)})}]}}])}(),function(){"use strict";var e=angular.module("pipFocused",[]);e.directive("pipFocused",["$timeout","$mdConstant",function(e,t){return{require:"?ngModel",link:function(r,n,a){function i(){var e=s?".pip-focusable":".pip-focusable:visible";u=n.find(e),l=u.length,u.on("focus",function(){n.addClass("pip-focused-container"),$(this).addClass("md-focused")}).on("focusout",function(){n.removeClass("pip-focused-container")})}function o(e){var r=e.which||e.keyCode;if(r==t.KEY_CODE.LEFT_ARROW||r==t.KEY_CODE.UP_ARROW||r==t.KEY_CODE.RIGHT_ARROW||r==t.KEY_CODE.DOWN_ARROW){e.preventDefault();var n=r==t.KEY_CODE.RIGHT_ARROW||r==t.KEY_CODE.DOWN_ARROW?1:-1,a=u.index(u.filter(".md-focused"))+n;a>=0&&a<l&&u[a].focus()}}var u,l,s=a.pipWithHidden;e(i),n.on("keydown",o),r.$watch(a.ngModel,function(){e(i)},!0)}}}])}(),function(){"use strict";var e=angular.module("pipInfiniteScroll",[]);e.directive("pipInfiniteScroll",["$rootScope","$window","$interval","$parse",function(e,t,r,n){var a=500;return{scope:{pipInfiniteScroll:"&",pipScrollContainer:"=",pipScrollDistance:"=",pipScrollDisabled:"=",pipScrollUseDocumentBottom:"=",pipScrollListenForEvent:"@"},link:function(n,i,o){function u(e){return e=e[0]||e,isNaN(e.offsetHeight)?e.document.documentElement.clientHeight:e.offsetHeight}function l(e){if(e[0].getBoundingClientRect&&!e.css("none"))return e[0].getBoundingClientRect().top+s(e)}function s(e){return e=e[0]||e,isNaN(window.pageYOffset)?e.document.documentElement.scrollTop:e.ownerDocument.defaultView.pageYOffset}function c(e){return D=parseFloat(e)||0}function p(e){if(b=!e,b&&h)return h=!1,y()}function f(e){return S=e}function d(e){if(null!=m&&m.unbind("scroll",y),m=e,null!=e)return m.bind("scroll",y)}function g(e){if(null!=e&&0!==e.length){if(e instanceof HTMLElement?e=angular.element(e):"function"==typeof e.append?e=angular.element(e[e.length-1]):"string"==typeof e&&(e=i.parents().find(e)),null!=e&&(!Array.isArray(e)||Array.isArray(e)&&e.length>0))return d(e);throw new Error("Invalid pip-scroll-container attribute.")}}var m,h=null,v=!0,D=null,b=null,T=null,S=!1,E=angular.element(t),y=function(){var t,r,a,o,c;return m===E?(t=u(m)+s(m[0].document.documentElement),a=l(i)+u(i)):(t=u(m),r=0,void 0!==l(m)&&(r=l(m)),a=l(i)-r+u(i)),S&&(a=u((i[0].ownerDocument||i[0].document).documentElement)),o=a-t,c=o<=u(m)*D+1,c?(h=!0,b?n.$$phase||e.$$phase?n.pipInfiniteScroll():n.$apply(n.pipInfiniteScroll):void 0):h=!1};return null!=a&&(y=_.throttle(y,a)),n.$on("$destroy",function(){if(m.unbind("scroll",y),null!=T)return T(),T=null}),n.$watch("pipScrollDistance",c),c(n.pipScrollDistance),n.$watch("pipScrollDisabled",p),p(n.pipScrollDisabled),n.$watch("pipScrollUseDocumentBottom",f),f(n.pipScrollUseDocumentBottom),d(E),n.pipScrollListenForEvent&&(T=e.$on(n.pipScrollListenForEvent,y)),n.$watch("pipScrollContainer",function(e){e!==m&&g(e)}),g(n.pipScrollContainer||[]),null!=o.pipScrollParent&&d(angular.element(i.parent())),null!=o.pipScrolImmediateCheck&&(v=n.$eval(o.pipScrolImmediateCheck)),r(function(){if(v)return y()},0,1)}}}])}(),function(){"use strict";var e=angular.module("pipSelected",["pipUtils"]);e.directive("pipSelected",["$parse","pipUtils","$mdConstant","$timeout",function(e,t,r,n){return{restrict:"A",scope:!1,link:function(n,a,i){function o(e){var t=e.itemIndex,r=e.itemId,n=e.items||a.find(v+h),i=n.length,o=function(){return e.item?e.item:(void 0===t&&t===-1&&(t=n.index(n.filter("[pip-id="+r+"]"))),t>=0&&t<i?n[t]:void 0)}(),s=e.raiseEvent;o&&(a.find(v).removeClass("selected md-focused"),o=angular.element(o).addClass("selected md-focused").focus(),m||l(o),s&&u(n))}function u(e){function t(){var t=angular.element(e[_]),i=t.attr("pip-id");c&&c(n,_),f&&f(n,i),d&&d(n,{$event:{target:a,item:t,index:_,id:i,newIndex:_,oldIndex:r}})}var r=_;_=-1;for(var i=0;i<e.length;i++)if($(e[i]).hasClass("selected")){_=i;break}r!=_&&_!==-1&&n.$apply(t)}function l(e){if(!m){var t=a.offset().top,r=a.height(),n=t+r,i=e.offset().top,o=e.outerHeight(!0),u=i+o,l=a.scrollTop();t>i?a.scrollTop(l+i-t):n<u&&a.scrollTop(l+u-n)}}var s=i.pipSelected?e(i.pipSelected):null,c=s?s.assign:null,p=i.pipSelectedId?e(i.pipSelectedId):null,f=p?p.assign:null,d=i.pipSelect?e(i.pipSelect):null,g=i.pipEnterSpacePress?e(i.pipEnterSpacePress):null,m=t.toBoolean(i.pipNoScroll),h=t.toBoolean(i.pipSkipHidden)?":visible":"",v=t.toBoolean(i.pipTreeList)?".pip-selectable-tree":".pip-selectable",_=s(n),D=a.attr("tabindex"),b=i.pipSelectedWatch;a.attr("tabindex",D||0),t.toBoolean(i.pipTreeList)?n.$watch(p,function(e){setTimeout(function(){o({itemId:e,raiseEvent:!0})},0)}):n.$watch(s,function(e){o({itemIndex:e})}),b&&n.$watch(b,function(){setTimeout(function(){_=s(n),o({itemIndex:_})},100)}),o({itemIndex:_,items:a.find(v)}),a.on("click touchstart",v,function(e){o({item:e.currentTarget,raiseEvent:!0})}),a.on("keydown",function(e){var t=e.which||e.keyCode;if(t==r.KEY_CODE.ENTER||t==r.KEY_CODE.SPACE)e.preventDefault(),e.stopPropagation(),g&&g(n,{$event:{target:a,index:_,item:a.find(".selected")}});else if(t==r.KEY_CODE.LEFT_ARROW||t==r.KEY_CODE.RIGHT_ARROW||t==r.KEY_CODE.UP_ARROW||t==r.KEY_CODE.DOWN_ARROW){e.preventDefault(),e.stopPropagation();var i=a.find(v+h),u=t==r.KEY_CODE.RIGHT_ARROW||t==r.KEY_CODE.DOWN_ARROW?1:-1,l=_+u;o({itemIndex:l,items:i,raiseEvent:!0})}}),a.on("focusin",function(e){var t,r=a.find(v+".selected");r.addClass("md-focused"),0===r.length&&(_=s(n),t=a.find(v+h),o({itemIndex:_||0,items:t,raiseEvent:!0}))}),a.on("focusout",function(e){a.find(v+".md-focused"+h).removeClass("md-focused")})}}}])}(),function(){"use strict";var e=angular.module("pipUnsavedChanges",[]);e.directive("pipUnsavedChanges",["$window","$rootScope",function(e,t){return{restrict:"AE",scope:{unsavedChangesAvailable:"&pipUnsavedChangesAvailable",unsavedChangesMessage:"@pipUnsavedChangesMessage",afterLeave:"&pipUnsavedChangesAfterLeave"},link:function(r){e.onbeforeunload=function(){if(r.unsavedChangesAvailable())return t.$routing=!1,r.unsavedChangesMessage};var n=r.$on("$stateChangeStart",function(n){r.unsavedChangesAvailable()&&!e.confirm(r.unsavedChangesMessage)?(t.$routing=!1,n.preventDefault()):_.isFunction(r.afterLeave)&&r.afterLeave()});r.$on("$destroy",function(){e.onbeforeunload=null,n()})}}}])}(),function(){"use strict";var e=angular.module("pipDateTimeFilters",["pipDateFormat"]);e.filter("formatDate",["pipDateFormat",function(e){return function(t,r){return e.formatDate(t,r)}}]),e.filter("formatLongDate",["pipDateFormat",function(e){return function(t){return e.formatLongDate(t)}}]),e.filter("formatLongDateWithYear",["pipDateFormat",function(e){return function(t){return e.formatLongDateWithYear(t)}}]),e.filter("formatMonth",["pipDateFormat",function(e){return function(t,r){return e.formatMonth(t,r)}}]),e.filter("formatShortDate",["pipDateFormat",function(e){return function(t){return e.formatShortDate(t)}}]),e.filter("formatShortDateWithYear",["pipDateFormat",function(e){return function(t){return e.formatShortDateWithYear(t)}}]),e.filter("formatLongMonth",["pipDateFormat",function(e){return function(t){return e.formatLongMonth(t)}}]),e.filter("formatYear",["pipDateFormat",function(e){return function(t){return e.formatYear(t)}}]),e.filter("formatShortWeek",["pipDateFormat",function(e){return function(t){return e.formatShortWeek(t)}}]),e.filter("formatTime",["pipDateFormat",function(e){return function(t,r){return e.formatTime(t,r)}}]),e.filter("formatLongTime",["pipDateFormat",function(e){return function(t){return e.formatLongTime(t)}}]),e.filter("formatShortTime",["pipDateFormat",function(e){return function(t){return e.formatShortTime(t)}}]),e.filter("formatLongDateTime",["pipDateFormat",function(e){return function(t){return e.formatLongDateTime(t)}}]),e.filter("formatShortDateTime",["pipDateFormat",function(e){return function(t){return e.formatShortDateTime(t)}}]),e.filter("formatElapsedInterval",["pipDateFormat",function(e){return function(t){return e.formatElapsedInterval(t)}}]),e.filter("formatElapsedTime",["pipDateFormat",function(e){return function(t){return e.formatElapsedTime(t)}}]),e.filter("formatMillisecondsToSeconds",["pipDateFormat",function(e){return function(t){return e.formatMillisecondsToSeconds(t)}}]),e.filter("formatDateRange",["pipDateFormat",function(e){return function(t,r){return e.formatDateRange(t,r)}}]),e.filter("formatDateTimeRange",["pipDateFormat",function(e){return function(t,r){return e.formatDateTimeRange(t,r)}}])}(),function(){"use strict";var e=angular.module("pipTranslateFilters",["pipTranslate"]);e.filter("translate",["pipTranslate",function(e){return function(t){return e.translate(t)||t}}])}(),function(){"use strict";var e=angular.module("pipDateFormat",["pipUtils","pipTranslate"]);e.config(["pipTranslateProvider",function(e){e.translations("en",{MONTH_1:"January",MONTH_2:"February",MONTH_3:"March",MONTH_4:"April",MONTH_5:"May",MONTH_6:"June",MONTH_7:"July",MONTH_8:"August",MONTH_9:"September",MONTH_10:"October",MONTH_11:"November",MONTH_12:"December",MONTH_LONG_1:"January",MONTH_LONG_2:"February",MONTH_LONG_3:"March",MONTH_LONG_4:"April",MONTH_LONG_5:"May",MONTH_LONG_6:"June",MONTH_LONG_7:"July",MONTH_LONG_8:"August",MONTH_LONG_9:"September",MONTH_LONG_10:"October",MONTH_LONG_11:"November",MONTH_LONG_12:"December",MONTH_SHORT_1:"Jan",MONTH_SHORT_2:"Feb",MONTH_SHORT_3:"Mar",MONTH_SHORT_4:"Apr",MONTH_SHORT_5:"May",MONTH_SHORT_6:"Jun",MONTH_SHORT_7:"Jul",MONTH_SHORT_8:"Aug",MONTH_SHORT_9:"Sep",MONTH_SHORT_10:"Oct",MONTH_SHORT_11:"Nov",MONTH_SHORT_12:"Dec",DAY_1:"Monday",DAY_2:"Tuesday",DAY_3:"Wednesday",DAY_4:"Thursday",DAY_5:"Friday",DAY_6:"Saturday",DAY_7:"Sunday",ELAPSED_TODAY:"Today",ELAPSED_YESTERDAY:"Yesterday",ELAPSED_YEARS:"y",ELAPSED_MONTHS:"mth",ELAPSED_WEEKS:"w",ELAPSED_DAYS:"d",ELAPSED_HOURS:"h",ELAPSED_MINUTES:"m",ELAPSED_SECONDS:"s",ELAPSED_AT:"at",ELAPSED_AGO:"ago",ELAPSED_JUST_NOW:"Just now",ELAPSED_FEW_MIN_AGO:"Few min ago",ELAPSED_MIN_AGO:"min ago",ELAPSED_HOUR_AGO:"hour ago",ELAPSED_HOURS_AGO:"hours ago",ELAPSED_HOURS_AGO_MORE_THAN_FIVE:"hours ago"}),e.translations("ru",{MONTH_1:"январь",MONTH_2:"февраль",MONTH_3:"март",MONTH_4:"апрель",MONTH_5:"май",MONTH_6:"июнь",MONTH_7:"июль",MONTH_8:"август",MONTH_9:"сентябрь",MONTH_10:"октябрь",MONTH_11:"ноябрь",MONTH_12:"декабрь",MONTH_LONG_1:"января",MONTH_LONG_2:"февраля",MONTH_LONG_3:"марта",MONTH_LONG_4:"апреля",MONTH_LONG_5:"мая",MONTH_LONG_6:"июня",MONTH_LONG_7:"июля",MONTH_LONG_8:"августа",MONTH_LONG_9:"сентября",MONTH_LONG_10:"октября",MONTH_LONG_11:"ноября",MONTH_LONG_12:"декабря",MONTH_SHORT_1:"янв",MONTH_SHORT_2:"фев",MONTH_SHORT_3:"мар",MONTH_SHORT_4:"апр",MONTH_SHORT_5:"май",MONTH_SHORT_6:"июн",MONTH_SHORT_7:"июл",MONTH_SHORT_8:"авг",MONTH_SHORT_9:"сен",MONTH_SHORT_10:"окт",MONTH_SHORT_11:"ноя",MONTH_SHORT_12:"дек",DAY_1:"понедельник",DAY_2:"вторник",DAY_3:"среда",DAY_4:"четверг",DAY_5:"пятница",DAY_6:"суббота",DAY_7:"воскресенье",ELAPSED_TODAY:"Сегодня",ELAPSED_YESTERDAY:"Вчера",ELAPSED_YEARS:"г",ELAPSED_MONTHS:"мц",ELAPSED_WEEKS:"н",ELAPSED_DAYS:"д",ELAPSED_HOURS:"ч",ELAPSED_MINUTES:"м",ELAPSED_SECONDS:"с",ELAPSED_AT:"в",ELAPSED_AGO:"тн",ELAPSED_JUST_NOW:"Только что",ELAPSED_FEW_MIN_AGO:"Несколько мин тн",ELAPSED_MIN_AGO:"мин тн",ELAPSED_HOUR_AGO:"час тн",ELAPSED_HOURS_AGO:"часа тн",ELAPSED_HOURS_AGO_MORE_THAN_FIVE:"часов тн"})}]),e.factory("pipDateFormat",["pipDates","pipTranslate","$rootScope",function(e,t,r){function n(e){return e<10?"0"+e:e}function a(n,a,i){if(null==n)return"";var o=i||!1,n=_.isDate(n)?n:new Date(n),u=(new Date).getUTCFullYear(),l=n.getUTCFullYear(),s=n.getUTCMonth(),c=t.translate("MONTH_LONG_"+(s+1)),p=t.translate("MONTH_SHORT_"+(s+1)),f=t.translate("MONTH_"+(s+1)),d=n.getUTCDate(),g=e.toStartWeek(n),m=e.toEndWeek(n,-1);return 0==o&&"d MMMM yyyy"==a&&u===l&&(a="MMMM d"),0==o&&"d MMM yyyy"==a&&u===l&&(a="MMM d"),"MMM d"==a&&"ru"==r.$language&&(a="d MMM"),"MMMM d"==a&&"ru"==r.$language&&(a="d MMMM"),"d MMMM yyyy"==a?""+d+" "+c+" "+l:"MMMM d, yyyy"==a?""+f+" "+d+", "+l:"d MMM yyyy"==a?""+d+" "+p+" "+l:"MMM d, yyyy"==a?""+p+" "+d+", "+l:"d MMMM"==a?""+d+" "+c:"d MMM"==a?""+d+" "+p:"MMM d"==a?""+p+" "+d:"MMMM d"==a?""+c+" "+d:"yyyy/M/d"==a?""+l+"/"+s+"/"+d:"yyy-M-d"==a?""+l+"-"+s+"-"+d:"MMMM"==a?""+c+" "+l:"yyyy"==a?""+l:"ww"==a?""+g.getUTCDate()+" - "+m.getUTCDate()+" "+f+" "+l:""+d+" "+f+" "+l}function i(e){return a(e,"d MMMM yyyy")}function o(e){return a(e,"d MMM yyyy",!0)}function u(e){return a(e,"d MMMM yyyy",!0)}function l(e){return a(e,"d MMM yyyy")}function s(e){return a(e,"MMMM")}function c(e){return a(e,"yyyy")}function p(e){return a(e,"ww")}function f(e){return a(e,"d MMM")}function d(e){return"ru"==r.$language?a(e,"d MMMM"):a(e,"MMMM d")}function g(e,t){return e=e?_.isDate(e)?e:new Date(e):null,t=t?_.isDate(t)?t:new Date(t):null,null==e?"ru"==r.$language?a(t,"d MMM yyyy",!0):a(t,"MMM d, yyyy",!0):null==t||e==t?"ru"==r.$language?a(e,"d MMM yyyy",!0):a(e,"MMM d, yyyy",!0):e.getUTCFullYear()!==t.getUTCFullYear()?"ru"==r.$language?a(e,"d MMM yyyy",!0)+"-"+a(t,"d MMM yyyy",!0):a(e,"MMM d, yyyy",!0)+"-"+a(t,"MMM d, yyyy",!0):a(e,"d MMM")+" - "+a(t,"d MMM")+((new Date).getUTCFullYear()!==e.getUTCFullYear()?" "+a(e,"yyyy"):"")}function m(e,t){if(e=e?_.isDate(e)?e:new Date(e):null,t=t?_.isDate(t)?t:new Date(t):null,null==e&&null==t)return"";if(null==e)return S(t);if(null==t||e==t)return S(e);var r,n,i,o,u,l;return r=e.getUTCDate(),n=e.getUTCMonth(),i=e.getUTCFullYear(),o=t.getUTCDate(),u=t.getUTCMonth(),l=t.getUTCFullYear(),i!==l?a(e,"d MMM")+", "+i+" "+h(e,"hh:mm")+" - "+a(t,"d MMM")+", "+l+" "+h(t,"hh:mm"):n!=u&&!r!=o?a(e,"d MMM")+", "+h(e,"hh:mm")+" - "+a(t,"d MMM")+", "+h(t,"hh:mm"):h(e,"hh:mm")+" - "+h(t,"hh:mm")}function h(e,r){if(null==e)return"";e=_.isDate(e)?e:new Date(e);var a=e.getHours(),i=e.getMinutes(),o=e.getSeconds(),u="";return"en"==t.use()&&(u=a>=12?" PM":" AM",a%=12,0==a&&(a=12)),"hh:mm:ss"==r?""+n(a)+":"+n(i)+":"+n(o)+u:"hh:mm"==r?""+n(a)+":"+n(i)+u:""+n(a)+":"+n(i)+":"+n(o)+u}function v(e,r){return null==e?"":r?t.translate("MONTH_SHORT_"+e):t.translate("MONTH_"+e)}function D(e){return h(e,"hh:mm:ss")}function b(e){return h(e,"hh:mm")}function T(e){return null==e?"":(e=_.isDate(e)?e:new Date(e),i(e)+" "+D(e))}function S(e){return null==e?"":(e=_.isDate(e)?e:new Date(e),l(e)+" "+b(e))}function E(e,r){if(null==e)return"";e=_.isDate(e)?e:new Date(e);var n=new Date,i=Math.floor((n.getTime()+n.getTimezoneOffset()-(e.getTime()+e.getTimezoneOffset()))/1e3);if(i<1)return t.translate("ELAPSED_JUST_NOW");var o,u,l,s,c,p,f;if(f=i%60,i=Math.floor(i/60),p=i%60,i=Math.floor(i/60),c=i%24,i/=24,o=Math.floor(i/365),i-=365*o,u=Math.floor(i/30),s=Math.floor(i-30*u),s%7==0?(l=Math.floor(s/7),s=0):l=0,"interval"==r){var d="";return o&&(d+=" "+o+t.translate("ELAPSED_YEARS"),l=s=c=p=f=null),u&&(d+=" "+u+t.translate("ELAPSED_MONTHS"),s=c=p=f=null),l&&(d+=" "+l+t.translate("ELAPSED_WEEKS"),c=p=f=null),s&&(d+=" "+s+t.translate("ELAPSED_DAYS"),p=f=null),c&&(d+=" "+c+t.translate("ELAPSED_HOURS"),f=null),p&&(d+=" "+p+t.translate("ELAPSED_MINUTES")),f&&(d+=" "+f+t.translate("ELAPSED_SECONDS")),""!=d?d+" "+t.translate("ELAPSED_AGO"):t.translate("ELAPSED_JUST_NOW")}return o>0?a(e,"d MMM yyyy"):u>0||l>0||s>1?a(e,"MMM d")+", "+h(e,"hh:mm"):1==s?t.translate("ELAPSED_YESTERDAY")+", "+h(e,"hh:mm"):c>10?t.translate("ELAPSED_TODAY")+", "+h(e,"hh:mm"):c>0?""+c+" "+(c<2?t.translate("ELAPSED_HOUR_AGO"):c<5?t.translate("ELAPSED_HOURS_AGO"):t.translate("ELAPSED_HOURS_AGO_MORE_THAN_FIVE")):p>10?""+p+" "+t.translate("ELAPSED_MIN_AGO"):p>0?t.translate("ELAPSED_FEW_MIN_AGO"):t.translate("ELAPSED_JUST_NOW")}function y(e){return E(e,"interval")}function M(e){return Math.floor(e/1e3)}return{formatDate:a,formatLongDate:i,formatShortDate:l,formatShortDateWithYear:o,formatLongDateWithYear:u,formatLongMonth:s,formatMonth:v,formatYear:c,formatShortWeek:p,formatShortDayAndMonth:f,formatLongDayAndMonth:d,formatDateRange:g,formatDateTimeRange:m,formatTime:h,formatLongTime:D,formatShortTime:b,formatLongDateTime:T,formatShortDateTime:S,formatElapsedTime:E,formatElapsedInterval:y,formatMillisecondsToSeconds:M}}])}(),function(){"use strict";var e=angular.module("pipAssert",["pipDebug"]);e.provider("pipAssert",["pipDebugProvider",function(e){function t(){}function r(e){return Object.prototype.toString.call(e)}function n(e,t){if(!Array.isArray(e))throw new Error(t||e+" should be array")}function a(e,t){if("boolean"!=typeof e)throw new Error(t||e+" should be boolean")}function i(e,t){if(null===e)throw new Error(t||e+" should be not null")}function o(e,t){if("number"!=typeof e)throw new Error(t||e+" should be number")}function u(e,t){if("string"!=typeof e)throw new Error(t||e+" should be string")}function l(e,t){if("object"!=typeof e)throw new Error(t||e+" should be an object")}function s(e,t){if("object"==typeof e&&"[object Date]"!==r(e))throw new Error(t||e+" should be a date")}function c(e,t){if("object"==typeof e&&("[object Error]"!==r(e)||e instanceof Error))throw new Error(t||e+" should be an error")}function p(e,t){if("function"!=typeof e)throw new Error(t||e+" should be a function")}function f(e,t){if("undefined"==typeof e)throw new Error(t||e+" should be defined")}function d(e,t){if(null===e||void 0===e||e===!1)throw new Error(t||e+" should be not null or undefined or false")}function g(e,t,r){if("object"!=typeof e)throw new Error(e+" should be an object");if(null===e[t]||void 0===e[t])throw new Error(r||t+" should be in object "+e)}function m(e,t,r){if(e!=t)throw new Error(r||e+" should be not equal "+t)}function h(e,t,r){if(e==t)throw new Error(r||e+" should be equal "+t)}function v(e,t,r){if(e!==t)throw new Error(r||e+" should not be strict equal "+t)}function _(e,t,r){if(e===t)throw new Error(r||e+" should not strict equal "+t)}function D(e,t){var r=new RegExp("^[0-9a-fA-F]{24}$");if(!r.test(e))throw new Error(t||e+" should be an object id")}return{isEmpty:e.enabled()?d:t,isObjectId:e.enabled()?D:t,isDefined:e.enabled()?f:t,isDef:e.enabled()?f:t,contains:e.enabled()?g:t,equal:e.enabled()?m:t,notEqual:e.enabled()?h:t,strictEqual:e.enabled()?v:t,notStrictEqual:e.enabled()?_:t,isArray:e.enabled()?n:t,isBoolean:e.enabled()?a:t,isNumber:e.enabled()?o:t,isString:e.enabled()?u:t,isObject:e.enabled()?l:t,isDate:e.enabled()?s:t,isError:e.enabled()?c:t,isFunction:e.enabled()?p:t,isNotNull:e.enabled()?i:t,$get:["pipDebug",function(e){return{isEmpty:e.enabled()?d:t,isObjectId:e.enabled()?D:t,isDefined:e.enabled()?f:t,isDef:e.enabled()?f:t,contains:e.enabled()?g:t,equal:e.enabled()?m:t,notEqual:e.enabled()?h:t,strictEqual:e.enabled()?v:t,notStrictEqual:e.enabled()?_:t,isArray:e.enabled()?n:t,isBoolean:e.enabled()?a:t,isNumber:e.enabled()?o:t,isString:e.enabled()?u:t,isObject:e.enabled()?l:t,isDate:e.enabled()?s:t,isError:e.enabled()?c:t,isFunction:e.enabled()?p:t,isNotNull:e.enabled()?i:t}}]}}])}(),function(){"use strict";var e=angular.module("pipDebug",[]);e.provider("pipDebug",["$logProvider",function(e){function t(){return this.enabled}function r(){this.enabled=!0,e.debugEnabled(!0)}function n(){this.enabled=!1,e.debugEnabled(!1)}return this.enabled=!0,{enable:r,disable:n,enabled:t,$get:["$log",function(e){return{enabled:t,log:e.log,info:e.info,warn:e.warn,error:e.error,debug:e.debug}}]}}])}(),function(){"use strict";var e=angular.module("pipErrors",["pipUtils","pipAssert"]);e.factory("pipError",["$rootScope","pipAssert",function(e,t){function r(t){e.errors[t]={message:void 0,code:void 0,details:void 0}}function n(e){if(_.isNull(e))return null;if(e.message)return e.message;if(e.data){if(e.data.code)return"ERROR_"+e.data.code;if(e.data.message)return e.data.message}return e.statusText?e.statusText:e.status?"ERROR_"+e.status:e.data?e.data:e}function a(e){return _.isNull(e)?null:e.data&&e.data.code?e.data.code:e.status?e.status:null}function i(e){return e&&e.data?e.data:e}function o(o,u){o=o||"global";var l={reset:function(){r(o)},empty:function(){var t=e.errors[o];return _.isNull(t)||_.isNull(t.message)&&_.isNull(t.code)},get:function(){return e.errors[o]?e.errors[o]:""},message:function(){return e.errors[o]?e.errors[o].message:null},code:function(){return e.errors[o]?e.errors[o].code:null},details:function(){return e.errors[o]?e.errors[o].details:null},set:function(u){u?(t.isObject(u,"Setting error: error should be an object"),e.errors[o]={message:n(u),code:a(u),details:i(u)},console.error(e.errors[o])):r(o)}};return _.isObject(u)&&(u.error=l),l}return e.errors={},o}])}(),function(){"use strict";var e=angular.module("pipState",["ui.router","pipTranslate","pipAssert"]);e.config(["$locationProvider","$httpProvider","pipTranslateProvider",function(e,t,r){r.translations("en",{ERROR_SWITCHING:"Error while switching route. Try again."}),r.translations("ru",{ERROR_SWITCHING:"Ошибка при переходе. Попробуйте ещё раз."})}]),e.run(["$rootScope","pipTranslate","$state",function(e,t,r){e.$on("$stateChangeSuccess",function(t,n,a,i,o){if(e.$user&&e.$user.id&&n.params&&n.params.access&&a&&a.party_id){var u=_.find(e.$user.party_access,{party_id:a.party_id});if(u){if(("manager"==n.params.access&&!u.manager||"contributor"==n.params.access&&!u.contributor)&&n.params.toState)return t.preventDefault(),void r.go(n.params.toState,a)}else if(a.party_id!=e.$user.id&&n.params.toState)return t.preventDefault(),void r.go(n.params.toState,a)}e.$routing=!1,e.$state={name:n.name,url:n.url,params:a},e.$prevState={name:i.name,url:i.url,params:o}}),e.$on("$stateChangeError",function(t,r,n,a,i,o){e.$routing=!1,console.error("Error while switching route to "+r.name),console.error(o)}),e.$on("$stateNotFound",function(t,n,a,i){t.preventDefault(),r.go("errors_missing_route",{unfoundState:n,fromState:{to:a?a.name:"",fromParams:i}}),e.$routing=!1})}]),e.provider("pipState",["$stateProvider","pipAssertProvider",function(e,t){function r(e,r){return t.isNotNull(e,"pipState.redirect: fromState cannot be null"),t.isNotNull(r,"pipState.redirect: toState cannot be null"),n[e]=r,this}var n={};this.redirect=r,this.state=e.state,this.$get=["$state","$timeout","pipAssert",function(e,t,r){function a(a,i,o,u){r.contains(i,"name","$state.redirect: state should contains name prop"),r.isObject(o,"$state.redirect: params should be an object");var l;if(u.$routing=!0,l=n[i.name],_.isFunction(l)&&(l=l(i.name,o,u),_.isNull(l)))throw u.$routing=!1,new Error("Redirected toState cannot be null");return!!l&&(t(function(){a.preventDefault(),e.transitionTo(l,o,{location:"replace"})}),!0)}return e.redirect=a,e}]}])}(),function(){"use strict";function e(e,t){function r(t){var r=e.extendPalette("blue",{contrastDefaultColor:"light",contrastDarkColors:void 0});e.definePalette("blue-primary",r);var n=e.extendPalette("grey",{A100:"rgba(231, 231, 231, 1)",A200:"rgba(33, 150, 243, 1)"});e.definePalette("blue-background",n);var a=e.extendPalette("green",{600:"rgba(0, 200, 83, 1)"});e.definePalette("blue-accent",a),e.theme(t).primaryPalette("blue-primary",{default:"500","hue-1":"300"}).backgroundPalette("blue-background",{default:"50","hue-1":"A200","hue-2":"A700"}).warnPalette("red",{default:"A200"}).accentPalette("blue-accent",{default:"600"})}function n(t){var r=e.extendPalette("grey",{A100:"rgba(231, 231, 231, 1)",A200:"rgba(188, 86, 121, 1)",contrastDefaultColor:"dark",contrastLightColors:["A200","A700"]});e.definePalette("pink-background",r);var n=e.extendPalette("pink",{600:"rgba(255, 128, 171, 1)",700:"rgba(188, 86, 121, .54)",900:"rgba(188, 86, 121, 1)",contrastDefaultColor:"light"});e.definePalette("pink-primary",n),e.theme(t).primaryPalette("pink-primary",{default:"900","hue-1":"700"}).backgroundPalette("pink-background",{default:"50","hue-1":"A200","hue-2":"A700"}).warnPalette("red",{default:"A200"}).accentPalette("pink-primary",{default:"600"})}function a(t){var r=e.extendPalette("grey",{A100:"rgba(231, 231, 231, 1)",A200:"rgba(255, 152, 0, 1)"});e.definePalette("orange-background",r);var n=e.extendPalette("orange",{800:"rgba(255, 152, 0, 1)",900:"rgba(255, 152, 0, .54);"});e.definePalette("orange-primary",n),e.theme(t).primaryPalette("orange-primary",{default:"800","hue-1":"900"}).backgroundPalette("orange-background",{default:"50","hue-1":"A200","hue-2":"A700"}).warnPalette("red",{default:"A200"}).accentPalette("orange",{default:"900"})}function i(t){var r=e.extendPalette("grey",{A100:"rgba(231, 231, 231, 1)",A200:"rgba(255, 112, 67, 1)",contrastLightColors:["600","700","800","900","A200"]});e.definePalette("red-background",r);var n=e.extendPalette("orange",{800:"rgba(255, 112, 67, 1)",900:"rgba(255, 152, 67, .54)",A100:"rgba(255, 171, 64, 1)",contrastLightColors:["800","900","A100"]});e.definePalette("red-primary",n),e.theme(t).primaryPalette("red-primary",{default:"800","hue-1":"900"}).backgroundPalette("red-background",{default:"50","hue-1":"A200","hue-2":"A700"}).warnPalette("red",{default:"A200"}).accentPalette("red-primary",{default:"A100"})}function o(t){var r=e.extendPalette("grey",{A100:"rgba(231, 231, 231, 1)",A200:"rgba(76, 175, 80, 1)"});e.definePalette("green-background",r);
var n=e.extendPalette("green",{300:"#9ed4a1",contrastLightColors:["500","300"]});e.definePalette("green-primary",n);var a=e.extendPalette("amber",{contrastLightColors:["A700"]});e.definePalette("green-accent",a),e.theme(t).primaryPalette("green-primary",{default:"500","hue-1":"300"}).backgroundPalette("green-background",{default:"50","hue-1":"A200","hue-2":"A700"}).warnPalette("red",{default:"A200"}).accentPalette("green-accent",{default:"A700"})}function u(t){var r=e.extendPalette("grey",{700:"rgba(86, 97, 125, 1)",800:"rgba(86, 97, 125, .54)",A100:"rgba(231, 231, 231, 1)"});e.definePalette("grey",r);var n=e.extendPalette("teal",{contrastLightColors:["500","600","700","800","900","A700"]});e.definePalette("teal",n),e.theme(t).primaryPalette("grey",{default:"700","hue-1":"800"}).backgroundPalette("grey",{default:"50","hue-1":"700","hue-2":"A700"}).warnPalette("red",{default:"A200"}).accentPalette("teal",{default:"A700"})}function l(t){var r=e.extendPalette("grey",{A100:"rgba(231, 231, 231, 1)",A200:"rgba(255, 152, 0, 1)",A400:"#a9b9c0",500:"#607D8B",A700:"#90A4AE",contrastDefaultColor:"dark",contrastLightColors:["300","400","500","600","700","800","900","A700"]});e.definePalette("third-party",r),e.theme(t).primaryPalette("third-party",{default:"500","hue-1":"A400"}).backgroundPalette("third-party",{default:"50","hue-1":"500","hue-2":"A700"}).warnPalette("red",{default:"A200"}).accentPalette("third-party",{default:"A700"})}t.translations("en",{THEME:"Theme",blue:"Blue",pink:"Pink",amber:"Amber",orange:"Orange",green:"Green",navy:"Navy",grey:"Grey"}),t.translations("ru",{THEME:"Тема",blue:"Голубая",pink:"Розовая",amber:"Янтарная",orange:"Оранжевая",green:"Зеленая",navy:"Сине-серая",grey:"Серая"}),r("default"),r("blue"),n("pink"),a("amber"),i("orange"),o("green"),u("navy"),l("grey"),e.setDefaultTheme("default"),e.alwaysWatchTheme(!0)}function t(e,t,r){try{var n=r.$user&&r.$user.theme?r.$user.theme:e.get("theme");t.initializeTheme(n)}catch(e){t.initializeTheme("blue")}}function r(e,t,r,n,a,i){return{setCurrentTheme:function(n){if(null==n||""===n)throw new Error("Theme is not specified");if(e.get("theme")!=n||r.$theme!=n){if(!(n in t.THEMES))throw new Error("Theme "+n+" is not registered. Please, register it first with $mdThemingProvider");e.set("theme",n),r.$theme=n}},initializeTheme:function(e){if(null==e||""===e)throw new Error("Theme is not specified");if(!(e in t.THEMES))throw new Error("Theme "+e+" is not registered. Please, register it first with $mdThemingProvider");r.$theme=e,$("body").attr("md-theme","{{ $theme }}").addClass("{{ $theme }}")}}}e.$inject=["$mdThemingProvider","pipTranslateProvider"],t.$inject=["localStorageService","pipTheme","$rootScope"],r.$inject=["localStorageService","$mdTheming","$rootScope","$timeout","$state","$stateParams"],angular.module("pipTheme",["ngMaterial"]).config(e).run(t).factory("pipTheme",r)}(),function(){"use strict";var e=angular.module("pipTimer",[]);e.service("pipTimer",["$interval","$rootScope",function(e,t){function r(){return p}function n(){p||(i=e(function(){t.$broadcast("pipAutoPullChanges")},l),o=e(function(){t.$broadcast("pipAutoUpdatePage")},s),u=e(function(){t.$broadcast("pipAutoUpdateCollection")},c),p=!0)}function a(){i&&e.cancel(i),o&&e.cancel(o),u&&e.cancel(o),p=!1}var i,o,u,l=6e4,s=15e3,c=3e5,p=!1;return{isStarted:r,start:n,stop:a}}])}(),function(){"use strict";var e=angular.module("pipTransactions",["pipTranslate","pipErrors"]);e.config(["pipTranslateProvider",function(e){e.translations("en",{ENTERING:"Entering...",PROCESSING:"Processing...",LOADING:"Loading...",SAVING:"Saving..."}),e.translations("ru",{ENTERING:"Вход в систему...",PROCESSING:"Обрабатывается...",LOADING:"Загружается...",SAVING:"Сохраняется..."})}]),e.factory("pipTransaction",["$rootScope","pipError",function(e,t){function r(t){e.transactions[t]={id:void 0,operation:void 0}}function n(n,a){n=n||"global";var i=t(n),o={error:i,reset:function(){r(),i.reset()},busy:function(){var t=e.transactions[n];return null!=t&&t.id},failed:function(){return!i.empty()},aborted:function(t){var r=e.transactions[n];return _.isNull(r)||r.id!=t},get:function(){return _.isNull(e.transactions[n])&&r(n),e.transactions[n]},id:function(){var t=e.transactions[n];return t?t.id:null},operation:function(){var t=e.transactions[n];return t?t.operation:null},errorMessage:function(){return i.message()},begin:function(t){var r=e.transactions[n];return null!=r&&r.id?null:(r=e.transactions[n]={id:(new Date).getTime(),operation:t||"PROCESSING"},i.reset(),r.id)},abort:function(){var t=e.transactions[n];t&&(t.id=null),i.reset()},end:function(t){t?i.set(t):i.reset();var r=e.transactions[n];null!=r&&(r.id=null)}};return _.isObject(a)&&(a.error=i,a.transaction=o),o}return e.transactions={},n}])}(),function(){"use strict";var e=angular.module("pipTranslate",["LocalStorageModule","pipAssert"]);e.provider("pipTranslate",["pipAssertProvider",function(e){function t(t){return e.isString(t||"","pipTranslateProvider.use or pipTranslateProvider.language: argument should be a string"),null!=t&&(f=t),f}function r(t){return null!=t&&(e.isBoolean(t||"","pipTranslateProvider.persist: argument should be a boolean"),d=t),d}function n(t){return null!=t&&(e.isBoolean(t||"","pipTranslateProvider.setRoot: argument should be a boolean"),g=t),g}function a(t,r){e.isString(t,"pipTranslate.setTranslations or pipTranslateProvider.translations: first argument should be a string"),e.isObject(r,"pipTranslate.setTranslations or pipTranslateProvider.translations: second argument should be an object");var n=m[t]||{};m[t]=_.extend(n,r)}function i(e){if(_.isNull(e)||_.isUndefined(e))return"";var t=m[f]||{};return t[e]||e}function o(t){if(_.isNull(t)||0==t.length)return[];e.isArray(t,"pipTranslate.translateArray: argument should be an array");var r=[],n=m[f]||{};return _.each(t,function(e){var t=e||"";r.push(n[t]||t)}),r}function u(t,r,n){if(_.isNull(t)||0==t.length)return[];e.isArray(t,"pipTranslate.translateSet: first argument should be an array"),e.isString(r||"","pipTranslate.translateSet: second argument should be a string"),e.isString(n||"","pipTranslate.translateSet: third argument should be a string"),r=r||"id",n=n||"name";var a=[],i=m[f]||{};return _.each(t,function(e){var t={},o=e||"";t[r]=o,t[n]=i[o]||o,a.push(t)}),a}function l(t,r,n){if(_.isNull(t)||0==t.length)return[];e.isArray(t,"pipTranslate.translateObjects: first argument should be an array"),e.isString(r||"","pipTranslate.translateObjects: second argument should be a string"),e.isString(n||"","pipTranslate.translateObjects: third argument should be a string"),r=r||"name",n=n||"nameLocal";var a=m[f]||{};return _.each(t,function(e){var t=e,i=t[r]||"";t[n]=a[i]||i}),t}function s(t,r){if(e.isString(r||"","pipTranslate.translateById: second argument should be a string"),e.isString(t||"","pipTranslate.translateById: first argument should be a string"),t=t?t+"_":"",r=(t+r).replace(/ /g,"_").toUpperCase(),null==r)return"";var n=m[f]||{};return n[r]||r}function c(t,r,n,a){if(_.isNull(t)||0==t.length)return[];e.isArray(t,"pipTranslate.translateSetById: first argument should be an array"),e.isString(r||"","pipTranslate.translateSetById: second argument should be a string"),e.isString(n||"","pipTranslate.translateSetById: third argument should be a string"),e.isString(a||"","pipTranslate.translateSetById: forth argument should be a string"),r=r?r.replace(/ /g,"_").toUpperCase():"",n=n||"id",a=a||"name";var i=[],o=m[f]||{};return _.each(t,function(e){var t={},u=e||"";t[n]=u,t[a]=o[r+"_"+u]||u,i.push(t)}),i}function p(t,r,n,a){if(_.isNull(t)||0==t.length)return[];e.isArray(t,"pipTranslate.translateStringsSet: first argument should be an array"),e.isString(r||"","pipTranslate.translateStringsSet: second argument should be a string"),e.isString(n||"","pipTranslate.translateStringsSet: third argument should be a string"),e.isString(a||"","pipTranslate.translateStringsSet: forth argument should be a string"),n=n||"id",a=a||"name",r=r?r.replace(/ /g,"_").toUpperCase()+"_":"";var i=[],o=m[f]||{};return _.each(t,function(e){var t={},u=e||"";t[n]=u,t[a]=o[r+u.replace(/ /g,"_").toUpperCase()]||r+u.replace(/ /g,"_").toUpperCase(),i.push(t)}),i}var f="en",d=!0,g=!0,m={en:{en:"English",ru:"Russian",es:"Spanish",pt:"Portuguese",de:"German",fr:"French"},ru:{en:"Английский",ru:"Русский",es:"Испанский",pt:"Португальский",de:"Немецкий",fr:"Французский"}};this.translations=a,this.language=t,this.use=t,this.persist=r,this.setRoot=n,this.$get=["$rootScope","$timeout","localStorageService","pipAssert",function(e,t,r,n){function m(r,n){r=void 0===r||!!r,n=void 0===n||!!n,e.$reset=r,e.$partialReset=n,t(function(){e.$reset=!1,e.$partialReset=!1},0)}return d&&(f=r.get("language")||f),g&&(e.$language=f),{use:function(t,a,i){return n.isString(t||"","pipTranslate.use: argument should be a string"),null!=t&&t!=f&&(f=t,d&&r.set("language",f),g&&(e.$language=f),m(a,i)),f},translations:a,translate:i,translateArray:o,translateSet:u,translateObjects:l,translateById:s,translateSetById:c,translateStringsSet:p}}]}]),e.directive("pipTranslate",["pipTranslate",function(e){return{restrict:"EA",scope:{key1:"@pipTranslate",key2:"@key"},link:function(t,r,n){var a=t.key1||t.key2,i=e.translate(a);r.text(i)}}}]),e.directive("pipTranslateHtml",["pipTranslate",function(e){return{restrict:"EA",scope:{key1:"@pipTranslateHtml",key2:"@key"},link:function(t,r,n){var a=t.key1||t.key2,i=e.translate(a);r.html(i)}}}])}(),function(){"use strict";var e=angular.module("pipUtils.Collections",[]);e.factory("pipCollections",function(){var e={};return e.indexBy=function(e,t,r){if(!e||!e.length)return null;for(var n=0;n<e.length;n++)if(e[n][t]==r)return n;return null},e.findBy=function(e,t,r){if(!e||!e.length)return null;for(var n=0;n<e.length;n++)if(e[n][t]==r)return e[n];return null},e.remove=function(e,t){if(!e||!e.length)return null;for(var r=0;r<e.length;r++)e[r]==t&&(e.splice(r,1),r--)},e.removeBy=function(e,t,r){if(!e||!e.length)return null;for(var n=0;n<e.length;n++)e[n][t]==r&&(e.splice(n,1),n--)},e.replaceBy=function(e,t,r,n){if(!e||!e.length)return null;for(var a=0;a<e.length;a++)if(e[a][t]==r)return void(e[a]=n)},e.difference=function(e,t,r){var n=[];return _.each(e,function(e){var a=_.find(t,function(t){return r(e,t)});null==a&&n.push(e)}),n},e})}(),function(){"use strict";var e=angular.module("pipUtils.Dates",[]);e.factory("pipDates",function(){var e={};return e.addHours=function(e,t){e=_.isDate(e)?e:new Date(e);var r=e.getTime()+36e5*t;return new Date(r)},e.toStartDay=function(e){return e=_.isDate(e)?e:new Date(e),new Date(e.getFullYear(),e.getMonth(),e.getDate())},e.toEndDay=function(e,t){e=_.isDate(e)?e:new Date(e),t=null!=t?t:0;var r=new Date(e.getFullYear(),e.getMonth(),e.getDate());return new Date(r.getTime()+864e5+t)},e.toStartWeek=function(e){e=_.isDate(e)?e:new Date(e);var t=e.getDay()?e.getDay():7;return e=new Date(e.getFullYear(),e.getMonth(),e.getDate()),new Date(e.getTime()-24*(t-1)*36e5)},e.toEndWeek=function(e,t){e=_.isDate(e)?e:new Date(e),t=null!=t?t:0;var r=e.getDay()?e.getDay():7;return e=new Date(e.getFullYear(),e.getMonth(),e.getDate()),new Date(e.getTime()+24*(8-r)*36e5+t)},e.toStartMonth=function(e){return e=_.isDate(e)?e:new Date(e),new Date(e.getFullYear(),e.getMonth(),1)},e.toEndMonth=function(e,t){e=_.isDate(e)?e:new Date(e);var r=e.getMonth()+1,n=e.getFullYear();return r>11&&(n++,r=0),e=new Date(n,r,1),null!=t&&(e=new Date(e.getTime()+t)),e},e.toStartYear=function(e){return e=_.isDate(e)?e:new Date(e),new Date(e.getFullYear(),0,1)},e.toEndYear=function(e,t){return e=_.isDate(e)?e:new Date(e),e=new Date(e.getFullYear()+1,0,1),null!=t&&(e=new Date(e.getTime()+t)),e},e.toUTCDate=function(e,t,r){return new Date(Date.UTC(e,t,r))},e.toUTCDate=function(e){return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()))},e.fromUTCDate=function(e){return null==e&&(e=new Date),new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())},e.toUTCStartWeek=function(e){_.isDate(e)||(e=new Date(e),e=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())));var t=e.getDay()?e.getDay():7;return e=new Date(e.getFullYear(),e.getMonth(),e.getDate()),e=1!=t?new Date(e.getTime()-24*(t-1)*36e5):e,new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()))},e.toUTCEndWeek=function(e,t){_.isDate(e)||(e=new Date(e),e=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()))),t=null!=t?t:0;var r=e.getDay()?e.getDay():7;return e=new Date(e.getFullYear(),e.getMonth(),e.getDate()),e=new Date(e.getTime()+24*(8-r)*36e5+t),new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()))},e})}(),function(){"use strict";var e=angular.module("pipUtils.FormErrors",[]);e.factory("pipFormErrors",["$rootScope",function(e){function t(e){if(null!=e)return _.isEmpty(e.$error)?{hint:!0}:e.$error}function r(e,t){if(null!=e&&null!=t){if(e.$submitted&&(t.$touched||e.$dirty)||!e.$submitted&&(t.$touched||t.$dirty)){var r=_.isEmpty(t.$error)?{hint:!0}:t.$error;return r}return{hint:!0}}}function n(e,t){e.$setPristine(),e.$setUntouched(),t&&(e.$setDirty(),e.$setSubmitted()),e.$serverError={}}function a(e,t){if(e)if(t&&e[t]&&e[t].$error)e[t].$error={};else{for(var r in e)e[r]&&e[r].$error&&(e[r].$error={});e&&e.$error&&(e.$error={})}}function i(e,t,r){if(null!=t){e.$serverError=e.$serverError||{};var n=t.code||(t.data||{}).code||null;if(!n&&t.status&&(n=t.status),n){var a="ERROR_"+n,i=r?r[n]:null;if(i&&e[i]&&e[i].$setValidity)return void e[i].$setValidity(a,!1);if("form"==i)return void(e.$serverError[a]=!0)}if(t.data&&t.data.message)return e.$serverError.ERROR_UNKNOWN=t.data.message,void o(t);if(t.message)return e.$serverError.ERROR_UNKNOWN=t.message,void o(t);if(t.name)return e.$serverError.ERROR_UNKNOWN=t.name,void o(t);e.$serverError.ERROR_UNKNOWN=t,o(t)}}function o(t){e.$emit("pipUnhandledInternalError",{error:t})}return{errorsWithHint:t,touchedErrorsWithHint:r,resetFormErrors:n,setFormError:i,resetFieldsErrors:a}}])}(),function(){"use strict";var e=angular.module("pipUtils.General",["pipState","pipAssert"]);e.factory("pipUtils",["$rootScope","$window","$state","pipAssert",function(e,t,r,n){function a(e,t){if(t<1)return"";for(var r="";t>0;)1&t&&(r+=e),t>>=1,e+=e;return r}function i(e,t,r,n){if(!e||!e.length)return null;for(var a=0;a<e.length;a++)if(e[a][t]==r)return void(e[a]=n)}function o(e,t){if(!e||""==e)return"";var r=e.indexOf("\n");return r=r>=0?r:e.length,r=r<t?e.length:t,e.substring(0,r)}function l(e){if(null==e)return 0;for(var t=0,r=0;r<e.length;r++)t+=e.charCodeAt(r);return t}function s(e){return null==e?"":""+e}function c(e){var t=new RegExp("^[0-9a-fA-F]{24}$");return t.test(e)}function p(e,t){return null==e&&null==t||null!=e&&null!=t&&e.toString()==t.toString()}function f(e,t){return(null!=e||null!=t)&&(null==e||null==t||e.toString()!=t.toString())}function d(e,t){return _.some(e,function(e){return p(e,t)})}function g(e,t,r,n){return _.isObject(t)&&"undefined"==typeof n&&(n=r,r=t,t=n),!!(r[n]||"number"==typeof r[n]&&r[n]%1==0)&&(e[t]=r[n],!0)}function m(e,t,r){var n=e[t],a=e[r];n?e[r]=n:delete e[r],a?e[t]=a:delete e[t]}function h(e){return null!=e&&(!!e&&(e=e.toString().toLowerCase(),"1"==e||"true"==e))}function v(e){return _.map(e,function(e){return e?e.toString():0})}function D(){return Math.random().toString(36).substr(2,10).toUpperCase()}function b(){t.history.back()}function T(a,i,o){if(n.isDef(a,"pipUtils.goBack: first argument should be defined"),n.isDef(i,"pipUtils.goBack: second argument should be defined"),n.isDef(o,"pipUtils.goBack: third argument should be defined"),n.isObject(a,"pipUtils.goBack: first argument should be an object"),n.isString(i,"pipUtils.goBack: second argument should a string"),n.isString(o,"pipUtils.goBack: third argument should a string"),e.$prevState&&e.$prevState.name){var u=_.cloneDeep(e.$prevState);u.params[i]=a.id,u.params[o]=a,r.go(u.name,u.params)}else t.history.back()}function S(e,t,r){e&&t&&(void 0==r&&(r=300),setTimeout(function(){if($(t).position()){var n=Math.abs($(e).scrollTop()-$(t).position().top);if(!(n<20)){var a=$(e).scrollTop()+($(t).position().top-20);r>0&&$(e).animate({scrollTop:a+"px"},r)}}},100))}function E(){var e,r=t.navigator.userAgent,n=function(){return r.search(/Edge/)>-1?"edge":r.search(/MSIE/)>-1?"ie":r.search(/Trident/)>-1?"ie11":r.search(/Firefox/)>-1?"firefox":r.search(/Opera/)>-1?"opera":r.search(/OPR/)>-1?"operaWebkit":r.search(/YaBrowser/)>-1?"yabrowser":r.search(/Chrome/)>-1?"chrome":r.search(/Safari/)>-1?"safari":r.search(/Maxthon/)>-1?"maxthon":void 0}();switch(n){case"edge":e=r.split("Edge")[1].split("/")[1];break;case"ie":e=r.split("MSIE ")[1].split(";")[0];break;case"ie11":n="ie",e=r.split("; rv:")[1].split(")")[0];break;case"firefox":e=r.split("Firefox/")[1];break;case"opera":e=r.split("Version/")[1];break;case"operaWebkit":n="opera",e=r.split("OPR/")[1];break;case"yabrowser":e=r.split("YaBrowser/")[1].split(" ")[0];break;case"chrome":e=r.split("Chrome/")[1].split(" ")[0];break;case"safari":e=r.split("Version/")[1].split(" ")[0];break;case"maxthon":e=r.split("Maxthon/")[1]}var a="desktop";/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(r.toLowerCase())&&(a="mobile");var i;try{var o=(/(windows|mac|android|linux|blackberry|sunos|solaris|iphone)/.exec(r.toLowerCase())||[u])[0].replace("sunos","solaris"),l=/(android)/.exec(r.toLowerCase())||"";i=!l||"android"!=l&&"android"!=l[0]?o:"android"}catch(e){i="unknown"}var s;try{s={platform:a,browser:n,versionFull:e,versionShort:e.split(".")[0],os:i}}catch(e){s={platform:a,browser:"unknown",versionFull:"unknown",versionShort:"unknown",os:"unknown"}}return s}function y(e){e||(e={edge:11,ie:11,firefox:43,opera:35,chrome:47});var t=E();return t&&t.browser&&e[t.browser]&&t.versionShort>=e[t.browser],!0}var M=Object.prototype.toString,O=function e(){function t(e){return M.call(e).slice(8,-1).toLowerCase()}var r=a,n=function(){return n.cache.hasOwnProperty(arguments[0])||(n.cache[arguments[0]]=n.parse(arguments[0])),n.format.call(null,n.cache[arguments[0]],arguments)};r