/.test(t)?t:e.get("_subid")||e.get("subid")||getCookie("subid")||getCookie("_subid")||null}function getToken(){var e=new URLSearchParams(window.location.search);if(!"{token}".match("{"))return"{token}";var t="getToken() : "" ?>";return t&&!/>/.test(t)?t:e.get("_token")||e.get("token")||getCookie("token")||null}function getPixel(){var e=new URLSearchParams(window.location.search);return"{pixel}".match("{")?e.get("pixel")||getCookie("pixel")||null:"{pixel}"}function sendPostback(e,t,n,o=0,a="",r="",i=""){var c="POSTBACK_URL/postback?subid="+(getSubId()||"")+"&status="+n+"&payout="+o+"&tid="+a+"&sub_id_1="+r+"&sub_id_2="+i,u=e.getAttribute("href");t.preventDefault(),fetch(c).then((e=>{e.ok?console.log("Postback отправлен успешно"):console.error("Ошибка при отправке postback"),u&&(window.location.href=u)})).catch((e=>{console.error("Ошибка при отправке запроса:",e),u&&(window.location.href=u)}))}document.addEventListener("DOMContentLoaded",(function(){var e=new URLSearchParams(window.location.search),t=getSubId(),n=getToken(),o=getPixel();e.set("_token",n),setCookie("pixel",o),setCookie("token",n),setCookie("subid",t),document.querySelectorAll("a").forEach((function(t){try{var n=new URL(t.href);e.forEach((function(e,t){n.searchParams.append(t,e)})),t.href=n.toString()}catch(e){console.error(`[Exception] Bad params: unexpected link '${t.href}' for new Url()`)}}));var a=new RegExp("{subid}","g"),r=new RegExp("{token}","g"),i=new RegExp("{pixel}","g");document.querySelectorAll('input[type="hidden"]').forEach((function(e){a.test(e.value)&&(e.value=e.value.replaceAll(a,t)),r.test(e.value)&&(e.value=e.value.replaceAll(r,n)),i.test(e.value)&&(e.value=e.value.replaceAll(i,o))})),document.querySelectorAll("form").forEach((function(t){e.forEach((function(e,n){var o=document.createElement("input");o.type="hidden",o.name=n,o.value=e,t.append(o)}))}))}))