(function($){$(document).on('change','table tr input[type="checkbox"][data-nondedup]',function(){if(!this.checked)return;var $row=$(this).closest('tr');$row.find('input[type="checkbox"][data-nondedup]').not(this).prop('checked',false);});})(jQuery);(function($){function isGoogleAdminPage(){return $('.UniPixelShell[data-platform="google"]').length>0;}
function getEventNameFromRow($row){return String($row.find('input[name="event_name[]"]').val()||'').trim();}
function shouldBeNonDedup($row){if(!isGoogleAdminPage())return false;const name=getEventNameFromRow($row).toLowerCase();return name!=='purchase';}
function syncNonDedupForCustomRow($row){const $pair=$row.find('input[name="send_client[]"], input[name="send_server[]"]');if($pair.length===0)return;if(shouldBeNonDedup($row)){$pair.attr('data-nondedup','');}else{$pair.removeAttr('data-nondedup');}}
function tagExistingCustomRows(){if(!isGoogleAdminPage())return;$('#event-settings-table tbody tr').each(function(){syncNonDedupForCustomRow($(this));});}
function bindCustomNameChange(){$(document).on('input change','#event-settings-table tbody input[name="event_name[]"]',function(){if(!isGoogleAdminPage())return;syncNonDedupForCustomRow($(this).closest('tr'));});}
function observeCustomTable(){if(!isGoogleAdminPage())return;const tbody=document.querySelector('#event-settings-table tbody');if(!tbody)return;new MutationObserver(function(mutations){mutations.forEach(function(m){$(m.addedNodes).filter('tr').each(function(){syncNonDedupForCustomRow($(this));});$(m.addedNodes).find('tr').each(function(){syncNonDedupForCustomRow($(this));});});}).observe(tbody,{childList:true,subtree:true});}
tagExistingCustomRows();bindCustomNameChange();observeCustomTable();document.addEventListener('DOMContentLoaded',function(){const triggers=document.querySelectorAll('[data-bs-toggle="popover"]');const HIDE_DELAY=250;triggers.forEach(el=>{const pop=new bootstrap.Popover(el,{trigger:'manual',html:true,container:'body',customClass:'UniPixelPopover'});let hideTimeout;const cancelHide=()=>clearTimeout(hideTimeout);const scheduleHide=()=>{clearTimeout(hideTimeout);hideTimeout=setTimeout(()=>pop.hide(),HIDE_DELAY);};el.addEventListener('shown.bs.popover',()=>{const tip=pop.tip||pop._popover||document.querySelector('.popover.UniPixelPopover');if(!tip)return;tip.addEventListener('mouseenter',cancelHide);tip.addEventListener('mouseleave',scheduleHide);});el.addEventListener('mouseenter',()=>{cancelHide();pop.show();});el.addEventListener('mouseleave',scheduleHide);});});})(jQuery);