angular.module("huellitas",["ngRoute","ngStorage","ngSanitize","ngAnimate","huellitasComponents","huellitasServices","underscore","angucomplete-alt"]),function(){"use strict";function e(e,t,o){t.interceptors.push("interceptorService"),o.debugInfoEnabled(!1),o.commentDirectivesEnabled(!1),o.cssClassDirectivesEnabled(!1),e.html5Mode(!0),e.hashPrefix("!")}angular.module("huellitas").config(e),e.$inject=["$locationProvider","$httpProvider","$compileProvider"]}(),function(){function e(e){var t=app.Settings.general.configJavascriptCacheKey;e.when("/",{templateUrl:"/app/front/home/home.html?"+t,controller:"HomeController",controllerAs:"main"}).when("/sinhogar/:friendlyName/editar",{templateUrl:"/app/front/contents/pets/editPet.html?"+t,controller:"EditPetController",controllerAs:"main"}).when("/sinhogar/:friendlyName/adoptar/formulario",{templateUrl:"/app/front/contents/pets/adopt.html?"+t,controller:"AdoptController",controllerAs:"main"}).when("/sinhogar/:friendlyName/adoptar",{templateUrl:"/app/front/contents/pets/adoptTerms.html?"+t,controller:"AdoptTermsController",controllerAs:"main"}).when("/sinhogar/:friendlyName",{templateUrl:"/app/front/contents/pets/petDetail.html?"+t,controller:"PetDetailController",controllerAs:"main"}).when("/sinhogar",{templateUrl:"/app/front/contents/pets/pets.html?"+t,controller:"PetsController",controllerAs:"main"}).when("/fundaciones/crear",{templateUrl:"/app/front/contents/shelters/editShelter.html?"+t,controller:"EditShelterController",controllerAs:"main"}).when("/fundaciones/:friendlyName/editar",{templateUrl:"/app/front/contents/shelters/editShelter.html?"+t,controller:"EditShelterController",controllerAs:"main"}).when("/fundaciones/:friendlyName",{templateUrl:"/app/front/contents/shelters/shelterDetail.html?"+t,controller:"ShelterDetailController",controllerAs:"main"}).when("/perdidos",{templateUrl:"/app/front/contents/lostPets/lostPets.html?"+t,controller:"LostPetsController",controllerAs:"main"}).when("/perdidos/crear",{templateUrl:"/app/front/contents/lostPets/editLostPet.html?"+t,controller:"EditLostPetController",controllerAs:"main"}).when("/perdidos/:friendlyName/editar",{templateUrl:"/app/front/contents/lostPets/editLostPet.html?"+t,controller:"EditLostPetController",controllerAs:"main"}).when("/perdidos/:friendlyName",{templateUrl:"/app/front/contents/lostPets/lostPetDetail.html?"+t,controller:"LostPetDetailController",controllerAs:"main"}).when("/fundaciones",{templateUrl:"/app/front/contents/shelters/shelters.html?"+t,controller:"SheltersController",controllerAs:"main"}).when("/dar-en-adopcion/crear",{templateUrl:"/app/front/contents/pets/editPet.html?"+t,controller:"EditPetController",controllerAs:"main"}).when("/dar-en-adopcion",{templateUrl:"/app/front/contents/pets/newPet.html?"+t,controller:"NewPetController",controllerAs:"main"}).when("/formularios-adopcion/:id",{templateUrl:"/app/front/contents/pets/adoptionFormDetail.html?"+t,controller:"AdoptionFormDetailController",controllerAs:"main"}).when("/formularios-adopcion",{templateUrl:"/app/front/contents/pets/listAdoptionForms.html?"+t,controller:"ListAdoptionFormController",controllerAs:"main"}).when("/mis-huellitas",{templateUrl:"/app/front/contents/pets/myPets.html?"+t,controller:"MyPetsController",controllerAs:"main"}).when("/notificaciones",{templateUrl:"/app/front/home/notifications.html?"+t,controller:"NotificationsController",controllerAs:"main"}).when("/por-que-adoptar",{templateUrl:"/app/front/home/faq.html?"+t,controller:"FaqController",controllerAs:"main"}).when("/pagina-no-encontrada",{templateUrl:"/app/front/home/notfound.html?"+t,controller:"NotFoundController",controllerAs:"main"}).when("/cambiar-clave/:token",{templateUrl:"/app/front/home/updatePasswordRecovery.html?"+t,controller:"UpdatePasswordRecoveryController",controllerAs:"main"}).when("/politicas-privacidad",{templateUrl:"/app/front/home/policies.html?"+t,controller:"PoliciesController",controllerAs:"main"}),e.otherwise({redirectTo:"/pagina-no-encontrada"}),e.caseInsensitiveMatch=!0}angular.module("huellitas").config(e),e.$inject=["$routeProvider"]}(),function(){"use strict";function e(e,t,r,i,a,o){a.getCurrentUser()&&(t.defaults.headers.common.Authorization="Bearer "+a.getToken()),e.$on("$locationChangeStart",function(e,t,o){var n=-1===["/login","/Login"].indexOf(r.path());n&&!a.isAuthenticated()?console.log("Sacar el login"):!n&&a.isAuthenticated()&&console.log("Sacar el login"),i.document.body.scrollTop=0})}angular.module("huellitas").run(e),e.$inject=["$rootScope","$http","$location","$window","sessionService","helperService"]}(),function(){"use strict";angular.module("huellitas").filter("age",function(){return function(e){if(!e)return;{if(e<12)return e+" mes"+(1"):""}})}(),function(){"use strict";function e(e){e.$parent.root.seo.title=app.Settings.resources["Seo.Faq.Title"],e.$parent.root.seo.description=app.Settings.resources["Seo.Faq.Description"]}angular.module("huellitas").controller("FaqController",e),e.$inject=["$scope"]}(),function(){"use strict";function e(e,t,o){var n=this;n.isSending=!1,n.model={},n.errorToken=void 0,n.modal=void 0,n.save=function(){n.form.$valid&&!n.isSending&&e.postPasswordRecovery(n.model).then(function(e){n.modal=$("#getPasswordRecovery").modal(),n.modal.off("hidden.bs.modal"),n.modal.modal("toggle"),$(n.modal).data("bs.modal",null),$(n.modal).remove(),t.show({message:"Te acabamos de enviar un correo para que puedas escoger tu nueva clave. Revísalo.",redirectAfterClose:o.getRoute("login")}),n.errorToken=void 0}).catch(function(e){n.errorToken="Valida que tu correo si se encuentre registrado"})}}angular.module("huellitas").controller("GetPasswordRecoveryController",e),e.$inject=["userService","modalService","routingService"]}(),function(){"use strict";function e(t,e,o,n,r,i,a,s,l){var c=this;c.banners=[],c.shelters=[],c.petsLoaded=function(e){c.featuredPet=_.findWhere(e.results,{featured:!0})},c.currentBanner=void 0,c.iCurrentBanner=0,c.filterPets={pageSize:6,orderBy:"Featured",status:"Published",contentType:"Pet",withinClosingDate:!0,onlyRescuers:!1},c.filterPetsRescuers={pageSize:6,orderBy:"Featured",status:"Published",contentType:"Pet",withinClosingDate:!0,onlyRescuers:!0},c.previousBanner=function(){c.iCurrentBanner=0==c.iCurrentBanner?c.banners.length-1:c.iCurrentBanner-1,d()},c.nextBanner=function(){c.iCurrentBanner=c.iCurrentBanner+1==c.banners.length?0:c.iCurrentBanner+1,d()},c.trustHtml=function(e){return t.trustAsHtml(e)},o.$parent.root.transparentHeader=!0,o.$parent.root.seo.title=app.Settings.resources["Seo.Home.Title"],o.$parent.root.seo.description=app.Settings.resources["Seo.Home.Description"],o.$parent.root.seo.image=l.getFullRouteOfFile(app.Settings.general.seoImage),i.getAll({active:!0,section:"Home"}).then(function(e){c.banners=e.results,d()}).catch(a.handleException),s.getAll({pageSize:4,orderBy:"DisplayOrder",status:"Published",featured:!0}).then(function(e){c.shelters=e.results}).catch(a.handleException),a.isMobileWidth()||(r[0].getElementsByTagName("header")[0].className="",n.addEventListener("scroll",function(e){r[0].getElementsByTagName("header")[0].className=100escríbenos a Facebook haciendo clic aquí.',redirectAfterClose:l.getRoute("lostpets")}),i.trackGoal("LostPets","Request")),p.form.isBusy=!1}function r(e){p.form.isBusy=!1,i.handleException(e)}},p.reorder=function(e){p.model.files=e},p.changeBreed=function(e){p.model.breed=e?{value:e.originalObject.id,text:e.originalObject.value}:void 0},p.imageOnProgress=function(e){p.progressFiles=e},p.currentUser=r.isAuthenticated()?r.getCurrentUser():{},t.$parent.root.seo.title=app.Settings.resources["Seo.EditLostPet.Title"],t.$parent.root.seo.description=app.Settings.resources["Seo.EditLostPet.Description"],t.$parent.root.seo.image=l.getFullRouteOfFile("img/front/compartir-fb-perdidos.png"),p.friendlyName?a.getById(p.friendlyName).then(function(e){p.model=e,p.model.canEdit||i.notFound(),p.canChangePhone=p.currentUser.id===p.model.user.id,f(),p.canChangePhone?m(p.currentUser):d.getUsers(p.model.id,{relationType:"Parent"}).then(function(e){m(e.results[0])}).catch(i.handleException)}).catch(i.handleException):(p.model.files=[],m(p.currentUser))}angular.module("huellitas").controller("EditLostPetController",e),e.$inject=["$routeParams","$scope","$location","helperService","petService","userService","routingService","modalService","fileService","sessionService","authenticationService","contentService"]}(),function(){"use strict";function e(e,t,o,n,r,i){var a=this;a.friendlyName=e.friendlyName,a.model={},a.filterSimilar={},a.titleSimilar="Mascotas similares",n.getById(a.friendlyName).then(function(e){a.model=e,a.model.fullRoute=i.getFullRoute("lostpet",{friendlyName:a.model.friendlyName}),a.filterSimilar={pageSize:4,status:"Published",subtype:a.model.subtype.value,size:a.model.size.value,contentType:"Pet"},t.$parent.root.seo.title=o.replaceJson(app.Settings.resources["Seo.LostPetDetail.Title"],{petName:a.model.name,petLocation:a.model.location.name,petSubtype:a.model.subtype.text}),t.$parent.root.seo.description=a.model.body,t.$parent.root.seo.image=i.getFullRouteOfFile(a.model.image.fileName),r.getUsers(a.model.id,{relationType:"Parent"}).then(function(e){a.model.parents=e.results}).catch(o.handleException)}).catch(o.notFound)}angular.module("huellitas").controller("LostPetDetailController",e),e.$inject=["$routeParams","$scope","helperService","petService","contentService","routingService"]}(),function(){"use strict";function e(e,t,o,n,r){var i=this;i.pets=[],i.filter={contentType:"LostPet",orderBy:"CreatedDate",status:"Published",page:0,pageSize:12,size:e.search().size?parseInt(e.search().size):void 0,genre:e.search().genre?parseInt(e.search().genre):void 0,subtype:e.search().subtype?parseInt(e.search().subtype):void 0,locationId:e.search().locationId?parseInt(e.search().locationId):void 0,locationName:e.search().locationName,breed:e.search().breed?parseInt(e.search().breed):void 0,breedName:e.search().breedName,keyword:e.search().keyword,fromStartingDate:e.search().fromStartingDate},i.genres=app.Settings.genres,i.sizes=app.Settings.sizes,i.subtypes=app.Settings.subtypes,i.breedTable=app.Settings.customTables.breed,i.hasNextPage=!1,i.pagingEnabled=!0,i.changeLocation=function(e){i.filter.locationId=e?e.originalObject.id:void 0,i.filter.locationName=e?e.originalObject.name:void 0},i.search=function(){e.path(r.getRoute("lostpets")).search({size:i.filter.size,genre:i.filter.genre,subtype:i.filter.subtype,locationId:i.filter.locationId,locationName:i.filter.locationName,keyword:i.filter.keyword,fromStartingDate:i.filter.fromStartingDate,breed:i.filter.breed,breedName:i.filter.breedName})},i.isSubtypeChecked=function(e){return i.filter.subtype==i.subtypes[e].id},i.changeBreed=function(e){i.filter.breed=e?e.originalObject.id:void 0,i.filter.breedName=e?e.originalObject.value:void 0},t.$parent.root.seo.title=app.Settings.resources["Seo.LostPets.Title"],t.$parent.root.seo.description=app.Settings.resources["Seo.LostPets.Description"],t.$parent.root.seo.image=r.getFullRouteOfFile("img/front/compartir-fb-perdidos.png")}angular.module("huellitas").controller("LostPetsController",e),e.$inject=["$location","$scope","helperService","petService","routingService"]}(),function(){"use strict";function e(e,r){var i=this;i.url=e.params.url,i.share=function(e){var t=r.screenY+(r.outerHeight-500)/2.5,o=r.screenX+(r.outerWidth-650)/2,n="";switch(e){case"twitter":n="https://twitter.com/intent/tweet?url="+i.url;break;case"whatsapp":n="whatsapp://send?text="+i.url;break;case"facebook":default:n="https://www.facebook.com/sharer/sharer.php?u="+i.url}r.open(n,"shared","width=".concat(650,",height=",500,",top=",t,",left=",o))},i.close=function(){e.close({accept:!0})}}angular.module("huellitas").controller("ShareController",e),e.$inject=["$scope","$window"]}(),function(){"use strict";function e(n){return{link:function(e,t,o){t.on("click",function(){n.show({controller:"ShareController",template:"/app/front/components/share/share.html?"+app.Settings.general.configJavascriptCacheKey,params:{url:e.url}})})},restrict:"A",scope:{url:"="}}}angular.module("huellitas").directive("shareHuellitas",e),e.$inject=["modalService"]}(),function(){"use strict";function e(t,e,o,n,r,i){var a=this;function s(e){o.promiseAuth.resolve(e),a.form.isBusy=!1,t.root.currentUser=e,l()}function l(){a.modal.off("hidden.bs.modal"),a.modal.modal("toggle"),$(a.modal).data("bs.modal",null),$(a.modal).remove()}a.model={},a.modal=void 0,a.modeLogin=!1,a.closeModal=l,a.register=function(e){a.modeLogin=!e},a.authenticate=function(){a.form.$valid&&!a.form.isBusy&&(a.form.isBusy=!0,a.modeLogin?o.post(a.model).then(s).catch(function(e){a.form.isBusy=!1,401===e.status?n.showError({message:"Usuario y clave invalidos",isFront:!0}):i.handleException(e)}):r.post(a.model).then(function(e){s(o.setSessionUser(e))}).catch(function(e){a.form.isBusy=!1,i.handleException(e)}))},a.facebookLogin=function(){o.external("facebook").then(function(e){s(e)})},a.getPasswordRecovery=function(){l(),n.show({controller:"GetPasswordRecoveryController",template:"/app/front/home/getPasswordRecovery.html?"+app.Settings.general.configJavascriptCacheKey,controllerAs:"getPassword"})},a.modal=$("#loginModal").modal(),a.modal.on("hidden.bs.modal",function(){e.remove(),o.promiseAuth&&o.promiseAuth.reject({})})}angular.module("huellitas").directive("loginHuellitas",function(){return{restrict:"E",bindToController:!0,controller:e,controllerAs:"login",templateUrl:"/app/front/components/login/login.html?"+app.Settings.general.configJavascriptCacheKey}}),angular.module("huellitas").controller("LoginController",e),e.$inject=["$scope","$element","authenticationService","modalService","userService","helperService"]}(),function(){"use strict";function e(e,t,r,i,a,s,l,o,c){var u=this;function n(){return d()?u.defaultNameImage=u.model.name+" "+u.model.location.name:""}function d(){return u.model.name&&u.model.location}u.model={},u.model.files=[],u.progressFiles=[],u.friendlyName=t.friendlyName,u.changeLocation=function(e){u.model.location=u.model.location||{},u.model.location=e?e.originalObject:void 0,n()},u.canShowGallery=d,u.getFullNameImage=n,u.imageAdded=function(t){u.model.id?o.postContentFile(u.model.id,t).then(function(e){u.model.files.push(t)}):(u.model.files=u.model.files||[],u.model.files.push(t))},u.removeFile=function(t){u.model.id?o.deleteContentFile(u.model.id,t.id).then(e):e();function e(){u.model.files=_.reject(u.model.files,function(e){return e.id==t.id})}},u.reorder=function(e){u.model.files=e},u.save=function(){u.form.$submitted&&u.form.$valid&&!u.form.isBusy?(u.form.isBusy=!0,c.showLogin(r).then(function(e){var t=e;if(u.model.files.length<3)return s.showError({message:"Debes cargar al menos tres imágenes de tu fundación",title:"Muy pocas imágenes!"}),void(u.form.isBusy=!1);if(u.progressFiles.length)return s.showError({message:"Las imagenes no han terminado de cargar, espera unos segundos y cuando termine dale clic nuevamente en guardar.",title:"Imagenes cargando"}),void(u.form.isBusy=!1);u.friendlyName?i.put(u.model).then(o).catch(n):(u.model.user=t,u.model.users=[{userid:u.model.user.id,relationType:"Shelter"}],i.post(u.model).then(o).catch(n))}).catch(function(){console.log("No autenticado"),u.form.isBusy=!1})):a.goToFocusError();function o(e){u.friendlyName||a.trackGoal("Shelters","Request"),u.form.isBusy=!1,u.friendlyName?s.show({message:"La fundación fue correctamente actualizada",redirectAfterClose:l.getRoute("shelter",{friendlyName:u.friendlyName})}):s.show({message:"Muchas gracias por registrar tu fundación en Huellitas sin Hogar. Pronto recibirás noticias de nosotros.",redirectAfterClose:l.getRoute("shelters")})}function n(e){u.form.isBusy=!1,s.showError({message:"No pudimos guardar los datos. Intenta de nuevo o comunicate con nosotros por medio de Facebook"})}},u.imageOnProgress=function(e){u.progressFiles=e},r.$parent.root.seo.title=app.Settings.resources["Seo.EditShelter.Title"],r.$parent.root.seo.description=app.Settings.resources["Seo.EditShelter.Description"],r.$parent.root.seo.image=l.getFullRouteOfFile("img/front/compartir-fb-registrar-fundacion.png"),u.friendlyName&&i.getById(u.friendlyName).then(function(e){u.model=e}).catch(a.handleError)}angular.module("huellitas").controller("EditShelterController",e),e.$inject=["$location","$routeParams","$scope","shelterService","helperService","modalService","routingService","fileService","authenticationService"]}(),function(){"use strict";function e(e,t,o,n,r){var i=this;i.model={},i.friendlyName=e.friendlyName,o.getById(i.friendlyName).then(function(e){i.model=e,i.model.fullRoute=r.getFullRoute("shelter",{friendlyName:i.model.friendlyName}),i.filterMyPets={page:0,pageSize:6,shelter:i.model.id,status:"Published",contentType:"Pet"},t.$parent.root.seo.title=n.replaceJson(app.Settings.resources["Seo.ShelterDetail.Title"],{shelterName:i.model.name,shelterLocation:i.model.location.name}),t.$parent.root.seo.description=i.model.body,t.$parent.root.seo.image=r.getFullRouteOfFile(i.model.image.fileName)}).catch(n.notFound)}angular.module("huellitas").controller("ShelterDetailController",e),e.$inject=["$routeParams","$scope","shelterService","helperService","routingService"]}(),function(){"use strict";function e(e,t,o,n,r){var i=this;function a(){r.getAll(i.filter).then(function(e){0escribenos a nuestro fan page dando clic aquí'}),d.post({shortMessage:"Error guardando el formulario de adopción",fullMessage:JSON.stringify(e.data)})})}}})}else p.form.$invalid&&i.goToFocusError()},p.back=function(){0escribenos a Facebook clic aquí.',redirectAfterClose:l.getRoute("pets")}),i.trackGoal("Pets","Request")),p.form.isBusy=!1}function r(e){p.form.isBusy=!1,i.handleException(e)}},p.reorder=function(e){p.model.files=e},p.validateAuthentication=m,p.imageOnProgress=function(e){p.progressFiles=e},p.chageShelter=function(){var e=_.findWhere(p.shelters,{id:p.model.shelter.id});p.model.location=e?e.location:void 0,v()},function(){p.currentUser=r.isAuthenticated()?r.getCurrentUser():{},p.previousPage=o.$parent.root.previousPages[o.$parent.root.previousPages.length-2],p.previousPage==l.getRoute("newpet0")?p.backLink=l.getRoute("pets"):p.previousPage==l.getRoute("mypets")?p.backLink=p.previousPage:p.backLink=p.friendlyName?l.getRoute("pet",{friendlyName:p.friendlyName}):l.getRoute("pets");m()}()}angular.module("huellitas").controller("EditPetController",e),e.$inject=["$routeParams","$scope","$location","helperService","petService","userService","routingService","modalService","fileService","sessionService","contentService","authenticationService"]}(),function(){"use strict";function e(t,e,o,n,r,i,a,s){var l=this;function c(){n.getAll(l.filter).then(function(e){for(var t=0;t=a.length&&(d.cancel(o),alert("Proceso finalizado"))},1e3)}).catch(function(e){alert("Error ejecutando"),console.log(e)});var r=3,i=0,a=[],s=0,l=[]}}}angular.module("huellitasServices").factory("crawlingService",e),e.$inject=["$window","$timeout","$interval","httpService","routingService"]}(),function(){function e(o){return{getByTable:e,getSizes:function(){return e(app.Settings.customTables.animalSize)},getSubtypes:function(){return e(app.Settings.customTables.animalSubtype)},getGenres:function(){return e(app.Settings.customTables.animalGenre)},getAdoptionFormQuestions:function(e){return o.get("/api/adoptionforms/questions")},getJobs:function(){return e(app.Settings.customTables.jobs)}};function e(e,t){return t=t||{page:0,pageSize:500},o.get("/api/customtables/"+e+"/rows",{params:t})}}angular.module("huellitasServices").factory("customTableRowService",e),e.$inject=["httpService"]}(),function(){function e(t){return{getAll:function(e){return t.get("/api/logs",{params:e})},post:function(e){return t.post("/api/logs",e)},clean:function(){return t.post("/api/logs/clean")}}}angular.module("huellitasServices").factory("logService",e),e.$inject=["httpService"]}(),function(){function e(e){return{getAll:function(){return e.get("/api/modules")}}}angular.module("huellitasServices").factory("moduleService",e),e.$inject=["httpService"]}(),function(){function e(t){return{setCurrentUser:function(e){t.currentUser=e},removeCurrentUser:function(){t.$reset({currentUser:void 0})},getCurrentUser:function(){return t.currentUser},getToken:function(){return t.currentUser?t.currentUser.token:void 0},isAuthenticated:function(){return void 0!==t.currentUser}}}angular.module("huellitasServices").factory("sessionService",e),e.$inject=["$localStorage"]}(),function(){function e(e){return{getAll:function(){return e.get("/api/statustypes")}}}angular.module("huellitasServices").factory("statusTypeService",e),e.$inject=["httpService"]}(),function(){function e(t){return{get:function(e){return t.get("/api/systemsettings",{params:e})},put:function(e){return t.put("/api/systemsettings/"+e.id,e)}}}angular.module("huellitasServices").factory("systemSettingService",e),e.$inject=["httpService"]}(),function(){function e(t){return{get:function(e){return t.get("/api/textresources",{params:e})},put:function(e){return t.put("/api/textresources/"+e.id,e)}}}angular.module("huellitasServices").factory("textResourceService",e),e.$inject=["httpService"]}(),angular.module("underscore",[]).factory("_",["$window",function(e){return e._}]),function(){function e(o){return{getAll:function(e){return o.get("/api/adoptionforms",{params:e})},getById:function(e){return o.get("/api/adoptionforms/"+e)},post:function(e){return o.post("/api/adoptionforms",e)},postUser:function(e,t){return o.post("/api/adoptionforms/"+e+"/users",{userId:t})},sendByEmail:function(e,t){return o.post("/api/adoptionforms/"+e+"/send",{email:t})},markAsOpened:function(e){return o.post("/api/adoptionforms/"+e+"/markAsRead",{})}}}angular.module("huellitasServices").factory("adoptionFormService",e),e.$inject=["httpService"]}(),function(){function e(t){return{post:function(e){return t.post("/api/adoptionforms/"+e.adoptionFormId+"/answers",e)},getByFormId:function(e){return t.get("/api/adoptionforms/"+e+"/answers")}}}angular.module("huellitasServices").factory("adoptionFormAnswerService",e),e.$inject=["httpService"]}(),function(){"use strict";function e(t){return{getAll:function(e){return t.get("/api/comments",{params:e})},post:function(e){return t.post("/api/comments",e)},delete:function(e){return t.delete("/api/comments/"+e)}}}angular.module("huellitasServices").factory("commentService",e),e.$inject=["httpService"]}(),function(){function e(o){return{postUser:function(e,t){return o.post("/api/contents/"+e+"/users",t)},getUsers:function(e,t){return o.get("/api/contents/"+e+"/users",{params:t})},getContentsOfUser:function(e,t){return o.get("/api/users/"+e+"/contents",{params:t})},deleteUser:function(e,t){return o.delete("/api/contents/"+e+"/users/"+t)}}}angular.module("huellitasServices").factory("contentService",e),e.$inject=["httpService"]}(),function(){function e(o){return{getAll:function(e){return o.get("/api/pets",{params:e})},getById:function(e){return o.get("/api/pets/"+e)},post:function(e){return o.post("/api/pets",e)},put:function(e){return o.put("/api/pets/"+e.id,e)},patch:n,changeStatus:function(e,t){return n(e,[{op:"replace",path:"/status",value:t}])},republish:function(e){return n(e,[{op:"replace",path:"/closingDate",value:moment().format("YYYY/MM/DD")}])},notify:function(e,t){return o.post("/api/pets/"+e+"/notify/"+t)}};function n(e,t){return o.patch("/api/pets/"+e,t)}}angular.module("huellitasServices").factory("petService",e),e.$inject=["httpService"]}(),function(){function e(t){return{getAll:function(e){return t.get("/api/shelters",{params:e})},getById:function(e){return t.get("/api/shelters/"+e)},post:function(e){return t.post("/api/shelters",e)},put:function(e){return t.put("/api/shelters/"+e.id,e)}}}angular.module("huellitasServices").factory("shelterService",e),e.$inject=["httpService"]}(),function(){function e(s,l,n){return{post:function(e,t,o,n){var r=l.defer(),i=r.promise,a=new FormData;return a.append("files",e),a.append("name",t||e.name),s({method:"POST",url:"/api/files",headers:{"Content-Type":void 0},uploadEventHandlers:{progress:function(e){try{var t=Math.ceil(e.loaded/e.total*100);o&&o.call(this,t,n)}catch(e){}}},data:a,transformRequest:angular.identity}).then(function(e,t){o&&o.call(this,101,n),e.resolve(t.data)}.bind(null,r),function(e,t){e.reject(t)}.bind(null,r)),i},deleteContentFile:function(e,t){return n.delete("/api/contents/"+e+"/files/"+t)},postContentFile:function(e,t){return n.post("/api/contents/"+e+"/files",t)},sortContentFile:function(e,t,o){return n.post("/api/contents/"+e+"/files/"+t+"/sort/"+o)},postSocialNetwork:function(e,t){return n.post("/api/contents/"+e+"/socialpost",t)},patchContentFile:function(e,t,o){return n.patch("/api/contents/"+e+"/files/"+t,o)}}}angular.module("huellitasServices").factory("fileService",e),e.$inject=["$http","$q","httpService"]}(),angular.module("huellitasServices").filter("timeago",function(){return function(e){return e&&""!=e?e.getIntervalTime():""}}),function(){"use strict";function e(r,e,n,o,t){return{configServiceUrl:function(e,t){{if(r.isIE){var o=Math.floor(600*Math.random())+1,n=e;return-1 UserAgent:"+navigator.userAgent+"
URL:"+document.location.href}))}},isMobileWidth:function(){return r.innerWidth<=600},goToFocus:a,goToFocusError:function(){a(".error",-100)},compile:function(e,t,o){angular.element(e).append(n(t)(o))},notFound:function(){e.path(t.getRoute("notfound"))},replaceJson:function(e,t){for(var o=_.keys(t),n=0;n",e);return this.promiseAuth.promise},external:function(e){var t="";"facebook"==e&&(o={response_type:"token",client_id:app.Settings.general.facebookPublicToken,redirect_uri:f.getFullRoute("facebooklogin"),display:"popup",scope:"email",state:"undefined"},t="https://www.facebook.com/v2.5/dialog/oauth?"+$.param(o));var o;var n=u.defer(),r=n.promise,i=d.screenY+(d.outerHeight-500)/2.5,a=d.screenX+(d.outerWidth-500)/2,s=d.open(t,"oauth","width=".concat(500,",height=",500,",top=",i,",left=",a)),l=p(function(){try{if(s.location.search||s.location.hash){switch(e){case"facebook":token=s.location.hash.queryStringToJson().access_token}g(e,token).then(c).catch(m.handleException),s.close(),p.cancel(l)}s&&!s.closed||p.cancel(l)}catch(e){console.log(e)}},500);function c(e){n.resolve(e)}return r},postExternal:g,setSessionUser:i};function i(e){var t={email:e.email,id:e.id,name:e.name,phone:e.phone,role:e.role,token:e.token.accessToken,location:e.location};return n.setCurrentUser(t),o.defaults.headers.common.Authorization="Bearer "+e.token.accessToken,t}function g(e,t,o){var n=u.defer();return r.post("/api/auth/external",{socialNetwork:e,token:t,token2:o}).then(function(e){i(e=e),n.resolve(e)}).catch(function(e){n.reject(e)}),n.promise}}angular.module("huellitasServices").factory("authenticationService",e),e.$inject=["$http","$q","$window","$interval","httpService","sessionService","helperService","routingService"]}(),function(){function e(e){return{getAll:function(){return e.get("/api/roles")}}}angular.module("huellitasServices").factory("roleService",e),e.$inject=["httpService"]}(),function(){function e(o){return{getAll:function(e){return o.get("/api/users",{params:e})},getById:function(e){return o.get("/api/users/"+e)},post:function(e){return o.post("/api/users",e)},put:function(e){return o.put("/api/users/"+e.id,e)},contact:function(e,t){return o.post("/api/users/"+e+"/contact",t)},delete:function(e){return o.delete("/api/users/"+e)},postPasswordRecovery:function(e){return o.post("/api/users/passwordrecovery",e)},getPasswordRecovery:function(e){return o.get("/api/users/passwordrecovery/"+e)},putPasswordRecovery:function(e,t){return o.put("/api/users/passwordrecovery/"+e,t)}}}angular.module("huellitasServices").factory("userService",e),e.$inject=["httpService"]}(),angular.module("huellitasComponents",[]),function(){"use strict";function e(n,e){return{restrict:"A",scope:{adClass:"@",adClient:"@",adSlot:"@",adFormat:"@"},template:'',link:function(e,t,o){app.Settings.general.adsenseEnabled?t[0].offsetWidth?(console.log("registra "+t[0].offsetWidth,o.adSlot),n(function(){console.log("registre google"),(adsbygoogle=window.adsbygoogle||[]).push({})},500)):(console.log("elimina "+t[0].offsetWidth,o.adSlot),t.remove()):t.remove()}}}angular.module("huellitasComponents").service("adsenseService",[function(){console.log("Entra al servicio"),this.url="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js",this.isAlreadyLoaded=!1}]),angular.module("huellitasComponents").directive("adsenseHuellitas",e),e.$inject=["$timeout","adsenseService"]}(),angular.module("huellitasComponents").directive("datepickerHuellitas",function(){return{scope:!1,link:function(e,t,o){var n=void 0;o.maxdate&&(n=moment().toDate(o.maxdate)),new Pikaday({field:t[0],format:"YYYY/MM/DD",i18n:{previousMonth:"Mes anterior",nextMonth:"Mes siguiente",months:["Enero","Febrero","Marzo","Abrl","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],weekdays:["Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado"],weekdaysShort:["Dom","Lun","Mar","Mie","Jue","Vie","Sab"]},maxDate:n})},restrict:"A"}}),function(){"use strict";function e(c,u){return{link:function(s,t,e){function l(e,t,o){s.files.splice(e,1),s.files.splice(t,0,o),s.callback&&s.callback(s.files)}t.on("dragstart",function(e){c.dragObject={},c.dragObject.id=s.id}),t.on("dragend",function(e){c.dragObject={}}),t.on("dragover",function(e){e.preventDefault(),-1===t[0].className.indexOf("over")&&c.dragObject&&c.dragObject.id!==s.id&&t.addClass("over")}),t.on("dragleave",function(e){e.preventDefault(),angular.element(document.getElementsByClassName("over")).removeClass("over")}),t.on("drop",function(e){e.preventDefault(),angular.element(document.getElementsByClassName("over")).removeClass("over");var t=s.id;if(t){var o=c.dragObject.id,n=_.findWhere(s.files,{id:parseInt(o)}),r=_.findWhere(s.files,{id:parseInt(t)}),i=s.files.indexOf(r),a=s.files.indexOf(n);"true"===s.saveonchange?u.sortContentFile(s.contentid,parseInt(o),parseInt(t)).then(l.bind(null,a,i,n)).catch(function(){console.log("Error moviendo")}):s.$apply(l.bind(null,a,i,n))}})},restrict:"A",scope:{contentid:"=",id:"=",callback:"=",saveonchange:"@",files:"="}}}angular.module("huellitasComponents").directive("draggableContentFile",e),e.$inject=["$window","fileService"]}(),function(){function e(n,f){return{restrict:"EA",link:function(l,c,e){angular.element(c).on("change",function(e){d=!1;for(var t=c[0],o=!1,n=!1,r=l.validextensions?new RegExp(l.validextensions,"i"):null,i=!!l.validatehorizontal&&l.validatehorizontal,a=0;a1024*app.Settings.security.maxRequestFileUploadMB*1024?o=!0:r&&!r.test(t.files[a].name)?n=!0:"1"==i?m(t.files[a],t.files.length):p(t.files[a]);if(o){var s="";s=1==t.files.length?"El archivo no puede exceder las "+app.Settings.security.maxRequestFileUploadMB+"MB. Subir archivos de menor peso.":0==u?"Los archivos no pueden exceder las "+app.Settings.security.maxRequestFileUploadMB+"MB. Subir archivos de menor peso.":"Hay archivos que exceden las "+app.Settings.security.maxRequestFileUploadMB+"MB. Subir archivos de menor peso.",f.handleException({data:{error:{message:s}}}),c.val(null)}else if(n){var s="";s=1==t.files.length?"El archivo no tiene una extension válida":0==u?"Los archivos no tienen extensiones válidas.":"Hay archivos no tienen extensiones válidas.",f.handleException({data:{error:{message:s}}}),c.val(null)}});angular.element(c)[0].attributes.multiple;e.$observe("defaultname",function(e){l.defaultname=e});var r=[],u=0,d=!1;function t(e,t){r[t]=e,l.onprogress&&l.onprogress(r)}function p(e){n.post(e,l.defaultname,t,u).then(o).catch(f.handleException),u++}function m(t,o){var e=window.URL||window.webkitURL;if(e){l.defaultname;var n=new Image;n.onload=function(){l.defaultname;if(n.height<=n.width)p(t);else if(!d){var e="";e=1==o?'La imagen no puede tener formato vertical ya que se va a ver cortadas. Debes subir otra imagen.
':'Hay imagenes en formato vertical y no pueden ser cargadas ya que se van a ver cortadas. Toma otras fotos en formato horizontal.
',f.handleException({data:{error:{message:e}}}),d=!0}},n.src=e.createObjectURL(t)}}function o(e,t,o){var n=_.reject(r,function(e){return 101==e});n.length||(console.log("Se resetea array",r),r=[],u=0),l.onprogress&&l.onprogress(r),l.onadded&&l.onadded(e,l.callbackParam),c.val(null)}},scope:{onadded:"=",onprogress:"=",callbackParam:"@",defaultname:"@",validextensions:"@",validatehorizontal:"@"}}}angular.module("huellitasComponents").directive("fileuploadHuellitas",e),e.$inject=["fileService","helperService"]}(),angular.module("huellitasComponents").directive("compareTo",function(){return{require:"ngModel",scope:{otherValue:"=compareTo"},link:function(t,e,o,n){n.$validators.compareTo=function(e){return e===t.otherValue},t.$watch("otherValue",function(){n.$validate()})}}}),function(){function e(e,t){var o=this;o.title=e.title,o.message=e.message,o.large=e.large,o.close=function(){e.close({accept:!0})},o.getRoute=t.getRoute}angular.module("huellitasComponents").controller("ModalDefaultController",e),e.$inject=["$scope","routingService"]}(),function(){function e(e){var t=this;t.title=e.title,t.message=e.message,t.large=e.large,t.cancel=function(){e.close({accept:!1})},t.accept=function(){e.close({accept:!0})}}angular.module("huellitasComponents").controller("ModalDialogController",e),e.$inject=["$scope"]}(),function(){function e(g,o,h,v,S,y,b){this.show=i,this.showError=function(e){if((e=e||{}).modalType="error",e.title=e.title||"Error",e.error){var t="",o=e.error;t="BadArgument"===o.code?o.details?_.pluck(o.details,"message").join("
"):o.message||"Algunos datos son invalidos":"InvalidForeignKey"===o.code?"El campo "+o.target+" que intenta relacionar no existe":o.message,e.message=t}return i(e)},this.showDialog=function(e){return(e=e||{}).modalType="dialog",e.title=e.title||"Importante",i(e)};var t={modalType:"default",scope:h,controllerAs:"modal",title:"Mensaje",redirectAfterClose:void 0,closed:void 0};return this;function n(e){var t=g.defer();return o(e,!0).then(function(e){t.resolve(e)}).catch(r),t.promise}function r(){}function i(m){var f=g.defer();return(m=_.defaults(m,t)).template?n(m.template).then(e).catch(r):n("/app/components/modal/"+(app.Settings.isFront?"front-":"")+"modal-"+m.modalType+".html?"+app.Settings.general.configJavascriptCacheKey).then(e).catch(r),f.promise;function e(e){var t=m.scope.$new(),o=h.$on("$locationChangeSuccess",p),n=v(e)(t);t.close=p,t.message=m.message,t.title=m.title,t.large=m.large,t.params=m.params;var r={$scope:t},i=t[m.controllerAs],a=S(function(){{if(m.controller)return m.controller;var e=m.modalType.toLowerCase();switch(e){case"dialog":return"ModalDialogController";case"default":default:return"ModalDefaultController"}}}(),r,!1,m.controllerAs);m.controllerAs&&i&&angular.extend(a,i);var s,l=angular.element(y[0].body);s=n,l.append(s);var c=g.defer(),u=g.defer(),d={controller:a,scope:t,element:n,close:c.promise,closed:u.promise};function p(e){c.resolve(e),e.previousClosed||(d.element.off("hidden.bs.modal"),d.element.modal("toggle")),t.$destroy(),u.resolve(e),m.closed&&m.closed(e),o&&o(),m.redirectAfterClose&&b.path(m.redirectAfterClose)}d.element.on("hidden.bs.modal",function(){p({previousClosed:!0})}),d.element.modal||(d.element=angular.element(d.element)),d.element.modal(),f.resolve(d)}}}angular.module("huellitasComponents").factory("modalService",e),e.$inject=["$q","$templateRequest","$rootScope","$compile","$controller","$document","$location"]}();