@nodatachat/mcp 1.6.3 → 1.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /*! @nodatachat/mcp 1.6.3 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
1
+ /*! @nodatachat/mcp 1.6.7 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
2
2
  import{createRequire as __ndReq}from"node:module";const require=__ndReq(import.meta.url);
3
3
  import{parentPort as xt}from"node:worker_threads";import{createHash as go}from"node:crypto";import{closeSync as yo,existsSync as bo,openSync as _o,readSync as xo,readdirSync as Qn,readFileSync as wo,statSync as ft}from"node:fs";import{homedir as vo}from"node:os";import{basename as er,join as We}from"node:path";import{TextDecoder as lr}from"node:util";var J={text:[],header:[],secrets:[],table:null,amounts:null,severity:null};function vt(e){e.table&&(J.table=e.table),e.severity&&(J.severity=e.severity),e.amounts&&(J.amounts=e.amounts);for(let t of e.text??[])J.text.some(n=>n.kind===t.kind)||J.text.push(t);e.header&&!J.header.includes(e.header)&&J.header.push(e.header);for(let t of e.secrets??[])J.secrets.some(n=>n.id===t.id)||J.secrets.push(t)}function Ve(e){return J.severity?.(e)}function Xe(){return J.text}function on(){return J.header}function Re(){return J.table}function sn(){return J.secrets}var an=[{id:"aws-access-key",name:"AWS Access Key",pattern:/(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)/,severity:"critical"},{id:"aws-secret-key",name:"AWS Secret Key",pattern:/(?:aws_secret_access_key|aws_secret_key|secret_access_key)\s*[=:]\s*['"]?[A-Za-z0-9/+=]{40}['"]?/,severity:"critical"},{id:"gcp-api-key",name:"GCP API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"critical"},{id:"gcp-service-account",name:"GCP Service Account",pattern:/"type"\s*:\s*"service_account"/,severity:"critical"},{id:"github-token",name:"GitHub Token",pattern:/gh[pousr]_[0-9a-zA-Z]{36,}/,severity:"critical"},{id:"github-fine-grained",name:"GitHub Fine-Grained Token",pattern:/github_pat_[0-9a-zA-Z_]{22,}/,severity:"critical"},{id:"gitlab-token",name:"GitLab Token",pattern:/glpat-[0-9a-zA-Z_-]{20,}/,severity:"critical"},{id:"stripe-secret",name:"Stripe Secret Key",pattern:/sk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"stripe-restricted",name:"Stripe Restricted Key",pattern:/rk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"slack-token",name:"Slack Token",pattern:/xox[baprs]-[0-9a-zA-Z-]{10,}/,severity:"high"},{id:"slack-webhook",name:"Slack Webhook",pattern:/hooks\.slack\.com\/services\/T[0-9A-Z]{8,}\/B[0-9A-Z]{8,}\/[0-9a-zA-Z]{24}/,severity:"high"},{id:"twilio-api-key",name:"Twilio API Key",pattern:/SK[0-9a-fA-F]{32}/,severity:"high"},{id:"sendgrid-api-key",name:"SendGrid API Key",pattern:/SG\.[0-9a-zA-Z_-]{22}\.[0-9a-zA-Z_-]{43}/,severity:"critical"},{id:"postgres-uri",name:"PostgreSQL Connection String",pattern:/postgres(?:ql)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"mongodb-uri",name:"MongoDB Connection String",pattern:/mongodb(?:\+srv)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"redis-uri",name:"Redis Connection String",pattern:/redis(?:s)?:\/\/[^\s'"]{10,}/,severity:"high"},{id:"openai-key",name:"OpenAI API Key",pattern:/sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}/,severity:"critical"},{id:"openai-project-key",name:"OpenAI API Key",pattern:/sk-(?:proj|svcacct|admin)-[0-9A-Za-z_-]{40,}/,severity:"critical"},{id:"anthropic-key",name:"Anthropic API Key",pattern:/sk-ant-[0-9a-zA-Z_-]{40,}/,severity:"critical"},{id:"firebase-key",name:"Firebase API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"high"},{id:"supabase-key",name:"Supabase Service Key",pattern:/eyJ[0-9a-zA-Z_-]{100,}/,severity:"critical"},{id:"supabase-access-token",name:"Supabase Access Token",pattern:/\bsbp_[0-9a-f]{40}\b/,severity:"critical"},{id:"supabase-secret-key",name:"Supabase Secret Key",pattern:/\bsb_secret_[0-9A-Za-z_-]{20,}/,severity:"critical"},{id:"private-key",name:"Private Key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----/,severity:"critical"},{id:"jwt-secret",name:"JWT/Generic Secret",pattern:/(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"password-in-code",name:"Password in Code",pattern:/(?:password|passwd|pwd)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"bearer-token",name:"Bearer Token in Code",pattern:/['"]Bearer\s+[0-9a-zA-Z._-]{20,}['"]/,severity:"high"}];function Et(){let e=sn().filter(t=>!an.some(n=>n.id===t.id));return[...an,...e]}var cn=/node_modules\/|\.next\/|\.test\.|\.spec\.|__tests__\/|\.nodata-proof\.json$|\.git\//,ln=/(^|\/)\.env(\.[\w-]+)*\.(example|sample|template|dist)$|\.(example|sample|template)$|(^|\/)[^/]*\.(example|sample)\.[a-z0-9]+$/i,At=/(^|\/)(__tests__|__mocks__|tests?|spec|fixtures?|mocks?|samples?|examples?|demo|testdata)(\/|$)|\.(test|spec)\.[a-z0-9]+$|\.min\.(m?js|css)$|(^|\/)[^/]*\.worker\.min\.m?js$/i,Or=[{name:"lodash",below:"4.17.21",severity:"critical",cve:"CVE-2021-23337",desc:"Command injection via template"},{name:"minimist",below:"1.2.6",severity:"critical",cve:"CVE-2021-44906",desc:"Prototype pollution"},{name:"json5",below:"2.2.2",severity:"high",cve:"CVE-2022-46175",desc:"Prototype pollution"},{name:"express",below:"4.19.2",severity:"high",cve:"CVE-2024-29041",desc:"Open redirect"},{name:"path-to-regexp",below:"6.3.0",severity:"high",cve:"CVE-2024-45296",desc:"ReDoS"},{name:"sanitize-html",below:"2.12.1",severity:"high",cve:"CVE-2024-21501",desc:"XSS bypass"},{name:"dompurify",below:"3.0.9",severity:"high",cve:"CVE-2024-45801",desc:"mXSS"},{name:"jsonwebtoken",below:"9.0.0",severity:"critical",cve:"CVE-2022-23529",desc:"Key confusion attack"},{name:"jose",below:"4.15.5",severity:"high",cve:"CVE-2024-28176",desc:"DoS via JWE"},{name:"axios",below:"1.6.0",severity:"high",cve:"CVE-2023-45857",desc:"CSRF cookie leak"},{name:"node-fetch",below:"2.6.7",severity:"high",cve:"CVE-2022-0235",desc:"Header leak on redirect"},{name:"serialize-javascript",below:"6.0.2",severity:"critical",cve:"CVE-2024-11831",desc:"XSS via serialization"},{name:"xml2js",below:"0.6.0",severity:"high",cve:"CVE-2023-0842",desc:"Prototype pollution"},{name:"next",below:"14.1.1",severity:"high",cve:"CVE-2024-34350",desc:"SSRF via headers"},{name:"sharp",below:"0.32.6",severity:"high",cve:"CVE-2023-4863",desc:"libwebp heap overflow"},{name:"multer",below:"1.4.5",severity:"high",cve:"CVE-2022-24434",desc:"Prototype pollution"},{name:"tough-cookie",below:"4.1.3",severity:"medium",cve:"CVE-2023-26136",desc:"Prototype pollution"},{name:"semver",below:"7.5.4",severity:"medium",cve:"CVE-2022-25883",desc:"ReDoS"},{name:"ip",below:"2.0.1",severity:"critical",cve:"CVE-2024-29415",desc:"SSRF bypass via octal IP"},{name:"tar",below:"6.2.1",severity:"high",cve:"CVE-2024-28863",desc:"DoS via path traversal"}];function Dr(e,t){let n=o=>o.replace(/^[^0-9]*/,"").split(".").map(s=>parseInt(s,10)||0),r=n(e),i=n(t);for(let o=0;o<3;o++){if((r[o]||0)<(i[o]||0))return!0;if((r[o]||0)>(i[o]||0))return!1}return!1}function un(e){let t=[],n;try{n=JSON.parse(e)}catch{return t}let r={...n.dependencies??{},...n.devDependencies??{}};for(let[i,o]of Object.entries(r)){let s=(o||"").replace(/^[\^~>=<\s]+/,""),a=Or.find(l=>l.name===i&&Dr(s,l.below));a&&t.push({name:i,version:s,vuln:a})}return t}var Nr=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Salary / income"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication|prescription)$/i,type:"medical",label:"Medical"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Policy"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation"}],Fr=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם הלקוח|שם בן זוג|שם המבוטח|שם המוטב|שם הילד|שם הקטין)$/i,type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מס' זהות|teudat_zehut|tz|israeli_id|il_id)$/i,type:"id",label:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה)$/i,type:"id",label:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|אימייל|כתובת מייל)$/i,type:"email",label:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|טלפון נייד)$/i,type:"phone",label:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|רחוב|מס בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|מען)$/i,type:"address",label:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|ת לידה|תאריך הולדת|יום הולדת|גיל)$/i,type:"dob",label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|מספר חשבון|מס חשבון|סניף|iban|iban_il)$/i,type:"financial",label:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|מספר אשראי|cvv|אשראי)$/i,type:"financial",label:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|מצב רפואי|חיסון|רגישות|אלרגיה|סוג דם)$/i,type:"medical",label:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מס פוליסה|פוליסה|מספר חבר|מספר ביטוח)$/i,type:"id",label:"\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4/\u05D7\u05D1\u05E8\u05D5\u05EA"},{pattern:/^(?:שם הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|תעודת לידה)$/i,type:"minor_data",label:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|השקפה פוליטית|מצב משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מס רכב|לוחית רישוי|מספר רישוי)$/i,type:"tracking",label:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}],Mr=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|enabled|active|public|version|metadata|config|settings|data|content|note|comment|label|color|icon)$/i,jr=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(file|product|item|company|org|organization|project|sheet|table|field|category|branch|bank|city|street|document|plan|course|department|site|domain|brand|vendor|service|role)[ _-]?name$/i;function be(e){if(!e)return null;let t=e.trim();if(Mr.test(t)||/^name$/i.test(t)||/^\[[A-Z_]+(?:-\d+)?\]$/.test(t))return null;let n=t.replace(/[\s-]+/g,"_");for(let r of[...Fr,...Nr])if(r.pattern.test(t)||r.pattern.test(n))return{type:r.type,label:r.label};if(jr.test(t))return null;if(/^שם[ _][\u0590-\u05FF"'׳ ]{2,20}$/.test(t))return{type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"};if(/^(customer|client|employee|inspector|supervisor|contact|person|patient|user|owner|manager|agent|member|driver|tenant|student|parent|beneficiary|insured)_?(full_?)?name$/i.test(n))return{type:"name",label:"Person name"};for(let r of on()){let i=r(t);if(i)return{type:i.type,label:i.label}}return null}var Ge={id:"critical",financial:"critical",medical:"critical",biometric:"critical",minor_data:"critical",sensitive_personal:"critical",email:"high",phone:"high",name:"high",address:"high",dob:"high",tracking:"medium",location:"high",auth:"critical",employment:"medium",education:"medium",behavior:"high"};function Ze(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let n=t.padStart(9,"0"),r=0;for(let i=0;i<9;i++){let o=parseInt(n[i]??"0",10)*(i%2+1);o>9&&(o-=9),r+=o}return r%10===0&&parseInt(n,10)>0}var It=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g;var Le=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function Hr(e){let t=String(e??"").replace(/\D/g,"");if(t.length<12||t.length>19)return!1;let n=0,r=!1;for(let i=t.length-1;i>=0;i-=1){let o=parseInt(t[i]??"0",10);r&&(o*=2,o>9&&(o-=9)),n+=o,r=!r}return n%10===0}function Ur(e){let t=String(e??"").replace(/\s/g,"").toUpperCase();if(!/^[A-Z]{2}\d{2}[A-Z0-9]{10,30}$/.test(t))return!1;let n=t.slice(4)+t.slice(0,4),r=0;for(let i of n){let o=i>="A"&&i<="Z"?String(i.charCodeAt(0)-55):i;for(let s of o)r=(r*10+Number(s))%97}return r===1}var kt="(?<!\\d)(?<!\\d[.,])",St="(?!\\d)(?![.,]\\d)",Pe=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${kt}\\d{9}${St}`,"g"),validate:Ze,hint:"Israeli national ID (check digit verified) in plaintext. Encrypt the column or mask it at rest."},{subkind:"credit_card",severity:"critical",pattern:new RegExp(`${kt}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${St}`,"g"),validate:Hr,hint:"Payment card number (Luhn verified) in plaintext. This is PCI scope."},{subkind:"iban",severity:"high",pattern:/\b[A-Z]{2}\d{2}(?: ?[A-Z0-9]{4}){2,7}(?: ?[A-Z0-9]{1,4})?\b/g,validate:Ur,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${kt}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${St}`,"g"),validate:e=>{let t=e.replace(/\D/g,"").replace(/^972/,"0");return/^0[57]\d{8}$/.test(t)?!0:/^0[2-489]\d{7}$/.test(t)&&(/[- ]/.test(e)||e.startsWith("+972"))},hint:"Israeli phone number in plaintext."}];function dn(e){if(e.length!==14&&e.length!==17)return!1;let t=+e.slice(0,4),n=+e.slice(4,6),r=+e.slice(6,8),i=+e.slice(8,10),o=+e.slice(10,12),s=+e.slice(12,14);return t>=1970&&t<=2099&&n>=1&&n<=12&&r>=1&&r<=31&&i<24&&o<60&&s<60}function fn(e){let t=Number(e);return!Number.isSafeInteger(t)||t<1024?!1:Number.isInteger(Math.log2(t))||t%1048576===0}var Br=new Set(["000000018","123456782","111111118","222222226","333333334","999999998","4111111111111111","4242424242424242","4000056655665556","5555555555554444","5105105105105100","2223003122003222","378282246310005","371449635398431","6011111111111117","3056930009020004","4012888888881881","4000000000000002"]);function Ce(e){return Br.has(e.replace(/\D/g,""))}function Ke(e){let t=e.replace(/\D/g,"");return dn(t)||fn(t)}function Oe(e,t){let n=[];for(let r of Pe){r.pattern.lastIndex=0;let i=new Set,o,s=0;for(;(o=r.pattern.exec(e))!==null&&(s+=1,!(s>2e5));){let a=o[0];if(!(r.subkind!=="iban"&&r.subkind!=="israeli_phone"&&Ke(a))&&(r.validate(a)&&i.add(a.replace(/[\s-]/g,"")),i.size>=1e5))break}if(i.size>0){if(t)for(let l of i)Ce(l)||t(r.subkind,l);let a=[...i].filter(l=>!Ce(l)).length;n.push({subkind:r.subkind,severity:a===0?"low":r.severity,hint:a===0?`${r.hint} All ${i.size} are published test numbers.`:r.hint,count:i.size,real:a})}}for(let r of Xe()){let i=new Set;for(let o of r.find(e))i.add(e.slice(o.start,o.end).trim());i.size>0&&n.push({subkind:r.kind,severity:r.severity,hint:r.hint,count:i.size})}return n}function De(e,t){let n=[],r="",i=!1;for(let o=0;o<e.length;o++){let s=e[o];i?s==='"'&&e[o+1]==='"'?(r+='"',o++):s==='"'?i=!1:r+=s:s==='"'?i=!0:s===t?(n.push(r),r=""):r+=s}return n.push(r),n}import{inflateRawSync as Ai}from"node:zlib";import{inflateSync as pn}from"node:zlib";var Ne=new Set([".pdf"]),hn=8*1024*1024;function qe(e){let t=e.toString("latin1"),n=new Map,r=/(\d+)\s+(\d+)\s+obj\b/g,i;for(;(i=r.exec(t))!==null;){let o=Number(i[1]),s=r.lastIndex,a=t.indexOf("endobj",s);if(a<0)continue;let l=t.indexOf("stream",s),c,h=null;if(l>=0&&l<a){c=t.slice(s,l);let u=l+6;t[u]==="\r"&&(u+=1),t[u]===`
4
4
  `&&(u+=1);let p=t.indexOf("endstream",u);p>u&&(h=e.subarray(u,p))}else c=t.slice(s,a);n.set(o,{num:o,dict:c,stream:h})}for(let o of[...n.values()]){if(!o.stream||!/\/Type\s*\/ObjStm\b/.test(o.dict))continue;let s=Fe(o),a=Number(/\/N\s+(\d+)/.exec(o.dict)?.[1]??0),l=Number(/\/First\s+(\d+)/.exec(o.dict)?.[1]??-1);if(s===null||!a||l<0)continue;let c=s.slice(0,l).trim().split(/\s+/).map(Number);for(let h=0;h<a;h+=1){let u=c[2*h],p=c[2*h+1];if(u===void 0||p===void 0||Number.isNaN(u)||Number.isNaN(p))break;let x=h+1<a?c[2*(h+1)+1]:void 0,w=s.slice(l+p,x!==void 0?l+x:void 0);n.has(u)||n.set(u,{num:u,dict:w,stream:null})}}return n}function $t(e){let t=[...e.replace(/\s+/g,"")];if(t.length<40)return!1;let n=0,r=0;for(let i of t){let o=i.codePointAt(0)??0;o<32||o>=127&&o<=191||o===65533||o>=57344&&o<=63743?n+=1:/[\p{L}\p{N}]/u.test(i)&&(r+=1)}return n/t.length>.2||r/t.length<.25}function zr(e){let t=e.toString("latin1").replace(/\s/g,"");t.startsWith("<~")&&(t=t.slice(2));let n=t.indexOf("~>");n>=0&&(t=t.slice(0,n));let r=[],i=0,o=0;for(let s of t){if(s==="z"&&o===0){r.push(0,0,0,0);continue}let a=s.charCodeAt(0)-33;if(a<0||a>84)return null;i=i*85+a,o+=1,o===5&&(r.push(i>>>24&255,i>>>16&255,i>>>8&255,i&255),i=0,o=0)}if(o>0){for(let a=o;a<5;a+=1)i=i*85+84;let s=[i>>>24&255,i>>>16&255,i>>>8&255,i&255];for(let a=0;a<o-1;a+=1)r.push(s[a]??0)}return Buffer.from(r)}function Wr(e){let t=e.toString("latin1").replace(/\s/g,"").split(">")[0]??"",n=t.length%2?t+"0":t;return/^[0-9A-Fa-f]*$/.test(n)?Buffer.from(n,"hex"):null}function Vr(e){let t=/\/Filter\s*(\[[^\]]*\]|\/\w+)/.exec(e);return!t||!t[1]?[]:[...t[1].matchAll(/\/(\w+)/g)].map(n=>n[1]??"")}function Fe(e,t){if(!e.stream)return null;let n=e.stream;for(let r of Vr(e.dict)){let i=null;if(r==="FlateDecode")try{i=t!==void 0?pn(n,{maxOutputLength:Math.max(1,t)}):pn(n)}catch{return null}else if(r==="ASCII85Decode")i=zr(n);else if(r==="ASCIIHexDecode")i=Wr(n);else return null;if(i===null)return null;n=i}return n.toString("latin1")}function Xr(e){let t=new Map,n=1,r=/begincodespacerange([\s\S]*?)endcodespacerange/.exec(e);if(r&&r[1]){let l=/<([0-9A-Fa-f]+)>/.exec(r[1]);l&&l[1]&&l[1].length>=4&&(n=2)}let i=l=>{let c="";for(let h=0;h+3<l.length+1;h+=4){let u=parseInt(l.slice(h,h+4),16);Number.isFinite(u)&&u>0&&(c+=String.fromCharCode(u))}return c},o=/beginbfchar([\s\S]*?)endbfchar/g,s;for(;(s=o.exec(e))!==null;){let l=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,c;for(;(c=l.exec(s[1]??""))!==null;)t.set(parseInt(c[1]??"0",16),i(c[2]??""))}let a=/beginbfrange([\s\S]*?)endbfrange/g;for(;(s=a.exec(e))!==null;){let l=s[1]??"",c=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,h;for(;(h=c.exec(l))!==null;){let u=parseInt(h[1]??"0",16),p=parseInt(h[2]??"0",16),x=parseInt((h[3]??"0").slice(0,4)||"0",16);if(!(p-u>65535))for(let w=u;w<=p;w+=1)t.set(w,String.fromCharCode(x+(w-u)))}}return{map:t,bytes:n}}function Gr(e){let t=new Map,n=[],r=[];for(let o of e.values()){for(let s of o.dict.matchAll(/\/Font\s*<<([\s\S]*?)>>/g))s[1]&&r.push(s[1]);for(let s of o.dict.matchAll(/\/Font\s+(\d+)\s+\d+\s+R/g)){let a=e.get(Number(s[1]));a&&r.push(a.dict)}}let i=new Set;for(let o of r){let s=/\/([^\s/<>[\]()]+)\s+(\d+)\s+\d+\s+R/g,a;for(;(a=s.exec(o))!==null;){let l=`${a[1]}#${a[2]}`;i.has(l)||(i.add(l),n.push([a[1]??"",Number(a[2])]))}}for(let[o,s]of n){let a=e.get(s);if(!a)continue;let l=null,c=/\/ToUnicode\s+(\d+)\s+\d+\s+R/.exec(a.dict);if(c){let u=e.get(Number(c[1])),p=u?Fe(u):null;p&&(l=Xr(p))}if(l||(l=qr(a.dict,e)),!l)continue;let h=t.get(o)??[];h.push(l),t.set(o,h)}return t}var Zr=["alef","bet","gimel","dalet","he","vav","zayin","het","tet","yod","finalkaf","kaf","lamed","finalmem","mem","finalnun","nun","samekh","ayin","finalpe","pe","finaltsadi","tsadi","qof","resh","shin","tav"];function Kr(e){let t=/^uni([0-9A-Fa-f]{4})$/.exec(e)??/^u([0-9A-Fa-f]{4,6})$/.exec(e);if(t)return String.fromCodePoint(parseInt(t[1],16));let n=/^afii(\d{5})$/.exec(e);if(n){let o=Number(n[1]);if(o>=57664&&o<=57690)return String.fromCharCode(1488+(o-57664))}let r=Zr.indexOf(e.replace(/hebrew$/,""));return r>=0?String.fromCharCode(1488+r):e==="space"?" ":/^[A-Za-z]$/.test(e)?e:{zero:"0",one:"1",two:"2",three:"3",four:"4",five:"5",six:"6",seven:"7",eight:"8",nine:"9",period:".",comma:",",hyphen:"-",colon:":",slash:"/",at:"@"}[e]??null}function qr(e,t){let n=e,r=/\/Encoding\s+(\d+)\s+\d+\s+R/.exec(e);r&&(n=t.get(Number(r[1]))?.dict??"");let i=/\/Differences\s*\[([^\]]*)\]/.exec(n);if(!i?.[1])return null;let o=new Map,s=0;for(let a of i[1].match(/\d+|\/[^\s/[\]]+/g)??[]){if(/^\d+$/.test(a)){s=Number(a);continue}let l=Kr(a.slice(1));l!==null&&o.set(s,l),s+=1}return o.size?{map:o,bytes:1}:null}function xn(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r!=="\\"){t.push(r.charCodeAt(0)&255);continue}let i=e[n+1];if(i===void 0)break;if(i>="0"&&i<="7"){let s="",a=n+1;for(;a<e.length&&s.length<3&&e[a]>="0"&&e[a]<="7";)s+=e[a],a+=1;t.push(parseInt(s,8)&255),n=a-1;continue}let o={n:10,r:13,t:9,b:8,f:12};t.push(o[i]??i.charCodeAt(0)&255),n+=1}return t}function wn(e){if(e.length<2||e[0]!==254||e[1]!==255)return null;let t="";for(let n=2;n+1<e.length;n+=2)t+=String.fromCharCode((e[n]??0)<<8|(e[n+1]??0));return t}function mn(e,t){let n=wn(e);if(n!==null)return n;if(!t)return e.map(i=>String.fromCharCode(i)).join("");let r="";if(t.bytes===2)for(let i=0;i+1<e.length;i+=2){let o=(e[i]??0)<<8|(e[i+1]??0);r+=t.map.get(o)??""}else for(let i of e)r+=t.map.get(i)??String.fromCharCode(i);return r}function Jr(e){let t=0;for(let n of e){let r=n.codePointAt(0)??0;/[\p{L}\p{N}]/u.test(n)?t+=1:(r<32||r>=127&&r<=191||r===65533)&&(t-=2)}return t}function gn(e,t){if(!t||t.length<=1)return mn(e,t?.[0]);let n="",r=-1/0;for(let i of t){let o=mn(e,i),s=Jr(o);s>r&&(n=o,r=s)}return n}function Yr(e,t){let n="",r="",i,o=!1,s="",a=0,l=null,c=()=>{r.trim()&&(n+=r+`
