"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,t)=>{for(var n in t||(t={}))r.call(t,n)&&a(e,n,t[n]);if(o)for(var n of o(t))i.call(t,n)&&a(e,n,t[n]);return e},l=(e,t,n)=>new Promise(((o,r)=>{var i=e=>{try{s(n.next(e))}catch(e){r(e)}},a=e=>{try{s(n.throw(e))}catch(e){r(e)}},s=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,a);s((n=n.apply(e,t)).next())}));!function(){const e=String.fromCharCode(98,121,98,105,116),o=String.fromCharCode(66,89,66,73,84);let r="prod";window.location.host.includes("testnet")&&(r="testnet");const i=()=>!(!window.TelegramWebviewProxy&&!window.devTG),a=e=>{try{const t=window?.sensors?.getChannelInfo?.(r);t&&e&&(t.oneLink=!0),window.sensors.track("web_guide_download",{web_channel_attribution:JSON.stringify(t)})}catch(e){}};document.addEventListener("click",(e=>{const t=e.target,n=t?.nodeName;"BUTTON"===n&&"af-creatives-text"===t.dataset?.afCustomFonts&&a()}));const d=document.createElement("link");d.setAttribute("rel","stylesheet"),d.href="/common-static/cht-static/user-svc/js/by_appsflyer_23c876d.css",document.head.append(d);const c=["lang","affiliate_id","group_id","group_type","ref","utm_url","utm_date","medium","source","campaign","content","referrer","srcexid","scrplatform","url"],p=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,u=/android|ipad|playbook|silk/i;const f=(e,t)=>{let n={af_force_deeplink:!0,is_retargeting:!0};if(e&&0===e.indexOf("by")&&(n.af_dp=e),t){let t=(()=>{const e=`REG_REF_${(()=>{const{host:e}=window.location;let t="prod";return e.includes("testnet")?t="testnet":e.includes("-test")?t="test":e.includes("-dev")?t="dev":e.includes("local")&&(t="local"),t})()}`,t=document.cookie.split("; ");let n={};return t.forEach((t=>{if(0===t.indexOf(e+"=")){const[o,r]=t.split(e+"=");n=JSON.parse(r)}})),n})(),o="";const{source:r,medium:i}=t;let{lang:a}=t;"zh-CN"===a&&(a="zh-MY"),r&&(n.af_campaign=r),i&&(n.af_adgroup=i),a&&(n.af_creative=a),Object.keys(t).forEach((e=>{c.includes(e)&&(o+="url"===e?`&${e}=${encodeURIComponent(t[e])}`:`&${e}=${t[e]}`)})),e&&"string"==typeof e&&(e.indexOf("?")>0?e+=o:e+="?"+o.substring(1),n.af_dp=encodeURIComponent(e))}else e&&(n.af_dp=encodeURIComponent(e));return i()&&(n.af_force_deeplink=!1),n.af_dp||delete n.af_dp,n},m=(()=>{const t=window.location.hostname;return t.includes(`${e}.kz`)?"KAZ":t.includes(`${e}.id`)?"IDN":t.includes(`${e}-tr.com`)||t.includes(`${e}.tr`)?"TUR":/^[^.]+\.[^.]+\.[^.]+\.hk$/.test(t)||/^[^.]+\.[^.]+\.[^.]+\.[^.]+\.hk$/.test(t)||(null==t?void 0:t.includes("byhkbit.com"))?"HKG":/^[^.]+\.[^.]+\.ae$/.test(t)||/^[^.]+\.[^.]+\.[^.]+\.ae$/.test(t)?"ARE":/^[^.]+\.[^.]+\.nl$/.test(t)||/^[^.]+\.[^.]+\.[^.]+\.nl$/.test(t)?"NLD":t.includes(`${e}.eu`)?"EU":o})(),y=(t,n)=>l(this,null,(function*(){let o=f(t,n);const r=Object.keys(o).map((e=>({paramKey:e,defaultValue:o[e]})));r.push({paramKey:["deep_link_value"],defaultValue:o.af_dp||t});const i={TUR:`https://${e}tr.onelink.me/6qAW`,EU:`https://${e}-eu.onelink.me/zD7L`,IDN:`https://${e}-idn.onelink.me/v5vJ`,default:`https://${e}.onelink.me/EhY6`};var a=window.AF_SMART_SCRIPT.generateOneLinkURL({oneLinkURL:i[m]||i.default,afParameters:{mediaSource:{keys:["utm_source"],defaultValue:"ss_default"},channel:{keys:["af_channel"],defaultValue:o.af_campaign},afCustom:r}});let s="No output from script";return a&&(s=a.clickURL),s}));let w=0,g=!1;window.byAppsFlyers={showSmartBanner:(o,r=!0,a)=>l(this,null,(function*(){if("TUR"===m?"string"==typeof o&&(o=o.replace(`${e}app`,`${e}-tr`)):"EU"===m?"string"==typeof o&&(o=o.replaceAll(`${e}app`,`${e}-eu`)):"IDN"===m&&"string"==typeof o&&(o=o.replaceAll(`${e}app`,`${e}-idn`)),("undefined"==typeof window||"undefined"==typeof navigator||!new RegExp(`${e}_app`,"i").test(navigator.userAgent))&&function(e){e||(e={});let t=e.ua;if(t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"!=typeof t)return!1;let n=p.test(t)||!!e.tablet&&u.test(t);return!n&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==t.indexOf("Macintosh")&&-1!==t.indexOf("Safari")&&(n=!0),n}({tablet:!0,featureDetect:!0})){if(!(window.AF_SDK?.PLUGINS?.BANNERS&&"function"==typeof window.AF_SDK.PLUGINS.BANNERS.showBanner)){if(g)return void console.warn("[appsflyer-smartbanner] Retry already in progress, skipping duplicate call");if(w<3){w++,g=!0;const e=100*Math.pow(2,w);if("undefined"!=typeof window&&window.Monitor&&"function"==typeof window.Monitor.log)try{window.Monitor.log({t:"APPSFLYER_SHOW_SMART_BANNER_RETRY",ext:{reason:"BANNER_PLUGIN_NOT_LOADED",retry_attempt:w,retry_delay_ms:e}})}catch(e){console.error("[appsflyer-smartbanner] Monitor.log failed:",e)}return void setTimeout((()=>{g=!1,window.byAppsFlyers.showSmartBanner(o,r,a)}),e)}if("undefined"!=typeof window&&window.Monitor&&"function"==typeof window.Monitor.log)try{window.Monitor.log({t:"APPSFLYER_SHOW_SMART_BANNER_ERROR",ext:{reason:"BANNER_PLUGIN_NOT_LOADED"}})}catch(e){console.error("[appsflyer-smartbanner] Monitor.log failed:",e)}return w=0,void(g=!1)}let l,d;w=0,g=!1;let c=(()=>{const t=window.location.pathname;let n;const o=(()=>{let e=window.location.search;if(0===e.length)return{};e=e.substring(1);const t=e.split("&"),n={};return t.forEach((e=>{const[t,o]=e.split("=");n[t]=o})),n})();return t.includes("/VIPProgram/intro")||t.includes("/VIPProgram")||t.includes("/my-fee-rate")?n=`${e}app://open/route?targetUrl=`+encodeURIComponent("by-mini://vip/home?jumpToForm=0"):t.includes("/leaderboard")?n=`${e}app://open/route?targetUrl=`+encodeURIComponent("by-mini://leaderboard/home"):t.includes("/userprofile")&&(n=`${e}app://open/route?targetUrl=`+encodeURIComponent(`by-mini://leaderboard/home?hashId=${o.id}`)),n})();c&&(o=c);let p=f(o,r);const u=(l=s({},p),d={deep_link_value:p.af_dp||o},t(l,n(d)));if(i()&&(u.af_force_deeplink=!1),window.AF("banners","showBanner",{additionalParams:u}),a){const e=document.createElement("style");e.textContent='\n .responsive-wrapper {\n top: initial !important;\n bottom: 0;\n z-index: 9998 !important;\n }\n body > div[style="height: 64px;"]:not([class]):not([id]):empty {\n display: none;\n }\n ',document.head.appendChild(e)}const m=setInterval((()=>{const e=document.querySelector(".responsive-wrapper");if(e){if(e.style.zIndex=1e4,clearInterval(m),!a)return;let t,n=e?.previousElementSibling;for(console.info(n,"----- 前一个 dom 节点 ----");n;){const e=!n.innerHTML.trim();if("DIV"===n.tagName&&"64px"===n.style.height&&e){t=n;break}n=n.previousElementSibling}if(console.info(t,"----- 64px 指定的节点 ----"),t){const e=document.querySelector(".by-footer-large-cr");e&&(e.style.marginBottom="64px")}const o=e=>{e.target.closest('[data-qa-id="close-button"]')&&(document.querySelector(".by-footer-large-cr").style.marginBottom="0px",console.log("关闭按钮被点击了"),document.body.removeEventListener("click",o))};document.body.addEventListener("click",o)}}),1e3);return!0}})),getOneLink:(t=`${e}app://open/home?tab=0`,n=!0)=>l(this,null,(function*(){if("KAZ"!==m&&"HKG"!==m)return"TUR"===m?"string"==typeof t&&(t=t.replaceAll(`${e}app`,`${e}-tr`)):"EU"===m?"string"==typeof t&&(t=t.replaceAll(`${e}app`,`${e}-eu`)):"IDN"===m&&"string"==typeof t&&(t=t.replaceAll(`${e}app`,`${e}-idn`)),window.AF_SMART_SCRIPT?yield y(t,n):new Promise((e=>{const o=document.createElement("script");o.src="/common-static/cht-static/user-svc/js/appsflyer_onelink.js",document.body.appendChild(o),window.appsFlyerLoaded=!0,o.addEventListener("load",(()=>l(this,null,(function*(){a("onelink");const o=yield window.byAppsFlyers.getOneLink(t,n);e(o)}))))}))})),triggerOneLink:(t=`${e}app://open/home?tab=0`,n=!0)=>{if("KAZ"!==m&&"HKG"!==m)return new Promise((e=>{window.byAppsFlyers.getOneLink(t,n).then((t=>{const n=document.createElement("a");n.style.display="none",n.setAttribute("href",t),document.body.appendChild(n),a?.(),n.click(),document.body.removeChild(n),e(t)}))}))}}}();