1const y=["test","test test","tra admin","funding applicant","applicant","demo","sample","john doe","jane doe","first last"],C=["11-1111111","22-2222222","12-3456789","00-0000000"],L=["1111111111","2222222222","5555555555","1234567890","0000000000"],o=e=>String(e||"").trim().toLowerCase(),u=e=>String(e||"").replace(/\D/g,"");function D(e,a){if(!e||!a)return 0;if(e===a)return 1;const t=new Set(e.split("")),n=new Set(a.split("")),i=new Set([...t].filter(c=>n.has(c))).size,s=new Set([...t,...n]).size;return s===0?0:i/s}function w(e){return/^(\d)\1+$/.test(e)}function A(e,a){if(!e)return{flagged:!1,level:"none",score:0,reasons:[]};const t=[];let n=0;const i=o(e.contact_email),s=u(e.phone),c=o(e.contact_name),l=o(e.company_name),r=o(e.ein);if(a){const m=o(a.email),g=u(a.phone),E=o(a.full_name),_=o(a.company);if(i&&m&&i===m)n+=50,t.push("Applicant email matches referring partner exactly");else if(i&&m){const[f,h]=i.split("@"),[P,S]=m.split("@");h&&S&&h===S&&(n+=10,t.push(`Same email domain as partner (@${h})`),f&&P&&D(f,P)>.6&&(n+=10,t.push("Email local-part similar to partner")))}s&&g&&s.length>=10&&s===g&&(n+=25,t.push("Phone matches referring partner")),c&&E&&c===E&&(n+=20,t.push("Contact name matches partner name")),l&&_&&l===_&&(n+=15,t.push("Company name matches partner company"));try{e.created_at&&a.created_at&&Math.abs(new Date(e.created_at).getTime()-new Date(a.created_at).getTime())/6e4<10&&(n+=10,t.push("Lead created within 10 minutes of partner registration"))}catch{}}s.length>=10&&(w(s)||L.includes(s))&&(n+=20,t.push(`Placeholder phone (${s})`)),r&&(C.includes(r)||w(u(r)))&&(n+=20,t.push(`Placeholder EIN (${r})`)),c&&y.includes(c)&&(n+=15,t.push(`Placeholder contact name ("${e.contact_name}")`)),l&&y.includes(l)&&(n+=15,t.push(`Placeholder company name ("${e.company_name}")`)),(i.includes("+test")||i.startsWith("test@")||i.includes("@example."))&&(n+=15,t.push("Email contains test marker"));const p=Math.min(100,n),d=p>=60?"strong":p>=30?"warn":"none";return{flagged:d!=="none",level:d,score:p,reasons:t}}export{A as detectTestClaim};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.