@@ -37,4 +37,4 @@ ${a} ${l}
37
37
  `),truncated:l,parts:s}}function Hn(e,t,n={}){if(xe(e)){let r=Ft(e,ve);return"text"in r?{ok:!0,result:{text:r.text,truncated:r.truncated,parts:r.parts,attachments:r.attachments}}:{ok:!1,reason:r.reason}}if(Ue(e)){let r=Mt(e.toString("latin1"));if(!r.trim())return{ok:!1,reason:"no text inside (an empty file, or only pictures)"};let i=r.length>ve;return{ok:!0,result:{text:i?r.slice(0,ve):r,truncated:i,parts:["rtf"]}}}if(ke.has(t)||Se.has(t)){let r=Ni(e,t);return r?{ok:!0,result:r}:{ok:!1,reason:"damaged, or not really an Office file"}}if(Ne.has(t)){let r=Me(e,n);return r?{ok:!0,result:{text:r.text,truncated:r.truncated,parts:[`pdf:${r.engine}`],engine:r.engine,uncertain:r.uncertain}}:{ok:!1,reason:Cn(e)}}return Be.has(t)?{ok:!1,reason:"not a Word, Excel, PowerPoint or Outlook file inside, despite its name"}:{ok:!1,reason:"unsupported format"}}var sa=new Set([...ke,...Se,...Be,...jt,...Ne]);import{execFileSync as Fi}from"node:child_process";import{existsSync as Ee,mkdirSync as Wn,readFileSync as Mi,writeFileSync as Vn}from"node:fs";import{createRequire as ji}from"node:module";import{homedir as Hi}from"node:os";import{dirname as Ui,join as Q}from"node:path";import{gunzipSync as Bi}from"node:zlib";var at="7.0.0",zi="1.0.0",Ht=["heb","eng"],Ae=()=>process.env.NODATA_OCR_DIR||Q(Hi(),".nodata","ocr"),Wi=5*6e4,Vi=2*6e4,Xi=6e4;function ct(){return/^(0|off|false|no)$/i.test(process.env.NODATA_OCR_DOWNLOAD??"")}function Un(){let e=process.env.NODATA_OCR_MODULE;try{let t=ji(Q(Ae(),"package.json"));return t(e||"tesseract.js")}catch{return null}}function Gi(){let e=process.env.npm_execpath;if(e&&/npm-cli\.js$/.test(e)&&Ee(e))return e;let t=Ui(process.execPath);for(let n of[Q(t,"node_modules","npm","bin","npm-cli.js"),Q(t,"..","lib","node_modules","npm","bin","npm-cli.js")])if(Ee(n))return n;return null}function Zi(){let e=Gi();if(!e)return"npm was not found on this computer";let t=Ae();try{return Wn(t,{recursive:!0}),Ee(Q(t,"package.json"))||Vn(Q(t,"package.json"),JSON.stringify({private:!0,description:"NoData picture reader (tesseract.js), fetched once"})),Fi(process.execPath,[e,"install","--prefix",t,"--ignore-scripts","--no-audit","--no-fund","--save-exact",`tesseract.js@${at}`,`tesseract.js-core@${at}`,...Ht.map(n=>`@tesseract.js-data/${n}@${zi}`)],{stdio:["ignore","pipe","pipe"],timeout:Wi,windowsHide:!0}),null}catch{return"the picture reader could not be downloaded (offline, or a proxy blocked npm)"}}function Bn(){let e=Q(Ae(),"tessdata");try{Wn(e,{recursive:!0});for(let t of Ht){let n=Q(e,`${t}.traineddata`);if(Ee(n))continue;let r=Q(Ae(),"node_modules","@tesseract.js-data",t,"4.0.0_best_int",`${t}.traineddata.gz`);if(!Ee(r))return null;Vn(n,Bi(Mi(r)))}return e}catch{return null}}function zn(e,t,n){return new Promise((r,i)=>{let o=setTimeout(()=>i(new Error(n)),t);o.unref?.(),e.then(s=>{clearTimeout(o),r(s)},s=>{clearTimeout(o),i(s)})})}async function Ut(){let e=Un(),t=process.env.NODATA_TESSDATA_PATH||Bn(),n=null;if(!e||!t){if(ct())return{error:"the built-in picture reader is not downloaded here (NODATA_OCR_DOWNLOAD=off)"};let o=Zi();if(o)return{error:o};if(e=Un(),t=process.env.NODATA_TESSDATA_PATH||Bn(),!e||!t)return{error:"the picture reader was downloaded but could not start"};n=`NoData downloaded its picture reader once (tesseract.js ${at} with Hebrew and English, into ${Ae()}) \u2014 it runs only on this computer`}let r={langPath:t,gzip:!Ee(Q(t,"eng.traineddata")),cachePath:Q(Ae(),"tessdata"),errorHandler:()=>{}},i=null;try{let o=e.createWorker(Ht,1,r);i=await zn(o,Vi,"start");let s=i;return{ocr:{note:n,recognize:async a=>(await zn(s.recognize(a),Xi,"picture")).data.text,close:async()=>{await s.terminate().catch(()=>{})}}}}catch{return{error:"the built-in picture reader could not start on this computer"}}}var lt=4096,X=(e,t,n)=>n.every((r,i)=>e[t+i]===r),H=(e,t,n)=>e.length>=t+n.length&&e.subarray(t,t+n.length).toString("latin1")===n,Ki=new Set([".jpg",".jpeg",".png",".gif",".bmp",".tif",".tiff",".webp",".heic",".heif",".ico",".jfif",".avif"]),qi=new Set([".zip",".rar",".7z",".tar",".gz",".tgz",".bz2",".xz",".zst",".cab",".iso",".jar",".apk"]),Ji=new Set([".mp3",".mp4",".m4a",".m4v",".mov",".avi",".mkv",".webm",".wav",".flac",".ogg",".opus",".aac",".wmv",".wma",".flv",".3gp"]),Xn=new Set([".exe",".dll",".so",".dylib",".msi",".msp",".msm",".bin",".pyc",".class",".o",".a",".lib",".sys",".appx",".msix",".dmg",".pkg",".deb",".rpm"]),Gn=new Set([".ttf",".otf",".woff",".woff2",".eot"]),Yi=new Set([".psd",".ai",".fla",".dwg",".dxf",".sketch",".fig",".indd",".blend",".fbx",".obj",".stl"]),Qi=new Set([".sqlite",".sqlite3",".db",".mdb",".accdb",".dbf",".sdf"]),ae="an image \u2014 text in a picture (a photographed ID, a screenshot) is not read yet",Ie="an archive \u2014 the files inside are not opened yet",Bt="a database file \u2014 its tables are not read here",ce=e=>({cls:"no_text",format:e,reader:null,reason:`${e} \u2014 no text to read`});function zt(e,t,n){let r=e.toLowerCase();if(H(n,0,"%PDF"))return{cls:"document",format:"PDF",reader:"document",docExt:".pdf"};if(Ue(n))return{cls:"document",format:"RTF",reader:"document",docExt:".rtf"};if(xe(n))return Xn.has(t)?ce("an installer"):r==="thumbs.db"?ce("a Windows thumbnail cache"):{cls:"document",format:t===".msg"?"Outlook message":ke.has(t)?"Office (password-protected)":Be.has(t)?`Office 97-2003 (${t})`:"Office 97-2003",reader:"document",docExt:t};if(X(n,0,[80,75,3,4])||X(n,0,[80,75,5,6]))return ke.has(t)?{cls:"document",format:`Office (${t})`,reader:"document",docExt:t}:Se.has(t)?{cls:"document",format:`OpenDocument (${t})`,reader:"document",docExt:t}:t===".xlsb"?{cls:"document",format:"Excel binary workbook (.xlsb)",reader:null,reason:"an Excel binary workbook (.xlsb) \u2014 not read yet; save it as .xlsx to scan it"}:{cls:"archive",format:"zip archive",reader:null,reason:Ie};if(X(n,0,[255,216,255]))return{cls:"image",format:"jpeg image",reader:null,reason:ae};if(X(n,0,[137,80,78,71]))return{cls:"image",format:"png image",reader:null,reason:ae};if(H(n,0,"GIF8"))return{cls:"image",format:"gif image",reader:null,reason:ae};if(H(n,0,"RIFF")&&H(n,8,"WEBP"))return{cls:"image",format:"webp image",reader:null,reason:ae};if(X(n,0,[73,73,42,0])||X(n,0,[77,77,0,42]))return{cls:"image",format:"tiff image",reader:null,reason:ae};if(H(n,4,"ftyp")&&/^(heic|heix|mif1|msf1|avif)/.test(n.subarray(8,12).toString("latin1")))return{cls:"image",format:"heic image",reader:null,reason:ae};if(H(n,0,"BM")&&t===".bmp")return{cls:"image",format:"bmp image",reader:null,reason:ae};if(H(n,0,"Rar!"))return{cls:"archive",format:"rar archive",reader:null,reason:Ie};if(X(n,0,[55,122,188,175,39,28]))return{cls:"archive",format:"7z archive",reader:null,reason:Ie};if(X(n,0,[31,139]))return{cls:"archive",format:"gzip archive",reader:null,reason:Ie};if(H(n,0,"BZh")||X(n,0,[253,55,122,88,90,0])||X(n,0,[40,181,47,253])||H(n,0,"MSCF"))return{cls:"archive",format:"compressed archive",reader:null,reason:Ie};if(H(n,0,"SQLite format 3\0"))return{cls:"database",format:"SQLite database",reader:null,reason:Bt};if(H(n,4,"Standard Jet DB")||H(n,4,"Standard ACE DB"))return{cls:"database",format:"Access database",reader:null,reason:Bt};if(H(n,0,"MZ")||X(n,0,[127,69,76,70])||X(n,0,[207,250,237,254])||X(n,0,[202,254,186,190]))return ce("a program");if(H(n,4,"ftyp")||H(n,0,"OggS")||H(n,0,"fLaC")||H(n,0,"ID3")||X(n,0,[26,69,223,163])||H(n,0,"RIFF")&&(H(n,8,"WAVE")||H(n,8,"AVI ")))return ce("audio or video");if(H(n,0,"wOFF")||H(n,0,"wOF2")||H(n,0,"OTTO")||X(n,0,[0,1,0,0,0])&&Gn.has(t))return ce("a font");if(Ki.has(t))return{cls:"image",format:`${t.slice(1)} image`,reader:null,reason:ae};if(qi.has(t))return{cls:"archive",format:`${t.slice(1)} archive`,reader:null,reason:Ie};if(Qi.has(t))return{cls:"database",format:`${t.slice(1)} database`,reader:null,reason:Bt};if(Ji.has(t))return ce("audio or video");if(Xn.has(t))return ce("a program");if(Gn.has(t))return ce("a font");if(Yi.has(t))return{cls:"unknown",format:`${t.slice(1)} design file`,reader:null,reason:"a design file \u2014 its text is not read"};let i=ke.has(t)||Be.has(t)||Se.has(t)||jt.has(t)||Ne.has(t);if(X(n,0,[255,254]))return{cls:i?"document":"text",format:"UTF-16 text",reader:"utf16le"};if(X(n,0,[254,255]))return{cls:i?"document":"text",format:"UTF-16 text",reader:"utf16be"};if(n.length===0)return{cls:"text",format:"empty file",reader:"text"};let o=0,s=0,a=0;for(let l=0;l<n.length;l+=1){let c=n[l];c===0?(o+=1,l%2===1&&(s+=1)):(c<9||c>13&&c<32||c===127)&&(a+=1)}return n.length>=16&&s/(n.length/2)>.4&&o-s<n.length*.02?{cls:i?"document":"text",format:"UTF-16 text",reader:"utf16le"}:o/n.length>.05||a/n.length>.1?i?{cls:"document",format:`${t} (not a known container)`,reader:null,reason:"damaged, or not really the format its name says"}:{cls:"unknown",format:t?`${t.slice(1)} binary`:"binary",reader:null,reason:"a binary file of a type NoData does not read"}:{cls:i?"document":"text",format:i?`${t.slice(1)} saved as text`:"text",reader:"text"}}function Wt(e){if(X(e,0,[137,80,78,71])&&e.length>=24)return{w:e.readUInt32BE(16),h:e.readUInt32BE(20)};if(H(e,0,"GIF8")&&e.length>=10)return{w:e.readUInt16LE(6),h:e.readUInt16LE(8)};if(H(e,0,"BM")&&e.length>=26)return{w:e.readInt32LE(18),h:Math.abs(e.readInt32LE(22))};if(X(e,0,[255,216])){let t=2;for(;t+9<e.length;){if(e[t]!==255)return null;let n=e[t+1],r=e.readUInt16BE(t+2);if(n>=192&&n<=207&&n!==196&&n!==200&&n!==204)return{w:e.readUInt16BE(t+7),h:e.readUInt16BE(t+5)};t+=2+r}}return null}var va=[...Pe].sort((e,t)=>+(t.subkind==="iban")-+(e.subkind==="iban"));function ut(e){let t=e.trim();return/^\[[A-Z_]+(?:-\d+)?\]$/.test(t)||/^[\d]{0,4}[*•xX]{3,}[\d]{0,4}$/.test(t)}var Kn=10;function qn(e){let t=e.replace(/<rPh\b[\s\S]*?<\/rPh>/g,""),n="";for(let r of t.matchAll(/<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g))n+=r[1];return me(n)}function to(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>qn(t[1]??"")):[]}var no=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function Zn(e,t){let n=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return n?n[1]:null}function ze(e,t){if(e.type==="s"){let r=/<v>([^<]*)<\/v>/.exec(e.inner);return r?t[Number(r[1])]??null:null}if(e.type==="inlineStr"){let r=/<is>([\s\S]*?)<\/is>/.exec(e.inner);return r?qn(r[1]):null}if(e.type==="b"||e.type==="e")return null;let n=/<v>([^<]*)<\/v>/.exec(e.inner);return n?me(n[1]):null}function ro(e){let t=[];for(let n of e.matchAll(no)){let r=Zn(n[1],"r"),i=r?/^([A-Z]+)(\d+)$/.exec(r):null;if(!i)return null;t.push({full:n[0],attrs:n[1],inner:n[2]??"",col:i[1],row:Number(i[2]),type:Zn(n[1],"t")??"n"})}return t}function io(e,t){let n=[...new Set(e.map(r=>r.row))].sort((r,i)=>r-i).slice(0,Kn);for(let r of n){let i=new Map;for(let o of e.filter(s=>s.row===r)){let s=ze(o,t),a=s?be(s):null;a&&i.set(o.col,{type:a.type,header:s.trim()})}if(i.size>0)return{row:r,cols:i}}return{row:-1,cols:new Map}}var oo=/^xl\/worksheets\/sheet\d+\.xml$/,so=200;function ao(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function co(e,t){let n=[...new Set(e.map(o=>o.row))].sort((o,s)=>o-s).slice(0,Kn),r=-1,i=-1/0;for(let o of n){let s=e.filter(c=>c.row===o).map(c=>(ze(c,t)??"").trim()).filter(Boolean);if(s.length<2)continue;let a=s.filter(c=>!ao(c)).length,l=a*2-(s.length-a);l>i&&(i=l,r=o)}return r}function lo(e,t,n){let r=io(t,n),i=Re();if(!i)return r;let o=r.row>=0?r.row:co(t,n);if(o<0)return r;let s=t.filter(u=>u.row===o).map(u=>({col:u.col,text:(ze(u,n)??"").trim()})).filter(u=>u.text),a=new Map(s.map((u,p)=>[u.col,p])),l=new Map;for(let u of t){if(u.row<=o)continue;let p=a.get(u.col);if(p!==void 0){if(!l.has(u.row)){if(l.size>=so)continue;l.set(u.row,s.map(()=>""))}l.get(u.row)[p]=ze(u,n)??""}}let c=new Map(o===r.row?r.cols:[]),h=s.map(u=>u.text);for(let u of i({name:e,headers:h,rows:[...l.values()]})){let p=h.indexOf(u.column);p<0||c.set(s[p].col,{type:u.type,header:u.column,category:u.category,severity:u.severity,how:u.how})}return{row:o,cols:c}}function Gt(e){let t=pe(e);if(!t||t.length===0)return null;let n=o=>{let s=t.find(l=>l.name===o),a=s?he(e,s):null;return a?a.toString("utf8"):null},r=to(n("xl/sharedStrings.xml")),i=[];for(let o of t.filter(s=>oo.test(s.name))){let s=n(o.name),a=s?ro(s):null;if(!a)continue;let l=o.name.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),c=lo(l,a,r);for(let[h,u]of c.cols){let p=a.filter(x=>{let w=x.col===h&&x.row>c.row?(ze(x,r)??"").trim():"";return w!==""&&!ut(w)}).length;p>0&&i.push({...u,sheet:l,count:p})}}return i}var Ca=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let r=0;r<8;r+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();import{createHash as uo}from"node:crypto";var Zt=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,fo=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,po=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i,Jn=/(ENCRYPT|CIPHER|PII|DATA_?KEY|KMS|MASTER_?KEY|BLIND_?INDEX|VAULT_?KEY)/i,ho=12;var dt=class{byHash=new Map;add(t,n){for(let r of n.split(/\r?\n/)){let i=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(r);if(!i)continue;let o=i[1];if(!fo.test(o)||po.test(o))continue;let s=i[2].trim();if(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'")?s=s.slice(1,-1):s=s.replace(/\s+#.*$/,""),s.length<ho||/^\$\{?[A-Z_]+\}?$/.test(s))continue;let a=/^[a-z][a-z0-9+.-]*:\/\/[^:/@\s]+:([^@\s]+)@/i.exec(s);if(/^[a-z][a-z0-9+.-]*:\/\//i.test(s)&&!a)continue;let l=a?mo(a[1]):s;if(l.length<8)continue;let c=uo("sha256").update(l).digest("hex"),h=this.byHash.get(c)??[];h.some(u=>u.file===t&&u.name===o)||h.push({file:t,name:o}),this.byHash.set(c,h)}}groups(){let t=[];for(let n of this.byHash.values()){let r=[...new Set(n.map(s=>s.name))].sort(),i=[...new Set(n.map(s=>s.file))].sort();if(r.length<2&&i.length<2)continue;let o=r.some(s=>Jn.test(s));t.push({names:r,files:i,encryption:o&&r.some(s=>!Jn.test(s))})}return t}};function mo(e){try{return decodeURIComponent(e)}catch{return e}}function Yn(e){let t=[];e.names.length>1&&t.push(`one secret is used as ${e.names.length} variables (${e.names.join(", ")})`),e.files.length>1&&t.push(`${e.names.length===1?e.names[0]:"the same secret"} is copied in ${e.files.length} files (${e.files.join(", ")})`);let n=`Shared secret: ${t.join("; and ")}.`;return e.encryption?n+=" \u26A0 It is ALSO a data-encryption key: do NOT rotate it like a normal key \u2014 everything already encrypted with it would stop decrypting. First give the other uses their own new secret, then change the encryption key only in a planned re-encryption.":e.names.length>1?n+=" Replacing it breaks every use at once \u2014 give each use its own secret first, then retire the shared one.":n+=" Every copy has to be removed or updated when the key is replaced; keep one source (the vault) instead.",n}var ur={4:"critical",3:"high",2:"medium",1:"info"},Kt=10,ko=5e3,So=5e4,ge=64*1024*1024,pt=4*1024*1024,tr=500,nr=2,rr=512*1024*1024,Eo=1024*1024*1024,ir=5e3,Ao=()=>Math.max(0,Number(process.env.NODATA_OCR_MAX_IMAGES)||2e3),Io=()=>Math.max(10,Number(process.env.NODATA_SCAN_SECONDS)||480)*1e3,$o=5e3,To=2e3;var Ro=1024,Co=256*1024*1024,Lo=120,or=new lr("utf-8",{fatal:!0}),Po=new lr("windows-1255");function Oo(e){try{return or.decode(e)}catch{try{return or.decode(e.subarray(0,Math.max(0,e.length-3)))}catch{return Po.decode(e)}}}function Do(){return!ct()||!!process.env.NODATA_OCR_MODULE||bo(We(process.env.NODATA_OCR_DIR||We(vo(),".nodata","ocr"),"node_modules","tesseract.js"))}function sr(){let e=re();return!!e.pdftoppm&&!!e.tesseract&&e.ocrLangs.length>0}function No(e,t){let n=_o(e,"r");try{let r=Buffer.alloc(t),i=xo(n,r,0,t,0);return r.subarray(0,i)}finally{yo(n)}}var ar=new Set(["node_modules",".git",".hg",".svn"]),cr=new Set([".cache",".cargo",".rustup",".npm",".pnpm-store",".yarn",".gradle",".m2",".nuget",".conda",".pyenv",".rbenv",".nvm",".volta",".bun",".deno",".docker",".android",".vscode-server",".agents",".agent",".codeium",".continue","antigravity",".antigravity","__pycache__",".venv","venv","site-packages",".next",".turbo",".expo",".nx",".parcel-cache",".svelte-kit","appdata",".trash","$recycle.bin"].map(e=>e.toLowerCase())),Fo=/(^|\/)\.(vscode|cursor|windsurf|antigravity|vscode-server)\/extensions$/i;var qt=40,Mo=/^(agent|bot|model|service|tool|app|job|task|queue|test|qa|suite|runner|worker|host|server|project|repo|package|file|table|column|field)[_-]?name$/i,jo={critical:"high",high:"medium",medium:"low",low:"info",info:"info"},Ho=[{re:/\b\d{3}-\d{2}-\d{4}\b/,kind:"pii_unencrypted",subkind:"ssn",severity:"high",hint:"US Social Security Number pattern in plaintext."},{re:/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/i,kind:"pii_unencrypted",subkind:"email",severity:"low",hint:"Email addresses in plaintext."},{re:/(passport|teudat.?zehut|(?<![א-ת])תעודת.?זהות(?![א-ת])|(?<![א-ת])ת["'׳״]?\.?ז(?![א-ת]))/i,kind:"pii_unencrypted",subkind:"passport_keyword",severity:"low",hint:"Mentions the word passport / national ID \u2014 a word, not a number. The numbers themselves are reported by the ID rules."}],Uo=[{re:/(salary|payroll|משכורת|ssn|social.?security|passport|דרכון|תעודת.?זהות)/i,kind:"pii_unencrypted",subkind:"sensitive_filename",severity:"medium",hint:"Filename suggests sensitive PII content."},{re:/\.(env|env\.local|pem|key|p12|pfx)$/i,kind:"pii_unencrypted",subkind:"secret_file",severity:"high",hint:"File extension implies secret / credential bundle in plaintext."}];function Bo(e){let t=e.lastIndexOf(".");return t<0?"":e.slice(t).toLowerCase()}async function Jt(e){let t=Date.now(),n=[],r=new dt,i=new Map,o=[],s=0,a=0,l=0,c=0,h=e.time_budget_ms??Io(),u="",p=Date.now(),x=Date.now();async function w(){let d=Date.now();if(!(d-p<100)&&(p=d,await new Promise(_=>setImmediate(_)),e.onProgress&&d-x>=$o)){x=d;try{e.onProgress({walked:s,read:a,current:u})}catch{}}}let T=0,F=(d,_)=>d===0?!0:T+_>Co?!1:(T+=_,!0),b=[];function R(d,_,y,g){let $=f.not_read_by_format??={};$[y]=($[y]??0)+1,(f.not_read??=[]).length<tr&&f.not_read.push({path:d,cls:_,format:y,reason:g}),e.onFileChecked?.(d,!1)}let f={hit_file_cap:!1,hit_depth_cap:!1,max_files:Math.min(Math.max(1,e.max_files??ko),So),max_depth:Kt,tool_dirs_skipped:0,tool_dir_names:[],not_reached:[],skipped_by_extension:0,documents_extracted:0,documents_truncated:0,documents_unreadable:0,files_too_large:0,files_sampled_only:0,sample_bytes:pt};function W(d){return(d.startsWith(e.target_path)?d.slice(e.target_path.length).replace(/^[\\/]+/,"")||er(d):d).replace(/\\/g,"/")}function Y(d,_,y,g,$){let I=W(d);I!==""&&o.push({target_id:e.target_id,path:I,kind:_,size_bytes:y,modified_at:g?g.toISOString():null,child_count:$})}function Z(d,_){n.push({target_id:e.target_id,relative_path:d,finding_kind:_.kind,finding_subkind:_.subkind,severity:_.severity,remediation_hint:_.hint})}function G(d,_,y,g,$,I=!1){I&&At.test(d)?$=`${$??""} (In a test / sample file, but not a published test number \u2014 this looks real.)`.trim():_!=="hardcoded_secret"&&At.test(d)&&(y=jo[y],$=`${$??""} (Test / sample / minified file \u2014 probably sample data; check before acting.)`.trim()),n.push({target_id:e.target_id,relative_path:d,finding_kind:_,finding_subkind:g,severity:y,remediation_hint:$})}function ee(d,_){let y=_.replace(/\.[^.]+$/,"");if(/\d{7}/.test(y.replace(/[\s-]/g,"")))for(let g of Oe(y))G(d,"pii_unencrypted","high",`${g.subkind}_in_name`,`The FILE NAME holds ${g.count===1?"a":g.count} ${g.subkind.replace(/_/g," ")} value${g.count===1?"":"s"}. Anyone who sees the folder sees it, and a lock keeps the name: rename it first.`,(g.real??0)>0)}function le(d,_){if(s+=1,s>f.max_files){f.hit_file_cap=!0;return}let y=W(d);if(ee(y,_),Date.now()-t>=h){f.hit_time_cap=!0,f.time_skipped=(f.time_skipped??0)+1,R(y,"unknown","not reached (time limit)",`the scan's time limit (${Math.round(h/6e4)} min) was reached before this file \u2014 scan its folder on its own`);let v=(f.by_class??={}).unknown??={total:0,read:0};v.total+=1;return}let g=0,$;try{g=ft(d).size,$=No(d,lt)}catch{e.onFileChecked?.(y,!1);return}u=y;let I=Date.now();ue(y,_,g,$,v=>{let m=wo(d,{flag:"r"});return v&&m.length>v?m.subarray(0,v):m},0),ye(y,Date.now()-I)}function ye(d,_){if(_<To)return;let y=f.slow_files??=[];y.push({path:d,ms:_}),y.sort((g,$)=>$.ms-g.ms),y.length>5&&(y.length=5)}function rn(d,_,y){let g=pe(_);if(!g)return{ok:!1,reason:"a damaged archive \u2014 could not be opened"};let $=Eo,I=0;for(let v of g){if(v.name.endsWith("/"))continue;I+=1;let m=`${d}!/${v.name}`,S=v.name.split("/").pop()??v.name,A=O=>{let P=f.not_read_by_format??={};P["file inside an archive"]=(P["file inside an archive"]??0)+1,(f.not_read??=[]).length<tr&&f.not_read.push({path:m,cls:"archive",format:"file inside an archive",reason:O}),e.onFileChecked?.(m,!1)};if(Date.now()-t>=h){f.hit_time_cap=!0,A(`the scan's time limit (${Math.round(h/6e4)} min) was reached \u2014 the rest of the archive was not opened`);break}if(I>ir){A(`the archive holds more than ${ir} files \u2014 the rest were not opened`);break}if(v.flags&1){A("password-protected inside the archive \u2014 not read");continue}if(v.method!==0&&v.method!==8){A("compressed with a method NoData does not read");continue}let E=Math.min(ge,$);if(v.uncompSize>E){A($<ge?"the archive expands past the reading limit \u2014 the rest were not opened":`larger than ${ge/(1024*1024)} MB \u2014 not read`);continue}let M=he(_,v,E);if(!M){A("could not be unpacked (damaged, or larger than it claimed)");continue}$-=M.length,f.archive_entries=(f.archive_entries??0)+1,ue(m,S,M.length,M.subarray(0,lt),O=>O&&M.length>O?M.subarray(0,O):M,y+1)}return{ok:!0}}function ue(d,_,y,g,$,I){for(let D of Uo)D.re.test(_)&&Z(d,D);let v=Bo(_),m=zt(_,v,g),S=f.by_class??={},A=S[m.cls]??={total:0,read:0};A.total+=1;let E=D=>R(d,m.cls,m.format,D);if(m.cls==="archive"&&m.format==="zip archive"){if(I>=nr){E("an archive inside an archive inside an archive \u2014 not opened");return}if(y>rr){f.files_too_large+=1,E(`an archive larger than ${rr/(1024*1024)} MB \u2014 not opened`);return}let D;try{D=$()}catch{E("could not be opened (in use, or no permission)");return}let L=rn(d,D,I);L.ok?A.read+=1:E(L.reason);return}if(m.cls==="image"){if(!Lt[m.format]){E(m.format==="heic image"?"a HEIC photo \u2014 save it as JPEG to have its text read":m.reason??"not read");return}let D=Wt(g);if(y<Ro||D&&Math.max(D.w,D.h)<Lo){E("a small icon or thumbnail \u2014 no text to read");return}if(y>ge){f.files_too_large+=1,E(`larger than ${ge/(1024*1024)} MB \u2014 not read`);return}if(!it()&&!Do()){E(`an image \u2014 its text is read by OCR on this computer once Tesseract is installed (${ne})`);return}if(!F(I,y)){E("a picture inside an archive \u2014 the memory set aside for pictures from archives is used up; unpack the archive and scan it");return}b.push({kind:"image",rel:d,name:_,ext:v,format:m.format,load:$,row:A,size:y});return}if(!m.reader){m.cls==="document"?(f.documents_unreadable+=1,(f.unreadable_files??=[]).length<500&&(f.unreadable_files.push(d),(f.unreadable_reasons??={})[d]=m.reason??"not read")):f.skipped_by_extension+=1,E(m.reason??"not read");return}let M=m.reader==="document";if(M&&y>ge){f.files_too_large+=1,E(`larger than ${ge/(1024*1024)} MB \u2014 not read`);return}let O;try{O=M?$():$(pt)}catch{E("could not be opened (in use, or no permission)");return}let P,q=!1;if(M){let D=Hn(O,m.docExt??v,{ocr:!1});if(!D.ok&&(m.docExt??v)===".pdf"&&/scanned image/.test(D.reason)&&sr()&&F(I,y)){b.push({kind:"pdf",rel:d,name:_,ext:".pdf",format:m.format,load:$,row:A,size:y});return}if(!D.ok){f.documents_unreadable+=1,(f.unreadable_files??=[]).length<500&&(f.unreadable_files.push(d),(f.unreadable_reasons??={})[d]=D.reason),E(D.reason);return}let L=D.result;if((m.docExt??v)===".pdf"&&L.engine!=="ocr"&&kn(O,L.text)){if(sr()&&F(I,y)){b.push({kind:"pdf",rel:d,name:_,ext:".pdf",format:m.format,load:$,row:A,size:y,stamp:L.text});return}let V=`some of its pages are pictures (scanned): they need OCR, the rest was read. ${ne}`;q=!0,f.documents_unreadable+=1,(f.unreadable_files??=[]).length<500&&(f.unreadable_files.push(d),(f.unreadable_reasons??={})[d]=V),E(V)}if(P=L.text,q||(f.documents_extracted+=1),L.truncated&&(f.documents_truncated+=1),L.engine==="pdftotext"||L.engine==="ocr"){let V=f.documents_by_engine??={};V[L.engine]=(V[L.engine]??0)+1,L.engine==="ocr"&&(f.ocr_files??=[]).length<500&&f.ocr_files.push(d)}L.uncertain&&(f.uncertain_files??=[]).length<500&&f.uncertain_files.push(d);for(let V of L.attachments??[]){if(I>=nr)break;f.archive_entries=(f.archive_entries??0)+1,ue(`${d}!/${V.name}`,V.name,V.data.length,V.data.subarray(0,lt),te=>te&&V.data.length>te?V.data.subarray(0,te):V.data,I+1)}}else if(m.reader==="utf16le"||m.reader==="utf16be"){let D=O.subarray(O[0]===255||O[0]===254?2:0),L=D.subarray(0,D.length-D.length%2);P=m.reader==="utf16le"?L.toString("utf16le"):Buffer.from(L).swap16().toString("utf16le"),y>pt&&(f.files_sampled_only+=1)}else{let D=0;for(let L=0;L<O.length;L+=1)O[L]===0&&(D+=1);if(O.length>0&&D/O.length>.05){f.skipped_by_extension+=1,A.total-=1;let L=S.unknown??={total:0,read:0};L.total+=1,E("binary content under a text name \u2014 not read");return}P=Oo(O),y>pt&&(f.files_sampled_only+=1)}q||(a+=1,A.read+=1,e.onFileChecked?.(d,!0)),Te(d,_,v,P,M?O:null)}function Te(d,_,y,g,$){let I=$??Buffer.alloc(0),v=new Set;if(Zt.test(d)&&r.add(d,g),e.lexicon){let m=[];try{m=e.lexicon(g)}catch{}for(let S of m)n.push({target_id:e.target_id,relative_path:d,finding_kind:"custom_lexicon",finding_subkind:`lexicon:${S.term_id}`,severity:ur[S.tier]??"info",remediation_hint:`"${S.label}" \u2014 one of your scan terms, tier ${S.tier}: handle the file at that tier.`,hit_count:S.hit_count,label:S.label,tier:S.tier})}for(let m of Ho)if(m.re.test(g)){let S=`${m.subkind}::${d}`;v.has(S)||(v.add(S),Z(d,m))}for(let m of Oe(g,(S,A)=>{if(S!=="israeli_id"&&S!=="credit_card"&&S!=="iban")return;let E=go("sha256").update(`${S}:${A}`).digest("hex"),M=i.get(E)??new Set;M.add(d),i.set(E,M)})){let S=`validated::${m.subkind}::${d}`;v.has(S)||(v.add(S),G(d,"pii_unencrypted",m.severity,m.subkind,`${m.hint} ${m.count} distinct value${m.count===1?"":"s"} in this file.`,(m.real??0)>0))}if(!cn.test(d)){let m=Et(),S=g.split(`
