;(function(){var Context=function(){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var s=function(){return(s=Object.assign||function(t){for(var e,n=1,o=arguments.length;na[0]&&e[1]")}}return e}(function(t){var e=function(t){var e=[];for(;t;)(t=t.parentNode)&&e.push(t);return e}(t);return e.unshift(t),e}(t))}};function x(t){var e=[];t=t||{};var n=/^(?:string|boolean|number)/i;for(var o in t)t.hasOwnProperty(o)&&n.test(typeof t[o])&&e.push(o+"="+t[o]);return e.join("&")}function C(t,e){var n=RegExp("[?&]"+t+"=([^&]*)").exec(e);return n&&decodeURIComponent(n[1].replace(/\+/g," "))}function L(t){var e=location.search;return C(t,e)||(e=document.referrer),C(t,e)}function E(){return sessionStorage.getItem("_sdk_clickId")?sessionStorage.getItem("_sdk_clickId"):(sessionStorage.setItem("_sdk_clickId",L("clickid")||""),L("clickid"))}var R=0,A=1,M=2,P=(N.prototype.setBridgeState=function(t,e){switch(t){case"adInfo":this.adInfoFlag=e;break;case"appInfo":this.appInfoFlag=e}},N.prototype.callPromise=function(i){return t(this,void 0,void 0,function(){var o,r;return c(this,function(t){switch(t.label){case 0:return[4,(o=this).bridgeLoaded];case 1:return r=t.sent(),this.setBridgeState(i,R),[2,this.retry(function(){return new Promise(function(e,t){var n=setTimeout(function(){o.adInfoFlag!=R&&o.appInfoFlag!=R||t("timeout")},400);r.call(i,{},function(t){o.setBridgeState(i,M),e(t),clearTimeout(n)})})},1)]}})})},N.prototype.retry=function(o,r){void 0===r&&(r=1);var i=this;return new Promise(function(n){o().then(function(t){n(t)},function(){return t(this,void 0,void 0,function(){var e;return c(this,function(t){switch(t.label){case 0:if(1!==r)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),e=n,[4,o()];case 2:return e.apply(void 0,[t.sent()]),[3,4];case 3:return t.sent(),n({}),[3,4];case 4:return[3,6];case 5:n(i.retry(o,r-1)),t.label=6;case 6:return[2]}})})})})},N.prototype.track_event=function(e){return t(this,void 0,void 0,function(){return c(this,function(t){switch(t.label){case 0:return[4,this.bridgeLoaded];case 1:return t.sent().call("track_event",e),[2]}})})},N.prototype.setSession=function(){return t(this,void 0,void 0,function(){var e,n;return c(this,function(t){switch(t.label){case 0:return n=[{}],[4,this.adInfo];case 1:return n=n.concat([t.sent()]),[4,this.appInfo];case 2:return e=s.apply(void 0,n.concat([t.sent()])),w("bridge",JSON.stringify(e)),[2]}})})},N);function N(t){this.adInfoFlag=A,this.appInfoFlag=A,this.bridgeLoaded=function(t){var n=document.createElement("script");n.src=t;var e=new Promise(function(t,e){n.onload=t,n.onerror=e});return document.head.appendChild(n),e}(t).then(function(){return window.ToutiaoJSBridge}),this.adInfo=this.callPromise("adInfo"),this.appInfo=this.callPromise("appInfo"),this.setSession()}function O(){var e,t=b("umeng")||"{}";try{e=JSON.parse(t)}catch(t){e={}}return e}var U=0,D=2,j=1;"{}"!==JSON.stringify(O())&&(j=D);var J=function(){j=U;var t,e=decodeURIComponent(L("_toutiao_params")||L("_toutiao_recommend")||"");try{t=JSON.parse(e)}catch(t){return{}}return j=D,w("umeng",JSON.stringify(t)),t}(),T=j,H=new P("https://s3.pstatp.com/inapp/toutiao.js"),F=0,B=2,V=!o()&&/(UCBrowser|baiduboxapp|baidubrowser|MQQBrowser|QQ|MicroMessenger|Weibo|Opera|Firefox|MSIE|360SE|MetaSr|TheWorld|Firefox|LBBROWSER|Chrome|Safari)(\s|\/|_)(\S)/i.test(navigator.userAgent)?F:B;var $=function(){return t(this,void 0,void 0,function(){var e,n,o,r,i,a;return c(this,function(t){switch(t.label){case 0:return n=[{}],[4,H.adInfo];case 1:return n=n.concat([t.sent()]),[4,H.appInfo];case 2:return e=s.apply(void 0,n.concat([t.sent()])),o=100+10*H.adInfoFlag+H.appInfoFlag,r=1e3+100*H.adInfoFlag+10*T+V,i=s({},k(),O(),J,function(){var e,t=b("bridge")||"{}";try{e=JSON.parse(t)}catch(t){e={}}return e}(),e),a=JSON.parse(i.log_extra||"{}"),[2,{value:i.cid||"",log_extra:i.log_extra||"",req_id:i.req_id||a.req_id||"",cid:i.cid||"",ad_id:i.ad_id||L("_tt_ad_id")||L("ad_id")||"",device_id:i.device_id||"",user_id:i.user_id||"",uid:i.uid||"",ut:i.ut||"",app_version:i.appVersion||"",version_code:i.version_code||"",app_id:i.aid||"",os:u(),page_url:i.page_url,page_type:i.page_type,site_id:i.site_id,tt_bridge:o,tt_env:r,ad_extra_data:JSON.stringify({clickid:E()})}]}})})};q.prototype.handleLog=function(t,e){return{log:t,context:e}};function q(){}Q.prototype.handleLog=function(t,e){try{var n=s({},e,t,{source:"webunion"});navigator.sendBeacon(this.API_URL,JSON.stringify(n))}catch(t){}};function Q(t){this.API_URL=t}W.prototype.handleLog=function(){};function W(){}var X=(Y.prototype.handleLog=function(t,e){var n="bytedance://"+(h.test(d)||m()||r()||i()?"log_event":"custom_event")+"?";this.isRealtimeReport(e.app_version)&&(n+="&realtime_report=1"),"ios"===u()?n+=this.formatData(s({},e,t)):n+=this.formatData(this.androidData(s({},e,t)));try{window.webkit.messageHandlers.observe.postMessage(n)}catch(t){console.log(n)}if(this.isVideoArticleCompatible(e.app_version))try{window.webkit.messageHandlers.consoleLog.postMessage(n)}catch(t){}},Y.prototype.isVideoArticleCompatible=function(t){var e=!1;try{e=_.test(d)&&"ios"==u()&&parseInt(t.replace(/\./g,""))<=794&&779<=parseInt(t.replace(/\./g,""))}catch(t){}return e},Y.prototype.formatData=function(t){var e="";for(var n in t)"object"==typeof t[n]?e+="&"+n+"="+encodeURIComponent(JSON.stringify(t[n])):e+="&"+n+"="+encodeURIComponent(t[n]);return e},Y.prototype.androidData=function(t){return{category:t.category,tag:t.tag,label:t.label,value:t.cid,extra:t}},Y.prototype.isRealtimeReport=function(t){return"6.6.7"===t},Y);function Y(){}G.prototype.handleLog=function(t,e){var n=function(t,e){return{convert_id:t.convert_id||0,event_type:t.event_type||"",log_extra:e.log_extra,os:e.os,page_url:location.href,page_type:e.page_type}}(t,e),o=s({track_data:encodeURIComponent(JSON.stringify([n]))},e),r=this.API_URL+"?"+x(o);try{(new Image).src=window.location.protocol+r+"&t="+new Date}catch(t){}};function G(t){this.API_URL=t}var z=(K.prototype.isSuperCompatible=function(t,e){var n=!1;try{n="1319"==e&&"android"==u()&&parseInt(t.replace(/\./g,""))<=274&&244<=parseInt(t.replace(/\./g,""))}catch(t){}return n},K.prototype.handleLog=function(t,e){var n="bytedance://log_event?",o=s({},e,t);for(var r in o)"object"==typeof o[r]?n+="&"+r+"="+encodeURIComponent(JSON.stringify(o[r])):n+="&"+r+"="+encodeURIComponent(o[r]);try{window.webkit.messageHandlers.observe.postMessage(n)}catch(t){console.log(n)}if(this.isSuperCompatible(e.app_version,e.app_id)){var i=document.createElement("iframe");i.style.width="1px",i.style.height="1px",i.style.display="none",i.style.position="absolute",i.src=n,document.documentElement.appendChild(i),setTimeout(function(){document.documentElement.removeChild(i)},100)}},K);function K(){}var Z=(tt.prototype.handleLog=function(t,e){var n=function(t,e){return{convert_id:t.convert_id||0,event_type:t.event_type||"",log_extra:e.log_extra,os:e.os,page_url:location.href,page_type:e.page_type,xpath:t.xpath||"",select_content:t.select_content||"",event_value:t.event_value||""}}(t,e),o=s({track_data:encodeURIComponent(JSON.stringify([n]))},e),r=this.API_URL+"?"+x(o);try{!function t(e,n){var o=n||0,r=new XMLHttpRequest;r.open("GET",e.url,!1),r.withCredentials=!0,r.onreadystatechange=function(){4===r.readyState&&200!==r.status&&o<1&&t(e,++o)},r.send(null)}({url:r+"&t="+new Date})}catch(t){}},tt);function tt(t){this.API_URL=t}var et={category:"umeng",tag:"embeded_ad",label:"convert"},nt={sdk_version:"0.0.1"},ot=(rt.prototype.handleLog=function(t,e){if(t=s({},nt,t),o()&&!this.isAwemeCompatible(e.app_version)&&!this.isLiveCompatible(e.app_version)||(t.select_content&&(t.select_content=encodeURIComponent(t.select_content)),this.httpHandler.handleLog(t,e)),o())return t=s({},et,t),y.test(d)?this.iframeHandler.handleLog(t,e):this.consoleHandler.handleLog(t,e)},rt.prototype.isAwemeCompatible=function(t){var e=!1;try{e=i()&&"ios"==u()&&parseInt(t.replace(/\./g,""))<182}catch(t){}return e},rt.prototype.isLiveCompatible=function(t){var e=!1;try{e=r()&&"ios"==u()&&parseInt(t.replace(/\./g,""))<420}catch(t){}return e},rt);function rt(){this.httpHandler=new Z("https://isub.snssdk.com/2/wap/landing_tetris_log/"),this.iframeHandler=new z,this.consoleHandler=new X}var it,at,st=["","webkit","Moz","MS","ms","o"],ct=window,ut=void 0!==function(t,e){var n,o,r=e[0].toUpperCase()+e.slice(1),i=0;for(;i -1 var isUnion = /(open_news)(\s|\/|_)(\S)/i.test(navigator.userAgent) if (!isTetris && isUnion) { !function() { var script = document.createElement('script') script.async = !0 script.src = 'https://s3.pstatp.com/bytecom/resource/tetris/h5-insight-sdk-1.2.0.iife.js' var r = document.getElementsByTagName('script')[0] r.parentNode.insertBefore(script, r) }(); } } })();