getURLParameter("cod_rec")&&criaCookie("pda_cod_rec",getURLParameter("cod_rec"),1);eAssinatura.controller("HomeController",["$scope","$http","$window","$timeout","blockService","notifyService","$rootScope","$modal","locale","$filter",function(n,t,i,r,u,f,e,o,s){s.ready(["Common","Controllers.HomeController"]).then(function(){n.precoPadrao=null;n.Logins={Email:!1,MobileId:!1,ShowLogins:!1};n.planosMensais=[];n.planosAnuais=[];n.planosPrePagos=[];n.planosPorAC=[];n.planosMensaisAgrupados=[];n.planosAnuaisAgrupados=[];n.planoContratado=null;n.SelecionarSubplano=function(n,t){n.selecionado=t};t.get("/API/Documento/PrecoPadrao").success(function(t){n.precoPadrao=moneyToString(t.preco)}).error(function(){});n.ShowPricingMonthly=function(){n.PricingMonthly=!0};n.hidePlansHome=function(){return n.planosPrePagos.length===0&&n.planosPrePagos.length===0?!0:!1};n.ContratarPlano=function(n){var t="/Conta/ContratarPlano/"+n.id+"?contaId=";window.location.href="/Home/Login?ReturnUrl="+t};n.ComprarPlanoPrePago=function(){window.location.href="/Home/Login?ReturnUrl=/Home/MeusCreditos"};n.RecuperarPlanosPrePagos=function(){t.get("/API/PlanoPrePago/List").success(function(t){var i=_.filter(t.planos,function(n){return n.active});n.planosPrePagos=n.filterByAC(i,!0)}).error(function(n,t){f.errorModel(n,s.getString("Controllers.HomeController.ErrorRetrievingPrepaidPlans"),t)})};n.RecuperarPlanosPeriodo=function(){u.block();t.get("/API/PlanoPeriodo/List").success(function(t){var i=_.filter(t.planos,function(n){return n.mensal&&n.active}),r=_.filter(t.planos,function(n){return!n.mensal&&n.active});i=_.sortBy(i,"ordem");r=_.sortBy(r,"ordem");n.planosMensais=n.filterByAC(i);n.planosAnuais=n.filterByAC(r);n.planosMensaisAgrupados=_.groupBy(i,"codigoProduto");n.planosMensaisAgrupados=_.map(n.planosMensaisAgrupados,function(n){return{subplanos:n,selecionado:n[0]}});n.planosAnuaisAgrupados=_.groupBy(r,"codigoProduto");n.planosAnuaisAgrupados=_.map(n.planosAnuaisAgrupados,function(n){return{subplanos:n,selecionado:n[0]}});u.unblock()}).error(function(n,t){u.unblock();f.errorModel(n,s.getString("Controllers.MyCreditsController.ErrorRetrievingPeriodPlans"),t)})};n.filterByAC=function(t,i){var r=n.planosPorAC,u=[];return _.each(t,function(n){var t,f,e;n.autoridadeCertificadora==null?u.push(n):(t=_.find(r,function(t){return t.autoridadeCertificadora.id===n.autoridadeCertificadora.id}),isNullOrEmpty(t)?(f=[],e=[],i?f.push(n):e.push(n),r.push({autoridadeCertificadora:n.autoridadeCertificadora,planosPrePagos:f,planosPeriodo:e})):i?t.planosPrePagos.push(n):t.planosPeriodo.push(n))}),u};n.SolicitarMaisDocumentosClick=function(){var n=o.open({templateUrl:"/Dialog/SolicitarMaisDocumentos",controller:"SolicitarMaisDocumentosDialogController"})};n.RecuperarPlanosPeriodo();n.RecuperarPlanosPrePagos()})}]).filter("removeSpaces",[function(){return function(n){return angular.isString(n)?n.replace(/[\s]/g,"-").toLowerCase():n}}])