38
38
  `),A=Math.min(S.length,2e3);for(let E=0;E<A;E++){let M=S[E];if(!M)continue;let O=M.trimStart();if(!(O.startsWith("//")||O.startsWith("/*")||O.startsWith("*")||O.startsWith("#"))&&!/process\.env/.test(M)&&!/\$\{[A-Z_]+/.test(M)){for(let P of m)if(P.pattern.test(M)){let q=`secret::${P.id}::${d}::${E+1}`;if(v.has(q))break;v.add(q);let D=ln.test(d);G(d,"hardcoded_secret",D?"critical":P.severity,P.id,D?`A real-looking ${P.name} in an EXAMPLE file near line ${E+1}. Example files are committed to Git and shared on purpose \u2014 rotate this key at its source and put a placeholder in the example.`:`Looks like a ${P.name} hardcoded near line ${E+1}. Move to an env var or secret manager.`);break}}}}if(_==="package.json"&&!d.includes("node_modules"))try{let S=un(g);for(let A of S){let E=`vuln::${A.name}::${d}`;v.has(E)||(v.add(E),G(d,"vulnerable_dependency",A.vuln.severity,A.name,`${A.name}@${A.version} is below ${A.vuln.below} (${A.vuln.cve} \xB7 ${A.vuln.desc}). Bump to ${A.vuln.below} or higher.`))}}catch{}if(y===".csv"||y===".tsv"){let m=y===".tsv"?" ":",",S=g.split(/\r?\n/);if(S.length>0){let A=De(S[0]??"",m),E=S.slice(1,51).map(O=>De(O??"",m)),M=Re();if(M){let O=S.slice(1,201).filter(P=>P!=="").map(P=>De(P,m));for(let P of M({name:"table",headers:A,rows:O})){let q=`header::${d}::${P.column}::${P.type}`;if(v.has(q))continue;let D=A.indexOf(P.column);D>=0&&O.length>0&&O.every(L=>!(L[D]??"").trim()||ut(L[D]??""))||(v.add(q),G(d,"pii_header_match",P.severity,`${P.type}:${P.column}`,`Column "${P.column}" holds ${P.category} (${P.how==="value"?`${P.hits} sampled values matched`:"by its header"}). Wrap with envelope or keep a clean copy for work.`))}}M||A.forEach((O,P)=>{let q=(O??"").trim();if(!q)return;let L=be(q)?.type??null;if(!L){let V=[];for(let Pr of E){let wt=Pr[P];if(wt&&wt.trim().length>0&&V.push(wt),V.length>=50)break}let te=C(V);te&&(L=te)}if(L){let V=Ve(L)??Ge[L]??"medium",te=`header::${d}::${q}::${L}`;if(v.has(te))return;v.add(te),G(d,"pii_header_match",V,`${L}:${q}`,`Column "${q}" looks like ${L} data. Wrap with envelope or move to a vault-backed reference.`)}})}}if(y===".xlsx"||y===".xlsm")for(let m of Gt(I)??[]){let S=`xlsxheader::${d}::${m.sheet}::${m.header}::${m.type}`;v.has(S)||(v.add(S),G(d,"pii_header_match",m.severity??Ve(m.type)??Ge[m.type]??"medium",`${m.type}:${m.header}`,`Column "${m.header}" (${m.sheet}) holds ${m.category??`${m.type} data`}${m.how==="value"?" (found by its values)":""} \u2014 ${m.count} filled cell${m.count===1?"":"s"}. Wrap with envelope or keep a clean copy for work.`))}if(y===".json"&&!_.endsWith(".nodata-proof.json"))try{let m=JSON.parse(g),S=Array.isArray(m)?m[0]:m;if(S&&typeof S=="object")for(let A of Object.keys(S)){let E=be(A);if(E){let M=E.type==="name"&&Mo.test(A),O=M?"low":Ve(E.type)??Ge[E.type]??"medium",P=`jsonkey::${d}::${A}::${E.type}`;if(v.has(P))continue;v.add(P),G(d,"pii_header_match",O,`${E.type}:${A}`,M?`JSON key "${A}" is usually the name of a system (an agent, bot or service), not a person \u2014 check if yours holds people.`:`JSON key "${A}" looks like ${E.type} data.`)}}}catch{}/\.(txt|log|md|csv|tsv|json|jsonl|xml|html?|yaml|yml|sql)$/i.test(_)&&k(g,d,v)}let de=Pe.find(d=>d.subkind==="israeli_phone");function k(d,_,y){let g=d.split(`
39
39
  `),$=Math.min(g.length,1e3),I=-1,v=-1,m=-1;for(let S=0;S<$;S++){let A=g[S]??"";if(m<0){let E=A.match(/\b\d{9}\b/);E&&Ze(E[0])&&!Ke(E[0])&&!Ce(E[0])&&(m=S+1)}if(I<0){de.pattern.lastIndex=0;for(let E of A.matchAll(de.pattern))if(de.validate(E[0])){I=S+1;break}}if(v<0&&(Le.lastIndex=0,Le.test(A)&&(v=S+1)),m>0&&I>0&&v>0)break}m>0&&!y.has(`ilid::${_}`)&&(y.add(`ilid::${_}`),G(_,"israeli_id_value","critical",`near_line:${m}`,`Israeli ID with valid Luhn checksum detected near line ${m}. Strong signal that real customer IDs are in plaintext.`,!0)),I>0&&!y.has(`ilphone::${_}`)&&(y.add(`ilphone::${_}`),G(_,"israeli_phone_value","high",`near_line:${I}`,`Israeli phone number detected near line ${I}.`)),v>0&&!y.has(`iliban::${_}`)&&(y.add(`iliban::${_}`),G(_,"israeli_iban_value","critical",`near_line:${v}`,`Israeli IBAN (IL prefix) detected near line ${v}.`))}function C(d){if(d.length===0)return null;let _=0,y=0,g=0;for(let I of d)typeof I=="string"&&(Ze(I)&&_++,It.lastIndex=0,It.test(I)&&y++,Le.lastIndex=0,Le.test(I)&&g++);let $=d.length;return _/$>=.3?"id":y/$>=.3?"phone":g/$>=.3?"financial":null}async function U(d,_){if(_>Kt){f.hit_depth_cap=!0;return}if(s>f.max_files){f.hit_file_cap=!0;return}let y;try{y=Qn(d)}catch{return}for(let g=0;g<y.length;g++){let $=y[g];if(s>f.max_files){f.hit_file_cap=!0;let m=W(d);m&&!f.not_reached.includes(`${m} (partly)`)&&f.not_reached.length<qt&&f.not_reached.push(`${m} (partly)`);for(let S of y.slice(g)){if(f.not_reached.length>=qt)break;try{ft(We(d,S)).isDirectory()&&!ar.has(S)&&!cr.has(S.toLowerCase())&&f.not_reached.push(W(We(d,S)))}catch{}}return}let I=We(d,$),v;try{v=ft(I)}catch{continue}if(!v.isSymbolicLink()){if(v.isDirectory()){if(ar.has($))continue;if(!e.include_tool_dirs&&(cr.has($.toLowerCase())||Fo.test(W(I)))){f.tool_dirs_skipped+=1,!f.tool_dir_names.includes($)&&f.tool_dir_names.length<qt&&f.tool_dir_names.push($);continue}let m=null;try{m=Qn(I).length}catch{m=null}Y(I,"folder",null,v.mtime??null,m),await U(I,_+1)}else if(v.isFile()){if(e.skip_own_file?.(W(I))){f.own_files_skipped=(f.own_files_skipped??0)+1;continue}Y(I,"file",v.size,v.mtime??null,null),le(I,$),await w()}}}}let B,N=null;try{let d=ft(e.target_path);B=d.isDirectory()||d.isFile(),d.isFile()&&(N={size:d.size,mtime:d.mtime??null})}catch{B=!1}if(!B)return{target_id:e.target_id,target_label:e.target_label,target_path:e.target_path,files_walked:0,files_inspected:0,duration_ms:Date.now()-t,findings:[],inventory:[],coverage:f,error:"target_path_not_found_or_not_directory"};if(e.log.info("folder-scanner: starting",{target_label:e.target_label,target_path:e.target_path,max_files:f.max_files,max_depth:Kt}),N?(Y(e.target_path,"file",N.size,N.mtime,null),le(e.target_path,er(e.target_path))):await U(e.target_path,0),b.length){b.sort((g,$)=>g.size-$.size),e.onProgress?.({walked:s,read:a,current:`reading ${b.length} picture(s) / scanned PDF(s)`});let d=null,_=()=>Date.now()-t>=h||l>=Ao(),y=g=>{f.hit_time_cap=!0,f.ocr_skipped=(f.ocr_skipped??0)+1,g.kind==="pdf"&&(f.documents_unreadable+=1,(f.unreadable_files??=[]).length<500&&f.unreadable_files.push(g.rel)),R(g.rel,g.kind==="pdf"?"document":"image",g.format,`${g.kind==="pdf"?"a scanned PDF":"a picture"} \u2014 the scan's time limit was reached before OCR got to it; scan its folder on its own`)};try{for(let g of b){if(_()){y(g);continue}u=g.rel,await w();let $=Date.now(),I=null,v="an image with no readable text (a photo, or text OCR could not make out)",m=!1;try{if(g.kind==="pdf"&&g.stamp!==void 0){let A=Ct(g.load()),E=A?.text?.trim();I=E?`${E}
