UNPKG

pip-webui

Version:

HTML5 UI for LOB applications

2 lines 54.2 kB
!function(){"use strict";angular.module("pipPictures",["pipAddImage","pipAvatar","pipAvatarEdit","pipPicture","pipPictureEdit","pipCollage","pipPictureListEdit","pipCameraDialog","pipPictureUrlDialog"])}(),function(e){try{e=angular.module("pipPictures.Templates")}catch(t){e=angular.module("pipPictures.Templates",[])}e.run(["$templateCache",function(e){e.put("add_image/add_image.html",'<md-menu><ng-transclude class="pip-add-image-open-button" ng-click="ngDisabled() ? \'\' : $mdOpenMenu()"></ng-transclude><md-menu-content width="4"><md-menu-item><md-button layout="row" layout-align="start center" accept="image/*" ng-keydown="onKeyDown($event)" ng-multiple="isMulti()" ng-file-select="" ng-file-change="onFileChange($files)" ng-click="hideMenu()" ng-file-drop=""><md-icon class="text-headline text-grey rm24-flex" md-svg-icon="icons:folder"></md-icon><span class="text-grey">{{::\'FILE\' | translate}}</span></md-button></md-menu-item><md-menu-item><md-button layout="row" layout-align="start center" ng-click="onWebLinkClick()"><md-icon class="text-headline text-grey rm24-flex" md-svg-icon="icons:weblink"></md-icon><span class="text-grey">{{::\'WEB_LINK\' | translate}}</span></md-button></md-menu-item><md-menu-item><md-button layout="row" layout-align="start center" ng-click="onCameraClick()"><md-icon class="text-headline text-grey rm24-flex" md-svg-icon="icons:camera"></md-icon><span class="text-grey">{{::\'CAMERA\' | translate}}</span></md-button></md-menu-item><md-menu-item><md-button layout="row" layout-align="start center" ng-click="onGalleryClick()"><md-icon class="text-headline text-grey rm24-flex" md-svg-icon="icons:images"></md-icon><span class="text-grey">{{::\'IMAGE_GALLERY\' | translate}}</span></md-button></md-menu-item></md-menu-content></md-menu>')}])}(),function(e){try{e=angular.module("pipPictures.Templates")}catch(t){e=angular.module("pipPictures.Templates",[])}e.run(["$templateCache",function(e){e.put("camera_dialog/camera_dialog.html",'<md-dialog class="pip-dialog pip-picture-dialog pip-camera-dialog" layout="column" md-theme="{{theme}}" ng-show="browser != \'android\'" ng-class="{\'pip-android-dialog\': browser == \'android\' || !browser}"><div class="pip-header" layout="row" layout-align="start center"><md-button ng-click="onCancelClick()" class="md-icon-button" aria-label="{{ ::\'CANCEL\' | translate }}"><md-icon class="text-grey" md-svg-icon="icons:arrow-left"></md-icon></md-button><h3 class="m0 text-title">{{ ::\'TAKE_PICTURE\' | translate }}</h3></div><div class="pip-body"><div class="camera-stream" ng-hide="webCamError || browser == \'android\'"></div><div class="camera-error" ng-show="webCamError || browser == \'android\'" layout="row" layout-align="center center"><span>{{ ::\'WEB_CAM_ERROR\' | translate }}</span></div></div><div class="pip-footer"><div class="w48"><md-button ng-click="onResetPicture()" ng-hide="!$freeze || webCamError" class="md-icon-button" ng-disabled="transaction.busy()" aria-label="{{ ::\'REMOVE_PICTURE\' | translate }}"><md-icon class="text-grey" md-svg-icon="icons:refresh"></md-icon></md-button></div><div flex=""></div><div class="w48"><md-button ng-click="onTakePictureClick()" ng-hide="webCamError" class="md-icon-button" aria-label="{{ ::\'TAKE_PICTURE\' | translate }}"><md-icon class="text-grey icon-button" md-svg-icon="icons:{{$freeze ? \'check\' : \'camera\'}}"></md-icon></md-button></div><div flex=""></div><div class="w48"><md-button ng-click="onCancelClick()" class="md-icon-button" aria-label="{{ ::\'CANCEL\' | translate }}"><md-icon class="text-grey" md-svg-icon="icons:cross"></md-icon></md-button></div></div></md-dialog>')}])}(),function(e){try{e=angular.module("pipPictures.Templates")}catch(t){e=angular.module("pipPictures.Templates",[])}e.run(["$templateCache",function(e){e.put("gallery_search_dialog/gallery_search_dialog.html",'<md-dialog class="pip-dialog pip-gallery-search-dialog pip-picture-dialog" layout="column" md-theme="{{theme}}"><md-progress-linear ng-show="transaction.busy()" md-mode="indeterminate"></md-progress-linear><md-dialog-content class="pip-body lp0 rp0 tp0 pip-scroll" layout="row" flex=""><div layout="column" layout-align="start start" flex=""><div class="pip-header w-stretch" layout="column" layout-align="start start"><h3 class="w-stretch text-title m0 bp8"><md-button class="md-icon-button m0" ng-click="onCancelClick()" aria-label="{{ ::\'CANCEL\' | translate }}"><md-icon class="text-grey" md-svg-icon="icons:arrow-left"></md-icon></md-button>{{::\'IMAGE_GALLERY\' | translate}}</h3><div class="w-stretch divider-bottom" layout="row"><input class="no-divider rm8 text-subhead1" flex="" ng-disabled="transaction.busy()" ng-model="$search" ng-keypress="onKeyPress($event)" placeholder="{{::\'SEARCH_PICTURES\' | translate}}" type="text" tabindex="1"><md-button class="md-icon-button md-icon-button-square p0 pip-search-button md-primary" ng-click="onSearchClick()" ng-hide="optionDefault" tabindex="-1" aria-label="SEARCH"><md-icon class="text-opacity md-primary" md-svg-icon="icons:search-square"></md-icon></md-button></div></div><div class="pip-content" flex="" ng-show="$images.length > 0"><div class="pip-image-container" ng-click="onImageClick(image)" ng-repeat="image in $images track by $index" ng-class="{\'checked\': image.checked}" tabindex="{{ $index + 2 }}"><pip-picture pip-src="image.thumbnail" pip-default-icon="icon-images" pip-rebind="true"></pip-picture><div class="pip-checked-cover"></div><div class="pip-checkbox-backdrop"><md-checkbox md-no-ink="" ng-model="image.checked" ng-click="image.checked = !image.checked" aria-label="CHECKED"></md-checkbox></div></div></div><div class="pip-no-images w-stretch" layout="column" layout-align="center center" flex="" ng-show="$images.length == 0"><img src="images/add_from_image_library.svg" width="200" height="200"><p class="text-secondary opacity-secondary text-center">{{\'IMAGE_START_SEARCH\' | translate}}</p></div></div></md-dialog-content><div class="pip-footer"><md-button ng-click="onCancelClick()" ng-hide="transaction.busy()" aria-label="{{ ::\'CANCEL\' | translate }}" tabindex="{{ $images.length + 3 }}"><span class="text-grey">{{ ::\'CANCEL\' | translate }}</span></md-button><md-button ng-if="transaction.busy()" ng-click="onStopSearchClick()" class="md-raised md-warn m0" tabindex="5" aria-label="ABORT" pip-test="button-cancel">{{::\'CANCEL\' | translate}}</md-button><md-button class="md-accent" ng-hide="transaction.busy()" ng-disabled="addButtonDisabled()" ng-click="onAddClick()" aria-label="{{ ::\'ADD\' | translate }}" tabindex="{{ $images.length + 4 }}">{{ ::\'ADD\' | translate }}</md-button></div></md-dialog>')}])}(),function(e){try{e=angular.module("pipPictures.Templates")}catch(t){e=angular.module("pipPictures.Templates",[])}e.run(["$templateCache",function(e){e.put("picture_edit/picture_edit.html",'<div class="pip-picture-upload pip-picture-drop md-focused" ng-keydown="onKeyDown($event)" tabindex="{{ ngDisabled() || control.uploading ? -1 : 0 }}" pip-changed="readItemLocally(url, file)" ng-disabled="ngDisabled()" pip-multi="false" ng-focus="onFocus()" ng-blur="onBlur()" pip-add-image=""><div class="pip-default-icon" ng-show="empty()"><md-icon class="pip-picture-icon" md-svg-icon="icons:{{icon}}"></md-icon></div><div class="pip-default-text" ng-show="empty()"><span>{{text | translate}}</span></div><img class="pip-picture-image" ng-src="{{control.url}}" ng-show="!empty()" ng-class="{ \'pip-image-new\': isUpdated(), \'cursor-default\' : ngDisabled() || control.uploading }" ui-event="{ error: \'onImageError($event)\', load: \'onImageLoad($event)\' }"><md-button class="md-icon-button" ng-click="onDeleteClick($event)" tabindex="-1" aria-label="delete" ng-hide="empty() || ngDisabled()" ng-disabled="ngDisabled() || control.uploading"><md-icon md-svg-icon="icons:cross"></md-icon></md-button><md-progress-linear ng-show="control.uploading" ng-value="control.progress"></md-progress-linear></div>')}])}(),function(e){try{e=angular.module("pipPictures.Templates")}catch(t){e=angular.module("pipPictures.Templates",[])}e.run(["$templateCache",function(e){e.put("picture_list_edit/picture_list_edit.html",'<div pip-focused=""><div class="pip-picture-upload pointer pip-focusable" ng-class="{\'pip-picture-error\': item.error}" ng-keydown="onKeyDown($event, item)" tabindex="{{ ngDisabled() ? -1 : 0 }}" ng-repeat="item in control.items | filter: filterItem"><div class="pip-default-icon" ng-hide="item.loaded || item.error"><md-icon pip-cancel-drag="true" class="pip-picture-icon" md-svg-icon="icons:{{icon}}"></md-icon></div><div class="pip-default-text" ng-show="item.error"><md-icon pip-cancel-drag="true" md-svg-icon="icons:warn-circle"></md-icon></div><img ng-src="{{::item.url}}" pip-cancel-drag="true" ng-hide="item.error" ng-class="{ \'pip-image-new\': item.state == \'added\' }" ui-event="{ error: \'onImageError($event, item)\', load: \'onImageLoad($event, item)\' }"><md-button ng-click="onDeleteClick(item)" ng-disabled="ngDisabled() || control.uploading" tabindex="-1" aria-label="delete" class="md-icon-button"><md-icon pip-cancel-drag="true" md-svg-icon="icons:cross"></md-icon></md-button><md-progress-linear md-mode="indeterminate" ng-show="item.uploading" value="{{ item.progress }}"></md-progress-linear></div><button class="pip-picture-upload pip-picture-drop pip-focusable" pip-add-image="" ng-focus="onFocus()" ng-blur="onBlur()" pip-changed="readItemLocally(url, file)" ng-disabled="ngDisabled() || control.uploading"><div class="pip-default-icon"><md-icon pip-cancel-drag="true" class="pip-picture-icon" md-svg-icon="icons:{{icon}}"></md-icon></div><div class="pip-default-text"><span>{{text | translate}}</span></div></button><div class="clearfix"></div></div>')}])}(),function(e){try{e=angular.module("pipPictures.Templates")}catch(t){e=angular.module("pipPictures.Templates",[])}e.run(["$templateCache",function(e){e.put("picture_url_dialog/picture_url_dialog.html",'<md-dialog class="pip-dialog pip-picture-url-dialog pip-picture-dialog" layout="column" md-theme="{{theme}}"><md-dialog-content class="pip-body lp0 rp0 tp0 pip-scroll"><div class="pip-header bm16" layout="row" layout-align="start center"><md-button ng-click="onCancelClick()" class="md-icon-button lm0" aria-label="{{ ::\'CANCEL\' | translate }}"><md-icon class="text-grey" md-svg-icon="icons:arrow-left"></md-icon></md-button><h3 class="text-title m0">{{ ::\'PICTURE_FROM_WEBLINK\' | translate}}</h3></div><div class="pip-content"><md-input-container md-no-float="" class="w-stretch text-subhead1"><input type="text" ng-model="url" ng-change="checkUrl()" placeholder="{{:: \'LINK_PICTURE\' | translate}}"></md-input-container><div class="w-stretch" ng-hide="invalid" layout="row" layout-align="center center"><img id="url_image"></div><div class="pip-no-images" ng-show="invalid" layout="row" layout-align="center center"><md-icon class="text-grey" md-svg-icon="icons:images"></md-icon></div></div></md-dialog-content><div class="pip-footer"><md-button ng-click="onCancelClick()" aria-label="{{ ::\'CANCEL\' | translate }}">{{ ::\'CANCEL\' | translate }}</md-button><md-button class="md-accent" ng-click="onAddClick()" ng-disabled="invalid" aria-label="{{ ::\'ADD\' | translate }}">{{ ::\'ADD\' | translate }}</md-button></div></md-dialog>')}])}(),function(){"use strict";var e=angular.module("pipAddImage",["pipCameraDialog","pipPictureUrlDialog","pipGallerySearchDialog","pipCore"]);e.config(["pipTranslateProvider",function(e){e.translations("en",{FILE:"Upload pictures",WEB_LINK:"Use web link",CAMERA:"Take photo",IMAGE_GALLERY:"Use image library"}),e.translations("ru",{FILE:"Загрузить картинку",WEB_LINK:"Вставить веб ссылка",CAMERA:"Использовать камеру",IMAGE_GALLERY:"Открыть галерею изображений"})}]),e.directive("pipAddImage",function(){return{restrict:"AC",scope:{$images:"=pipImages",onChange:"&pipChanged",multi:"&pipMulti",ngDisabled:"&"},transclude:!0,templateUrl:"add_image/add_image.html",controller:"pipAddImageController"}}),e.controller("pipAddImageController",["$scope","$element","$mdMenu","$timeout","pipCameraDialog","pipPictureUrlDialog","pipGallerySearchDialog","pipUtils",function(e,t,i,l,n,o,a,r){function d(){$(t).find(".pip-add-image-open-button").scope().$mdOpenMenu()}function c(){return void 0===e.multi()||r.toBoolean(e.multi())}function p(){i.hide()}function u(e){var t;t=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):unescape(e.split(",")[1]);for(var i=e.split(",")[0].split(":")[1].split(";")[0],l=new Uint8Array(t.length),n=0;n<t.length;n++)l[n]=t.charCodeAt(n);return new Blob([l],{type:i})}function s(t){void 0!==t&&(Array.isArray(t)?t.forEach(function(t){e.onChange&&e.onChange({url:t.url,file:t.file})}):e.onChange&&e.onChange({url:t.url,file:t.file}),void 0!==e.$images&&Array.isArray(e.$images)&&(Array.isArray(t)?t.forEach(function(t){e.$images.push(t.url)}):e.$images.push(t.url)))}function g(e){null!=e&&0!=e.length&&e.forEach(function(e){e.type.indexOf("image")>-1&&l(function(){var t=new FileReader;t.readAsDataURL(e),t.onload=function(t){l(function(){s({url:t.target.result,file:e})})}})})}function f(){o.show(function(e){var t=null;"data:image"==e.substring(0,10)&&(t=u(e),t.name=e.slice(e.lastIndexOf("/")+1,e.length).split("?")[0]),s({url:e,file:t})})}function h(){n.show(function(e){var t=u(e);t.name="camera",s({url:e,file:t})})}function m(){a.show(function(e){var t=[];e.forEach(function(e){t.push({url:e,file:null})}),s(t)},e.isMulti())}e.hideMenu=p,e.onFileChange=g,e.onWebLinkClick=f,e.onCameraClick=h,e.onGalleryClick=m,e.isMulti=c,t.click(function(){e.ngDisabled()||d()})}])}(),function(){"use strict";var e=angular.module("pipAvatar",["pipCore","pipRest","pipImageUtils"]);e.directive("pipAvatar",function(){return{restrict:"EA",scope:!1,template:'<md-icon></md-icon><img/><div><md-icon class="default_icon" id="icon-film" md-svg-icon="icons:film"></md-icon><md-icon class="default_icon" id="icon-task" md-svg-icon="icons:task"></md-icon><md-icon class="default_icon" id="icon-folder" md-svg-icon="icons:folder"></md-icon></div>',controller:"pipAvatarController"}}),e.controller("pipAvatarController",["$scope","$rootScope","$element","$attrs","$parse","pipUtils","pipStrings","pipRest","$http","pipImageUtils",function(e,t,i,l,n,o,a,r,d,c){function p(){m.css("display","none"),h.css("display","none"),P.css("display","none"),f.css("display","none"),g.attr("src",""),s.css("display","none"),g.css("display","inline-block"),u()}function u(){var t=b(e),l=y(e),n=C(e),o=x(e);m.css("display","none"),h.css("display","none"),P.css("display","none"),f.css("display","none");var r=c.getAvatarUrl(l,t,n,o,!1,!1);if(o&&n&&l||l&&t)if(o&&n&&l){if("category"==o)return;if("goals"==E[o]||"areas"==E[o])g.attr("src",r),s.css("display","none"),g.css("display","inline-block");else{f.css("display","block");var d=a.hashCode(n)%w.length;switch(i.addClass(I[d]),o){case"vision":s.css("display","none"),h.css("display","inline-block"),m.css("display","none"),P.css("display","none"),g.css("display","none");break;case"event":s.css("display","none"),m.css("display","inline-block"),h.css("display","none"),P.css("display","none"),g.css("display","none");break;case"note":s.css("display","none"),P.css("display","inline-block"),m.css("display","none"),h.css("display","none"),g.css("display","none")}}}else g.attr("src",r),s.css("display","none"),g.css("display","inline-block")}var s=i.children("md-icon"),g=i.children("img"),f=i.children("div"),h=i.find("#icon-film"),m=i.find("#icon-task"),P=i.find("#icon-folder"),v=null,y=n(l.pipPartyId),b=n(l.pipPartyName),x=n(l.pipEntityType),C=n(l.pipId),w=c.getAvatarColors(),I=c.getColorClasses(),E=c.getEntityTypes();g.load(function(e){v=$(e.target),c.setImageMarginCSS(i,v)}),i.addClass("pip-avatar flex-fixed"),l.ngClass&&e.$watch(l.ngClass,function(){setTimeout(function(){c.setImageMarginCSS(i,v)},50)}),u(),o.toBoolean(l.pipRebindAvatar)&&t.$on("pipPartyAvatarUpdated",p),o.toBoolean(l.pipRebind)&&(e.$watch(y,function(e,t){t!==e&&u()}),e.$watch(C,function(e,t){t!==e&&u()}))}])}(),function(){"use strict";var e=angular.module("pipAvatarEdit",["ui.event","angularFileUpload","pipPicturePaste","pipRest","pipImageUtils","pipPictures.Templates"]);e.config(["pipTranslateProvider",function(e){e.translations("en",{PICTURE_EDIT_TEXT:"Click here to upload a picture"}),e.translations("ru",{PICTURE_EDIT_TEXT:"Нажмите сюда для загрузки картинки"})}]),e.directive("pipAvatarEdit",function(){return{restrict:"EA",scope:{ngDisabled:"&",pipPartyId:"&",pipEntityType:"&",pipId:"&",pipCreated:"&",pipChanged:"&",pipReset:"&"},templateUrl:"picture_edit/picture_edit.html",controller:"pipAvatarEditController"}}),e.controller("pipAvatarEditController",["$scope","$element","$attrs","$http","$upload","$rootScope","pipPicturePaste","pipRest","pipImageUtils",function(e,t,i,l,n,o,a,r,d){function c(t){if(e.control.progress=0,e.control.uploading=!1,e.control.uploaded=!1,e.control.file=null,e.control.state="original",e.control.url="",t)e.onChange();else{var i=d.getAvatarUrl(e.pipPartyId(),"",e.pipId(),e.pipEntityType(),!1,!0);if(!i)return;e.control.progress=0,e.control.url=i,e.control.uploaded=""!=e.control.url,e.onChange()}}function p(){return e.pipEntityType()&&e.pipId()&&e.pipPartyId()?_+"/api/parties/"+e.pipPartyId()+"/"+E[e.pipEntityType()]+"/"+e.pipId()+"/avatar":e.pipPartyId()&&!e.pipEntityType()?i.pipEntityType||i.pipId?"":_+"/api/parties/"+e.pipPartyId()+"/avatar":""}function u(){var t=e.control.url,i=p(),l=t.slice(t.lastIndexOf("/")+1,t.length).split("?")[0];return i+"?name="+l+"&url="+t}function s(t,i){var o=e.control,a=o.file;if(null!==e.control.file){var r=new FileReader,d=p();r.onload=function(e){o.uploading=!0;n.http({url:d+"?name="+a.name,headers:{"Content-Type":a.type},data:e.target.result}).then(function(e){o.reset(),t&&t(e)},function(e){o.uploading=!1,o.upload=!1,o.progress=0,i?i(e):console.error(e)},function(e){o.progress=Math.min(100,parseInt(100*e.loaded/e.total))})},r.readAsArrayBuffer(a)}else{var c=u();o.uploading=!0,l.post(c).success(function(e){o.reset(),t&&t(e)}).error(function(e){o.uploading=!1,o.upload=!1,i?i(e):console.error(e)})}}function g(t,i){var n=e.control;l["delete"](p()).success(function(e){n.reset(!0),t&&t()}).error(function(e){n.uploading=!1,n.upload=!1,n.progress=0,i?i(e):console.error(e)})}function f(t,i){"changed"==e.control.state?s(t,i):"deleted"==e.control.state?g(t,i):t&&t()}function h(){return""==e.control.url&&!e.control.uploading}function m(){return"original"!=e.control.state}function P(t,i){e.control.file=i,e.control.url=t,e.control.state="changed",e.onChange()}function v(t){t.stopPropagation(),w.focus(),e.control.file=null,e.control.url="",e.control.state="deleted",e.onChange()}function y(t){13==t.keyCode||32==t.keyCode?setTimeout(function(){w.trigger("click")},0):46==t.keyCode||8==t.keyCode?(e.control.file=null,e.control.url="",e.control.state="deleted",e.onChange()):27==t.keyCode&&e.control.reset()}function b(t){e.$apply(function(){e.control.url="";var i=$(t.target);d.setErrorImageCSS(i,{width:"auto",height:"100%"})})}function x(t){var i=$(t.target);d.setImageMarginCSS({clientWidth:80,clientHeight:80},i),e.control.uploading=!1}function C(){e.pipChanged&&e.pipChanged({$event:{sender:e.control},$control:e.control})}var w=t.children(".pip-picture-upload"),I=w.children("input[type=file]"),E=d.getEntityTypes(),_=r.serverUrl();e.text=i.pipDefaultText||"PICTURE_EDIT_TEXT",e.icon=i.pipDefaultIcon||"picture-no-border",e.control={url:"",progress:0,uploaded:!1,uploading:!1,loaded:!1,file:null,state:"original"},e.control.reset=c,e.control.save=f,e.empty=h,e.isUpdated=m,e.readItemLocally=P,e.onDeleteClick=v,e.onKeyDown=y,e.onImageError=b,e.onImageLoad=x,e.onChange=C,e.$watch(e.pipId,function(t){e.pipReset()!==!1&&e.control.reset()}),e.$watch(e.pipPartyId,function(t){e.pipReset()!==!1&&e.control.reset()}),e.$watch(e.ngDisabled,function(t){I.attr("disabled",e.control.disabled)}),t.children(".pip-picture-upload").focus(function(){a.addPasteListener(function(t){e.readItemLocally(t.url,t.file)})}),t.children(".pip-picture-upload").blur(function(){a.removePasteListener()}),t.addClass("pip-picture-edit"),e.pipCreated&&e.pipCreated({$event:{sender:e.control},$control:e.control}),e.control.reset()}])}(),function(){"use strict";var e=angular.module("pipCameraDialog",["ngMaterial","pipCore","pipPictures.Templates"]);e.config(["pipTranslateProvider",function(e){e.translations("en",{TAKE_PICTURE:"Take a picture",WEB_CAM_ERROR:"Webcam is missing or was not found"}),e.translations("ru",{TAKE_PICTURE:"Сделать фото",WEB_CAM_ERROR:"Web-камера отсутствует или не найдена"})}]),e.factory("pipCameraDialog",["$mdDialog",function(e){return{show:function(t){e.show({templateUrl:"camera_dialog/camera_dialog.html",clickOutsideToClose:!0,controller:"pipCameraController"}).then(function(e){Webcam.reset(),console.log(e),t&&t(e)},function(){Webcam.reset()})}}}]),e.controller("pipCameraController",["$scope","$rootScope","$timeout","$mdMenu","$mdDialog","pipUtils",function(e,t,i,l,n,o){function a(){navigator.camera.getPicture(r,d,{sourceType:Camera.PictureSourceType.CAMERA,correctOrientation:!0,quality:75,targetWidth:200,destinationType:Camera.DestinationType.DATA_URL})}function r(e){var t=e,t="data:image/jpeg;base64,"+e;n.hide(t)}function d(e){alert("Failed because: "+e),n.hide()}function c(){Webcam&&(e.$freeze?Webcam.snap(function(t){e.$freeze=!1,n.hide(t)}):(e.$freeze=!0,Webcam.freeze()))}function p(){e.$freeze=!1,Webcam.unfreeze()}function u(){n.cancel()}e.browser=o.getBrowser().os,e.theme=t.$theme,"android"!==e.browser?(console.log("webcam"),Webcam.init(),setTimeout(function(){Webcam.attach(".camera-stream")},0),Webcam.on("error",function(t){e.webCamError=!0,console.error(t)}),Webcam.set({width:400,height:300,dest_width:400,dest_height:300,crop_width:400,crop_height:300,image_format:"jpeg",jpeg_quality:90}),Webcam.setSWFLocation("webcam.swf")):document.addEventListener("deviceready",a,!1),e.$freeze=!1,e.onTakePictureClick=c,e.onResetPicture=p,e.onCancelClick=u}])}(),function(){"use strict";var e=angular.module("pipCollage",["pipCore","pipRest"]);e.directive("pipCollage",function(){return{restrict:"EA",scope:!1,controller:"pipCollageController"}}),e.controller("pipCollageController",["$scope","$element","$attrs","$parse","$rootScope","pipUtils","pipStrings","pipRest","pipImageUtils",function(e,t,i,l,n,o,a,r,d){function c(){var e=t.find("img"),i=0;for(i;i<e.length;i++){var l=angular.element(e[i].parentElement),n=angular.element(e[i]);"none"!=n.css("display")&&d.setImageMarginCSS(l,n)}var o=t.find("md-icon"),i=0;for(i;i<o.length;i++){var l=angular.element(o[i].parentElement),a=angular.element(o[i]);"none"!=l.css("display")&&d.setIconMarginCSS(l[0],a)}}function p(){var e={h:t.height(),w:t.width()};return e}function u(e){var t=$(e.target),i=t.parent(),l=i.children("div"),n=t.parent().find("md-icon");l.css("display","block"),t.css("display","none"),d.setIconMarginCSS(i[0],n),n.empty().append(E)}function s(e){var t=$(e.target),i=t.parent(),l=i.children("div");d.setImageMarginCSS(i,t),l.css("display","none")}function g(t){var i=I[t-1];if(1==i.length)return i[0];var l=x?""+x(e):"",n=a.hashCode(l);return i[n%i.length]}function f(){if(b){var t=b(e);return _.clone(t)}if(y){for(var i=y(e)||[],l=r.serverUrl(),o=(n.$user||{}).id,a=(n.$party||{}).id||o,d=[],c=0;c<i.length;c++)d.push(l+"/api/parties/"+a+"/files/"+i[c]+"/content");return d}return[]}function h(e,t){var i=e[0],l="",n="";return e.splice(0,1),l+=t.fullWidth?" pip-full-width":"",l+=t.fullHeight?" pip-full-height":"",l+=" flex-"+t.flex,n+=t.leftPadding?" pip-left":"",n+=t.rightPadding?" pip-right":"",n+=t.topPadding?" pip-top":"",n+=t.bottomPadding?" pip-bottom":"",w?'<a class="pip-picture-container'+l+'" flex="'+t.flex+'" href="'+i+'" target="_blank"><div class="pip-picture'+n+'"><img src="'+i+'"/><div><md-icon></md-icon></div></div></a>':'<div class="pip-picture-container'+l+'" flex="'+t.flex+'"><div class="pip-picture'+n+'"><img src="'+i+'"/><div><md-icon></md-icon></div></div></div>'}function m(e,t){var i,l="";l+=t.fullWidth?" pip-full-width":"",l+=t.fullHeight?" pip-full-height":"",l+=" flex-"+t.flex,l+=" layout-"+t.layout,i='<div class="pip-picture-group layout'+l+'" flex="'+t.flex+'" layout="'+t.layout+'">';for(var n=0;n<t.children.length;n++)i+=P(e,t.children[n]);return i+="</div>"}function P(e,t){return t.group?m(e,t):h(e,t)}function v(i){t.find("img").unbind("error").unbind("load"),t.empty();var i=f();if(0==i.length)return void t.hide();if(i.length>8){var l=!!C&&C(e);l||(i.length=8)}if(i.length<=8){var n=g(i.length),o='<div class="pip-collage-section">'+P(i,n)+"</div>";o+='<div class="clearfix"></div>',t.html(o)}else{for(var o="";i.length>0;){var a=i.splice(0,8),n=g(a.length);o+='<div class="pip-collage-section">'+P(a,n)+"</div>"}o+='<div class="clearfix"></div>',t.html(o)}t.find("img").bind("error",u).bind("load",s),t.show()}var y=i.pipPictureIds?l(i.pipPictureIds):null,b=i.pipSrcs?l(i.pipSrcs):null,x=i.pipUniqueCode?l(i.pipUniqueCode):null,C=i.pipMultiple?l(i.pipMultiple):null,w=o.toBoolean(i.pipOpen),I=d.getCollageSchemes(),E='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg version="1.1"xmlns="http://www.w3.org/2000/svg"xmlns:xlink="http://www.w3.org/1999/xlink"x="0px" y="0px"viewBox="0 0 510 510"style="enable-background:new 0 0 515 515;"xml:space="preserve"><defs><style type="text/css"><![CDATA[#symbol-picture-no-border { transform-origin: 50% 50%; transform: scale(0.6, -0.6); } ]]></style> </defs><rect x="0" width="515" height="515"/><path id="symbol-picture-no-border" d="M120 325l136-102 69 33 136-82 0-54-410 0 0 136z m341 15c0-28-23-51-51-51-29 0-52 23-52 51 0 29 23 52 52 52 28 0 51-23 51-52z" /></svg>';t.addClass("pip-collage"),o.toBoolean(i.pipRebind)&&(b?(e.$watch(b,function(e){v()}),e.$watchCollection(b,function(e){v()})):y&&e.$watch(y,function(e){v()})),e.getElementDimensions=p;_.debounce(c,50);e.$watch(e.getElementDimensions,function(e,t){e&&t&&t.h==e.h&&t.w==e.w||c()},!0),v()}])}(),function(){"use strict";var e=angular.module("pipGallerySearchDialog",["ngMaterial","pipCore","pipPictures.Templates","pipRest"]);e.config(["pipTranslateProvider",function(e){e.translations("en",{IMAGE_GALLERY:"Add from image gallery",SEARCH_PICTURES:"Search for pictures...",IMAGE_START_SEARCH:"Images will appear here once you start searching"}),e.translations("ru",{IMAGE_GALLERY:"Добавить из галереи изображений",SEARCH_PICTURES:"Поиск изображений...",IMAGE_START_SEARCH:"Картинки появятся после начала поиска"})}]),e.factory("pipGallerySearchDialog",["$mdDialog",function(e){return{show:function(t,i){e.show({templateUrl:"gallery_search_dialog/gallery_search_dialog.html",clickOutsideToClose:!0,controller:"pipGallerySearchController",locals:{multiple:i}}).then(function(e){t&&t(e)},function(){})}}}]),e.controller("pipGallerySearchController",["$scope","$rootScope","$timeout","$mdMenu","$mdDialog","$http","pipRest","multiple","pipTransaction",function(e,t,i,l,n,o,a,r,d){function c(){if(!e.transaction.busy()&&""!=e.$search&&e.$search!=P){P=e.$search,e.$images=[],e.stop=null;var t=v+"?q="+e.$search,i=e.transaction.begin("ENTERING");i&&o.get(t).success(function(t){if(!e.transaction.aborted(i)){for(var l=0;l<t.length;l++)e.$images.push({checked:!1,url:t[l].link,thumbnail:t[l].thumbnail});e.transaction.end()}}).error(function(e){console.error(e)})}}function p(){e.transaction.abort(),P=""}function u(t){13===t.keyCode&&e.onSearchClick()}function s(t){e.transaction.busy()||(t.checked=!t.checked,r?t.checked?y.push(t):_.remove(y,{url:t.url}):t.checked?y.length>0?(y[0].checked=!1,y[0]=t):y.push(t):y=[])}function g(){if(!e.transaction.busy()){var t=[];y.forEach(function(e){e.checked&&t.push(e.url)}),n.hide(t)}}function f(){n.cancel()}function h(){return 0==y.length||e.transaction.busy()}function m(){setTimeout(function(){var e=$(".pip-gallery-search-dialog .search-images");e.length>0&&e.focus()},0)}var P="",v=a.serverUrl()+"/api/images/search",y=[];e.theme=t.$theme,e.$serverUrl=a.serverUrl(),e.$search="",e.$images=[],e.transaction=d("search",e),e.onSearchClick=c,e.onKeyPress=u,e.onImageClick=s,e.onAddClick=g,e.onCancelClick=f,e.addButtonDisabled=h,e.onStopSearchClick=p,m()}])}(),function(){"use strict";var e=angular.module("pipPicture",["pipCore"]);e.directive("pipPicture",function(){return{restrict:"EA",scope:{src:"&pipSrc",pictureId:"=pipPictureId",defaultIcon:"=pipDefaultIcon"},template:"<img ui-event=\"{ error: 'onImageError($event)', load: 'onImageLoad($event)' }\"/><div><span></span></div>",controller:"pipPictureController"}}),e.controller("pipPictureController",["$scope","$element","$attrs","$rootScope","pipUtils","pipImageUtils","pipRest",function(e,t,i,l,n,o,a){function r(t){e.$apply(function(){var e=$(t.target);o.setErrorImageCSS(e),u.css("display","block")})}function d(e){var i=$(e.target);o.setImageMarginCSS(t,i),u.css("display","none")}function c(){if(e.pictureId){var t=a.serverUrl(),i=(l.$user||{}).id,n=(l.$party||{}).id||i,o=t+"/api/parties/"+n+"/files/"+e.pictureId+"/content";p.attr("src",o)}else e.src?p.attr("src",e.src()):p.attr("src","")}var p=t.children("img"),u=t.children("div");e.onImageError=r,e.onImageLoad=d,t.addClass("pip-picture"),c(),n.toBoolean(i.pipRebind)&&e.$watch(e.pictureId,function(t){e.pictureId!=t&&c()}),n.toBoolean(i.pipRebind)&&e.$watch(e.src,function(t){e.src!=t&&c()})}])}(),function(){"use strict";var e=angular.module("pipPictureEdit",["ui.event","angularFileUpload","pipRest","pipPicturePaste","pipTranslate","pipPictures.Templates"]);e.config(["pipTranslateProvider",function(e){e.translations("en",{ERROR_WRONG_IMAGE_FILE:"Incorrect image file. Please, choose another one",PICTURE_EDIT_TEXT:"Click here to upload a picture"}),e.translations("ru",{ERROR_WRONG_IMAGE_FILE:"Неправильный файл с изображением. Выберете другой файл",PICTURE_EDIT_TEXT:"Нажмите сюда для загрузки картинки"})}]),e.directive("pipPictureEdit",function(){return{restrict:"EA",scope:{ngDisabled:"&",pipCreated:"&",pipChanged:"&",pipReset:"&",pipPictureId:"=",pipAddedPicture:"="},templateUrl:"picture_edit/picture_edit.html",controller:"pipPictureEditController"}}),e.controller("pipPictureEditController",["$scope","$element","$attrs","$http","$upload","$timeout","$rootScope","$parse","pipRest","pipPicturePaste","pipImageUtils","pipUtils",function(e,t,i,l,n,o,a,r,d,c,p,u){function s(t){e.control.progress=0,e.control.uploading=!1,e.control.uploaded=!1,e.control.file=null,e.control.state=e.pictureStartState,e.control.url="";var i="";if(t)e.onChange();else{if(a.$party&&a.$party.id&&e.pipPictureId&&(i=R+"/"+e.pipPictureId+"/content"),!i)return;e.control.url=i,e.control.uploaded=!0,e.onChange()}}function g(){var t=e.control.url,i=t.slice(t.lastIndexOf("/")+1,t.length).split("?")[0];return R+"?name="+i+"&url="+t}function f(){c.addPasteListener(function(t){e.readItemLocally(t.url,t.file)})}function h(){c.removePasteListener()}function m(t,i){var o=e.control,a=o.file;if(null!==e.control.file){var r=new FileReader;r.onload=function(l){o.uploading=!0;n.http({url:R+"?name="+a.name,headers:{"Content-Type":a.type},data:l.target.result}).then(function(i){e.pipPictureId=i.data.id,o.reset(),t&&t(i)},function(e){o.uploading=!1,o.upload=!1,o.progress=0,i?i(e):console.error(e)},function(e){o.progress=Math.min(100,parseInt(100*e.loaded/e.total))})},r.readAsArrayBuffer(a)}else{var d=g();o.uploading=!0,l.post(d).success(function(i){e.pipPictureId=i.id,o.reset(),t&&t(i)}).error(function(e){o.uploading=!1,o.upload=!1,i?i(e):console.error(e)})}}function P(t,i){var n=e.control;l["delete"](R+"/"+e.pipPictureId).success(function(i){e.pipPictureId=null,n.reset(!0),t&&t()}).error(function(e){n.uploading=!1,n.upload=!1,n.progress=0,i?i(e):console.error(e)})}function v(t,i){"changed"==e.control.state?m(t,i):"deleted"==e.control.state?P(t,i):t&&t()}function y(){return""==e.control.url&&!e.control.uploading}function b(){return"original"!=e.control.state; }function x(t,i){e.control.file=i,e.control.url=t,e.control.state="changed",e.onChange()}function C(t){t.stopPropagation(),T.focus(),e.control.file=null,e.control.url="","copied"!=e.control.state&&(e.control.state="deleted"),e.onChange()}function w(t){13==t.keyCode||32==t.keyCode?setTimeout(function(){T.trigger("click")},0):46==t.keyCode||8==t.keyCode?(e.control.file=null,e.control.url="",e.control.state="deleted",e.onChange()):27==t.keyCode&&e.control.reset()}function I(t){e.$apply(function(){e.control.url="";var i=$(t.target);p.setErrorImageCSS(i,{width:"auto",height:"100%"})})}function E(t){var i=$(t.target);p.setImageMarginCSS({clientWidth:80,clientHeight:80},i),e.control.uploading=!1}function _(){e.pipChanged&&e.pipChanged({$event:{sender:e.control},$control:e.control})}var T=t.children(".pip-picture-upload"),k=T.children("input[type=file]"),W=d.serverUrl(),R=W+"/api/parties/"+a.$party.id+"/files";e.text=i.pipDefaultText||"PICTURE_EDIT_TEXT",e.icon=i.pipDefaultIcon||"picture-no-border",e.pictureStartState=u.toBoolean(e.pipAddedPicture)?"copied":"original",e.control={url:"",progress:0,uploaded:!1,uploading:!1,loaded:!1,file:null,state:e.pictureStartState},e.control.reset=s,e.control.save=v,e.empty=y,e.isUpdated=b,e.readItemLocally=x,e.onDeleteClick=C,e.onKeyDown=w,e.onImageError=I,e.onImageLoad=E,e.onChange=_,e.onBlur=h,e.onFocus=f,u.toBoolean(i.pipRebind)&&e.$watch("pipPictureId",function(t){e.control.reset()}),e.$watch(e.ngDisabled,function(t){k.attr("disabled",e.control.disabled)}),t.addClass("pip-picture-edit"),e.control.reset(),e.pipCreated&&e.pipCreated({$event:{sender:e.control},$control:e.control})}])}(),function(){"use strict";var e=angular.module("pipPictureListEdit",["ui.event","angularFileUpload","pipCore","pipFocused","pipRest","pipPicturePaste"]);e.config(["pipTranslateProvider",function(e){e.translations("en",{PICTURE_LIST_EDIT_TEXT:"Click here to add a picture",ERROR_TRANSACTION_IN_PROGRESS:"Transaction is in progress. Please, wait until it is finished or abort",ERROR_IMAGE_PRELOADING:"Image loading error. The picture can not be saved"}),e.translations("ru",{PICTURE_LIST_EDIT_TEXT:"Нажмите сюда чтобы добавить картинку",ERROR_TRANSACTION_IN_PROGRESS:"Транзакция еще не завершена. Подождите окончания или прервите её",ERROR_IMAGE_PRELOADING:"Ошибка при загрузки картинки. Картинка не сохранена."})}]),e.directive("pipPictureListEdit",function(){return{restrict:"EA",scope:{pipPictureIds:"=",pipAddedPicture:"=",ngDisabled:"&",pipCreated:"&",pipChanged:"&"},templateUrl:"picture_list_edit/picture_list_edit.html",controller:"pipPictureListEditController"}}),e.controller("pipPictureListEditController",["$scope","$rootScope","$element","$attrs","$parse","$http","$upload","$timeout","pipUtils","pipRest","pipPicturePaste","pipImageUtils",function(e,t,i,l,n,o,a,r,d,c,p,u){function s(t){var i=c.serverUrl(),l=e.$party?e.$party.id:c.userId();return i+"/api/parties/"+l+"/files/"+t+"/content"}function g(e,t){t.error=!0}function f(t){p.addPasteListener(function(t){e.readItemLocally(t.url,t.file)})}function h(){p.removePasteListener()}function m(){var t=e.pipPictureIds,i=[];if(null==t||0==t.length)return i;for(var l=0;l<t.length;l++)i.push({pin:U++,id:t[l],uploading:!1,uploaded:!1,progress:0,file:null,url:s(t[l]),state:e.pictureStartState});return i}function P(){e.pipPictureIds&&e.pipPictureIds.length>0&&e.pipPictureIds.splice(0,e.pipPictureIds.length);for(var t=0;t<e.control.items.length;t++){var i=e.control.items[t];i.id&&e.pipPictureIds.push(i.id)}}function v(){e.control.uploading=0,e.control.items=m()}function y(t){var i=t.url.slice(t.url.lastIndexOf("/")+1,t.url.length).split("?")[0],l=c.serverUrl(),n=e.$party?e.$party.id:c.userId();return l+"/api/parties/"+n+"/files?name="+i+"&url="+t.url}function b(t){var i=c.serverUrl(),l=e.$party?e.$party.id:c.userId();return i+"/api/parties/"+l+"/files?name="+t.file.name}function x(e,t){if(null!==e.file){var i=e.file,l=new FileReader;l.onload=function(l){e.uploading||(e.uploading=!0,e.upload=a.http({url:b(e),headers:{"Content-Type":i.type},data:l.target.result}).then(function(i){e.id=i.data?i.data.id:null,e.uploaded=!0,e.uploading=!1,e.progress=0,e.upload=null,e.file=null,e.url=s(e.id),e.state="original",t()},function(i){e.uploaded=!1,e.uploading=!1,e.progress=0,e.upload=null,t(i)},function(t){e.progress=Math.min(100,parseInt(100*t.loaded/t.total))}))},l.readAsArrayBuffer(i)}else{var n=y(e);e.uploading=!0,o.post(n).success(function(i){e.id=i.data?i.data.id:i.id||null,e.uploaded=!0,e.uploading=!1,e.progress=0,e.upload=null,e.file=null,e.url=s(e.id),e.state="original",t()}).error(function(i){e.uploaded=!1,e.uploading=!1,e.progress=0,e.upload=null,t()})}}function C(t){var i=c.serverUrl(),l=e.$party?e.$party.id:c.userId();return i+"/api/parties/"+l+"/files/"+t.id}function w(t,i){var l=e.control;t.upload&&(t.upload.abort(),t.upload=null),"deleted"==t.state&&o["delete"](C(t)).success(function(e){_.remove(l.items,{pin:t.pin}),i()}).error(function(e,n){null==e?_.remove(l.items,{pin:t.pin}):(t.uploaded=!1,t.uploading=!1,t.progress=0,t.upload=null),i(e)})}function I(t,i){var l=e.control;if(l.uploading)return void(i&&i("ERROR_TRANSACTION_IN_PROGRESS"));l.error=null,l.uploading=0;for(var n=function(e){e&&!l.error&&(l.error=e),l.uploading--,0==l.uploading&&(l.error?i?i(l.error):console.error(l.error):(P(),t&&t()))},o=0;o<l.items.length;o++){var a=l.items[o];"added"!=a.state||a.error?"deleted"==a.state&&(l.uploading++,w(a,n)):(l.uploading++,x(a,n))}0==l.uploading&&t&&t()}function E(){for(var t=e.control,i=0;i<t.items.length;i++){var l=t.items[i];l.uploading&&(l.upload&&l.upload.abort(),l.uploaded=!1,l.uploading=!1,l.progress=0,l.upload=null)}t.uploading=0}function T(t,i){e.control.items.push({pin:U++,id:null,uploading:!1,uploaded:!1,progress:0,file:i,url:t,state:"added"}),e.onChange()}function k(e){if(D.focus(),null!=e&&0!=e.length)for(var t=0;t<e.length;t++){var i=e[t];i.type.indexOf("image")>-1&&T(i)}}function W(t){"added"==t.state||"copied"==t.state?_.remove(e.control.items,{pin:t.pin}):t.state="deleted",e.onChange()}function R(t,i){i?46!=t.keyCode&&8!=t.keyCode||("added"==i.state?_.remove(e.control.items,{pin:i.pin}):i.state="deleted",e.onChange()):13!=t.keyCode&&32!=t.keyCode||setTimeout(function(){D.trigger("click")},0)}function A(e,t){t.error=!1,setTimeout(function(){var t=$(e.target);u.setImageMarginCSS({clientWidth:80,clientHeight:80},t)},250),t.loaded=!0}function S(){e.pipChanged&&e.pipChanged({$event:{sender:e.control},$control:e.control})}var D=i.children(".pip-picture-drop"),U=0;e.text=l.pipDefaultText||"PICTURE_LIST_EDIT_TEXT",e.icon=l.pipDefaultIcon||"picture-no-border",e.pipRebind=d.toBoolean(l.pipRebind),e.pictureStartState=d.toBoolean(e.pipAddedPicture)?"copied":"original",e.control={uploading:0,items:[]},e.control.reset=v,e.control.save=I,e.control.abort=E,e.filterItem=function(e){return"deleted"!=e.state},e.readItemLocally=T,e.onSelectClick=k,e.onDeleteClick=W,e.onKeyDown=R,e.onImageError=g,e.onImageLoad=A,e.onChange=S,e.onBlur=h,e.onFocus=f,e.pipRebind&&e.$watch(function(){return e.pipPictureIds},function(t){e.control.reset()}),i.addClass("pip-picture-list-edit"),e.control.reset(),e.pipCreated&&e.pipCreated({$event:{sender:e.control},$control:e.control})}])}(),function(){"use strict";var e=angular.module("pipPictureUrlDialog",["ngMaterial","pipCore","pipPictures.Templates"]);e.config(["pipTranslateProvider",function(e){e.translations("en",{PICTURE_FROM_WEBLINK:"Add from web link",LINK_PICTURE:"Link to the picture..."}),e.translations("ru",{PICTURE_FROM_WEBLINK:"Добавить из веб ссылки",LINK_PICTURE:"Ссылка на изображение..."})}]),e.factory("pipPictureUrlDialog",["$mdDialog",function(e){return{show:function(t){e.show({templateUrl:"picture_url_dialog/picture_url_dialog.html",clickOutsideToClose:!0,controller:"pipPictureUrlDialogController"}).then(function(e){t&&t(e)})}}}]),e.controller("pipPictureUrlDialogController",["$scope","$rootScope","$timeout","$mdMenu","$mdDialog","pipImageUtils",function(e,t,i,l,n,o){function a(e){var t=e.width(),i=e.height(),l={};t>i?(l.width="250px",l.height="auto"):(l.width="auto",l.height="250px"),e.css(l)}function r(){var t=$("img#url_image").on("error",function(){e.invalid=!0,e.$apply()}).on("load",function(){e.invalid=!1,a(t),e.$apply()}).attr("src",e.url)}function d(){n.cancel()}function c(){n.hide(e.url)}e.url="",e.invalid=!0,e.theme=t.$theme,e.checkUrl=r,e.onCancelClick=d,e.onAddClick=c}])}(),function(){"use strict";var e=angular.module("pipPicturePaste",[]);e.factory("pipPicturePaste",["$timeout",function(e){var t={},i=null;return t.addPasteListener=function(t){window.Clipboard||(null!==i&&this.removePasteElement(),i=document.createElement("div"),i.setAttribute("contenteditable","true"),$(i).css({position:"absolute",left:"-999",width:"0",height:"0",overflow:"hidden",outline:0}),document.body.appendChild(i)),$(document).on("paste",function(i){if(null==i.clipboardData&&i.originalEvent&&(i=i.originalEvent),i.clipboardData){var l=i.clipboardData.items;_.each(l,function(i){if(i.type.indexOf("image")!=-1){var l=i.getAsFile(),n=new FileReader;n.onload=function(i){e(function(){t({url:i.target.result,file:l})})},n.readAsDataURL(l)}})}else window.clipboardData&&window.clipboardData.files&&_.each(window.clipboardData.files,function(i){var l=new FileReader;l.onload=function(l){e(function(){t({url:l.target.result,file:i})})},l.readAsDataURL(i)})})},t.removePasteListener=function(){window.Clipboard||null!==i&&(document.body.removeChild(i),i=null),$(document).off("paste")},t}])}(),function(){"use strict";var e=angular.module("pipImageUtils",[]);e.service("pipImageUtils",["$http","pipStrings","$rootScope","pipRest",function(e,t,i,l){function n(){return h}function o(){return g}function a(){return f}function r(){return m}function d(e,i,n,o,a,r){var d=1e3*Math.floor((new Date).getTime()/1e3),c=t.hashCode(n)%f.length,p=null,u=null,s="",g=l.serverUrl();if(a=a&&a===!0?"&no_redirect=true":"",o&&n&&e||e)if(o&&n&&e){if("category"==o)return;r||(s="default_template="+o+"&bg="+f[c]+"&fg=white&"),"goals"!=h[o]&&"areas"!=h[o]||(u=g+"/api/parties/"+e+"/"+h[o]+"/"+n+"/avatar?"+s+"timestamp="+d+"&obj_id="+n+a)}else e&&i?(c=t.hashCode(e)%f.length,p=(i[0]||"?").toUpperCase(),r||(s="default_template=letter&bg="+f[c]+"&fg=white&chr="+p+"&"),u=g+"/api/parties/"+e+"/avatar?"+s+"timestamp="+d+"&obj_id="+e+a):!e||o||n||(u=g+"/api/parties/"+e+"/avatar?timestamp="+d+"&obj_id="+e+a);return u}function c(t,n,o){var a,r=(i.$user||{}).id,d=(i.$party||{}).id||r,c=l.serverUrl()+"/api/parties/"+d+"/files/"+t;c&&e.get(c).success(function(e){a=e&&e.url?e.url:"",n&&n(a)}).error(function(e){o&&o(e)})}function p(e,t){var i={width:"","margin-left":"",height:"","margin-top":""};t&&(i=_.assign(i,t)),e&&e.css(i)}function u(e,t,i){var l=e.width?e.width():e.clientWidth,n=e.height?e.height():e.clientHeight,o=t[0].naturalWidth||t.width,a=t[0].naturalHeight||t.height,r=0,d={};o/l>a/n?(r=-((o/a*n-l)/2),d["margin-left"]=""+r+"px",d.height=""+n+"px",d.width=""+o*n/a+"px",d["margin-top"]=""):(r=-((a/o*l-n)/2),d["margin-top"]=""+r+"px",d.height=""+a*l/o+"px",d.width=""+l+"px",d["margin-left"]=""),i&&(d=_.assign(d,i)),t.css(d)}function s(e,t){var i=e.clientWidth?e.clientWidth:e.width,l=e.clientHeight?e.clientHeight:e.height,n=0,o=i>l?l:i,a={width:""+o+"px","margin-left":"",height:""+o+"px","margin-top":""};i>l?(n=(i-l)/2,a["margin-left"]=""+n+"px"):(n=(l-i)/2,a["margin-top"]=""+n+"px"),t.css(a)}var g=["pip-avatar-color-0","pip-avatar-color-1","pip-avatar-color-2","pip-avatar-color-3","pip-avatar-color-4","pip-avatar-color-5","pip-avatar-color-6","pip-avatar-color-7","pip-avatar-color-8","pip-avatar-color-9","pip-avatar-color-10","pip-avatar-color-11","pip-avatar-color-12","pip-avatar-color-13","pip-avatar-color-14","pip-avatar-color-15"],f=["rgba(239,83,80,1)","rgba(236,64,122,1)","rgba(171,71,188,1)","rgba(126,87,194,1)","rgba(92,107,192,1)","rgba(3,169,244,1)","rgba(0,188,212,1)","rgba(0,150,136,1)","rgba(76,175,80,1)","rgba(139,195,74,1)","rgba(205,220,57,1)","rgba(255,193,7,1)","rgba(255,152,0,1)","rgba(255,87,34,1)","rgba(121,85,72,1)","rgba(96,125,139,1)"],h={goal:"goals",objective:"goals",dream:"goals",accomplishment:"goals",area:"areas",overall:"visions",vision:"visions",event:"events",instance:"events"},m=[[{flex:100,fullWidth:!0,fullHeight:!0}],[{group:!0,layout:"row",flex:100,fullHeight:!0,children:[{flex:50,fullHeight:!0,rightPadding:!0},{flex:50,fullHeight:!0,leftPadding:!0}]}],[{group:!0,layout:"row",flex:100,fullHeight:!0,children:[{flex:33,fullHeight:!0,rightPadding:!0},{flex:33,fullHeight:!0,leftPadding:!0,rightPadding:!0},{flex:33,fullHeight:!0,leftPadding:!0}]},{group:!0,layout:"row",flex:100,fullHeight:!0,children:[{flex:50,fullHeight:!0,rightPadding:!0},{group:!0,layout:"column",flex:50,fullHeight:!0,children:[{flex:50,leftPadding:!0,bottomPadding:!0},{flex:50,leftPadding:!0,topPadding:!0}]}]},{group:!0,layout:"row",flex:100,fullHeight:!0,children:[{flex:70,fullHeight:!0,rightPadding:!0},{group:!0,layout:"column",flex:30,fullHeight:!0,children:[{flex:50,leftPadding:!0,bottomPadding:!0},{flex:50,leftPadding:!0,topPadding:!0}]}]},{group:!0,layout:"column",flex:100,fullHeight:!0,children:[{flex:50,fullWidth:!0,bottomPadding:!0},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,rightPadding:!0,topPadding:!0},{flex:50,leftPadding:!0,topPadding:!0}]}]}],[{group:!0,layout:"column",flex:100,fullHeight:!0,children:[{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,rightPadding:!0,bottomPadding:!0},{flex:50,fullWidth:!0,leftPadding:!0,bottomPadding:!0}]},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,rightPadding:!0,topPadding:!0},{flex:50,fullWidth:!0,leftPadding:!0,topPadding:!0}]}]},{group:!0,layout:"row",flex:100,fullHeight:!0,children:[{flex:50,fullWidth:!0,rightPadding:!0},{group:!0,layout:"column",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,leftPadding:!0,bottomPadding:!0},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,leftPadding:!0,rightPadding:!0,topPadding:!0},{flex:50,fullWidth:!0,leftPadding:!0,topPadding:!0}]}]}]},{group:!0,layout:"row",flex:100,fullHeight:!0,children:[{flex:30,fullWidth:!0,rightPadding:!0},{group:!0,layout:"column",flex:70,fullHeight:!0,children:[{flex:50,fullWidth:!0,leftPadding:!0,bottomPadding:!0},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,leftPadding:!0,rightPadding:!0,topPadding:!0},{flex:50,fullWidth:!0,leftPadding:!0,topPadding:!0}]}]}]},{group:!0,layout:"column",flex:100,fullHeight:!0,children:[{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:100,fullWidth:!0,bottomPadding:!0}]},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:33,fullWidth:!0,rightPadding:!0,topPadding:!0},{flex:33,fullWidth:!0,leftPadding:!0,rightPadding:!0,topPadding:!0},{flex:33,fullWidth:!0,leftPadding:!0,topPadding:!0}]}]}],[{group:!0,layout:"column",flex:100,fullHeight:!0,children:[{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,rightPadding:!0,bottomPadding:!0},{flex:50,fullWidth:!0,leftPadding:!0,bottomPadding:!0}]},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:33,fullWidth:!0,rightPadding:!0,topPadding:!0},{flex:33,fullWidth:!0,leftPadding:!0,rightPadding:!0,topPadding:!0},{flex:33,fullWidth:!0,leftPadding:!0,topPadding:!0}]}]},{group:!0,layout:"row",flex:100,fullHeight:!0,children:[{flex:50,fullWidth:!0,rightPadding:!0},{group:!0,layout:"column",flex:50,fullHeight:!0,children:[{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,leftPadding:!0,rightPadding:!0,bottomPadding:!0},{flex:50,fullWidth:!0,leftPadding:!0,bottomPadding:!0}]},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,leftPadding:!0,rightPadding:!0,topPadding:!0},{flex:50,fullWidth:!0,leftPadding:!0,topPadding:!0}]}]}]},{group:!0,layout:"row",flex:100,fullHeight:!0,children:[{flex:33,fullWidth:!0,rightPadding:!0},{group:!0,layout:"column",flex:67,fullHeight:!0,children:[{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,leftPadding:!0,rightPadding:!0,bottomPadding:!0},{flex:50,fullWidth:!0,leftPadding:!0,bottomPadding:!0}]},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,leftPadding:!0,rightPadding:!0,topPadding:!0},{flex:50,fullWidth:!0,leftPadding:!0,topPadding:!0}]}]}]},{group:!0,layout:"column",flex:100,fullHeight:!0,children:[{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:100,fullWidth:!0,bottomPadding:!0}]},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:25,fullWidth:!0,rightPadding:!0,topPadding:!0},{flex:25,fullWidth:!0,leftPadding:!0,rightPadding:!0,topPadding:!0},{flex:25,fullWidth:!0,leftPadding:!0,rightPadding:!0,topPadding:!0},{flex:25,fullWidth:!0,leftPadding:!0,topPadding:!0}]}]}],[{group:!0,layout:"column",flex:100,fullHeight:!0,children:[{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:33,fullWidth:!0,rightPadding:!0,bottomPadding:!0},{flex:33,fullWidth:!0,leftPadding:!0,rightPadding:!0,bottomPadding:!0},{flex:33,fullWidth:!0,leftPadding:!0,bottomPadding:!0}]},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:33,fullWidth:!0,rightPadding:!0,topPadding:!0},{flex:33,fullWidth:!0,leftPadding:!0,rightPadding:!0,topPadding:!0},{flex:33,fullWidth:!0,leftPadding:!0,topPadding:!0}]}]},{group:!0,layout:"column",flex:100,fullHeight:!0,children:[{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,rightPadding:!0,bottomPadding:!0},{flex:25,fullWidth:!0,leftPadding:!0,rightPadding:!0,bottomPadding:!0},{flex:25,fullWidth:!0,leftPadding:!0,bottomPadding:!0}]},{group:!0,layout:"row",flex:50,fullHeight:!0,children:[{flex:50,fullWidth:!0,rightPadding:!0,topPadding:!0},{flex:25,fullWidth:!0,leftPadding:!0,rightPadding:!0,topPadding:!0},{flex:25,fullWidth:!0,leftPadding:!0,topPadding:!0}]}]},{group:!0,layout:"row",flex:100,fullHeight:!0,children:[{fle