tm.jsuol.com.br
Open in
urlscan Pro
2600:9000:2761:7400:6:9eb2:5cc0:93a1
Public Scan
URL:
https://tm.jsuol.com.br/uoltm.js?id=wsywkx
Submission: On September 30 via api from LU — Scanned from DE
Submission: On September 30 via api from LU — Scanned from DE
Form analysis
0 forms found in the DOMText Content
(function(window,document,undefined){try{if(window.UOLPD.TagManager["wsywkx"]){return;}}catch(err){}var tmConsole;function ContentValidator(){var $public=this;var $private={};$public.isFilledObject=function(entity){if(!entity||entity.constructor!==Object){return false;}for(var key in entity){return true;}return false;};$public.stringIsNotEmpty=function(string){if(typeof string!=="string"){return false;}return $private.trimString(string).length>0;};$private.trimString=function(string){return string.replace(/^(\s+)|(\s+)$/gm,"").replace(/\s+/gm," ");};$public.stringMatches=function(string,regexp){if(!$public.stringIsNotEmpty(string)){return false;}return regexp.test(string);};return $public;}function CookieUtils(){var $public=this;var $private={};$private.typeValidator=new TypeValidator();$public.getItem=function(name){if(!$private.typeValidator.isString(name)){return;}var cookie=document.cookie;var startIndex=cookie.indexOf(name+"=");if(startIndex===-1){return;}var middleIndex=cookie.indexOf("=",startIndex)+1;var endIndex=cookie.indexOf(";",middleIndex);cookie=cookie.replace(/ SameSite=None; Secure;/gi,"");if(endIndex===-1){endIndex=cookie.length;}return unescape(cookie.substring(middleIndex,endIndex));};$public.setItem=function(name,value,domain,expireDays,expireHours,expireMinutes){if(!$private.typeValidator.isString(name)){return false;}if(!$private.typeValidator.isString(value)){return false;}document.cookie=$private.createCookieString(name,value,domain,expireDays,expireHours,expireMinutes);};$private.createCookieString=function(name,value,domain,expireDays,expireHours,expireMinutes){var cookie=name+"="+value;if($private.hasExpirationTime(expireDays,expireHours,expireMinutes)){cookie+="; expires="+$private.getExpirationDate(expireDays,expireHours,expireMinutes)+"; path=/";}if($private.typeValidator.isString(domain)){if(cookie.substr(cookie.length-1)!==";"){cookie+=";";}cookie+=" domain="+domain+";";}if(window.location.ancestorOrigins.length>0){if(!window.location.ancestorOrigins[0].match(/localhost/g)&&!window.location.ancestorOrigins[0].match(/uol.com/g)&&!window.location.ancestorOrigins[0].match(/karma.tm.uol.com.br/g)){if(cookie.substr(cookie.length-1)!==";"){cookie+="; SameSite=None; Secure;";}else{cookie+=" SameSite=None; Secure;";}}}return cookie;};$private.hasExpirationTime=function(days,hours,minutes){if($private.isValidNumber(days)||$private.isValidNumber(hours)||$private.isValidNumber(minutes)){return true;}return false;};$private.isValidNumber=function(number){if(!isNaN(parseInt(number))&&parseInt(number)!==0){return true;}return false;};$private.getExpirationDate=function(days,hours,minutes){var exdate=new Date();if($private.isValidNumber(days)){exdate.setDate(exdate.getDate()+days);}if($private.isValidNumber(hours)){exdate.setHours(exdate.getHours()+hours);}if($private.isValidNumber(minutes)){exdate.setMinutes(exdate.getMinutes()+minutes);}return exdate.toGMTString();};$private.setCookie=function(value){document.cookie=value;};$public.removeItem=function(name,domain){$private.setCookie($private.createCookieString(name,"",domain,-100));};$public.getCookies=function(){var listCookies=document.cookie;listCookies=listCookies.replace(/ SameSite=None; Secure;/gi,"");return listCookies;};}function Logs(){var $private={};var $public=this;$private.queryString=new QueryString();$private.typeValidator=new TypeValidator();$private.tmConsole=(typeof tmConsole!=="undefined"?tmConsole:undefined);$private.history={"warn":[],"error":[],"info":[],"debug":[],"log":[]};$public.getPrefix=function(prefix){return $private.prefix;};$public.setPrefix=function(prefix){if($private.typeValidator.isString(prefix)){$private.prefix="["+prefix+"] ";}};$public.warn=function(message,namTag,namespace,executionTime){if($public.consoleValidator($private.tmConsole)){$private.tmConsole.append(namTag,namespace,message,executionTime,"warn");}return $private.print(message,"warn");};$public.error=function(message,namTag,namespace,executionTime){if($public.consoleValidator($private.tmConsole)){$private.tmConsole.append(namTag,namespace,message,executionTime,"error");}return $private.print(message,"error");};$public.info=function(message){return $private.print(message,"info");};$public.debug=function(message){return $private.print(message,"debug");};$public.log=function(message,namTag,namespace,executionTime){if($public.consoleValidator($private.tmConsole)){$private.tmConsole.append(namTag,namespace,message,executionTime,"success");}return $private.print(message,"log");};$public.consoleValidator=function(tmConsole){if(!tmConsole){return false;}if(!$private.typeValidator.isFunction(tmConsole.append)){return false;}return true;};$private.print=function(msg,fn){if(!$private.prefix){return;}if(!$private.typeValidator.isString(msg)){return;}msg=$private.prefix+msg;$public.setHistory(fn,msg);if($public.isActive()===false||!$private.hasConsole()){return;}return $private.runLogMethod(fn,msg);};$public.isActive=function(){if($private.queryString.getValue("tm")==="debug"){return true;}return false;};$public.getHistory=function(methodName){if($private.typeValidator.isArray($private.history[methodName])){return $private.history[methodName];}return;};$public.setHistory=function(fn,msg){if($private.typeValidator.isString(msg)&&$private.typeValidator.isArray($private.history[fn])){$private.history[fn].push(msg);}};$private.hasConsole=function(){if(!$private.typeValidator.isDefined($public.getConsole())){return false;}if(!$private.typeValidator.isDefined($public.getConsoleLog())){return false;}return true;};$public.getConsole=function(){return window.console;};$public.getConsoleLog=function(){return $public.getConsole().log;};$private.runLogMethod=function(fn,msg){if($private.typeValidator.isDefined($public.getConsole()[fn])){$public.getConsole()[fn](msg);return fn;}window.console.log(msg);return"log";};}function NameSpace(packageName){var $private={};var $public=this;$private.version="${project.version}";$private.validator=new TypeValidator();$public.init=function(packageName){if($private.validator.isString(packageName)){return $public.create(packageName);}};$public.create=function(packageName){$private.createUOLPD();$private.createTagManager();return $private.createPackage(packageName);};$private.createUOLPD=function(){if(!$private.validator.isObject(window.UOLPD)){window.UOLPD={};}};$private.createTagManager=function(){if(!$private.validator.isObject(UOLPD.TagManager)&&!$private.validator.isFunction(UOLPD.TagManager)&&typeof UOLPD.TagManager!=="object"){UOLPD.TagManager={};}};$private.createPackage=function(packageName){if(!$private.validator.isString(packageName)){return UOLPD.TagManager;}if(!$private.validator.isObject(UOLPD.TagManager[packageName])){UOLPD.TagManager[packageName]={};}UOLPD.TagManager[packageName].version=$private.version;if(!$private.validator.isArray(UOLPD.TagManager[packageName].config)){UOLPD.TagManager[packageName].config=[];}if(!$private.validator.isObject(UOLPD.TagManager[packageName].log)){UOLPD.TagManager[packageName].log=new Logs();UOLPD.TagManager[packageName].log.setPrefix("UOLPD.TagManager."+packageName);}return UOLPD.TagManager[packageName];};return $public.init(packageName);}function QueryString(){var $private={};var $public=this;$private.typeValidator=new TypeValidator();$public.getValue=function(name){if(!$private.queryStrings){return;}return $private.queryStrings[name];};$public.getQueryStrings=function(){return $private.queryStrings;};$public.setValues=function(){if(!$private.typeValidator.isString($public.getSearch())){return;}var substrings=$public.getSearch().substring(1).split("&");if(!$private.typeValidator.isArray(substrings)){return;}if(substrings.length===0){return;}for(var i=0,length=substrings.length;i<length;i++){if($private.typeValidator.isString(substrings[i])){$private.addQueryString(substrings[i]);}}};$public.getSearch=function(){return window.location.search;};$private.addQueryString=function(substring){var queryObject=$private.getQueryObject(substring);if(!queryObject){return;}$private.queryStrings=$private.queryStrings||{};$private.queryStrings[queryObject.key]=queryObject.value;};$private.getQueryObject=function(substring){var query=substring.split("=");if(!$private.typeValidator.isString(query[0])){return;}var result={"key":query[0],"value":"true"};if($private.typeValidator.isString(query[1])){result.value=query[1];}return result;};$public.setValues();}function RemoteStorage(){var $private={};var $public=this;$public.logs=new Logs();$public.logs.setPrefix("UOLPD.TagManager");$private.validator=new TypeValidator();$private.path="https://tm.uol.com.br/mercurio.html";$private.iframe=undefined;$private.iframeLoaded=false;$private.queue=[];$private.requests={};$public.init=function(){$private.hasLoaded(function(){$private.iframe=$private.getIframe($private.path);if(!$private.iframe){$private.setIframe();}if($private.iframe.getAttribute("data-loaded")==="true"){$private.iframeLoaded=true;}$private.setListener($private.iframe);return true;});return $public;};$private.getIframe=function(src){return document.querySelector('iframe[src*="'+src+'"]');};$public.get=function(key,callback,dataType){$private.communicator("get",key,undefined,callback,dataType);};$public.set=function(key,value,callback,dataType){$private.communicator("set",key,value,callback,dataType);};$public.removeItem=function(key,callback,dataType){callback=callback||function(){};$private.communicator("removeItem",key,undefined,callback,dataType);};$private.hasLoaded=function(fn,timeout){timeout=(timeout?timeout+10:10);if(typeof fn!="function"){return false;}if(document.body!==null){fn();return true;}window.setTimeout(function(){$private.hasLoaded(fn,timeout);},timeout);};$private.setIframe=function(){$private.iframe=$private.buildIframe();};$private.buildIframe=function(){var iframe=document.createElement("iframe");iframe.setAttribute("src",$private.path);iframe.setAttribute("id","tm-remote-storage");iframe.setAttribute("style","position:absolute;width:1px;height:1px;left:-9999px;display:none;");document.body.appendChild(iframe);return iframe;};$private.setListener=function(iframe){var hasEventListener=(window.addEventListener!==undefined);var method=(hasEventListener)?"addEventListener":"attachEvent";var message=(hasEventListener)?"message":"onmessage";var load=(hasEventListener)?"load":"onload";iframe[method](load,$private.iframeLoadHandler);window[method](message,$private.messageHandler);return iframe;};$private.iframeLoadHandler=function(event){event.target.setAttribute("data-loaded","true");$private.iframeLoaded=true;if(!$private.queue.length){return;}for(var i=0,length=$private.queue.length;i<length;i++){$private.sendMessageToIframe($private.queue[i]);}$private.queue=[];};$private.messageHandler=function(event){try{var data=JSON.parse(event.data);$private.requests[data.id].callback(data.key,data.value);delete $private.requests[data.id];}catch(err){}};$private.communicator=function(method,key,value,callback,dataType){if(!$private.validator.isString(key)){$public.logs.warn("Ocorreu um erro ao requisitar os dados");return;}if(method==="set"&&value===undefined){$public.logs.warn("Ocorreu um erro ao requisitar os dados");return;}if(!$private.validator.isFunction(callback)){$public.logs.warn("Ocorreu um erro ao requisitar os dados");return;}var request={id:(Math.round(Math.random()*9000000)),key:key,method:method,dataType:dataType};if(value){request.value=value;}var data={request:request,callback:callback};if($private.iframeLoaded){$private.sendMessageToIframe(data);}else{$private.queue.push(data);}if(!$private.iframe){$public.init();}};$private.sendMessageToIframe=function(data){$private.requests[data.request.id]=data;data=JSON.stringify(data.request);if(!data){return;}if($private.iframe&&$private.iframe.contentWindow){$private.iframe.contentWindow.postMessage(data,$private.path);}};return $public.init();}function Schema(configSchema){var $private={};var $public=this;$private.typeValidator=new TypeValidator();$private.contentValidator=new ContentValidator();$public.__constructor=function(configSchema){if(!$private.typeValidator.isObject(configSchema)){return;}if(!$private.typeValidator.isObject(configSchema.properties)){return;}if(!$private.isValidRequired(configSchema)){return;}$private.configSchema={};$private.configSchema.required=[];$private.setProperties(configSchema.properties);if(configSchema.required.length>0){$private.configSchema.required=configSchema.required;}return $public;};$public.isValid=function(config){if(!$private.configSchema){return false;}if(!$private.typeValidator.isObject(config)){$public.invalidProperties=$private.configSchema.required;return false;}if(!$private.contentValidator.isFilledObject(config)){$public.invalidProperties=$private.configSchema.required;return false;}return $private.areValidProperties(config);};$private.isValidRequired=function(configSchema){if(!$private.typeValidator.isArray(configSchema.required)){return false;}for(var i=0,length=configSchema.required.length;i<length;i++){var required=configSchema.required[i];if(!$private.typeValidator.isString(required)){return false;}if(!configSchema.properties[required]){return false;}}return true;};$private.setProperties=function(properties){$private.configSchema.properties=$private.configSchema.properties||{};for(var key in properties){var property=$private.getProperty(properties[key]);if(property){$private.configSchema.properties[key]=property;}}};$private.getProperty=function(property){var result={};if($private.typeValidator.isRegExp(property)){return{"validator":$private.contentValidator.stringMatches,"modifier":property};}if(!$private.typeValidator.isString(property)){return;}property=property.split(/\|(.+)?/,2);var validator=$private.getValidator(property);if(!validator){return;}result.validator=validator;if(property[1]){result.modifier=$private.getModifier(property[1]);}return result;};$private.getValidator=function(property){if(property.length===1){return $private.typeValidator[property[0]];}return $private.contentValidator[property[0]];};$private.getModifier=function(modifier){if(!modifier){return;}try{return eval(modifier);}catch(e){}};$private.areValidProperties=function(config){var isValid=true;var requiredProperties=0;for(var property in config){if(!$private.isValidProperty(property,config)){isValid=false;}if($private.isRequiredProperty(property)){requiredProperties++;}}if(requiredProperties!==$private.configSchema.required.length){$private.countRequiredProperties(config);return false;}return isValid;};$private.isValidProperty=function(property,config){var propertyValidator=$private.configSchema.properties[property];if(!propertyValidator){return false;}if(!propertyValidator.validator(config[property],propertyValidator.modifier)){$private.addInvalidProperty(property);return false;}return true;};$private.getPropertyValidator=function(property){var item=$private.configSchema.properties[property];if(!$private.typeValidator.isString(item)){return;}item=item.split(/\|(.+)?/,2);var validator=$private.typeValidator[item[0]];if(!validator){return;}var contentValidator=$private.contentValidator[item[1]];if(!contentValidator){return;}return{"validator":validator,"contentValidator":contentValidator};};$private.validateContent=function(property,contentValidator){try{return contentValidator(property,eval(contentValidator));}catch(e){}};$private.isRequiredProperty=function(property){if($private.configSchema.required.length===0){return false;}for(var i=0,length=$private.configSchema.required.length;i<length;i++){var required=$private.configSchema.required[i];if(required===property){return true;}}return false;};$private.addInvalidProperty=function(property){if(!$public.invalidProperties){$public.invalidProperties=[];}if(!$private.arrayHasItem($public.invalidProperties,property)){$public.invalidProperties.push(property);}};$private.arrayHasItem=function(array,item){for(var i=0,length=array.length;i<length;i++){if(array[i]==item){return true;}}return false;};$private.countRequiredProperties=function(config){for(var i=0,length=$private.configSchema.required.length;i<length;i++){var required=$private.configSchema.required[i];if(!$private.typeValidator.isDefined(config[required])){$private.addInvalidProperty(required);}}};return $public.__constructor(configSchema);}function ScriptUtils(){var $private={};var $public=this;$private.typeValidator=new TypeValidator();$private.dataCalls="data-uoltm-calls";$public.hasTagScript=function(src){if(!$private.typeValidator.isString(src)){return false;}if(src.length===0){return false;}if($public.findScript($private.removeProtocol(src))){return true;}return false;};$private.removeProtocol=function(value){return value.replace(/(^\/\/|^http:\/\/|^https:\/\/)/,"");};$public.findScript=function(src){return document.querySelector('script[src*="'+src+'"]');};$private.isSrcEqual=function(src1,src2){return(src1.indexOf(src2)>-1);};$public.createScript=function(src){if(!$private.typeValidator.isString(src)){return;}var tag=document.createElement("script");tag.setAttribute("src",src);tag.async=true;return tag;};$public.appendTag=function(script){if(!$private.typeValidator.isDefined(script)){return;}if(script.constructor===HTMLScriptElement){$private.lastScriptsParent().appendChild(script);return true;}};$private.lastScriptsParent=function(){return document.getElementsByTagName("script")[0].parentNode;};$public.createSyncScript=function(src){if(!$private.typeValidator.isString(src)){return;}document.write("<scr"+'ipt src="'+src+'"></scr'+"ipt>");};}function StringUtils(){var $private={};var $public=this;$private.typeValidator=new TypeValidator();$public.trim=function(value){if(!$private.typeValidator.isString(value)){return;}if(value.length===0){return;}value=value.replace(/^(\s+)|(\s+)$/gm,"").replace(/\s+/gm," ");return value;};$public.getValueFromKeyInString=function(str,name,separator){if(!$private.typeValidator.isString(name)||name.length===0){return;}if(!$private.typeValidator.isString(str)||str.length===0){return;}if(!$private.typeValidator.isString(separator)||separator.length===0){return;}if(str.substring(str.length-1)){str+=separator;}name+="=";var startIndex=str.indexOf(name);if(startIndex===-1){return"";}var middleIndex=str.indexOf("=",startIndex)+1;var endIndex=str.indexOf(separator,middleIndex);if(endIndex===-1){endIndex=str.length;}return unescape(str.substring(middleIndex,endIndex));};return $public;}function TrackManager(){var $private={};var $public=this;$private.API_URL="//logger.uol.com.br/v1/?prd=98&gps=true&disp=true&mm=true";$private.typeValidator=new TypeValidator();$private.scriptUtils=new ScriptUtils();$private.baseMetric={groupingMap:{},measureMap:{}};$private.raffledRate=Math.round(Math.random()*100);$private.samplingRate=1;$public.trackSuccess=function(msr,samplingRate){return;var sampling=$private.generateSamplingRate(samplingRate);$public.addMetrics($private.getMeasures(msr),null,sampling);};$public.trackExecution=function(){var measures=$private.getMeasures("execution");if(!$private.isTrackEnabled(1)){return;}var metric=$private.generateMetric(measures);if(!metric){return;}$private.createNamespaceMetrics();window.UOLPD.TagManager.metrics.push(metric);$private.triggerMetrics();};$private.generateSamplingRate=function(samplingRate){if($private.typeValidator.isNumber(samplingRate)){return samplingRate;}return $private.samplingRate;};$public.addMetrics=function(measures,groupings,samplingRate){if(!$private.isTrackEnabled(samplingRate)){return;}var metric=$private.generateMetric(measures,groupings);if(!metric){return;}var metricOrigem=metric.groupingMap.Origem;if(metricOrigem!=="TM-dfp-async"&&metricOrigem!=="TM-core"){return;}$private.createNamespaceMetrics();window.UOLPD.TagManager.metrics.push(metric);$private.triggerMetrics();};$private.isTrackEnabled=function(samplingRate){try{if(window.localStorage.getItem("trackManager")=="true"){return true;}}catch(e){}if($public.getRaffledRate()<=samplingRate){return true;}return false;};$public.getRaffledRate=function(){return $private.raffledRate;};$private.generateMetric=function(measures,groupings){var metric=JSON.parse(JSON.stringify($private.baseMetric));if($private.typeValidator.isObject(measures)){metric.measureMap=metric.measureMap||{};for(var msr in measures){metric.measureMap[msr]=measures[msr];}}if($private.typeValidator.isObject(groupings)){metric.groupingMap=metric.groupingMap||{};for(var grp in groupings){metric.groupingMap[grp]=groupings[grp];}}if(Object.keys(metric.measureMap).length<1){return;}return metric;};$private.createNamespaceMetrics=function(){window.UOLPD=window.UOLPD||{};window.UOLPD.TagManager=window.UOLPD.TagManager||{};window.UOLPD.TagManager.metrics=window.UOLPD.TagManager.metrics||[];};$private.triggerMetrics=function(){if(window.UOLPD.TagManager.trackTimeWindow){return;}window.UOLPD.TagManager.trackTimeWindow=setTimeout(function(){var xhr=new XMLHttpRequest();xhr.open("POST",$private.API_URL,true);xhr.setRequestHeader("Content-Type","application/json; charset=UTF-8");xhr.send(JSON.stringify(window.UOLPD.TagManager.metrics));window.UOLPD.TagManager.metrics=[];clearTimeout(window.UOLPD.TagManager.trackTimeWindow);window.UOLPD.TagManager.trackTimeWindow=undefined;},4000);};$private.getMeasures=function(msr,value,measure){if(!$private.typeValidator.isString(msr)){return measure;}if(!value){value="1";}if($private.typeValidator.isNumericString(value)||$private.typeValidator.isNumber(value)){measure=measure||{};measure[msr]=value;}return measure;};$public.getModuleName=function(moduleName){return $private.moduleName;};$public.setModuleName=function(moduleName){if($private.typeValidator.isString(moduleName)){$private.moduleName="TM-"+moduleName;}$private.baseMetric.groupingMap=$private.baseMetric.groupingMap||{};$private.baseMetric.groupingMap.tm_repo_id=$public.getRepoId();$private.baseMetric.groupingMap.Origem=$private.moduleName;};$public.getRepoId=function(){return"wsywkx";};$public.trackError=function(errorType,errorEffect){var errorGroups=$private.getGroups("erro_tipo",errorType);if(!$private.typeValidator.isObject(errorGroups)){return;}errorGroups=$private.getGroups("erro_efeito",errorEffect,errorGroups);if(!$private.typeValidator.isObject(errorGroups)){return;}$public.addMetrics($private.getMeasures("Erros"),errorGroups);};$private.getGroups=function(grp,value,groups){if(!$private.typeValidator.isString(grp)){return;}if(!$private.typeValidator.isString(value)&&!$private.typeValidator.isNumber(value)){return;}groups=groups||{};groups[grp]=value;return groups;};$public.trackCustom=function(measure,trackType,trackValue,samplingRate){var metricMeasures=$private.getMeasures(measure);var metricsGroups=$private.getGroups(trackType,trackValue);if(!metricMeasures||!metricsGroups){return;}var sampling=$private.generateSamplingRate(samplingRate);$public.addMetrics(metricMeasures,metricsGroups,sampling);};$public.trackCustomObj=function(metrics,samplingRate){if(!$private.typeValidator.isObject(metrics)||!$private.typeValidator.isObject(metrics.measures)){return;}var measures,groups;measures={};for(var msr in metrics.measures){measures=$private.getMeasures(msr,metrics.measures[msr],measures);}if(!$private.isValidMeasures(measures)){return;}if($private.typeValidator.isObject(metrics.groups)){groups={};for(var grp in metrics.groups){groups=$private.getGroups(grp,metrics.groups[grp],groups);}}var sampling=$private.generateSamplingRate(samplingRate);$public.addMetrics(measures,groups,sampling);};$private.isValidMeasures=function(measures){if(Object.keys(measures).length<1){return false;}var isValid=false;for(var msr in measures){if(measures[msr]==1||measures[msr]=="1"){isValid=true;}}return isValid;};}function TypeValidator(){var $public=this;var $private={};$private.contentValidator=new ContentValidator();$public.isDefined=function(value){return value!==undefined&&value!==null;};$public.isString=function(value){return $private.contentValidator.stringIsNotEmpty(value);};$public.isArray=function(value){return value&&value.constructor.toString()===Array.toString();};$public.isObject=function(entity){return entity&&entity.constructor.toString()===Object.toString();};$public.isFunction=function(value){return value!==undefined&&value.constructor.toString()===Function.toString();};$public.isNumber=function(value){return Number(value)===value;};$public.isInt=function(value){return $public.isNumber(value)&&value%1===0;};$public.isRegExp=function(value){return value!==undefined&&value.constructor.toString()===RegExp.toString();};$public.isNumericString=function(value){return $public.isString(value)&&!isNaN(value);};$public.isBoolean=function(value){return value!==undefined&&value.constructor.toString()==Boolean.toString();};return $public;}var uolpdCommons=new NameSpace("Commons");uolpdCommons.RemoteStorage=RemoteStorage;(function(window,document,undefined){var CodeInjectorSchema={"properties":{"codeInjector":"isString","globalScope":"isArray"},"required":["codeInjector"]};function Injector(){var $private={};var $public=this;$private.schema=new Schema(CodeInjectorSchema);$public.logger=new Logs();$public.logger.setPrefix("UOLPD.TagManager.CodeInjector");$public.codes=[];$private.typeValidator=new TypeValidator();$public.init=function(config,namTag,namespace){$private.configureLogger(namTag,namespace);if(!$private.schema.isValid(config)){$public.logger.error("A configuração fornecida pelo Tag Manager está inválida a seguinte propriedade de configuração: "+$private.schema.invalidProperties.join(", ")+" não existe ou está inválida",$private.namTag,$private.namespace,$private.calculateTimeSpent());return;}var code=$private.trimScriptTag(config.codeInjector);$private.evalCode(code,config.globalScope);};$private.configureLogger=function(namTag,namespace){$private.namTag=namTag;$private.namespace=namespace;$private.timeStampInit=Date.now();};$private.trackError=function(errorType,errorMessage){if(!$private.typeValidator.isString(errorType)){return;}if(!$private.typeValidator.isString(errorMessage)){return;}$public.logger.warn(errorMessage,$private.namTag,$private.namespace,$private.calculateTimeSpent());};$private.calculateTimeSpent=function(timeStampInit){if(!$private.typeValidator.isDefined(timeStampInit)){return Date.now()-$private.timeStampInit;}return Date.now()-timeStampInit;};$private.trimScriptTag=function(code){var replaceScriptRegex=/^(\s+)?<script>(\s+)?|(\s+)?<\/script>(\s+)?$/gm;code=code.replace(replaceScriptRegex,"");$public.codes.push(code);return code;};$private.evalCode=function(code,globalScope){try{if(globalScope&&globalScope.length===1){window.eval(code);}else{var dynMet=new Function(code);dynMet();}$public.logger.log("Tag do CodeInjector executada com sucesso",$private.namTag,$private.namespace,$private.calculateTimeSpent());}catch(err){$private.trackError("parse_error","O Tag Manager previniu um erro de execução de javascript. Favor verificar a implementação de sua tag");}};}var nameSpace=new NameSpace("CodeInjector");nameSpace.init=function(config,namTag){return(new Injector()).init(config,namTag,"CodeInjector");};})(window,document);(function(window,document,undefined){function UolDna(){var $private={};var $public=this;$public.logger=new Logs();$public.logger.setPrefix("UOLPD.TagManager.DNA");$public.trackManager=new TrackManager();$public.trackManager.setModuleName("dna");$private.src="//tm.uol.com.br/uoldna.html?referer="+encodeURIComponent(window.location.host+window.location.pathname);$public.init=function(namTag,namespace){$public.trackManager.trackSuccess("Execucoes Iniciadas");$private.configureLogger(namTag,namespace);if($private.stopFlow()){return;}$public.setIframe();$private.appendIframe();};$private.configureLogger=function(namTag,namespace){$private.namTag=namTag;$private.namespace=namespace;$private.timeStampInit=Date.now();};$private.stopFlow=function(){var tt_uid;try{tt_uid=window.localStorage.getItem("tt_uid");}catch(err){}if(tt_uid){$public.logger.log("O UOL DNA já foi realizado na página",$private.namTag,$private.namespace,$private.calculateTimeSpent());$public.trackManager.trackCustom("Execucoes Finalizadas","fluxo","2");return true;}if($private.isIframeInPage()){$public.trackManager.trackError("duplicate-call","fluxo_interrompido");$public.logger.warn("Já existe o iframe com o src do DNA na página",$private.namTag,$private.namespace,$private.calculateTimeSpent());return true;}return false;};$private.isIframeInPage=function(){if(document.querySelector('[src*="'+$private.src+'"]')){return true;}return false;};$private.calculateTimeSpent=function(){return Date.now()-$private.timeStampInit;};$public.getIframe=function(){return $private.iframe;};$public.setIframe=function(){$private.iframe=document.createElement("iframe");$private.iframe.style.display="none";$private.iframe.setAttribute("src","https:"+$private.src);};$private.appendIframe=function(){if(!document.body){setTimeout($private.appendIframe,100);}else{document.body.appendChild($private.iframe);$private.loadTimeInit=Date.now();$private.executionTime=$private.calculateTimeSpent();$public.logger.log("O iframe do UOL DNA foi incluído com sucesso",$private.namTag,$private.namespace,$private.executionTime);$public.trackManager.trackCustom("Execucoes Finalizadas","fluxo","1");}};}var nameSpace=new NameSpace("DNA");nameSpace.init=function(config,namTag){return(new UolDna()).init(namTag,"DNA");};})(window,document);var defaultTags=[{"name":"UOL DNA","module":"DNA","rules":{"enable":["/\\.uol\\.com\\.br/.test(window.location.href)"],"disable":[]},"events":["onload"]},{"name":"Behavioural Targeting","module":"CodeInjector","rules":{"enable":["document.location.href.match(/.*/)"],"disable":[]},"events":["onload"],"config":{"codeInjector":"(function() {\n\tif ('wsywkx' == 'a06jq7' || 'wsywkx' == 'wapbwn') return;\n\tvar script = document.createElement('script');\n\tscript.setAttribute('src', '//tracker.bt.uol.com.br/partner?source=tagmanager');\n\tdocument.head.appendChild(script);\n})()"}},{"name":"TailTarget Cookie Sync","module":"CodeInjector","rules":{"enable":["document.location.href.match(/.*/)"],"disable":[]},"events":["onload"],"config":{"codeInjector":"(function (RemoteStorage) {\n function UserIdentifier () {\n var $private = {};\n var $public = this;\n\n $private.remoteStorage = new RemoteStorage();\n $private.ttSource = '//m.t.tailtarget.com/sync/TT-10162-1/';\n $private.uid = {};\n $private.dna = null;\n\n $public.init = function () {\n $private.remoteStorage.get('DNA', $private.requestDNA);\n };\n\n $private.requestDNA = function (key, dnaID) {\n var DNA_UID = ('; ' + document.cookie).split('; DNA=').pop().split(';').shift();\n if (!DNA_UID || DNA_UID === 'null') {\n if (!dnaID) {\n return;\n }\n DNA_UID = dnaID;\n }\n\n if (DNA_UID.indexOf('{') >= 0) {\n return;\n }\n\n $private.dna = DNA_UID.split(\"|\")[0];\n $private.uid.dna = $private.dna;\n\n $private.setHash();\n };\n\n $private.setHash = function () {\n var ttSrcs = $private.getScriptTailBySrc($private.ttSource);\n if (ttSrcs.length > 0) {\n $private.uid.hash = [];\n }\n for (var i = 0; i < ttSrcs.length; i++) {\n var ttSrc = ttSrcs[i];\n var hash = ttSrc.getAttribute('src').match(/.*m\\.t.tailtarget\\.com\\/sync\\/TT-10162-1\\/([\\w]+)/)[1];\n\n $private.uid.hash.push(hash);\n }\n\n $private.remoteStorage.set('UID', JSON.stringify($private.uid), function () {});\n };\n\n $private.getScriptTailBySrc = function (src) {\n return document.querySelectorAll('[src*=\"'+ src +'\"]');\n };\n };\n\n window.setTimeout(function () { (new UserIdentifier()).init(); }, 500);\n})(UOLPD.TagManager.Commons.RemoteStorage);"}},{"name":"Purga de clients de RT expirados","module":"CodeInjector","rules":{"enable":["document.location.href.match(/.*/)"],"disable":[]},"events":["onload"],"config":{"codeInjector":"(function () {\n var createIframe = function (name, expname, expdomain) {\n var iframe = document.createElement('iframe');\n iframe.style.width = '0';\n iframe.style.heigth = '0';\n iframe.style.display = 'none';\n iframe.style.opacity = '0';\n iframe.style.border = '0';\n iframe.setAttribute('src', 'https://tm.uol.com.br/purge-clients.html?name=' + name + '&expname=' + expname + '&expdomain=' + expdomain);\n document.body.appendChild(iframe);\n };\n \n createIframe('DEretargeting', 'DEretargetingExp', '1');\n createIframe('dynad_rt', 'dynad_rt_exp', '1');\n})();"}}];function VersionManager(){var $private={};var $public=this;$public.logger=new Logs();$private.validator=new TypeValidator();$private.stringUtils=new StringUtils();$private.scriptUtils=new ScriptUtils();$private.tmVersionToken="uoltm_version";$public.setSpecificVersion=function(){if(!$public.specificVersionWasRequested()){return;}$private.scriptUtils.createSyncScript($public.getSpecificVersionURL());};$public.specificVersionWasRequested=function(){var requestedVersion=$private.getRequestedVersion();var versionRegex=/^\d+$/gm;var isValidVersion=versionRegex.test(requestedVersion);if(!requestedVersion||!isValidVersion){return false;}if($private.hasVersionScriptInPage()){return false;}return true;};$public.getSearch=function(){return window.location.search;};$public.getScriptUrl=function(){var __monitoracaoJsuol="tm.jsuol.com.br/ws/yw/wsywkx.js";return __monitoracaoJsuol;};$public.getSpecificVersionURL=function(){var codRepository=$private.getCodRepository();var versionURL=$private.buildVersionURL(codRepository);return versionURL;};$private.getRequestedVersion=function(){var requestedVersion=$private.stringUtils.getValueFromKeyInString($public.getSearch(),$private.tmVersionToken,"&");return requestedVersion;};$private.hasVersionScriptInPage=function(){var versionURL=$public.getSpecificVersionURL();var scripts=document.querySelectorAll('script[src*="'+versionURL+'"]');if(!scripts||!scripts.length){return false;}return true;};$private.buildVersionURL=function(codRepository){var mainPath="//tm.jsuol.com.br/";var firstDirLevel=codRepository.substring(0,2)+"/";var secondDirLevel=codRepository.substring(2,4)+"/";var fullPath=mainPath+firstDirLevel+secondDirLevel+codRepository;var requestedVersion=$private.getRequestedVersion();if(requestedVersion!="0"){fullPath+="-"+$private.getRequestedVersion()+".js";}else{fullPath+=".js";}return fullPath;};$private.getCodRepository=function(){var baseURLRegex=/[\w\d]{6}\.js$/gm;var codRepository=$public.getScriptUrl().match(baseURLRegex,"")[0];codRepository=codRepository.replace(".js","");return codRepository;};}function TagController(){var $private={};var $public=this;$private.typeValidator=new TypeValidator();$private.dataLayer=new DataLayer();$private.trackManager=new TrackManager();$private.trackManager.setModuleName("core");$private.executedTags=[];$private.useEvalCache=false;$private.evalCache={};$public.loadEvalCache=function(distinctEvals){if(distinctEvals!=undefined){for(var index in distinctEvals){var evalElement=distinctEvals[index];try{$private.evalCache[evalElement]=eval(evalElement);}catch(e){$private.evalCache[evalElement]=false;}}$private.useEvalCache=true;}};$public.addEvents=function(tag){if(!$private.isTagValid(tag)){return;}for(var i=0,length=tag.events.length;i<length;i++){if($private.typeValidator.isString(tag.events[i])){$private.addEvent(tag.events[i],tag);}}};$private.isTagValid=function(tag){if(!$private.typeValidator.isObject(tag)){return false;}if(!$private.typeValidator.isString(tag.module)){return false;}if(!$private.typeValidator.isObject(tag.rules)){return false;}if(!$private.typeValidator.isArray(tag.rules.enable)){return false;}if(!$private.typeValidator.isArray(tag.rules.disable)){return false;}if(!$private.typeValidator.isArray(tag.events)){return false;}if(tag.config&&!$private.typeValidator.isObject(tag.config)){return false;}return true;};$public.getEvents=function(eventName){return $private.events;};$private.addEvent=function(eventName,tag){if(eventName==="autostart"||eventName==="onload"||eventName==="onready"){$private.eventsDefaul(eventName,tag);return;}window.UOLPD=window.UOLPD||{};window.UOLPD.eventsUOLTM=window.UOLPD.eventsUOLTM||{};var events=window.UOLPD.eventsUOLTM[eventName]||[];events.push($private.cloneTag(tag,eventName));window.UOLPD.eventsUOLTM[eventName]=events;};$private.eventsDefaul=function(eventName,tag){$private.events=$private.events||{};var events=$private.events[eventName]||[];events.push($private.cloneTag(tag,eventName));$private.events[eventName]=events;};$private.cloneTag=function(tag,eventName){var result={};for(var key in tag){result[key]=tag[key];}if($private.typeValidator.isString(tag.module)){result.moduleName=tag.module;result.module=$public.getModuleByName(tag.module);result.event=[eventName];}return result;};$public.getModuleByName=function(moduleName){var module;if(!$private.typeValidator.isString(moduleName)){return;}module=window.UOLPD.TagManager[moduleName];if(!$private.typeValidator.isDefined(module)){return;}module.nameSpace=moduleName;if($private.typeValidator.isFunction(module.init)){return module;}};$public.triggerEvents=function(eventName){var timeStampStartExecution=Date.now();var currentEvent=$public.getCurrentEvent(eventName);if(!currentEvent){return;}for(var i=0,length=currentEvent.length;i<length;i++){try{$private.activateTag(currentEvent[i],eventName);}catch(e){}}$private.trackManager.trackCustomObj($private.getExecutionMetrics(timeStampStartExecution,{groups:{event:eventName},measures:{tagsAmount:currentEvent.length}}));};$public.getCurrentEvent=function(eventName){var currentEvent=$private.getTagsEvent(eventName);if($private.typeValidator.isArray(currentEvent)){return currentEvent;}};$private.getTagsEvent=function(eventName){if(eventName!=="autostart"&&eventName!=="onload"&&eventName!="onready"){window.UOLPD.eventsUOLTM=window.UOLPD.eventsUOLTM||{};return window.UOLPD.eventsUOLTM[eventName];}if(!$private.events){return;}return $private.events[eventName];};$private.activateTag=function(tag,eventName){if($private.isTagEnabled(tag)){var timeStampStartExecution=Date.now();tag.module.init(tag.config,tag.name);$private.trackManager.trackCustomObj($private.getExecutionMetrics(timeStampStartExecution,{groups:{tag:tag.name,module:tag.module.nameSpace}}));$private.executedTags.push(tag);$private.dataLayer.setDataLayer(tag.module.nameSpace);}};$private.isTagEnabled=function(tag){if(tag.rules.disable.length>0){if($private.checkRules(tag.rules.disable)){return false;}}if($private.checkRules(tag.rules.enable)){return true;}};$private.calculateTimeSpent=function(initialTime){return Date.now()-initialTime;};$private.getExecutionMetrics=function(startExecutionTime,obj){var metrics={};metrics.groups={};metrics.measures={};var executionTime=$private.calculateTimeSpent(startExecutionTime);metrics.measures.executionTime=executionTime;if(executionTime<0||executionTime>1000){metrics.groups.groupType=2;metrics.measures.OutsideTime=1;}else{metrics.groups.groupType=1;metrics.measures.Execution=1;}for(var key in obj.measures){metrics.measures[key]=obj.measures[key];}for(var key in obj.groups){metrics.groups[key]=obj.groups[key];}return metrics;};$private.checkRules=function(rules){var evalCode=rules.join(" || ");try{var evalResult;if($private.useEvalCache){evalResult=$private.evalCache[evalCode];}else{evalResult=eval(evalCode);}if(evalResult){return true;}}catch(e){return false;}};$public.getExecutedTags=function(){return $private.executedTags;};}function BehaviouralTargeting(){var $private={};var $public=this;$private.validator=new TypeValidator();$private.cookieUtils=new CookieUtils();$private.remoteStorage=new RemoteStorage();$public.getBTCookies=function(){var rtCodes=$private.getMergeCookies();var dntTrack=$public.getDoNotTrack();rtCodes.push(dntTrack);return rtCodes;};$private.getMergeCookies=function(){var BTCookie=$private.getClientsArray($private.cookieUtils.getItem("BT"));var DECookie=$private.getClientsArray($private.cookieUtils.getItem("DEretargeting"));return $private.mergeCookies(BTCookie,DECookie);};$private.getClientsArray=function(cookie){if(!$private.validator.isString(cookie)){return[];}if(cookie.length===0){return[];}var retargeting=cookie.split(";").sort();for(var i=0;i<retargeting.length;i++){var arr=retargeting[0];if(arr===""){retargeting.splice(0,1);}}return retargeting;};$private.mergeCookies=function(deRetar,bt){var retargeting=deRetar.concat(bt).sort();for(var i=0;i<retargeting.length;i++){if(retargeting[i]===retargeting[i+1]){retargeting.splice(i,1);}}return retargeting;};$public.getDoNotTrack=function(){var dntCode="9000";if(!navigator.doNotTrack&&!window.doNotTrack&&!navigator.MsDoNotTrack){dntCode="9000";return dntCode;}if(navigator.doNotTrack==="1"||window.doNotTrack==="1"||navigator.MsDoNotTrack==="1"){dntCode="9001";return dntCode;}if(navigator.doNotTrack==="yes"){dntCode="9003";return dntCode;}return dntCode;};}function DataLayer(){var $private={};var $public=this;$public.logs=new Logs();$public.logs.setPrefix("UOLPD.TagManager");$private.typeValidator=new TypeValidator();$private.remoteStorage=new RemoteStorage();$private.cookieUtils=new CookieUtils();$private.behaviouralTargeting=new BehaviouralTargeting();$public.__constructor=(function(){$private.remoteStorage.get("uolDataLayer",function(key,value){try{window.localStorage.setItem("uolDataLayer",value);}catch(e){}});})();$public.createDataLayer=function(){var namespace=window.UOLPD;if(!$private.typeValidator.isObject(namespace)){window.UOLPD={};}var dataLayer=window.UOLPD.dataLayer;if(!$private.typeValidator.isObject(dataLayer)){window.UOLPD.dataLayer={};}$private.addOrigin();$private.addFocusStatus();$private.addBT();$private.addUOLDNA();};$private.cleanSpecialChars=function(text){return text.replace(/(^https?:\/\/|["'=!+#\*~;^\(\)<>\[\],&\\\/\.\:\-\_\?])+/gm,function(match,offset,string){var isProtocol=(/https?:\/\//g).test(match);var isLastChar=offset===(string.length-1);return(isProtocol||isLastChar)?"":" ";}).replace(/\s{2,}/g," ");};$private.addOrigin=function(){var origin=window.UOLPD.dataLayer.origin||$private.cleanSpecialChars($public.getOrigin());if(origin.slice(-1)===" "){origin=origin.slice(0,-1);}window.UOLPD.dataLayer.origin=origin;};$public.getOrigin=function(){if(!$private.isOnMainPage()){return document.referrer;}return window.location.href;};$private.isOnMainPage=function(){if(window.top!=self){return false;}return true;};$private.addFocusStatus=function(){$private.updateFocus();setInterval(function(){$private.updateFocus();},750);};$private.updateFocus=function(){try{window.UOLPD.dataLayer.hasFocus=window.parent.top.document.hasFocus().toString();}catch(err){$public.logs.error(err.name+": "+err.message);}};$private.sha256=function(message,callback){var msgBuffer=new TextEncoder("utf-8").encode(message);crypto.subtle.digest("SHA-256",msgBuffer).then(callback);};$private.UUID=(function(){var self={};var lut=[];for(var i=0;i<256;i++){lut[i]=(i<16?"0":"")+(i).toString(16);}self.generate=function(){var d0=Math.random()*4294967295|0;var d1=Math.random()*4294967295|0;var d2=Math.random()*4294967295|0;var d3=Math.random()*4294967295|0;return lut[d0&255]+lut[d0>>8&255]+lut[d0>>16&255]+lut[d0>>24&255]+"-"+lut[d1&255]+lut[d1>>8&255]+"-"+lut[d1>>16&15|64]+lut[d1>>24&255]+"-"+lut[d2&63|128]+lut[d2>>8&255]+"-"+lut[d2>>16&255]+lut[d2>>24&255]+lut[d3&255]+lut[d3>>8&255]+lut[d3>>16&255]+lut[d3>>24&255];};return self;})();$private.addUOLDNA=function(){try{var dna=document.cookie.includes("DNA=")?document.cookie.replace(/.*DNA=([^;|]+).*/,"$1"):null;window.UOLPD.dataLayer.UOLDNA=dna;}catch(e){}};$private.addBT=function(){var values=[];if($private.typeValidator.isString(window.UOLPD.dataLayer.bt)){values=window.UOLPD.dataLayer.bt.split(",");}var cookieValues=$private.behaviouralTargeting.getBTCookies();if($private.typeValidator.isArray(cookieValues)){values=$private.mergeArrays(values,cookieValues);}if(values.length>0){window.UOLPD.dataLayer.bt=values.toString();}};$private.mergeArrays=function(dataLayerItems,cookieItems){var finalArray=[];finalArray=$private.addValidItems(dataLayerItems,finalArray);finalArray=$private.addValidItems(cookieItems,finalArray);return finalArray;};$private.addValidItems=function(dataArray,targetArray){if(!$private.typeValidator.isArray(dataArray)){return targetArray;}for(var i=0,length=dataArray.length;i<length;i++){var item=dataArray[i];if(!$private.typeValidator.isString(item)){continue;}if(targetArray.indexOf(item)<0){targetArray.push(item);}}return targetArray;};$public.setDataLayer=function(module){var dataLayer=$private.hasModuleDataLayer(module);if(module==="TailtargetTrack"&&dataLayer===undefined){window.UOLPD.dataLayer["tt_age"]="na";window.UOLPD.dataLayer["tt_cluster"]="na";window.UOLPD.dataLayer["tt_gender"]="na";window.UOLPD.dataLayer["tt_microsegments"]="na";window.UOLPD.dataLayer["tt_socialclass"]="na";window.UOLPD.dataLayer["tt_subjects"]="na";window.UOLPD.dataLayer["tt_team"]="na";}if(!$private.typeValidator.isObject(dataLayer)){return;}for(var key in dataLayer){window.UOLPD.dataLayer[key]=dataLayer[key];$public.logs.debug('Foi adicionado "'+key+" : "+dataLayer[key]+'" à window.UOLPD.dataLayer pelo módulo: '+module);}$private.addBT();};$private.hasModuleDataLayer=function(module){var data={};try{data=JSON.parse(window.localStorage.getItem("uolDataLayer"));}catch(e){}if(!$private.typeValidator.isObject(data)){return;}if(!$private.typeValidator.isString(module)){return;}var dataLayer=data[module];if(!$private.typeValidator.isObject(dataLayer)){return;}return dataLayer;};}function UniqueId(){var $private={};var $public=this;$private.typeValidator=new TypeValidator();$private.remoteStorage=new RemoteStorage();$private.trackManager=new TrackManager();$private.trackManager.setModuleName("core");$private.setUniqueId=function(value){var uniqueId=[],indice=1;if(!$private.typeValidator.isObject(value)||!$private.typeValidator.isString(value.dna)){return;}uniqueId.push(indice+"|"+value.dna);indice=indice+1;var hash=$private.setHash(indice,value.hash);if(hash){uniqueId.push(hash);}if(uniqueId.length>0){window.localStorage.setItem("tt_uid",uniqueId.join(";"));}if(window.localStorage.getItem("tt_uid")&&window.localStorage.getItem("tt_uid").indexOf("{")!==-1){window.localStorage.removeItem("tt_uid");}};$private.setHash=function(indice,hash){if($private.typeValidator.isArray(hash)){var data=[];for(var i=0;i<hash.length;i++){data.push(indice+"|"+hash[i]);indice=indice+1;}return data.join(";");}else{if(window.localStorage.getItem("tt_uid")&&window.localStorage.getItem("tt_uid").split("2|").length>1){var hash=window.localStorage.getItem("tt_uid").split("2|")[1];return"2|"+hash;}}return;};$private.trackUniqueId=function(){$private.metrics={"groups":{"ttUid":"none","cookieDNA":"none","remoteDNA":"none","remoteDnaUid":"none"},"measures":{"Execution":"1"}};var cookieDNA=("; "+document.cookie).split("; DNA=").pop().split(";").shift(),ttUid;try{ttUid=window.localStorage.getItem("tt_uid");}catch(err){}if($private.typeValidator.isString(ttUid)){$private.metrics.groups.ttUid=ttUid;}if($private.typeValidator.isString(cookieDNA)){$private.metrics.groups.cookieDNA=cookieDNA;}$private.remoteStorage.get("DNA",$private.metricsDNA);};$private.metricsDNA=function(key,value){var data;try{data=value||"";}catch(err){data="";}if(data){$private.metrics.groups.remoteDNA=data;}$private.remoteStorage.get("DNA_UID",$private.metricsUniqueId);};$private.metricsUniqueId=function(key,value){var data;try{data=value||"";}catch(err){data="";}if(data){$private.metrics.groups.remoteDnaUid=data;}};$public.__constructor=(function(){$private.remoteStorage.get("UID",function(key,value){try{$private.setUniqueId(JSON.parse(value));}catch(e){}});$private.trackUniqueId();})();}function TMConsole(codRepository,version){var $private={};var $public=this;$public.logger=new Logs();$public.logger.setPrefix("UOLPD.TagManager");$private.typeValidator=new TypeValidator();$private.cookieUtils=new CookieUtils();$private.cookieName="uoltm_version";$public.__constructor=function(codRepository,version){if(!$private.isValidConstructorArguments(codRepository,version)){return;}if($private.hasOtherRepositoryCookie(codRepository)){return;}if(!$private.cookieUtils.getItem($private.cookieName)){$private.cookieUtils.setItem($private.cookieName,codRepository,null,0,0,15);}$private.appendOnDocComplete(codRepository,version);return $public;};$private.appendOnDocComplete=function(codRepository,version){$private.container=$private.createMainContainer(codRepository,version);if(document.readyState==="complete"){document.body.appendChild($private.container);return;}var method=(document.addEventListener)?"readystatechange":"onreadystatechange";var methodListener=(document.addEventListener)?"addEventListener":"attachEvent";document[methodListener](method,function(){if(document.readyState==="complete"){document.body.appendChild($private.container);}});};$private.isValidConstructorArguments=function(codRepository,version){if(!$private.typeValidator.isString(codRepository)){$public.logger.error("O parâmetro fornecido como código do repositório é inválido");return false;}if(!$private.typeValidator.isNumericString(version)){$public.logger.error("O parâmetro fornecido como versão do repositório é inválido");return false;}return true;};$private.hasOtherRepositoryCookie=function(codRepository){var currentCookie=$private.cookieUtils.getItem($private.cookieName);if($private.typeValidator.isString(currentCookie)&¤tCookie!==codRepository){return true;}return false;};$private.createMainContainer=function(codRepository,version){var mainContainer=document.createElement("div");mainContainer.setAttribute("id",codRepository);mainContainer.style.backgroundColor="#fafafa";mainContainer.style.bottom=0;mainContainer.style.display="block";mainContainer.style.height=Math.round(window.innerHeight/3)+"px";mainContainer.style.position="fixed";mainContainer.style.width="100%";mainContainer.style.fontFamily="Verdana, Sans-serif";mainContainer.style.zIndex="99999999999";mainContainer.appendChild($private.createHeaderContainer(codRepository,version));mainContainer.appendChild($private.createLogContainer());return mainContainer;};$private.createHeaderContainer=function(codRepository,version){var headerContainer=document.createElement("div");headerContainer.style.width="100%";headerContainer.style.borderTop="solid 0.5px #aaaaaa";headerContainer.style.color="#757575";headerContainer.style.position="relative";headerContainer.appendChild($private.createLogo());headerContainer.appendChild($private.createRepositoryInfo(codRepository,version));headerContainer.appendChild($private.createCloseButton(codRepository));headerContainer.appendChild($private.createControlButton(codRepository));return headerContainer;};$private.createLogo=function(){var logo=$private.createHeaderSubDivision();logo.appendChild($private.createLogoAnchor());return logo;};$private.createHeaderSubDivision=function(){var headerSubDivision=document.createElement("div");headerSubDivision.style.display="inline-block";headerSubDivision.style.padding="5px";return headerSubDivision;};$private.createLogoAnchor=function(){var anchor=document.createElement("a");anchor.setAttribute("href","//tagmanager.uol.com.br");anchor.style.backgroundImage="url(//imguol.com.br/tag-manager/icons-sprite.png)";anchor.style.backgroundPosition="0 0";anchor.style.backgroundRepeat="no-repeat";anchor.style.width="155px";anchor.style.height="38px";anchor.style.display="block";anchor.style.textIndent="100%";anchor.style.whiteSpace="nowrap";anchor.style.overflow="hidden";anchor.setAttribute("title","Logo do console do UOL Tag Manager");var h1=document.createElement("h1");h1.innerHTML="UOL Tag Manager";anchor.appendChild(h1);return anchor;};$private.createRepositoryInfo=function(codRepository,version){var repositoryInfo=$private.createHeaderSubDivision();var repositoryName=$private.createRepositoryName("ZZ - Filmelier - EX PARCEIRO");codRepository=$private.createHeaderSubText(codRepository);version=$private.createHeaderSubText("Versão "+version);version.style.marginLeft="28px";repositoryInfo.innerHTML=repositoryName.outerHTML+"-"+codRepository.outerHTML+version.outerHTML;repositoryInfo.style.position="absolute";repositoryInfo.style.left=Math.round(window.innerWidth/3)+"px";repositoryInfo.style.marginRight="40px";return repositoryInfo;};$private.createRepositoryName=function(name){var h2=document.createElement("h2");h2.style.margin="0px 5px 0px 0px";h2.style.padding="0px";h2.style.fontWeight="lighter";h2.style.display="inline";h2.style.color="#757575";h2.style.fontSize="27px";h2.innerHTML=name;return h2;};$private.createHeaderSubText=function(innerText){var h4=document.createElement("h4");h4.style.margin="0px 0px 0px 5px";h4.style.padding="0px";h4.style.display="inline";h4.style.fontWeight="lighter";h4.style.color="#757575";h4.style.fontSize="17px";h4.innerHTML=innerText;return h4;};$private.createLogContainer=function(){var logContainer=document.createElement("div");logContainer.style.overflowX="hidden";logContainer.style.overflowY="auto";logContainer.style.height=(Math.round(window.innerHeight/3)-49)+"px";logContainer.setAttribute("class","logContainer");var table=document.createElement("table");table.style.width="100%";table.style.textAlign="left";table.style.borderCollapse="collapse";table.style.marginTop="15px";table.appendChild($private.createThead());table.appendChild($private.createTbody());logContainer.appendChild(table);return logContainer;};$private.createThead=function(){var thead=document.createElement("thead");thead.style.backgroundColor="#FAFAFA";var headers=["","Nome da Tag","Módulo","Mensagem","Tempo de execução"];for(var i=0,length=headers.length;i<length;i++){var th=document.createElement("th");th.style.fontWeight="lighter";th.style.color="#757575";th.style.padding="5px 0px";th.style.fontSize="17px";th.innerHTML=headers[i];thead.appendChild(th);}return thead;};$private.createTbody=function(){var tbody=document.createElement("tbody");tbody.setAttribute("class","log-messages");return tbody;};$private.createCloseButton=function(codRepository){var anchor=document.createElement("a");anchor.style.backgroundImage="url('//imguol.com.br/tag-manager/icons-sprite.png')";anchor.style.backgroundPosition="-102px -49px";anchor.style.backgroundRepeat="no-repeat";anchor.style.height="15px";anchor.style.width="15px";anchor.style.display="inline-block";anchor.style.position="absolute";anchor.style.right="12px";anchor.style.marginTop="14px";anchor.style.cursor="pointer";anchor.setAttribute("title","Fechar o console do UOL Tag Manager");$private.applyEventClosed(anchor,codRepository);return anchor;};$private.applyEventClosed=function(element,codRepository){var methodListener=(document.addEventListener)?"addEventListener":"attachEvent";var nameEvent=(document.addEventListener)?"click":"onclick";element[methodListener](nameEvent,function(e){e.preventDefault();e.stopPropagation();$private.close(codRepository);});};$private.createControlButton=function(codRepository){var ctrlButton=document.createElement("a");ctrlButton.style.backgroundImage="url(//imguol.com.br/tag-manager/icons-sprite.png)";ctrlButton.style.backgroundPosition="-122px -49px";ctrlButton.style.backgroundRepeat="no-repeat";ctrlButton.style.height="25px";ctrlButton.style.width="25px";ctrlButton.style.display="inline-block";ctrlButton.style.position="absolute";ctrlButton.style.right="30px";ctrlButton.style.marginTop="14px";ctrlButton.style.cursor="pointer";ctrlButton.className="maximized";ctrlButton.setAttribute("title","Minimizar o console do UOL Tag Manager");$private.applyEventControlButton(ctrlButton,codRepository);return ctrlButton;};$private.applyEventControlButton=function(element,codRepository){var methodListener=(document.addEventListener)?"addEventListener":"attachEvent";var nameEvent=(document.addEventListener)?"click":"onclick";element[methodListener](nameEvent,function(event){event.preventDefault();event.stopPropagation();$private.controlConsole(event.target,codRepository);});};$private.close=function(codRepository){var mainContainer=document.getElementById(codRepository);if(mainContainer){mainContainer.style.display="none";}document.cookie=$private.cookieName+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";};$private.controlConsole=function(target,codRepository){var className=target.className;var mainContainer=document.getElementById(codRepository);if(!mainContainer){return false;}target.classList.remove(className);if(className==="minimized"){mainContainer.style.height=Math.round(window.innerHeight/3)+"px";target.classList.add("maximized");target.style.backgroundPosition="-122px -49px";target.setAttribute("title","Minimizar o console do UOL Tag Manager");}else{if(className==="maximized"){mainContainer.style.height="50px";target.classList.add("minimized");target.style.backgroundPosition="-78px -49px";target.setAttribute("title","Maximizar o console do UOL Tag Manager");}else{return false;}}};$public.append=function(namTag,namespace,message,executionTime,messageType){var logContainer=$private.getLogContainer();if(!logContainer){return false;}if(!$private.isValidLog(namTag,namespace,message,executionTime,messageType)){return false;}logContainer.appendChild($private.createLogLine(namTag,namespace,message,executionTime,messageType));return true;};$private.createLogLine=function(namTag,namespace,message,executionTime,messageType){var logLine=document.createElement("tr");logLine.style.border="solid 0.5px #AAAAAA";logLine.style.backgroundColor="#FFFFFF";var statusIcon=$private.createLogTd($private.createStatusIcon(messageType));statusIcon.style.padding="10px";logLine.appendChild(statusIcon);logLine.appendChild($private.createLogTd(namTag));logLine.appendChild($private.createLogTd(namespace));logLine.appendChild($private.createLogTd(message));logLine.appendChild($private.createLogTd(executionTime+" ms"));return logLine;};$private.getLogContainer=function(){if(!$private.container){return;}var container=$private.findChildByClass($private.container,"logContainer");var tbody=$private.findChildByClass(container.firstChild,"log-messages");if(!tbody){return;}return tbody;};$private.findChildByClass=function(element,className){if(!element){return;}var childNodes=element.childNodes;for(var i=0,length=childNodes.length;i<length;i++){var classes=childNodes[i].getAttribute("class");if(classes&&classes.indexOf(className)>-1){return childNodes[i];}}return;};$private.isValidLog=function(namTag,namespace,message,executionTime,messageType){if(!$private.typeValidator.isString(namTag)){return false;}if(!$private.typeValidator.isString(namespace)){return false;}if(!$private.typeValidator.isString(message)){return false;}if(!$private.typeValidator.isNumber(executionTime)){return false;}if(!$private.isValidMessageType(messageType)){return false;}return true;};$private.isValidMessageType=function(messageType){if(!$private.typeValidator.isString(messageType)){return false;}messageType=messageType.toLocaleLowerCase();if(messageType==="error"){return true;}if(messageType==="warn"){return true;}if(messageType==="success"){return true;}return false;};$private.createStatusIcon=function(messageType){var i=document.createElement("i");i.style.backgroundImage="url(//imguol.com.br/tag-manager/icons-sprite.png)";i.style.backgroundPosition=$private.getStatusIconPosition(messageType);i.style.width="20px";i.style.height="20px";i.style.display="block";i.style.backgroundRepeat="no-repeat";return i.outerHTML;};$private.getStatusIconPosition=function(messageType){messageType=messageType.toLocaleLowerCase();if(messageType=="success"){return"-55px -49px";}if(messageType=="warn"){return"-26px -49px";}if(messageType=="error"){return"-1px -49px";}};$private.createLogTd=function(innerHTML){var td=document.createElement("td");td.style.fontWeight="lighter";td.style.color="#757575";td.style.fontSize="17px";td.style.padding="10px 0px";td.innerHTML=innerHTML;return td;};return $public.__constructor(codRepository,version);}function TagManager(nameSpace,codRepository,version){var $private={};var $public=this;$public.logs=new Logs();$public.logs.setPrefix("UOLPD.TagManager");$private.validator=new TypeValidator();$private.versionManager=new VersionManager();$public.trackManager=new TrackManager();$public.trackManager.setModuleName("core");$private.tagController=new TagController();$public.queryString=new QueryString();$private.cookieUtils=new CookieUtils();$private.dataLayer=new DataLayer();$private.version="${parent.version}";$private.triggerQueue=[];$public.init=function(tags,distinctEvals){$private.timeStampInit=Date.now();$public.trackManager.trackSuccess("Execucoes Iniciadas");$private.trackExecution();$private.startTMConsole();$private.dataLayer.createDataLayer();$private.tagController.loadEvalCache(distinctEvals);if(!$private.validator.isArray(tags)){return false;}if($private.versionManager.specificVersionWasRequested()){return $private.versionManager.setSpecificVersion();}tags=tags.concat(defaultTags);$private.cloneTriggerQueue();return $private.createModules(tags);};$private.trackExecution=function(){var trackAccounts=["552","553","670","1010"];var repAccount="552";if(trackAccounts.indexOf(repAccount)>=0){$public.trackManager.trackExecution();}};$private.cloneTriggerQueue=function(){var triggerUOLTM=window.triggerUOLTM;if($private.validator.isArray(triggerUOLTM)){while(triggerUOLTM.length){$private.triggerQueue.push(triggerUOLTM.shift());}}window.triggerUOLTM=$private.triggerUOLTM;window.triggerUOLTM.push=$private.pushTrigger;};$private.createModules=function(tags){var result=true;if(tags.length===0){return false;}while(tags.length){$private.tagController.addEvents(tags.shift());}$private.tagController.triggerEvents("autostart");$private.triggerOnDocEvents();$private.updateEvents();$public.trackManager.trackSuccess("Execucoes Finalizadas");var executionTime=$private.calculateTimeSpent();$public.logs.debug("Tempo de execuçao: "+executionTime);$public.trackManager.trackCustomObj($private.getExecutionMetrics(executionTime));return result;};$private.calculateTimeSpent=function(){return Date.now()-$private.timeStampInit;};$private.getExecutionMetrics=function(executionTime){var metrics={};metrics.measures={};metrics.groups={};metrics.measures.executionTime=executionTime;$private.addTime(metrics);return metrics;};$private.addTime=function(metrics){if(metrics.measures.executionTime<0||metrics.measures.executionTime>1000){metrics.measures.OutsideTime=1;metrics.groups.groupType=2;}else{metrics.measures.Execution=1;metrics.groups.groupType=1;}};$private.triggerOnDocEvents=function(){if(document.readyState!=="loading"&&!$private.readyTriggered){$private.tagController.triggerEvents("onready");$private.readyTriggered=true;}if(document.readyState==="complete"){$private.tagController.triggerEvents("onload");return;}document.addEventListener("readystatechange",function(){if(document.readyState==="complete"){$private.tagController.triggerEvents("onload");}if(document.readyState!=="loading"&&!$private.readyTriggered){$private.readyTriggered=true;$private.tagController.triggerEvents("onready");}});};$private.updateEvents=function(){while($private.triggerQueue.length){$private.pushTrigger($private.triggerQueue.shift());}};$private.pushTrigger=function(trigger){if($private.validator.isObject(trigger)){$private.triggerUOLTM(trigger.eventName);return;}$private.triggerUOLTM(trigger);};$private.triggerUOLTM=function(eventType){if(!$private.validator.isString(eventType)){$public.logs.warn("O gatilho solicitado deve ser uma string");return;}if(eventType==="onload"){$public.logs.warn('O gatilho solicitado não pode ser do tipo "onload"');return;}if(eventType==="autostart"){$public.logs.warn('O gatilho solicitado não pode ser do tipo "autostart"');return;}if(eventType==="onready"){$public.logs.warn('O gatilho solicitado não pode ser do tipo "onready"');return;}$private.tagController.triggerEvents(eventType);};$public.tagsHistory=function(tagName){return $private.tagController.getTriggerHistory(tagName);};$private.startTMConsole=function(){var queryString=$public.queryString.getValue("uoltm_console");var repositoryCookie=$private.cookieUtils.getItem("uoltm_version");if(queryString===codRepository||repositoryCookie===codRepository){tmConsole=new TMConsole(codRepository,version);}};}var nameSpace=(new NameSpace()).create();nameSpace["wsywkx"]=nameSpace["wsywkx"]||{};nameSpace["wsywkx"].version="43";var tagManager=new TagManager(nameSpace,"wsywkx","43");nameSpace.trigger=tagManager.trigger;tagManager.init([],[]);})(window,document);