var jqueryModule=angular.module("jqueryModule",[]),portalModule;jqueryModule.service("autocompleteService",function(){this.init=function(n,t){$(n).autocomplete(t)};this.disabled=function(n){$(n).autocomplete("disable")}});portalModule=angular.module("portalModule",["jqueryModule","infinite-scroll","ngMask"]);portalModule.directive("tooltip",function(){return{restrict:"A",link:function(n,t){$(t).hover(function(){$('[data-toggle="tooltip"]').tooltip()})}}});portalModule.directive("scrollto",function(){return{restrict:"A",link:function(n,t,i){$(t).click(function(){location.hash="#hashtag";location.hash="#"+i.anchorname})}}});portalModule.directive("sharefacebook",function(){return{restrict:"A",link:function(n,t,i){$(t).click(function(){var n=i.urlshare;FB.ui({method:"share",href:n},function(){})})}}});portalModule.directive("sharetwitter",function(){return{restrict:"A",link:function(n,t,i){$(t).click(function(){var n=i.urlshare,t="https://twitter.com/intent/tweet?url="+n+"&original_referer="+n;window.open(t,"","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600")})}}});portalModule.directive("sharegoogleplus",function(){return{restrict:"A",link:function(n,t,i){$(t).click(function(){var n=i.urlshare,t="https://plus.google.com/share?url="+n;window.open(t,"","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600")})}}});portalModule.directive("popover",function(){return{restrict:"A",link:function(n,t){$(t).click(function(){$('[data-toggle="popover"]').popover()})}}});portalModule.factory("stringService",function(){return{toUrlSeo:function(n){var t=n.replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g,"-").toLowerCase(),i;return t.charAt(0)=="-"&&(t=t.substring(1)),i=t.length-1,t.charAt(i)=="-"&&(t=t.substring(0,i)),t},removeAccents:function(n){var i,r,t;for(strAccents=n.split(""),strAccentsOut=[],strAccentsLen=strAccents.length,i="ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž",r=["A","A","A","A","A","A","a","a","a","a","a","a","O","O","O","O","O","O","O","o","o","o","o","o","o","E","E","E","E","e","e","e","e","e","C","c","D","I","I","I","I","i","i","i","i","U","U","U","U","u","u","u","u","N","n","S","s","Y","y","y","Z","z"],t=0;t<strAccentsLen;t++)strAccentsOut[t]=i.indexOf(strAccents[t])!=-1?r[i.indexOf(strAccents[t])]:strAccents[t];return strAccentsOut=$.trim(strAccentsOut.join(""))}}});portalModule.factory("globalService",["stringService",function(){return{absolutepath:"/",masterclass:"",cdnUrl:"https://d1jfoe5og03v22.cloudfront.net/",tooltip:function(){$('[data-toggle="tooltip"]').tooltip()},popover:function(){$('[data-toggle="popover"]').popover()},mapcontainer:function(){var n=$(window).width(),t=$(".l-footer");$("#m-map-container").hasClass("m-map-container")&&$("body").addClass("s-fixed-layout ")},randomToken:"?tk="+Math.random()*100,isEmailValid:function(n){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n)},googleApiKey:function(){return"AIzaSyANJhnI0JhyULe-WaEHLPb7bjDpyUL5C-o "}}}]);portalModule.factory("slowCounter",function(){function n(t,i,r){($("#"+t).html(i),i++,i>=r)||setTimeout(n(t,i,r),500)}return{counter:function(t,i){n(t,1,i)}}});portalModule.factory("companyBoxService",["globalService","stringService","cotacaoService",function(n,t,i){function u(n,t){$(this).closest(".m-company").toggleClass("s-selected");i.adicionarEmpresaParaCotacao(n,t)}function f(i){return n.absolutepath+"Transportadora/"+i.Id+"/"+t.toUrlSeo(i.Name)}function e(n,t){var i=$("#divMoreInfo"+t.Id);$(i).siblings().hide();$(i).removeClass("hide")}function o(n,t,i){ga("send","event","Box da Empresa",i,"Empresa "+n.Name+" - Cod: "+n.Id,n.Id)}var r=n.googleApiKey(),s=function(n,t,i,u,f,e,o,s){var h=r,l=n.attr("src"),c="https://www.google.com/maps/embed/v1/place?key="+h+"&q="+i+","+u+" "+e+"  "+o+" - "+s;n.attr("src",c)};return{selecionarEmpresa:function(n,t){return u(n,t)},linkParaPerfilEmpresa:function(n,t){return f(n,t)},verMaisInfo:function(n,t){return e(n,t)},gaEvent:function(n,t,i){return o(n,t,i)},localizarNoMapa:s,carregarTemplate:function(t){return t?n.absolutepath+"AngularViews/Shared/_BoxEmpresaAnunciante.html":n.absolutepath+"AngularViews/Shared/_BoxEmpresaNaoAnunciante.html"}}}]);portalModule.factory("endPointService",["globalService",function(n){return{sugestoesCidades:n.absolutepath+"Api/Sugestao/Cidades"+n.randomToken,sugestoesProdutosServicos:n.absolutepath+"Api/Sugestao/ProdutosServicos/Categorias"+n.randomToken,sugestoesCargasEspecializadas:n.absolutepath+"Api/Sugestao/CargasEspeciais/Categorias"+n.randomToken,listarCidadePorEstado:function(t){var i;return i="Api/Localizacao/Cidades/"+t,n.absolutepath+i+n.randomToken},rotasOrigemDestino:function(t,i,r,u,f){var e,o;return e="Api/Rotas/Resultados/"+t+"/"+i,o=(r.length>0?r:"0")+"/"+(u.length>0?u:"0")+"/"+(f.length>0?f:"0"),(r||u||f)&&(e=e+"/"+o),n.absolutepath+e+n.randomToken},cargasEspeciais:function(t,i,r){var u,f;return u="Api/CargasEspeciais/Resultados/"+t,f=(i.length>0?i:"0")+"/"+(r.length>0?r:"0"),(i||r)&&(u=u+"/"+f),n.absolutepath+u+n.randomToken},produtosServicos:function(t,i,r){var u,f;return u="Api/ProdutosServicos/Resultados/"+t,f=(i.length>0?i:"0")+"/"+(r.length>0?r:"0"),(i||r)&&(u=u+"/"+f),n.absolutepath+u+n.randomToken},transportadoras:function(t,i){var r;return r="Api/Transportadoras/Resultados/"+t+"/"+i,n.absolutepath+r+n.randomToken},filtrosOrigemDestino:function(t,i){var r;return r="Api/Rotas/Filtros/"+t+"/"+i,n.absolutepath+r+n.randomToken},filtrosCargasEspeciais:function(t){var i;return i="Api/CargasEspeciais/Filtros/"+t,n.absolutepath+i+n.randomToken},filtrosProdutosServicos:function(t){var i;return i="Api/ProdutosServicos/Filtros/"+t,n.absolutepath+i+n.randomToken},filtrosTransportadoras:function(t){var i;return i="Api/Transportadoras/Filtros/"+t,n.absolutepath+i+n.randomToken},assinarNewsletter:function(){var t;return t="Api/Newsletter/Assinar",n.absolutepath+t}}}]);portalModule.factory("origemDestinoService",["globalService","endPointService","autocompleteService",function(n,t,i){return{distanciaEndPoint:n.absolutepath+"rotas/distancia",configAutoComplete:function(n,r,u,f){i.init("#"+n,options={minChars:2,maxHeight:200,width:630,zIndex:9999,deferRequestBy:0,noCache:!1,onSelect:function(n){$("#"+u).val(n.data)},serviceUrl:t.sugestoesCidades,autoSelectFirst:!0,tabDisabled:!1,noItemLinked:!0,onSearchStart:function(){},onSearchComplete:function(){},showNoSuggestionNotice:!0,noSuggestionNotice:"Nenhuma cidade encontrada"});i.init("#"+r,options={minChars:2,maxHeight:200,width:630,zIndex:9999,deferRequestBy:0,noCache:!1,onSelect:function(n){$("#"+f).val(n.data)},serviceUrl:t.sugestoesCidades,autoSelectFirst:!0,tabDisabled:!1,noItemLinked:!0})}}}]);portalModule.factory("transportadorasService",["globalService","endPointService","autocompleteService",function(n,t,i){return{configAutoComplete:function(n){i.init("#"+n,options={minChars:2,maxHeight:200,width:630,zIndex:9999,deferRequestBy:0,noCache:!1,serviceUrl:t.sugestoesCidades,autoSelectFirst:!0,tabDisabled:!1,noItemLinked:!0});i.init("#"+destinoFieldText,options={minChars:2,maxHeight:200,width:630,zIndex:9999,deferRequestBy:0,noCache:!1,onSelect:function(n){$("#"+destinoFieldHidden).val(n.data)},serviceUrl:t.sugestoesCidades,autoSelectFirst:!0,tabDisabled:!1,noItemLinked:!0})},removeAutoComplete:function(){i.disable("#"+destinoFieldText)}}}]);portalModule.factory("produtoServicosService",["globalService","endPointService","autocompleteService",function(n,t,i){return{configAutoComplete:function(n){i.init("#"+n,options={minChars:2,maxHeight:200,width:630,zIndex:9999,deferRequestBy:0,noCache:!1,serviceUrl:t.sugestoesProdutosServicos,autoSelectFirst:!0,tabDisabled:!1,noItemLinked:!0})}}}]);portalModule.factory("cargasEspeciaisService",["globalService","endPointService","autocompleteService",function(n,t,i){return{configAutoComplete:function(n){i.init("#"+n,options={minChars:2,maxHeight:200,width:630,zIndex:9999,deferRequestBy:0,noCache:!1,serviceUrl:t.sugestoesCargasEspecializadas,autoSelectFirst:!0,tabDisabled:!1,noItemLinked:!0})}}}]);portalModule.factory("perfilEmpresaService",["globalService","endPointService",function(){return{fotos:function(){return""}}}]);portalModule.factory("cotacaoService",["globalService","endPointService",function(){var n=[],t=0;return{carregarValores:function(i,r){n=i;t=r},adicionarEmpresaParaCotacao:function(i,r){n&&n.find(function(n){return n==r.Id})?(t--,n.splice(n.indexOf(r.Id),1)):(t++,n.push(r.Id))},totalBoxesParaCotacao:function(){return t},boxesIdsParaCotacao:function(){return n}}}]);portalModule.factory("googleMapsService",["$q",function(n){var t={zoom:6,center:new google.maps.LatLng(-15.8722599,-46.0718145),mapTypeId:google.maps.MapTypeId.ROADMAP,disableDoubleClickZoom:!0,streetViewControl:!1,mapTypeControl:!1,scaleControl:!0,scrollwheel:!1},u=new google.maps.DirectionsService,i=new google.maps.DirectionsRenderer,r,f=function(n,u){angular.extend(t,u);r=new google.maps.Map(document.getElementById(n),t);i.setMap(r)},e=function(t){var r=n.defer(),f,e;if(t instanceof Array==!1)return r.reject("Parâmetro 'locais' precisa ser um array de strings"),r.promise;if(t.length<2)return r.reject("Parâmetro 'locais' precisa de ao menos duas rotas, origem e destino"),r.promise;if(!t[0])return r.reject("Informe um endereço de origem"),r.promise;if(!t[t.length-1])return r.reject("Informe um endereço de destino"),r.promise;for(f=t.slice(0),f.shift(),f.pop(),e=0;e<f.length;e++)f[e]&&(f[e]={location:f[e],stopover:!0});return u.route({origin:t[0],destination:t[t.length-1],waypoints:f,optimizeWaypoints:!1,travelMode:google.maps.TravelMode.DRIVING},function(n,t){t===google.maps.DirectionsStatus.OK?(i.setDirections(n),r.resolve(n.routes[0])):r.reject(t)}),r.promise};return{inicializarMapa:f,gerarRotas:e}}]);portalModule.factory("googleDistanceService",["$q",function(n){directionsService=new google.maps.DirectionsService;var t=function(t){var i=n.defer(),r,u;if(t instanceof Array==!1)return i.reject("Parâmetro 'locais' precisa ser um array de strings"),i.promise;if(t.length<2)return i.reject("Parâmetro 'locais' precisa de ao menos duas rotas, origem e destino"),i.promise;if(!t[0])return i.reject("Informe um endereço de origem"),i.promise;if(!t[t.length-1])return i.reject("Informe um endereço de destino"),i.promise;for(r=t.slice(0),r.shift(),r.pop(),u=0;u<r.length;u++)r[u]&&(r[u]={location:r[u],stopover:!0});return directionsService.route({origin:t[0],destination:t[t.length-1],waypoints:r,optimizeWaypoints:!1,travelMode:google.maps.TravelMode.DRIVING},function(n,t){t===google.maps.DirectionsStatus.OK?i.resolve(n.routes[0]):i.reject(t)}),i.promise};return{gerarRotas:t}}]);portalModule.factory("preventDoubleSubmitService",["$http",function(){return{enablePreventDoubleSubmit:function(n,t){t==null?$("form button[type=submit]").text(n):($(t).text(n),$(t).attr("disabled","disabled"))},disablePreventDoubleSubmit:function(n,t,i){i==null?$("form button[type=submit]").text(n):$(i).text(n);t&&$("form").trigger("reset")}}}]);portalModule.factory("formService",["$http","endPointService","preventDoubleSubmitService",function(n,t,i){var u=function(){$("form button[type=button]").filter(":contains('Fechar'),:contains('Limpar')").click(function(){$("form").trigger("reset")})},f=function(n,t){i.enablePreventDoubleSubmit(n,t)},e=function(n,t,r,u){$("#"+n).submit(function(){i.enablePreventDoubleSubmit(r,u);setTimeout(function(){$("#"+n+" input").each(function(){var n=$(this).attr("class");if(n!=null&&n.toString().indexOf("error")>0){i.disablePreventDoubleSubmit(t,!1,u);return}})},500)})},r=!1,o=function(n,t){_useSvgShow="<use xmlns:xlink='http://www.w3.org/1999/xlink' xlink:href='#m-icon__see'><\/use>";_useSvgHide="<use xmlns:xlink='http://www.w3.org/1999/xlink' xlink:href='#m-icon__hidden'><\/use>";r?(angular.element("#seePasswordSvg").html(_useSvgShow),angular.element("#seePasswordText").html("exibir")):(angular.element("#seePasswordSvg").html(_useSvgHide),angular.element("#seePasswordText").html("ocultar"));r=!r;angular.element(t).hasClass("s-password-open")?angular.element(t).removeClass("s-password-open"):angular.element(t).addClass("s-password-open");angular.element(n).is("[type=text]")?angular.element(n).prop("type","password"):angular.element(n).prop("type","text")};return{setButtonResetForm:u,enablePreventDoubleSubmit:f,preventDoubleSubmit:e,disablePreventDoubleSubmit:function(n,t,r){i.disablePreventDoubleSubmit(n,t,r)},consultarEnderecoPorCep:function(i,r){var u=n.get(t.consultarEnderecoPorCep(i));u.success(function(n,t){r(n,t)});u.error(function(n,t){r(t,t)})},carregarCidadesPorEstado:function(i,r){var u=n.get(t.cidadesPorEstado(i));u.success(function(n,t){r(n,t)});u.error(function(n,t){r(t,t)})},carregarEstados:function(i){var r=n.get(t.estados);r.success(function(n,t){i(n,t)});r.error(function(n,t){i(t,t)})},mostrarSenha:o}}]);portalModule.factory("assinaturaEmailService",["$http","$q","globalService","endPointService",function(n,t,i,r){var u=function(u){var f=t.defer(),e;return i.isEmailValid(u)?(e=n.post(r.assinarNewsletter(),{email:u}),e.success(function(){f.resolve("Email registrado com sucesso!")}),e.error(function(n,t){f.reject(t)}),f.promise):(f.reject("O email precisa ser válido!"),f.promise)};return{assinar:u}}]);portalModule.directive("googleplace",function(){return{require:"ngModel",link:function(n,t,i,r){n.gPlace=new google.maps.places.Autocomplete(t[0],{types:[],componentRestrictions:{country:"br"}});google.maps.event.addListener(n.gPlace,"place_changed",function(){n.$apply(function(){r.$setViewValue(t.val())})})}}});portalModule.directive("ngHtml",["$compile",function(n){return function(t,i,r){r.ngHtml&&(i.html(t.$eval(r.ngHtml)),n(i.contents())(t));t.$watch(r.ngHtml,function(r,u){r&&r!==u&&(i.html(r),n(i.contents())(t))})}}]);portalModule.filter("USUnitsToPTBR",function(){return function(n){return n.replace(",","-").replace(".",",").replace("-",".")}});portalModule.filter("metersToKilometers",function(){return function(n){return n/1e3}})