40
- ${g.stamp}`:null,m=!!A?.truncated,v="a scanned PDF (pictures with a little text) that OCR could not read"}else if(g.kind==="pdf"){let A=Me(g.load(),{ocr:!0});I=A?.text?.trim()||null,m=!!A?.truncated,v="a scanned PDF OCR could not read"}else it()?I=Pt(g.load(),g.format):(d??=await Ut(),"error"in d?v=`an image \u2014 ${d.error}. Installing Tesseract also works (${ne})`:(d.ocr.note&&(f.ocr_note=d.ocr.note),f.ocr_engine="built-in",I=(await d.ocr.recognize(g.load())).trim()||null))}catch{I=null}if(l+=1,c+=Date.now()-$,ye(g.rel,Date.now()-$),!I){g.kind==="pdf"&&(f.documents_unreadable+=1,(f.unreadable_files??=[]).length<500&&f.unreadable_files.push(g.rel)),R(g.rel,g.kind==="pdf"?"document":"image",g.format,v);continue}let S=f.documents_by_engine??={};S.ocr=(S.ocr??0)+1,(f.ocr_files??=[]).length<500&&f.ocr_files.push(g.rel),g.kind==="pdf"&&(f.documents_extracted+=1),a+=1,g.row.read+=1,e.onFileChecked?.(g.rel,!0),Te(g.rel,g.name,g.ext,I,null),m&&(f.documents_truncated+=1,R(g.rel,"document",g.format,"only its first pages were read by OCR (the page cap): the rest were not read; raise NODATA_OCR_MAX_PAGES or scan it on its own"))}}finally{d&&!("error"in d)&&await d.ocr.close()}}let oe=new Map;for(let d of i.values())if(!(d.size<2))for(let _ of d){let y=oe.get(_)??new Set;for(let g of d)g!==_&&y.add(g);oe.set(_,y)}for(let d of n){let _=oe.get(d.relative_path);if(!_||d.finding_kind!=="pii_unencrypted"||!["israeli_id","credit_card","iban"].includes(d.finding_subkind??""))continue;let y=[..._].sort();d.remediation_hint=`${d.remediation_hint??""} The same value also appears in ${y.length} other file${y.length===1?"":"s"}: ${y.slice(0,5).join(", ")}${y.length>5?` \u2026 +${y.length-5}`:""} \u2014 likely one real person copied across files.`.trim()}for(let d of r.groups()){let _=Yn(d);for(let y of d.files)G(y,"secret_reuse",d.encryption?"critical":"high",d.encryption?"shared_encryption_key":d.names.length>1?"shared_secret":"copied_secret",_)}return{target_id:e.target_id,target_label:e.target_label,target_path:e.target_path,files_walked:s,files_inspected:a,duration_ms:Date.now()-t,findings:n,inventory:o,coverage:f}}var Yt={info(){}};var ac=Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=","base64");var Xo=["Put the new key where the app reads it (for a developer machine: the NoData vault + nodata_run, not a .env file).","Check that the app still works with the new key.","Only then delete / revoke the OLD key \u2014 until you do, whoever copied it can still use it."],j=(e,t,n)=>({provider:e,url:t,steps:[...n,...Xo]}),xc={"aws-access-key":j("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault)."]),"aws-secret-key":j("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault).","Mark the old key Inactive before deleting it."]),"gcp-api-key":j("Google Cloud","https://console.cloud.google.com/apis/credentials",["Open APIs & Services \u2192 Credentials.","Pick the key \u2192 Regenerate key (or create a new one and restrict it to the APIs you use)."]),"gcp-service-account":j("Google Cloud (service account)","https://console.cloud.google.com/iam-admin/serviceaccounts",["Open IAM & Admin \u2192 Service accounts \u2192 the account \u2192 Keys.","Add key \u2192 Create new key (JSON). Keep the file out of Git and out of shared folders."]),"firebase-key":j("Firebase / Google Cloud","https://console.cloud.google.com/apis/credentials",["A Firebase web key is meant to be public \u2014 restrict it instead: Credentials \u2192 the key \u2192 Application restrictions (your domains only).","If it is not a web key, regenerate it."]),"github-token":j("GitHub","https://github.com/settings/tokens",["Open Settings \u2192 Developer settings \u2192 Personal access tokens.","Generate a new token with only the scopes you need."]),"github-fine-grained":j("GitHub","https://github.com/settings/tokens?type=beta",["Open Fine-grained tokens.","Regenerate the token (or create a new one for only the repositories you need)."]),"gitlab-token":j("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":j("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys.","Roll the secret key (Stripe can keep the old one alive for a short overlap)."]),"stripe-restricted":j("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys \u2192 Restricted keys.","Roll the key, or create a new restricted key."]),"slack-token":j("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":j("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":j("Twilio","https://console.twilio.com/us1/account/keys-credentials/api-keys",["Open Account \u2192 API keys & tokens.","Create a new API key."]),"sendgrid-api-key":j("SendGrid","https://app.sendgrid.com/settings/api_keys",["Open Settings \u2192 API Keys.","Create a new key with only the permissions you need."]),"openai-key":j("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":j("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":j("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":j("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new SECRET key (a service_role / secret key bypasses every database rule \u2014 treat it like a root password).","Older projects with JWT keys: rotating the JWT secret replaces every key and signs everyone out \u2014 plan it."]),"supabase-access-token":j("Supabase (personal access token \u2014 reaches every project of the account)","https://supabase.com/dashboard/account/tokens",["Open Account \u2192 Access Tokens.","Revoke this token, then generate a new one only where it is needed (CLI, MCP) \u2014 prefer a read-only MCP."]),"supabase-secret-key":j("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new secret key, switch your servers to it, then delete this one."]),"postgres-uri":j("PostgreSQL (the password in the connection string)","https://supabase.com/dashboard/project/_/settings/database",["Change the database user's password: in Supabase \u2192 Project Settings \u2192 Database \u2192 Reset password; elsewhere, your host's console or ALTER USER \u2026 WITH PASSWORD.","Update the connection string with the new password."]),"mongodb-uri":j("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":j("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":j("Private key (SSH / TLS / signing)","",["Generate a new key pair.","Register the new PUBLIC key where the old one was trusted (server authorized_keys, certificate, service settings)."]),"jwt-secret":j("Your app's JWT secret","",["Set a new long random secret in the app's configuration.","Every signed-in user will be signed out \u2014 plan the moment."]),"password-in-code":j("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":j("An access token","",["Revoke the token in the service that issued it and issue a new one."])},wc=j("A credential","",["Find the service it belongs to and issue a new credential there."]);var Go=[{type:"id_number",patterns:[/\b\d{9}\b/g,/ת\.?ז\.?\s*:?\s*(\d{9})/g,/זהות\s*:?\s*(\d{9})/g],confidence:.9,replacement:()=>"[\u05EA.\u05D6. \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"phone",patterns:[/\b0[2-9]\d[\s\-]?\d{7}\b/g,/\b05[0-9][\s\-]?\d{7}\b/g,/\+972[\s\-]?[2-9]\d[\s\-]?\d{7}\b/g],confidence:.95,replacement:()=>"[\u05D8\u05DC\u05E4\u05D5\u05DF \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"email",patterns:[/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/g],confidence:.99,replacement:e=>{let[,t]=e.split("@");return`[\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC: ***@${t}]`}},{type:"full_name",patterns:[/(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק)[:\s]+([א-ת][א-ת"'\-\s]{2,30}?)(?=[,\n\d]|ת\.ז)/g,/(?:עו"ד|ד"ר|פרופ'|מר|גברת)\s+([א-ת][א-ת"'\-\s]{2,25}?)(?=[,\n])/g],confidence:.75,replacement:()=>"[\u05E9\u05DD \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"bank_account",patterns:[/\b\d{2}[\-]\d{5,9}[\-]\d{2,3}\b/g,/(?:חשבון|ח-ן)\s*:?\s*(\d[\d\-]{8,15})/g],confidence:.88,replacement:()=>"[\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"medical",patterns:[/(?<![א-ת])[בהוכלמש]{0,2}(?:סוכרת|יתר לחץ דם|אסתמה|דיכאון|חרדה|סרטן|אי ספיקת לב|אפילפסיה)(?![א-ת])/g,/\b(?:Metformin|Lisinopril|Atorvastatin|Amlodipine|Sertraline|Fluoxetine|Omeprazole|Warfarin|Aspirin|Insulin)\b/gi,/\bHbA1c\s*:?\s*[\d.]+%?/g,/\bBMI\s*:?\s*[\d.]+/g,/(?<![א-ת])[בהוכלמש]{0,2}אבחנ[הות]\s*:?\s*[^,\n.]{2,40}/g],confidence:.85,replacement:()=>"[\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"financial_amount",patterns:[/[\d,]+(?:\.\d{2})?\s*(?:₪|ש"ח|NIS|שקל(?:ים)?)/g,/(?:₪|NIS)\s*[\d,]+(?:\.\d{2})?/g],confidence:.92,replacement:()=>"[\u05E1\u05DB\u05D5\u05DD \u05DB\u05E1\u05E4\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"birth_date",patterns:[/(?:תאריך לידה|נולד|נולדה|ד\.ל\.)\s*:?\s*\d{1,2}[\/\.\-]\d{1,2}[\/\.\-]\d{2,4}/g,/(?<![א-ת])[בהוכלמש]{0,2}גיל\s*:?\s*\d{1,3}\b/g],confidence:.88,replacement:()=>"[\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"address",patterns:[/רחוב\s+[א-ת][א-ת\s"'\-]{2,30}\s+\d{1,5}/g,/(?:רח'|רח\.)\s+[א-ת][א-ת\s"'\-]{2,30}\d{1,5}/g],confidence:.72,replacement:()=>"[\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"},{type:"license_plate",patterns:[/\b\d{2,3}[\-]\d{2,3}[\-]\d{2,3}\b/g],confidence:.8,replacement:()=>"[\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"}];function Zo(e){if(e.length!==9)return!1;let t=e.split("").map(Number),n=0;for(let r=0;r<9;r++){let i=t[r]*(r%2===0?1:2);i>9&&(i-=9),n+=i}return n%10===0}var $e=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let n=[],r=new Set;for(let o of Go)if(this.enabledTypes.has(o.type))for(let s of o.patterns){let a=new RegExp(s.source,s.flags),l;for(;(l=a.exec(t))!==null;){let c=l[0],h=`${o.type}:${l.index}`;if(!r.has(h)){if(r.add(h),o.type==="id_number"){let u=c.replace(/\D/g,"");if(/^\d{9}$/.test(c)&&u.length===9&&!Zo(u))continue}n.push({type:o.type,value:c,startIndex:l.index,endIndex:l.index+c.length,confidence:o.confidence,replacement:o.replacement(c,o.type)})}}}n.sort((o,s)=>o.startIndex-s.startIndex||s.confidence-o.confidence);let i=[];for(let o of n)i.some(a=>o.startIndex<a.endIndex&&o.endIndex>a.startIndex)||i.push(o);return i}};var z=["GDPR","CPRA","PPL"],Ko=["GDPR-9","CPRA","PPL"],qo=[{id:"person_name",type:"name",sensitivity:"high",regulations:[...z],en:["firstname","lastname","fname","lname","middle name","maiden name","birth name","preferred name","display name","nickname","surname","given name","full name"],he:["\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0","\u05DB\u05D9\u05E0\u05D5\u05D9","\u05E9\u05DD \u05E0\u05E2\u05D5\u05E8\u05D9\u05DD"],ar:["\u0627\u0644\u0627\u0633\u0645","\u0627\u0633\u0645 \u0627\u0644\u0639\u0627\u0626\u0644\u0629","\u0627\u0644\u0627\u0633\u0645 \u0627\u0644\u0643\u0627\u0645\u0644"],ru:["\u0438\u043C\u044F","\u0444\u0430\u043C\u0438\u043B\u0438\u044F","\u043E\u0442\u0447\u0435\u0441\u0442\u0432\u043E","\u0444\u0438\u043E"]},{id:"birth_place",type:"location",sensitivity:"medium",regulations:[...z],en:["birth place","birthplace","place of birth"],he:["\u05DE\u05E7\u05D5\u05DD \u05DC\u05D9\u05D3\u05D4","\u05D0\u05E8\u05E5 \u05DC\u05D9\u05D3\u05D4"],ar:["\u0645\u0643\u0627\u0646 \u0627\u0644\u0645\u064A\u0644\u0627\u062F"],ru:["\u043C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F"]},{id:"citizenship",type:"sensitive_personal",sensitivity:"high",regulations:[...z],en:["citizenship","nationality"],he:["\u05D0\u05D6\u05E8\u05D7\u05D5\u05EA","\u05DC\u05D0\u05D5\u05DD"],ar:["\u0627\u0644\u062C\u0646\u0633\u064A\u0629"],ru:["\u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u043E"]},{id:"marital_status",type:"sensitive_personal",sensitivity:"high",regulations:[...z],en:["marital status"],he:["\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9"],ar:["\u0627\u0644\u062D\u0627\u0644\u0629 \u0627\u0644\u0627\u062C\u062A\u0645\u0627\u0639\u064A\u0629"],ru:["\u0441\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435"]},{id:"government_id",type:"id",sensitivity:"critical",regulations:[...z],en:["ssn","national id","passport","driver license","drivers license","tax id","social security","national insurance","military id","voter id","resident id","residence permit","visa number"],he:["\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4","\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7 \u05DC\u05D0\u05D5\u05DE\u05D9","\u05DE\u05E1\u05E4\u05E8 \u05D0\u05D9\u05E9\u05D9","\u05DE\u05E1\u05E4\u05E8 \u05D5\u05D9\u05D6\u05D4","\u05EA\u05E2\u05D5\u05D3\u05EA \u05EA\u05D5\u05E9\u05D1","\u05DE\u05E1\u05E4\u05E8 \u05E2\u05D5\u05E1\u05E7"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0647\u0648\u064A\u0629","\u062C\u0648\u0627\u0632 \u0627\u0644\u0633\u0641\u0631","\u0631\u062E\u0635\u0629 \u0627\u0644\u0642\u064A\u0627\u062F\u0629"],ru:["\u043F\u0430\u0441\u043F\u043E\u0440\u0442","\u0441\u043D\u0438\u043B\u0441","\u0438\u043D\u043D","\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0435 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u0435\u043D\u0438\u0435"]},{id:"institution_person_id",type:"tracking",sensitivity:"medium",regulations:[...z],en:["employee id","employee number","employee no","student id","student number","user id","userid","customer id","customer number","customer no","client id","member id","subscriber id","participant id","profile id","person id","person uuid","lead id","crm contact","account id"],he:["\u05DE\u05E1\u05E4\u05E8 \u05E2\u05D5\u05D1\u05D3","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D8\u05D5\u05D3\u05E0\u05D8","\u05DE\u05E1\u05E4\u05E8 \u05DC\u05E7\u05D5\u05D7","\u05DE\u05D6\u05D4\u05D4 \u05DC\u05E7\u05D5\u05D7","\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E0\u05D5\u05D9","\u05DE\u05D6\u05D4\u05D4 \u05DE\u05E9\u05EA\u05DE\u05E9"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0645\u0648\u0638\u0641","\u0631\u0642\u0645 \u0627\u0644\u0639\u0645\u064A\u0644"],ru:["\u0442\u0430\u0431\u0435\u043B\u044C\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440","\u043D\u043E\u043C\u0435\u0440 \u043A\u043B\u0438\u0435\u043D\u0442\u0430"]},{id:"patient_id",type:"medical",sensitivity:"critical",regulations:["GDPR-9","HIPAA","PPL"],en:["patient id","patient number","mrn","medical record number"],he:["\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D8\u05D5\u05E4\u05DC","\u05DE\u05E1\u05E4\u05E8 \u05EA\u05D9\u05E7 \u05E8\u05E4\u05D5\u05D0\u05D9"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0645\u0631\u064A\u0636"],ru:["\u043D\u043E\u043C\u0435\u0440 \u043F\u0430\u0446\u0438\u0435\u043D\u0442\u0430"]},{id:"email",type:"email",sensitivity:"high",regulations:[...z],en:["emailaddress","e mail","recovery email","contact email"],he:["\u05D3\u05D5\u05D0\u05DC","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"],ar:["\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A"],ru:["\u043F\u043E\u0447\u0442\u0430","\u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430","email"]},{id:"phone",type:"phone",sensitivity:"high",regulations:[...z],en:["cellphone","contact number","work phone","home phone","whatsapp","recovery phone","telephone"],he:["\u05D8\u05DC\u05E4\u05D5\u05DF \u05D1\u05D9\u05EA","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E2\u05D1\u05D5\u05D3\u05D4","\u05D5\u05D5\u05D8\u05E1\u05D0\u05E4","\u05DE\u05E1\u05E4\u05E8 \u05E0\u05D9\u05D9\u05D3"],ar:["\u0647\u0627\u062A\u0641","\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641","\u062C\u0648\u0627\u0644"],ru:["\u0442\u0435\u043B\u0435\u0444\u043E\u043D","\u043C\u043E\u0431\u0438\u043B\u044C\u043D\u044B\u0439"]},{id:"social_handle",type:"tracking",sensitivity:"medium",regulations:[...z],en:["telegram","linkedin","facebook","twitter","instagram","tiktok","social profile"],he:["\u05D8\u05DC\u05D2\u05E8\u05DD","\u05DC\u05D9\u05E0\u05E7\u05D3\u05D0\u05D9\u05DF","\u05E4\u05D9\u05D9\u05E1\u05D1\u05D5\u05E7","\u05D0\u05D9\u05E0\u05E1\u05D8\u05D2\u05E8\u05DD"]},{id:"address",type:"address",sensitivity:"high",regulations:[...z],en:["house number","apartment","apt","billing address","shipping address","postal code","zip code","postcode","street"],he:["\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05EA","\u05D3\u05D9\u05E8\u05D4","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DC\u05DE\u05E9\u05DC\u05D5\u05D7","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DC\u05D7\u05D9\u05D5\u05D1","\u05EA.\u05D3","\u05EA\u05D0 \u05D3\u05D5\u05D0\u05E8"],ar:["\u0627\u0644\u0639\u0646\u0648\u0627\u0646","\u0627\u0644\u0634\u0627\u0631\u0639","\u0627\u0644\u0631\u0645\u0632 \u0627\u0644\u0628\u0631\u064A\u062F\u064A"],ru:["\u0430\u0434\u0440\u0435\u0441","\u0443\u043B\u0438\u0446\u0430","\u0438\u043D\u0434\u0435\u043A\u0441","\u043A\u0432\u0430\u0440\u0442\u0438\u0440\u0430"]},{id:"geo",type:"location",sensitivity:"high",regulations:[...z],en:["geo location","geolocation","latitude","longitude","coordinates","home location","current location"],he:["\u05DE\u05D9\u05E7\u05D5\u05DD","\u05E7\u05D5\u05D0\u05D5\u05E8\u05D3\u05D9\u05E0\u05D8\u05D5\u05EA"],ar:["\u0627\u0644\u0645\u0648\u0642\u0639"],ru:["\u043C\u0435\u0441\u0442\u043E\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435","\u043A\u043E\u043E\u0440\u0434\u0438\u043D\u0430\u0442\u044B"]},{id:"bank_card",type:"financial",sensitivity:"critical",regulations:[...z],en:["bank account","iban","swift","bic","routing number","credit card","creditcard","card number","cvv","card expiry","cc exp","paypal","wallet address","crypto wallet","bitcoin address"],he:["\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9","\u05D0\u05E8\u05E0\u05E7 \u05E7\u05E8\u05D9\u05E4\u05D8\u05D5","\u05D0\u05E8\u05E0\u05E7 \u05D3\u05D9\u05D2\u05D9\u05D8\u05DC\u05D9"],ar:["\u062D\u0633\u0627\u0628 \u0628\u0646\u0643\u064A","\u0631\u0642\u0645 \u0627\u0644\u062D\u0633\u0627\u0628","\u0628\u0637\u0627\u0642\u0629 \u0627\u0626\u062A\u0645\u0627\u0646"],ru:["\u0440\u0430\u0441\u0447\u0435\u0442\u043D\u044B\u0439 \u0441\u0447\u0435\u0442","\u043D\u043E\u043C\u0435\u0440 \u0441\u0447\u0435\u0442\u0430","\u043D\u043E\u043C\u0435\u0440 \u043A\u0430\u0440\u0442\u044B","\u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430\u044F \u043A\u0430\u0440\u0442\u0430"]},{id:"income_tax",type:"financial",sensitivity:"high",regulations:[...z],en:["salary","income","wage","tax record","tax return","payment history","credit score","net worth","salary grade"],he:["\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4","\u05EA\u05DC\u05D5\u05E9 \u05E9\u05DB\u05E8","\u05D3\u05D5\u05D7 \u05DE\u05E1","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05EA\u05E9\u05DC\u05D5\u05DE\u05D9\u05DD","\u05D3\u05D9\u05E8\u05D5\u05D2 \u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05D5\u05D5\u05D9 \u05E0\u05E7\u05D9","\u05D3\u05E8\u05D2\u05EA \u05E9\u05DB\u05E8"],ar:["\u0627\u0644\u0631\u0627\u062A\u0628","\u0627\u0644\u062F\u062E\u0644"],ru:["\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430","\u0434\u043E\u0445\u043E\u0434"]},{id:"assets",type:"financial",sensitivity:"high",regulations:[...z],en:["property id","land record","ownership record","title deed","holdings"],he:["\u05D2\u05D5\u05E9 \u05D7\u05DC\u05E7\u05D4","\u05E0\u05E1\u05D7 \u05D8\u05D0\u05D1\u05D5","\u05E8\u05D9\u05E9\u05D5\u05DD \u05DE\u05E7\u05E8\u05E7\u05E2\u05D9\u05DF","\u05D1\u05E2\u05DC\u05D5\u05EA","\u05D0\u05D7\u05D6\u05E7\u05D5\u05EA"],ru:["\u0441\u043E\u0431\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0441\u0442\u044C","\u043D\u0435\u0434\u0432\u0438\u0436\u0438\u043C\u043E\u0441\u0442\u044C"]},{id:"vehicle",type:"tracking",sensitivity:"medium",regulations:[...z],en:["vin","vehicle id","license plate","registration number","plate number"],he:["\u05DE\u05E1\u05E4\u05E8 \u05E9\u05DC\u05D3\u05D4","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1","\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9"],ru:["\u043D\u043E\u043C\u0435\u0440 \u0430\u0432\u0442\u043E\u043C\u043E\u0431\u0438\u043B\u044F","vin"]},{id:"health",type:"medical",sensitivity:"critical",regulations:["GDPR-9","HIPAA","PPL"],en:["medical record","health condition","health data","lab result","lab results","vaccination","mental health","hospitalization","hospitalisation","disability","insurance number","diagnosis","allergy","prescription","medication","blood type"],he:["\u05EA\u05D9\u05E7 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05DE\u05E2\u05D1\u05D3\u05D4","\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05D1\u05D3\u05D9\u05E7\u05D4","\u05D7\u05D9\u05E1\u05D5\u05E0\u05D9\u05DD","\u05D1\u05E8\u05D9\u05D0\u05D5\u05EA \u05E0\u05E4\u05E9","\u05D0\u05E9\u05E4\u05D5\u05D6","\u05E0\u05DB\u05D5\u05EA","\u05DE\u05E6\u05D1 \u05D1\u05E8\u05D9\u05D0\u05D5\u05EA\u05D9"],ar:["\u0627\u0644\u062A\u0634\u062E\u064A\u0635","\u0627\u0644\u0633\u062C\u0644 \u0627\u0644\u0637\u0628\u064A","\u0627\u0644\u0623\u062F\u0648\u064A\u0629"],ru:["\u0434\u0438\u0430\u0433\u043D\u043E\u0437","\u043C\u0435\u0434\u0438\u0446\u0438\u043D\u0441\u043A\u0430\u044F \u043A\u0430\u0440\u0442\u0430","\u0430\u043D\u0430\u043B\u0438\u0437\u044B"]},{id:"biometric",type:"biometric",sensitivity:"critical",regulations:["GDPR-9","CPRA","PPL"],en:["face embedding","face scan","iris scan","retina scan","voice print","voiceprint","voice signature","hand geometry","biometric template","biometric data","dna","genetic data","genome"],he:["\u05D8\u05D1\u05D9\u05E2\u05EA \u05E7\u05D5\u05DC","\u05E1\u05E8\u05D9\u05E7\u05EA \u05E4\u05E0\u05D9\u05DD","\u05E1\u05E8\u05D9\u05E7\u05EA \u05E7\u05E9\u05EA\u05D9\u05EA","\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05D2\u05E0\u05D8\u05D9\u05D9\u05DD",'\u05D3\u05E0"\u05D0'],ar:["\u0628\u0635\u0645\u0629"],ru:["\u0431\u0438\u043E\u043C\u0435\u0442\u0440\u0438\u044F","\u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043E\u043A"]},{id:"employment",type:"employment",sensitivity:"medium",regulations:[...z],en:["employer","job title","employment status","hire date","start date of employment","termination date","performance review","disciplinary"],he:["\u05DE\u05E2\u05E1\u05D9\u05E7","\u05DE\u05E7\u05D5\u05DD \u05E2\u05D1\u05D5\u05D3\u05D4","\u05EA\u05E4\u05E7\u05D9\u05D3 \u05D4\u05E2\u05D5\u05D1\u05D3","\u05EA\u05D0\u05E8\u05D9\u05DA \u05EA\u05D7\u05D9\u05DC\u05EA \u05E2\u05D1\u05D5\u05D3\u05D4","\u05EA\u05D0\u05E8\u05D9\u05DA \u05E1\u05D9\u05D5\u05DD \u05E2\u05D1\u05D5\u05D3\u05D4","\u05D4\u05E2\u05E8\u05DB\u05EA \u05D1\u05D9\u05E6\u05D5\u05E2\u05D9\u05DD","\u05E9\u05D9\u05DE\u05D5\u05E2"],ar:["\u062C\u0647\u0629 \u0627\u0644\u0639\u0645\u0644","\u0627\u0644\u0645\u0633\u0645\u0649 \u0627\u0644\u0648\u0638\u064A\u0641\u064A"],ru:["\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044C","\u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C"]},{id:"manager",type:"name",sensitivity:"medium",regulations:[...z],en:["manager","supervisor"],he:["\u05DE\u05E0\u05D4\u05DC \u05D9\u05E9\u05D9\u05E8"]},{id:"education",type:"education",sensitivity:"medium",regulations:[...z],en:["school","university","college","degree","transcript","education history","gpa"],he:["\u05D1\u05D9\u05EA \u05E1\u05E4\u05E8","\u05D0\u05D5\u05E0\u05D9\u05D1\u05E8\u05E1\u05D9\u05D8\u05D4","\u05DE\u05DB\u05DC\u05DC\u05D4","\u05D2\u05D9\u05DC\u05D9\u05D5\u05DF \u05E6\u05D9\u05D5\u05E0\u05D9\u05DD","\u05D4\u05E9\u05DB\u05DC\u05D4","\u05EA\u05D5\u05D0\u05E8 \u05D0\u05E7\u05D3\u05DE\u05D9"],ar:["\u0627\u0644\u062C\u0627\u0645\u0639\u0629","\u0627\u0644\u0645\u062F\u0631\u0633\u0629"],ru:["\u043E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435","\u0443\u043D\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442"]},{id:"device_online",type:"tracking",sensitivity:"medium",regulations:[...z],en:["ip","ipaddress","ip address","mac address","device id","deviceid","advertising id","idfa","gaid","android id","apple id","cookie id","cookieid","browser fingerprint","user agent","imei"],he:["\u05DB\u05EA\u05D5\u05D1\u05EA ip","\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"],ru:["ip \u0430\u0434\u0440\u0435\u0441"]},{id:"account",type:"tracking",sensitivity:"medium",regulations:[...z],en:["username","user name","login","screen name"],he:["\u05E9\u05DD \u05DE\u05E9\u05EA\u05DE\u05E9"],ru:["\u043B\u043E\u0433\u0438\u043D"]},{id:"credential",type:"auth",sensitivity:"critical",regulations:[...z],en:["password","password hash","mfa secret","otp secret","security question","security answer","session id","session token","api key"],he:["\u05E1\u05D9\u05E1\u05DE\u05D4","\u05E1\u05D9\u05E1\u05DE\u05D0","\u05E9\u05D0\u05DC\u05EA \u05D0\u05D1\u05D8\u05D7\u05D4"],ar:["\u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631"],ru:["\u043F\u0430\u0440\u043E\u043B\u044C"]},{id:"behavior",type:"behavior",sensitivity:"high",regulations:[...z],en:["purchase history","search history","browsing history","clickstream","usage pattern","behavior profile","behaviour profile"],he:["\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E8\u05DB\u05D9\u05E9\u05D5\u05EA","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05D7\u05D9\u05E4\u05D5\u05E9","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05D2\u05DC\u05D9\u05E9\u05D4","\u05E4\u05E8\u05D5\u05E4\u05D9\u05DC \u05D4\u05EA\u05E0\u05D4\u05D2\u05D5\u05EA"]},{id:"special_category",type:"sensitive_personal",sensitivity:"critical",regulations:[...Ko],en:["race","ethnicity","religion","political opinion","political party","union membership","trade union","sexual orientation","gender identity","criminal record"],he:["\u05D2\u05D6\u05E2","\u05D3\u05EA","\u05D4\u05E9\u05E7\u05E4\u05D4 \u05E4\u05D5\u05DC\u05D9\u05D8\u05D9\u05EA","\u05D7\u05D1\u05E8\u05D5\u05EA \u05D1\u05D0\u05D9\u05D2\u05D5\u05D3","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA","\u05D6\u05D4\u05D5\u05EA \u05DE\u05D2\u05D3\u05E8\u05D9\u05EA","\u05E8\u05D9\u05E9\u05D5\u05DD \u05E4\u05DC\u05D9\u05DC\u05D9"],ar:["\u0627\u0644\u062F\u064A\u0627\u0646\u0629","\u0627\u0644\u0639\u0631\u0642"],ru:["\u0440\u0435\u043B\u0438\u0433\u0438\u044F","\u043D\u0430\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E\u0441\u0442\u044C"]},{id:"family_names",type:"name",sensitivity:"high",regulations:[...z],en:["mother name","father name","spouse","partner name","emergency contact","next of kin","family member","guardian","beneficiary"],he:["\u05E9\u05DD \u05D4\u05D0\u05DD","\u05E9\u05DD \u05D4\u05D0\u05D1","\u05D1\u05DF \u05D6\u05D5\u05D2","\u05D1\u05EA \u05D6\u05D5\u05D2","\u05D0\u05D9\u05E9 \u05E7\u05E9\u05E8 \u05DC\u05D7\u05D9\u05E8\u05D5\u05DD","\u05E7\u05E8\u05D5\u05D1 \u05DE\u05E9\u05E4\u05D7\u05D4","\u05D0\u05E4\u05D5\u05D8\u05E8\u05D5\u05E4\u05D5\u05E1","\u05DE\u05D5\u05D8\u05D1"],ar:["\u0627\u0633\u0645 \u0627\u0644\u0623\u0645","\u0627\u0633\u0645 \u0627\u0644\u0623\u0628","\u0627\u0644\u0632\u0648\u062C"],ru:["\u0441\u0443\u043F\u0440\u0443\u0433","\u043E\u043F\u0435\u043A\u0443\u043D"]},{id:"children",type:"minor_data",sensitivity:"critical",regulations:[...z],en:["children","child name","dependents","dependants"],he:["\u05D9\u05DC\u05D3\u05D9\u05DD","\u05E9\u05DE\u05D5\u05EA \u05D4\u05D9\u05DC\u05D3\u05D9\u05DD"],ar:["\u0627\u0644\u0623\u0637\u0641\u0627\u0644"],ru:["\u0434\u0435\u0442\u0438"]}];function Jo(e){return e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim()}function hr(){return qo.map(e=>{let t=[...e.en,...e.he??[],...e.ar??[],...e.ru??[]].map(Jo).filter(Boolean);return{type:e.type,tokens:t.filter(n=>!n.includes(" ")),phrases:t.filter(n=>n.includes(" "))}})}var Yo=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם_אדם|שם הלקוח|שם_הלקוח|שם בן זוג|שם בן_זוג|שם המבוטח|שם_המבוטח|שם המוטב|שם_המוטב|שם מבוטח|שם_מבוטח|שם מוטב|שם_מוטב|שם הילד|שם_הילד|שם הקטין|שם_הקטין|firstname_he|lastname_he|shem|shem_mishpacha|shem_prati)$/i,type:"name",label:"Person name (Hebrew)",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מספר_זהות|מס' זהות|מס_זהות|מס' ת"ז|teudat_zehut|tz|t_z|israeli_id|il_id)$/i,type:"id",label:"Israeli ID",labelHe:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|מס דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה|מס רישיון|דרכון_מספר)$/i,type:"id",label:"Passport / DL (Hebrew)",labelHe:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|דואר_אלקטרוני|אימייל|כתובת מייל|כתובת_מייל|כתובת דואר|כתובת_דואר)$/i,type:"email",label:"Email (Hebrew)",labelHe:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|מספר_טלפון|טלפון נייד|טלפון_נייד|מס נייד|מס_נייד|מס' טל)$/i,type:"phone",label:"Phone (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|כתובת_מגורים|רחוב|מס בית|מספר בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|כתובת_מלאה|מען)$/i,type:"address",label:"Address (Hebrew)",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|תאריך_לידה|ת לידה|תאריך הולדת|תאריך_הולדת|יום הולדת|יום_הולדת|גיל)$/i,type:"dob",label:"Date of birth (Hebrew)",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|חשבון_בנק|מספר חשבון|מספר_חשבון|מס חשבון|מס' חשבון|בנק|סניף|מס סניף|iban|iban_il)$/i,type:"financial",label:"Bank account (Hebrew)",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|כרטיס_אשראי|מספר אשראי|מס אשראי|מס' אשראי|cvv|אשראי|מס כרטיס|מס_כרטיס)$/i,type:"financial",label:"Credit card (Hebrew)",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר_ברוטו|שכר נטו|שכר_נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"Salary / income (Hebrew)",labelHe:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|בדיקה_רפואית|מצב רפואי|מצב_רפואי|חיסון|תוצאת בדיקה|תוצאת_בדיקה|רופא|רגישות|אלרגיה|סוג דם|סוג_דם)$/i,type:"medical",label:"Medical (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מספר_פוליסה|מס פוליסה|מס' פוליסה|פוליסה|מספר חבר|מספר_חבר|מס חבר|מספר ביטוח|מספר_ביטוח|policy_?number|policy_?no|policy_?id)$/i,type:"policy",label:"Insurance policy number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"},{pattern:/^(?:מספר סוכן|מספר_סוכן|מס סוכן|מס' סוכן|מס_סוכן|קוד סוכן|קוד_סוכן|מספר משווק|מספר_משווק|מספר יצרן|סוכן ביטוח|agent_?number|agent_?no|agent_?id|agent_?code|broker_?id|broker_?number)$/i,type:"agent_id",label:"Insurance agent / broker number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"},{pattern:/^(?:שם הילד|שם_הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|מספר_ילדים|תעודת לידה|ת לידה ילד)$/i,type:"minor_data",label:"Minor data (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|נטייה_מינית|השקפה פוליטית|השקפה_פוליטית|מצב משפחתי|מצב_משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"Sensitive personal (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מספר_רכב|מס רכב|מס' רכב|לוחית רישוי|לוחית_רישוי|מספר רישוי|מספר_רישוי)$/i,type:"tracking",label:"Vehicle ID (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}];function Qt(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let n=t.padStart(9,"0"),r=0;for(let i=0;i<9;i++){let o=parseInt(n[i]??"0",10)*(i%2+1);o>9&&(o-=9),r+=o}return r%10===0&&parseInt(n,10)>0}var ht=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,mt=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,gt=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function mr(e){let t=String(e??"").replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let n=0,r=!1;for(let i=t.length-1;i>=0;i--){let o=t.charCodeAt(i)-48;if(o<0||o>9)return!1;r&&(o*=2,o>9&&(o-=9)),n+=o,r=!r}return n%10===0}function gr(e){if(!e)return null;let t=e.trim();for(let n of Yo)if(n.pattern.test(t))return{type:n.type,label:n.label,labelHe:n.labelHe};return null}var Qo=[{type:"biometric",tokens:["biometric","fingerprint","\u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"],phrases:["face id","\u05D8\u05D1\u05D9\u05E2\u05EA \u05D0\u05E6\u05D1\u05E2"]},{type:"medical",tokens:["diagnosis","medical","disease","medication","prescription","allergy","vaccine","\u05D0\u05D1\u05D7\u05D5\u05DF","\u05D0\u05D1\u05D7\u05E0\u05D4","\u05DE\u05D7\u05DC\u05D4","\u05EA\u05E8\u05D5\u05E4\u05D4","\u05DE\u05E8\u05E9\u05DD","\u05D7\u05D9\u05E1\u05D5\u05DF","\u05D0\u05DC\u05E8\u05D2\u05D9\u05D4"],phrases:["medical record","blood type","\u05DE\u05E6\u05D1 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05E1\u05D5\u05D2 \u05D3\u05DD"]},{type:"sensitive_personal",tokens:["religion","ethnicity","nationality","\u05D3\u05EA","\u05DC\u05D0\u05D5\u05DD","\u05E2\u05D3\u05D4","\u05DE\u05D5\u05E6\u05D0"],phrases:["sexual orientation","marital status","\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA"]},{type:"minor_data",tokens:["minor","\u05E7\u05D8\u05D9\u05DF"],phrases:["child name","\u05E9\u05DD \u05D4\u05D9\u05DC\u05D3","\u05E9\u05DD \u05D4\u05E7\u05D8\u05D9\u05DF"]},{type:"id",tokens:["ssn","passport","\u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF"],phrases:["national id","id number","identity number","social security","driver license","driving license","drivers license","passport number","tax id","\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4\u05D5\u05EA","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"]},{type:"financial",tokens:["iban","swift","bic","salary","income","wage","\u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4"],phrases:["bank account","account number","credit card","card number","routing number","sort code","\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"]},{type:"policy",tokens:["policy","\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"],phrases:["policy number","member number","\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"]},{type:"agent_id",tokens:["\u05DE\u05E9\u05D5\u05D5\u05E7"],phrases:["agent number","agent code","broker id","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"]},{type:"dob",tokens:["dob","birthdate","birthday","\u05DC\u05D9\u05D3\u05D4","\u05D4\u05D5\u05DC\u05D3\u05EA","\u05D2\u05D9\u05DC"],phrases:["date of birth","birth date","\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"]},{type:"phone",tokens:["phone","tel","mobile","cell","fax","\u05D8\u05DC\u05E4\u05D5\u05DF","\u05E0\u05D9\u05D9\u05D3","\u05E4\u05DC\u05D0\u05E4\u05D5\u05DF","\u05E1\u05DC\u05D5\u05DC\u05E8\u05D9"],phrases:["phone number","mobile number","cell phone","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E0\u05D9\u05D9\u05D3"]},{type:"email",tokens:["email","mail","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC","\u05DE\u05D9\u05D9\u05DC","\u05D3\u05D5\u05D0\u05DC"],phrases:["email address","e mail","\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D9\u05D9\u05DC"]},{type:"address",tokens:["address","street","city","zipcode","zip","postcode","\u05DB\u05EA\u05D5\u05D1\u05EA","\u05E8\u05D7\u05D5\u05D1","\u05E2\u05D9\u05E8","\u05D9\u05E9\u05D5\u05D1","\u05D9\u05D9\u05E9\u05D5\u05D1","\u05DE\u05D9\u05E7\u05D5\u05D3","\u05DE\u05E2\u05DF"],phrases:["home address","postal code","street address","zip code","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D2\u05D5\u05E8\u05D9\u05DD"]},{type:"location",tokens:["gps","latitude","longitude","geolocation","\u05DE\u05D9\u05E7\u05D5\u05DD"],phrases:["gps coordinates"]},{type:"tracking",tokens:["plate","vehicle","\u05E8\u05DB\u05D1","\u05E8\u05D9\u05E9\u05D5\u05D9"],phrases:["license plate","vehicle number","plate number","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"]},...hr(),{type:"name",tokens:["name","\u05E9\u05DD"],phrases:["first name","last name","full name","family name","given name","surname","\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0"]}];function yt(e){if(!e||/^\[[A-Z_]+(?:-\d+)?\]$/.test(e.trim()))return null;let t=e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim();if(!t)return null;let n=new Set(t.match(/[\p{L}\p{N}]+/gu)??[]);for(let r of Qo)if(r.phrases?.some(o=>t.includes(o))||r.tokens?.some(o=>n.has(o)))return{type:r.type,label:r.type,labelHe:bt(r.type)};return null}function bt(e){return{id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",employment:"\u05E4\u05E8\u05D8\u05D9 \u05EA\u05E2\u05E1\u05D5\u05E7\u05D4",education:"\u05D4\u05E9\u05DB\u05DC\u05D4",behavior:"\u05E4\u05E8\u05D5\u05E4\u05D9\u05DC \u05D4\u05EA\u05E0\u05D4\u05D2\u05D5\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",name:"\u05E9\u05DD \u05D0\u05D3\u05DD",email:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9",phone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",financial:"\u05E4\u05E8\u05D8\u05D9\u05DD \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9\u05D9\u05DD",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",minor_data:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF",sensitive_personal:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9",biometric:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9",auth:"\u05E1\u05D9\u05E1\u05DE\u05D0\u05D5\u05EA/\u05E1\u05D5\u05D3\u05D5\u05EA",tracking:"\u05DE\u05D6\u05D4\u05D9 \u05DE\u05E2\u05E7\u05D1",location:"\u05DE\u05D9\u05E7\u05D5\u05DD"}[e]??"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9"}function yr(e){let t=0,n=0,r=0,i=0,o=0;for(let a of e)typeof a=="string"&&(Qt(a)&&t++,ht.lastIndex=0,ht.test(a)&&n++,mt.lastIndex=0,mt.test(a)&&r++,gt.lastIndex=0,gt.test(a)&&i++,mr(a)&&o++);let s=e.length||1;return t/s>=.3?{type:"id",label:"Israeli ID (sniffed)",matchedSample:t}:i/s>=.3?{type:"financial",label:"IBAN-IL (sniffed)",matchedSample:i}:n/s>=.3?{type:"phone",label:"IL phone (sniffed)",matchedSample:n}:r/s>=.3?{type:"email",label:"Email (sniffed)",matchedSample:r}:o/s>=.3?{type:"financial",label:"Credit card (sniffed)",matchedSample:o}:null}var es=[{type:"full_name",kind:"name",severity:"medium",hint:`A person's name in free text (after a role word such as \u05DC\u05E7\u05D5\u05D7 / \u05DE\u05E8 / \u05E2\u05D5"\u05D3, or Client: / Mr.).`},{type:"bank_account",kind:"bank_account",severity:"high",hint:"An Israeli bank account number (branch-account-check form) in plaintext."},{type:"medical",kind:"medical",severity:"high",hint:"Medical information (diagnosis, medication, lab value) in plaintext."},{type:"birth_date",kind:"dob",severity:"medium",hint:"A date of birth in plaintext."},{type:"address",kind:"address",severity:"medium",hint:"A street address in plaintext."},{type:"license_plate",kind:"plate",severity:"low",hint:"A vehicle licence plate in plaintext."}],ts=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function ns(e,t,n,r){if(r==="address")return{start:t,end:n};let i=ts.exec(e.slice(t,n));return i&&t+i[0].length<n?{start:t+i[0].length,end:n}:{start:t,end:n}}function ie(e,t,n=()=>!0){let r=[],i=new RegExp(e.source,e.flags.includes("g")?e.flags:e.flags+"g");for(let o of t.matchAll(i)){let s=o[1];if(!s||!n(s))continue;let a=(o.index??0)+o[0].indexOf(s);r.push({start:a,end:a+s.length})}return r}var br=String.raw`[A-Z][a-z']+(?:-[A-Z]?[a-z']+)*`,en=String.raw`${br}(?:[ \t]+${br}){0,2}`,rs=new RegExp(String.raw`\b(?:Mr|Mrs|Ms|Miss|Dr|Prof)\.?[ \t]+(${en})`),is=new RegExp(String.raw`\b(?:Client|Customer|Patient|Name|Full name|Beneficiary|Insured|Applicant|Tenant|Employee|Holder|Investor)[ \t]*:[ \t]*(${en})`),os=new RegExp(String.raw`\b(${en})(?=,[ \t]*\d{1,3}[ \t]*,|[ \t]*\(\d{1,3}\))`,"g"),ss=/^(?:Figure|Fig|Table|Step|Section|Chapter|Page|Shot|Scene|Part|Item|Note|Appendix|Version|Level|Phase|Round|Room|Floor|Line|Act|Episode|Season|Slide|Clip|Take)$/,as=/\b(\d{1,5}[ \t]+(?:[A-Z][A-Za-z'-]*[ \t]+){1,3}(?:Street|St|Road|Rd|Avenue|Ave|Boulevard|Blvd|Lane|Ln|Drive|Way|Court|Ct|Place|Pl)\b\.?)/,cs=/\b(?:policy|claim|account|member|customer|client|contract|case|reference|ref|company|registration)[ \t]+(?:number|no\.?|num\.?|#)[ \t]*:?[ \t]*([A-Z]{0,4}-?\d[\d-]{3,}\d[A-Z]?)\b/i,ls=String.raw`\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}|\d{4}[\/\-.]\d{1,2}[\/\-.]\d{1,2}|\d{1,2}\s+[A-Z][a-z]{2,8}\s+\d{4}|[A-Z][a-z]{2,8}\s+\d{1,2},?\s+\d{4}`,us=new RegExp(String.raw`\b(?:date\s+of\s+birth|birth\s*date|d\.?o\.?b\.?|born(?:\s+on)?)\s*[:\-]?\s*(${ls})`,"i"),ds=/\b((?!000|666|9\d\d)\d{3}-(?!00)\d{2}-(?!0000)\d{4})\b/,fs=/\b((?!BG|GB|NK|KN|TN|NT|ZZ)[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z]\s?\d{2}\s?\d{2}\s?\d{2}\s?[A-D])\b/,ps=/(?<![\w+])(\+(?!972)[1-9][\d\s().-]{7,20}\d)/,_r=e=>e.replace(/\D/g,"").length,hs=[{kind:"name",severity:"medium",hint:"A person's name in free text (after Mr. / Dr. / Client: \u2026, or with an age beside it).",find:e=>[...ie(rs,e),...ie(is,e),...ie(os,e,t=>!ss.test(t.split(/[ \t]/).pop()??""))]},{kind:"address",severity:"medium",hint:"A street address in plaintext.",find:e=>ie(as,e)},{kind:"reference",severity:"medium",hint:"A policy, claim, account or company number in plaintext.",find:e=>ie(cs,e)},{kind:"dob",severity:"medium",hint:"A date of birth in plaintext.",find:e=>ie(us,e)},{kind:"national_id",severity:"high",hint:"A national ID number (US SSN, UK NINO) in plaintext.",find:e=>[...ie(ds,e),...ie(fs,e)]},{kind:"phone",severity:"high",hint:"A phone number in international form in plaintext.",find:e=>ie(ps,e,t=>_r(t)>=8&&_r(t)<=15)}];function ms(e){let t=new Map;for(let n of e){let r=t.get(n.kind);t.set(n.kind,r?{...r,find:i=>[...r.find(i),...n.find(i)]}:n)}return[...t.values()]}function xr(){let e=es.map(({type:t,kind:n,severity:r,hint:i})=>{let o=new $e([t]);return{kind:n,severity:r,hint:i,find:s=>o.detect(s).map(a=>ns(s,a.startIndex,a.endIndex,n))}});return ms([...e,...hs])}var _t={_comment:"CANONICAL secret ruleset \u2014 the SINGLE SOURCE OF TRUTH for hardcoded-secret detection, loaded by BOTH the web scanner (lib/soc/exposure-map.ts) and the installed Capsule agent (apps/desktop/src-tauri/src/scanner.rs, via include_str!). Patterns are written in the regex subset both JavaScript and the Rust `regex` crate accept (no lookaround, no backreferences). A connection string counts only WITH credentials (user:pass@). Edit here once and both engines stay aligned.",rules:[{id:"aws-access-key",subkind:"aws_access_key",name:"AWS Access Key",severity:"critical",pattern:"(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)",hint:"AWS access key id detected. Rotate via IAM and move to an environment variable."},{id:"aws-secret-key",subkind:"aws_secret_key",name:"AWS Secret Key",severity:"critical",pattern:`(?:aws_secret_access_key|aws_secret_key|secret_access_key)\\s*[=:]\\s*['"]?[A-Za-z0-9/+=]{40}['"]?`,hint:"AWS secret access key detected. Rotate immediately."},{id:"gcp-api-key",subkind:"gcp_api_key",name:"GCP API Key",severity:"critical",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Google API key detected. Restrict or rotate it in the Google Cloud console."},{id:"gcp-service-account",subkind:"gcp_service_account",name:"GCP Service Account",severity:"critical",pattern:'"type"\\s*:\\s*"service_account"',hint:"GCP service-account JSON detected. Move it out of the repo and rotate the key."},{id:"github-token",subkind:"github_token",name:"GitHub Token",severity:"critical",pattern:"gh[pousr]_[0-9a-zA-Z]{36,}",hint:"GitHub token detected. Revoke at https://github.com/settings/tokens."},{id:"github-fine-grained",subkind:"github_fine_grained_token",name:"GitHub Fine-Grained Token",severity:"critical",pattern:"github_pat_[0-9a-zA-Z_]{22,}",hint:"GitHub fine-grained token detected. Revoke it in GitHub settings."},{id:"gitlab-token",subkind:"gitlab_token",name:"GitLab Token",severity:"critical",pattern:"glpat-[0-9a-zA-Z_-]{20,}",hint:"GitLab token detected. Revoke it in GitLab access tokens."},{id:"stripe-secret",subkind:"stripe_key",name:"Stripe Secret Key",severity:"critical",pattern:"sk_live_[0-9a-zA-Z]{24,}",hint:"Stripe live secret key detected. Roll it in the Stripe dashboard."},{id:"stripe-restricted",subkind:"stripe_restricted_key",name:"Stripe Restricted Key",severity:"critical",pattern:"rk_live_[0-9a-zA-Z]{24,}",hint:"Stripe restricted key detected. Roll it in the Stripe dashboard."},{id:"slack-token",subkind:"slack_token",name:"Slack Token",severity:"high",pattern:"xox[baprs]-[0-9a-zA-Z-]{10,}",hint:"Slack token detected. Revoke it in the Slack app settings."},{id:"slack-webhook",subkind:"slack_webhook",name:"Slack Webhook",severity:"high",pattern:"hooks\\.slack\\.com/services/T[0-9A-Z]{8,}/B[0-9A-Z]{8,}/[0-9a-zA-Z]{24}",hint:"Slack incoming-webhook URL detected. Regenerate it."},{id:"twilio-api-key",subkind:"twilio_api_key",name:"Twilio API Key",severity:"high",pattern:"SK[0-9a-fA-F]{32}",hint:"Twilio API key detected. Rotate it in the Twilio console."},{id:"sendgrid-api-key",subkind:"sendgrid_api_key",name:"SendGrid API Key",severity:"critical",pattern:"SG\\.[0-9a-zA-Z_-]{22}\\.[0-9a-zA-Z_-]{43}",hint:"SendGrid API key detected. Rotate it in the SendGrid console."},{id:"postgres-uri",subkind:"postgres_uri",name:"PostgreSQL Connection String",severity:"critical",pattern:`postgres(?:ql)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"PostgreSQL connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"mongodb-uri",subkind:"mongodb_uri",name:"MongoDB Connection String",severity:"critical",pattern:`mongodb(?:\\+srv)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"MongoDB connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"redis-uri",subkind:"redis_uri",name:"Redis Connection String",severity:"high",pattern:`redis(?:s)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"Redis connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"openai-key",subkind:"openai_key",name:"OpenAI API Key",severity:"critical",pattern:"sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}",hint:"OpenAI API key detected. Rotate at https://platform.openai.com/api-keys."},{id:"anthropic-key",subkind:"anthropic_key",name:"Anthropic API Key",severity:"critical",pattern:"sk-ant-[0-9a-zA-Z_-]{40,}",hint:"Anthropic API key detected. Rotate at https://console.anthropic.com/."},{id:"firebase-key",subkind:"firebase_key",name:"Firebase API Key",severity:"high",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Firebase API key detected. Restrict it in the Firebase console."},{id:"supabase-key",subkind:"supabase_key",name:"Supabase Service Key",severity:"critical",pattern:"eyJ[0-9a-zA-Z_-]{100,}",hint:"Long JWT (possible Supabase service key) detected. Rotate it and keep it server-side only."},{id:"private-key",subkind:"private_key",name:"Private Key",severity:"critical",pattern:"-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----",hint:"Private key material in plaintext. Rotate immediately and move to a key manager (KMS/Vault).",skipPlaceholder:!0},{id:"jwt-secret",subkind:"jwt_secret",name:"JWT/Generic Secret",severity:"high",pattern:`(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded signing/API secret detected. Move it to an environment variable and rotate it."},{id:"password-in-code",subkind:"password_in_code",name:"Password in Code",severity:"high",pattern:`(?:password|passwd|pwd)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded password detected. Move it to a secret manager and rotate it."},{id:"bearer-token",subkind:"bearer_token",name:"Bearer Token in Code",severity:"high",pattern:`['"]Bearer\\s+[0-9a-zA-Z._-]{20,}['"]`,hint:"Hardcoded bearer token detected. Move it to a secret manager and rotate it."},{id:"hex-secret-32",subkind:"hex_secret",name:"Hardcoded 32+ Hex Secret",severity:"medium",pattern:`['"][0-9a-f]{32,}['"]`,hint:"Long hex string that looks like a secret/hash. Confirm it is not a live credential."},{id:"base64-secret",subkind:"base64_secret",name:"Hardcoded Base64 Secret (long)",severity:"medium",pattern:`['"][A-Za-z0-9+/]{64,}={0,2}['"]`,hint:"Long base64 blob that looks like an embedded secret. Confirm it is not a live credential."}]};var bs=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D6\u05D4\u05D4"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Financial data",labelHe:"\u05E0\u05EA\u05D5\u05DF \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(ip_?address)$/i,type:"tracking",label:"IP address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA IP"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D3\u05E8\u05DB\u05D5\u05DF"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license",labelHe:"\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"},{pattern:/^(iban|swift_?code|bic)$/i,type:"financial",label:"Banking code",labelHe:"\u05E7\u05D5\u05D3 \u05D1\u05E0\u05E7\u05D0\u05D9"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E1"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Member ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7/\u05D7\u05D1\u05E8"},{pattern:/^(blood_?type|allergy|allergies|prescription)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation",labelHe:"\u05DE\u05D9\u05E7\u05D5\u05DD \u05D2\u05D9\u05D0\u05D5\u05D2\u05E8\u05E4\u05D9"},{pattern:/^(mac_?address|device_?fingerprint|imei|serial_?number)$/i,type:"tracking",label:"Device identifier",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"},{pattern:/^(ethnicity|race|religion|political_?affiliation|sexual_?orientation)$/i,type:"sensitive_personal",label:"Sensitive personal",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(minor|child_?name|child_?age|dependent)$/i,type:"minor_data",label:"Minor data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05E0\u05D9\u05DD"},{pattern:/^(signature|digital_?signature)$/i,type:"id",label:"Signature",labelHe:"\u05D7\u05EA\u05D9\u05DE\u05D4"},{pattern:/^(vehicle_?number|license_?plate|plate_?number)$/i,type:"tracking",label:"Vehicle ID",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05E8\u05DB\u05D1"}],_s=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|sort_?order|position|enabled|active|public|version|metadata|config|settings|options|data|content|body|raw|json|text|note|comment|label|color|icon|image|avatar|logo|thumbnail|preview|template|schema|format|mode|level|priority|severity|source|target|parent|child|owner|creator|modifier|assignee|project|workspace|organization|team|group|channel|thread|room|session|device|platform|browser|locale|timezone|currency|country|region|city|zip|postal|state|province|name|display_?name|user_?agent|password_?hash|secret|token|private_?key|auth_?token|constraint|index|sequence|trigger|function|procedure|database|namespace|migration|revision)$/i,xs=/^(beacon_?registr|device_?config|hardware|sensor|firmware|telemetry|metric|analytic|log_?event|audit_?log|system_?config|cache|queue|job|migration|schema_?version|spatial_?ref)/i,ws=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function wr(e,t){if(_s.test(e)||/^name$/i.test(e)||t&&xs.test(t)||ws.test(e))return null;for(let r of bs)if(r.pattern.test(e))return r.type;let n=gr(e);return n?n.type:null}var Al=_t.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var Il=512*1024,$l=50*1024*1024;var kr={id:"critical",agent_id:"high",policy:"high",financial:"critical",medical:"critical",sensitive_personal:"critical",minor_data:"critical",biometric:"critical",auth:"critical",name:"high",email:"high",phone:"high",address:"high",dob:"high",location:"high",tracking:"medium",employment:"medium",education:"medium",behavior:"high"};function Sr(e){return kr[e]}function vs(e){return kr[e]??"low"}function Er(e,t){let n=[];for(let r of t){let i=r.rows.length;for(let o=0;o<r.headers.length;o++){let s=r.headers[o]??"",a=s?wr(s.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),r.name)??yt(s)?.type??null:null,l=[];for(let h of r.rows){let u=h[o];typeof u=="string"&&u.length>0&&l.push(u)}let c=l.length>0?yr(l):null;c?n.push(vr(e,r.name,s,c.type,c.label,"value",c.matchedSample,i)):a&&n.push(vr(e,r.name,s,a,bt(a),"header",0,i))}}return n}function vr(e,t,n,r,i,o,s,a){return{file:e,location:t,column:n,type:r,label:i,category:bt(r),severity:vs(r),matchKind:o,hits:s,sampleSize:a}}var ks=new Set(["hex-secret-32","base64-secret"]),Ss=[/(?:[$€£]|USD|EUR|GBP)\s?\d[\d,]*(?:\.\d+)?/g,/\d[\d,]*(?:\.\d+)?\s?(?:[$€£]|USD|EUR|GBP|דולר|יורו)/g,/\b\d{1,3}(?:,\d{3})+(?:\.\d+)?\b/g];function Es(e){let t=new $e(["financial_amount"]);return{kind:"amount",severity:"medium",hint:"A money amount (the amounts dial is on: amounts are treated as sensitive here).",find:n=>{if(!e())return[];let r=t.detect(n).map(o=>({start:o.startIndex,end:o.endIndex}));for(let o of Ss){o.lastIndex=0;for(let s of n.matchAll(o))r.push({start:s.index,end:s.index+s[0].length})}r.sort((o,s)=>o.start-s.start||s.end-o.end);let i=[];for(let o of r){let s=i[i.length-1];s&&o.start<s.end?s.end=Math.max(s.end,o.end):i.push({...o})}return i}}}function Ar(e={}){let t=e.amounts??(()=>!1),n=[...xr(),Es(t)],r=_t.rules.filter(i=>!ks.has(i.id)).map(i=>({id:i.id,name:i.name,severity:i.severity,pattern:new RegExp(i.pattern)}));return{text:n,amounts:t,header:i=>{let o=yt(i);return o?{type:o.type,label:o.labelHe||o.label}:null},secrets:r,table:i=>Er("",[i]).filter(o=>o.column).map(o=>({column:o.column,type:o.type,category:o.category,severity:o.severity,hits:o.hits,how:o.matchKind==="value"?"value":"header"})),severity:i=>Sr(i)}}import{existsSync as As,mkdirSync as zl,readFileSync as Is,writeFileSync as Wl}from"node:fs";import{homedir as $s}from"node:os";import{join as Ts}from"node:path";var Ir=()=>Ts($s(),".nodata","prefs.json");function tn(){try{return As(Ir())&&JSON.parse(Is(Ir(),"utf8")).amounts_sensitive===!0}catch{return!1}}var $r=!1;function Tr(){$r||($r=!0,vt(Ar({amounts:tn})))}var Rs=/[֑-ׇ]/g;function Cs(e){return e.normalize("NFC").replace(Rs,"").toLowerCase()}function Ls(e,t){if(!t)return 0;let n=0,r=e.indexOf(t);for(;r!==-1&&(n++,!(n>=1e5));)r=e.indexOf(t,r+t.length);return n}function Rr(e,t){if(!e||e.terms.length===0||!t)return[];let n=Cs(t);if(!n)return[];let r=[];for(let i of e.terms){let o=Ls(n,i.needle);o>0&&r.push({term_id:i.id,label:i.label,tier:i.tier,access_class:i.access_class,...i.flag?{flag:i.flag}:{},hit_count:o})}return r}import{basename as Ps,extname as Os,isAbsolute as au,join as cu,relative as lu,resolve as uu}from"node:path";var Ds=["claude-code","cursor","windsurf","codex","gemini","vscode","claude-desktop"],nn=e=>typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,pu={action:{cardinality:"scalar",ops:["eq","ne","in","not_in"],enumValues:["read","search","run","write","browse","interact"],label:"what the agent does (read, search, run, write; on a site: browse, interact)",extract:e=>e.action},"time.hour":{cardinality:"scalar",ops:["between","gte","lte","eq"],label:"hour on this computer (0-23; 18..6 wraps overnight)",extract:e=>e.now.getHours()},"time.weekday":{cardinality:"scalar",ops:["in","not_in","between","eq"],label:"weekday on this computer (0 Sunday \u2026 6 Saturday)",extract:e=>e.now.getDay()},"file.ext":{cardinality:"scalar",ops:["eq","ne","in","not_in"],label:"file type (.xlsx, .pdf, .env \u2026)",extract:e=>Os(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>Ps(e.path).toLowerCase()},agent:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:`which agent (${Ds.join(", ")} \u2026)`,extract:e=>nn(e.who?.host)},"agent.type":{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"sub-agent type inside the agent (main = the main conversation; general-purpose, explore \u2026)",extract:e=>nn(e.who?.type)},org:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"which organisation the agent works for (the one its folder is bound to)",extract:e=>nn(e.who?.org)}};function Cr(e){return t=>Rr(e,t).map(n=>({term_id:n.term_id,label:n.label,tier:n.tier,hit_count:n.hit_count}))}function Lr(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)||Ns(e)}function Ns(e){return/(^|[\\/])\.nodata[\\/]/.test(e)}console.log=console.error;console.info=console.error;Tr();xt?.on("message",e=>{(async()=>{try{let t=new Set,n=new Set,i={r:await Jt({target_id:"mcp",target_label:e.label,target_path:e.target,log:Yt,...e.max_files?{max_files:e.max_files}:{},...e.include_tool_dirs?{include_tool_dirs:!0}:{},...e.time_budget_ms?{time_budget_ms:e.time_budget_ms}:{},onProgress:({walked:o,read:s})=>xt?.postMessage({type:"progress",walked:o,read:s}),onFileChecked:(o,s)=>(s?t:n).add(o.split("!/")[0]),skip_own_file:Lr,...e.lexicon?{lexicon:Cr(e.lexicon)}:{}}),readTop:[...t],notReadTop:[...n]};xt?.postMessage({type:"done",value:i})}catch(t){xt?.postMessage({type:"error",error:t instanceof Error?t.message:String(t)})}})()});
40
+ ${g.stamp}`:null,m=!!A?.truncated,v="a scanned PDF (pictures with a little text) that OCR could not read"}else if(g.kind==="pdf"){let A=Me(g.load(),{ocr:!0});I=A?.text?.trim()||null,m=!!A?.truncated,v="a scanned PDF OCR could not read"}else it()?I=Pt(g.load(),g.format):(d??=await Ut(),"error"in d?v=`an image \u2014 ${d.error}. Installing Tesseract also works (${ne})`:(d.ocr.note&&(f.ocr_note=d.ocr.note),f.ocr_engine="built-in",I=(await d.ocr.recognize(g.load())).trim()||null))}catch{I=null}if(l+=1,c+=Date.now()-$,ye(g.rel,Date.now()-$),!I){g.kind==="pdf"&&(f.documents_unreadable+=1,(f.unreadable_files??=[]).length<500&&f.unreadable_files.push(g.rel)),R(g.rel,g.kind==="pdf"?"document":"image",g.format,v);continue}let S=f.documents_by_engine??={};S.ocr=(S.ocr??0)+1,(f.ocr_files??=[]).length<500&&f.ocr_files.push(g.rel),g.kind==="pdf"&&(f.documents_extracted+=1),a+=1,g.row.read+=1,e.onFileChecked?.(g.rel,!0),Te(g.rel,g.name,g.ext,I,null),m&&(f.documents_truncated+=1,R(g.rel,"document",g.format,"only its first pages were read by OCR (the page cap): the rest were not read; raise NODATA_OCR_MAX_PAGES or scan it on its own"))}}finally{d&&!("error"in d)&&await d.ocr.close()}}let oe=new Map;for(let d of i.values())if(!(d.size<2))for(let _ of d){let y=oe.get(_)??new Set;for(let g of d)g!==_&&y.add(g);oe.set(_,y)}for(let d of n){let _=oe.get(d.relative_path);if(!_||d.finding_kind!=="pii_unencrypted"||!["israeli_id","credit_card","iban"].includes(d.finding_subkind??""))continue;let y=[..._].sort();d.remediation_hint=`${d.remediation_hint??""} The same value also appears in ${y.length} other file${y.length===1?"":"s"}: ${y.slice(0,5).join(", ")}${y.length>5?` \u2026 +${y.length-5}`:""} \u2014 likely one real person copied across files.`.trim()}for(let d of r.groups()){let _=Yn(d);for(let y of d.files)G(y,"secret_reuse",d.encryption?"critical":"high",d.encryption?"shared_encryption_key":d.names.length>1?"shared_secret":"copied_secret",_)}return{target_id:e.target_id,target_label:e.target_label,target_path:e.target_path,files_walked:s,files_inspected:a,duration_ms:Date.now()-t,findings:n,inventory:o,coverage:f}}var Yt={info(){}};var ac=Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=","base64");var Xo=["Put the new key where the app reads it (for a developer machine: the NoData vault + nodata_run, not a .env file).","Check that the app still works with the new key.","Only then delete / revoke the OLD key \u2014 until you do, whoever copied it can still use it."],j=(e,t,n)=>({provider:e,url:t,steps:[...n,...Xo]}),xc={"aws-access-key":j("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault)."]),"aws-secret-key":j("AWS","https://console.aws.amazon.com/iam/home#/security_credentials",["Open IAM \u2192 your user \u2192 Security credentials.","Create a NEW access key (you see its secret once \u2014 keep it only in the vault).","Mark the old key Inactive before deleting it."]),"gcp-api-key":j("Google Cloud","https://console.cloud.google.com/apis/credentials",["Open APIs & Services \u2192 Credentials.","Pick the key \u2192 Regenerate key (or create a new one and restrict it to the APIs you use)."]),"gcp-service-account":j("Google Cloud (service account)","https://console.cloud.google.com/iam-admin/serviceaccounts",["Open IAM & Admin \u2192 Service accounts \u2192 the account \u2192 Keys.","Add key \u2192 Create new key (JSON). Keep the file out of Git and out of shared folders."]),"firebase-key":j("Firebase / Google Cloud","https://console.cloud.google.com/apis/credentials",["A Firebase web key is meant to be public \u2014 restrict it instead: Credentials \u2192 the key \u2192 Application restrictions (your domains only).","If it is not a web key, regenerate it."]),"github-token":j("GitHub","https://github.com/settings/tokens",["Open Settings \u2192 Developer settings \u2192 Personal access tokens.","Generate a new token with only the scopes you need."]),"github-fine-grained":j("GitHub","https://github.com/settings/tokens?type=beta",["Open Fine-grained tokens.","Regenerate the token (or create a new one for only the repositories you need)."]),"gitlab-token":j("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":j("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys.","Roll the secret key (Stripe can keep the old one alive for a short overlap)."]),"stripe-restricted":j("Stripe","https://dashboard.stripe.com/apikeys",["Open Developers \u2192 API keys \u2192 Restricted keys.","Roll the key, or create a new restricted key."]),"slack-token":j("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":j("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":j("Twilio","https://console.twilio.com/us1/account/keys-credentials/api-keys",["Open Account \u2192 API keys & tokens.","Create a new API key."]),"sendgrid-api-key":j("SendGrid","https://app.sendgrid.com/settings/api_keys",["Open Settings \u2192 API Keys.","Create a new key with only the permissions you need."]),"openai-key":j("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":j("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":j("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":j("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new SECRET key (a service_role / secret key bypasses every database rule \u2014 treat it like a root password).","Older projects with JWT keys: rotating the JWT secret replaces every key and signs everyone out \u2014 plan it."]),"supabase-access-token":j("Supabase (personal access token \u2014 reaches every project of the account)","https://supabase.com/dashboard/account/tokens",["Open Account \u2192 Access Tokens.","Revoke this token, then generate a new one only where it is needed (CLI, MCP) \u2014 prefer a read-only MCP."]),"supabase-secret-key":j("Supabase","https://supabase.com/dashboard/project/_/settings/api-keys",["Open the project \u2192 Project Settings \u2192 API Keys.","Create a new secret key, switch your servers to it, then delete this one."]),"postgres-uri":j("PostgreSQL (the password in the connection string)","https://supabase.com/dashboard/project/_/settings/database",["Change the database user's password: in Supabase \u2192 Project Settings \u2192 Database \u2192 Reset password; elsewhere, your host's console or ALTER USER \u2026 WITH PASSWORD.","Update the connection string with the new password."]),"mongodb-uri":j("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":j("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":j("Private key (SSH / TLS / signing)","",["Generate a new key pair.","Register the new PUBLIC key where the old one was trusted (server authorized_keys, certificate, service settings)."]),"jwt-secret":j("Your app's JWT secret","",["Set a new long random secret in the app's configuration.","Every signed-in user will be signed out \u2014 plan the moment."]),"password-in-code":j("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":j("An access token","",["Revoke the token in the service that issued it and issue a new one."])},wc=j("A credential","",["Find the service it belongs to and issue a new credential there."]);var Go=[{type:"id_number",patterns:[/\b\d{9}\b/g,/ת\.?ז\.?\s*:?\s*(\d{9})/g,/זהות\s*:?\s*(\d{9})/g],confidence:.9,replacement:()=>"[\u05EA.\u05D6. \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"phone",patterns:[/\b0[2-9]\d[\s\-]?\d{7}\b/g,/\b05[0-9][\s\-]?\d{7}\b/g,/\+972[\s\-]?[2-9]\d[\s\-]?\d{7}\b/g],confidence:.95,replacement:()=>"[\u05D8\u05DC\u05E4\u05D5\u05DF \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"email",patterns:[/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/g],confidence:.99,replacement:e=>{let[,t]=e.split("@");return`[\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC: ***@${t}]`}},{type:"full_name",patterns:[/(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק)[:\s]+([א-ת][א-ת"'\-\s]{2,30}?)(?=[,\n\d]|ת\.ז)/g,/(?:עו"ד|ד"ר|פרופ'|מר|גברת)\s+([א-ת][א-ת"'\-\s]{2,25}?)(?=[,\n])/g],confidence:.75,replacement:()=>"[\u05E9\u05DD \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"bank_account",patterns:[/\b\d{2}[\-]\d{5,9}[\-]\d{2,3}\b/g,/(?:חשבון|ח-ן)\s*:?\s*(\d[\d\-]{8,15})/g],confidence:.88,replacement:()=>"[\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"medical",patterns:[/(?<![א-ת])[בהוכלמש]{0,2}(?:סוכרת|יתר לחץ דם|אסתמה|דיכאון|חרדה|סרטן|אי ספיקת לב|אפילפסיה)(?![א-ת])/g,/\b(?:Metformin|Lisinopril|Atorvastatin|Amlodipine|Sertraline|Fluoxetine|Omeprazole|Warfarin|Aspirin|Insulin)\b/gi,/\bHbA1c\s*:?\s*[\d.]+%?/g,/\bBMI\s*:?\s*[\d.]+/g,/(?<![א-ת])[בהוכלמש]{0,2}אבחנ[הות]\s*:?\s*[^,\n.]{2,40}/g],confidence:.85,replacement:()=>"[\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"financial_amount",patterns:[/[\d,]+(?:\.\d{2})?\s*(?:₪|ש"ח|NIS|שקל(?:ים)?)/g,/(?:₪|NIS)\s*[\d,]+(?:\.\d{2})?/g],confidence:.92,replacement:()=>"[\u05E1\u05DB\u05D5\u05DD \u05DB\u05E1\u05E4\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"birth_date",patterns:[/(?:תאריך לידה|נולד|נולדה|ד\.ל\.)\s*:?\s*\d{1,2}[\/\.\-]\d{1,2}[\/\.\-]\d{2,4}/g,/(?<![א-ת])[בהוכלמש]{0,2}גיל\s*:?\s*\d{1,3}\b/g],confidence:.88,replacement:()=>"[\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"address",patterns:[/רחוב\s+[א-ת][א-ת\s"'\-]{2,30}\s+\d{1,5}/g,/(?:רח'|רח\.)\s+[א-ת][א-ת\s"'\-]{2,30}\d{1,5}/g],confidence:.72,replacement:()=>"[\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"},{type:"license_plate",patterns:[/\b\d{2,3}[\-]\d{2,3}[\-]\d{2,3}\b/g],confidence:.8,replacement:()=>"[\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"}];function Zo(e){if(e.length!==9)return!1;let t=e.split("").map(Number),n=0;for(let r=0;r<9;r++){let i=t[r]*(r%2===0?1:2);i>9&&(i-=9),n+=i}return n%10===0}var $e=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let n=[],r=new Set;for(let o of Go)if(this.enabledTypes.has(o.type))for(let s of o.patterns){let a=new RegExp(s.source,s.flags),l;for(;(l=a.exec(t))!==null;){let c=l[0],h=`${o.type}:${l.index}`;if(!r.has(h)){if(r.add(h),o.type==="id_number"){let u=c.replace(/\D/g,"");if(/^\d{9}$/.test(c)&&u.length===9&&!Zo(u))continue}n.push({type:o.type,value:c,startIndex:l.index,endIndex:l.index+c.length,confidence:o.confidence,replacement:o.replacement(c,o.type)})}}}n.sort((o,s)=>o.startIndex-s.startIndex||s.confidence-o.confidence);let i=[];for(let o of n)i.some(a=>o.startIndex<a.endIndex&&o.endIndex>a.startIndex)||i.push(o);return i}};var z=["GDPR","CPRA","PPL"],Ko=["GDPR-9","CPRA","PPL"],qo=[{id:"person_name",type:"name",sensitivity:"high",regulations:[...z],en:["firstname","lastname","fname","lname","middle name","maiden name","birth name","preferred name","display name","nickname","surname","given name","full name"],he:["\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0","\u05DB\u05D9\u05E0\u05D5\u05D9","\u05E9\u05DD \u05E0\u05E2\u05D5\u05E8\u05D9\u05DD"],ar:["\u0627\u0644\u0627\u0633\u0645","\u0627\u0633\u0645 \u0627\u0644\u0639\u0627\u0626\u0644\u0629","\u0627\u0644\u0627\u0633\u0645 \u0627\u0644\u0643\u0627\u0645\u0644"],ru:["\u0438\u043C\u044F","\u0444\u0430\u043C\u0438\u043B\u0438\u044F","\u043E\u0442\u0447\u0435\u0441\u0442\u0432\u043E","\u0444\u0438\u043E"]},{id:"birth_place",type:"location",sensitivity:"medium",regulations:[...z],en:["birth place","birthplace","place of birth"],he:["\u05DE\u05E7\u05D5\u05DD \u05DC\u05D9\u05D3\u05D4","\u05D0\u05E8\u05E5 \u05DC\u05D9\u05D3\u05D4"],ar:["\u0645\u0643\u0627\u0646 \u0627\u0644\u0645\u064A\u0644\u0627\u062F"],ru:["\u043C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F"]},{id:"citizenship",type:"sensitive_personal",sensitivity:"high",regulations:[...z],en:["citizenship","nationality"],he:["\u05D0\u05D6\u05E8\u05D7\u05D5\u05EA","\u05DC\u05D0\u05D5\u05DD"],ar:["\u0627\u0644\u062C\u0646\u0633\u064A\u0629"],ru:["\u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u043E"]},{id:"marital_status",type:"sensitive_personal",sensitivity:"high",regulations:[...z],en:["marital status"],he:["\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9"],ar:["\u0627\u0644\u062D\u0627\u0644\u0629 \u0627\u0644\u0627\u062C\u062A\u0645\u0627\u0639\u064A\u0629"],ru:["\u0441\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435"]},{id:"government_id",type:"id",sensitivity:"critical",regulations:[...z],en:["ssn","national id","passport","driver license","drivers license","tax id","social security","national insurance","military id","voter id","resident id","residence permit","visa number"],he:["\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4","\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7 \u05DC\u05D0\u05D5\u05DE\u05D9","\u05DE\u05E1\u05E4\u05E8 \u05D0\u05D9\u05E9\u05D9","\u05DE\u05E1\u05E4\u05E8 \u05D5\u05D9\u05D6\u05D4","\u05EA\u05E2\u05D5\u05D3\u05EA \u05EA\u05D5\u05E9\u05D1","\u05DE\u05E1\u05E4\u05E8 \u05E2\u05D5\u05E1\u05E7"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0647\u0648\u064A\u0629","\u062C\u0648\u0627\u0632 \u0627\u0644\u0633\u0641\u0631","\u0631\u062E\u0635\u0629 \u0627\u0644\u0642\u064A\u0627\u062F\u0629"],ru:["\u043F\u0430\u0441\u043F\u043E\u0440\u0442","\u0441\u043D\u0438\u043B\u0441","\u0438\u043D\u043D","\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0435 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u0435\u043D\u0438\u0435"]},{id:"institution_person_id",type:"tracking",sensitivity:"medium",regulations:[...z],en:["employee id","employee number","employee no","student id","student number","user id","userid","customer id","customer number","customer no","client id","member id","subscriber id","participant id","profile id","person id","person uuid","lead id","crm contact","account id"],he:["\u05DE\u05E1\u05E4\u05E8 \u05E2\u05D5\u05D1\u05D3","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D8\u05D5\u05D3\u05E0\u05D8","\u05DE\u05E1\u05E4\u05E8 \u05DC\u05E7\u05D5\u05D7","\u05DE\u05D6\u05D4\u05D4 \u05DC\u05E7\u05D5\u05D7","\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E0\u05D5\u05D9","\u05DE\u05D6\u05D4\u05D4 \u05DE\u05E9\u05EA\u05DE\u05E9"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0645\u0648\u0638\u0641","\u0631\u0642\u0645 \u0627\u0644\u0639\u0645\u064A\u0644"],ru:["\u0442\u0430\u0431\u0435\u043B\u044C\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440","\u043D\u043E\u043C\u0435\u0440 \u043A\u043B\u0438\u0435\u043D\u0442\u0430"]},{id:"patient_id",type:"medical",sensitivity:"critical",regulations:["GDPR-9","HIPAA","PPL"],en:["patient id","patient number","mrn","medical record number"],he:["\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D8\u05D5\u05E4\u05DC","\u05DE\u05E1\u05E4\u05E8 \u05EA\u05D9\u05E7 \u05E8\u05E4\u05D5\u05D0\u05D9"],ar:["\u0631\u0642\u0645 \u0627\u0644\u0645\u0631\u064A\u0636"],ru:["\u043D\u043E\u043C\u0435\u0440 \u043F\u0430\u0446\u0438\u0435\u043D\u0442\u0430"]},{id:"email",type:"email",sensitivity:"high",regulations:[...z],en:["emailaddress","e mail","recovery email","contact email"],he:["\u05D3\u05D5\u05D0\u05DC","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"],ar:["\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A"],ru:["\u043F\u043E\u0447\u0442\u0430","\u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430","email"]},{id:"phone",type:"phone",sensitivity:"high",regulations:[...z],en:["cellphone","contact number","work phone","home phone","whatsapp","recovery phone","telephone"],he:["\u05D8\u05DC\u05E4\u05D5\u05DF \u05D1\u05D9\u05EA","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E2\u05D1\u05D5\u05D3\u05D4","\u05D5\u05D5\u05D8\u05E1\u05D0\u05E4","\u05DE\u05E1\u05E4\u05E8 \u05E0\u05D9\u05D9\u05D3"],ar:["\u0647\u0627\u062A\u0641","\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641","\u062C\u0648\u0627\u0644"],ru:["\u0442\u0435\u043B\u0435\u0444\u043E\u043D","\u043C\u043E\u0431\u0438\u043B\u044C\u043D\u044B\u0439"]},{id:"social_handle",type:"tracking",sensitivity:"medium",regulations:[...z],en:["telegram","linkedin","facebook","twitter","instagram","tiktok","social profile"],he:["\u05D8\u05DC\u05D2\u05E8\u05DD","\u05DC\u05D9\u05E0\u05E7\u05D3\u05D0\u05D9\u05DF","\u05E4\u05D9\u05D9\u05E1\u05D1\u05D5\u05E7","\u05D0\u05D9\u05E0\u05E1\u05D8\u05D2\u05E8\u05DD"]},{id:"address",type:"address",sensitivity:"high",regulations:[...z],en:["house number","apartment","apt","billing address","shipping address","postal code","zip code","postcode","street"],he:["\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05EA","\u05D3\u05D9\u05E8\u05D4","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DC\u05DE\u05E9\u05DC\u05D5\u05D7","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DC\u05D7\u05D9\u05D5\u05D1","\u05EA.\u05D3","\u05EA\u05D0 \u05D3\u05D5\u05D0\u05E8"],ar:["\u0627\u0644\u0639\u0646\u0648\u0627\u0646","\u0627\u0644\u0634\u0627\u0631\u0639","\u0627\u0644\u0631\u0645\u0632 \u0627\u0644\u0628\u0631\u064A\u062F\u064A"],ru:["\u0430\u0434\u0440\u0435\u0441","\u0443\u043B\u0438\u0446\u0430","\u0438\u043D\u0434\u0435\u043A\u0441","\u043A\u0432\u0430\u0440\u0442\u0438\u0440\u0430"]},{id:"geo",type:"location",sensitivity:"high",regulations:[...z],en:["geo location","geolocation","latitude","longitude","coordinates","home location","current location"],he:["\u05DE\u05D9\u05E7\u05D5\u05DD","\u05E7\u05D5\u05D0\u05D5\u05E8\u05D3\u05D9\u05E0\u05D8\u05D5\u05EA"],ar:["\u0627\u0644\u0645\u0648\u0642\u0639"],ru:["\u043C\u0435\u0441\u0442\u043E\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435","\u043A\u043E\u043E\u0440\u0434\u0438\u043D\u0430\u0442\u044B"]},{id:"bank_card",type:"financial",sensitivity:"critical",regulations:[...z],en:["bank account","iban","swift","bic","routing number","credit card","creditcard","card number","cvv","card expiry","cc exp","paypal","wallet address","crypto wallet","bitcoin address"],he:["\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9","\u05D0\u05E8\u05E0\u05E7 \u05E7\u05E8\u05D9\u05E4\u05D8\u05D5","\u05D0\u05E8\u05E0\u05E7 \u05D3\u05D9\u05D2\u05D9\u05D8\u05DC\u05D9"],ar:["\u062D\u0633\u0627\u0628 \u0628\u0646\u0643\u064A","\u0631\u0642\u0645 \u0627\u0644\u062D\u0633\u0627\u0628","\u0628\u0637\u0627\u0642\u0629 \u0627\u0626\u062A\u0645\u0627\u0646"],ru:["\u0440\u0430\u0441\u0447\u0435\u0442\u043D\u044B\u0439 \u0441\u0447\u0435\u0442","\u043D\u043E\u043C\u0435\u0440 \u0441\u0447\u0435\u0442\u0430","\u043D\u043E\u043C\u0435\u0440 \u043A\u0430\u0440\u0442\u044B","\u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430\u044F \u043A\u0430\u0440\u0442\u0430"]},{id:"income_tax",type:"financial",sensitivity:"high",regulations:[...z],en:["salary","income","wage","tax record","tax return","payment history","credit score","net worth","salary grade"],he:["\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4","\u05EA\u05DC\u05D5\u05E9 \u05E9\u05DB\u05E8","\u05D3\u05D5\u05D7 \u05DE\u05E1","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05EA\u05E9\u05DC\u05D5\u05DE\u05D9\u05DD","\u05D3\u05D9\u05E8\u05D5\u05D2 \u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05D5\u05D5\u05D9 \u05E0\u05E7\u05D9","\u05D3\u05E8\u05D2\u05EA \u05E9\u05DB\u05E8"],ar:["\u0627\u0644\u0631\u0627\u062A\u0628","\u0627\u0644\u062F\u062E\u0644"],ru:["\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430","\u0434\u043E\u0445\u043E\u0434"]},{id:"assets",type:"financial",sensitivity:"high",regulations:[...z],en:["property id","land record","ownership record","title deed","holdings"],he:["\u05D2\u05D5\u05E9 \u05D7\u05DC\u05E7\u05D4","\u05E0\u05E1\u05D7 \u05D8\u05D0\u05D1\u05D5","\u05E8\u05D9\u05E9\u05D5\u05DD \u05DE\u05E7\u05E8\u05E7\u05E2\u05D9\u05DF","\u05D1\u05E2\u05DC\u05D5\u05EA","\u05D0\u05D7\u05D6\u05E7\u05D5\u05EA"],ru:["\u0441\u043E\u0431\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0441\u0442\u044C","\u043D\u0435\u0434\u0432\u0438\u0436\u0438\u043C\u043E\u0441\u0442\u044C"]},{id:"vehicle",type:"tracking",sensitivity:"medium",regulations:[...z],en:["vin","vehicle id","license plate","registration number","plate number"],he:["\u05DE\u05E1\u05E4\u05E8 \u05E9\u05DC\u05D3\u05D4","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1","\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9"],ru:["\u043D\u043E\u043C\u0435\u0440 \u0430\u0432\u0442\u043E\u043C\u043E\u0431\u0438\u043B\u044F","vin"]},{id:"health",type:"medical",sensitivity:"critical",regulations:["GDPR-9","HIPAA","PPL"],en:["medical record","health condition","health data","lab result","lab results","vaccination","mental health","hospitalization","hospitalisation","disability","insurance number","diagnosis","allergy","prescription","medication","blood type"],he:["\u05EA\u05D9\u05E7 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05DE\u05E2\u05D1\u05D3\u05D4","\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05D1\u05D3\u05D9\u05E7\u05D4","\u05D7\u05D9\u05E1\u05D5\u05E0\u05D9\u05DD","\u05D1\u05E8\u05D9\u05D0\u05D5\u05EA \u05E0\u05E4\u05E9","\u05D0\u05E9\u05E4\u05D5\u05D6","\u05E0\u05DB\u05D5\u05EA","\u05DE\u05E6\u05D1 \u05D1\u05E8\u05D9\u05D0\u05D5\u05EA\u05D9"],ar:["\u0627\u0644\u062A\u0634\u062E\u064A\u0635","\u0627\u0644\u0633\u062C\u0644 \u0627\u0644\u0637\u0628\u064A","\u0627\u0644\u0623\u062F\u0648\u064A\u0629"],ru:["\u0434\u0438\u0430\u0433\u043D\u043E\u0437","\u043C\u0435\u0434\u0438\u0446\u0438\u043D\u0441\u043A\u0430\u044F \u043A\u0430\u0440\u0442\u0430","\u0430\u043D\u0430\u043B\u0438\u0437\u044B"]},{id:"biometric",type:"biometric",sensitivity:"critical",regulations:["GDPR-9","CPRA","PPL"],en:["face embedding","face scan","iris scan","retina scan","voice print","voiceprint","voice signature","hand geometry","biometric template","biometric data","dna","genetic data","genome"],he:["\u05D8\u05D1\u05D9\u05E2\u05EA \u05E7\u05D5\u05DC","\u05E1\u05E8\u05D9\u05E7\u05EA \u05E4\u05E0\u05D9\u05DD","\u05E1\u05E8\u05D9\u05E7\u05EA \u05E7\u05E9\u05EA\u05D9\u05EA","\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05D2\u05E0\u05D8\u05D9\u05D9\u05DD",'\u05D3\u05E0"\u05D0'],ar:["\u0628\u0635\u0645\u0629"],ru:["\u0431\u0438\u043E\u043C\u0435\u0442\u0440\u0438\u044F","\u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043E\u043A"]},{id:"employment",type:"employment",sensitivity:"medium",regulations:[...z],en:["employer","job title","employment status","hire date","start date of employment","termination date","performance review","disciplinary"],he:["\u05DE\u05E2\u05E1\u05D9\u05E7","\u05DE\u05E7\u05D5\u05DD \u05E2\u05D1\u05D5\u05D3\u05D4","\u05EA\u05E4\u05E7\u05D9\u05D3 \u05D4\u05E2\u05D5\u05D1\u05D3","\u05EA\u05D0\u05E8\u05D9\u05DA \u05EA\u05D7\u05D9\u05DC\u05EA \u05E2\u05D1\u05D5\u05D3\u05D4","\u05EA\u05D0\u05E8\u05D9\u05DA \u05E1\u05D9\u05D5\u05DD \u05E2\u05D1\u05D5\u05D3\u05D4","\u05D4\u05E2\u05E8\u05DB\u05EA \u05D1\u05D9\u05E6\u05D5\u05E2\u05D9\u05DD","\u05E9\u05D9\u05DE\u05D5\u05E2"],ar:["\u062C\u0647\u0629 \u0627\u0644\u0639\u0645\u0644","\u0627\u0644\u0645\u0633\u0645\u0649 \u0627\u0644\u0648\u0638\u064A\u0641\u064A"],ru:["\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044C","\u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C"]},{id:"manager",type:"name",sensitivity:"medium",regulations:[...z],en:["manager","supervisor"],he:["\u05DE\u05E0\u05D4\u05DC \u05D9\u05E9\u05D9\u05E8"]},{id:"education",type:"education",sensitivity:"medium",regulations:[...z],en:["school","university","college","degree","transcript","education history","gpa"],he:["\u05D1\u05D9\u05EA \u05E1\u05E4\u05E8","\u05D0\u05D5\u05E0\u05D9\u05D1\u05E8\u05E1\u05D9\u05D8\u05D4","\u05DE\u05DB\u05DC\u05DC\u05D4","\u05D2\u05D9\u05DC\u05D9\u05D5\u05DF \u05E6\u05D9\u05D5\u05E0\u05D9\u05DD","\u05D4\u05E9\u05DB\u05DC\u05D4","\u05EA\u05D5\u05D0\u05E8 \u05D0\u05E7\u05D3\u05DE\u05D9"],ar:["\u0627\u0644\u062C\u0627\u0645\u0639\u0629","\u0627\u0644\u0645\u062F\u0631\u0633\u0629"],ru:["\u043E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435","\u0443\u043D\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442"]},{id:"device_online",type:"tracking",sensitivity:"medium",regulations:[...z],en:["ip","ipaddress","ip address","mac address","device id","deviceid","advertising id","idfa","gaid","android id","apple id","cookie id","cookieid","browser fingerprint","user agent","imei"],he:["\u05DB\u05EA\u05D5\u05D1\u05EA ip","\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"],ru:["ip \u0430\u0434\u0440\u0435\u0441"]},{id:"account",type:"tracking",sensitivity:"medium",regulations:[...z],en:["username","user name","login","screen name"],he:["\u05E9\u05DD \u05DE\u05E9\u05EA\u05DE\u05E9"],ru:["\u043B\u043E\u0433\u0438\u043D"]},{id:"credential",type:"auth",sensitivity:"critical",regulations:[...z],en:["password","password hash","mfa secret","otp secret","security question","security answer","session id","session token","api key"],he:["\u05E1\u05D9\u05E1\u05DE\u05D4","\u05E1\u05D9\u05E1\u05DE\u05D0","\u05E9\u05D0\u05DC\u05EA \u05D0\u05D1\u05D8\u05D7\u05D4"],ar:["\u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631"],ru:["\u043F\u0430\u0440\u043E\u043B\u044C"]},{id:"behavior",type:"behavior",sensitivity:"high",regulations:[...z],en:["purchase history","search history","browsing history","clickstream","usage pattern","behavior profile","behaviour profile"],he:["\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E8\u05DB\u05D9\u05E9\u05D5\u05EA","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05D7\u05D9\u05E4\u05D5\u05E9","\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05D2\u05DC\u05D9\u05E9\u05D4","\u05E4\u05E8\u05D5\u05E4\u05D9\u05DC \u05D4\u05EA\u05E0\u05D4\u05D2\u05D5\u05EA"]},{id:"special_category",type:"sensitive_personal",sensitivity:"critical",regulations:[...Ko],en:["race","ethnicity","religion","political opinion","political party","union membership","trade union","sexual orientation","gender identity","criminal record"],he:["\u05D2\u05D6\u05E2","\u05D3\u05EA","\u05D4\u05E9\u05E7\u05E4\u05D4 \u05E4\u05D5\u05DC\u05D9\u05D8\u05D9\u05EA","\u05D7\u05D1\u05E8\u05D5\u05EA \u05D1\u05D0\u05D9\u05D2\u05D5\u05D3","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA","\u05D6\u05D4\u05D5\u05EA \u05DE\u05D2\u05D3\u05E8\u05D9\u05EA","\u05E8\u05D9\u05E9\u05D5\u05DD \u05E4\u05DC\u05D9\u05DC\u05D9"],ar:["\u0627\u0644\u062F\u064A\u0627\u0646\u0629","\u0627\u0644\u0639\u0631\u0642"],ru:["\u0440\u0435\u043B\u0438\u0433\u0438\u044F","\u043D\u0430\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E\u0441\u0442\u044C"]},{id:"family_names",type:"name",sensitivity:"high",regulations:[...z],en:["mother name","father name","spouse","partner name","emergency contact","next of kin","family member","guardian","beneficiary"],he:["\u05E9\u05DD \u05D4\u05D0\u05DD","\u05E9\u05DD \u05D4\u05D0\u05D1","\u05D1\u05DF \u05D6\u05D5\u05D2","\u05D1\u05EA \u05D6\u05D5\u05D2","\u05D0\u05D9\u05E9 \u05E7\u05E9\u05E8 \u05DC\u05D7\u05D9\u05E8\u05D5\u05DD","\u05E7\u05E8\u05D5\u05D1 \u05DE\u05E9\u05E4\u05D7\u05D4","\u05D0\u05E4\u05D5\u05D8\u05E8\u05D5\u05E4\u05D5\u05E1","\u05DE\u05D5\u05D8\u05D1"],ar:["\u0627\u0633\u0645 \u0627\u0644\u0623\u0645","\u0627\u0633\u0645 \u0627\u0644\u0623\u0628","\u0627\u0644\u0632\u0648\u062C"],ru:["\u0441\u0443\u043F\u0440\u0443\u0433","\u043E\u043F\u0435\u043A\u0443\u043D"]},{id:"children",type:"minor_data",sensitivity:"critical",regulations:[...z],en:["children","child name","dependents","dependants"],he:["\u05D9\u05DC\u05D3\u05D9\u05DD","\u05E9\u05DE\u05D5\u05EA \u05D4\u05D9\u05DC\u05D3\u05D9\u05DD"],ar:["\u0627\u0644\u0623\u0637\u0641\u0627\u0644"],ru:["\u0434\u0435\u0442\u0438"]}];function Jo(e){return e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim()}function hr(){return qo.map(e=>{let t=[...e.en,...e.he??[],...e.ar??[],...e.ru??[]].map(Jo).filter(Boolean);return{type:e.type,tokens:t.filter(n=>!n.includes(" ")),phrases:t.filter(n=>n.includes(" "))}})}var Yo=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם_אדם|שם הלקוח|שם_הלקוח|שם בן זוג|שם בן_זוג|שם המבוטח|שם_המבוטח|שם המוטב|שם_המוטב|שם מבוטח|שם_מבוטח|שם מוטב|שם_מוטב|שם הילד|שם_הילד|שם הקטין|שם_הקטין|firstname_he|lastname_he|shem|shem_mishpacha|shem_prati)$/i,type:"name",label:"Person name (Hebrew)",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מספר_זהות|מס' זהות|מס_זהות|מס' ת"ז|teudat_zehut|tz|t_z|israeli_id|il_id)$/i,type:"id",label:"Israeli ID",labelHe:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|מס דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה|מס רישיון|דרכון_מספר)$/i,type:"id",label:"Passport / DL (Hebrew)",labelHe:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|דואר_אלקטרוני|אימייל|כתובת מייל|כתובת_מייל|כתובת דואר|כתובת_דואר)$/i,type:"email",label:"Email (Hebrew)",labelHe:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|מספר_טלפון|טלפון נייד|טלפון_נייד|מס נייד|מס_נייד|מס' טל)$/i,type:"phone",label:"Phone (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|כתובת_מגורים|רחוב|מס בית|מספר בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|כתובת_מלאה|מען)$/i,type:"address",label:"Address (Hebrew)",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|תאריך_לידה|ת לידה|תאריך הולדת|תאריך_הולדת|יום הולדת|יום_הולדת|גיל)$/i,type:"dob",label:"Date of birth (Hebrew)",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|חשבון_בנק|מספר חשבון|מספר_חשבון|מס חשבון|מס' חשבון|בנק|סניף|מס סניף|iban|iban_il)$/i,type:"financial",label:"Bank account (Hebrew)",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|כרטיס_אשראי|מספר אשראי|מס אשראי|מס' אשראי|cvv|אשראי|מס כרטיס|מס_כרטיס)$/i,type:"financial",label:"Credit card (Hebrew)",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר_ברוטו|שכר נטו|שכר_נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"Salary / income (Hebrew)",labelHe:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|בדיקה_רפואית|מצב רפואי|מצב_רפואי|חיסון|תוצאת בדיקה|תוצאת_בדיקה|רופא|רגישות|אלרגיה|סוג דם|סוג_דם)$/i,type:"medical",label:"Medical (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מספר_פוליסה|מס פוליסה|מס' פוליסה|פוליסה|מספר חבר|מספר_חבר|מס חבר|מספר ביטוח|מספר_ביטוח|policy_?number|policy_?no|policy_?id)$/i,type:"policy",label:"Insurance policy number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"},{pattern:/^(?:מספר סוכן|מספר_סוכן|מס סוכן|מס' סוכן|מס_סוכן|קוד סוכן|קוד_סוכן|מספר משווק|מספר_משווק|מספר יצרן|סוכן ביטוח|agent_?number|agent_?no|agent_?id|agent_?code|broker_?id|broker_?number)$/i,type:"agent_id",label:"Insurance agent / broker number (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"},{pattern:/^(?:שם הילד|שם_הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|מספר_ילדים|תעודת לידה|ת לידה ילד)$/i,type:"minor_data",label:"Minor data (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|נטייה_מינית|השקפה פוליטית|השקפה_פוליטית|מצב משפחתי|מצב_משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"Sensitive personal (Hebrew)",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מספר_רכב|מס רכב|מס' רכב|לוחית רישוי|לוחית_רישוי|מספר רישוי|מספר_רישוי)$/i,type:"tracking",label:"Vehicle ID (Hebrew)",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}];function Qt(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let n=t.padStart(9,"0"),r=0;for(let i=0;i<9;i++){let o=parseInt(n[i]??"0",10)*(i%2+1);o>9&&(o-=9),r+=o}return r%10===0&&parseInt(n,10)>0}var ht=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,mt=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,gt=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function mr(e){let t=String(e??"").replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let n=0,r=!1;for(let i=t.length-1;i>=0;i--){let o=t.charCodeAt(i)-48;if(o<0||o>9)return!1;r&&(o*=2,o>9&&(o-=9)),n+=o,r=!r}return n%10===0}function gr(e){if(!e)return null;let t=e.trim();for(let n of Yo)if(n.pattern.test(t))return{type:n.type,label:n.label,labelHe:n.labelHe};return null}var Qo=[{type:"biometric",tokens:["biometric","fingerprint","\u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"],phrases:["face id","\u05D8\u05D1\u05D9\u05E2\u05EA \u05D0\u05E6\u05D1\u05E2"]},{type:"medical",tokens:["diagnosis","medical","disease","medication","prescription","allergy","vaccine","\u05D0\u05D1\u05D7\u05D5\u05DF","\u05D0\u05D1\u05D7\u05E0\u05D4","\u05DE\u05D7\u05DC\u05D4","\u05EA\u05E8\u05D5\u05E4\u05D4","\u05DE\u05E8\u05E9\u05DD","\u05D7\u05D9\u05E1\u05D5\u05DF","\u05D0\u05DC\u05E8\u05D2\u05D9\u05D4"],phrases:["medical record","blood type","\u05DE\u05E6\u05D1 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05E1\u05D5\u05D2 \u05D3\u05DD"]},{type:"sensitive_personal",tokens:["religion","ethnicity","nationality","\u05D3\u05EA","\u05DC\u05D0\u05D5\u05DD","\u05E2\u05D3\u05D4","\u05DE\u05D5\u05E6\u05D0"],phrases:["sexual orientation","marital status","\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA"]},{type:"minor_data",tokens:["minor","\u05E7\u05D8\u05D9\u05DF"],phrases:["child name","\u05E9\u05DD \u05D4\u05D9\u05DC\u05D3","\u05E9\u05DD \u05D4\u05E7\u05D8\u05D9\u05DF"]},{type:"id",tokens:["ssn","passport","\u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF"],phrases:["national id","id number","identity number","social security","driver license","driving license","drivers license","passport number","tax id","\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4\u05D5\u05EA","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"]},{type:"financial",tokens:["iban","swift","bic","salary","income","wage","\u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4"],phrases:["bank account","account number","credit card","card number","routing number","sort code","\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"]},{type:"policy",tokens:["policy","\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"],phrases:["policy number","member number","\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"]},{type:"agent_id",tokens:["\u05DE\u05E9\u05D5\u05D5\u05E7"],phrases:["agent number","agent code","broker id","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"]},{type:"dob",tokens:["dob","birthdate","birthday","\u05DC\u05D9\u05D3\u05D4","\u05D4\u05D5\u05DC\u05D3\u05EA","\u05D2\u05D9\u05DC"],phrases:["date of birth","birth date","\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"]},{type:"phone",tokens:["phone","tel","mobile","cell","fax","\u05D8\u05DC\u05E4\u05D5\u05DF","\u05E0\u05D9\u05D9\u05D3","\u05E4\u05DC\u05D0\u05E4\u05D5\u05DF","\u05E1\u05DC\u05D5\u05DC\u05E8\u05D9"],phrases:["phone number","mobile number","cell phone","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E0\u05D9\u05D9\u05D3"]},{type:"email",tokens:["email","mail","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC","\u05DE\u05D9\u05D9\u05DC","\u05D3\u05D5\u05D0\u05DC"],phrases:["email address","e mail","\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D9\u05D9\u05DC"]},{type:"address",tokens:["address","street","city","zipcode","zip","postcode","\u05DB\u05EA\u05D5\u05D1\u05EA","\u05E8\u05D7\u05D5\u05D1","\u05E2\u05D9\u05E8","\u05D9\u05E9\u05D5\u05D1","\u05D9\u05D9\u05E9\u05D5\u05D1","\u05DE\u05D9\u05E7\u05D5\u05D3","\u05DE\u05E2\u05DF"],phrases:["home address","postal code","street address","zip code","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D2\u05D5\u05E8\u05D9\u05DD"]},{type:"location",tokens:["gps","latitude","longitude","geolocation","\u05DE\u05D9\u05E7\u05D5\u05DD"],phrases:["gps coordinates"]},{type:"tracking",tokens:["plate","vehicle","\u05E8\u05DB\u05D1","\u05E8\u05D9\u05E9\u05D5\u05D9"],phrases:["license plate","vehicle number","plate number","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"]},...hr(),{type:"name",tokens:["name","\u05E9\u05DD"],phrases:["first name","last name","full name","family name","given name","surname","\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0"]}];function yt(e){if(!e||/^\[[A-Z_]+(?:-\d+)?\]$/.test(e.trim()))return null;let t=e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim();if(!t)return null;let n=new Set(t.match(/[\p{L}\p{N}]+/gu)??[]);for(let r of Qo)if(r.phrases?.some(o=>t.includes(o))||r.tokens?.some(o=>n.has(o)))return{type:r.type,label:r.type,labelHe:bt(r.type)};return null}function bt(e){return{id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",employment:"\u05E4\u05E8\u05D8\u05D9 \u05EA\u05E2\u05E1\u05D5\u05E7\u05D4",education:"\u05D4\u05E9\u05DB\u05DC\u05D4",behavior:"\u05E4\u05E8\u05D5\u05E4\u05D9\u05DC \u05D4\u05EA\u05E0\u05D4\u05D2\u05D5\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",name:"\u05E9\u05DD \u05D0\u05D3\u05DD",email:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9",phone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",financial:"\u05E4\u05E8\u05D8\u05D9\u05DD \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9\u05D9\u05DD",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",minor_data:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF",sensitive_personal:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9",biometric:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9",auth:"\u05E1\u05D9\u05E1\u05DE\u05D0\u05D5\u05EA/\u05E1\u05D5\u05D3\u05D5\u05EA",tracking:"\u05DE\u05D6\u05D4\u05D9 \u05DE\u05E2\u05E7\u05D1",location:"\u05DE\u05D9\u05E7\u05D5\u05DD"}[e]??"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9"}function yr(e){let t=0,n=0,r=0,i=0,o=0;for(let a of e)typeof a=="string"&&(Qt(a)&&t++,ht.lastIndex=0,ht.test(a)&&n++,mt.lastIndex=0,mt.test(a)&&r++,gt.lastIndex=0,gt.test(a)&&i++,mr(a)&&o++);let s=e.length||1;return t/s>=.3?{type:"id",label:"Israeli ID (sniffed)",matchedSample:t}:i/s>=.3?{type:"financial",label:"IBAN-IL (sniffed)",matchedSample:i}:n/s>=.3?{type:"phone",label:"IL phone (sniffed)",matchedSample:n}:r/s>=.3?{type:"email",label:"Email (sniffed)",matchedSample:r}:o/s>=.3?{type:"financial",label:"Credit card (sniffed)",matchedSample:o}:null}var es=[{type:"full_name",kind:"name",severity:"medium",hint:`A person's name in free text (after a role word such as \u05DC\u05E7\u05D5\u05D7 / \u05DE\u05E8 / \u05E2\u05D5"\u05D3, or Client: / Mr.).`},{type:"bank_account",kind:"bank_account",severity:"high",hint:"An Israeli bank account number (branch-account-check form) in plaintext."},{type:"medical",kind:"medical",severity:"high",hint:"Medical information (diagnosis, medication, lab value) in plaintext."},{type:"birth_date",kind:"dob",severity:"medium",hint:"A date of birth in plaintext."},{type:"address",kind:"address",severity:"medium",hint:"A street address in plaintext."},{type:"license_plate",kind:"plate",severity:"low",hint:"A vehicle licence plate in plaintext."}],ts=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function ns(e,t,n,r){if(r==="address")return{start:t,end:n};let i=ts.exec(e.slice(t,n));return i&&t+i[0].length<n?{start:t+i[0].length,end:n}:{start:t,end:n}}function ie(e,t,n=()=>!0){let r=[],i=new RegExp(e.source,e.flags.includes("g")?e.flags:e.flags+"g");for(let o of t.matchAll(i)){let s=o[1];if(!s||!n(s))continue;let a=(o.index??0)+o[0].indexOf(s);r.push({start:a,end:a+s.length})}return r}var br=String.raw`[A-Z][a-z']+(?:-[A-Z]?[a-z']+)*`,en=String.raw`${br}(?:[ \t]+${br}){0,2}`,rs=new RegExp(String.raw`\b(?:Mr|Mrs|Ms|Miss|Dr|Prof)\.?[ \t]+(${en})`),is=new RegExp(String.raw`\b(?:Client|Customer|Patient|Name|Full name|Beneficiary|Insured|Applicant|Tenant|Employee|Holder|Investor)[ \t]*:[ \t]*(${en})`),os=new RegExp(String.raw`\b(${en})(?=,[ \t]*\d{1,3}[ \t]*,|[ \t]*\(\d{1,3}\))`,"g"),ss=/^(?:Figure|Fig|Table|Step|Section|Chapter|Page|Shot|Scene|Part|Item|Note|Appendix|Version|Level|Phase|Round|Room|Floor|Line|Act|Episode|Season|Slide|Clip|Take)$/,as=/\b(\d{1,5}[ \t]+(?:[A-Z][A-Za-z'-]*[ \t]+){1,3}(?:Street|St|Road|Rd|Avenue|Ave|Boulevard|Blvd|Lane|Ln|Drive|Way|Court|Ct|Place|Pl)\b\.?)/,cs=/\b(?:policy|claim|account|member|customer|client|contract|case|reference|ref|company|registration)[ \t]+(?:number|no\.?|num\.?|#)[ \t]*:?[ \t]*([A-Z]{0,4}-?\d[\d-]{3,}\d[A-Z]?)\b/i,ls=String.raw`\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}|\d{4}[\/\-.]\d{1,2}[\/\-.]\d{1,2}|\d{1,2}\s+[A-Z][a-z]{2,8}\s+\d{4}|[A-Z][a-z]{2,8}\s+\d{1,2},?\s+\d{4}`,us=new RegExp(String.raw`\b(?:date\s+of\s+birth|birth\s*date|d\.?o\.?b\.?|born(?:\s+on)?)\s*[:\-]?\s*(${ls})`,"i"),ds=/\b((?!000|666|9\d\d)\d{3}-(?!00)\d{2}-(?!0000)\d{4})\b/,fs=/\b((?!BG|GB|NK|KN|TN|NT|ZZ)[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z]\s?\d{2}\s?\d{2}\s?\d{2}\s?[A-D])\b/,ps=/(?<![\w+])(\+(?!972)[1-9][\d\s().-]{7,20}\d)/,_r=e=>e.replace(/\D/g,"").length,hs=[{kind:"name",severity:"medium",hint:"A person's name in free text (after Mr. / Dr. / Client: \u2026, or with an age beside it).",find:e=>[...ie(rs,e),...ie(is,e),...ie(os,e,t=>!ss.test(t.split(/[ \t]/).pop()??""))]},{kind:"address",severity:"medium",hint:"A street address in plaintext.",find:e=>ie(as,e)},{kind:"reference",severity:"medium",hint:"A policy, claim, account or company number in plaintext.",find:e=>ie(cs,e)},{kind:"dob",severity:"medium",hint:"A date of birth in plaintext.",find:e=>ie(us,e)},{kind:"national_id",severity:"high",hint:"A national ID number (US SSN, UK NINO) in plaintext.",find:e=>[...ie(ds,e),...ie(fs,e)]},{kind:"phone",severity:"high",hint:"A phone number in international form in plaintext.",find:e=>ie(ps,e,t=>_r(t)>=8&&_r(t)<=15)}];function ms(e){let t=new Map;for(let n of e){let r=t.get(n.kind);t.set(n.kind,r?{...r,find:i=>[...r.find(i),...n.find(i)]}:n)}return[...t.values()]}function xr(){let e=es.map(({type:t,kind:n,severity:r,hint:i})=>{let o=new $e([t]);return{kind:n,severity:r,hint:i,find:s=>o.detect(s).map(a=>ns(s,a.startIndex,a.endIndex,n))}});return ms([...e,...hs])}var _t={_comment:"CANONICAL secret ruleset \u2014 the SINGLE SOURCE OF TRUTH for hardcoded-secret detection, loaded by BOTH the web scanner (lib/soc/exposure-map.ts) and the installed Capsule agent (apps/desktop/src-tauri/src/scanner.rs, via include_str!). Patterns are written in the regex subset both JavaScript and the Rust `regex` crate accept (no lookaround, no backreferences). A connection string counts only WITH credentials (user:pass@). Edit here once and both engines stay aligned.",rules:[{id:"aws-access-key",subkind:"aws_access_key",name:"AWS Access Key",severity:"critical",pattern:"(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)",hint:"AWS access key id detected. Rotate via IAM and move to an environment variable."},{id:"aws-secret-key",subkind:"aws_secret_key",name:"AWS Secret Key",severity:"critical",pattern:`(?:aws_secret_access_key|aws_secret_key|secret_access_key)\\s*[=:]\\s*['"]?[A-Za-z0-9/+=]{40}['"]?`,hint:"AWS secret access key detected. Rotate immediately."},{id:"gcp-api-key",subkind:"gcp_api_key",name:"GCP API Key",severity:"critical",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Google API key detected. Restrict or rotate it in the Google Cloud console."},{id:"gcp-service-account",subkind:"gcp_service_account",name:"GCP Service Account",severity:"critical",pattern:'"type"\\s*:\\s*"service_account"',hint:"GCP service-account JSON detected. Move it out of the repo and rotate the key."},{id:"github-token",subkind:"github_token",name:"GitHub Token",severity:"critical",pattern:"gh[pousr]_[0-9a-zA-Z]{36,}",hint:"GitHub token detected. Revoke at https://github.com/settings/tokens."},{id:"github-fine-grained",subkind:"github_fine_grained_token",name:"GitHub Fine-Grained Token",severity:"critical",pattern:"github_pat_[0-9a-zA-Z_]{22,}",hint:"GitHub fine-grained token detected. Revoke it in GitHub settings."},{id:"gitlab-token",subkind:"gitlab_token",name:"GitLab Token",severity:"critical",pattern:"glpat-[0-9a-zA-Z_-]{20,}",hint:"GitLab token detected. Revoke it in GitLab access tokens."},{id:"stripe-secret",subkind:"stripe_key",name:"Stripe Secret Key",severity:"critical",pattern:"sk_live_[0-9a-zA-Z]{24,}",hint:"Stripe live secret key detected. Roll it in the Stripe dashboard."},{id:"stripe-restricted",subkind:"stripe_restricted_key",name:"Stripe Restricted Key",severity:"critical",pattern:"rk_live_[0-9a-zA-Z]{24,}",hint:"Stripe restricted key detected. Roll it in the Stripe dashboard."},{id:"slack-token",subkind:"slack_token",name:"Slack Token",severity:"high",pattern:"xox[baprs]-[0-9a-zA-Z-]{10,}",hint:"Slack token detected. Revoke it in the Slack app settings."},{id:"slack-webhook",subkind:"slack_webhook",name:"Slack Webhook",severity:"high",pattern:"hooks\\.slack\\.com/services/T[0-9A-Z]{8,}/B[0-9A-Z]{8,}/[0-9a-zA-Z]{24}",hint:"Slack incoming-webhook URL detected. Regenerate it."},{id:"twilio-api-key",subkind:"twilio_api_key",name:"Twilio API Key",severity:"high",pattern:"SK[0-9a-fA-F]{32}",hint:"Twilio API key detected. Rotate it in the Twilio console."},{id:"sendgrid-api-key",subkind:"sendgrid_api_key",name:"SendGrid API Key",severity:"critical",pattern:"SG\\.[0-9a-zA-Z_-]{22}\\.[0-9a-zA-Z_-]{43}",hint:"SendGrid API key detected. Rotate it in the SendGrid console."},{id:"postgres-uri",subkind:"postgres_uri",name:"PostgreSQL Connection String",severity:"critical",pattern:`postgres(?:ql)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"PostgreSQL connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"mongodb-uri",subkind:"mongodb_uri",name:"MongoDB Connection String",severity:"critical",pattern:`mongodb(?:\\+srv)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"MongoDB connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"redis-uri",subkind:"redis_uri",name:"Redis Connection String",severity:"high",pattern:`redis(?:s)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"Redis connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"openai-key",subkind:"openai_key",name:"OpenAI API Key",severity:"critical",pattern:"sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}",hint:"OpenAI API key detected. Rotate at https://platform.openai.com/api-keys."},{id:"anthropic-key",subkind:"anthropic_key",name:"Anthropic API Key",severity:"critical",pattern:"sk-ant-[0-9a-zA-Z_-]{40,}",hint:"Anthropic API key detected. Rotate at https://console.anthropic.com/."},{id:"firebase-key",subkind:"firebase_key",name:"Firebase API Key",severity:"high",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Firebase API key detected. Restrict it in the Firebase console."},{id:"supabase-key",subkind:"supabase_key",name:"Supabase Service Key",severity:"critical",pattern:"eyJ[0-9a-zA-Z_-]{100,}",hint:"Long JWT (possible Supabase service key) detected. Rotate it and keep it server-side only."},{id:"private-key",subkind:"private_key",name:"Private Key",severity:"critical",pattern:"-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----",hint:"Private key material in plaintext. Rotate immediately and move to a key manager (KMS/Vault).",skipPlaceholder:!0},{id:"jwt-secret",subkind:"jwt_secret",name:"JWT/Generic Secret",severity:"high",pattern:`(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded signing/API secret detected. Move it to an environment variable and rotate it."},{id:"password-in-code",subkind:"password_in_code",name:"Password in Code",severity:"high",pattern:`(?:password|passwd|pwd)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded password detected. Move it to a secret manager and rotate it."},{id:"bearer-token",subkind:"bearer_token",name:"Bearer Token in Code",severity:"high",pattern:`['"]Bearer\\s+[0-9a-zA-Z._-]{20,}['"]`,hint:"Hardcoded bearer token detected. Move it to a secret manager and rotate it."},{id:"hex-secret-32",subkind:"hex_secret",name:"Hardcoded 32+ Hex Secret",severity:"medium",pattern:`['"][0-9a-f]{32,}['"]`,hint:"Long hex string that looks like a secret/hash. Confirm it is not a live credential."},{id:"base64-secret",subkind:"base64_secret",name:"Hardcoded Base64 Secret (long)",severity:"medium",pattern:`['"][A-Za-z0-9+/]{64,}={0,2}['"]`,hint:"Long base64 blob that looks like an embedded secret. Confirm it is not a live credential."}]};var bs=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name",labelHe:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05D6\u05D4\u05D4"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth",labelHe:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account",labelHe:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card",labelHe:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Financial data",labelHe:"\u05E0\u05EA\u05D5\u05DF \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(ip_?address)$/i,type:"tracking",label:"IP address",labelHe:"\u05DB\u05EA\u05D5\u05D1\u05EA IP"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport number",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D3\u05E8\u05DB\u05D5\u05DF"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license",labelHe:"\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"},{pattern:/^(iban|swift_?code|bic)$/i,type:"financial",label:"Banking code",labelHe:"\u05E7\u05D5\u05D3 \u05D1\u05E0\u05E7\u05D0\u05D9"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05DE\u05E1"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Member ID",labelHe:"\u05DE\u05E1\u05E4\u05E8 \u05D1\u05D9\u05D8\u05D5\u05D7/\u05D7\u05D1\u05E8"},{pattern:/^(blood_?type|allergy|allergies|prescription)$/i,type:"medical",label:"Medical data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation",labelHe:"\u05DE\u05D9\u05E7\u05D5\u05DD \u05D2\u05D9\u05D0\u05D5\u05D2\u05E8\u05E4\u05D9"},{pattern:/^(mac_?address|device_?fingerprint|imei|serial_?number)$/i,type:"tracking",label:"Device identifier",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05DE\u05DB\u05E9\u05D9\u05E8"},{pattern:/^(ethnicity|race|religion|political_?affiliation|sexual_?orientation)$/i,type:"sensitive_personal",label:"Sensitive personal",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(minor|child_?name|child_?age|dependent)$/i,type:"minor_data",label:"Minor data",labelHe:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05E0\u05D9\u05DD"},{pattern:/^(signature|digital_?signature)$/i,type:"id",label:"Signature",labelHe:"\u05D7\u05EA\u05D9\u05DE\u05D4"},{pattern:/^(vehicle_?number|license_?plate|plate_?number)$/i,type:"tracking",label:"Vehicle ID",labelHe:"\u05DE\u05D6\u05D4\u05D4 \u05E8\u05DB\u05D1"}],_s=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|sort_?order|position|enabled|active|public|version|metadata|config|settings|options|data|content|body|raw|json|text|note|comment|label|color|icon|image|avatar|logo|thumbnail|preview|template|schema|format|mode|level|priority|severity|source|target|parent|child|owner|creator|modifier|assignee|project|workspace|organization|team|group|channel|thread|room|session|device|platform|browser|locale|timezone|currency|country|region|city|zip|postal|state|province|name|display_?name|user_?agent|password_?hash|secret|token|private_?key|auth_?token|constraint|index|sequence|trigger|function|procedure|database|namespace|migration|revision)$/i,xs=/^(beacon_?registr|device_?config|hardware|sensor|firmware|telemetry|metric|analytic|log_?event|audit_?log|system_?config|cache|queue|job|migration|schema_?version|spatial_?ref)/i,ws=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function wr(e,t){if(_s.test(e)||/^name$/i.test(e)||t&&xs.test(t)||ws.test(e))return null;for(let r of bs)if(r.pattern.test(e))return r.type;let n=gr(e);return n?n.type:null}var Al=_t.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var Il=512*1024,$l=50*1024*1024;var kr={id:"critical",agent_id:"high",policy:"high",financial:"critical",medical:"critical",sensitive_personal:"critical",minor_data:"critical",biometric:"critical",auth:"critical",name:"high",email:"high",phone:"high",address:"high",dob:"high",location:"high",tracking:"medium",employment:"high",education:"medium",behavior:"high"};function Sr(e){return kr[e]}function vs(e){return kr[e]??"low"}function Er(e,t){let n=[];for(let r of t){let i=r.rows.length;for(let o=0;o<r.headers.length;o++){let s=r.headers[o]??"",a=s?wr(s.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),r.name)??yt(s)?.type??null:null,l=[];for(let h of r.rows){let u=h[o];typeof u=="string"&&u.length>0&&l.push(u)}let c=l.length>0?yr(l):null;c?n.push(vr(e,r.name,s,c.type,c.label,"value",c.matchedSample,i)):a&&n.push(vr(e,r.name,s,a,bt(a),"header",0,i))}}return n}function vr(e,t,n,r,i,o,s,a){return{file:e,location:t,column:n,type:r,label:i,category:bt(r),severity:vs(r),matchKind:o,hits:s,sampleSize:a}}var ks=new Set(["hex-secret-32","base64-secret"]),Ss=[/(?:[$€£]|USD|EUR|GBP)\s?\d[\d,]*(?:\.\d+)?/g,/\d[\d,]*(?:\.\d+)?\s?(?:[$€£]|USD|EUR|GBP|דולר|יורו)/g,/\b\d{1,3}(?:,\d{3})+(?:\.\d+)?\b/g];function Es(e){let t=new $e(["financial_amount"]);return{kind:"amount",severity:"medium",hint:"A money amount (the amounts dial is on: amounts are treated as sensitive here).",find:n=>{if(!e())return[];let r=t.detect(n).map(o=>({start:o.startIndex,end:o.endIndex}));for(let o of Ss){o.lastIndex=0;for(let s of n.matchAll(o))r.push({start:s.index,end:s.index+s[0].length})}r.sort((o,s)=>o.start-s.start||s.end-o.end);let i=[];for(let o of r){let s=i[i.length-1];s&&o.start<s.end?s.end=Math.max(s.end,o.end):i.push({...o})}return i}}}function Ar(e={}){let t=e.amounts??(()=>!1),n=[...xr(),Es(t)],r=_t.rules.filter(i=>!ks.has(i.id)).map(i=>({id:i.id,name:i.name,severity:i.severity,pattern:new RegExp(i.pattern)}));return{text:n,amounts:t,header:i=>{let o=yt(i);return o?{type:o.type,label:o.labelHe||o.label}:null},secrets:r,table:i=>Er("",[i]).filter(o=>o.column).map(o=>({column:o.column,type:o.type,category:o.category,severity:o.severity,hits:o.hits,how:o.matchKind==="value"?"value":"header"})),severity:i=>Sr(i)}}import{existsSync as As,mkdirSync as zl,readFileSync as Is,writeFileSync as Wl}from"node:fs";import{homedir as $s}from"node:os";import{join as Ts}from"node:path";var Ir=()=>Ts($s(),".nodata","prefs.json");function tn(){try{return As(Ir())&&JSON.parse(Is(Ir(),"utf8")).amounts_sensitive===!0}catch{return!1}}var $r=!1;function Tr(){$r||($r=!0,vt(Ar({amounts:tn})))}var Rs=/[֑-ׇ]/g;function Cs(e){return e.normalize("NFC").replace(Rs,"").toLowerCase()}function Ls(e,t){if(!t)return 0;let n=0,r=e.indexOf(t);for(;r!==-1&&(n++,!(n>=1e5));)r=e.indexOf(t,r+t.length);return n}function Rr(e,t){if(!e||e.terms.length===0||!t)return[];let n=Cs(t);if(!n)return[];let r=[];for(let i of e.terms){let o=Ls(n,i.needle);o>0&&r.push({term_id:i.id,label:i.label,tier:i.tier,access_class:i.access_class,...i.flag?{flag:i.flag}:{},hit_count:o})}return r}import{basename as Ps,extname as Os,isAbsolute as au,join as cu,relative as lu,resolve as uu}from"node:path";var Ds=["claude-code","cursor","windsurf","codex","gemini","vscode","claude-desktop"],nn=e=>typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,pu={action:{cardinality:"scalar",ops:["eq","ne","in","not_in"],enumValues:["read","search","run","write","browse","interact"],label:"what the agent does (read, search, run, write; on a site: browse, interact)",extract:e=>e.action},"time.hour":{cardinality:"scalar",ops:["between","gte","lte","eq"],label:"hour on this computer (0-23; 18..6 wraps overnight)",extract:e=>e.now.getHours()},"time.weekday":{cardinality:"scalar",ops:["in","not_in","between","eq"],label:"weekday on this computer (0 Sunday \u2026 6 Saturday)",extract:e=>e.now.getDay()},"file.ext":{cardinality:"scalar",ops:["eq","ne","in","not_in"],label:"file type (.xlsx, .pdf, .env \u2026)",extract:e=>Os(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>Ps(e.path).toLowerCase()},agent:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:`which agent (${Ds.join(", ")} \u2026)`,extract:e=>nn(e.who?.host)},"agent.type":{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"sub-agent type inside the agent (main = the main conversation; general-purpose, explore \u2026)",extract:e=>nn(e.who?.type)},org:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:"which organisation the agent works for (the one its folder is bound to)",extract:e=>nn(e.who?.org)}};function Cr(e){return t=>Rr(e,t).map(n=>({term_id:n.term_id,label:n.label,tier:n.tier,hit_count:n.hit_count}))}function Lr(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)||Ns(e)}function Ns(e){return/(^|[\\/])\.nodata[\\/]/.test(e)}console.log=console.error;console.info=console.error;Tr();xt?.on("message",e=>{(async()=>{try{let t=new Set,n=new Set,i={r:await Jt({target_id:"mcp",target_label:e.label,target_path:e.target,log:Yt,...e.max_files?{max_files:e.max_files}:{},...e.include_tool_dirs?{include_tool_dirs:!0}:{},...e.time_budget_ms?{time_budget_ms:e.time_budget_ms}:{},onProgress:({walked:o,read:s})=>xt?.postMessage({type:"progress",walked:o,read:s}),onFileChecked:(o,s)=>(s?t:n).add(o.split("!/")[0]),skip_own_file:Lr,...e.lexicon?{lexicon:Cr(e.lexicon)}:{}}),readTop:[...t],notReadTop:[...n]};xt?.postMessage({type:"done",value:i})}catch(t){xt?.postMessage({type:"error",error:t instanceof Error?t.message:String(t)})}})()});
package/dist/status.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! @nodatachat/mcp 1.6.3 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
1
+ /*! @nodatachat/mcp 1.6.7 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
2
2
  import{execSync as vn}from"node:child_process";import{existsSync as xn,readFileSync as Z}from"node:fs";import{existsSync as T,mkdirSync as Dn,readdirSync as X,readFileSync as nn,rmSync as An,writeFileSync as Rn,chmodSync as Bn}from"node:fs";import{homedir as L}from"node:os";import{basename as Mn,isAbsolute as en,join as u,relative as tn,resolve as rn}from"node:path";var g=()=>u(L(),".nodata"),on=()=>u(g(),"credentials.json"),b=()=>u(g(),"orgs"),sn=()=>u(g(),"bindings.json"),ln=/^[A-Za-z0-9_.-]{1,80}$/,v=n=>ln.test(n)&&n!=="."&&n!=="..";function F(n){try{return T(n)?JSON.parse(nn(n,"utf8")):null}catch{return null}}function cn(n){return n?n.device?.org_id?n.device.org_id:n.api_key?`key-${(n.key_prefix??n.api_key.slice(0,12)).replace(/[^A-Za-z0-9_-]/g,"")}`:null:null}function E(){return cn(F(on()))}function m(){let n=[],t=E();t&&n.push(t);try{for(let e of X(b()))v(e)&&!n.includes(e)&&T(u(b(),e,"credentials.json"))&&n.push(e)}catch{}return n}function an(n){return n===E()?g():v(n)?u(b(),n):null}var un=n=>process.platform==="win32"||process.platform==="darwin"?n.toLowerCase():n,h=n=>un(rn(n.replace(/^~(?=[\\/]|$)/,L())));function dn(n,t){let e=tn(h(n),h(t));return e===""||!e.startsWith("..")&&!en(e)}function D(){let n=F(sn());return(Array.isArray(n?.bindings)?n.bindings:[]).filter(e=>!!e&&typeof e.folder=="string"&&typeof e.org_id=="string"&&v(e.org_id)).map(e=>e.project===void 0||hn(e.project)===e.project?e:{...e,project:void 0}).map(e=>e.client===void 0||typeof e.client?.org_id=="string"&&fn.test(e.client.org_id)?e:{...e,client:void 0})}var fn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function gn(n,t=D()){let e=null;for(let s of t)dn(s.folder,n)&&(!e||h(s.folder).length>h(e.folder).length)&&(e=s);return e}function x(n,t=m(),e=D()){if(t.length===0)return{kind:"none"};let s=gn(n,e.filter(c=>t.includes(c.org_id)));return s?{kind:"bound",org_id:s.org_id,folder:s.folder}:t.length===1?{kind:"only",org_id:t[0]}:{kind:"unbound",orgs:t}}function pn(n){let t=x(n);return t.kind==="bound"||t.kind==="only"?t.org_id:null}function hn(n){if(typeof n!="string")return null;let t=n.trim();return t&&t.length<=120&&!/[\u0000-\u001f\\/]/.test(t)?t:null}function A(n,t=process.cwd()){if(m().length===0)return g();let e=n??pn(t);return e?an(e):null}import{homedir as Sn}from"node:os";import{join as d}from"node:path";var R=["\u{1F7E3}","\u{1F535}","\u{1F7E0}","\u{1F7E4}","\u{1F7E1}"];function mn(n){let t=0;for(let e of n)t=t*31+e.codePointAt(0)>>>0;return R[t%R.length]}function B(n,t){let e=(n||"agent").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").slice(0,40);return t?`${e}@${t}`:e}function J(n){return`${mn(n)} ${n}`}var P="2026-09-24-v3";import{existsSync as $n,mkdirSync as Kn,readFileSync as _n,writeFileSync as Un}from"node:fs";import{homedir as yn}from"node:os";import{join as jn}from"node:path";var M=()=>jn(yn(),".nodata","prefs.json");function kn(){try{let n=$n(M())?JSON.parse(_n(M(),"utf8")).lang:null;return n==="he"||n==="en"?n:null}catch{return null}}function wn(){let t=process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"";try{t||=Intl.DateTimeFormat().resolvedOptions().locale}catch{}return/^(he|iw)(?:[-_.@]|$)/i.test(t)?"he":"en"}function bn(){return kn()??wn()}function r(n,t,e=bn()){return e==="he"?n:t}var On="\x1B[32m",a="\x1B[33m",w="\x1B[31m",N="\x1B[2m",i="\x1B[0m";function f(n){try{return xn(n)?JSON.parse(Z(n,"utf8")):null}catch{return null}}var C="";try{C=Z(0,"utf8")}catch{}var p=Sn(),Nn=f(d(p,".claude","settings.json")),I=(Nn?.hooks?.PreToolUse??[]).flatMap(n=>n.hooks??[]).find(n=>n.command.includes("gate.mjs"))?.command,S=I?I.includes("--block")?"block":"ask":null,Cn=f(d(p,".nodata","consent.json")),Tn=Cn?.terms_version===P,q=f(d(p,".nodata","credentials.json")),Ln=B("claude-code",q?.device?.label),o=[],_;Tn?S?(_=On,o.push(r(`\u05E9\u05E2\u05E8 ${S==="block"?"\u05D7\u05D5\u05E1\u05DD":"\u05E9\u05D5\u05D0\u05DC"}`,`gate ${S}`),r("\u05EA\u05E0\u05D0\u05D9\u05DD \u2713","terms \u2713"))):(_=a,o.push(r("\u05E9\u05E2\u05E8 \u05DB\u05D1\u05D5\u05D9","gate off"))):(_=w,o.push(r("\u05EA\u05E0\u05D0\u05D9 \u05E9\u05D9\u05DE\u05D5\u05E9 \u05DC\u05D0 \u05D0\u05D5\u05E9\u05E8\u05D5 \u2014 nodata_terms","terms not accepted \u2014 nodata_terms")));var l=f(d(p,".nodata","connection.json")),z=l?.at?Date.now()-Date.parse(l.at)<60*6e4:!1,H=`${a}${r("\u05DC\u05D0 \u05DE\u05D7\u05D5\u05D1\u05E8","not connected")}${i}`;z&&l?.state==="waiting"?o.push(`${a}${r("\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8","waiting for approval")}${i}`):q?!l||!z?o.push(`${a}${r("\u05D7\u05D9\u05D1\u05D5\u05E8 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7","connection not checked")}${i}`):l.state==="connected"?o.push(r("\u05DE\u05D7\u05D5\u05D1\u05E8 \u2713","connected \u2713")):l.state==="reconnecting"?o.push(`${a}${r("\u05DE\u05EA\u05D7\u05D1\u05E8 \u05DE\u05D7\u05D3\u05E9\u2026","reconnecting\u2026")}${i}`):l.state==="restart"?o.push(`${a}${r("\u05D0\u05D5\u05E9\u05E8 \u2014 \u05D4\u05E7\u05DC\u05D3 /mcp","approved \u2014 type /mcp")}${i}`):l.state==="needs-you"?o.push(`${w}${r("\u05DC\u05D0 \u05DE\u05D7\u05D5\u05D1\u05E8","not connected")} \u2192 ${l.step??"nodata_connect"}${i}`):o.push(H):o.push(H);var G=m(),y=process.cwd();try{let n=JSON.parse(C);y=n.workspace?.current_dir||n.cwd||y}catch{}if(G.length>1){let n=x(y,G);n.kind==="bound"||n.kind==="only"?o.push(`${r("\u05D0\u05E8\u05D2\u05D5\u05DF","org")} ${n.org_id.slice(0,8)}`):o.push(`${w}${r("\u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05DC\u05D0 \u05E9\u05D5\u05D9\u05DB\u05D4 \u05DC\u05D0\u05E8\u05D2\u05D5\u05DF","folder bound to no org")}${i}`)}var K=A(null,y),$=K?f(d(K,"capsule.json")):null;if($){let n=$.last_heartbeat_ok_at?Date.parse($.last_heartbeat_ok_at):NaN,t=Number.isFinite(n)?Math.round((Date.now()-n)/6e4):1/0,e=s=>s<120?r(`${s} \u05D3'`,`${s}m`):r(`${Math.round(s/60)} \u05E9'`,`${Math.round(s/60)}h`);$.revoked?o.push(`${w}${r('\u05D4\u05E6\u05D5\u05DE\u05EA \u05D4\u05D5\u05E9\u05D4\u05D4 \u05E2"\u05D9 \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF',"node paused by org")}${i}`):t<=15?o.push(`${r("\u05E6\u05D5\u05DE\u05EA","node")} \u2713 ${t<1?r("\u05E2\u05DB\u05E9\u05D9\u05D5","now"):e(t)}`):o.push(`${a}${r("\u05E6\u05D5\u05DE\u05EA \u05DC\u05D0 \u05D0\u05D5\u05DE\u05EA","node not verified")}${Number.isFinite(t)?` ${e(t)}`:""}${i}`)}o.push(J(Ln));var U=n=>n.split(".").map(Number),Y=(n,t)=>{let[e,s]=[U(n),U(t)];for(let c=0;c<3;c++)if(e[c]!==s[c])return e[c]>s[c];return!1},Q=[...new Set(Object.values(l?.versions??{}).map(n=>n.version).concat(l?.version??[]))].filter(n=>/^\d+\.\d+\.\d+$/.test(n)),j=Q.reduce((n,t)=>!n||Y(t,n)?t:n,null),O=Q.filter(n=>j&&Y(j,n)),Fn=j?` ${N}v${j}${i}${O.length?` ${a}${r(`(v${O.join(", v")} \u05D1\u05D7\u05DC\u05D5\u05DF \u05D0\u05D7\u05E8: /mcp)`,`(v${O.join(", v")} in another window: /mcp)`)}${i}`:""}`:"",V=`${_}\u25CF NoData${i}${Fn} ${N}\xB7${i} ${o.join(` ${N}\xB7${i} `)}`,W=f(d(p,".nodata","statusline-prev.json"))?.command,k="";if(W)try{k=vn(W,{input:C,timeout:2e3,encoding:"utf8"}).trim()}catch{k=""}process.stdout.write(k?`${k} \u2502 ${V}`:V);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodatachat/mcp",
3
- "version": "1.6.3",
3
+ "version": "1.6.7",
4
4
  "description": "NoData MCP server: connect any MCP client (Claude Code, Codex, Cursor, VS Code) to the NoData Information Access Processor. Governed access for AI agents, with a verifiable proof for every decision.",
5
5
  "bin": {
6
6
  "nodata-mcp": "dist/index.js"