function P(){if(!(typeof window>"u"||window.__wdeftksaOutboundInit)){window.__wdeftksaOutboundInit=!0;try{const i="wdeftksa",d="referral",f="outbound",u="company_url",m=["wdeftksa.com","www.wdeftksa.com","online.wdeftksa.com","cdn.wdeftksa.com"],h=["jobs.sa","apps.apple.com","play.google.com","t.me","wa.me","googlesyndication.com","doubleclick.net","googleadservices.com","g.doubleclick.net"],w=t=>t==="http:"||t==="https:",l=(t,e)=>{const n=(e||"").toLowerCase();if(!n)return!1;for(const s of t){const c=(s||"").toLowerCase();if(c&&(n===c||n.endsWith(`.${c}`)))return!0}return!1},p=t=>l(m,t),y=t=>l(h,t),o=(()=>{try{const t=new URL(window.location.href);if(t.pathname.includes("/company/"))return`${t.origin}${t.pathname}`;const e=document.querySelector('a[href*="/company/"]');if(e&&e.href){const n=new URL(e.href,window.location.href);return`${n.origin}${n.pathname}`}}catch{}return null})(),_=t=>{try{return t.hasAttribute("data-no-utm")}catch{return!1}},g=t=>{try{return t?(t.getAttribute("rel")||"").toLowerCase().includes("sponsored")?!0:!!t.closest(".ad, .ads, .ad-auto, .wdeftksssacat, [data-ad], [data-adslot]"):!1}catch{return!1}},k=t=>{const e=new URL(t,window.location.href);return!w(e.protocol)||p(e.hostname)||y(e.hostname)?null:(e.searchParams.has("utm_source")||e.searchParams.set("utm_source",i),e.searchParams.has("utm_medium")||e.searchParams.set("utm_medium",d),e.searchParams.has("utm_campaign")||e.searchParams.set("utm_campaign",f),o&&!e.searchParams.has(u)&&e.searchParams.set(u,o),e.toString())},L=t=>t.defaultPrevented||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey,r=t=>t&&typeof t.closest=="function"?t.closest("a[href]"):null,b=t=>{try{window.dataLayer=window.dataLayer||[];const e=new URL(t);window.dataLayer.push({event:"click_outbound",link_url:t,link_host:e.hostname,page:window.location.href,company_url:typeof o=="string"?o:"",company_url_attached:!!o})}catch{}},a=(t,e)=>{if(!e||!e.href||_(e)||g(e))return;const n=k(e.href);if(!n)return;const s=(e.getAttribute("target")||"").toLowerCase();if(L(t)){e.href=n;return}t.preventDefault(),b(n),s==="_blank"?window.open(n,"_blank","noopener"):window.location.href=n},A=t=>{const e=r(t.target);e&&a(t,e)},U=t=>{if(t.button!==1)return;const e=r(t.target);e&&a(t,e)},C=t=>{if(t.key!=="Enter")return;const e=r(t.target);e&&a(t,e)};document.addEventListener("click",A,{capture:!0,passive:!1}),document.addEventListener("auxclick",U,{capture:!0,passive:!1}),document.addEventListener("keydown",C,{capture:!0,passive:!0})}catch{}}}P();