(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"]');triggers.forEach(el=>{const pop=new bootstrap.Popover(el,{trigger:'manual',html:true,container:'body',customClass:'UniPixelPopover'});let hideTimeout;el.addEventListener('mouseenter',()=>{clearTimeout(hideTimeout);pop.show();const popEl=bootstrap.Popover.getInstance(el)._popover||document.querySelector('.popover');if(popEl){popEl.addEventListener('mouseenter',()=>clearTimeout(hideTimeout));popEl.addEventListener('mouseleave',()=>{hideTimeout=setTimeout(()=>pop.hide(),50);});}});el.addEventListener('mouseleave',()=>{hideTimeout=setTimeout(()=>pop.hide(),50);});});});})(jQuery);