!function(){"use strict";function e(e){return!(!e||!(e.countryCodeMap||e.pageHostMap||e.advancePageHostMap||e.advanceCountryCodeMap))}function o(){if("1"==localStorage.getItem("openDebugMode")){var e=Array.prototype.slice.call(arguments),o=["%c debugLog-common-config ","border:1px solid red;color: blue; font-weight: bold;"];console.log.apply(this,o.concat(e))}}-1!=location.href.indexOf("openDebugMode=1")?localStorage.setItem("openDebugMode","1"):-1!=location.href.indexOf("openDebugMode=0")&&localStorage.removeItem("openDebugMode");var n="_remote_xhr_replace_conf_tk2_";function t(t,r,i){if(!(!1 in window)&&"function"==typeof window.XMLHttpRequest){"function"!=typeof r&&(r=function(){}),"function"!=typeof i&&(i=function(){}),t=t||"";var a=new XMLHttpRequest;a.open("GET",t,!0),a.onreadystatechange=function(){if(o("xhr.readyState",a.readyState),o("xhr.status",a.status),4===a.readyState)if(200===a.status){var t,c=a.responseText;try{"string"==typeof c&&(t=JSON.parse(c)),e(t)?(!function(e){(e=e||{}).extraOptions=e.extraOptions||{},e.extraOptions.lastFetchTimestamp=Date.now(),e.extraOptions.expireSeconds=Number(e.extraOptions.expireSeconds)||600,e.extraOptions.expireSeconds>3600&&(e.extraOptions.expireSeconds=3600),window.localStorage.setItem(n,JSON.stringify(e))}(t),r(c)):i(c)}catch(e){i(e)}}else i("respError")},a.onerror=function(){o("请求onerror",t),i("onerror")},a.timeout=1e4,a.ontimeout=function(){o("请求ontimeout",t),i("ontimeout")},a.send()}}function r(){var e={};try{e=window.localStorage.getItem(n)||"{}",e=JSON.parse(e)}catch(e){}return e}function i(e,n){var i=(r()||{}).extraOptions||{},a=Number(i.lastFetchTimestamp)||0,c=Number(i.expireSeconds)||600,s=Date.now(),p=function(){var e=["/live/transparent_cdn/HostConf_TK2.json","https://static-act.tiki.sg/live/transparent_cdn/HostConf_TK2.json","https://d2eijw1m1il1j2.cloudfront.net/live/transparent_cdn/HostConf_TK2.json","https://d1yff9iowhnuqg.cloudfront.net/live/transparent_cdn/HostConf_TK2.json","https://static-act.tiki.run/live/transparent_cdn/HostConf_TK2.json"],r="_remote_xhr_available_url_tk2_";e=function(e,o){var n=e.indexOf(o);if(n>-1){var t=e.splice(n);e=t.concat(e)}return e}(e,localStorage.getItem(r)),o("拉取配置顺序",JSON.stringify(e));var i=0;!function o(){if(i-1?"&":"?",c+d+p),(function(){localStorage.setItem(r,a)}),(function(){i+=1,o()}))}else"function"==typeof n&&n();var c,p,d}()};c>3600&&(c=3600),(c<0||e||(s-a)/1e3>=c)&&p()}window.initFetchXhrConfig=i;var a=(r()||{}).extraOptions||{},c=Number(a.delayFetchSeconds)||0;setTimeout((function(){i(!1,(function(){o("遍历执行完毕")}))}),1e3*c);var s={countryCodeMap:{},pageHostMap:{},extraOptions:{lastFetchTimestamp:0,expireSeconds:600,delayFetchSeconds:1,perfConfig:{sampleRate:.2},sentryConfig:{}}};function p(e,o){for(var n in o)o.hasOwnProperty(n)&&(o[n]instanceof Object&&n in e?p(e[n],o[n]):e[n]=o[n]);return e}function d(){var e=r(),o=p(s,e),n=p(o,window.$_XHR_REPLACE_OPTIONS||{});return window.$_FinalXhrReplaceConf=n,n}window.getFinalXhrReplaceConf=d;var u=d(),f=u&&u.extraOptions&&u.extraOptions.sentryConfig||{},l=Object.assign({},{categoryMap:{request:"request"},tagMap:{actName:"act.name",actDeveloper:"act.developer"},maxBreadcrumbs:50,sampleRate:.3,autoCategoryRule:{},ignoreEventRule:[/vid_mate_check is not defined/],ignoreBreadcrumbRule:[],changeEvent:function(e){return e}},f);o("【sentry】finalSentryConf:",l);var m=d(),v=m&&m.extraOptions&&m.extraOptions.perfConfig||{},w=Object.assign({},{sampleRate:.05,costTimeLimit:2e4,api:"https://front-perf.like-video.com/api/call",reportWaitMilliseconds:2e3},{sampleRate:.2},v);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}o("【perf】finalPerfConfig:",w);var y=function(){try{var e=navigator.userAgent,o=(e=(e=e.replace("__nimbus","")).replace("__webkit","")).match(/BIGO-baiguoyuan \((.+)\)/i);if(o){var n=o[1],t={},r=n.split("__");return["phoneName","appName","appVersion","sysName","sysVersion","appEnv","deviceid","userid","appVersionCode","countryCode"].forEach((function(e,o){t[e]=r[o]})),t}return{}}catch(e){return{}}}().countryCode;function _(e,n){var t=n&&n.customCountryCode||y,r=/^(http:\/\/|https:\/\/|wss:\/\/|\/\/)([a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?)/.exec(e),i=r&&r[2];if(!i)return e;var a=d();function c(e){var o="";return"string"==typeof e?o=e:"object"===g(e)&&(o=navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)&&e.ios?e.ios:(navigator.userAgent.indexOf("Android")>-1||navigator.userAgent.indexOf("Adr")>-1)&&e.android?e.android:e.other),o}var s,p,u=!1,f=!1,l=function(){var o=(a.advanceCountryCodeMap||{})[i]||{};if("string"==typeof o)return e.replace(i,o);if("object"===g(o)){var n=c(o[t])||c(o.other);if(n)return e.replace(i,n)}return""}(),m=function(){var o=(a.advancePageHostMap||{})[i]||{},n=location.host,t="";if("string"==typeof o?t=o:"object"===g(o)&&(t=c(o[n])||c(o.other)),t){if(0===t.indexOf("/")){var r=new RegExp("^(http://|https://|wss://|//)".concat(i),"");return u=!0,e.replace(r,t)}return e.replace(i,t)}return""}(),v=(s=(a.countryCodeMap||{})[i]||{},p="","string"==typeof s&&(p=s),"object"===g(s)&&(p=s[t]||s.other),p?e.replace(i,p):""),w=function(){var o,n=(a.pageHostMap||{})[i]||{},t=location&&location.host;if("string"==typeof n&&(o=n),"object"===g(n)&&(o=n[t]||n.other),o){if(0===o.indexOf("/")){var r=new RegExp("^(http://|https://|wss://|//)".concat(i),"");return f=!0,e.replace(r,o)}return e.replace(i,o)}return""}(),_="";return _=t?u?m||e:f?w||e:l||m||v||w||e:m||w||e,o("=============== 【begin doBlockHostReplace】 ================"),o("【originApiUrl】",e),o("【finalApiUrlFromAdvanceCCmap】",l),o("【finalApiUrlFromAdvanceHostMap】",m),o("【finalApiUrlFromCCMap】",v),o("【finalApiUrlFromHostMap】",w),o("【finalUrl】",_),o("=============== 【endof doBlockHostReplace】 ================"),_}function h(o,n,t){var r=o,i=n;if(t=t||{},e(d())){var a=(n||"")+o;n&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(o)?i=_(n,t):r=_(o,t);var c=(i||"")+r;a!==c&&(console.info("替换前",a,"extraParams: ",JSON.stringify(t)),console.info("替换后",c))}return{url:r,baseURL:i}}window.doBlockHostReplace=h,"XMLHttpRequest"in window&&function(e,o,n){if(o in e){var t=n(e[o]);if("function"==typeof t)try{t.prototype=t.prototype||{}}catch(e){}e[o]=t}}(XMLHttpRequest.prototype,"open",(function(e){return function(){for(var o=arguments.length,n=new Array(o),t=0;t0)for(var r=0;r-1||i.src.indexOf("common_vendor")>-1)&&(i.onload=function(){n(2)},i.addEventListener("load",(function(){n(2)})))}}))}))).observe(document,{childList:!0,subtree:!0})}catch(e){console.error("【commonVendorObserver】",e)}}(),setTimeout((function(){void 0!==e&&e.disconnect&&e.disconnect()}),2e4))}(),window.$_SENTRY_OPTIONS=l,window.$_PERF_OPTIONS=w;var O=h(w&&w.api||"");O&&O.url&&(window.$_JSSDK_OPTIONS=window.$_JSSDK_OPTIONS||{},window.$_JSSDK_OPTIONS.api=O.url,window.$_PERF_OPTIONS=window.$_PERF_OPTIONS||{},window.$_PERF_OPTIONS.api=O.url)}();