(function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='catalog/view/theme/vista/public/',b(b.s=517)})({517:function(){function a(){FB.init({appId:$('#btnAppFacebook').data('facebook-id'),cookie:!0,xfbml:!0,version:'v14.0'})}function b(a){var b=$('#btnAppFacebook').data('tipo-validacao-social');FB.api('/me',{fields:'name,first_name,last_name, email'},function(c){$.ajax({url:'index.php?route=account/login/socialLogin',type:'post',data:{emailRedeSocial:c.email,nomeRedeSocial:c.name,primeiroNomeRedeSocial:c.first_name,sobrenomeRedeSocial:c.last_name,idRedeSocial:c.id,origemLogin:'facebook',tokenloginsocial:a,tipo_validacao_social:b},dataType:'json',success:function(a){if('vincular'!=b)a.login?-1==window.location.href.indexOf('route=checkout/checkout')?document.formlogin.submit():location.reload():(notificationMsg(a.warning,'warning'),$('input[name=\'email\']').val(a.emailRedeSocial),$('input[name=\'firstname\']').val(a.primeiroNomeRedeSocial),$('input[name=\'lastname\']').val(a.sobrenomeRedeSocial));else if(!a.warning_login_vinculado){var c=document.getElementById('btnAppFacebook'),d=document.getElementById('text-vinculo-facebook');a.login_vinculado?(d.textContent='Desconectar',c.onclick=function(a){a.preventDefault(),a.stopPropagation(),facebookUnlink()},notificationMsg($('#btnAppFacebook').data('text-facebook-vinculado'),'success')):(d.textContent='Conectar',c.onclick=function(a){a.preventDefault(),a.stopPropagation(),loginFacebook()},notificationMsg($('#btnAppFacebook').data('text-facebook-desvinculado'),'success'))}else notificationMsg(a.warning_login_vinculado,'warning')}})})}(function(a,b,c){var d,e=a.getElementsByTagName(b)[0];a.getElementById(c)||(d=a.createElement(b),d.id=c,d.src='https://connect.facebook.net/pt_BR/sdk.js',e.parentNode.insertBefore(d,e))})(document,'script','facebook-jssdk'),window.loginFacebook=function(){try{a(),FB.login(function(a){'connected'===a.status&&b(a.authResponse.accessToken)},{scope:'public_profile,email',enable_profile_selector:!0})}catch(a){alert('Verifique se voc\xEA tem acesso liberado ao Facebook(https://www.facebook.com/).')}},window.facebookUnlink=function(){try{a(),$.ajax({url:'index.php?route=account/account/unlink_social_media_access',type:'post',dataType:'json',data:{ajax:!0,redesocial:'facebook'}}).done(function(a){if(a.result){FB.getLoginStatus(function(a){'connected'==a.status&&FB.logout()});var b=document.getElementById('btnAppFacebook'),c=document.getElementById('text-vinculo-facebook');c.textContent='Conectar',b.onclick=function(a){a.preventDefault(),a.stopPropagation(),loginFacebook()},notificationMsg($('#btnAppFacebook').data('text-facebook-desvinculado'),'success')}else notificationMsg('Ocorreu um erro ao fazer o desvinculo dos dados do Facebook!','warning')}).fail(function(a){console.log('error'),console.log(a)})}catch(a){alert('Verifique se voc\xEA tem acesso liberado ao Facebook(https://www.facebook.com/).')}}}});