@nodatachat/mcp 1.5.6 → 1.5.9

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.
package/dist/gate.js CHANGED
@@ -1,54 +1,58 @@
1
- /*! @nodatachat/mcp 1.5.6 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
2
- import{appendFileSync as ao,copyFileSync as Bd,existsSync as yr,mkdirSync as co,readdirSync as lo,readFileSync as uo,statSync as Zt,writeFileSync as zd}from"node:fs";import{homedir as ue}from"node:os";import{basename as Xt,extname as br,isAbsolute as fe,join as tt,relative as fo,resolve as C}from"node:path";import{TextDecoder as Hn}from"node:util";var P={text:[],header:[],secrets:[],table:null,amounts:null,severity:null};function ut(e){e.table&&(P.table=e.table),e.severity&&(P.severity=e.severity),e.amounts&&(P.amounts=e.amounts);for(let t of e.text??[])P.text.some(r=>r.kind===t.kind)||P.text.push(t);e.header&&!P.header.includes(e.header)&&P.header.push(e.header);for(let t of e.secrets??[])P.secrets.some(r=>r.id===t.id)||P.secrets.push(t)}function ft(){return P.amounts?.()===!0}function Ae(){return P.text}function en(){return P.header}function ge(){return P.table}function tn(){return P.secrets}var $e=[{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 ye(){let e=tn().filter(t=>!$e.some(r=>r.id===t.id));return[...$e,...e]}var Vr=[{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"}],Gr=[{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"}],Kr=/^(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,Zr=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(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(Kr.test(t)||/^name$/i.test(t)||/^\[[A-Z_]+(?:-\d+)?\]$/.test(t))return null;let r=t.replace(/[\s-]+/g,"_");for(let n of[...Gr,...Vr])if(n.pattern.test(t)||n.pattern.test(r))return{type:n.type,label:n.label};if(Zr.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(r))return{type:"name",label:"Person name"};for(let n of en()){let i=n(t);if(i)return{type:i.type,label:i.label}}return null}function nn(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let i=0;i<9;i++){let s=parseInt(r[i]??"0",10)*(i%2+1);s>9&&(s-=9),n+=s}return n%10===0&&parseInt(r,10)>0}function Xr(e){let t=String(e??"").replace(/\D/g,"");if(t.length<12||t.length>19)return!1;let r=0,n=!1;for(let i=t.length-1;i>=0;i-=1){let s=parseInt(t[i]??"0",10);n&&(s*=2,s>9&&(s-=9)),r+=s,n=!n}return r%10===0}function Jr(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 r=t.slice(4)+t.slice(0,4),n=0;for(let i of r){let s=i>="A"&&i<="Z"?String(i.charCodeAt(0)-55):i;for(let o of s)n=(n*10+Number(o))%97}return n===1}var pt="(?<!\\d)(?<!\\d[.,])",ht="(?!\\d)(?![.,]\\d)",mt=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${pt}\\d{9}${ht}`,"g"),validate:nn,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(`${pt}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${ht}`,"g"),validate:Xr,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:Jr,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${pt}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${ht}`,"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 Ie(e,t){let r=[],n="",i=!1;for(let s=0;s<e.length;s++){let o=e[s];i?o==='"'&&e[s+1]==='"'?(n+='"',s++):o==='"'?i=!1:n+=o:o==='"'?i=!0:o===t?(r.push(n),n=""):n+=o}return r.push(n),r}import{inflateRawSync as Ci}from"node:zlib";import{inflateSync as qr}from"node:zlib";var Te=new Set([".pdf"]),rn=8*1024*1024;function cn(e){let t=e.toString("latin1"),r=new Map,n=/(\d+)\s+(\d+)\s+obj\b/g,i;for(;(i=n.exec(t))!==null;){let s=Number(i[1]),o=n.lastIndex,a=t.indexOf("endobj",o);if(a<0)continue;let l=t.indexOf("stream",o),c,u=null;if(l>=0&&l<a){c=t.slice(o,l);let d=l+6;t[d]==="\r"&&(d+=1),t[d]===`
3
- `&&(d+=1);let f=t.indexOf("endstream",d);f>d&&(u=e.subarray(d,f))}else c=t.slice(o,a);r.set(s,{num:s,dict:c,stream:u})}for(let s of[...r.values()]){if(!s.stream||!/\/Type\s*\/ObjStm\b/.test(s.dict))continue;let o=Re(s),a=Number(/\/N\s+(\d+)/.exec(s.dict)?.[1]??0),l=Number(/\/First\s+(\d+)/.exec(s.dict)?.[1]??-1);if(o===null||!a||l<0)continue;let c=o.slice(0,l).trim().split(/\s+/).map(Number);for(let u=0;u<a;u+=1){let d=c[2*u],f=c[2*u+1];if(d===void 0||f===void 0||Number.isNaN(d)||Number.isNaN(f))break;let h=u+1<a?c[2*(u+1)+1]:void 0,m=o.slice(l+f,h!==void 0?l+h:void 0);r.has(d)||r.set(d,{num:d,dict:m,stream:null})}}return r}function gt(e){let t=[...e.replace(/\s+/g,"")];if(t.length<40)return!1;let r=0,n=0;for(let i of t){let s=i.codePointAt(0)??0;s<32||s>=127&&s<=191||s===65533||s>=57344&&s<=63743?r+=1:/[\p{L}\p{N}]/u.test(i)&&(n+=1)}return r/t.length>.2||n/t.length<.25}function Yr(e){let t=e.toString("latin1").replace(/\s/g,"");t.startsWith("<~")&&(t=t.slice(2));let r=t.indexOf("~>");r>=0&&(t=t.slice(0,r));let n=[],i=0,s=0;for(let o of t){if(o==="z"&&s===0){n.push(0,0,0,0);continue}let a=o.charCodeAt(0)-33;if(a<0||a>84)return null;i=i*85+a,s+=1,s===5&&(n.push(i>>>24&255,i>>>16&255,i>>>8&255,i&255),i=0,s=0)}if(s>0){for(let a=s;a<5;a+=1)i=i*85+84;let o=[i>>>24&255,i>>>16&255,i>>>8&255,i&255];for(let a=0;a<s-1;a+=1)n.push(o[a]??0)}return Buffer.from(n)}function Qr(e){let t=e.toString("latin1").replace(/\s/g,"").split(">")[0]??"",r=t.length%2?t+"0":t;return/^[0-9A-Fa-f]*$/.test(r)?Buffer.from(r,"hex"):null}function ei(e){let t=/\/Filter\s*(\[[^\]]*\]|\/\w+)/.exec(e);return!t||!t[1]?[]:[...t[1].matchAll(/\/(\w+)/g)].map(r=>r[1]??"")}function Re(e){if(!e.stream)return null;let t=e.stream;for(let r of ei(e.dict)){let n=null;if(r==="FlateDecode")try{n=qr(t)}catch{return null}else if(r==="ASCII85Decode")n=Yr(t);else if(r==="ASCIIHexDecode")n=Qr(t);else return null;if(n===null)return null;t=n}return t.toString("latin1")}function ti(e){let t=new Map,r=1,n=/begincodespacerange([\s\S]*?)endcodespacerange/.exec(e);if(n&&n[1]){let l=/<([0-9A-Fa-f]+)>/.exec(n[1]);l&&l[1]&&l[1].length>=4&&(r=2)}let i=l=>{let c="";for(let u=0;u+3<l.length+1;u+=4){let d=parseInt(l.slice(u,u+4),16);Number.isFinite(d)&&d>0&&(c+=String.fromCharCode(d))}return c},s=/beginbfchar([\s\S]*?)endbfchar/g,o;for(;(o=s.exec(e))!==null;){let l=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,c;for(;(c=l.exec(o[1]??""))!==null;)t.set(parseInt(c[1]??"0",16),i(c[2]??""))}let a=/beginbfrange([\s\S]*?)endbfrange/g;for(;(o=a.exec(e))!==null;){let l=o[1]??"",c=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,u;for(;(u=c.exec(l))!==null;){let d=parseInt(u[1]??"0",16),f=parseInt(u[2]??"0",16),h=parseInt((u[3]??"0").slice(0,4)||"0",16);if(!(f-d>65535))for(let m=d;m<=f;m+=1)t.set(m,String.fromCharCode(h+(m-d)))}}return{map:t,bytes:r}}function ni(e){let t=new Map,r=[],n=[];for(let s of e.values()){for(let o of s.dict.matchAll(/\/Font\s*<<([\s\S]*?)>>/g))o[1]&&n.push(o[1]);for(let o of s.dict.matchAll(/\/Font\s+(\d+)\s+\d+\s+R/g)){let a=e.get(Number(o[1]));a&&n.push(a.dict)}}let i=new Set;for(let s of n){let o=/\/([^\s/<>[\]()]+)\s+(\d+)\s+\d+\s+R/g,a;for(;(a=o.exec(s))!==null;){let l=`${a[1]}#${a[2]}`;i.has(l)||(i.add(l),r.push([a[1]??"",Number(a[2])]))}}for(let[s,o]of r){let a=e.get(o);if(!a)continue;let l=null,c=/\/ToUnicode\s+(\d+)\s+\d+\s+R/.exec(a.dict);if(c){let d=e.get(Number(c[1])),f=d?Re(d):null;f&&(l=ti(f))}if(l||(l=si(a.dict,e)),!l)continue;let u=t.get(s)??[];u.push(l),t.set(s,u)}return t}var ri=["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 ii(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 r=/^afii(\d{5})$/.exec(e);if(r){let s=Number(r[1]);if(s>=57664&&s<=57690)return String.fromCharCode(1488+(s-57664))}let n=ri.indexOf(e.replace(/hebrew$/,""));return n>=0?String.fromCharCode(1488+n):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 si(e,t){let r=e,n=/\/Encoding\s+(\d+)\s+\d+\s+R/.exec(e);n&&(r=t.get(Number(n[1]))?.dict??"");let i=/\/Differences\s*\[([^\]]*)\]/.exec(r);if(!i?.[1])return null;let s=new Map,o=0;for(let a of i[1].match(/\d+|\/[^\s/[\]]+/g)??[]){if(/^\d+$/.test(a)){o=Number(a);continue}let l=ii(a.slice(1));l!==null&&s.set(o,l),o+=1}return s.size?{map:s,bytes:1}:null}function ln(e){let t=[];for(let r=0;r<e.length;r+=1){let n=e[r];if(n!=="\\"){t.push(n.charCodeAt(0)&255);continue}let i=e[r+1];if(i===void 0)break;if(i>="0"&&i<="7"){let o="",a=r+1;for(;a<e.length&&o.length<3&&e[a]>="0"&&e[a]<="7";)o+=e[a],a+=1;t.push(parseInt(o,8)&255),r=a-1;continue}let s={n:10,r:13,t:9,b:8,f:12};t.push(s[i]??i.charCodeAt(0)&255),r+=1}return t}function dn(e){if(e.length<2||e[0]!==254||e[1]!==255)return null;let t="";for(let r=2;r+1<e.length;r+=2)t+=String.fromCharCode((e[r]??0)<<8|(e[r+1]??0));return t}function sn(e,t){let r=dn(e);if(r!==null)return r;if(!t)return e.map(i=>String.fromCharCode(i)).join("");let n="";if(t.bytes===2)for(let i=0;i+1<e.length;i+=2){let s=(e[i]??0)<<8|(e[i+1]??0);n+=t.map.get(s)??""}else for(let i of e)n+=t.map.get(i)??String.fromCharCode(i);return n}function oi(e){let t=0;for(let r of e){let n=r.codePointAt(0)??0;/[\p{L}\p{N}]/u.test(r)?t+=1:(n<32||n>=127&&n<=191||n===65533)&&(t-=2)}return t}function on(e,t){if(!t||t.length<=1)return sn(e,t?.[0]);let r="",n=-1/0;for(let i of t){let s=sn(e,i),o=oi(s);o>n&&(r=s,n=o)}return r}function ai(e,t){let r="",n="",i,s=!1,o="",a=0,l=null,c=()=>{n.trim()&&(r+=n+`
4
- `),n="",a=0},u=()=>{n&&!n.endsWith(" ")&&a>1&&(n+=" ")},d=/\/([^\s/<>[\]()]+)\s+-?[\d.]+\s+Tf|(-?[\d.]+)\s+(-?[\d.]+)\s+T[dD]\b|(?:-?[\d.]+\s+){5}(-?[\d.]+)\s+Tm\b|T\*|\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>|\[|\]|-?\d+(?:\.\d+)?|TJ|Tj|'|"/g,f;for(;(f=d.exec(e))!==null;){let h=f[0];if(f[1]!==void 0&&h.endsWith("Tf")){i=t.get(f[1]);continue}if(f[2]!==void 0){Math.abs(Number(f[3]))>.01?c():Number(f[2])!==0&&u();continue}if(f[4]!==void 0){let m=Number(f[4]);l!==null&&Math.abs(m-l)>.01?c():l!==null&&u(),l=m;continue}if(h==="T*"){c();continue}if(h==="["){s=!0;continue}if(h==="]"){s=!1;continue}if(h==="TJ"||h==="Tj"||h==="'"||h==='"'){(h==="'"||h==='"')&&c(),o&&(n+=o,a=o.trim().length,o="");continue}if(h.startsWith("("))o+=on(ln(h.slice(1,-1)),i);else if(h.startsWith("<")){let m=h.slice(1,-1).replace(/\s+/g,""),g=[];for(let b=0;b+1<m.length;b+=2)g.push(parseInt(m.slice(b,b+2),16));o+=on(g,i)}else s&&Number(h)<-200&&o&&!o.endsWith(" ")&&(o+=" ")}return o&&(n+=o),c(),r}function ci(e,t){let r=e.toString("latin1"),n=/\/Info\s+(\d+)\s+\d+\s+R/.exec(r),i=n?t.get(Number(n[1]))?.dict:void 0;if(!i)return"";let s=[],o=/\/(Author|Title|Subject|Keywords|Creator|Producer)\s*(\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>)/g,a;for(;(a=o.exec(i))!==null;){let l=a[2]??"";if(l.startsWith("(")){let c=ln(l.slice(1,-1));s.push(dn(c)??c.map(u=>String.fromCharCode(u)).join(""))}else{let c=l.slice(1,-1).replace(/\s+/g,""),u="";if(c.toUpperCase().startsWith("FEFF"))for(let d=4;d+3<c.length+1;d+=4)u+=String.fromCharCode(parseInt(c.slice(d,d+4),16));else for(let d=0;d+1<c.length;d+=2)u+=String.fromCharCode(parseInt(c.slice(d,d+2),16));s.push(u)}}return s.join(`
5
- `)}var an="\u05DD\u05DF\u05E5\u05E3\u05DA";function Ce(e){let t=0,r=0;for(let n of e.match(/[\u05D0-\u05EA]{2,}/g)??[])an.includes(n[0])&&(t+=1),an.includes(n[n.length-1])&&(r+=1);return t>=3&&t>r*2}var li={"(":")",")":"(","[":"]","]":"[","<":">",">":"<","{":"}","}":"{"};function Pe(e){return/[\u05D0-\u05EA]/.test(e)?[...e].reverse().map(r=>li[r]??r).join("").replace(/[A-Za-z0-9](?:[A-Za-z0-9@._\-/:+]*[A-Za-z0-9])?/g,r=>[...r].reverse().join("")):e}function yt(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-")||e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return null;let r=cn(e);if(r.size===0)return null;let n=ni(r),i=[];i.push(ci(e,r));let s=0,o=0,a=!1;for(let c of r.values()){if(!c.stream||!/\/Subtype\s*\/Form\b/.test(c.dict)&&/\/Subtype|\/Type\s*\/(XObject|Font|Metadata|ObjStm|XRef)|\/FontFile/.test(c.dict))continue;let d=Re(c);if(d===null||!/(TJ|Tj)\b/.test(d))continue;let f=ai(d,n);if(f.trim().length!==0){if(o+=1,s+f.length>rn){i.push(f.slice(0,Math.max(0,rn-s))),a=!0;break}i.push(f),s+=f.length}}if(o===0)return null;let l=i.slice(1).join(`
6
- `);return gt(l)?null:(Ce(l)&&(l=l.split(`
7
- `).map(Pe).join(`
8
- `)),{text:[i[0]??"",l].join(`
9
- `),truncated:a,streams:o})}function un(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return"not a valid PDF";if(e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return"encrypted (password or copy protection)";let r=cn(e),n=0,i=0,s=0;for(let o of r.values()){if(!o.stream)continue;if(/\/Subtype\s*\/Image\b/.test(o.dict)){i+=1;continue}let a=Re(o);if(a===null){/\/Type\s*\/(Font|Metadata|XRef)|\/FontFile|\/Length1/.test(o.dict)||(s+=1);continue}/(TJ|Tj)\b/.test(a)&&(n+=1)}return n===0&&i>0?"no text layer \u2014 a scanned image (needs OCR, which NoData does not do)":n===0&&s>0?"its pages are compressed in a way NoData cannot open":n===0?"no text in it":"its fonts have no usable letter map \u2014 the text decodes to symbols"}import{execFileSync as di}from"node:child_process";import{existsSync as ui,mkdtempSync as fi,readFileSync as pn,readdirSync as Ne,rmSync as pi,statSync as hi,writeFileSync as hn}from"node:fs";import{tmpdir as mi}from"node:os";import{delimiter as gi,join as T}from"node:path";var ee="install the free tools once (they run only on this computer): winget install oschwartz10612.Poppler and winget install UB-Mannheim.TesseractOCR (tick Hebrew in its installer)",Le=null;function fn(e){try{return hi(e).isFile()}catch{return!1}}function yi(){let e=[],t=[process.env.ProgramFiles,process.env["ProgramFiles(x86)"]].filter(Boolean),r=process.env.LOCALAPPDATA;for(let n of t)e.push(T(n,"Tesseract-OCR"));if(r){e.push(T(r,"Programs","Tesseract-OCR"),T(r,"Microsoft","WinGet","Links"));let n=T(r,"Microsoft","WinGet","Packages");try{for(let i of Ne(n))if(/^oschwartz10612\.Poppler/i.test(i))for(let s of Ne(T(n,i)))e.push(T(n,i,s,"Library","bin"))}catch{}}for(let n of t)try{for(let i of Ne(n))/^poppler/i.test(i)&&e.push(T(n,i,"Library","bin"),T(n,i,"bin"))}catch{}return e}function De(e,t){let r=process.env[t];if(r)return fn(r)?r:void 0;let n=process.platform==="win32",i=n?[`${e}.exe`,e]:[e],s=(process.env.PATH??"").split(gi).filter(Boolean);n&&s.push(...yi());for(let o of s)for(let a of i)if(fn(T(o,a)))return T(o,a)}function V(e,t,r){try{return di(e,t,{encoding:"utf8",timeout:r,maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{return null}}function te(){if(Le)return Le;if(/^(0|off|false|no)$/i.test(process.env.NODATA_PDF_TOOLS??""))return Le={ocrLangs:[],osd:!1};let e={pdftotext:De("pdftotext","NODATA_PDFTOTEXT"),pdftoppm:De("pdftoppm","NODATA_PDFTOPPM"),tesseract:De("tesseract","NODATA_TESSERACT"),ocrmypdf:De("ocrmypdf","NODATA_OCRMYPDF"),ocrLangs:[],osd:!1};if(e.tesseract){let t=new Set((V(e.tesseract,["--list-langs"],15e3)??"").split(/\r?\n/).map(r=>r.trim()));e.ocrLangs=["heb","eng"].filter(r=>t.has(r)),e.osd=t.has("osd")}return Le=e}function _t(e,t,r=".pdf"){let n=fi(T(mi(),"nd-read-"));try{let i=T(n,`in${r}`);return hn(i,e,{mode:384}),t(n,i)}finally{pi(n,{recursive:!0,force:!0})}}function xt(e){let t=e.replace(/[\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,"").replace(/\f/g,`
1
+ /*! @nodatachat/mcp 1.5.9 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
2
+ import{appendFileSync as Hs,copyFileSync as Lu,existsSync as Fr,mkdirSync as jr,readdirSync as Us,readFileSync as Mr,statSync as on,writeFileSync as Bs}from"node:fs";import{homedir as V}from"node:os";import{basename as sn,extname as Hr,isAbsolute as me,join as he,relative as zs,resolve as O}from"node:path";import{TextDecoder as Yn}from"node:util";var D={text:[],header:[],secrets:[],table:null,amounts:null,severity:null};function ht(e){e.table&&(D.table=e.table),e.severity&&(D.severity=e.severity),e.amounts&&(D.amounts=e.amounts);for(let t of e.text??[])D.text.some(r=>r.kind===t.kind)||D.text.push(t);e.header&&!D.header.includes(e.header)&&D.header.push(e.header);for(let t of e.secrets??[])D.secrets.some(r=>r.id===t.id)||D.secrets.push(t)}function mt(){return D.amounts?.()===!0}function Ie(){return D.text}function pn(){return D.header}function be(){return D.table}function hn(){return D.secrets}var Te=[{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 _e(){let e=hn().filter(t=>!Te.some(r=>r.id===t.id));return[...Te,...e]}var hi=[{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"}],mi=[{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"}],gi=/^(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,yi=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(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 xe(e){if(!e)return null;let t=e.trim();if(gi.test(t)||/^name$/i.test(t)||/^\[[A-Z_]+(?:-\d+)?\]$/.test(t))return null;let r=t.replace(/[\s-]+/g,"_");for(let n of[...mi,...hi])if(n.pattern.test(t)||n.pattern.test(r))return{type:n.type,label:n.label};if(yi.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(r))return{type:"name",label:"Person name"};for(let n of pn()){let i=n(t);if(i)return{type:i.type,label:i.label}}return null}function mn(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let i=0;i<9;i++){let o=parseInt(r[i]??"0",10)*(i%2+1);o>9&&(o-=9),n+=o}return n%10===0&&parseInt(r,10)>0}function bi(e){let t=String(e??"").replace(/\D/g,"");if(t.length<12||t.length>19)return!1;let r=0,n=!1;for(let i=t.length-1;i>=0;i-=1){let o=parseInt(t[i]??"0",10);n&&(o*=2,o>9&&(o-=9)),r+=o,n=!n}return r%10===0}function _i(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 r=t.slice(4)+t.slice(0,4),n=0;for(let i of r){let o=i>="A"&&i<="Z"?String(i.charCodeAt(0)-55):i;for(let s of o)n=(n*10+Number(s))%97}return n===1}var gt="(?<!\\d)(?<!\\d[.,])",yt="(?!\\d)(?![.,]\\d)",bt=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${gt}\\d{9}${yt}`,"g"),validate:mn,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(`${gt}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${yt}`,"g"),validate:bi,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:_i,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${gt}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${yt}`,"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 Re(e,t){let r=[],n="",i=!1;for(let o=0;o<e.length;o++){let s=e[o];i?s==='"'&&e[o+1]==='"'?(n+='"',o++):s==='"'?i=!1:n+=s:s==='"'?i=!0:s===t?(r.push(n),n=""):n+=s}return r.push(n),r}import{inflateRawSync as eo}from"node:zlib";import{inflateSync as xi}from"node:zlib";var Ce=new Set([".pdf"]),gn=8*1024*1024;function xn(e){let t=e.toString("latin1"),r=new Map,n=/(\d+)\s+(\d+)\s+obj\b/g,i;for(;(i=n.exec(t))!==null;){let o=Number(i[1]),s=n.lastIndex,a=t.indexOf("endobj",s);if(a<0)continue;let c=t.indexOf("stream",s),l,u=null;if(c>=0&&c<a){l=t.slice(s,c);let d=c+6;t[d]==="\r"&&(d+=1),t[d]===`
3
+ `&&(d+=1);let f=t.indexOf("endstream",d);f>d&&(u=e.subarray(d,f))}else l=t.slice(s,a);r.set(o,{num:o,dict:l,stream:u})}for(let o of[...r.values()]){if(!o.stream||!/\/Type\s*\/ObjStm\b/.test(o.dict))continue;let s=Pe(o),a=Number(/\/N\s+(\d+)/.exec(o.dict)?.[1]??0),c=Number(/\/First\s+(\d+)/.exec(o.dict)?.[1]??-1);if(s===null||!a||c<0)continue;let l=s.slice(0,c).trim().split(/\s+/).map(Number);for(let u=0;u<a;u+=1){let d=l[2*u],f=l[2*u+1];if(d===void 0||f===void 0||Number.isNaN(d)||Number.isNaN(f))break;let m=u+1<a?l[2*(u+1)+1]:void 0,h=s.slice(c+f,m!==void 0?c+m:void 0);r.has(d)||r.set(d,{num:d,dict:h,stream:null})}}return r}function _t(e){let t=[...e.replace(/\s+/g,"")];if(t.length<40)return!1;let r=0,n=0;for(let i of t){let o=i.codePointAt(0)??0;o<32||o>=127&&o<=191||o===65533||o>=57344&&o<=63743?r+=1:/[\p{L}\p{N}]/u.test(i)&&(n+=1)}return r/t.length>.2||n/t.length<.25}function ki(e){let t=e.toString("latin1").replace(/\s/g,"");t.startsWith("<~")&&(t=t.slice(2));let r=t.indexOf("~>");r>=0&&(t=t.slice(0,r));let n=[],i=0,o=0;for(let s of t){if(s==="z"&&o===0){n.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&&(n.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)n.push(s[a]??0)}return Buffer.from(n)}function wi(e){let t=e.toString("latin1").replace(/\s/g,"").split(">")[0]??"",r=t.length%2?t+"0":t;return/^[0-9A-Fa-f]*$/.test(r)?Buffer.from(r,"hex"):null}function vi(e){let t=/\/Filter\s*(\[[^\]]*\]|\/\w+)/.exec(e);return!t||!t[1]?[]:[...t[1].matchAll(/\/(\w+)/g)].map(r=>r[1]??"")}function Pe(e){if(!e.stream)return null;let t=e.stream;for(let r of vi(e.dict)){let n=null;if(r==="FlateDecode")try{n=xi(t)}catch{return null}else if(r==="ASCII85Decode")n=ki(t);else if(r==="ASCIIHexDecode")n=wi(t);else return null;if(n===null)return null;t=n}return t.toString("latin1")}function Si(e){let t=new Map,r=1,n=/begincodespacerange([\s\S]*?)endcodespacerange/.exec(e);if(n&&n[1]){let c=/<([0-9A-Fa-f]+)>/.exec(n[1]);c&&c[1]&&c[1].length>=4&&(r=2)}let i=c=>{let l="";for(let u=0;u+3<c.length+1;u+=4){let d=parseInt(c.slice(u,u+4),16);Number.isFinite(d)&&d>0&&(l+=String.fromCharCode(d))}return l},o=/beginbfchar([\s\S]*?)endbfchar/g,s;for(;(s=o.exec(e))!==null;){let c=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,l;for(;(l=c.exec(s[1]??""))!==null;)t.set(parseInt(l[1]??"0",16),i(l[2]??""))}let a=/beginbfrange([\s\S]*?)endbfrange/g;for(;(s=a.exec(e))!==null;){let c=s[1]??"",l=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,u;for(;(u=l.exec(c))!==null;){let d=parseInt(u[1]??"0",16),f=parseInt(u[2]??"0",16),m=parseInt((u[3]??"0").slice(0,4)||"0",16);if(!(f-d>65535))for(let h=d;h<=f;h+=1)t.set(h,String.fromCharCode(m+(h-d)))}}return{map:t,bytes:r}}function Ei(e){let t=new Map,r=[],n=[];for(let o of e.values()){for(let s of o.dict.matchAll(/\/Font\s*<<([\s\S]*?)>>/g))s[1]&&n.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&&n.push(a.dict)}}let i=new Set;for(let o of n){let s=/\/([^\s/<>[\]()]+)\s+(\d+)\s+\d+\s+R/g,a;for(;(a=s.exec(o))!==null;){let c=`${a[1]}#${a[2]}`;i.has(c)||(i.add(c),r.push([a[1]??"",Number(a[2])]))}}for(let[o,s]of r){let a=e.get(s);if(!a)continue;let c=null,l=/\/ToUnicode\s+(\d+)\s+\d+\s+R/.exec(a.dict);if(l){let d=e.get(Number(l[1])),f=d?Pe(d):null;f&&(c=Si(f))}if(c||(c=Ii(a.dict,e)),!c)continue;let u=t.get(o)??[];u.push(c),t.set(o,u)}return t}var Ai=["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 $i(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 r=/^afii(\d{5})$/.exec(e);if(r){let o=Number(r[1]);if(o>=57664&&o<=57690)return String.fromCharCode(1488+(o-57664))}let n=Ai.indexOf(e.replace(/hebrew$/,""));return n>=0?String.fromCharCode(1488+n):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 Ii(e,t){let r=e,n=/\/Encoding\s+(\d+)\s+\d+\s+R/.exec(e);n&&(r=t.get(Number(n[1]))?.dict??"");let i=/\/Differences\s*\[([^\]]*)\]/.exec(r);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 c=$i(a.slice(1));c!==null&&o.set(s,c),s+=1}return o.size?{map:o,bytes:1}:null}function kn(e){let t=[];for(let r=0;r<e.length;r+=1){let n=e[r];if(n!=="\\"){t.push(n.charCodeAt(0)&255);continue}let i=e[r+1];if(i===void 0)break;if(i>="0"&&i<="7"){let s="",a=r+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),r=a-1;continue}let o={n:10,r:13,t:9,b:8,f:12};t.push(o[i]??i.charCodeAt(0)&255),r+=1}return t}function wn(e){if(e.length<2||e[0]!==254||e[1]!==255)return null;let t="";for(let r=2;r+1<e.length;r+=2)t+=String.fromCharCode((e[r]??0)<<8|(e[r+1]??0));return t}function yn(e,t){let r=wn(e);if(r!==null)return r;if(!t)return e.map(i=>String.fromCharCode(i)).join("");let n="";if(t.bytes===2)for(let i=0;i+1<e.length;i+=2){let o=(e[i]??0)<<8|(e[i+1]??0);n+=t.map.get(o)??""}else for(let i of e)n+=t.map.get(i)??String.fromCharCode(i);return n}function Ti(e){let t=0;for(let r of e){let n=r.codePointAt(0)??0;/[\p{L}\p{N}]/u.test(r)?t+=1:(n<32||n>=127&&n<=191||n===65533)&&(t-=2)}return t}function bn(e,t){if(!t||t.length<=1)return yn(e,t?.[0]);let r="",n=-1/0;for(let i of t){let o=yn(e,i),s=Ti(o);s>n&&(r=o,n=s)}return r}function Ri(e,t){let r="",n="",i,o=!1,s="",a=0,c=null,l=()=>{n.trim()&&(r+=n+`
4
+ `),n="",a=0},u=()=>{n&&!n.endsWith(" ")&&a>1&&(n+=" ")},d=/\/([^\s/<>[\]()]+)\s+-?[\d.]+\s+Tf|(-?[\d.]+)\s+(-?[\d.]+)\s+T[dD]\b|(?:-?[\d.]+\s+){5}(-?[\d.]+)\s+Tm\b|T\*|\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>|\[|\]|-?\d+(?:\.\d+)?|TJ|Tj|'|"/g,f;for(;(f=d.exec(e))!==null;){let m=f[0];if(f[1]!==void 0&&m.endsWith("Tf")){i=t.get(f[1]);continue}if(f[2]!==void 0){Math.abs(Number(f[3]))>.01?l():Number(f[2])!==0&&u();continue}if(f[4]!==void 0){let h=Number(f[4]);c!==null&&Math.abs(h-c)>.01?l():c!==null&&u(),c=h;continue}if(m==="T*"){l();continue}if(m==="["){o=!0;continue}if(m==="]"){o=!1;continue}if(m==="TJ"||m==="Tj"||m==="'"||m==='"'){(m==="'"||m==='"')&&l(),s&&(n+=s,a=s.trim().length,s="");continue}if(m.startsWith("("))s+=bn(kn(m.slice(1,-1)),i);else if(m.startsWith("<")){let h=m.slice(1,-1).replace(/\s+/g,""),g=[];for(let x=0;x+1<h.length;x+=2)g.push(parseInt(h.slice(x,x+2),16));s+=bn(g,i)}else o&&Number(m)<-200&&s&&!s.endsWith(" ")&&(s+=" ")}return s&&(n+=s),l(),r}function Ci(e,t){let r=e.toString("latin1"),n=/\/Info\s+(\d+)\s+\d+\s+R/.exec(r),i=n?t.get(Number(n[1]))?.dict:void 0;if(!i)return"";let o=[],s=/\/(Author|Title|Subject|Keywords|Creator|Producer)\s*(\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>)/g,a;for(;(a=s.exec(i))!==null;){let c=a[2]??"";if(c.startsWith("(")){let l=kn(c.slice(1,-1));o.push(wn(l)??l.map(u=>String.fromCharCode(u)).join(""))}else{let l=c.slice(1,-1).replace(/\s+/g,""),u="";if(l.toUpperCase().startsWith("FEFF"))for(let d=4;d+3<l.length+1;d+=4)u+=String.fromCharCode(parseInt(l.slice(d,d+4),16));else for(let d=0;d+1<l.length;d+=2)u+=String.fromCharCode(parseInt(l.slice(d,d+2),16));o.push(u)}}return o.join(`
5
+ `)}var _n="\u05DD\u05DF\u05E5\u05E3\u05DA";function Le(e){let t=0,r=0;for(let n of e.match(/[\u05D0-\u05EA]{2,}/g)??[])_n.includes(n[0])&&(t+=1),_n.includes(n[n.length-1])&&(r+=1);return t>=3&&t>r*2}var Pi={"(":")",")":"(","[":"]","]":"[","<":">",">":"<","{":"}","}":"{"};function Oe(e){return/[\u05D0-\u05EA]/.test(e)?[...e].reverse().map(r=>Pi[r]??r).join("").replace(/[A-Za-z0-9](?:[A-Za-z0-9@._\-/:+]*[A-Za-z0-9])?/g,r=>[...r].reverse().join("")):e}function xt(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-")||e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return null;let r=xn(e);if(r.size===0)return null;let n=Ei(r),i=[];i.push(Ci(e,r));let o=0,s=0,a=!1;for(let l of r.values()){if(!l.stream||!/\/Subtype\s*\/Form\b/.test(l.dict)&&/\/Subtype|\/Type\s*\/(XObject|Font|Metadata|ObjStm|XRef)|\/FontFile/.test(l.dict))continue;let d=Pe(l);if(d===null||!/(TJ|Tj)\b/.test(d))continue;let f=Ri(d,n);if(f.trim().length!==0){if(s+=1,o+f.length>gn){i.push(f.slice(0,Math.max(0,gn-o))),a=!0;break}i.push(f),o+=f.length}}if(s===0)return null;let c=i.slice(1).join(`
6
+ `);return _t(c)?null:(Le(c)&&(c=c.split(`
7
+ `).map(Oe).join(`
8
+ `)),{text:[i[0]??"",c].join(`
9
+ `),truncated:a,streams:s})}function vn(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return"not a valid PDF";if(e.toString("latin1",0,Math.min(e.length,4096)).includes("/Encrypt"))return"encrypted (password or copy protection)";let r=xn(e),n=0,i=0,o=0;for(let s of r.values()){if(!s.stream)continue;if(/\/Subtype\s*\/Image\b/.test(s.dict)){i+=1;continue}let a=Pe(s);if(a===null){/\/Type\s*\/(Font|Metadata|XRef)|\/FontFile|\/Length1/.test(s.dict)||(o+=1);continue}/(TJ|Tj)\b/.test(a)&&(n+=1)}return n===0&&i>0?"no text layer \u2014 a scanned image (needs OCR, which NoData does not do)":n===0&&o>0?"its pages are compressed in a way NoData cannot open":n===0?"no text in it":"its fonts have no usable letter map \u2014 the text decodes to symbols"}import{execFileSync as Li}from"node:child_process";import{existsSync as Oi,mkdtempSync as Di,readFileSync as En,readdirSync as Fe,rmSync as Ni,statSync as Fi,writeFileSync as An}from"node:fs";import{tmpdir as ji}from"node:os";import{delimiter as Mi,join as L}from"node:path";var re="install the free tools once (they run only on this computer): winget install oschwartz10612.Poppler and winget install UB-Mannheim.TesseractOCR (tick Hebrew in its installer)",De=null;function Sn(e){try{return Fi(e).isFile()}catch{return!1}}function Hi(){let e=[],t=[process.env.ProgramFiles,process.env["ProgramFiles(x86)"]].filter(Boolean),r=process.env.LOCALAPPDATA;for(let n of t)e.push(L(n,"Tesseract-OCR"));if(r){e.push(L(r,"Programs","Tesseract-OCR"),L(r,"Microsoft","WinGet","Links"));let n=L(r,"Microsoft","WinGet","Packages");try{for(let i of Fe(n))if(/^oschwartz10612\.Poppler/i.test(i))for(let o of Fe(L(n,i)))e.push(L(n,i,o,"Library","bin"))}catch{}}for(let n of t)try{for(let i of Fe(n))/^poppler/i.test(i)&&e.push(L(n,i,"Library","bin"),L(n,i,"bin"))}catch{}return e}function Ne(e,t){let r=process.env[t];if(r)return Sn(r)?r:void 0;let n=process.platform==="win32",i=n?[`${e}.exe`,e]:[e],o=(process.env.PATH??"").split(Mi).filter(Boolean);n&&o.push(...Hi());for(let s of o)for(let a of i)if(Sn(L(s,a)))return L(s,a)}function Z(e,t,r){try{return Li(e,t,{encoding:"utf8",timeout:r,maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{return null}}function ie(){if(De)return De;if(/^(0|off|false|no)$/i.test(process.env.NODATA_PDF_TOOLS??""))return De={ocrLangs:[],osd:!1};let e={pdftotext:Ne("pdftotext","NODATA_PDFTOTEXT"),pdftoppm:Ne("pdftoppm","NODATA_PDFTOPPM"),tesseract:Ne("tesseract","NODATA_TESSERACT"),ocrmypdf:Ne("ocrmypdf","NODATA_OCRMYPDF"),ocrLangs:[],osd:!1};if(e.tesseract){let t=new Set((Z(e.tesseract,["--list-langs"],15e3)??"").split(/\r?\n/).map(r=>r.trim()));e.ocrLangs=["heb","eng"].filter(r=>t.has(r)),e.osd=t.has("osd")}return De=e}function wt(e,t,r=".pdf"){let n=Di(L(ji(),"nd-read-"));try{let i=L(n,`in${r}`);return An(i,e,{mode:384}),t(n,i)}finally{Ni(n,{recursive:!0,force:!0})}}function vt(e){let t=e.replace(/[\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,"").replace(/\f/g,`
10
10
  `).replace(/[ \t]+\n/g,`
11
- `).trim();return t.replace(/\s/g,"").length<2||gt(t)?null:Ce(t)?t.split(`
12
- `).map(Pe).join(`
13
- `):t}function mn(e){let t=te().pdftotext;if(!t)return null;let r=_t(e,(n,i)=>V(t,["-enc","UTF-8","-q",i,"-"],6e4));return r===null?null:xt(r)}var bi=()=>Math.max(1,Number(process.env.NODATA_OCR_MAX_PAGES)||10);function gn(e){let t=e.toString("latin1",0,64).match(/^P5\s+(\d+)\s+(\d+)\s+255\s/);return t?{w:Number(t[1]),h:Number(t[2]),at:t[0].length}:null}function _i(e,t){let r=gn(e);if(!r)return null;let{w:n,h:i,at:s}=r,o=e.subarray(s),[a,l]=t===180?[n,i]:[i,n],c=Buffer.alloc(a*l);for(let u=0;u<i;u++)for(let d=0;d<n;d++){let f=o[u*n+d];t===180?c[(i-1-u)*n+(n-1-d)]=f:t===90?c[d*a+(i-1-u)]=f:c[(n-1-d)*a+u]=f}return Buffer.concat([Buffer.from(`P5
14
- ${a} ${l}
11
+ `).trim();return t.replace(/\s/g,"").length<2||_t(t)?null:Le(t)?t.split(`
12
+ `).map(Oe).join(`
13
+ `):t}function $n(e){let t=ie().pdftotext;if(!t)return null;let r=wt(e,(n,i)=>Z(t,["-enc","UTF-8","-q",i,"-"],6e4));return r===null?null:vt(r)}var Ui=()=>Math.max(1,Number(process.env.NODATA_OCR_MAX_PAGES)||10);function In(e){let t=e.toString("latin1",0,64).match(/^P5\s+(\d+)\s+(\d+)\s+255\s/);return t?{w:Number(t[1]),h:Number(t[2]),at:t[0].length}:null}function Bi(e,t){let r=In(e);if(!r)return null;let{w:n,h:i,at:o}=r,s=e.subarray(o),[a,c]=t===180?[n,i]:[i,n],l=Buffer.alloc(a*c);for(let u=0;u<i;u++)for(let d=0;d<n;d++){let f=s[u*n+d];t===180?l[(i-1-u)*n+(n-1-d)]=f:t===90?l[d*a+(i-1-u)]=f:l[(n-1-d)*a+u]=f}return Buffer.concat([Buffer.from(`P5
14
+ ${a} ${c}
15
15
  255
16
- `,"latin1"),c])}function yn(e,t){if(!e.osd)return;let r=V(e.tesseract,[t,"-","--psm","0"],6e4)??"",n=Number(r.match(/Rotate:\s*(\d+)/)?.[1]??0),i=Number(r.match(/Orientation confidence:\s*([\d.]+)/)?.[1]??0);if(!(n===90||n===180||n===270)||i<2)return;let s=_i(pn(t),n);s&&hn(t,s,{mode:384})}function xi(e,t,r){if(!e.ocrmypdf||e.ocrLangs.length===0)return null;let n=T(t,"side.txt");return V(e.ocrmypdf,["-q","-l",e.ocrLangs.join("+"),"--rotate-pages","--deskew","--force-ocr","--sidecar",n,r,T(t,"out.pdf")],3e5),ui(n)?xt(pn(n,"utf8")):null}function ki(e){let t=te();if(!t.pdftoppm||!t.tesseract||t.ocrLangs.length===0)return null;let r=bi();return _t(e,(n,i)=>{if(V(t.pdftoppm,["-r","300","-gray","-f","1","-l",String(r+1),i,T(n,"p")],12e4)===null)return null;let s=Ne(n).filter(c=>/^p-\d+\.pgm$/.test(c)).sort((c,u)=>Number(c.match(/\d+/)[0])-Number(u.match(/\d+/)[0])),o=s.length>r,a=[];for(let c of s.slice(0,r)){yn(t,T(n,c));let u=V(t.tesseract,[T(n,c),"stdout","-l",t.ocrLangs.join("+"),"--psm","3"],12e4);u&&a.push(u)}let l=xt(a.join(`
17
- `))??xi(t,n,i);return l===null?null:{text:l,truncated:o,pages:Math.min(s.length,r)}})}function bt(e){return new Set(e.match(/[\p{L}\p{N}]{2,}/gu)??[])}function Oe(e,t={}){let r=yt(e),n=mn(e);if(r){if(n===null)return{...r,engine:"builtin",uncertain:!1};let s=bt(r.text),o=n.split(`
18
- `).filter(u=>[...bt(u)].some(d=>!s.has(d))),a=bt(n),l=[...a].filter(u=>!s.has(u)),c=l.length>Math.max(3,a.size*.1)||l.some(u=>/^\d{5,}$/.test(u));return o.length===0?{...r,engine:"builtin",uncertain:!1}:{...r,text:r.text+`
19
- `+o.join(`
20
- `),engine:"builtin",uncertain:c}}if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return null;if(n!==null)return{text:n,truncated:!1,streams:0,engine:"pdftotext",uncertain:!1};if(!t.ocr)return null;let i=ki(e);return i?{text:i.text,truncated:i.truncated,streams:0,engine:"ocr",uncertain:!1}:null}function bn(e){let t=un(e),r=te();return/scanned image/.test(t)?r.tesseract&&r.pdftoppm&&r.ocrLangs.length?"no text layer \u2014 a scanned image; the folder scan reads it with OCR on this computer, the read gate does not wait for OCR":`no text layer \u2014 a scanned image. To read it: ${ee}`:/encrypted/.test(t)?t+(r.pdftotext?"":` \u2014 if it opens without a password, the second reader can read it: ${ee}`):/letter map|compressed/.test(t)&&!r.pdftotext?`${t}. A second reader may read it: ${ee}`:/letter map|compressed/.test(t)?`${t} (the second reader, pdftotext, could not read it either)`:t}var _n=[208,207,17,224,161,177,26,225],kt=4294967294,Fe=4294967295,wi=64*1024*1024;function _e(e){if(e.length<512)return!1;for(let t=0;t<_n.length;t+=1)if(e[t]!==_n[t])return!1;return!0}function wt(e){if(!_e(e))return null;try{let t=e.readUInt16LE(30),r=e.readUInt16LE(32);if(t!==9&&t!==12)return null;let n=1<<t,i=1<<r,s=e.readUInt32LE(44),o=e.readUInt32LE(48),a=e.readUInt32LE(56),l=e.readUInt32LE(60),c=e.readUInt32LE(68),u=e.readUInt32LE(72),d=Math.floor((e.length-n)/n)+1,f=y=>{let _=(y+1)*n;return y>=d||_>=e.length?null:e.subarray(_,Math.min(_+n,e.length))},h=[];for(let y=0;y<109&&h.length<s;y+=1){let _=e.readUInt32LE(76+y*4);_!==Fe&&h.push(_)}let m=c;for(let y=0;y<u&&m!==kt&&m!==Fe;y+=1){let _=f(m);if(!_)return null;let v=n/4-1;for(let E=0;E<v&&h.length<s;E+=1){let w=_.readUInt32LE(E*4);w!==Fe&&h.push(w)}m=_.readUInt32LE(v*4)}let g=[];for(let y of h){let _=f(y);if(!_)return null;for(let v=0;v+4<=_.length;v+=4)g.push(_.readUInt32LE(v))}let b=(y,_,v)=>{let E=[],w=y;for(;w!==kt&&w!==Fe;){if(w>=_.length||E.length>v)return null;E.push(w),w=_[w]}return E},p=(y,_)=>{let v=b(y,g,d);if(!v)return null;let E=[];for(let W of v){let me=f(W);if(!me)return null;E.push(me)}let w=Buffer.concat(E);return _>=0?w.subarray(0,Math.min(_,w.length)):w},x=p(o,-1);if(!x)return null;let k=[],$=new Map;for(let y=0,_=0;y+128<=x.length;y+=128,_+=1){let v=x.readUInt16LE(y+64),E=x[y+66];if(E===0||v<2||v>64)continue;let w=x.subarray(y,y+v-2).toString("utf16le"),W={id:_,name:w,type:E,left:x.readUInt32LE(y+68),right:x.readUInt32LE(y+72),child:x.readUInt32LE(y+76),start:x.readUInt32LE(y+116),size:x.readUInt32LE(y+120),path:w};k.push(W),$.set(_,W)}let L=new Set,M=(y,_)=>{let v=[y];for(;v.length;){let E=v.pop(),w=$.get(E);!w||L.has(E)||(L.add(E),w.path=_?`${_}/${w.name}`:w.name,v.push(w.left,w.right),w.type===1&&M(w.child,w.path))}},H=k.find(y=>y.type===5);H&&M(H.child,"");let F=k.find(y=>y.type===5);if(!F)return null;let Y=null,R=[];if(k.some(y=>y.type===2&&y.size<a&&y.size>0)){Y=p(F.start,F.size);let y=l!==kt?p(l,-1):null;if(y)for(let _=0;_+4<=y.length;_+=4)R.push(y.readUInt32LE(_));else R=[]}let z=new Map,Q=new Map,U=(y,_)=>{z.has(y.name)||z.set(y.name,_),Q.set(y.path,_)};for(let y of k)if(y.type===2&&!(y.size>wi)){if(y.size===0){U(y,Buffer.alloc(0));continue}if(y.size<a){if(!Y)continue;let _=b(y.start,R,Math.ceil(Y.length/i)+1);if(!_)continue;let v=_.map(E=>Y.subarray(E*i,E*i+i));U(y,Buffer.concat(v).subarray(0,y.size))}else{let _=p(y.start,y.size);_&&U(y,_)}}return{streams:z,paths:Q}}catch{return null}}import{TextDecoder as xn}from"node:util";var xe="password-protected: open it with its password, or check it by hand";function vi(e){let t=e.streams;return t.has("EncryptionInfo")&&t.has("EncryptedPackage")?"encrypted-ooxml":t.has("WordDocument")?"doc":t.has("Workbook")||t.has("Book")?"xls":t.has("PowerPoint Document")?"ppt":[...t.keys()].some(r=>r.startsWith("__substg1.0_"))?"msg":null}var Sn=e=>{try{return new xn(e)}catch{return new xn("latin1")}},ne=Sn("windows-1252");function ke(e){return e.replace(/[\r\x07\x0b\x0c]/g,`
16
+ `,"latin1"),l])}function Tn(e,t){if(!e.osd)return;let r=Z(e.tesseract,[t,"-","--psm","0"],6e4)??"",n=Number(r.match(/Rotate:\s*(\d+)/)?.[1]??0),i=Number(r.match(/Orientation confidence:\s*([\d.]+)/)?.[1]??0);if(!(n===90||n===180||n===270)||i<2)return;let o=Bi(En(t),n);o&&An(t,o,{mode:384})}function zi(e,t,r){if(!e.ocrmypdf||e.ocrLangs.length===0)return null;let n=L(t,"side.txt");return Z(e.ocrmypdf,["-q","-l",e.ocrLangs.join("+"),"--rotate-pages","--deskew","--force-ocr","--sidecar",n,r,L(t,"out.pdf")],3e5),Oi(n)?vt(En(n,"utf8")):null}function Wi(e){let t=ie();if(!t.pdftoppm||!t.tesseract||t.ocrLangs.length===0)return null;let r=Ui();return wt(e,(n,i)=>{if(Z(t.pdftoppm,["-r","300","-gray","-f","1","-l",String(r+1),i,L(n,"p")],12e4)===null)return null;let o=Fe(n).filter(l=>/^p-\d+\.pgm$/.test(l)).sort((l,u)=>Number(l.match(/\d+/)[0])-Number(u.match(/\d+/)[0])),s=o.length>r,a=[];for(let l of o.slice(0,r)){Tn(t,L(n,l));let u=Z(t.tesseract,[L(n,l),"stdout","-l",t.ocrLangs.join("+"),"--psm","3"],12e4);u&&a.push(u)}let c=vt(a.join(`
17
+ `))??zi(t,n,i);return c===null?null:{text:c,truncated:s,pages:Math.min(o.length,r)}})}function kt(e){return new Set(e.match(/[\p{L}\p{N}]{2,}/gu)??[])}function je(e,t={}){let r=xt(e),n=$n(e);if(r){if(n===null)return{...r,engine:"builtin",uncertain:!1};let o=kt(r.text),s=n.split(`
18
+ `).filter(u=>[...kt(u)].some(d=>!o.has(d))),a=kt(n),c=[...a].filter(u=>!o.has(u)),l=c.length>Math.max(3,a.size*.1)||c.some(u=>/^\d{5,}$/.test(u));return s.length===0?{...r,engine:"builtin",uncertain:!1}:{...r,text:r.text+`
19
+ `+s.join(`
20
+ `),engine:"builtin",uncertain:l}}if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return null;if(n!==null)return{text:n,truncated:!1,streams:0,engine:"pdftotext",uncertain:!1};if(!t.ocr)return null;let i=Wi(e);return i?{text:i.text,truncated:i.truncated,streams:0,engine:"ocr",uncertain:!1}:null}function Rn(e){let t=vn(e),r=ie();return/scanned image/.test(t)?r.tesseract&&r.pdftoppm&&r.ocrLangs.length?"no text layer \u2014 a scanned image; the folder scan reads it with OCR on this computer, the read gate does not wait for OCR":`no text layer \u2014 a scanned image. To read it: ${re}`:/encrypted/.test(t)?t+(r.pdftotext?"":` \u2014 if it opens without a password, the second reader can read it: ${re}`):/letter map|compressed/.test(t)&&!r.pdftotext?`${t}. A second reader may read it: ${re}`:/letter map|compressed/.test(t)?`${t} (the second reader, pdftotext, could not read it either)`:t}var Cn=[208,207,17,224,161,177,26,225],St=4294967294,Me=4294967295,Vi=64*1024*1024;function ke(e){if(e.length<512)return!1;for(let t=0;t<Cn.length;t+=1)if(e[t]!==Cn[t])return!1;return!0}function Et(e){if(!ke(e))return null;try{let t=e.readUInt16LE(30),r=e.readUInt16LE(32);if(t!==9&&t!==12)return null;let n=1<<t,i=1<<r,o=e.readUInt32LE(44),s=e.readUInt32LE(48),a=e.readUInt32LE(56),c=e.readUInt32LE(60),l=e.readUInt32LE(68),u=e.readUInt32LE(72),d=Math.floor((e.length-n)/n)+1,f=y=>{let _=(y+1)*n;return y>=d||_>=e.length?null:e.subarray(_,Math.min(_+n,e.length))},m=[];for(let y=0;y<109&&m.length<o;y+=1){let _=e.readUInt32LE(76+y*4);_!==Me&&m.push(_)}let h=l;for(let y=0;y<u&&h!==St&&h!==Me;y+=1){let _=f(h);if(!_)return null;let S=n/4-1;for(let A=0;A<S&&m.length<o;A+=1){let v=_.readUInt32LE(A*4);v!==Me&&m.push(v)}h=_.readUInt32LE(S*4)}let g=[];for(let y of m){let _=f(y);if(!_)return null;for(let S=0;S+4<=_.length;S+=4)g.push(_.readUInt32LE(S))}let x=(y,_,S)=>{let A=[],v=y;for(;v!==St&&v!==Me;){if(v>=_.length||A.length>S)return null;A.push(v),v=_[v]}return A},p=(y,_)=>{let S=x(y,g,d);if(!S)return null;let A=[];for(let K of S){let ye=f(K);if(!ye)return null;A.push(ye)}let v=Buffer.concat(A);return _>=0?v.subarray(0,Math.min(_,v.length)):v},b=p(s,-1);if(!b)return null;let k=[],w=new Map;for(let y=0,_=0;y+128<=b.length;y+=128,_+=1){let S=b.readUInt16LE(y+64),A=b[y+66];if(A===0||S<2||S>64)continue;let v=b.subarray(y,y+S-2).toString("utf16le"),K={id:_,name:v,type:A,left:b.readUInt32LE(y+68),right:b.readUInt32LE(y+72),child:b.readUInt32LE(y+76),start:b.readUInt32LE(y+116),size:b.readUInt32LE(y+120),path:v};k.push(K),w.set(_,K)}let R=new Set,j=(y,_)=>{let S=[y];for(;S.length;){let A=S.pop(),v=w.get(A);!v||R.has(A)||(R.add(A),v.path=_?`${_}/${v.name}`:v.name,S.push(v.left,v.right),v.type===1&&j(v.child,v.path))}},C=k.find(y=>y.type===5);C&&j(C.child,"");let N=k.find(y=>y.type===5);if(!N)return null;let H=null,T=[];if(k.some(y=>y.type===2&&y.size<a&&y.size>0)){H=p(N.start,N.size);let y=c!==St?p(c,-1):null;if(y)for(let _=0;_+4<=y.length;_+=4)T.push(y.readUInt32LE(_));else T=[]}let G=new Map,ne=new Map,B=(y,_)=>{G.has(y.name)||G.set(y.name,_),ne.set(y.path,_)};for(let y of k)if(y.type===2&&!(y.size>Vi)){if(y.size===0){B(y,Buffer.alloc(0));continue}if(y.size<a){if(!H)continue;let _=x(y.start,T,Math.ceil(H.length/i)+1);if(!_)continue;let S=_.map(A=>H.subarray(A*i,A*i+i));B(y,Buffer.concat(S).subarray(0,y.size))}else{let _=p(y.start,y.size);_&&B(y,_)}}return{streams:G,paths:ne}}catch{return null}}import{TextDecoder as Pn}from"node:util";var we="password-protected: open it with its password, or check it by hand";function Gi(e){let t=e.streams;return t.has("EncryptionInfo")&&t.has("EncryptedPackage")?"encrypted-ooxml":t.has("WordDocument")?"doc":t.has("Workbook")||t.has("Book")?"xls":t.has("PowerPoint Document")?"ppt":[...t.keys()].some(r=>r.startsWith("__substg1.0_"))?"msg":null}var Nn=e=>{try{return new Pn(e)}catch{return new Pn("latin1")}},oe=Nn("windows-1252");function ve(e){return e.replace(/[\r\x07\x0b\x0c]/g,`
21
21
  `).replace(/[\x13\x14\x15]/g," ").replace(/[\x00-\x08\x0e-\x1f]/g,"").replace(/\n{3,}/g,`
22
22
 
23
- `)}function Si(e,t){return e.length>t?{text:e.slice(0,t),truncated:!0}:{text:e,truncated:!1}}function Ei(e){let t=e.streams.get("WordDocument");if(t.length<512)return{kind:"doc",reason:"damaged Word file"};let r=t.readUInt16LE(10);if(r&256||r&32768)return{kind:"doc",reason:xe};if(t.readUInt16LE(2)<101){let m=t.readUInt32LE(24),g=t.readUInt32LE(28);return g<=m||g>t.length?{kind:"doc",reason:"damaged Word file"}:ke(ne.decode(t.subarray(m,g)))}let i=e.streams.get(r&512?"1Table":"0Table");if(!i)return{kind:"doc",reason:"damaged Word file (no table stream)"};let s=32;s+=2+t.readUInt16LE(s)*2,s+=2+t.readUInt16LE(s)*4;let o=s+2,a=t.readUInt32LE(o+264),l=t.readUInt32LE(o+264+4);if(!l||a+l>i.length)return{kind:"doc",reason:"damaged Word file (no piece table)"};let c=a,u=a+l,d=null;for(;c<u;){let m=i[c];if(m===1)c+=3+i.readInt16LE(c+1);else if(m===2){let g=i.readUInt32LE(c+1);d=i.subarray(c+5,Math.min(c+5+g,i.length));break}else break}if(!d||d.length<16)return{kind:"doc",reason:"damaged Word file (no piece table)"};let f=Math.floor((d.length-4)/12),h=[];for(let m=0;m<f;m+=1){let g=d.readUInt32LE(m*4),p=d.readUInt32LE((m+1)*4)-g;if(p<=0||p>t.length)continue;let x=d.readUInt32LE(4*(f+1)+m*8+2);if(x&1073741824){let k=(x&1073741823)/2;h.push(ne.decode(t.subarray(k,Math.min(k+p,t.length))))}else h.push(t.subarray(x,Math.min(x+p*2,t.length)).toString("utf16le"))}return ke(h.join(""))}var vt=class{segs;i=0;p=0;constructor(t){this.segs=t}here(){for(;this.i<this.segs.length&&this.p>=this.segs[this.i].length;)this.i+=1,this.p=0;return this.i<this.segs.length?this.segs[this.i]:null}get done(){return this.here()===null}atSeam(){return this.p===0&&this.i>0}u8(){let t=this.here();if(!t)throw new Error("eof");return t[this.p++]}u16(){return this.u8()|this.u8()<<8}u32(){return(this.u16()|this.u16()<<16)>>>0}skip(t){for(let r=0;r<t;r+=1)this.u8()}chars(t,r){let n="",i=t,s=r;for(;i>0&&this.here();){this.p===0&&n.length>0&&(s=(this.u8()&1)===1);let a=this.here();if(!a)break;let l=Math.floor((a.length-this.p)/(s?2:1)),c=Math.min(i,l);if(c<=0){this.p=a.length;continue}let u=a.subarray(this.p,this.p+c*(s?2:1));n+=s?u.toString("utf16le"):u.toString("latin1"),this.p+=u.length,i-=c}return n}};function Ai(e){let t=new vt(e),r=[];try{t.u32();let n=t.u32();for(let i=0;i<n&&!t.done;i+=1){let s=t.u16(),o=t.u8(),a=o&8?t.u16():0,l=o&4?t.u32():0;r.push(t.chars(s,(o&1)===1)),t.skip(a*4+l)}}catch{}return r}function kn(e,t,r,n){if(t+2>e.length)return"";let i=e.readUInt16LE(t);if(!r)return n.decode(e.subarray(t+2,t+2+i));let s=e[t+2],o=t+3;return s&8&&(o+=2),s&4&&(o+=4),s&1?e.subarray(o,o+i*2).toString("utf16le"):e.subarray(o,o+i).toString("latin1")}function wn(e){let t;if(e&2)t=e>>2;else{let r=Buffer.alloc(8);r.writeUInt32LE(0,0),r.writeUInt32LE((e&4294967292)>>>0,4),t=r.readDoubleLE(0)}return e&1?t/100:t}var je=e=>Number.isFinite(e)?String(e):"";function $i(e){let t=e.streams.get("Workbook")??e.streams.get("Book"),r=!0,n=ne,i=[],s=new Set,o=[],a=[],l=-1,c=null,u=0,d=(g,b,p)=>{if(l<0||!p)return;let x=a[l],k=x.get(g)??new Map;k.set(b,p),x.set(g,k)},f=0;for(;f+4<=t.length;){let g=t.readUInt16LE(f),b=t.readUInt16LE(f+2),p=t.subarray(f+4,Math.min(f+4+b,t.length)),x=f+4+b;switch(g){case 2057:u+=1,p.length>=4&&(r=p.readUInt16LE(0)===1536),u===1&&p.length>=4&&p.readUInt16LE(2)!==5&&(l=a.length,a.push(new Map));break;case 10:u=Math.max(0,u-1);break;case 47:return{kind:"xls",reason:xe};case 66:if(p.length>=2&&!r){let k=p.readUInt16LE(0);n=k===1200?ne:Sn(`windows-${k}`)}break;case 133:if(p.length>6){let k=p[6];if(r){let $=p[7]&1;o.push($?p.subarray(8,8+k*2).toString("utf16le"):p.subarray(8,8+k).toString("latin1"))}else o.push(n.decode(p.subarray(7,7+k)))}break;case 252:{let k=[p];for(;x+4<=t.length&&t.readUInt16LE(x)===60;){let $=t.readUInt16LE(x+2);k.push(t.subarray(x+4,Math.min(x+4+$,t.length))),x+=4+$}i=Ai(k);break}case 253:if(p.length>=10){let k=p.readUInt32LE(6);s.add(k),d(p.readUInt16LE(0),p.readUInt16LE(2),i[k]??"")}break;case 516:case 214:p.length>=8&&d(p.readUInt16LE(0),p.readUInt16LE(2),kn(p,6,r,n));break;case 515:p.length>=14&&d(p.readUInt16LE(0),p.readUInt16LE(2),je(p.readDoubleLE(6)));break;case 638:p.length>=10&&d(p.readUInt16LE(0),p.readUInt16LE(2),je(wn(p.readUInt32LE(6))));break;case 189:{if(p.length>=6){let k=p.readUInt16LE(0),$=p.readUInt16LE(2);for(let L=4;L+6<=p.length-2;L+=6)d(k,$++,je(wn(p.readUInt32LE(L+2))))}break}case 6:if(p.length>=14){let k=p.readUInt16LE(0),$=p.readUInt16LE(2);p.readUInt16LE(12)===65535?c=p[6]===0?[k,$]:null:d(k,$,je(p.readDoubleLE(6)))}break;case 519:c&&d(c[0],c[1],kn(p,0,r,n)),c=null;break}f=x}let h=[];a.forEach((g,b)=>{h.push(o[b]??"");for(let p of[...g.keys()].sort((x,k)=>x-k)){let x=g.get(p);h.push([...x.keys()].sort((k,$)=>k-$).map(k=>x.get(k)).join(" "))}h.push("")});let m=i.filter((g,b)=>!s.has(b));return m.length&&h.push(...m),ke(h.join(`
24
- `))}function Ii(e){if(e.streams.has("EncryptedSummary"))return{kind:"ppt",reason:xe};let t=e.streams.get("PowerPoint Document"),r=[],n=0;for(;n+8<=t.length;){let i=t.readUInt16LE(n)&15,s=t.readUInt16LE(n+2),o=t.readUInt32LE(n+4);if(s===12052)return{kind:"ppt",reason:xe};if(i===15){n+=8;continue}let a=t.subarray(n+8,Math.min(n+8+o,t.length));s===4e3||s===4026?r.push(a.toString("utf16le")):s===4008&&r.push(ne.decode(a)),n+=8+o}return ke(r.join(`
25
- `))}function Ti(e){let t=[];for(let[r,n]of e.paths){if(r.startsWith("__attach_"))continue;let i=/(?:^|\/)__substg1\.0_([0-9A-F]{4})(001F|001E)$/i.exec(r);i&&t.push(i[2].toUpperCase()==="001F"?n.toString("utf16le"):ne.decode(n))}return ke(t.join(`
26
- `))}function vn(e){let t=new Map;for(let[r,n]of e.paths){let i=/^(__attach_version1\.0_#[0-9A-F]{8})\/__substg1\.0_(3707|3704|3701)(001F|0102)$/i.exec(r);if(!i)continue;let s=t.get(i[1])??{};i[2]==="3701"&&i[3]==="0102"?s.data=n:i[2]==="3707"?s.name=n.toString("utf16le").replace(/\0+$/,""):i[2]==="3704"&&(s.short=n.toString("utf16le").replace(/\0+$/,"")),t.set(i[1],s)}return[...t.values()].filter(r=>r.data).map((r,n)=>({name:r.name||r.short||`attachment-${n+1}`,data:r.data}))}function St(e,t){let r=wt(e);if(!r)return{kind:null,reason:"damaged Office 97-2003 file"};let n=vi(r);if(!n)return{kind:null,reason:"a compound file that is not a Word, Excel, PowerPoint or Outlook file"};if(n==="encrypted-ooxml")return{kind:n,reason:xe};let i;try{i=n==="doc"?Ei(r):n==="xls"?$i(r):n==="ppt"?Ii(r):Ti(r)}catch{i={kind:n,reason:"damaged Office 97-2003 file"}}if(typeof i!="string")return i;if(!i.trim()&&!(n==="msg"&&vn(r).length))return{kind:n,reason:"no text inside (an empty file, or only pictures)"};let s=Si(i,t),o=n==="msg"?vn(r):[];return{kind:n,text:s.text,truncated:s.truncated,parts:[`cfb:${n}`],...o.length?{attachments:o}:{}}}import{TextDecoder as En}from"node:util";var Ri=new Set(["fonttbl","colortbl","stylesheet","listtable","listoverridetable","rsidtbl","generator","pict","object","objdata","themedata","colorschememapping","datastore","latentstyles","xmlnstbl","mmathpr","filetbl","revtbl","pgdsctbl","bkmkstart","bkmkend","fldinst","shppict","nonshppict","blipuid","panose","falt","wgrffmtfilter","defchp","defpap"]),An=e=>{try{return new En(e===65001?"utf-8":`windows-${e}`)}catch{return new En("windows-1252")}};function Me(e){return e.length>=5&&e.subarray(0,5).toString("latin1")==="{\\rtf"}function Et(e){let t=An(1252),r=[],n=[],i=()=>{n.length&&(r.push(t.decode(Uint8Array.from(n))),n=[])},s=[],o=!1,a=1,l=0,c=0,u=e.length;for(;c<u;){let d=e[c];if(d==="{"){i(),s.push({skip:o,uc:a}),c+=1,e.startsWith("\\*",c)&&(o=!0);continue}if(d==="}"){i();let f=s.pop();f&&(o=f.skip,a=f.uc),c+=1;continue}if(d==="\\"){let f=e[c+1];if(f==="'"){let b=parseInt(e.substr(c+2,2),16);if(c+=4,l>0){l-=1;continue}!o&&Number.isFinite(b)&&n.push(b);continue}if(f==="\\"||f==="{"||f==="}"){o||(i(),r.push(f)),c+=2;continue}if(f==="~"){o||r.push(" "),c+=2;continue}let h=/^([a-zA-Z]+)(-?\d+)? ?/.exec(e.slice(c+1,c+40));if(!h){c+=2;continue}c+=1+h[0].length;let m=h[1].toLowerCase(),g=h[2]!==void 0?Number(h[2]):null;if(Ri.has(m)){o=!0;continue}m==="ansicpg"&&g?t=An(g):m==="uc"&&g!==null?a=g:m==="u"&&g!==null?(i(),o||r.push(String.fromCharCode(g<0?g+65536:g)),l=a):!o&&(m==="par"||m==="line"||m==="row"||m==="sect"||m==="page")?(i(),r.push(`
27
- `)):!o&&(m==="tab"||m==="cell")&&(i(),r.push(" "));continue}if(d==="\r"||d===`
28
- `){c+=1;continue}if(l>0){l-=1,c+=1;continue}o||(i(),r.push(d)),c+=1}return i(),r.join("").replace(/\n{3,}/g,`
23
+ `)}function Ki(e,t){return e.length>t?{text:e.slice(0,t),truncated:!0}:{text:e,truncated:!1}}function Zi(e){let t=e.streams.get("WordDocument");if(t.length<512)return{kind:"doc",reason:"damaged Word file"};let r=t.readUInt16LE(10);if(r&256||r&32768)return{kind:"doc",reason:we};if(t.readUInt16LE(2)<101){let h=t.readUInt32LE(24),g=t.readUInt32LE(28);return g<=h||g>t.length?{kind:"doc",reason:"damaged Word file"}:ve(oe.decode(t.subarray(h,g)))}let i=e.streams.get(r&512?"1Table":"0Table");if(!i)return{kind:"doc",reason:"damaged Word file (no table stream)"};let o=32;o+=2+t.readUInt16LE(o)*2,o+=2+t.readUInt16LE(o)*4;let s=o+2,a=t.readUInt32LE(s+264),c=t.readUInt32LE(s+264+4);if(!c||a+c>i.length)return{kind:"doc",reason:"damaged Word file (no piece table)"};let l=a,u=a+c,d=null;for(;l<u;){let h=i[l];if(h===1)l+=3+i.readInt16LE(l+1);else if(h===2){let g=i.readUInt32LE(l+1);d=i.subarray(l+5,Math.min(l+5+g,i.length));break}else break}if(!d||d.length<16)return{kind:"doc",reason:"damaged Word file (no piece table)"};let f=Math.floor((d.length-4)/12),m=[];for(let h=0;h<f;h+=1){let g=d.readUInt32LE(h*4),p=d.readUInt32LE((h+1)*4)-g;if(p<=0||p>t.length)continue;let b=d.readUInt32LE(4*(f+1)+h*8+2);if(b&1073741824){let k=(b&1073741823)/2;m.push(oe.decode(t.subarray(k,Math.min(k+p,t.length))))}else m.push(t.subarray(b,Math.min(b+p*2,t.length)).toString("utf16le"))}return ve(m.join(""))}var At=class{segs;i=0;p=0;constructor(t){this.segs=t}here(){for(;this.i<this.segs.length&&this.p>=this.segs[this.i].length;)this.i+=1,this.p=0;return this.i<this.segs.length?this.segs[this.i]:null}get done(){return this.here()===null}atSeam(){return this.p===0&&this.i>0}u8(){let t=this.here();if(!t)throw new Error("eof");return t[this.p++]}u16(){return this.u8()|this.u8()<<8}u32(){return(this.u16()|this.u16()<<16)>>>0}skip(t){for(let r=0;r<t;r+=1)this.u8()}chars(t,r){let n="",i=t,o=r;for(;i>0&&this.here();){this.p===0&&n.length>0&&(o=(this.u8()&1)===1);let a=this.here();if(!a)break;let c=Math.floor((a.length-this.p)/(o?2:1)),l=Math.min(i,c);if(l<=0){this.p=a.length;continue}let u=a.subarray(this.p,this.p+l*(o?2:1));n+=o?u.toString("utf16le"):u.toString("latin1"),this.p+=u.length,i-=l}return n}};function Xi(e){let t=new At(e),r=[];try{t.u32();let n=t.u32();for(let i=0;i<n&&!t.done;i+=1){let o=t.u16(),s=t.u8(),a=s&8?t.u16():0,c=s&4?t.u32():0;r.push(t.chars(o,(s&1)===1)),t.skip(a*4+c)}}catch{}return r}function Ln(e,t,r,n){if(t+2>e.length)return"";let i=e.readUInt16LE(t);if(!r)return n.decode(e.subarray(t+2,t+2+i));let o=e[t+2],s=t+3;return o&8&&(s+=2),o&4&&(s+=4),o&1?e.subarray(s,s+i*2).toString("utf16le"):e.subarray(s,s+i).toString("latin1")}function On(e){let t;if(e&2)t=e>>2;else{let r=Buffer.alloc(8);r.writeUInt32LE(0,0),r.writeUInt32LE((e&4294967292)>>>0,4),t=r.readDoubleLE(0)}return e&1?t/100:t}var He=e=>Number.isFinite(e)?String(e):"";function Ji(e){let t=e.streams.get("Workbook")??e.streams.get("Book"),r=!0,n=oe,i=[],o=new Set,s=[],a=[],c=-1,l=null,u=0,d=(g,x,p)=>{if(c<0||!p)return;let b=a[c],k=b.get(g)??new Map;k.set(x,p),b.set(g,k)},f=0;for(;f+4<=t.length;){let g=t.readUInt16LE(f),x=t.readUInt16LE(f+2),p=t.subarray(f+4,Math.min(f+4+x,t.length)),b=f+4+x;switch(g){case 2057:u+=1,p.length>=4&&(r=p.readUInt16LE(0)===1536),u===1&&p.length>=4&&p.readUInt16LE(2)!==5&&(c=a.length,a.push(new Map));break;case 10:u=Math.max(0,u-1);break;case 47:return{kind:"xls",reason:we};case 66:if(p.length>=2&&!r){let k=p.readUInt16LE(0);n=k===1200?oe:Nn(`windows-${k}`)}break;case 133:if(p.length>6){let k=p[6];if(r){let w=p[7]&1;s.push(w?p.subarray(8,8+k*2).toString("utf16le"):p.subarray(8,8+k).toString("latin1"))}else s.push(n.decode(p.subarray(7,7+k)))}break;case 252:{let k=[p];for(;b+4<=t.length&&t.readUInt16LE(b)===60;){let w=t.readUInt16LE(b+2);k.push(t.subarray(b+4,Math.min(b+4+w,t.length))),b+=4+w}i=Xi(k);break}case 253:if(p.length>=10){let k=p.readUInt32LE(6);o.add(k),d(p.readUInt16LE(0),p.readUInt16LE(2),i[k]??"")}break;case 516:case 214:p.length>=8&&d(p.readUInt16LE(0),p.readUInt16LE(2),Ln(p,6,r,n));break;case 515:p.length>=14&&d(p.readUInt16LE(0),p.readUInt16LE(2),He(p.readDoubleLE(6)));break;case 638:p.length>=10&&d(p.readUInt16LE(0),p.readUInt16LE(2),He(On(p.readUInt32LE(6))));break;case 189:{if(p.length>=6){let k=p.readUInt16LE(0),w=p.readUInt16LE(2);for(let R=4;R+6<=p.length-2;R+=6)d(k,w++,He(On(p.readUInt32LE(R+2))))}break}case 6:if(p.length>=14){let k=p.readUInt16LE(0),w=p.readUInt16LE(2);p.readUInt16LE(12)===65535?l=p[6]===0?[k,w]:null:d(k,w,He(p.readDoubleLE(6)))}break;case 519:l&&d(l[0],l[1],Ln(p,0,r,n)),l=null;break}f=b}let m=[];a.forEach((g,x)=>{m.push(s[x]??"");for(let p of[...g.keys()].sort((b,k)=>b-k)){let b=g.get(p);m.push([...b.keys()].sort((k,w)=>k-w).map(k=>b.get(k)).join(" "))}m.push("")});let h=i.filter((g,x)=>!o.has(x));return h.length&&m.push(...h),ve(m.join(`
24
+ `))}function qi(e){if(e.streams.has("EncryptedSummary"))return{kind:"ppt",reason:we};let t=e.streams.get("PowerPoint Document"),r=[],n=0;for(;n+8<=t.length;){let i=t.readUInt16LE(n)&15,o=t.readUInt16LE(n+2),s=t.readUInt32LE(n+4);if(o===12052)return{kind:"ppt",reason:we};if(i===15){n+=8;continue}let a=t.subarray(n+8,Math.min(n+8+s,t.length));o===4e3||o===4026?r.push(a.toString("utf16le")):o===4008&&r.push(oe.decode(a)),n+=8+s}return ve(r.join(`
25
+ `))}function Yi(e){let t=[];for(let[r,n]of e.paths){if(r.startsWith("__attach_"))continue;let i=/(?:^|\/)__substg1\.0_([0-9A-F]{4})(001F|001E)$/i.exec(r);i&&t.push(i[2].toUpperCase()==="001F"?n.toString("utf16le"):oe.decode(n))}return ve(t.join(`
26
+ `))}function Dn(e){let t=new Map;for(let[r,n]of e.paths){let i=/^(__attach_version1\.0_#[0-9A-F]{8})\/__substg1\.0_(3707|3704|3701)(001F|0102)$/i.exec(r);if(!i)continue;let o=t.get(i[1])??{};i[2]==="3701"&&i[3]==="0102"?o.data=n:i[2]==="3707"?o.name=n.toString("utf16le").replace(/\0+$/,""):i[2]==="3704"&&(o.short=n.toString("utf16le").replace(/\0+$/,"")),t.set(i[1],o)}return[...t.values()].filter(r=>r.data).map((r,n)=>({name:r.name||r.short||`attachment-${n+1}`,data:r.data}))}function $t(e,t){let r=Et(e);if(!r)return{kind:null,reason:"damaged Office 97-2003 file"};let n=Gi(r);if(!n)return{kind:null,reason:"a compound file that is not a Word, Excel, PowerPoint or Outlook file"};if(n==="encrypted-ooxml")return{kind:n,reason:we};let i;try{i=n==="doc"?Zi(r):n==="xls"?Ji(r):n==="ppt"?qi(r):Yi(r)}catch{i={kind:n,reason:"damaged Office 97-2003 file"}}if(typeof i!="string")return i;if(!i.trim()&&!(n==="msg"&&Dn(r).length))return{kind:n,reason:"no text inside (an empty file, or only pictures)"};let o=Ki(i,t),s=n==="msg"?Dn(r):[];return{kind:n,text:o.text,truncated:o.truncated,parts:[`cfb:${n}`],...s.length?{attachments:s}:{}}}import{TextDecoder as Fn}from"node:util";var Qi=new Set(["fonttbl","colortbl","stylesheet","listtable","listoverridetable","rsidtbl","generator","pict","object","objdata","themedata","colorschememapping","datastore","latentstyles","xmlnstbl","mmathpr","filetbl","revtbl","pgdsctbl","bkmkstart","bkmkend","fldinst","shppict","nonshppict","blipuid","panose","falt","wgrffmtfilter","defchp","defpap"]),jn=e=>{try{return new Fn(e===65001?"utf-8":`windows-${e}`)}catch{return new Fn("windows-1252")}};function Ue(e){return e.length>=5&&e.subarray(0,5).toString("latin1")==="{\\rtf"}function It(e){let t=jn(1252),r=[],n=[],i=()=>{n.length&&(r.push(t.decode(Uint8Array.from(n))),n=[])},o=[],s=!1,a=1,c=0,l=0,u=e.length;for(;l<u;){let d=e[l];if(d==="{"){i(),o.push({skip:s,uc:a}),l+=1,e.startsWith("\\*",l)&&(s=!0);continue}if(d==="}"){i();let f=o.pop();f&&(s=f.skip,a=f.uc),l+=1;continue}if(d==="\\"){let f=e[l+1];if(f==="'"){let x=parseInt(e.substr(l+2,2),16);if(l+=4,c>0){c-=1;continue}!s&&Number.isFinite(x)&&n.push(x);continue}if(f==="\\"||f==="{"||f==="}"){s||(i(),r.push(f)),l+=2;continue}if(f==="~"){s||r.push(" "),l+=2;continue}let m=/^([a-zA-Z]+)(-?\d+)? ?/.exec(e.slice(l+1,l+40));if(!m){l+=2;continue}l+=1+m[0].length;let h=m[1].toLowerCase(),g=m[2]!==void 0?Number(m[2]):null;if(Qi.has(h)){s=!0;continue}h==="ansicpg"&&g?t=jn(g):h==="uc"&&g!==null?a=g:h==="u"&&g!==null?(i(),s||r.push(String.fromCharCode(g<0?g+65536:g)),c=a):!s&&(h==="par"||h==="line"||h==="row"||h==="sect"||h==="page")?(i(),r.push(`
27
+ `)):!s&&(h==="tab"||h==="cell")&&(i(),r.push(" "));continue}if(d==="\r"||d===`
28
+ `){l+=1;continue}if(c>0){c-=1,l+=1;continue}s||(i(),r.push(d)),l+=1}return i(),r.join("").replace(/\n{3,}/g,`
29
29
 
30
- `)}var At=new Set([".xlsx",".xlsm",".xltx",".xltm",".docx",".docm",".dotx",".dotm",".pptx",".pptm",".ppsx",".ppsm",".potx"]),He=new Set([".odt",".ods",".odp",".ott",".ots",".otp"]),$t=new Set([".doc",".dot",".xls",".xlt",".ppt",".pps",".pot",".msg"]),$n=new Set([".rtf"]);function Pi(e){return/^\.(xls[xm]|xlt[xm])$/.test(e)?".xlsx":/^\.(doc[xm]|dot[xm])$/.test(e)?".docx":/^\.(ppt[xm]|pps[xm]|potx)$/.test(e)?".pptx":e}var re=8*1024*1024,Li=101010256,Di=33639248,Ni=67324752;function ie(e){let t=Math.min(e.length,67584),r=-1;for(let o=e.length-22;o>=e.length-t&&o>=0;o-=1)if(e.readUInt32LE(o)===Li){r=o;break}if(r<0)return null;let n=e.readUInt16LE(r+10),i=e.readUInt32LE(r+16);if(i>=e.length)return null;let s=[];for(let o=0;o<n&&!(i+46>e.length||e.readUInt32LE(i)!==Di);o+=1){let a=e.readUInt16LE(i+8),l=e.readUInt16LE(i+10),c=e.readUInt32LE(i+20),u=e.readUInt32LE(i+24),d=e.readUInt16LE(i+28),f=e.readUInt16LE(i+30),h=e.readUInt16LE(i+32),m=e.readUInt32LE(i+42),g=e.subarray(i+46,i+46+d).toString("utf8");s.push({name:g,flags:a,method:l,compSize:c,uncompSize:u,localHeaderOffset:m}),i+=46+d+f+h}return s}function se(e,t,r=256*1024*1024){let n=t.localHeaderOffset;if(n+30>e.length||e.readUInt32LE(n)!==Ni)return null;let i=e.readUInt16LE(n+26),s=e.readUInt16LE(n+28),o=n+30+i+s,a=o+t.compSize;if(a>e.length)return null;let l=e.subarray(o,a);try{if(t.method===0)return l.length<=r?Buffer.from(l):null;if(t.method===8)return Ci(l,{maxOutputLength:r})}catch{return null}return null}function Oi(e,t){return se(e,t)?.toString("utf8")??null}var Fi={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'"};function B(e){return e.replace(/&(amp|lt|gt|quot|apos);/g,t=>Fi[t]??t).replace(/&#(\d+);/g,(t,r)=>{let n=Number(r);return n>0&&n<1114112?String.fromCodePoint(n):""}).replace(/&#x([0-9a-fA-F]+);/g,(t,r)=>{let n=parseInt(r,16);return n>0&&n<1114112?String.fromCodePoint(n):""})}function ji(e){return B(e.replace(/<[^>]*>/g,`
30
+ `)}var Tt=new Set([".xlsx",".xlsm",".xltx",".xltm",".docx",".docm",".dotx",".dotm",".pptx",".pptm",".ppsx",".ppsm",".potx"]),Be=new Set([".odt",".ods",".odp",".ott",".ots",".otp"]),Rt=new Set([".doc",".dot",".xls",".xlt",".ppt",".pps",".pot",".msg"]),Mn=new Set([".rtf"]);function to(e){return/^\.(xls[xm]|xlt[xm])$/.test(e)?".xlsx":/^\.(doc[xm]|dot[xm])$/.test(e)?".docx":/^\.(ppt[xm]|pps[xm]|potx)$/.test(e)?".pptx":e}var se=8*1024*1024,no=101010256,ro=33639248,io=67324752;function ae(e){let t=Math.min(e.length,67584),r=-1;for(let s=e.length-22;s>=e.length-t&&s>=0;s-=1)if(e.readUInt32LE(s)===no){r=s;break}if(r<0)return null;let n=e.readUInt16LE(r+10),i=e.readUInt32LE(r+16);if(i>=e.length)return null;let o=[];for(let s=0;s<n&&!(i+46>e.length||e.readUInt32LE(i)!==ro);s+=1){let a=e.readUInt16LE(i+8),c=e.readUInt16LE(i+10),l=e.readUInt32LE(i+20),u=e.readUInt32LE(i+24),d=e.readUInt16LE(i+28),f=e.readUInt16LE(i+30),m=e.readUInt16LE(i+32),h=e.readUInt32LE(i+42),g=e.subarray(i+46,i+46+d).toString("utf8");o.push({name:g,flags:a,method:c,compSize:l,uncompSize:u,localHeaderOffset:h}),i+=46+d+f+m}return o}function ce(e,t,r=256*1024*1024){let n=t.localHeaderOffset;if(n+30>e.length||e.readUInt32LE(n)!==io)return null;let i=e.readUInt16LE(n+26),o=e.readUInt16LE(n+28),s=n+30+i+o,a=s+t.compSize;if(a>e.length)return null;let c=e.subarray(s,a);try{if(t.method===0)return c.length<=r?Buffer.from(c):null;if(t.method===8)return eo(c,{maxOutputLength:r})}catch{return null}return null}function oo(e,t){return ce(e,t)?.toString("utf8")??null}var so={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'"};function z(e){return e.replace(/&(amp|lt|gt|quot|apos);/g,t=>so[t]??t).replace(/&#(\d+);/g,(t,r)=>{let n=Number(r);return n>0&&n<1114112?String.fromCodePoint(n):""}).replace(/&#x([0-9a-fA-F]+);/g,(t,r)=>{let n=parseInt(r,16);return n>0&&n<1114112?String.fromCodePoint(n):""})}function ao(e){return z(e.replace(/<[^>]*>/g,`
31
31
  `)).replace(/\n{2,}/g,`
32
- `)}function Mi(e,t,r){let n=new RegExp(`<${t}\\b[^>]*\\b${r}="([^"]*)"`,"g"),i=[],s;for(;(s=n.exec(e))!==null;)s[1]&&i.push(B(s[1]));return i}function Hi(e,t){let r=[];if(He.has(e)){for(let n of t)(n==="content.xml"||n==="styles.xml"||n==="meta.xml")&&r.push(n);return r}e=Pi(e);for(let n of t)(n==="docProps/core.xml"||n==="docProps/app.xml")&&r.push(n);if(e===".xlsx"||e===".xlsm")for(let n of t)(n==="xl/sharedStrings.xml"||n==="xl/workbook.xml"||/^xl\/worksheets\/sheet\d+\.xml$/.test(n)||/^xl\/comments\d*\.xml$/.test(n))&&r.push(n);else if(e===".docx")for(let n of t)(n==="word/document.xml"||/^word\/(header|footer|footnotes|endnotes|comments)\d*\.xml$/.test(n))&&r.push(n);else if(e===".pptx")for(let n of t)/^ppt\/(slides|notesSlides)\/(slide|notesSlide)\d+\.xml$/.test(n)&&r.push(n);return r}function Ui(e,t){let r=ie(e);if(!r||r.length===0)return null;let n=new Map(r.map(c=>[c.name,c])),i=Hi(t,r.map(c=>c.name));if(i.length===0)return null;let s=[],o=[],a=0,l=!1;for(let c of i){if(a>=re){l=!0;break}let u=n.get(c);if(!u)continue;let d=Oi(e,u);if(d===null)continue;let f=ji(d);if(c==="xl/workbook.xml"){let h=Mi(d,"sheet","name");h.length&&(f+=`
33
- `+h.join(`
34
- `))}a+f.length>re&&(f=f.slice(0,Math.max(0,re-a)),l=!0),f.trim().length!==0&&(s.push(f),o.push(c),a+=f.length)}return s.length===0?null:{text:s.join(`
35
- `),truncated:l,parts:o}}function In(e,t,r={}){if(_e(e)){let n=St(e,re);return"text"in n?{ok:!0,result:{text:n.text,truncated:n.truncated,parts:n.parts,attachments:n.attachments}}:{ok:!1,reason:n.reason}}if(Me(e)){let n=Et(e.toString("latin1"));if(!n.trim())return{ok:!1,reason:"no text inside (an empty file, or only pictures)"};let i=n.length>re;return{ok:!0,result:{text:i?n.slice(0,re):n,truncated:i,parts:["rtf"]}}}if(At.has(t)||He.has(t)){let n=Ui(e,t);return n?{ok:!0,result:n}:{ok:!1,reason:"damaged, or not really an Office file"}}if(Te.has(t)){let n=Oe(e,r);return n?{ok:!0,result:{text:n.text,truncated:n.truncated,parts:[`pdf:${n.engine}`],engine:n.engine,uncertain:n.uncertain}}:{ok:!1,reason:bn(e)}}return $t.has(t)?{ok:!1,reason:"not a Word, Excel, PowerPoint or Outlook file inside, despite its name"}:{ok:!1,reason:"unsupported format"}}function It(e,t,r={}){let n=In(e,t,r);return n.ok?n.result:null}var Tt=new Set([...At,...He,...$t,...$n,...Te]);var tc=5*6e4,nc=2*6e4;import{deflateRawSync as Ki}from"node:zlib";var Tn={israeli_id:"[ID]",credit_card:"[CARD]",iban:"[IBAN]",israeli_phone:"[PHONE]",email:"[EMAIL]"},Bi=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,zi=[...mt].sort((e,t)=>+(t.subkind==="iban")-+(e.subkind==="iban"));function G(e,t,r=1){e[t]=(e[t]??0)+r}var Rn=null,K=e=>{let t=e.trim();Rn&&t&&Rn.add(t)};function N(e,t={},r){let n=e;for(let s of ye()){let o=new RegExp(s.pattern.source,s.pattern.flags.includes("g")?s.pattern.flags:s.pattern.flags+"g");n=n.replace(o,a=>(G(t,"secret"),K(a),"[SECRET]"))}for(let s of zi)s.pattern.lastIndex=0,n=n.replace(s.pattern,o=>s.validate(o)?(G(t,s.subkind),K(o),Tn[s.subkind]??`[${s.subkind.toUpperCase()}]`):o);n=n.replace(Bi,s=>(G(t,"email"),K(s),Tn.email));let i=r??new Set;for(let s of Ae()){let o=s.find(n).sort((a,l)=>l.start-a.start);for(let a of o){let l=n.slice(a.start,a.end);K(l),s.kind==="name"&&i.add(l.trim()),n=n.slice(0,a.start)+`[${s.kind.toUpperCase()}]`+n.slice(a.end),G(t,s.kind)}}return i.size&&(n=Vi(n,i,t)),{text:n,counts:t,columnsHidden:[]}}var Wi=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Vi(e,t,r){let n=new Set;for(let s of t){n.add(s);let o=s.split(/\s+/)[0]??"";o.length>=3&&o!==s&&n.add(o)}let i=e;for(let s of[...n].sort((o,a)=>a.length-o.length)){let o=new RegExp(`(?<![\\p{L}\\p{N}@.\\[-])${Wi(s)}(?![\\p{L}\\p{N}@\\]-])`,"gu");i=i.replace(o,a=>(G(r,"name"),K(a),"[NAME]"))}return i}function oe(e,t,r={}){let n=e;for(let[i,s]of[...t].sort((o,a)=>a[0].length-o[0].length))n.includes(i)&&(n=n.split(i).join(`[${s.toUpperCase()}]`),G(r,s),K(i));return n}function Rt(){let e=new Map,t={};return(r,n)=>{K(n);let i=`${r}\0${n.trim()}`,s=e.get(i);return s===void 0&&(s=t[r]=(t[r]??0)+1,e.set(i,s)),`[${r.toUpperCase()}-${s}]`}}function Ue(e){let t=e.trim();return/^\[[A-Z_]+(?:-\d+)?\]$/.test(t)||/^[\d]{0,4}[*•xX]{3,}[\d]{0,4}$/.test(t)}var Pn=/^\s*-?\d+(?:\.\d+)?\s*$/;function Ct(e){let t=new Set;for(let[r,n]of e){let i=n.filter(o=>Pn.test(o));if(i.length<3)continue;i.filter(o=>N(o).text!==o).length/i.length<.5&&t.add(r)}return t}function Cn(e,t){return e.includes(t)||e.includes('"')||e.includes(`
36
- `)?`"${e.replace(/"/g,'""')}"`:e}function Gi(e){let t=(e.match(/\t/g)??[]).length,r=(e.match(/;/g)??[]).length,n=(e.match(/,/g)??[]).length;return t>n&&t>=r?" ":r>n?";":","}function Pt(e,t){let r=e.split(/\r?\n/),n=t??Gi(r[0]??""),i=Ie(r[0]??"",n),s=i.map(h=>be(h)),o={},a=Rt(),l=r.slice(1).map(h=>h===""?null:Ie(h,n)),c=new Map;for(let h of l)h?.forEach((m,g)=>c.set(g,[...c.get(g)??[],m]));let u=Ct(c),d=ge();if(d){let h=l.filter(m=>m!==null).slice(0,200);for(let m of d({name:"table",headers:i,rows:h})){let g=i.indexOf(m.column);g>=0&&!(m.how==="header"&&u.has(g))&&(s[g]={type:m.type,label:m.category})}}let f=[i.map(h=>Cn(h,n)).join(n)];for(let h of l){if(h===null){f.push("");continue}let m=h.map((g,b)=>{let p=s[b];return p&&g.trim()!==""&&!Ue(g)?(G(o,`column:${p.type}`),a(p.type,g)):u.has(b)&&Pn.test(g)?g:N(g,o).text});f.push(m.map(g=>Cn(g,n)).join(n))}return{text:f.join(`
37
- `),counts:o,columnsHidden:i.filter((h,m)=>s[m])}}var Zi=/^xl\/(pivotCache|charts|externalLinks)\//,Nn=10;function Ln(e,t,r=1){e[t]=(e[t]??0)+r}function On(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Fn(e){let t=e.replace(/<rPh\b[\s\S]*?<\/rPh>/g,""),r="";for(let n of t.matchAll(/<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g))r+=n[1];return B(r)}function Xi(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>Fn(t[1]??"")):[]}var jn=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function Be(e,t){let r=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return r?r[1]:null}function ae(e,t){if(e.type==="s"){let n=/<v>([^<]*)<\/v>/.exec(e.inner);return n?t[Number(n[1])]??null:null}if(e.type==="inlineStr"){let n=/<is>([\s\S]*?)<\/is>/.exec(e.inner);return n?Fn(n[1]):null}if(e.type==="b"||e.type==="e")return null;let r=/<v>([^<]*)<\/v>/.exec(e.inner);return r?B(r[1]):null}function Ji(e){let t=[];for(let r of e.matchAll(jn)){let n=Be(r[1],"r"),i=n?/^([A-Z]+)(\d+)$/.exec(n):null;if(!i)return null;t.push({full:r[0],attrs:r[1],inner:r[2]??"",col:i[1],row:Number(i[2]),type:Be(r[1],"t")??"n"})}return t}function qi(e,t){let r=[...new Set(e.map(n=>n.row))].sort((n,i)=>n-i).slice(0,Nn);for(let n of r){let i=new Map;for(let s of e.filter(o=>o.row===n)){let o=ae(s,t),a=o?be(o):null;a&&i.set(s.col,{type:a.type,header:o.trim()})}if(i.size>0)return{row:n,cols:i}}return{row:-1,cols:new Map}}var Yi=/^xl\/worksheets\/sheet\d+\.xml$/,Qi=200;function es(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function ts(e,t){let r=[...new Set(e.map(s=>s.row))].sort((s,o)=>s-o).slice(0,Nn),n=-1,i=-1/0;for(let s of r){let o=e.filter(c=>c.row===s).map(c=>(ae(c,t)??"").trim()).filter(Boolean);if(o.length<2)continue;let a=o.filter(c=>!es(c)).length,l=a*2-(o.length-a);l>i&&(i=l,n=s)}return n}function ns(e,t,r){let n=qi(t,r),i=ge();if(!i)return n;let s=n.row>=0?n.row:ts(t,r);if(s<0)return n;let o=t.filter(d=>d.row===s).map(d=>({col:d.col,text:(ae(d,r)??"").trim()})).filter(d=>d.text),a=new Map(o.map((d,f)=>[d.col,f])),l=new Map;for(let d of t){if(d.row<=s)continue;let f=a.get(d.col);if(f!==void 0){if(!l.has(d.row)){if(l.size>=Qi)continue;l.set(d.row,o.map(()=>""))}l.get(d.row)[f]=ae(d,r)??""}}let c=new Map(s===n.row?n.cols:[]),u=o.map(d=>d.text);for(let d of i({name:e,headers:u,rows:[...l.values()]})){let f=u.indexOf(d.column);f<0||c.set(o[f].col,{type:d.type,header:d.column,category:d.category,severity:d.severity,how:d.how})}return{row:s,cols:c}}function Lt(e,t){return`<c${e.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${On(t)}</t></is></c>`}var rs=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let r=t;for(let n=0;n<8;n+=1)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r>>>0}return e})();function is(e){let t=4294967295;for(let r=0;r<e.length;r+=1)t=rs[(t^e[r])&255]^t>>>8;return(t^4294967295)>>>0}var Dn=33;function Dt(e){let t=[],r=[],n=0;for(let o of e){let a=Buffer.from(o.name,"utf8"),l=o.name.endsWith("/"),c=l?Buffer.alloc(0):Ki(o.data),u=l?0:8,d=l?0:is(o.data),f=Buffer.alloc(30);f.writeUInt32LE(67324752,0),f.writeUInt16LE(20,4),f.writeUInt16LE(2048,6),f.writeUInt16LE(u,8),f.writeUInt16LE(Dn,12),f.writeUInt32LE(d,14),f.writeUInt32LE(c.length,18),f.writeUInt32LE(o.data.length,22),f.writeUInt16LE(a.length,26),t.push(f,a,c);let h=Buffer.alloc(46);h.writeUInt32LE(33639248,0),h.writeUInt16LE(20,4),h.writeUInt16LE(20,6),h.writeUInt16LE(2048,8),h.writeUInt16LE(u,10),h.writeUInt16LE(Dn,14),h.writeUInt32LE(d,16),h.writeUInt32LE(c.length,20),h.writeUInt32LE(o.data.length,24),h.writeUInt16LE(a.length,28),h.writeUInt32LE(n,42),r.push(h,a),n+=f.length+a.length+c.length}let i=Buffer.concat(r),s=Buffer.alloc(22);return s.writeUInt32LE(101010256,0),s.writeUInt16LE(e.length,8),s.writeUInt16LE(e.length,10),s.writeUInt32LE(i.length,12),s.writeUInt32LE(n,16),Buffer.concat([...t,i,s])}function Nt(e,t){let r=ie(e);if(!r||r.length===0||r.some(p=>Zi.test(p.name)))return null;let n=new Map;for(let p of r){if(p.name.endsWith("/")){n.set(p.name,Buffer.alloc(0));continue}let x=se(e,p);if(!x)return null;n.set(p.name,x)}let i=[...n.keys()].filter(p=>Yi.test(p));if(i.length===0)return null;let s=n.get("xl/sharedStrings.xml")?.toString("utf8")??null,o=Xi(s),a=new Set,l={},c=new Set,u=Rt(),d=ft();for(let p of i){let x=n.get(p).toString("utf8"),k=Ji(x);if(!k)return null;let $=ns(p.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),k,o),L=$.row,M=new Map;for(let R of k){if(R.type!=="n"||R.row<=L)continue;let D=ae(R,o);D!==null&&M.set(R.col,[...M.get(R.col)??[],D])}let H=Ct(M),F=new Map;for(let[R,{type:D,header:z,how:Q}]of $.cols)Q==="header"&&H.has(R)||(F.set(R,D),c.add(z));let Y=x.replace(jn,(R,D,z)=>{let Q=Be(D,"r"),[,U,y]=/^([A-Z]+)(\d+)$/.exec(Q),_={full:R,attrs:D,inner:z??"",col:U,row:Number(y),type:Be(D,"t")??"n"},v=ae(_,o),E=()=>{if(_.type==="s"){let Qt=/<v>([^<]*)<\/v>/.exec(_.inner);Qt&&a.add(Number(Qt[1]))}return R};if(v===null||v.trim()==="")return E();if(d&&_.type==="n"&&H.has(U)&&_.row>L)return Ln(l,"amount"),Lt(D,"[AMOUNT]");let w=F.get(U);if(w&&_.row>L&&!Ue(v))return Ln(l,`column:${w}`),Lt(D,u(w,v));if(_.type==="n"&&H.has(U))return E();let W=N(v,l),me=t?.size?oe(W.text,t,l):W.text;return me===v?E():Lt(D,me)});n.set(p,Buffer.from(Y,"utf8"))}if(s){let p=-1,x=s.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,k=>(p+=1,a.has(p)?k:"<si><t>[HIDDEN]</t></si>"));n.set("xl/sharedStrings.xml",Buffer.from(x,"utf8"))}for(let p of[...n.keys()].filter(x=>/^xl\/comments\d*\.xml$/.test(x))){let k=n.get(p).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,($,L,M,H)=>{let F=N(B(M),l);return`${L}${On(t?.size?oe(F.text,t,l):F.text)}${H}`});n.set(p,Buffer.from(k,"utf8"))}let f=n.get("docProps/core.xml");if(f){let p=f.toString("utf8").replace(/(<dc:creator>)[\s\S]*?(<\/dc:creator>)/,"$1$2").replace(/(<cp:lastModifiedBy>)[\s\S]*?(<\/cp:lastModifiedBy>)/,"$1$2");n.set("docProps/core.xml",Buffer.from(p,"utf8"))}let h=n.get("xl/workbook.xml");if(h){let p=h.toString("utf8").replace(/<(\w+:)?absPath\b[^>]*\/>|<(\w+:)?absPath\b[^>]*>[\s\S]*?<\/(\w+:)?absPath>/g,"");n.set("xl/workbook.xml",Buffer.from(p,"utf8"))}let m=n.get("docProps/app.xml");if(m){let p=m.toString("utf8").replace(/(<Company>)[\s\S]*?(<\/Company>)/,"$1$2").replace(/(<Manager>)[\s\S]*?(<\/Manager>)/,"$1$2");n.set("docProps/app.xml",Buffer.from(p,"utf8"))}let g=n.has("xl/calcChain.xml"),b=r.map(p=>p.name).filter(p=>!(g&&p==="xl/calcChain.xml"));if(g)for(let p of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let x=n.get(p);x&&n.set(p,Buffer.from(x.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:Dt(b.map(p=>({name:p,data:n.get(p)}))),counts:l,columnsHidden:[...c]}}var ce=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,ss=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,os=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i;function Ot(e){let t=0;for(let r of e.split(/\r?\n/)){let n=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(r);if(!n||!ss.test(n[1])||os.test(n[1]))continue;let i=n[2].trim().replace(/^(['"])(.*)\1$/,"$2");i.length>=8&&!/^\$\{?[A-Z_]+\}?$/.test(i)&&t++}return t}var Bc=64*1024*1024,zc=4*1024*1024;var Wc=512*1024*1024,Vc=1024*1024*1024;var Gc=256*1024*1024;var Kc=new Hn("utf-8",{fatal:!0}),Zc=new Hn("windows-1255");var Xc=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()));var al=Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=","base64");var bs=["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."],S=(e,t,r)=>({provider:e,url:t,steps:[...r,...bs]}),_s={"aws-access-key":S("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":S("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":S("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":S("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":S("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":S("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":S("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":S("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":S("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":S("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":S("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":S("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":S("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":S("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":S("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":S("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":S("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":S("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":S("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":S("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":S("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":S("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":S("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":S("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":S("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":S("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":S("An access token","",["Revoke the token in the service that issued it and issue a new one."])},xs=S("A credential","",["Find the service it belongs to and issue a new credential there."]);function Ft(e){return _s[e]??xs}function Wn(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)||ks(e)}function ks(e){return/(^|[\\/])\.nodata[\\/]/.test(e)}import{existsSync as ws,mkdirSync as pd,readFileSync as vs,statSync as jt,writeFileSync as hd}from"node:fs";import{homedir as Ss}from"node:os";import{join as Es}from"node:path";var As=()=>Es(Ss(),".nodata","flagged.json");var Vn="unread";function Gn(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t}var we=null;function Kn(){let e=As();try{if(!ws(e))return{};let t=jt(e).mtimeMs;if(we&&we.path===e&&we.mtimeMs===t)return we.store;let r=JSON.parse(vs(e,"utf8"));return we={path:e,mtimeMs:t,store:r},r}catch{return{}}}function ze(e){let t=Kn()[Gn(e)];if(!t)return null;try{if(jt(e).mtimeMs>t.mtimeMs+1e3)return null}catch{return null}let r=Object.fromEntries(Object.entries(t.kinds).filter(([n])=>n!==Vn));return Object.keys(r).length?r:null}function We(e){let t=Kn()[Gn(e)];if(!t||!t.kinds[Vn])return null;try{return{changed:jt(e).mtimeMs>t.mtimeMs+1e3}}catch{return null}}import{existsSync as Zn,mkdirSync as _d,readFileSync as Xn,writeFileSync as xd}from"node:fs";import{homedir as $s}from"node:os";import{join as Is}from"node:path";var Ve=()=>Is($s(),".nodata","prefs.json");function Ts(){try{let e=Zn(Ve())?JSON.parse(Xn(Ve(),"utf8")).lang:null;return e==="he"||e==="en"?e:null}catch{return null}}function Rs(){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 le(){return Ts()??Rs()}function Jn(){try{return Zn(Ve())&&JSON.parse(Xn(Ve(),"utf8")).amounts_sensitive===!0}catch{return!1}}function I(e,t,r=le()){return r==="he"?e:t}import{createHmac as Vs,randomBytes as Gs}from"node:crypto";import{existsSync as zt,mkdirSync as Ks,readdirSync as Zs,readFileSync as Wt,writeFileSync as Xs}from"node:fs";import{homedir as qe}from"node:os";import{basename as Js,extname as qs,isAbsolute as Ys,join as Ye,relative as Qs,resolve as eo}from"node:path";function Z(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function Cs(e,t,r){return t===null||r===null?!1:t<=r?e>=t&&e<=r:e>=t||e<=r}function qn(e,t,r){switch(t){case"eq":return e===r;case"ne":return e!==r;case"in":return Array.isArray(r)&&r.includes(e);case"not_in":return Array.isArray(r)&&!r.includes(e);case"prefix":return typeof e=="string"&&typeof r=="string"&&e.toLowerCase().startsWith(r.toLowerCase());case"gte":{let n=Z(e),i=Z(r);return n!==null&&i!==null&&n>=i}case"lte":{let n=Z(e),i=Z(r);return n!==null&&i!==null&&n<=i}case"between":{let n=Z(e);return n!==null&&Array.isArray(r)&&r.length===2&&Cs(n,Z(r[0]),Z(r[1]))}default:return!1}}function Yn(e,t,r){switch(t){case"in":return Array.isArray(r)&&e.some(n=>r.includes(n));case"not_in":return Array.isArray(r)&&!e.some(n=>r.includes(n));default:return!1}}import{existsSync as Ge,mkdirSync as Ad,readdirSync as Qn,readFileSync as Ps,rmSync as $d,writeFileSync as Id,chmodSync as Td}from"node:fs";import{homedir as er}from"node:os";import{basename as Pd,isAbsolute as Ls,join as X,relative as Ds,resolve as Ns}from"node:path";var Xe=()=>X(er(),".nodata"),Os=()=>X(Xe(),"credentials.json"),Ke=()=>X(Xe(),"orgs"),Fs=()=>X(Xe(),"bindings.json"),js=/^[A-Za-z0-9_.-]{1,80}$/,Mt=e=>js.test(e)&&e!=="."&&e!=="..";function tr(e){try{return Ge(e)?JSON.parse(Ps(e,"utf8")):null}catch{return null}}function Ms(e){return e?e.device?.org_id?e.device.org_id:e.api_key?`key-${(e.key_prefix??e.api_key.slice(0,12)).replace(/[^A-Za-z0-9_-]/g,"")}`:null:null}function nr(){return Ms(tr(Os()))}function Ht(){let e=[],t=nr();t&&e.push(t);try{for(let r of Qn(Ke()))Mt(r)&&!e.includes(r)&&Ge(X(Ke(),r,"credentials.json"))&&e.push(r)}catch{}return e}var Hs=e=>process.platform==="win32"||process.platform==="darwin"?e.toLowerCase():e,Ze=e=>Hs(Ns(e.replace(/^~(?=[\\/]|$)/,er())));function Us(e,t){let r=Ds(Ze(e),Ze(t));return r===""||!r.startsWith("..")&&!Ls(r)}function J(){let e=tr(Fs());return(Array.isArray(e?.bindings)?e.bindings:[]).filter(r=>!!r&&typeof r.folder=="string"&&typeof r.org_id=="string"&&Mt(r.org_id)).map(r=>r.project===void 0||Ws(r.project)===r.project?r:{...r,project:void 0}).map(r=>r.client===void 0||typeof r.client?.org_id=="string"&&Bs.test(r.client.org_id)?r:{...r,client:void 0})}var Bs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rr(e,t=J()){let r=null;for(let n of t)Us(n.folder,e)&&(!r||Ze(n.folder).length>Ze(r.folder).length)&&(r=n);return r}function zs(e,t=Ht(),r=J()){if(t.length===0)return{kind:"none"};let n=rr(e,r.filter(i=>t.includes(i.org_id)));return n?{kind:"bound",org_id:n.org_id,folder:n.folder}:t.length===1?{kind:"only",org_id:t[0]}:{kind:"unbound",orgs:t}}function ir(e){let t=zs(e);return t.kind==="bound"||t.kind==="only"?t.org_id:null}function Ws(e){if(typeof e!="string")return null;let t=e.trim();return t&&t.length<=120&&!/[\u0000-\u001f\\/]/.test(t)?t:null}function sr(){let e=[],t=X(Xe(),"org-mandate.json");Ge(t)&&e.push({owner:nr(),file:t});try{for(let r of Qn(Ke())){let n=X(Ke(),r,"org-mandate.json");Mt(r)&&Ge(n)&&e.push({owner:r,file:n})}}catch{}return e}function Ut(e,t,r=J()){if(!e)return!0;let n=rr(t,r);return!n||n.org_id===e}var or=()=>Ye(qe(),".nodata","rules.json"),Je=()=>Ye(qe(),".nodata","rules-key"),ar={allow:0,ask:1,clean_copy:2,deny:3},to=["claude-code","cursor","windsurf","codex","gemini","vscode","claude-desktop"],Bt=e=>typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,no={action:{cardinality:"scalar",ops:["eq","ne","in","not_in"],enumValues:["read","search","run","write"],label:"what the agent does (read, search, run, write)",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=>qs(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>Js(e.path).toLowerCase()},agent:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:`which agent (${to.join(", ")} \u2026)`,extract:e=>Bt(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=>Bt(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=>Bt(e.who?.org)}};function ro(){try{if(zt(Je())){let t=Wt(Je(),"utf8").trim();if(/^[0-9a-f]{64}$/.test(t))return Buffer.from(t,"hex")}}catch{}let e=Gs(32);return Ks(Ye(qe(),".nodata"),{recursive:!0}),Xs(Je(),e.toString("hex")+`
38
- `,{mode:384}),e}var io=(e,t)=>Vs("sha256",t).update(JSON.stringify(e)).digest("hex");function cr(){if(!zt(or()))return{rules:[],tampered:!1};try{let e=JSON.parse(Wt(or(),"utf8")),t=Array.isArray(e.rules)?e.rules:[],r=zt(Je())&&typeof e.mac=="string"&&e.mac===io(t,ro());return{rules:t,tampered:!r}}catch{return{rules:[],tampered:!0}}}var ve=e=>{let t=eo(e.replace(/^~(?=[\\/]|$)/,qe())).replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t};function q(e,t){if(e.startsWith("**/")){let n=e.slice(3).replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),i=ve(t).toLowerCase();return i.endsWith("/"+n)||i.includes("/"+n+"/")}let r=Qs(ve(e),ve(t));return r===""||!r.startsWith("..")&&!Ys(r)}function lr(e,t,r){let n=no[e.field];if(!n)return!1;let i=n.extract(t);return n.agentScope&&i===void 0?r!=="allow":e.op==="exists"?i!==void 0&&i!=="":i===void 0?!1:n.cardinality==="set"?Yn(Array.isArray(i)?i:[],e.op,e.value):qn(i,e.op,e.value)}function Qe(e,t){let r=e.map((n,i)=>({rule:n,n:i+1})).filter(n=>q(n.rule.path,t.path)).sort((n,i)=>ve(i.rule.path).length-ve(n.rule.path).length||n.n-i.n);for(let n of r)if((n.rule.when??[]).every(i=>lr(i,t,n.rule.effect)))return{...n,touched:t.path};return null}function et(e,t,r,n,i){let s=null;for(let[o,a]of e.entries())q(a.path,t)||(a.path.startsWith("**/")?!so(t,a.path):!q(t,a.path))||(a.when??[]).every(l=>lr(l,{action:r,path:a.path,now:n,who:i},a.effect))&&(!s||ar[a.effect]>ar[s.rule.effect])&&(s={rule:a,n:o+1,touched:a.path});return s}function so(e,t){let r=0,n=(i,s)=>{if(s>5||r>4e3)return!1;let o;try{o=Zs(i,{withFileTypes:!0})}catch{return!1}for(let a of o){if(++r>4e3||!a.isDirectory()||a.name==="node_modules"||a.name===".git")continue;let l=Ye(i,a.name);if(q(t,l)||n(l,s+1))return!0}return!1};return n(e,0)}var oo={allow:["allowed","\u05DE\u05D5\u05EA\u05E8"],ask:["ask the person","\u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05D5\u05EA\u05DA"],clean_copy:["clean copy only","\u05E8\u05E7 \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9"],deny:["not allowed","\u05D0\u05E1\u05D5\u05E8"]};var dr=(e,t=!1)=>oo[e][t?1:0];function ur(){let e=[];for(let{owner:t,file:r}of sr())try{let n=JSON.parse(Wt(r,"utf8"));Array.isArray(n?.folder_rules)&&n.folder_rules.length&&e.push({owner:t,rules:n.folder_rules})}catch{}return e}function fr(){let e=Ht();return e.length<2?[]:J().filter(t=>e.includes(t.org_id)).map(t=>({path:t.folder,effect:"deny",when:[{field:"org",op:"ne",value:t.org_id.toLowerCase()}],note:`works for organisation ${t.org_id}; another organisation's agent does not touch it`}))}var po=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".eml",...Tt]),ho=50*1024*1024,pr=8,mo={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function Jt(e){let t=Xt(e).toLowerCase();return po.has(br(t))||ce.test(t)}var go=/^(reports|receipts)(\/|$)|^(prefs|consent|flagged|statusline-prev|key-backup|connection)\.json$|^(gate|status)\.mjs$|^(gate|answers)\.log$/i,yo=/\.nodata[\\/]+(device-key\.json|secrets\.json|credentials\.json|issuer-ed25519\.json|capsule\.json|capsule-key|shares|approvals|fabric-key\.json|machine-salt|pending-link\.json|api-shares\.json|secret-shares\.json|quarantine|bindings\.json|orgs)\b/i;function de(e){let t=tt(ue(),".nodata").replace(/\\/g,"/").toLowerCase();if(!e.replace(/\\/g,"/").toLowerCase().startsWith(t+"/"))return!1;let n=e.replace(/\\/g,"/").slice(t.length+1);return n!==""&&!go.test(n)}function bo(e){return yo.test(e)}var pe=e=>e.startsWith("mcp__"),_r=e=>/^mcp__.+__nodata_[a-z0-9_]+$/i.test(e),_o=/(path|file|dir|folder|root|uri|target|source|destination|cwd)/i,xo=/(write|edit|create|save|update|delete|remove|move|rename|append|put|upload|patch|insert|mkdir)/i,ko=/(search|grep|find|glob|list|tree|director|query)/i,hr=16;function it(e){let t=e.split("__").slice(2).join("__");return xo.test(t)?"write":ko.test(t)?"search":"read"}function Ee(e,t){let r=[],n=(s,o)=>{let a=s.trim();if(/^file:\/\//i.test(a))try{a=decodeURIComponent(new URL(a).pathname).replace(/^\/([a-zA-Z]:)/,"$1")}catch{return}else if(!(o||/^(~[\\/]|\/|[a-zA-Z]:[\\/])/.test(a)))return;if(!a||a.length>1024||/[\n\r]/.test(a)||/^[a-z][a-z0-9+.-]*:\/\//i.test(a))return;let l=C(t,a.replace(/^~(?=[\\/]|$)/,ue()));!r.includes(l)&&r.length<hr&&r.push(l)},i=(s,o,a)=>{if(!(a>3||r.length>=hr)){if(typeof s=="string")n(s,_o.test(o));else if(Array.isArray(s))for(let l of s.slice(0,50))i(l,o,a+1);else if(s&&typeof s=="object")for(let[l,c]of Object.entries(s))i(c,l,a+1)}};return i(e,"",0),r}var Vt=/(\.claude[\\/]+settings(\.local)?\.json|node_modules[\\/]+@nodatachat[\\/])/i,wo=/(>|\bsed\s+-i|\btee\b|\b(rm|del|erase|mv|move|cp|copy|ren|rename)\b|Set-Content|Add-Content|Out-File|Remove-Item|Move-Item|Copy-Item|Rename-Item|WriteAllText|writeFileSync|unlinkSync)/i;function vo(e,t,r){if(e==="Bash"||e==="PowerShell"){let i=typeof t.command=="string"?t.command:"";return Vt.test(i)&&wo.test(i)}if(pe(e))return it(e)==="write"&&Ee(t,r).some(i=>Vt.test(i.replace(/\\/g,"/")));let n=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return n?Vt.test((fe(n)?n:C(r,n)).replace(/\\/g,"/")):!1}function So(e){return Jt(e)||ze(e)!==null||We(e)!==null}var nt=class extends Error{};function Eo(e){let t=br(e).toLowerCase(),r=uo(e),n,i;if(t===".csv"||t===".tsv")i=r.toString("utf8"),n=Pt(i,t===".tsv"?" ":void 0).counts;else if(Tt.has(t)){let o=t===".xlsx"||t===".xlsm"?Nt(r):null,a=It(r,t);if(!a&&!o)throw new nt;i=a?.text??"",n=o?o.counts:N(i).counts}else i=r.toString("utf8"),n=N(i).counts;let s=$e.filter(o=>o.pattern.test(i)).length;return ce.test(Xt(e).toLowerCase())&&(s=Math.max(s,Ot(i))),s&&(n.secret=Math.max(n.secret??0,s)),n}var Ao={israeli_id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",credit_card:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9",iban:"IBAN",israeli_phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",email:'\u05D3\u05D5\u05D0"\u05DC',secret:"\u05E1\u05D5\u05D3",name:"\u05E9\u05DD",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",financial:"\u05DE\u05D9\u05D3\u05E2 \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",bank_account:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7",plate:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"};function xr(e){let t=le()==="he",r=n=>(t?Ao[n]:mo[n])??n;return Object.entries(e).sort((n,i)=>i[1]-n[1]).map(([n,i])=>`${i} ${n.startsWith("column:")?`${r(n.slice(7))} (${t?"\u05E2\u05DE\u05D5\u05D3\u05D4":"column"})`:r(n)}`).join(", ")}function $o(e){return xr(e)}function kr(e,t,r){let n=s=>fe(s)?s:C(r,s),i=s=>{try{return Zt(s).isFile()}catch{return!1}};if(e==="Read"&&typeof t.file_path=="string")return[n(t.file_path)];if(e==="Grep"&&typeof t.path=="string"&&i(n(t.path)))return[n(t.path)];if(pe(e))return it(e)==="write"?[]:Ee(t,r).filter(i).slice(0,pr);if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let s=t.command,o=[...[...s.matchAll(/"([^"]*)"/g)].map(l=>l[1]),...[...s.matchAll(/'([^']*)'/g)].map(l=>l[1]),...s.split(/[\s|;&<>(),=`]+/)],a=[];for(let l of o){let c=l.trim().replace(/^['"]|['"]$/g,"").replace(/\\\\/g,"\\").replace(/^~(?=[\\/])/,ue()).replace(/^\/([a-zA-Z])\//,(d,f)=>process.platform==="win32"?`${f}:/`:d);if(!c)continue;let u=n(c);if(!(!Jt(c)&&!de(u)&&ze(u)===null&&We(u)===null)&&(i(u)&&!a.includes(u)&&a.push(u),a.length>=pr))break}return a}return[]}function O(e){return e.replace(/\\+/g,"/")}function Io(e){let t=e.trim();return/[;|&\n]|`|\$\(/.test(t.replace(/^cmd(?:\.exe)?\s+\/c\s+/i,""))?!1:/^(?:cmd(?:\.exe)?\s+\/c\s+)?(?:explorer(?:\.exe)?|start|invoke-item|ii|start-process|open|xdg-open)\b/i.test(t)}function mr(e,t){return`${O(e)}: ${t?I("\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05DC\u05D0 \u05D4\u05E6\u05DC\u05D9\u05D7\u05D4 \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05D5\u05EA\u05D5, \u05D5\u05D4\u05D5\u05D0 \u05D4\u05E9\u05EA\u05E0\u05D4 \u05DE\u05D0\u05D6 \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","your last scan could not read it, and it changed since \u2014 NOT checked, treat it as sensitive"):I("\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05DC\u05D0 \u05D4\u05E6\u05DC\u05D9\u05D7\u05D4 \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","your last scan could not read it \u2014 NOT checked, treat it as sensitive")}`}function wr(e,t,r){let n=[];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"&&Io(t.command))return n;for(let i of kr(e,t,r)){if(!So(i)||Wn(i)||!yr(i))continue;let s=We(i);if(!Jt(i)){let o=ze(i);o?n.push({line:`${O(i)}: ${I("\u05E7\u05D5\u05D3 \u05E9\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05E1\u05D9\u05DE\u05E0\u05D4","code your last scan flagged")} \u2014 ${$o(o)}`,kind:"flagged_code"}):s&&n.push({line:mr(i,s.changed),kind:"unread"});continue}try{if(Zt(i).size>ho)n.push({line:`${O(i)}: too large to check here (over 50 MB)`,kind:"too_large"});else{let o=Eo(i);Object.keys(o).length?n.push({line:`${O(i)}: ${xr(o)}`,kind:"data_file"}):s&&!s.changed&&n.push({line:mr(i,!1),kind:"unread"})}}catch(o){n.push(o instanceof nt?{line:`${O(i)}: ${I("\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05EA \u05D4\u05D8\u05E7\u05E1\u05D8 (\u05E1\u05E8\u05D9\u05E7\u05D4, \u05D4\u05E6\u05E4\u05E0\u05D4 \u05D0\u05D5 \u05D2\u05D5\u05E4\u05DF \u05DC\u05D0 \u05E0\u05EA\u05DE\u05DA) \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","its text could not be read (a scan, encryption or an unsupported font) \u2014 NOT checked, treat it as sensitive")}`,kind:"unreadable"}:{line:`${O(i)}: could not be checked`,kind:"unreadable"})}}return n}var Kt=/(?:\.aws[\\/]+credentials|\.npmrc|\.yarnrc\.yml|\.pypirc|[._]netrc|\.git-credentials|\.pgpass|\.docker[\\/]+config\.json|\.kube[\\/]+config|gh[\\/]+hosts\.yml|\.supabase[\\/]+access-token|application_default_credentials\.json|gcloud[\\/]+(?:credentials|access_tokens)\.db|\.azure[\\/]+(?:msal_token_cache|accessTokens)|com\.vercel\.cli[\\/]+auth\.json|\.ssh[\\/]+id_(?:rsa|ed25519|ecdsa|dsa)(?![\w.]))/i,rt=/(?:TOKEN|SECRET|PASSW(?:OR)?D|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIAL|SERVICE_ROLE|_KEY$)/i,vr="the vault's secrets, outside nodata_run's per-command approval",To=/(?:^|[^\w.@-])(?:npx|pnpx|bunx|npm|pnpm|yarn|bun|node|nodejs|deno|nodata-mcp)(?:\.cmd|\.exe|\.ps1|\.js)?(?![\w-])[\s\S]*?(?<![\w-])secrets-(?:run|login|set|import|share)(?![\w-])/i;function Ro(e){return To.test(e)}var Co=[[/^(?:env|set|export\s+-p|declare\s+-x|get-childitem\s+env:\S*|gci\s+env:\S*|dir\s+env:\S*|ls\s+env:\S*)\s*$/i,"every environment variable"],[/^gh\s+auth\s+(?:token\b|status\b.*(?:\s-t\b|--show-token))/i,"the GitHub login token"],[/^gcloud\s+auth\s+(?:application-default\s+)?print-(?:access|identity)-token\b/i,"a Google Cloud access token"],[/^az\s+account\s+get-access-token\b/i,"an Azure access token"],[/^aws\s+(?:configure\s+(?:get\s+\S*(?:secret|token)\S*|export-credentials)|sts\s+get-session-token|ecr\s+get-login-password)\b/i,"AWS credentials"],[/^supabase\s+projects\s+api-keys\b/i,"the project's Supabase keys (incl. service_role)"],[/^heroku\s+auth:token\b/i,"the Heroku login token"],[/^op\s+(?:read|item\s+get)\b/i,"a 1Password secret"],[/^vault\s+(?:kv\s+get|read)\b/i,"a Vault secret"],[/^doppler\s+secrets\b/i,"Doppler secrets"],[/^security\s+find-(?:generic|internet)-password\b.*\s-w\b/i,"a keychain password"],[/^git\s+credential\s+fill\b/i,"a saved Git password"],[/^node\s+\S*nodata-pull\.mjs\b/i,vr],[/^kubectl\s+get\s+secrets?\b.*\s-o\b/i,"Kubernetes secrets"]],Po=/^(?:echo|printf|print|write-output|write-host|say)\b/i,Sr=/^(?:cat|type|get-content|gc|more|less|head|tail|bat|nl|strings|xxd|od|hexdump|grep|egrep|rg|select-string|sls|awk|sed|jq|yq|python\d*|py|node|ruby|perl)\b/i,Lo=/\$\{?env:([A-Za-z_][\w]*)|\$\{?([A-Za-z_][\w]*)|%([A-Za-z_][\w]*)%|GetEnvironmentVariable\(\s*['"]([^'"]+)['"]/g;function Do(e,t,r){let n=e==="Read"&&typeof t.file_path=="string"?t.file_path:e==="Grep"&&typeof t.path=="string"?t.path:"";if(n&&Kt.test((fe(n)?n:C(r,n)).replace(/\\/g,"/")))return`a saved login (${Xt(n)})`;if(e!=="Bash"&&e!=="PowerShell"||typeof t.command!="string")return null;let i=t.command.split(/(\|\||&&|[;|\n])/);for(let s=0;s<i.length;s+=2){let o=i[s+1]==="|",a=i[s].trim().replace(/^(?:sudo\s+|cmd(?:\.exe)?\s+\/c\s+|powershell(?:\.exe)?\s+(?:-command\s+)?|pwsh\s+(?:-c(?:ommand)?\s+)?)+/i,"").replace(/^["']|["']$/g,"");if(Sr.test(a)&&Kt.test(a))return"a saved login file";if(Ro(a))return vr;for(let[c,u]of Co)if(c.test(a))return u;let l=a.match(/^printenv(?:\s+(\S+))?\s*$/i);if(l&&(!l[1]||rt.test(l[1])))return l[1]?`the variable ${l[1]}`:"every environment variable";if(!o&&(Po.test(a)||/GetEnvironmentVariable/i.test(a)))for(let c of a.matchAll(Lo)){let u=c[1]??c[2]??c[3]??c[4]??"";if(rt.test(u))return`the variable ${u}`}}return null}var Er=/^(?:grep|egrep|fgrep|rg|ag|ack|git\s+grep|findstr|select-string|sls)\b/i,No=/(?:^|\s)(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive|--dereference-recursive|\/s|-recurse)(?=\s|$)/i,Oo=new Set(["node_modules",".git",".next","dist","build",".venv","venv","__pycache__",".cache"]),gr=4e3,Fo=5;function jo(e){let t=0,r=0,n=(i,s)=>{if(s>Fo||t>gr)return;let o;try{o=lo(i,{withFileTypes:!0})}catch{return}for(let a of o){if(++t>gr)return;let l=tt(i,a.name);a.isDirectory()?Oo.has(a.name)||n(l,s+1):(ce.test(a.name.toLowerCase())||Kt.test(l.replace(/\\/g,"/"))||de(l))&&r++}};return n(e,0),r}var Se=e=>{try{return Zt(e).isDirectory()}catch{return!1}};function Mo(e,t){let r=fo(C(t),C(e));return r===""||!r.startsWith("..")&&!fe(r)}function Ho(e,t,r){let n=s=>C(r,s.replace(/^~(?=[\\/]|$)/,ue())),i=[];if(e==="Grep"){let s=typeof t.path=="string"&&t.path?n(t.path):C(r);if(Se(s)){let o=[t.pattern,t.glob,t.type].filter(a=>typeof a=="string").join(" ");i.push({roots:[s],bySecret:rt.test(o)||/\.env|env\b/i.test(String(t.glob??""))})}}else if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string")for(let s of t.command.split(/\|\||&&|[;|\n]/)){let o=s.trim().replace(/^(?:sudo\s+|xargs\s+(?:-\S+\s+)*)/i,"");if(!/^find\b.*-exec\s+(?:grep|egrep|rg|cat)\b/i.test(o)&&!(Er.test(o)&&(No.test(o)||/^(?:rg|ag|ack|git\s+grep)\b/i.test(o))))continue;let c=o.split(/\s+/).slice(1).map(u=>u.replace(/^['"]|['"]$/g,"")).filter(u=>u&&!u.startsWith("-")&&!/^\/[a-z]$/i.test(u)).map(n).filter(Se);i.push({roots:c.length?c:[C(r)],bySecret:rt.test(o)||/\.env\b/i.test(o)})}for(let s of i)for(let o of s.roots){if(!s.bySecret&&Mo(o,r))continue;let a=jo(o);if(a>0)return{why:s.bySecret?"by_name":"outside",root:o,keyFiles:a}}return null}var Ar=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),Gt=e=>Ar.has(e)||pe(e)&&it(e)==="write";function $r(e,t,r){let n=i=>C(r,i.replace(/^~(?=[\\/]|$)/,ue()));if(e==="Read"&&typeof t.file_path=="string")return{action:"read",paths:[n(t.file_path)],roots:[]};if(Ar.has(e)){let i=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return i?{action:"write",paths:[n(i)],roots:[]}:null}if(e==="Grep"||e==="Glob"){let i=typeof t.path=="string"&&t.path?n(t.path):C(r);return{action:"search",paths:[i],roots:Se(i)?[i]:[]}}if(pe(e)){let i=Ee(t,r);if(!i.length)return null;let s=it(e);return{action:s,paths:i,roots:s==="search"?i.filter(Se):[]}}if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let i=t.command,o=[...[...i.matchAll(/"([^"]*)"/g)].map(c=>c[1]),...[...i.matchAll(/'([^']*)'/g)].map(c=>c[1]),...i.split(/[\s|;&<>(),=`]+/)].map(c=>c.trim()).filter(c=>c&&!c.startsWith("-")&&/[\\/.~]/.test(c)).map(n).filter(c=>yr(c)),a=i.split(/\|\||&&|[;|\n]/).some(c=>Er.test(c.trim())||/^find\b/i.test(c.trim())),l=o.filter(Se);return{action:a?"search":Sr.test(i.trim())?"read":"run",paths:[C(r),...o],roots:a?l.length?l:[C(r)]:[]}}return null}function Uo(e,t,r,n=new Date,i){let s=$r(e,t,r);if(!s)return null;let{rules:o,tampered:a}=cr(),l=ur();if(!o.length&&!l.length)return null;let c={allow:0,ask:1,clean_copy:2,deny:3},u=J(),d=null;for(let{owner:h,rules:m}of l){for(let g of s.paths){if(!Ut(h,g,u))continue;let b=Qe(m,{action:s.action,path:g,now:n,who:i});b&&(!d||c[b.rule.effect]>c[d.rule.effect])&&(d={...b,org:!0})}for(let g of s.roots){if(!Ut(h,g,u))continue;let b=et(m,g,s.action,n,i);b&&b.rule.effect!=="allow"&&(!d||c[b.rule.effect]>c[d.rule.effect])&&(d={...b,org:!0})}}let f=Bo(o,a,s,n,c,i);return d&&(!f||c[d.rule.effect]>=c[f.rule.effect])?d:f}function Bo(e,t,r,n,i,s){if(!e.length)return null;if(t){for(let a of r.paths){let l=e.find(c=>q(c.path,a)||q(a,c.path));if(l)return{rule:{...l,effect:"deny",when:[]},n:e.indexOf(l)+1,touched:a,tampered:!0}}return null}let o=null;for(let a of r.paths){let l=Qe(e,{action:r.action,path:a,now:n,who:s});l&&(!o||i[l.rule.effect]>i[o.rule.effect])&&(o=l)}for(let a of r.roots){let l=et(e,a,r.action,n,s);l&&l.rule.effect!=="allow"&&(!o||i[l.rule.effect]>i[o.rule.effect])&&(o=l)}return o}function zo(e){let t;try{t=typeof e=="string"?e:JSON.stringify(e??"")}catch{return{}}if(!t)return{};t=t.slice(0,2*1024*1024);let r={};for(let n of ye()){let i=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g"),s=(t.match(i)??[]).length;s&&(r[n.id]=(r[n.id]??0)+s)}return r}function Wo(e){let t=Object.keys(e);if(t.length===0)return null;let r=t.reduce((i,s)=>i+e[s],0),n=[...new Set(t.map(i=>{let s=Ft(i);return s.url?`${s.provider}: ${s.url}`:s.provider}))];return`NoData \xB7 A CREDENTIAL IS IN THIS OUTPUT (${r}: ${t.join(", ")}). It is now in this conversation and was sent to the AI model. Do not repeat, quote, shorten, mask-by-hand or reuse it \u2014 not in your answer, not in a command, not in a file. Tell the user in one line that a key was shown here and should be replaced at its provider (${n.join(" \xB7 ")}); nodata_scan_folder gives the full steps. Next time, run commands that need secrets through nodata_run: the output comes back with every value blanked.`+(le()==="he"?" Answer the user in Hebrew.":"")}function Vo(e,t,r,n){let i=fr();if(!i.length)return null;let s=$r(e,t,r);if(!s)return null;let o=new Date,a=s.paths.map(c=>Qe(i,{action:s.action,path:c,now:o,who:n})).find(Boolean)??s.roots.map(c=>et(i,c,s.action,o,n)).find(Boolean);if(!a)return null;let l=String(a.rule.when?.[0]?.value??"");return I(`NoData \u05D7\u05E1\u05DD: ${O(a.rule.path)} \u05E2\u05D5\u05D1\u05D3\u05EA \u05E2\u05D1\u05D5\u05E8 \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05E8 (${l}) \u05DE\u05D6\u05D4 \u05E9\u05DC \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5. \u05E1\u05D5\u05DB\u05DF \u05E9\u05E2\u05D5\u05D1\u05D3 \u05DB\u05D0\u05DF \u05E2\u05D1\u05D5\u05E8 \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05D3 \u05DC\u05D0 \u05E0\u05D5\u05D2\u05E2 \u05D1\u05E7\u05D1\u05E6\u05D9\u05DD \u05E9\u05DC \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05E8 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4 \u05E9\u05DD: \u05DC\u05E4\u05EA\u05D5\u05D7 \u05D0\u05EA \u05D4\u05E1\u05D5\u05DB\u05DF \u05D1\u05EA\u05D5\u05DA \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D4\u05D9\u05D0.`,`NoData refused: ${O(a.rule.path)} works for another organisation (${l}) than this folder. An agent working here for one organisation does not touch another organisation's files \u2014 not even with approval. To work there, start the agent inside that folder.`)}function Go(e,t,r){let n=(e==="Bash"||e==="PowerShell")&&typeof t.command=="string"?t.command:"",i=(e==="Grep"||e==="Glob")&&typeof t.path=="string"?t.path:e==="Read"&&typeof t.file_path=="string"?t.file_path:"";return n&&bo(n)||i&&de(fe(i)?i:C(r,i))||pe(e)&&Ee(t,r).some(de)||kr(e,t,r).some(de)?I("NoData \u05D7\u05E1\u05DD: \u05D6\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E4\u05EA\u05D7 \u05E9\u05DC NoData (\u05DE\u05E4\u05EA\u05D7 \u05D4\u05DE\u05DB\u05E9\u05D9\u05E8, \u05D4\u05DB\u05E1\u05E4\u05EA \u05D0\u05D5 \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF). \u05DE\u05D9 \u05E9\u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E4\u05EA\u05D5\u05D7 \u05DB\u05DC \u05E7\u05D5\u05D1\u05E5 \u05E0\u05E2\u05D5\u05DC, \u05D5\u05DC\u05DB\u05DF \u05D0\u05E3 \u05E1\u05D5\u05DB\u05DF \u05DC\u05D0 \u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC-NoData \u05D0\u05D9\u05DF \u05E2\u05D5\u05EA\u05E7 \u05E9\u05DC \u05D4\u05DE\u05E4\u05EA\u05D7 \u05D5\u05D0\u05D9\u05DF \u05D3\u05E8\u05DA \u05DC\u05E9\u05D7\u05D6\u05E8 \u05D0\u05D5\u05EA\u05D5: \u05D4\u05D2\u05D9\u05D1\u05D5\u05D9 \u05E9\u05DC\u05DA \u05D4\u05D5\u05D0 \u05D4\u05D3\u05E8\u05DA \u05D4\u05D9\u05D7\u05D9\u05D3\u05D4. \u05DC\u05D2\u05D9\u05D1\u05D5\u05D9, \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC \u05D5\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8: npx -y @nodatachat/mcp@latest key-backup E: (E: = \u05D4\u05D3\u05D9\u05E1\u05E7-\u05D0\u05D5\u05DF-\u05E7\u05D9).","NoData refused: this is one of NoData's own key files (the device key, the vault login or the org credential). Whoever reads it can open every sealed file, so no agent reads it \u2014 not even with approval. NoData holds no copy of this key and cannot recover it: your backup is the only recovery. To back it up, in a terminal (not the chat): npx -y @nodatachat/mcp@latest key-backup E: (E: = your USB drive). Do not suggest other recovery routes \u2014 there are none."):null}function Ko(e,t,r,n,i){if(_r(e))return{decision:"allow"};let s=ir(r),o={...i,org:s??void 0},a=Go(e,t,r);if(a)return{decision:"deny",reason:a,kind:"nodata_key"};let l=Vo(e,t,r,o);if(l)return{decision:"deny",reason:l,kind:"org_wall"};let c=Do(e,t,r);if(c){let b=I(`NoData: \u05D4\u05E4\u05E7\u05D5\u05D3\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E6\u05D9\u05D2\u05D4 ${c}. \u05DE\u05D4 \u05E9\u05D4\u05D9\u05D0 \u05DE\u05D3\u05E4\u05D9\u05E1\u05D4 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4 \u05D5\u05E0\u05E9\u05DC\u05D7 \u05DC\u05DE\u05D5\u05D3\u05DC \u05D4\u05D1\u05D9\u05E0\u05D4 \u05D4\u05DE\u05DC\u05D0\u05DB\u05D5\u05EA\u05D9\u05EA, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05E8\u05D0\u05D4 \u05DB\u05D0\u05DF \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D7\u05DC\u05D9\u05E3.
39
- \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05D5\u05EA\u05D4 \u05D1\u05E2\u05E6\u05DE\u05DA \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC (\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8), \u05D0\u05D5 nodata_run \u2014 \u05E9\u05DE\u05E8\u05D9\u05E5 \u05E4\u05E7\u05D5\u05D3\u05D4 \u05E2\u05DD \u05D4\u05E1\u05D5\u05D3\u05D5\u05EA \u05D5\u05DE\u05D7\u05D6\u05D9\u05E8 \u05D0\u05EA \u05D4\u05E4\u05DC\u05D8 \u05DB\u05E9\u05DB\u05DC \u05E2\u05E8\u05DA \u05DE\u05D5\u05E1\u05EA\u05E8.`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this shows ${c}. Whatever it prints enters the conversation and goes to the AI model, and a key seen there has to be replaced.
40
- Instead: run it yourself in a terminal (not the chat), or nodata_run \u2014 it runs a command with the secrets and returns the output with every value blanked.`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:b,kind:"credential_print"}}if((Gt(e)||e==="Bash"||e==="PowerShell")&&vo(e,t,r))return{decision:"ask",kind:"gate_holder",reason:I("NoData: \u05D4\u05E4\u05E2\u05D5\u05DC\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05D4 \u05E9\u05DE\u05E4\u05E2\u05D9\u05DC \u05D0\u05EA \u05D4\u05E9\u05E2\u05E8 \u2014 \u05D4\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05E9\u05DC Claude Code \u05D0\u05D5 \u05D4\u05E7\u05D5\u05D3 \u05D4\u05DE\u05D5\u05EA\u05E7\u05DF \u05E9\u05DC NoData. \u05D0\u05D7\u05E8\u05D9 \u05E9\u05D9\u05E0\u05D5\u05D9 \u05DB\u05D6\u05D4 \u05D9\u05D9\u05EA\u05DB\u05DF \u05E9\u05D4\u05E9\u05E2\u05E8 \u05DC\u05D0 \u05D9\u05D1\u05D3\u05D5\u05E7 \u05D9\u05D5\u05EA\u05E8. \u05DC\u05D0\u05E9\u05E8 \u05E8\u05E7 \u05D0\u05DD \u05D0\u05EA\u05D4 \u05D1\u05D9\u05E7\u05E9\u05EA \u05D0\u05EA \u05D6\u05D4.","NoData: this changes what runs the gate \u2014 Claude Code's settings or NoData's installed code. After such a change the gate may stop checking. Approve only if you asked for it.")};if(Gt(e)){let b=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";if((pe(e)?Ee(t,r):b?[fe(b)?b:C(r,b)]:[]).some(de))return{decision:"deny",kind:"nodata_write",reason:I("NoData \u05D7\u05E1\u05DD: \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 ~/.nodata \u05E1\u05D2\u05D5\u05E8\u05D4 \u05DC\u05E1\u05D5\u05DB\u05E0\u05D9\u05DD, \u05D2\u05DD \u05DC\u05DB\u05EA\u05D9\u05D1\u05D4 (\u05DB\u05DC\u05DC\u05D9\u05DD, \u05DE\u05E4\u05EA\u05D7\u05D5\u05EA, \u05D0\u05D9\u05E9\u05D5\u05E8\u05D9\u05DD).","NoData refused: ~/.nodata is closed to agents, writes included (rules, keys, approvals).")}}let u=Uo(e,t,r,new Date,o);if(u&&u.rule.effect!=="allow"){let b=le()==="he",p=u.tampered?I("\u05E7\u05D5\u05D1\u05E5 \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05D5\u05E0\u05D4 \u05E9\u05DC\u05D0 \u05D3\u05E8\u05DA nodata_rules, \u05D5\u05DC\u05DB\u05DF \u05DB\u05DC \u05E0\u05EA\u05D9\u05D1 \u05E9\u05D4\u05D5\u05D0 \u05DE\u05D6\u05DB\u05D9\u05E8 \u05E1\u05D2\u05D5\u05E8 \u05E2\u05D3 \u05E9\u05EA\u05E9\u05DE\u05D5\u05E8 \u05D0\u05EA \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05DE\u05D7\u05D3\u05E9.","the rules file was changed outside nodata_rules, so every path it names is closed until you save the rules again."):`${u.org?I("\u05DB\u05DC\u05DC \u05E9\u05DC \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF","organisation rule"):I("\u05DB\u05DC\u05DC","rule")} ${u.n}: ${u.rule.path.startsWith("**/")?u.rule.path:O(u.rule.path)} \u2192 ${dr(u.rule.effect,b)}${u.rule.note?` (${u.rule.note})`:""}`,x=u.rule.effect==="clean_copy"?I(`NoData: ${p}. \u05D4\u05E1\u05D5\u05DB\u05DF \u05E2\u05D5\u05D1\u05D3 \u05DB\u05D0\u05DF \u05E8\u05E7 \u05E2\u05DC \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9: nodata_redact \u05D9\u05D5\u05E6\u05E8 \u05D0\u05D5\u05EA\u05D5 (\u05DE\u05D6\u05D4\u05D9\u05DD \u05DE\u05D5\u05D7\u05DC\u05E4\u05D9\u05DD, \u05E0\u05D1\u05D3\u05E7 \u05DC\u05E4\u05E0\u05D9 \u05E9\u05D9\u05DE\u05D5\u05E9).`,`NoData: ${p}. The agent works here on a clean copy only: nodata_redact makes one (identifiers replaced, checked before use).`):u.rule.effect==="ask"?I(`NoData: ${p}. \u05DC\u05D0\u05E9\u05E8?`,`NoData: ${p}. Allow?`):I(`NoData: ${p}. \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05DC \u05D4\u05E7\u05D1\u05E6\u05D9\u05DD \u05D5\u05D4\u05EA\u05D9\u05E7\u05D9\u05D5\u05EA \u05E9\u05DC\u05DA: nodata_rules.`,`NoData: ${p}. Your file and folder rules: nodata_rules.`);return{decision:u.rule.effect==="ask"?"ask":"deny",reason:x,kind:"rule"}}if(Gt(e))return{decision:"allow"};let d=Ho(e,t,r);if(d){let b=O(d.root),p=I(`NoData: \u05D6\u05D4 ${d.why==="by_name"?"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E1\u05D5\u05D3 \u05DC\u05E4\u05D9 \u05E9\u05DD":"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05DE\u05D7\u05D5\u05E5 \u05DC\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8"}, \u05D1\u05EA\u05D5\u05DA ${b}, \u05E9\u05D9\u05E9 \u05D1\u05D4 ${d.keyFiles} \u05E7\u05D1\u05E6\u05D9 \u05DE\u05E4\u05EA\u05D7\u05D5\u05EA (.env, \u05D4\u05EA\u05D7\u05D1\u05E8\u05D5\u05D9\u05D5\u05EA). \u05DE\u05D4 \u05E9\u05D4\u05D7\u05D9\u05E4\u05D5\u05E9 \u05D9\u05DE\u05E6\u05D0 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05DE\u05E6\u05D0 \u05DB\u05DA \u05D9\u05DB\u05D5\u05DC \u05DC\u05E9\u05DE\u05E9 \u05D0\u05EA \u05D4\u05E1\u05D5\u05DB\u05DF \u2014 \u05D2\u05DD \u05DC\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E9\u05E2\u05D5\u05DC\u05D5\u05EA \u05DB\u05E1\u05E3 \u2014 \u05D1\u05DC\u05D9 \u05E9\u05D0\u05D9\u05E9\u05E8\u05EA \u05D0\u05D5\u05EA\u05D5.
41
- \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D7\u05E4\u05E9 \u05D1\u05EA\u05D5\u05DA \u05D4\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8, \u05D0\u05D5 nodata_run \u05E2\u05DD \u05D4\u05DE\u05E4\u05EA\u05D7\u05D5\u05EA \u05DE\u05D4\u05DB\u05E1\u05E4\u05EA (\u05DB\u05DC \u05E4\u05E7\u05D5\u05D3\u05D4 \u05DE\u05D0\u05D5\u05E9\u05E8\u05EA \u05DB\u05DE\u05D5 \u05E9\u05D4\u05D9\u05D0).`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this is ${d.why==="by_name"?"a search for a secret by name":"a search outside this project"}, over ${b}, where ${d.keyFiles} key file(s) (.env, logins) are. Whatever it finds enters the conversation, and a key found this way can be used by the agent \u2014 for paid calls too \u2014 without you approving it.
42
- Instead: search inside the project, or nodata_run with the keys from the vault (each command approved as written).`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:p,kind:"secret_search"}}if(u?.rule.effect==="allow")return{decision:"allow"};let f=wr(e,t,r);if(f.length===0)return{decision:"allow"};let h=f.map(b=>b.line),m=I(`NoData \u05E1\u05E8\u05E7 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D1\u05DE\u05D7\u05E9\u05D1 \u05E9\u05DC\u05DA \u2014 \u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05D9\u05E6\u05D0:
43
- ${h.join(`
32
+ `)}function co(e,t,r){let n=new RegExp(`<${t}\\b[^>]*\\b${r}="([^"]*)"`,"g"),i=[],o;for(;(o=n.exec(e))!==null;)o[1]&&i.push(z(o[1]));return i}function lo(e,t){let r=[];if(Be.has(e)){for(let n of t)(n==="content.xml"||n==="styles.xml"||n==="meta.xml")&&r.push(n);return r}e=to(e);for(let n of t)(n==="docProps/core.xml"||n==="docProps/app.xml")&&r.push(n);if(e===".xlsx"||e===".xlsm")for(let n of t)(n==="xl/sharedStrings.xml"||n==="xl/workbook.xml"||/^xl\/worksheets\/sheet\d+\.xml$/.test(n)||/^xl\/comments\d*\.xml$/.test(n))&&r.push(n);else if(e===".docx")for(let n of t)(n==="word/document.xml"||/^word\/(header|footer|footnotes|endnotes|comments)\d*\.xml$/.test(n))&&r.push(n);else if(e===".pptx")for(let n of t)/^ppt\/(slides|notesSlides)\/(slide|notesSlide)\d+\.xml$/.test(n)&&r.push(n);return r}function uo(e,t){let r=ae(e);if(!r||r.length===0)return null;let n=new Map(r.map(l=>[l.name,l])),i=lo(t,r.map(l=>l.name));if(i.length===0)return null;let o=[],s=[],a=0,c=!1;for(let l of i){if(a>=se){c=!0;break}let u=n.get(l);if(!u)continue;let d=oo(e,u);if(d===null)continue;let f=ao(d);if(l==="xl/workbook.xml"){let m=co(d,"sheet","name");m.length&&(f+=`
33
+ `+m.join(`
34
+ `))}a+f.length>se&&(f=f.slice(0,Math.max(0,se-a)),c=!0),f.trim().length!==0&&(o.push(f),s.push(l),a+=f.length)}return o.length===0?null:{text:o.join(`
35
+ `),truncated:c,parts:s}}function Hn(e,t,r={}){if(ke(e)){let n=$t(e,se);return"text"in n?{ok:!0,result:{text:n.text,truncated:n.truncated,parts:n.parts,attachments:n.attachments}}:{ok:!1,reason:n.reason}}if(Ue(e)){let n=It(e.toString("latin1"));if(!n.trim())return{ok:!1,reason:"no text inside (an empty file, or only pictures)"};let i=n.length>se;return{ok:!0,result:{text:i?n.slice(0,se):n,truncated:i,parts:["rtf"]}}}if(Tt.has(t)||Be.has(t)){let n=uo(e,t);return n?{ok:!0,result:n}:{ok:!1,reason:"damaged, or not really an Office file"}}if(Ce.has(t)){let n=je(e,r);return n?{ok:!0,result:{text:n.text,truncated:n.truncated,parts:[`pdf:${n.engine}`],engine:n.engine,uncertain:n.uncertain}}:{ok:!1,reason:Rn(e)}}return Rt.has(t)?{ok:!1,reason:"not a Word, Excel, PowerPoint or Outlook file inside, despite its name"}:{ok:!1,reason:"unsupported format"}}function Ct(e,t,r={}){let n=Hn(e,t,r);return n.ok?n.result:null}var Pt=new Set([...Tt,...Be,...Rt,...Mn,...Ce]);var Uc=5*6e4,Bc=2*6e4;import{deflateRawSync as yo}from"node:zlib";var Un={israeli_id:"[ID]",credit_card:"[CARD]",iban:"[IBAN]",israeli_phone:"[PHONE]",email:"[EMAIL]"},fo=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,po=[...bt].sort((e,t)=>+(t.subkind==="iban")-+(e.subkind==="iban"));function X(e,t,r=1){e[t]=(e[t]??0)+r}var Bn=null,J=e=>{let t=e.trim();Bn&&t&&Bn.add(t)};function F(e,t={},r){let n=e;for(let o of _e()){let s=new RegExp(o.pattern.source,o.pattern.flags.includes("g")?o.pattern.flags:o.pattern.flags+"g");n=n.replace(s,a=>(X(t,"secret"),J(a),"[SECRET]"))}for(let o of po)o.pattern.lastIndex=0,n=n.replace(o.pattern,s=>o.validate(s)?(X(t,o.subkind),J(s),Un[o.subkind]??`[${o.subkind.toUpperCase()}]`):s);n=n.replace(fo,o=>(X(t,"email"),J(o),Un.email));let i=r??new Set;for(let o of Ie()){let s=o.find(n).sort((a,c)=>c.start-a.start);for(let a of s){let c=n.slice(a.start,a.end);J(c),o.kind==="name"&&i.add(c.trim()),n=n.slice(0,a.start)+`[${o.kind.toUpperCase()}]`+n.slice(a.end),X(t,o.kind)}}return i.size&&(n=mo(n,i,t)),{text:n,counts:t,columnsHidden:[]}}var ho=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function mo(e,t,r){let n=new Set;for(let o of t){n.add(o);let s=o.split(/\s+/)[0]??"";s.length>=3&&s!==o&&n.add(s)}let i=e;for(let o of[...n].sort((s,a)=>a.length-s.length)){let s=new RegExp(`(?<![\\p{L}\\p{N}@.\\[-])${ho(o)}(?![\\p{L}\\p{N}@\\]-])`,"gu");i=i.replace(s,a=>(X(r,"name"),J(a),"[NAME]"))}return i}function le(e,t,r={}){let n=e;for(let[i,o]of[...t].sort((s,a)=>a[0].length-s[0].length))n.includes(i)&&(n=n.split(i).join(`[${o.toUpperCase()}]`),X(r,o),J(i));return n}function Lt(){let e=new Map,t={};return(r,n)=>{J(n);let i=`${r}\0${n.trim()}`,o=e.get(i);return o===void 0&&(o=t[r]=(t[r]??0)+1,e.set(i,o)),`[${r.toUpperCase()}-${o}]`}}function ze(e){let t=e.trim();return/^\[[A-Z_]+(?:-\d+)?\]$/.test(t)||/^[\d]{0,4}[*•xX]{3,}[\d]{0,4}$/.test(t)}var Wn=/^\s*-?\d+(?:\.\d+)?\s*$/;function Ot(e){let t=new Set;for(let[r,n]of e){let i=n.filter(s=>Wn.test(s));if(i.length<3)continue;i.filter(s=>F(s).text!==s).length/i.length<.5&&t.add(r)}return t}function zn(e,t){return e.includes(t)||e.includes('"')||e.includes(`
36
+ `)?`"${e.replace(/"/g,'""')}"`:e}function go(e){let t=(e.match(/\t/g)??[]).length,r=(e.match(/;/g)??[]).length,n=(e.match(/,/g)??[]).length;return t>n&&t>=r?" ":r>n?";":","}function Dt(e,t){let r=e.split(/\r?\n/),n=t??go(r[0]??""),i=Re(r[0]??"",n),o=i.map(m=>xe(m)),s={},a=Lt(),c=r.slice(1).map(m=>m===""?null:Re(m,n)),l=new Map;for(let m of c)m?.forEach((h,g)=>l.set(g,[...l.get(g)??[],h]));let u=Ot(l),d=be();if(d){let m=c.filter(h=>h!==null).slice(0,200);for(let h of d({name:"table",headers:i,rows:m})){let g=i.indexOf(h.column);g>=0&&!(h.how==="header"&&u.has(g))&&(o[g]={type:h.type,label:h.category})}}let f=[i.map(m=>zn(m,n)).join(n)];for(let m of c){if(m===null){f.push("");continue}let h=m.map((g,x)=>{let p=o[x];return p&&g.trim()!==""&&!ze(g)?(X(s,`column:${p.type}`),a(p.type,g)):u.has(x)&&Wn.test(g)?g:F(g,s).text});f.push(h.map(g=>zn(g,n)).join(n))}return{text:f.join(`
37
+ `),counts:s,columnsHidden:i.filter((m,h)=>o[h])}}var bo=/^xl\/(pivotCache|charts|externalLinks)\//,Kn=10;function Vn(e,t,r=1){e[t]=(e[t]??0)+r}function Zn(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Xn(e){let t=e.replace(/<rPh\b[\s\S]*?<\/rPh>/g,""),r="";for(let n of t.matchAll(/<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g))r+=n[1];return z(r)}function _o(e){return e?[...e.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(t=>Xn(t[1]??"")):[]}var Jn=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function We(e,t){let r=new RegExp(`\\b${t}="([^"]*)"`).exec(e);return r?r[1]:null}function de(e,t){if(e.type==="s"){let n=/<v>([^<]*)<\/v>/.exec(e.inner);return n?t[Number(n[1])]??null:null}if(e.type==="inlineStr"){let n=/<is>([\s\S]*?)<\/is>/.exec(e.inner);return n?Xn(n[1]):null}if(e.type==="b"||e.type==="e")return null;let r=/<v>([^<]*)<\/v>/.exec(e.inner);return r?z(r[1]):null}function xo(e){let t=[];for(let r of e.matchAll(Jn)){let n=We(r[1],"r"),i=n?/^([A-Z]+)(\d+)$/.exec(n):null;if(!i)return null;t.push({full:r[0],attrs:r[1],inner:r[2]??"",col:i[1],row:Number(i[2]),type:We(r[1],"t")??"n"})}return t}function ko(e,t){let r=[...new Set(e.map(n=>n.row))].sort((n,i)=>n-i).slice(0,Kn);for(let n of r){let i=new Map;for(let o of e.filter(s=>s.row===n)){let s=de(o,t),a=s?xe(s):null;a&&i.set(o.col,{type:a.type,header:s.trim()})}if(i.size>0)return{row:n,cols:i}}return{row:-1,cols:new Map}}var wo=/^xl\/worksheets\/sheet\d+\.xml$/,vo=200;function So(e){let t=e.trim();return/^[\d.,\-+/:%$₪€\s]+$/.test(t)||t.length>60}function Eo(e,t){let r=[...new Set(e.map(o=>o.row))].sort((o,s)=>o-s).slice(0,Kn),n=-1,i=-1/0;for(let o of r){let s=e.filter(l=>l.row===o).map(l=>(de(l,t)??"").trim()).filter(Boolean);if(s.length<2)continue;let a=s.filter(l=>!So(l)).length,c=a*2-(s.length-a);c>i&&(i=c,n=o)}return n}function Ao(e,t,r){let n=ko(t,r),i=be();if(!i)return n;let o=n.row>=0?n.row:Eo(t,r);if(o<0)return n;let s=t.filter(d=>d.row===o).map(d=>({col:d.col,text:(de(d,r)??"").trim()})).filter(d=>d.text),a=new Map(s.map((d,f)=>[d.col,f])),c=new Map;for(let d of t){if(d.row<=o)continue;let f=a.get(d.col);if(f!==void 0){if(!c.has(d.row)){if(c.size>=vo)continue;c.set(d.row,s.map(()=>""))}c.get(d.row)[f]=de(d,r)??""}}let l=new Map(o===n.row?n.cols:[]),u=s.map(d=>d.text);for(let d of i({name:e,headers:u,rows:[...c.values()]})){let f=u.indexOf(d.column);f<0||l.set(s[f].col,{type:d.type,header:d.column,category:d.category,severity:d.severity,how:d.how})}return{row:o,cols:l}}function Nt(e,t){return`<c${e.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${Zn(t)}</t></is></c>`}var $o=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let r=t;for(let n=0;n<8;n+=1)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r>>>0}return e})();function Io(e){let t=4294967295;for(let r=0;r<e.length;r+=1)t=$o[(t^e[r])&255]^t>>>8;return(t^4294967295)>>>0}var Gn=33;function Ft(e){let t=[],r=[],n=0;for(let s of e){let a=Buffer.from(s.name,"utf8"),c=s.name.endsWith("/"),l=c?Buffer.alloc(0):yo(s.data),u=c?0:8,d=c?0:Io(s.data),f=Buffer.alloc(30);f.writeUInt32LE(67324752,0),f.writeUInt16LE(20,4),f.writeUInt16LE(2048,6),f.writeUInt16LE(u,8),f.writeUInt16LE(Gn,12),f.writeUInt32LE(d,14),f.writeUInt32LE(l.length,18),f.writeUInt32LE(s.data.length,22),f.writeUInt16LE(a.length,26),t.push(f,a,l);let m=Buffer.alloc(46);m.writeUInt32LE(33639248,0),m.writeUInt16LE(20,4),m.writeUInt16LE(20,6),m.writeUInt16LE(2048,8),m.writeUInt16LE(u,10),m.writeUInt16LE(Gn,14),m.writeUInt32LE(d,16),m.writeUInt32LE(l.length,20),m.writeUInt32LE(s.data.length,24),m.writeUInt16LE(a.length,28),m.writeUInt32LE(n,42),r.push(m,a),n+=f.length+a.length+l.length}let i=Buffer.concat(r),o=Buffer.alloc(22);return o.writeUInt32LE(101010256,0),o.writeUInt16LE(e.length,8),o.writeUInt16LE(e.length,10),o.writeUInt32LE(i.length,12),o.writeUInt32LE(n,16),Buffer.concat([...t,i,o])}function jt(e,t){let r=ae(e);if(!r||r.length===0||r.some(p=>bo.test(p.name)))return null;let n=new Map;for(let p of r){if(p.name.endsWith("/")){n.set(p.name,Buffer.alloc(0));continue}let b=ce(e,p);if(!b)return null;n.set(p.name,b)}let i=[...n.keys()].filter(p=>wo.test(p));if(i.length===0)return null;let o=n.get("xl/sharedStrings.xml")?.toString("utf8")??null,s=_o(o),a=new Set,c={},l=new Set,u=Lt(),d=mt();for(let p of i){let b=n.get(p).toString("utf8"),k=xo(b);if(!k)return null;let w=Ao(p.replace(/^xl\/worksheets\//,"").replace(/\.xml$/,""),k,s),R=w.row,j=new Map;for(let T of k){if(T.type!=="n"||T.row<=R)continue;let P=de(T,s);P!==null&&j.set(T.col,[...j.get(T.col)??[],P])}let C=Ot(j),N=new Map;for(let[T,{type:P,header:G,how:ne}]of w.cols)ne==="header"&&C.has(T)||(N.set(T,P),l.add(G));let H=b.replace(Jn,(T,P,G)=>{let ne=We(P,"r"),[,B,y]=/^([A-Z]+)(\d+)$/.exec(ne),_={full:T,attrs:P,inner:G??"",col:B,row:Number(y),type:We(P,"t")??"n"},S=de(_,s),A=()=>{if(_.type==="s"){let fn=/<v>([^<]*)<\/v>/.exec(_.inner);fn&&a.add(Number(fn[1]))}return T};if(S===null||S.trim()==="")return A();if(d&&_.type==="n"&&C.has(B)&&_.row>R)return Vn(c,"amount"),Nt(P,"[AMOUNT]");let v=N.get(B);if(v&&_.row>R&&!ze(S))return Vn(c,`column:${v}`),Nt(P,u(v,S));if(_.type==="n"&&C.has(B))return A();let K=F(S,c),ye=t?.size?le(K.text,t,c):K.text;return ye===S?A():Nt(P,ye)});n.set(p,Buffer.from(H,"utf8"))}if(o){let p=-1,b=o.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,k=>(p+=1,a.has(p)?k:"<si><t>[HIDDEN]</t></si>"));n.set("xl/sharedStrings.xml",Buffer.from(b,"utf8"))}for(let p of[...n.keys()].filter(b=>/^xl\/comments\d*\.xml$/.test(b))){let k=n.get(p).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,(w,R,j,C)=>{let N=F(z(j),c);return`${R}${Zn(t?.size?le(N.text,t,c):N.text)}${C}`});n.set(p,Buffer.from(k,"utf8"))}let f=n.get("docProps/core.xml");if(f){let p=f.toString("utf8").replace(/(<dc:creator>)[\s\S]*?(<\/dc:creator>)/,"$1$2").replace(/(<cp:lastModifiedBy>)[\s\S]*?(<\/cp:lastModifiedBy>)/,"$1$2");n.set("docProps/core.xml",Buffer.from(p,"utf8"))}let m=n.get("xl/workbook.xml");if(m){let p=m.toString("utf8").replace(/<(\w+:)?absPath\b[^>]*\/>|<(\w+:)?absPath\b[^>]*>[\s\S]*?<\/(\w+:)?absPath>/g,"");n.set("xl/workbook.xml",Buffer.from(p,"utf8"))}let h=n.get("docProps/app.xml");if(h){let p=h.toString("utf8").replace(/(<Company>)[\s\S]*?(<\/Company>)/,"$1$2").replace(/(<Manager>)[\s\S]*?(<\/Manager>)/,"$1$2");n.set("docProps/app.xml",Buffer.from(p,"utf8"))}let g=n.has("xl/calcChain.xml"),x=r.map(p=>p.name).filter(p=>!(g&&p==="xl/calcChain.xml"));if(g)for(let p of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let b=n.get(p);b&&n.set(p,Buffer.from(b.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:Ft(x.map(p=>({name:p,data:n.get(p)}))),counts:c,columnsHidden:[...l]}}var ue=/(^|\/)(\.env(\.[\w.-]+)?|[\w.-]+\.env(\.[\w.-]+)?)$/i,To=/(SECRET|PASSWORD|PASSWD|PASS|PWD|TOKEN|PRIVATE|CREDENTIAL|API_?KEY|_KEY|KEY_ID|DSN|DATABASE_URL|_URI|POOLER_URL|SALT|PEPPER)$/i,Ro=/(^NEXT_PUBLIC_|^VITE_|^EXPO_PUBLIC_|ANON_KEY$|PUBLISHABLE_KEY$|PUBLIC_KEY$)/i;function Mt(e){let t=0;for(let r of e.split(/\r?\n/)){let n=/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(r);if(!n||!To.test(n[1])||Ro.test(n[1]))continue;let i=n[2].trim().replace(/^(['"])(.*)\1$/,"$2");i.length>=8&&!/^\$\{?[A-Z_]+\}?$/.test(i)&&t++}return t}var Il=64*1024*1024,Tl=4*1024*1024;var Rl=512*1024*1024,Cl=1024*1024*1024;var Pl=256*1024*1024;var Ll=new Yn("utf-8",{fatal:!0}),Ol=new Yn("windows-1255");var Dl=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()));var Kl=Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=","base64");var Bo=["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."],E=(e,t,r)=>({provider:e,url:t,steps:[...r,...Bo]}),zo={"aws-access-key":E("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":E("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":E("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":E("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":E("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":E("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":E("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":E("GitLab","https://gitlab.com/-/user_settings/personal_access_tokens",["Open Access tokens.","Create a new token with only the scopes you need."]),"stripe-secret":E("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":E("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":E("Slack","https://api.slack.com/apps",["Open your app \u2192 OAuth & Permissions.","Rotate / reinstall to get a new token."]),"slack-webhook":E("Slack","https://api.slack.com/apps",["Open your app \u2192 Incoming Webhooks.","Add a new webhook URL for the channel."]),"twilio-api-key":E("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":E("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":E("OpenAI","https://platform.openai.com/api-keys",["Open API keys.","Create a new secret key."]),"openai-project-key":E("OpenAI","https://platform.openai.com/api-keys",["Open API keys (per project).","Create a new secret key for the same project."]),"anthropic-key":E("Anthropic","https://console.anthropic.com/settings/keys",["Open Settings \u2192 API keys.","Create a new key."]),"supabase-key":E("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":E("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":E("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":E("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":E("MongoDB","https://cloud.mongodb.com/",["Open Atlas \u2192 Database Access \u2192 the user \u2192 Edit \u2192 Edit password.","Update the connection string."]),"redis-uri":E("Redis","",["Reset the password in your Redis host's console (or CONFIG SET requirepass on your own server).","Update the connection string."]),"private-key":E("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":E("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":E("A password in code","",["Change the password in the system it belongs to."]),"bearer-token":E("An access token","",["Revoke the token in the service that issued it and issue a new one."])},Wo=E("A credential","",["Find the service it belongs to and issue a new credential there."]);function Ht(e){return zo[e]??Wo}function nr(e){return/\.ndc$/i.test(e)||/\.clean\.[A-Za-z0-9]+$/.test(e)||Vo(e)}function Vo(e){return/(^|[\\/])\.nodata[\\/]/.test(e)}import{existsSync as Go,mkdirSync as Qd,readFileSync as Ko,statSync as Ut,writeFileSync as eu}from"node:fs";import{homedir as Zo}from"node:os";import{join as Xo}from"node:path";var Jo=()=>Xo(Zo(),".nodata","flagged.json");var rr="unread";function ir(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t}var Se=null;function or(){let e=Jo();try{if(!Go(e))return{};let t=Ut(e).mtimeMs;if(Se&&Se.path===e&&Se.mtimeMs===t)return Se.store;let r=JSON.parse(Ko(e,"utf8"));return Se={path:e,mtimeMs:t,store:r},r}catch{return{}}}function Ve(e){let t=or()[ir(e)];if(!t)return null;try{if(Ut(e).mtimeMs>t.mtimeMs+1e3)return null}catch{return null}let r=Object.fromEntries(Object.entries(t.kinds).filter(([n])=>n!==rr));return Object.keys(r).length?r:null}function Ge(e){let t=or()[ir(e)];if(!t||!t.kinds[rr])return null;try{return{changed:Ut(e).mtimeMs>t.mtimeMs+1e3}}catch{return null}}import{existsSync as sr,mkdirSync as ou,readFileSync as ar,writeFileSync as su}from"node:fs";import{homedir as qo}from"node:os";import{join as Yo}from"node:path";var Ke=()=>Yo(qo(),".nodata","prefs.json");function Qo(){try{let e=sr(Ke())?JSON.parse(ar(Ke(),"utf8")).lang:null;return e==="he"||e==="en"?e:null}catch{return null}}function es(){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 fe(){return Qo()??es()}function cr(){try{return sr(Ke())&&JSON.parse(ar(Ke(),"utf8")).amounts_sensitive===!0}catch{return!1}}function I(e,t,r=fe()){return r==="he"?e:t}import{createHmac as ms,randomBytes as gs}from"node:crypto";import{existsSync as Vt,mkdirSync as ys,readdirSync as bs,readFileSync as Gt,writeFileSync as _s}from"node:fs";import{homedir as tt}from"node:os";import{basename as xs,extname as ks,isAbsolute as ws,join as nt,relative as vs,resolve as Ss}from"node:path";function q(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function ts(e,t,r){return t===null||r===null?!1:t<=r?e>=t&&e<=r:e>=t||e<=r}function lr(e,t,r){switch(t){case"eq":return e===r;case"ne":return e!==r;case"in":return Array.isArray(r)&&r.includes(e);case"not_in":return Array.isArray(r)&&!r.includes(e);case"prefix":return typeof e=="string"&&typeof r=="string"&&e.toLowerCase().startsWith(r.toLowerCase());case"gte":{let n=q(e),i=q(r);return n!==null&&i!==null&&n>=i}case"lte":{let n=q(e),i=q(r);return n!==null&&i!==null&&n<=i}case"between":{let n=q(e);return n!==null&&Array.isArray(r)&&r.length===2&&ts(n,q(r[0]),q(r[1]))}default:return!1}}function dr(e,t,r){switch(t){case"in":return Array.isArray(r)&&e.some(n=>r.includes(n));case"not_in":return Array.isArray(r)&&!e.some(n=>r.includes(n));default:return!1}}import{existsSync as Ze,mkdirSync as fu,readdirSync as ur,readFileSync as ns,rmSync as pu,writeFileSync as hu,chmodSync as mu}from"node:fs";import{homedir as fr}from"node:os";import{basename as bu,isAbsolute as rs,join as Y,relative as is,resolve as os}from"node:path";var qe=()=>Y(fr(),".nodata"),ss=()=>Y(qe(),"credentials.json"),Xe=()=>Y(qe(),"orgs"),as=()=>Y(qe(),"bindings.json"),cs=/^[A-Za-z0-9_.-]{1,80}$/,Bt=e=>cs.test(e)&&e!=="."&&e!=="..";function pr(e){try{return Ze(e)?JSON.parse(ns(e,"utf8")):null}catch{return null}}function ls(e){return e?e.device?.org_id?e.device.org_id:e.api_key?`key-${(e.key_prefix??e.api_key.slice(0,12)).replace(/[^A-Za-z0-9_-]/g,"")}`:null:null}function hr(){return ls(pr(ss()))}function zt(){let e=[],t=hr();t&&e.push(t);try{for(let r of ur(Xe()))Bt(r)&&!e.includes(r)&&Ze(Y(Xe(),r,"credentials.json"))&&e.push(r)}catch{}return e}var ds=e=>process.platform==="win32"||process.platform==="darwin"?e.toLowerCase():e,Je=e=>ds(os(e.replace(/^~(?=[\\/]|$)/,fr())));function us(e,t){let r=is(Je(e),Je(t));return r===""||!r.startsWith("..")&&!rs(r)}function W(){let e=pr(as());return(Array.isArray(e?.bindings)?e.bindings:[]).filter(r=>!!r&&typeof r.folder=="string"&&typeof r.org_id=="string"&&Bt(r.org_id)).map(r=>r.project===void 0||hs(r.project)===r.project?r:{...r,project:void 0}).map(r=>r.client===void 0||typeof r.client?.org_id=="string"&&fs.test(r.client.org_id)?r:{...r,client:void 0})}var fs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function mr(e,t=W()){let r=null;for(let n of t)us(n.folder,e)&&(!r||Je(n.folder).length>Je(r.folder).length)&&(r=n);return r}function ps(e,t=zt(),r=W()){if(t.length===0)return{kind:"none"};let n=mr(e,r.filter(i=>t.includes(i.org_id)));return n?{kind:"bound",org_id:n.org_id,folder:n.folder}:t.length===1?{kind:"only",org_id:t[0]}:{kind:"unbound",orgs:t}}function gr(e){let t=ps(e);return t.kind==="bound"||t.kind==="only"?t.org_id:null}function hs(e){if(typeof e!="string")return null;let t=e.trim();return t&&t.length<=120&&!/[\u0000-\u001f\\/]/.test(t)?t:null}function yr(){let e=[],t=Y(qe(),"org-mandate.json");Ze(t)&&e.push({owner:hr(),file:t});try{for(let r of ur(Xe())){let n=Y(Xe(),r,"org-mandate.json");Bt(r)&&Ze(n)&&e.push({owner:r,file:n})}}catch{}return e}function Ye(e,t,r=W()){if(!e)return!0;let n=mr(t,r);return!n||n.org_id===e}var br=()=>nt(tt(),".nodata","rules.json"),Qe=()=>nt(tt(),".nodata","rules-key"),Q={allow:0,ask:1,clean_copy:2,deny:3},Es=["claude-code","cursor","windsurf","codex","gemini","vscode","claude-desktop"],Wt=e=>typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,As={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=>ks(e.path).toLowerCase()||void 0},"file.name":{cardinality:"scalar",ops:["eq","in","prefix"],label:"file name",extract:e=>xs(e.path).toLowerCase()},agent:{cardinality:"scalar",ops:["eq","ne","in","not_in"],agentScope:!0,label:`which agent (${Es.join(", ")} \u2026)`,extract:e=>Wt(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=>Wt(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=>Wt(e.who?.org)}};function $s(){try{if(Vt(Qe())){let t=Gt(Qe(),"utf8").trim();if(/^[0-9a-f]{64}$/.test(t))return Buffer.from(t,"hex")}}catch{}let e=gs(32);return ys(nt(tt(),".nodata"),{recursive:!0}),_s(Qe(),e.toString("hex")+`
38
+ `,{mode:384}),e}var Is=(e,t)=>ms("sha256",t).update(JSON.stringify(e)).digest("hex");function Kt(){if(!Vt(br()))return{rules:[],tampered:!1};try{let e=JSON.parse(Gt(br(),"utf8")),t=Array.isArray(e.rules)?e.rules:[],r=Vt(Qe())&&typeof e.mac=="string"&&e.mac===Is(t,$s());return{rules:t,tampered:!r}}catch{return{rules:[],tampered:!0}}}var Ee=e=>{let t=Ss(e.replace(/^~(?=[\\/]|$)/,tt())).replace(/\\/g,"/");return process.platform==="win32"?t.toLowerCase():t};function ee(e,t){if(_r(e)||_r(t))return!1;if(e.startsWith("**/")){let n=e.slice(3).replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),i=Ee(t).toLowerCase();return i.endsWith("/"+n)||i.includes("/"+n+"/")}let r=vs(Ee(e),Ee(t));return r===""||!r.startsWith("..")&&!ws(r)}var Ts="site:",_r=e=>e.startsWith(Ts);function Zt(e){try{let t=new URL(e.trim());return(t.protocol==="http:"||t.protocol==="https:")&&t.hostname.toLowerCase().replace(/\.$/,"")||null}catch{return null}}function Xt(e,t){return e==="*"?!0:t===e||t.endsWith("."+e)}function et(e,t,r){let n=As[e.field];if(!n)return!1;let i=n.extract(t);return n.agentScope&&i===void 0?r!=="allow":e.op==="exists"?i!==void 0&&i!=="":i===void 0?!1:n.cardinality==="set"?dr(Array.isArray(i)?i:[],e.op,e.value):lr(i,e.op,e.value)}function rt(e,t){let r=e.map((n,i)=>({rule:n,n:i+1})).filter(n=>ee(n.rule.path,t.path)).sort((n,i)=>Ee(i.rule.path).length-Ee(n.rule.path).length||n.n-i.n);for(let n of r)if((n.rule.when??[]).every(i=>et(i,t,n.rule.effect)))return{...n,touched:t.path};return null}function it(e,t,r,n,i){let o=null;for(let[s,a]of e.entries())ee(a.path,t)||(a.path.startsWith("**/")?!Rs(t,a.path):!ee(t,a.path))||(a.when??[]).every(c=>et(c,{action:r,path:a.path,now:n,who:i},a.effect))&&(!o||Q[a.effect]>Q[o.rule.effect])&&(o={rule:a,n:s+1,touched:a.path});return o}function Jt(e,t){let r=o=>o==="*"?0:o.length,n=t.site,i=e.map((o,s)=>({rule:o,n:s+1})).filter(o=>o.rule.site&&(n===void 0||Xt(o.rule.site,n))).sort((o,s)=>r(s.rule.site)-r(o.rule.site)||o.n-s.n);if(n===void 0){let o=null;for(let s of i)s.rule.effect==="allow"||!(s.rule.when??[]).every(a=>et(a,t,s.rule.effect))||(!o||Q[s.rule.effect]>Q[o.rule.effect])&&(o=s);return o?{...o,touched:""}:null}for(let o of i)if((o.rule.when??[]).every(s=>et(s,t,o.rule.effect)))return{...o,touched:n};return null}function Rs(e,t){let r=0,n=(i,o)=>{if(o>5||r>4e3)return!1;let s;try{s=bs(i,{withFileTypes:!0})}catch{return!1}for(let a of s){if(++r>4e3||!a.isDirectory()||a.name==="node_modules"||a.name===".git")continue;let c=nt(i,a.name);if(ee(t,c)||n(c,o+1))return!0}return!1};return n(e,0)}var Cs={allow:["allowed","\u05DE\u05D5\u05EA\u05E8"],ask:["ask the person","\u05DC\u05E9\u05D0\u05D5\u05DC \u05D0\u05D5\u05EA\u05DA"],clean_copy:["clean copy only","\u05E8\u05E7 \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9"],deny:["not allowed","\u05D0\u05E1\u05D5\u05E8"]};function xr(e,t=!1){return e.site?e.site==="*"?t?"\u05DB\u05DC \u05D0\u05EA\u05E8":"every site":`${t?"\u05D0\u05EA\u05E8":"site"} ${e.site}`:e.path}var kr=(e,t=!1)=>Cs[e][t?1:0];function qt(){let e=[];for(let{owner:t,file:r}of yr())try{let n=JSON.parse(Gt(r,"utf8"));Array.isArray(n?.folder_rules)&&n.folder_rules.length&&e.push({owner:t,rules:n.folder_rules})}catch{}return e}function wr(){let e=zt();return e.length<2?[]:W().filter(t=>e.includes(t.org_id)).map(t=>({path:t.folder,effect:"deny",when:[{field:"org",op:"ne",value:t.org_id.toLowerCase()}],note:`works for organisation ${t.org_id}; another organisation's agent does not touch it`}))}import{createHash as Ps}from"node:crypto";import{existsSync as Ls,mkdirSync as Os,readFileSync as Sr,writeFileSync as Ds}from"node:fs";import{homedir as Qt}from"node:os";import{join as en}from"node:path";var Er=()=>en(Qt(),".nodata","checkpoints.json"),vr=()=>en(Qt(),".nodata","connection.json"),Ns=900*1e3,Fs=300*1e3,js=100;function Yt(e){return Array.isArray(e)?e.map(Yt):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,Yt(e[t])])):e}function Ar(e,t,r,n){return Ps("sha256").update(JSON.stringify([e,t,r,Yt(n)])).digest("hex").slice(0,12)}var Ms=/^(element|selector|ref|uid|target|name|label|button|key|role|title|description|link|url|href|uri|startUrl|start_url|page_url)$/i;function $r(e){let t=[];for(let[r,n]of Object.entries(e)){if(!Ms.test(r)||typeof n!="string"&&typeof n!="number")continue;let i=String(n);if(/^https?:\/\//i.test(i))try{let o=new URL(i);i=`${o.origin}${o.pathname}`}catch{continue}if(t.push(`${r}: ${i.replace(/[\r\n]+/g," ").slice(0,120)}`),t.length>=4)break}return t.join(" \xB7 ").slice(0,300)}function Ir(){try{let e=JSON.parse(Sr(Er(),"utf8")),t=Date.now(),r={};for(let[n,i]of Object.entries(e??{})){if(!i||typeof i.at!="number")continue;(i.passed_at?t-i.passed_at<Fs:t-i.at<Ns)&&(r[n]=i)}return r}catch{return{}}}function Tr(e){let t=Object.entries(e).sort((r,n)=>n[1].at-r[1].at).slice(0,js);Os(en(Qt(),".nodata"),{recursive:!0}),Ds(Er(),JSON.stringify(Object.fromEntries(t))+`
39
+ `,{mode:384})}function Rr(e){try{let t=Ir(),r=t[e.id];t[e.id]={...r,...e,at:r&&!r.passed_at?r.at:Date.now()},Tr(t)}catch{}}function Cr(e){try{let t=Ir();return t[e]?.passed_at?(delete t[e],Tr(t),!0):!1}catch{return!1}}function Pr(){try{if(!Ls(vr()))return!1;let e=JSON.parse(Sr(vr(),"utf8")).state;return e==="connected"||e==="reconnecting"||e==="restart"}catch{return!1}}var Ws=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".eml",...Pt]),Vs=50*1024*1024,Lr=8,Gs={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function an(e){let t=sn(e).toLowerCase();return Ws.has(Hr(t))||ue.test(t)}var Ks=/^(reports|receipts)(\/|$)|^(prefs|consent|flagged|statusline-prev|key-backup|connection)\.json$|^(gate|status)\.mjs$|^(gate|answers)\.log$/i,Zs=/\.nodata[\\/]+(device-key\.json|secrets\.json|credentials\.json|issuer-ed25519\.json|capsule\.json|capsule-key|shares|approvals|fabric-key\.json|machine-salt|pending-link\.json|api-shares\.json|secret-shares\.json|quarantine|bindings\.json|orgs)\b/i;function pe(e){let t=he(V(),".nodata").replace(/\\/g,"/").toLowerCase();if(!e.replace(/\\/g,"/").toLowerCase().startsWith(t+"/"))return!1;let n=e.replace(/\\/g,"/").slice(t.length+1);return n!==""&&!Ks.test(n)}function Xs(e){return Zs.test(e)}var te=e=>e.startsWith("mcp__"),cn=e=>/^mcp__.+__nodata_[a-z0-9_]+$/i.test(e),Js=/(path|file|dir|folder|root|uri|target|source|destination|cwd)/i,qs=/(write|edit|create|save|update|delete|remove|move|rename|append|put|upload|patch|insert|mkdir)/i,Ys=/(search|grep|find|glob|list|tree|director|query)/i,Or=16;function at(e){let t=e.split("__").slice(2).join("__");return qs.test(t)?"write":Ys.test(t)?"search":"read"}function $e(e,t){let r=[],n=(o,s)=>{let a=o.trim();if(/^file:\/\//i.test(a))try{a=decodeURIComponent(new URL(a).pathname).replace(/^\/([a-zA-Z]:)/,"$1")}catch{return}else if(!(s||/^(~[\\/]|\/|[a-zA-Z]:[\\/])/.test(a)))return;if(!a||a.length>1024||/[\n\r]/.test(a)||/^[a-z][a-z0-9+.-]*:\/\//i.test(a))return;let c=O(t,a.replace(/^~(?=[\\/]|$)/,V()));!r.includes(c)&&r.length<Or&&r.push(c)},i=(o,s,a)=>{if(!(a>3||r.length>=Or)){if(typeof o=="string")n(o,Js.test(s));else if(Array.isArray(o))for(let c of o.slice(0,50))i(c,s,a+1);else if(o&&typeof o=="object")for(let[c,l]of Object.entries(o))i(l,c,a+1)}};return i(e,"",0),r}var tn=/(\.claude[\\/]+settings(\.local)?\.json|node_modules[\\/]+@nodatachat[\\/])/i,Qs=/(>|\bsed\s+-i|\btee\b|\b(rm|del|erase|mv|move|cp|copy|ren|rename)\b|Set-Content|Add-Content|Out-File|Remove-Item|Move-Item|Copy-Item|Rename-Item|WriteAllText|writeFileSync|unlinkSync)/i;function ea(e,t,r){if(e==="Bash"||e==="PowerShell"){let i=typeof t.command=="string"?t.command:"";return tn.test(i)&&Qs.test(i)}if(te(e))return at(e)==="write"&&$e(t,r).some(i=>tn.test(i.replace(/\\/g,"/")));let n=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return n?tn.test((me(n)?n:O(r,n)).replace(/\\/g,"/")):!1}function ta(e){return an(e)||Ve(e)!==null||Ge(e)!==null}var ot=class extends Error{};function na(e){let t=Hr(e).toLowerCase(),r=Mr(e),n,i;if(t===".csv"||t===".tsv")i=r.toString("utf8"),n=Dt(i,t===".tsv"?" ":void 0).counts;else if(Pt.has(t)){let s=t===".xlsx"||t===".xlsm"?jt(r):null,a=Ct(r,t);if(!a&&!s)throw new ot;i=a?.text??"",n=s?s.counts:F(i).counts}else i=r.toString("utf8"),n=F(i).counts;let o=Te.filter(s=>s.pattern.test(i)).length;return ue.test(sn(e).toLowerCase())&&(o=Math.max(o,Mt(i))),o&&(n.secret=Math.max(n.secret??0,o)),n}var ra={israeli_id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",credit_card:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9",iban:"IBAN",israeli_phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",phone:"\u05D8\u05DC\u05E4\u05D5\u05DF",email:'\u05D3\u05D5\u05D0"\u05DC',secret:"\u05E1\u05D5\u05D3",name:"\u05E9\u05DD",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",financial:"\u05DE\u05D9\u05D3\u05E2 \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",bank_account:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7",plate:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"};function Ur(e){let t=fe()==="he",r=n=>(t?ra[n]:Gs[n])??n;return Object.entries(e).sort((n,i)=>i[1]-n[1]).map(([n,i])=>`${i} ${n.startsWith("column:")?`${r(n.slice(7))} (${t?"\u05E2\u05DE\u05D5\u05D3\u05D4":"column"})`:r(n)}`).join(", ")}function ia(e){return Ur(e)}function Br(e,t,r){let n=o=>me(o)?o:O(r,o),i=o=>{try{return on(o).isFile()}catch{return!1}};if(e==="Read"&&typeof t.file_path=="string")return[n(t.file_path)];if(e==="Grep"&&typeof t.path=="string"&&i(n(t.path)))return[n(t.path)];if(te(e))return at(e)==="write"?[]:$e(t,r).filter(i).slice(0,Lr);if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let o=t.command,s=[...[...o.matchAll(/"([^"]*)"/g)].map(c=>c[1]),...[...o.matchAll(/'([^']*)'/g)].map(c=>c[1]),...o.split(/[\s|;&<>(),=`]+/)],a=[];for(let c of s){let l=c.trim().replace(/^['"]|['"]$/g,"").replace(/\\\\/g,"\\").replace(/^~(?=[\\/])/,V()).replace(/^\/([a-zA-Z])\//,(d,f)=>process.platform==="win32"?`${f}:/`:d);if(!l)continue;let u=n(l);if(!(!an(l)&&!pe(u)&&Ve(u)===null&&Ge(u)===null)&&(i(u)&&!a.includes(u)&&a.push(u),a.length>=Lr))break}return a}return[]}function M(e){return e.replace(/\\+/g,"/")}function oa(e){let t=e.trim();return/[;|&\n]|`|\$\(/.test(t.replace(/^cmd(?:\.exe)?\s+\/c\s+/i,""))?!1:/^(?:cmd(?:\.exe)?\s+\/c\s+)?(?:explorer(?:\.exe)?|start|invoke-item|ii|start-process|open|xdg-open)\b/i.test(t)}function Dr(e,t){return`${M(e)}: ${t?I("\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05DC\u05D0 \u05D4\u05E6\u05DC\u05D9\u05D7\u05D4 \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05D5\u05EA\u05D5, \u05D5\u05D4\u05D5\u05D0 \u05D4\u05E9\u05EA\u05E0\u05D4 \u05DE\u05D0\u05D6 \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","your last scan could not read it, and it changed since \u2014 NOT checked, treat it as sensitive"):I("\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05DC\u05D0 \u05D4\u05E6\u05DC\u05D9\u05D7\u05D4 \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","your last scan could not read it \u2014 NOT checked, treat it as sensitive")}`}function zr(e,t,r){let n=[];if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"&&oa(t.command))return n;for(let i of Br(e,t,r)){if(!ta(i)||nr(i)||!Fr(i))continue;let o=Ge(i);if(!an(i)){let s=Ve(i);s?n.push({line:`${M(i)}: ${I("\u05E7\u05D5\u05D3 \u05E9\u05D4\u05E1\u05E8\u05D9\u05E7\u05D4 \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D4 \u05E1\u05D9\u05DE\u05E0\u05D4","code your last scan flagged")} \u2014 ${ia(s)}`,kind:"flagged_code"}):o&&n.push({line:Dr(i,o.changed),kind:"unread"});continue}try{if(on(i).size>Vs)n.push({line:`${M(i)}: too large to check here (over 50 MB)`,kind:"too_large"});else{let s=na(i);Object.keys(s).length?n.push({line:`${M(i)}: ${Ur(s)}`,kind:"data_file"}):o&&!o.changed&&n.push({line:Dr(i,!1),kind:"unread"})}}catch(s){n.push(s instanceof ot?{line:`${M(i)}: ${I("\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05DC\u05E7\u05E8\u05D5\u05D0 \u05D0\u05EA \u05D4\u05D8\u05E7\u05E1\u05D8 (\u05E1\u05E8\u05D9\u05E7\u05D4, \u05D4\u05E6\u05E4\u05E0\u05D4 \u05D0\u05D5 \u05D2\u05D5\u05E4\u05DF \u05DC\u05D0 \u05E0\u05EA\u05DE\u05DA) \u2014 \u05DC\u05D0 \u05E0\u05D1\u05D3\u05E7, \u05D4\u05EA\u05D9\u05D9\u05D7\u05E1 \u05D0\u05DC\u05D9\u05D5 \u05DB\u05E8\u05D2\u05D9\u05E9","its text could not be read (a scan, encryption or an unsupported font) \u2014 NOT checked, treat it as sensitive")}`,kind:"unreadable"}:{line:`${M(i)}: could not be checked`,kind:"unreadable"})}}return n}var rn=/(?:\.aws[\\/]+credentials|\.npmrc|\.yarnrc\.yml|\.pypirc|[._]netrc|\.git-credentials|\.pgpass|\.docker[\\/]+config\.json|\.kube[\\/]+config|gh[\\/]+hosts\.yml|\.supabase[\\/]+access-token|application_default_credentials\.json|gcloud[\\/]+(?:credentials|access_tokens)\.db|\.azure[\\/]+(?:msal_token_cache|accessTokens)|com\.vercel\.cli[\\/]+auth\.json|\.ssh[\\/]+id_(?:rsa|ed25519|ecdsa|dsa)(?![\w.]))/i,st=/(?:TOKEN|SECRET|PASSW(?:OR)?D|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY|CREDENTIAL|SERVICE_ROLE|_KEY$)/i,Wr="the vault's secrets, outside nodata_run's per-command approval",sa=/(?:^|[^\w.@-])(?:npx|pnpx|bunx|npm|pnpm|yarn|bun|node|nodejs|deno|nodata-mcp)(?:\.cmd|\.exe|\.ps1|\.js)?(?![\w-])[\s\S]*?(?<![\w-])secrets-(?:run|login|set|import|share)(?![\w-])/i;function aa(e){return sa.test(e)}var ca=[[/^(?:env|set|export\s+-p|declare\s+-x|get-childitem\s+env:\S*|gci\s+env:\S*|dir\s+env:\S*|ls\s+env:\S*)\s*$/i,"every environment variable"],[/^gh\s+auth\s+(?:token\b|status\b.*(?:\s-t\b|--show-token))/i,"the GitHub login token"],[/^gcloud\s+auth\s+(?:application-default\s+)?print-(?:access|identity)-token\b/i,"a Google Cloud access token"],[/^az\s+account\s+get-access-token\b/i,"an Azure access token"],[/^aws\s+(?:configure\s+(?:get\s+\S*(?:secret|token)\S*|export-credentials)|sts\s+get-session-token|ecr\s+get-login-password)\b/i,"AWS credentials"],[/^supabase\s+projects\s+api-keys\b/i,"the project's Supabase keys (incl. service_role)"],[/^heroku\s+auth:token\b/i,"the Heroku login token"],[/^op\s+(?:read|item\s+get)\b/i,"a 1Password secret"],[/^vault\s+(?:kv\s+get|read)\b/i,"a Vault secret"],[/^doppler\s+secrets\b/i,"Doppler secrets"],[/^security\s+find-(?:generic|internet)-password\b.*\s-w\b/i,"a keychain password"],[/^git\s+credential\s+fill\b/i,"a saved Git password"],[/^node\s+\S*nodata-pull\.mjs\b/i,Wr],[/^kubectl\s+get\s+secrets?\b.*\s-o\b/i,"Kubernetes secrets"]],la=/^(?:echo|printf|print|write-output|write-host|say)\b/i,Vr=/^(?:cat|type|get-content|gc|more|less|head|tail|bat|nl|strings|xxd|od|hexdump|grep|egrep|rg|select-string|sls|awk|sed|jq|yq|python\d*|py|node|ruby|perl)\b/i,da=/\$\{?env:([A-Za-z_][\w]*)|\$\{?([A-Za-z_][\w]*)|%([A-Za-z_][\w]*)%|GetEnvironmentVariable\(\s*['"]([^'"]+)['"]/g;function ua(e,t,r){let n=e==="Read"&&typeof t.file_path=="string"?t.file_path:e==="Grep"&&typeof t.path=="string"?t.path:"";if(n&&rn.test((me(n)?n:O(r,n)).replace(/\\/g,"/")))return`a saved login (${sn(n)})`;if(e!=="Bash"&&e!=="PowerShell"||typeof t.command!="string")return null;let i=t.command.split(/(\|\||&&|[;|\n])/);for(let o=0;o<i.length;o+=2){let s=i[o+1]==="|",a=i[o].trim().replace(/^(?:sudo\s+|cmd(?:\.exe)?\s+\/c\s+|powershell(?:\.exe)?\s+(?:-command\s+)?|pwsh\s+(?:-c(?:ommand)?\s+)?)+/i,"").replace(/^["']|["']$/g,"");if(Vr.test(a)&&rn.test(a))return"a saved login file";if(aa(a))return Wr;for(let[l,u]of ca)if(l.test(a))return u;let c=a.match(/^printenv(?:\s+(\S+))?\s*$/i);if(c&&(!c[1]||st.test(c[1])))return c[1]?`the variable ${c[1]}`:"every environment variable";if(!s&&(la.test(a)||/GetEnvironmentVariable/i.test(a)))for(let l of a.matchAll(da)){let u=l[1]??l[2]??l[3]??l[4]??"";if(st.test(u))return`the variable ${u}`}}return null}var Gr=/^(?:grep|egrep|fgrep|rg|ag|ack|git\s+grep|findstr|select-string|sls)\b/i,fa=/(?:^|\s)(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive|--dereference-recursive|\/s|-recurse)(?=\s|$)/i,pa=new Set(["node_modules",".git",".next","dist","build",".venv","venv","__pycache__",".cache"]),Nr=4e3,ha=5;function ma(e){let t=0,r=0,n=(i,o)=>{if(o>ha||t>Nr)return;let s;try{s=Us(i,{withFileTypes:!0})}catch{return}for(let a of s){if(++t>Nr)return;let c=he(i,a.name);a.isDirectory()?pa.has(a.name)||n(c,o+1):(ue.test(a.name.toLowerCase())||rn.test(c.replace(/\\/g,"/"))||pe(c))&&r++}};return n(e,0),r}var Ae=e=>{try{return on(e).isDirectory()}catch{return!1}};function ga(e,t){let r=zs(O(t),O(e));return r===""||!r.startsWith("..")&&!me(r)}function ya(e,t,r){let n=o=>O(r,o.replace(/^~(?=[\\/]|$)/,V())),i=[];if(e==="Grep"){let o=typeof t.path=="string"&&t.path?n(t.path):O(r);if(Ae(o)){let s=[t.pattern,t.glob,t.type].filter(a=>typeof a=="string").join(" ");i.push({roots:[o],bySecret:st.test(s)||/\.env|env\b/i.test(String(t.glob??""))})}}else if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string")for(let o of t.command.split(/\|\||&&|[;|\n]/)){let s=o.trim().replace(/^(?:sudo\s+|xargs\s+(?:-\S+\s+)*)/i,"");if(!/^find\b.*-exec\s+(?:grep|egrep|rg|cat)\b/i.test(s)&&!(Gr.test(s)&&(fa.test(s)||/^(?:rg|ag|ack|git\s+grep)\b/i.test(s))))continue;let l=s.split(/\s+/).slice(1).map(u=>u.replace(/^['"]|['"]$/g,"")).filter(u=>u&&!u.startsWith("-")&&!/^\/[a-z]$/i.test(u)).map(n).filter(Ae);i.push({roots:l.length?l:[O(r)],bySecret:st.test(s)||/\.env\b/i.test(s)})}for(let o of i)for(let s of o.roots){if(!o.bySecret&&ga(s,r))continue;let a=ma(s);if(a>0)return{why:o.bySecret?"by_name":"outside",root:s,keyFiles:a}}return null}var Kr=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),nn=e=>Kr.has(e)||te(e)&&at(e)==="write";function Zr(e,t,r){let n=i=>O(r,i.replace(/^~(?=[\\/]|$)/,V()));if(e==="Read"&&typeof t.file_path=="string")return{action:"read",paths:[n(t.file_path)],roots:[]};if(Kr.has(e)){let i=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";return i?{action:"write",paths:[n(i)],roots:[]}:null}if(e==="Grep"||e==="Glob"){let i=typeof t.path=="string"&&t.path?n(t.path):O(r);return{action:"search",paths:[i],roots:Ae(i)?[i]:[]}}if(te(e)){let i=$e(t,r);if(!i.length)return null;let o=at(e);return{action:o,paths:i,roots:o==="search"?i.filter(Ae):[]}}if((e==="Bash"||e==="PowerShell")&&typeof t.command=="string"){let i=t.command,s=[...[...i.matchAll(/"([^"]*)"/g)].map(l=>l[1]),...[...i.matchAll(/'([^']*)'/g)].map(l=>l[1]),...i.split(/[\s|;&<>(),=`]+/)].map(l=>l.trim()).filter(l=>l&&!l.startsWith("-")&&/[\\/.~]/.test(l)).map(n).filter(l=>Fr(l)),a=i.split(/\|\||&&|[;|\n]/).some(l=>Gr.test(l.trim())||/^find\b/i.test(l.trim())),c=s.filter(Ae);return{action:a?"search":Vr.test(i.trim())?"read":"run",paths:[O(r),...s],roots:a?c.length?c:[O(r)]:[]}}return null}var ba=/(browser|playwright|puppeteer|chrome|chromium|stagehand|browserbase|selenium|webdriver)/i,_a=/(click|type|fill|press|select|submit|hover|drag|drop|upload|form|key|input|check|scroll|evaluate|dialog|tap|act\b|execute)/i,xa=/^(url|uri|href|link|address|page_?url|start_?url)$/i,Xr=()=>he(V(),".nodata","gate-sites.json"),ka=720*60*1e3,wa=50;function va(e,t){let r,n,i=(o,s,a)=>{if(!(a>3||r)){if(typeof o=="string"){let c=o.trim();if(!/^https?:\/\//i.test(c)||c.length>4096)return;xa.test(s)?r=c:n??=c}else if(Array.isArray(o))for(let c of o.slice(0,50))i(c,s,a+1);else if(o&&typeof o=="object")for(let[c,l]of Object.entries(o))i(l,c,a+1)}};return i(e,"",0),r??(t?n:void 0)}function ln(e,t){if(e==="WebFetch")return typeof t.url=="string"?{action:"browse",url:t.url}:null;if(!te(e)||cn(e))return null;let r=e.split("__").slice(2).join("__"),n=ba.test(e),i=va(t,n);return!i&&!n?null:{action:_a.test(r)?"interact":"browse",...i?{url:i}:{}}}function Jr(){try{let e=JSON.parse(Mr(Xr(),"utf8")),t=Date.now(),r={};for(let[n,i]of Object.entries(e??{}))typeof i?.host=="string"&&typeof i.at=="number"&&t-i.at<ka&&(r[n]={host:i.host,at:i.at});return r}catch{return{}}}function Sa(e){return e?Jr()[e]?.host:void 0}function Ea(e,t,r,n){if(!e||t==="WebFetch")return;let i=ln(t,r);if(!i)return;let o="";try{o=typeof n=="string"?n:JSON.stringify(n??"")}catch{}let s=/Page URL:\s*(https?:\/\/[^\s"\\]+)/i.exec(o)?.[1]??/"(?:url|pageUrl|page_url)"\s*:\s*"(https?:\/\/[^"\\]+)"/i.exec(o)?.[1],a=Zt(s??i.url??"");if(a)try{let c=Jr();c[e]={host:a,at:Date.now()};let l=Object.entries(c).sort((u,d)=>d[1].at-u[1].at).slice(0,wa);jr(he(V(),".nodata"),{recursive:!0}),Bs(Xr(),JSON.stringify(Object.fromEntries(l))+`
40
+ `,{mode:384})}catch{}}function Aa(e,t,r,n=new Date,i,o){let s=ln(e,t);if(!s)return null;let a;if(s.url){let x=Zt(s.url);if(!x)return null;a=x}else a=Sa(o);let{rules:c,tampered:l}=Kt(),u=qt(),d={allow:0,ask:1,clean_copy:2,deny:3},f={action:s.action,path:"",now:n,who:i,site:a},m=W(),h=null;for(let{owner:x,rules:p}of u){if(!Ye(x,O(r),m))continue;let b=Jt(p,f);b&&(!h||d[b.rule.effect]>d[h.rule.effect])&&(h={...b,org:!0})}let g=null;if(l){let x=c.find(p=>p.site&&(a===void 0||Xt(p.site,a)));x&&(g={rule:{...x,effect:"deny",when:[]},n:c.indexOf(x)+1,touched:a??"",tampered:!0})}else g=Jt(c,f);return h&&(!g||d[h.rule.effect]>=d[g.rule.effect])?h:g}function $a(e,t,r,n=new Date,i){let o=Zr(e,t,r);if(!o)return null;let{rules:s,tampered:a}=Kt(),c=qt();if(!s.length&&!c.length)return null;let l={allow:0,ask:1,clean_copy:2,deny:3},u=W(),d=null;for(let{owner:m,rules:h}of c){for(let g of o.paths){if(!Ye(m,g,u))continue;let x=rt(h,{action:o.action,path:g,now:n,who:i});x&&(!d||l[x.rule.effect]>l[d.rule.effect])&&(d={...x,org:!0})}for(let g of o.roots){if(!Ye(m,g,u))continue;let x=it(h,g,o.action,n,i);x&&x.rule.effect!=="allow"&&(!d||l[x.rule.effect]>l[d.rule.effect])&&(d={...x,org:!0})}}let f=Ia(s,a,o,n,l,i);return d&&(!f||l[d.rule.effect]>=l[f.rule.effect])?d:f}function Ia(e,t,r,n,i,o){if(!e.length)return null;if(t){for(let a of r.paths){let c=e.find(l=>ee(l.path,a)||ee(a,l.path));if(c)return{rule:{...c,effect:"deny",when:[]},n:e.indexOf(c)+1,touched:a,tampered:!0}}return null}let s=null;for(let a of r.paths){let c=rt(e,{action:r.action,path:a,now:n,who:o});c&&(!s||i[c.rule.effect]>i[s.rule.effect])&&(s=c)}for(let a of r.roots){let c=it(e,a,r.action,n,o);c&&c.rule.effect!=="allow"&&(!s||i[c.rule.effect]>i[s.rule.effect])&&(s=c)}return s}function Ta(e){let t;try{t=typeof e=="string"?e:JSON.stringify(e??"")}catch{return{}}if(!t)return{};t=t.slice(0,2*1024*1024);let r={};for(let n of _e()){let i=new RegExp(n.pattern.source,n.pattern.flags.includes("g")?n.pattern.flags:n.pattern.flags+"g"),o=(t.match(i)??[]).length;o&&(r[n.id]=(r[n.id]??0)+o)}return r}function Ra(e){let t=Object.keys(e);if(t.length===0)return null;let r=t.reduce((i,o)=>i+e[o],0),n=[...new Set(t.map(i=>{let o=Ht(i);return o.url?`${o.provider}: ${o.url}`:o.provider}))];return`NoData \xB7 A CREDENTIAL IS IN THIS OUTPUT (${r}: ${t.join(", ")}). It is now in this conversation and was sent to the AI model. Do not repeat, quote, shorten, mask-by-hand or reuse it \u2014 not in your answer, not in a command, not in a file. Tell the user in one line that a key was shown here and should be replaced at its provider (${n.join(" \xB7 ")}); nodata_scan_folder gives the full steps. Next time, run commands that need secrets through nodata_run: the output comes back with every value blanked.`+(fe()==="he"?" Answer the user in Hebrew.":"")}function Ca(e,t,r,n){let i=wr();if(!i.length)return null;let o=Zr(e,t,r);if(!o)return null;let s=new Date,a=o.paths.map(l=>rt(i,{action:o.action,path:l,now:s,who:n})).find(Boolean)??o.roots.map(l=>it(i,l,o.action,s,n)).find(Boolean);if(!a)return null;let c=String(a.rule.when?.[0]?.value??"");return I(`NoData \u05D7\u05E1\u05DD: ${M(a.rule.path)} \u05E2\u05D5\u05D1\u05D3\u05EA \u05E2\u05D1\u05D5\u05E8 \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05E8 (${c}) \u05DE\u05D6\u05D4 \u05E9\u05DC \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5. \u05E1\u05D5\u05DB\u05DF \u05E9\u05E2\u05D5\u05D1\u05D3 \u05DB\u05D0\u05DF \u05E2\u05D1\u05D5\u05E8 \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05D3 \u05DC\u05D0 \u05E0\u05D5\u05D2\u05E2 \u05D1\u05E7\u05D1\u05E6\u05D9\u05DD \u05E9\u05DC \u05D0\u05E8\u05D2\u05D5\u05DF \u05D0\u05D7\u05E8 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4 \u05E9\u05DD: \u05DC\u05E4\u05EA\u05D5\u05D7 \u05D0\u05EA \u05D4\u05E1\u05D5\u05DB\u05DF \u05D1\u05EA\u05D5\u05DA \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D4\u05D9\u05D0.`,`NoData refused: ${M(a.rule.path)} works for another organisation (${c}) than this folder. An agent working here for one organisation does not touch another organisation's files \u2014 not even with approval. To work there, start the agent inside that folder.`)}function Pa(e,t,r){let n=(e==="Bash"||e==="PowerShell")&&typeof t.command=="string"?t.command:"",i=(e==="Grep"||e==="Glob")&&typeof t.path=="string"?t.path:e==="Read"&&typeof t.file_path=="string"?t.file_path:"";return n&&Xs(n)||i&&pe(me(i)?i:O(r,i))||te(e)&&$e(t,r).some(pe)||Br(e,t,r).some(pe)?I("NoData \u05D7\u05E1\u05DD: \u05D6\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E4\u05EA\u05D7 \u05E9\u05DC NoData (\u05DE\u05E4\u05EA\u05D7 \u05D4\u05DE\u05DB\u05E9\u05D9\u05E8, \u05D4\u05DB\u05E1\u05E4\u05EA \u05D0\u05D5 \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF). \u05DE\u05D9 \u05E9\u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u05D9\u05DB\u05D5\u05DC \u05DC\u05E4\u05EA\u05D5\u05D7 \u05DB\u05DC \u05E7\u05D5\u05D1\u05E5 \u05E0\u05E2\u05D5\u05DC, \u05D5\u05DC\u05DB\u05DF \u05D0\u05E3 \u05E1\u05D5\u05DB\u05DF \u05DC\u05D0 \u05E7\u05D5\u05E8\u05D0 \u05D0\u05D5\u05EA\u05D5 \u2014 \u05D2\u05DD \u05DC\u05D0 \u05D1\u05D0\u05D9\u05E9\u05D5\u05E8. \u05DC-NoData \u05D0\u05D9\u05DF \u05E2\u05D5\u05EA\u05E7 \u05E9\u05DC \u05D4\u05DE\u05E4\u05EA\u05D7 \u05D5\u05D0\u05D9\u05DF \u05D3\u05E8\u05DA \u05DC\u05E9\u05D7\u05D6\u05E8 \u05D0\u05D5\u05EA\u05D5: \u05D4\u05D2\u05D9\u05D1\u05D5\u05D9 \u05E9\u05DC\u05DA \u05D4\u05D5\u05D0 \u05D4\u05D3\u05E8\u05DA \u05D4\u05D9\u05D7\u05D9\u05D3\u05D4. \u05DC\u05D2\u05D9\u05D1\u05D5\u05D9, \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC \u05D5\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8: npx -y @nodatachat/mcp@latest key-backup E: (E: = \u05D4\u05D3\u05D9\u05E1\u05E7-\u05D0\u05D5\u05DF-\u05E7\u05D9).","NoData refused: this is one of NoData's own key files (the device key, the vault login or the org credential). Whoever reads it can open every sealed file, so no agent reads it \u2014 not even with approval. NoData holds no copy of this key and cannot recover it: your backup is the only recovery. To back it up, in a terminal (not the chat): npx -y @nodatachat/mcp@latest key-backup E: (E: = your USB drive). Do not suggest other recovery routes \u2014 there are none."):null}function La(e,t,r,n,i,o){if(cn(e))return{decision:"allow"};let s=gr(r),a={...i,org:s??void 0},c=Pa(e,t,r);if(c)return{decision:"deny",reason:c,kind:"nodata_key"};let l=Ca(e,t,r,a);if(l)return{decision:"deny",reason:l,kind:"org_wall"};let u=ua(e,t,r);if(u){let w=I(`NoData: \u05D4\u05E4\u05E7\u05D5\u05D3\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E6\u05D9\u05D2\u05D4 ${u}. \u05DE\u05D4 \u05E9\u05D4\u05D9\u05D0 \u05DE\u05D3\u05E4\u05D9\u05E1\u05D4 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4 \u05D5\u05E0\u05E9\u05DC\u05D7 \u05DC\u05DE\u05D5\u05D3\u05DC \u05D4\u05D1\u05D9\u05E0\u05D4 \u05D4\u05DE\u05DC\u05D0\u05DB\u05D5\u05EA\u05D9\u05EA, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05E8\u05D0\u05D4 \u05DB\u05D0\u05DF \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D7\u05DC\u05D9\u05E3.
41
+ \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05D5\u05EA\u05D4 \u05D1\u05E2\u05E6\u05DE\u05DA \u05D1\u05D8\u05E8\u05DE\u05D9\u05E0\u05DC (\u05DC\u05D0 \u05D1\u05E6'\u05D0\u05D8), \u05D0\u05D5 nodata_run \u2014 \u05E9\u05DE\u05E8\u05D9\u05E5 \u05E4\u05E7\u05D5\u05D3\u05D4 \u05E2\u05DD \u05D4\u05E1\u05D5\u05D3\u05D5\u05EA \u05D5\u05DE\u05D7\u05D6\u05D9\u05E8 \u05D0\u05EA \u05D4\u05E4\u05DC\u05D8 \u05DB\u05E9\u05DB\u05DC \u05E2\u05E8\u05DA \u05DE\u05D5\u05E1\u05EA\u05E8.`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this shows ${u}. Whatever it prints enters the conversation and goes to the AI model, and a key seen there has to be replaced.
42
+ Instead: run it yourself in a terminal (not the chat), or nodata_run \u2014 it runs a command with the secrets and returns the output with every value blanked.`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:w,kind:"credential_print"}}if((nn(e)||e==="Bash"||e==="PowerShell")&&ea(e,t,r))return{decision:"ask",kind:"gate_holder",reason:I("NoData: \u05D4\u05E4\u05E2\u05D5\u05DC\u05D4 \u05D4\u05D6\u05D5 \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05D4 \u05E9\u05DE\u05E4\u05E2\u05D9\u05DC \u05D0\u05EA \u05D4\u05E9\u05E2\u05E8 \u2014 \u05D4\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05E9\u05DC Claude Code \u05D0\u05D5 \u05D4\u05E7\u05D5\u05D3 \u05D4\u05DE\u05D5\u05EA\u05E7\u05DF \u05E9\u05DC NoData. \u05D0\u05D7\u05E8\u05D9 \u05E9\u05D9\u05E0\u05D5\u05D9 \u05DB\u05D6\u05D4 \u05D9\u05D9\u05EA\u05DB\u05DF \u05E9\u05D4\u05E9\u05E2\u05E8 \u05DC\u05D0 \u05D9\u05D1\u05D3\u05D5\u05E7 \u05D9\u05D5\u05EA\u05E8. \u05DC\u05D0\u05E9\u05E8 \u05E8\u05E7 \u05D0\u05DD \u05D0\u05EA\u05D4 \u05D1\u05D9\u05E7\u05E9\u05EA \u05D0\u05EA \u05D6\u05D4.","NoData: this changes what runs the gate \u2014 Claude Code's settings or NoData's installed code. After such a change the gate may stop checking. Approve only if you asked for it.")};if(nn(e)){let w=typeof t.file_path=="string"?t.file_path:typeof t.notebook_path=="string"?t.notebook_path:"";if((te(e)?$e(t,r):w?[me(w)?w:O(r,w)]:[]).some(pe))return{decision:"deny",kind:"nodata_write",reason:I("NoData \u05D7\u05E1\u05DD: \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 ~/.nodata \u05E1\u05D2\u05D5\u05E8\u05D4 \u05DC\u05E1\u05D5\u05DB\u05E0\u05D9\u05DD, \u05D2\u05DD \u05DC\u05DB\u05EA\u05D9\u05D1\u05D4 (\u05DB\u05DC\u05DC\u05D9\u05DD, \u05DE\u05E4\u05EA\u05D7\u05D5\u05EA, \u05D0\u05D9\u05E9\u05D5\u05E8\u05D9\u05DD).","NoData refused: ~/.nodata is closed to agents, writes included (rules, keys, approvals).")}}let d=new Date,f=$a(e,t,r,d,a),m=Aa(e,t,r,d,a,o),h=m&&(!f||Q[m.rule.effect]>Q[f.rule.effect])?m:f;if(h&&h.rule.effect!=="allow"){let w=fe()==="he",R=h.rule.site?xr(h.rule,w):h.rule.path.startsWith("**/")?h.rule.path:M(h.rule.path),j=h.rule.site&&!h.touched?I(" (NoData \u05DC\u05D0 \u05D9\u05D5\u05D3\u05E2 \u05D1\u05D0\u05D9\u05D6\u05D4 \u05D0\u05EA\u05E8 \u05D4\u05D3\u05E3 \u05D4\u05D6\u05D4, \u05D5\u05DC\u05DB\u05DF \u05D4\u05DB\u05DC\u05DC \u05D4\u05DE\u05D7\u05DE\u05D9\u05E8 \u05DE\u05D1\u05D9\u05DF \u05DB\u05DC\u05DC\u05D9 \u05D4\u05D0\u05EA\u05E8\u05D9\u05DD \u05D7\u05DC)"," (NoData does not know which site this page is on, so the strictest site rule applies)"):"",C=h.tampered?I("\u05E7\u05D5\u05D1\u05E5 \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05D5\u05E0\u05D4 \u05E9\u05DC\u05D0 \u05D3\u05E8\u05DA nodata_rules, \u05D5\u05DC\u05DB\u05DF \u05DB\u05DC \u05E0\u05EA\u05D9\u05D1 \u05D5\u05D0\u05EA\u05E8 \u05E9\u05D4\u05D5\u05D0 \u05DE\u05D6\u05DB\u05D9\u05E8 \u05E1\u05D2\u05D5\u05E8\u05D9\u05DD \u05E2\u05D3 \u05E9\u05EA\u05E9\u05DE\u05D5\u05E8 \u05D0\u05EA \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05DE\u05D7\u05D3\u05E9.","the rules file was changed outside nodata_rules, so every path and site it names is closed until you save the rules again."):`${h.org?I("\u05DB\u05DC\u05DC \u05E9\u05DC \u05D4\u05D0\u05E8\u05D2\u05D5\u05DF","organisation rule"):I("\u05DB\u05DC\u05DC","rule")} ${h.n}: ${R} \u2192 ${kr(h.rule.effect,w)}${h.rule.note?` (${h.rule.note})`:""}${j}`;if(h.rule.site&&h.rule.effect==="ask"&&!h.tampered&&Pr()){let H=ln(e,t),T=h.touched,P=Ar(T,H.action,e,t);return Cr(P)?{decision:"allow"}:(Rr({id:P,site:T,action:H.action,tool:e,what:$r(t)}),{decision:"deny",kind:"checkpoint",reason:I(`NoData: ${C}. \u05D4\u05E6\u05E2\u05D3 \u05D4\u05D6\u05D4 \u05DE\u05D7\u05DB\u05D4 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 \u05E9\u05DC \u05D1\u05E2\u05DC\u05D9 \u05D4\u05DE\u05D7\u05E9\u05D1 \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF, \u05DC\u05D0 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 \u05DB\u05D0\u05DF.
43
+ \u05DB\u05D3\u05D9 \u05DC\u05D1\u05E7\u05E9: nodata_rules {action:"approve", checkpoint:"${P}"} \u2014 \u05D4\u05D5\u05D0 \u05E4\u05D5\u05EA\u05D7 \u05D0\u05EA \u05D3\u05E3 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8 \u05D5\u05DE\u05D7\u05DB\u05D4. \u05D0\u05D7\u05E8\u05D9 \u05D4\u05D0\u05D9\u05E9\u05D5\u05E8, \u05D7\u05D6\u05D5\u05E8 \u05E2\u05DC \u05D0\u05D5\u05EA\u05D4 \u05E7\u05E8\u05D9\u05D0\u05D4 \u05D1\u05D3\u05D9\u05D5\u05E7 (\u05E4\u05E2\u05DD \u05D0\u05D7\u05EA, \u05EA\u05D5\u05DA 5 \u05D3\u05E7\u05D5\u05EA). \u05D0\u05EA\u05D4 \u05DC\u05D0 \u05D9\u05DB\u05D5\u05DC \u05DC\u05D0\u05E9\u05E8 \u05D1\u05E2\u05E6\u05DE\u05DA.`,`NoData: ${C}. This step waits for the computer's owner to approve it in the browser, not here.
44
+ To ask: nodata_rules {action:"approve", checkpoint:"${P}"} \u2014 it opens the approval page and waits. Once approved, repeat exactly the same call (once, within 5 minutes). You cannot approve it yourself.`)})}let N=h.rule.effect==="clean_copy"?I(`NoData: ${C}. \u05D4\u05E1\u05D5\u05DB\u05DF \u05E2\u05D5\u05D1\u05D3 \u05DB\u05D0\u05DF \u05E8\u05E7 \u05E2\u05DC \u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9: nodata_redact \u05D9\u05D5\u05E6\u05E8 \u05D0\u05D5\u05EA\u05D5 (\u05DE\u05D6\u05D4\u05D9\u05DD \u05DE\u05D5\u05D7\u05DC\u05E4\u05D9\u05DD, \u05E0\u05D1\u05D3\u05E7 \u05DC\u05E4\u05E0\u05D9 \u05E9\u05D9\u05DE\u05D5\u05E9).`,`NoData: ${C}. The agent works here on a clean copy only: nodata_redact makes one (identifiers replaced, checked before use).`):h.rule.effect==="ask"?I(`NoData: ${C}. \u05DC\u05D0\u05E9\u05E8?`,`NoData: ${C}. Allow?`):I(`NoData: ${C}. \u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05E9\u05DC \u05D4\u05E7\u05D1\u05E6\u05D9\u05DD, \u05D4\u05EA\u05D9\u05E7\u05D9\u05D5\u05EA \u05D5\u05D4\u05D0\u05EA\u05E8\u05D9\u05DD \u05E9\u05DC\u05DA: nodata_rules.`,`NoData: ${C}. Your file, folder and site rules: nodata_rules.`);return{decision:h.rule.effect==="ask"?"ask":"deny",reason:N,kind:"rule"}}if(nn(e))return{decision:"allow"};let g=ya(e,t,r);if(g){let w=M(g.root),R=I(`NoData: \u05D6\u05D4 ${g.why==="by_name"?"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E1\u05D5\u05D3 \u05DC\u05E4\u05D9 \u05E9\u05DD":"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05DE\u05D7\u05D5\u05E5 \u05DC\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8"}, \u05D1\u05EA\u05D5\u05DA ${w}, \u05E9\u05D9\u05E9 \u05D1\u05D4 ${g.keyFiles} \u05E7\u05D1\u05E6\u05D9 \u05DE\u05E4\u05EA\u05D7\u05D5\u05EA (.env, \u05D4\u05EA\u05D7\u05D1\u05E8\u05D5\u05D9\u05D5\u05EA). \u05DE\u05D4 \u05E9\u05D4\u05D7\u05D9\u05E4\u05D5\u05E9 \u05D9\u05DE\u05E6\u05D0 \u05E0\u05DB\u05E0\u05E1 \u05DC\u05E9\u05D9\u05D7\u05D4, \u05D5\u05DE\u05E4\u05EA\u05D7 \u05E9\u05E0\u05DE\u05E6\u05D0 \u05DB\u05DA \u05D9\u05DB\u05D5\u05DC \u05DC\u05E9\u05DE\u05E9 \u05D0\u05EA \u05D4\u05E1\u05D5\u05DB\u05DF \u2014 \u05D2\u05DD \u05DC\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E9\u05E2\u05D5\u05DC\u05D5\u05EA \u05DB\u05E1\u05E3 \u2014 \u05D1\u05DC\u05D9 \u05E9\u05D0\u05D9\u05E9\u05E8\u05EA \u05D0\u05D5\u05EA\u05D5.
45
+ \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: \u05DC\u05D7\u05E4\u05E9 \u05D1\u05EA\u05D5\u05DA \u05D4\u05E4\u05E8\u05D5\u05D9\u05E7\u05D8, \u05D0\u05D5 nodata_run \u05E2\u05DD \u05D4\u05DE\u05E4\u05EA\u05D7\u05D5\u05EA \u05DE\u05D4\u05DB\u05E1\u05E4\u05EA (\u05DB\u05DC \u05E4\u05E7\u05D5\u05D3\u05D4 \u05DE\u05D0\u05D5\u05E9\u05E8\u05EA \u05DB\u05DE\u05D5 \u05E9\u05D4\u05D9\u05D0).`+(n?"":" \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData: this is ${g.why==="by_name"?"a search for a secret by name":"a search outside this project"}, over ${w}, where ${g.keyFiles} key file(s) (.env, logins) are. Whatever it finds enters the conversation, and a key found this way can be used by the agent \u2014 for paid calls too \u2014 without you approving it.
46
+ Instead: search inside the project, or nodata_run with the keys from the vault (each command approved as written).`+(n?"":" Allow anyway?"));return{decision:n?"deny":"ask",reason:R,kind:"secret_search"}}if(h?.rule.effect==="allow")return{decision:"allow"};let x=zr(e,t,r);if(x.length===0)return{decision:"allow"};let p=x.map(w=>w.line),b=I(`NoData \u05E1\u05E8\u05E7 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D1\u05DE\u05D7\u05E9\u05D1 \u05E9\u05DC\u05DA \u2014 \u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05D9\u05E6\u05D0:
47
+ ${p.join(`
44
48
  `)}
45
49
  `+(n?"\u05D4\u05E7\u05E8\u05D9\u05D0\u05D4 \u05E0\u05D7\u05E1\u05DE\u05D4: Claude \u05DC\u05D0 \u05D9\u05E7\u05E8\u05D0 \u05D0\u05EA \u05D4\u05DE\u05E7\u05D5\u05E8. \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: nodata_redact (\u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9 \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4) \u05D0\u05D5 nodata_protect (\u05E0\u05E2\u05D9\u05DC\u05D4).":"\u05D0\u05DD \u05EA\u05D0\u05E9\u05E8, Claude \u05D9\u05E7\u05E8\u05D0 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05E2\u05E6\u05DE\u05D5 \u05D5\u05D4\u05EA\u05D5\u05DB\u05DF \u05D9\u05D9\u05E9\u05DC\u05D7 \u05DC\u05DE\u05D5\u05D3\u05DC \u05D4\u05D1\u05D9\u05E0\u05D4 \u05D4\u05DE\u05DC\u05D0\u05DB\u05D5\u05EA\u05D9\u05EA. \u05D1\u05DE\u05E7\u05D5\u05DD \u05D6\u05D4: nodata_redact (\u05E2\u05D5\u05EA\u05E7 \u05E0\u05E7\u05D9 \u05DC\u05E2\u05D1\u05D5\u05D3\u05D4) \u05D0\u05D5 nodata_protect (\u05E0\u05E2\u05D9\u05DC\u05D4). \u05DC\u05D0\u05E9\u05E8 \u05D1\u05DB\u05DC \u05D6\u05D0\u05EA?"),`NoData scanned this file on your machine \u2014 nothing left it:
46
- ${h.join(`
50
+ ${p.join(`
47
51
  `)}
48
- `+(n?"Read refused: Claude will not read the original. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it).":"If you allow it, Claude reads the file itself and its content goes to the AI model. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it). Allow anyway?")),g=[...new Set(f.map(b=>b.kind))];return{decision:n?"deny":"ask",reason:m,kind:g[0],...g.length>1?{kinds:g}:{}}}function Zo(e,t,r){let n=wr(e,t,r).map(i=>i.line);return n.length===0?null:`NoData \xB7 ON SCREEN rule. What you just read holds personal data:
52
+ `+(n?"Read refused: Claude will not read the original. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it).":"If you allow it, Claude reads the file itself and its content goes to the AI model. Instead: nodata_redact (a clean copy to work on) or nodata_protect (lock it). Allow anyway?")),k=[...new Set(x.map(w=>w.kind))];return{decision:n?"deny":"ask",reason:b,kind:k[0],...k.length>1?{kinds:k}:{}}}function Oa(e,t,r){let n=zr(e,t,r).map(i=>i.line);return n.length===0?null:`NoData \xB7 ON SCREEN rule. What you just read holds personal data:
49
53
  ${n.join(`
50
54
  `)}
51
- The user's screen is not private \u2014 someone may be beside them. Answer with totals, counts, groupings and trends. Do not print names, ID / policy / account numbers, addresses, phones, or amounts tied to a person \u2014 not in a table, not as an "example" \u2014 unless the user explicitly asks to see those values. For a clean, anonymised or shareable version use nodata_redact \u2014 never your own script: it verifies the copy and records a proof.`+(le()==="he"?" Answer the user in Hebrew.":"")}function Ir(e){try{let t=tt(ue(),".nodata");co(t,{recursive:!0}),ao(tt(t,"gate.log"),JSON.stringify({at:new Date().toISOString(),...e})+`
52
- `,{mode:384})}catch{}}function Xo(e,t){Ir({tool:e,decision:t.decision,...t.kind?{kind:t.kind}:{},...t.kinds?.length?{kinds:t.kinds}:{}})}function Jo(e,t){let r=typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,n=typeof t.agent_type=="string"&&t.agent_type.trim()?t.agent_type.trim().toLowerCase():r==="claude-code"?"main":void 0;return{host:r,type:n}}async function Tr(e){let t=e.includes("--block"),r=e.includes("--post"),n=e.indexOf("--host"),i=n>=0&&e[n+1]&&!e[n+1].startsWith("--")?e[n+1]:void 0,s="";for await(let c of process.stdin)s+=c;let o;try{o=JSON.parse(s)}catch{return}let a=o.tool_name??"";if(_r(a))return;if(r){let c=zo(o.tool_response);Object.keys(c).length&&Ir({tool:a,leaked:Object.values(c).reduce((d,f)=>d+f,0)});let u=[Wo(c),Zo(a,o.tool_input??{},o.cwd??process.cwd())].filter(Boolean).join(`
55
+ The user's screen is not private \u2014 someone may be beside them. Answer with totals, counts, groupings and trends. Do not print names, ID / policy / account numbers, addresses, phones, or amounts tied to a person \u2014 not in a table, not as an "example" \u2014 unless the user explicitly asks to see those values. For a clean, anonymised or shareable version use nodata_redact \u2014 never your own script: it verifies the copy and records a proof.`+(fe()==="he"?" Answer the user in Hebrew.":"")}function qr(e){try{let t=he(V(),".nodata");jr(t,{recursive:!0}),Hs(he(t,"gate.log"),JSON.stringify({at:new Date().toISOString(),...e})+`
56
+ `,{mode:384})}catch{}}function Da(e,t){qr({tool:e,decision:t.decision,...t.kind?{kind:t.kind}:{},...t.kinds?.length?{kinds:t.kinds}:{}})}function Na(e,t){let r=typeof e=="string"&&e.trim()?e.trim().toLowerCase():void 0,n=typeof t.agent_type=="string"&&t.agent_type.trim()?t.agent_type.trim().toLowerCase():r==="claude-code"?"main":void 0;return{host:r,type:n}}async function Yr(e){let t=e.includes("--block"),r=e.includes("--post"),n=e.indexOf("--host"),i=n>=0&&e[n+1]&&!e[n+1].startsWith("--")?e[n+1]:void 0,o="";for await(let l of process.stdin)o+=l;let s;try{s=JSON.parse(o)}catch{return}let a=s.tool_name??"";if(cn(a))return;if(r){Ea(s.session_id,a,s.tool_input??{},s.tool_response);let l=Ta(s.tool_response);Object.keys(l).length&&qr({tool:a,leaked:Object.values(l).reduce((d,f)=>d+f,0)});let u=[Ra(l),Oa(a,s.tool_input??{},s.cwd??process.cwd())].filter(Boolean).join(`
53
57
 
54
- `);u&&process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:u}}));return}let l=Ko(a,o.tool_input??{},o.cwd??process.cwd(),t,Jo(i,o));l.decision!=="allow"&&(Xo(a,l),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:l.decision,permissionDecisionReason:l.reason}})))}var qo="claude-code",Yd=` --host ${qo}`;var Yo=[{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 Qo(e){if(e.length!==9)return!1;let t=e.split("").map(Number),r=0;for(let n=0;n<9;n++){let i=t[n]*(n%2===0?1:2);i>9&&(i-=9),r+=i}return r%10===0}var he=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let r=[],n=new Set;for(let s of Yo)if(this.enabledTypes.has(s.type))for(let o of s.patterns){let a=new RegExp(o.source,o.flags),l;for(;(l=a.exec(t))!==null;){let c=l[0],u=`${s.type}:${l.index}`;if(!n.has(u)){if(n.add(u),s.type==="id_number"){let d=c.replace(/\D/g,"");if(/^\d{9}$/.test(c)&&d.length===9&&!Qo(d))continue}r.push({type:s.type,value:c,startIndex:l.index,endIndex:l.index+c.length,confidence:s.confidence,replacement:s.replacement(c,s.type)})}}}r.sort((s,o)=>s.startIndex-o.startIndex||o.confidence-s.confidence);let i=[];for(let s of r)i.some(a=>s.startIndex<a.endIndex&&s.endIndex>a.startIndex)||i.push(s);return i}};var A=["GDPR","CPRA","PPL"],ea=["GDPR-9","CPRA","PPL"],ta=[{id:"person_name",type:"name",sensitivity:"high",regulations:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...A],en:["manager","supervisor"],he:["\u05DE\u05E0\u05D4\u05DC \u05D9\u05E9\u05D9\u05E8"]},{id:"education",type:"education",sensitivity:"medium",regulations:[...A],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:[...A],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:[...A],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:[...A],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:[...A],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:[...ea],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:[...A],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:[...A],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 na(e){return e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim()}function Rr(){return ta.map(e=>{let t=[...e.en,...e.he??[],...e.ar??[],...e.ru??[]].map(na).filter(Boolean);return{type:e.type,tokens:t.filter(r=>!r.includes(" ")),phrases:t.filter(r=>r.includes(" "))}})}var ra=[{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 r=t.padStart(9,"0"),n=0;for(let i=0;i<9;i++){let s=parseInt(r[i]??"0",10)*(i%2+1);s>9&&(s-=9),n+=s}return n%10===0&&parseInt(r,10)>0}var st=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,ot=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,at=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function Cr(e){let t=String(e??"").replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let r=0,n=!1;for(let i=t.length-1;i>=0;i--){let s=t.charCodeAt(i)-48;if(s<0||s>9)return!1;n&&(s*=2,s>9&&(s-=9)),r+=s,n=!n}return r%10===0}function Pr(e){if(!e)return null;let t=e.trim();for(let r of ra)if(r.pattern.test(t))return{type:r.type,label:r.label,labelHe:r.labelHe};return null}var ia=[{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"]},...Rr(),{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 ct(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 r=new Set(t.match(/[\p{L}\p{N}]+/gu)??[]);for(let n of ia)if(n.phrases?.some(s=>t.includes(s))||n.tokens?.some(s=>r.has(s)))return{type:n.type,label:n.type,labelHe:lt(n.type)};return null}function lt(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 Lr(e){let t=0,r=0,n=0,i=0,s=0;for(let a of e)typeof a=="string"&&(qt(a)&&t++,st.lastIndex=0,st.test(a)&&r++,ot.lastIndex=0,ot.test(a)&&n++,at.lastIndex=0,at.test(a)&&i++,Cr(a)&&s++);let o=e.length||1;return t/o>=.3?{type:"id",label:"Israeli ID (sniffed)",matchedSample:t}:i/o>=.3?{type:"financial",label:"IBAN-IL (sniffed)",matchedSample:i}:r/o>=.3?{type:"phone",label:"IL phone (sniffed)",matchedSample:r}:n/o>=.3?{type:"email",label:"Email (sniffed)",matchedSample:n}:s/o>=.3?{type:"financial",label:"Credit card (sniffed)",matchedSample:s}:null}var sa=[{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."}],oa=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function aa(e,t,r,n){if(n==="address")return{start:t,end:r};let i=oa.exec(e.slice(t,r));return i&&t+i[0].length<r?{start:t+i[0].length,end:r}:{start:t,end:r}}function j(e,t,r=()=>!0){let n=[],i=new RegExp(e.source,e.flags.includes("g")?e.flags:e.flags+"g");for(let s of t.matchAll(i)){let o=s[1];if(!o||!r(o))continue;let a=(s.index??0)+s[0].indexOf(o);n.push({start:a,end:a+o.length})}return n}var Dr=String.raw`[A-Z][a-z']+(?:-[A-Z]?[a-z']+)*`,Yt=String.raw`${Dr}(?:[ \t]+${Dr}){0,2}`,ca=new RegExp(String.raw`\b(?:Mr|Mrs|Ms|Miss|Dr|Prof)\.?[ \t]+(${Yt})`),la=new RegExp(String.raw`\b(?:Client|Customer|Patient|Name|Full name|Beneficiary|Insured|Applicant|Tenant|Employee|Holder|Investor)[ \t]*:[ \t]*(${Yt})`),da=new RegExp(String.raw`\b(${Yt})(?=,[ \t]*\d{1,3}[ \t]*,|[ \t]*\(\d{1,3}\))`,"g"),ua=/^(?: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)$/,fa=/\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\.?)/,pa=/\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,ha=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}`,ma=new RegExp(String.raw`\b(?:date\s+of\s+birth|birth\s*date|d\.?o\.?b\.?|born(?:\s+on)?)\s*[:\-]?\s*(${ha})`,"i"),ga=/\b((?!000|666|9\d\d)\d{3}-(?!00)\d{2}-(?!0000)\d{4})\b/,ya=/\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/,ba=/(?<![\w+])(\+(?!972)[1-9][\d\s().-]{7,20}\d)/,Nr=e=>e.replace(/\D/g,"").length,_a=[{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=>[...j(ca,e),...j(la,e),...j(da,e,t=>!ua.test(t.split(/[ \t]/).pop()??""))]},{kind:"address",severity:"medium",hint:"A street address in plaintext.",find:e=>j(fa,e)},{kind:"reference",severity:"medium",hint:"A policy, claim, account or company number in plaintext.",find:e=>j(pa,e)},{kind:"dob",severity:"medium",hint:"A date of birth in plaintext.",find:e=>j(ma,e)},{kind:"national_id",severity:"high",hint:"A national ID number (US SSN, UK NINO) in plaintext.",find:e=>[...j(ga,e),...j(ya,e)]},{kind:"phone",severity:"high",hint:"A phone number in international form in plaintext.",find:e=>j(ba,e,t=>Nr(t)>=8&&Nr(t)<=15)}];function xa(e){let t=new Map;for(let r of e){let n=t.get(r.kind);t.set(r.kind,n?{...n,find:i=>[...n.find(i),...r.find(i)]}:r)}return[...t.values()]}function Or(){let e=sa.map(({type:t,kind:r,severity:n,hint:i})=>{let s=new he([t]);return{kind:r,severity:n,hint:i,find:o=>s.detect(o).map(a=>aa(o,a.startIndex,a.endIndex,r))}});return xa([...e,..._a])}var dt={_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 va=[{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"}],Sa=/^(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,Ea=/^(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,Aa=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function Fr(e,t){if(Sa.test(e)||/^name$/i.test(e)||t&&Ea.test(t)||Aa.test(e))return null;for(let n of va)if(n.pattern.test(e))return n.type;let r=Pr(e);return r?r.type:null}var lu=dt.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var du=512*1024,uu=50*1024*1024;var Mr={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 Hr(e){return Mr[e]}function $a(e){return Mr[e]??"low"}function Ur(e,t){let r=[];for(let n of t){let i=n.rows.length;for(let s=0;s<n.headers.length;s++){let o=n.headers[s]??"",a=o?Fr(o.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),n.name)??ct(o)?.type??null:null,l=[];for(let u of n.rows){let d=u[s];typeof d=="string"&&d.length>0&&l.push(d)}let c=l.length>0?Lr(l):null;c?r.push(jr(e,n.name,o,c.type,c.label,"value",c.matchedSample,i)):a&&r.push(jr(e,n.name,o,a,lt(a),"header",0,i))}}return r}function jr(e,t,r,n,i,s,o,a){return{file:e,location:t,column:r,type:n,label:i,category:lt(n),severity:$a(n),matchKind:s,hits:o,sampleSize:a}}var Ia=new Set(["hex-secret-32","base64-secret"]),Ta=[/(?:[$€£]|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 Ra(e){let t=new he(["financial_amount"]);return{kind:"amount",severity:"medium",hint:"A money amount (the amounts dial is on: amounts are treated as sensitive here).",find:r=>{if(!e())return[];let n=t.detect(r).map(s=>({start:s.startIndex,end:s.endIndex}));for(let s of Ta){s.lastIndex=0;for(let o of r.matchAll(s))n.push({start:o.index,end:o.index+o[0].length})}n.sort((s,o)=>s.start-o.start||o.end-s.end);let i=[];for(let s of n){let o=i[i.length-1];o&&s.start<o.end?o.end=Math.max(o.end,s.end):i.push({...s})}return i}}}function Br(e={}){let t=e.amounts??(()=>!1),r=[...Or(),Ra(t)],n=dt.rules.filter(i=>!Ia.has(i.id)).map(i=>({id:i.id,name:i.name,severity:i.severity,pattern:new RegExp(i.pattern)}));return{text:r,amounts:t,header:i=>{let s=ct(i);return s?{type:s.type,label:s.labelHe||s.label}:null},secrets:n,table:i=>Ur("",[i]).filter(s=>s.column).map(s=>({column:s.column,type:s.type,category:s.category,severity:s.severity,hits:s.hits,how:s.matchKind==="value"?"value":"header"})),severity:i=>Hr(i)}}var zr=!1;function Wr(){zr||(zr=!0,ut(Br({amounts:Jn})))}Wr();Tr(process.argv.slice(2)).catch(()=>{process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"ask",permissionDecisionReason:"NoData could not check this file before it is read. Allow anyway?"}}))});
58
+ `);u&&process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:u}}));return}let c=La(a,s.tool_input??{},s.cwd??process.cwd(),t,Na(i,s),s.session_id);c.decision!=="allow"&&(Da(a,c),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:c.decision,permissionDecisionReason:c.reason}})))}var Fa="claude-code",zu=` --host ${Fa}`;var ja=[{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 Ma(e){if(e.length!==9)return!1;let t=e.split("").map(Number),r=0;for(let n=0;n<9;n++){let i=t[n]*(n%2===0?1:2);i>9&&(i-=9),r+=i}return r%10===0}var ge=class{constructor(t){this.enabledTypes=new Set(t)}detect(t){let r=[],n=new Set;for(let o of ja)if(this.enabledTypes.has(o.type))for(let s of o.patterns){let a=new RegExp(s.source,s.flags),c;for(;(c=a.exec(t))!==null;){let l=c[0],u=`${o.type}:${c.index}`;if(!n.has(u)){if(n.add(u),o.type==="id_number"){let d=l.replace(/\D/g,"");if(/^\d{9}$/.test(l)&&d.length===9&&!Ma(d))continue}r.push({type:o.type,value:l,startIndex:c.index,endIndex:c.index+l.length,confidence:o.confidence,replacement:o.replacement(l,o.type)})}}}r.sort((o,s)=>o.startIndex-s.startIndex||s.confidence-o.confidence);let i=[];for(let o of r)i.some(a=>o.startIndex<a.endIndex&&o.endIndex>a.startIndex)||i.push(o);return i}};var $=["GDPR","CPRA","PPL"],Ha=["GDPR-9","CPRA","PPL"],Ua=[{id:"person_name",type:"name",sensitivity:"high",regulations:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...$],en:["manager","supervisor"],he:["\u05DE\u05E0\u05D4\u05DC \u05D9\u05E9\u05D9\u05E8"]},{id:"education",type:"education",sensitivity:"medium",regulations:[...$],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:[...$],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:[...$],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:[...$],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:[...$],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:[...Ha],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:[...$],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:[...$],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 Ba(e){return e.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim()}function Qr(){return Ua.map(e=>{let t=[...e.en,...e.he??[],...e.ar??[],...e.ru??[]].map(Ba).filter(Boolean);return{type:e.type,tokens:t.filter(r=>!r.includes(" ")),phrases:t.filter(r=>r.includes(" "))}})}var za=[{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 dn(e){let t=String(e??"").replace(/\D/g,"");if(t.length===0||t.length>9)return!1;let r=t.padStart(9,"0"),n=0;for(let i=0;i<9;i++){let o=parseInt(r[i]??"0",10)*(i%2+1);o>9&&(o-=9),n+=o}return n%10===0&&parseInt(r,10)>0}var ct=/(?:\+972[\s-]?|0)(?:5[0-9]|[2-4]|[89])(?:[\s-]?\d){7}/g,lt=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi,dt=/\bIL\d{2}\s?(?:\d{4}\s?){4}\d{3}\b/g;function ei(e){let t=String(e??"").replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let r=0,n=!1;for(let i=t.length-1;i>=0;i--){let o=t.charCodeAt(i)-48;if(o<0||o>9)return!1;n&&(o*=2,o>9&&(o-=9)),r+=o,n=!n}return r%10===0}function ti(e){if(!e)return null;let t=e.trim();for(let r of za)if(r.pattern.test(t))return{type:r.type,label:r.label,labelHe:r.labelHe};return null}var Wa=[{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"]},...Qr(),{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 ut(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 r=new Set(t.match(/[\p{L}\p{N}]+/gu)??[]);for(let n of Wa)if(n.phrases?.some(o=>t.includes(o))||n.tokens?.some(o=>r.has(o)))return{type:n.type,label:n.type,labelHe:ft(n.type)};return null}function ft(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 ni(e){let t=0,r=0,n=0,i=0,o=0;for(let a of e)typeof a=="string"&&(dn(a)&&t++,ct.lastIndex=0,ct.test(a)&&r++,lt.lastIndex=0,lt.test(a)&&n++,dt.lastIndex=0,dt.test(a)&&i++,ei(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}:r/s>=.3?{type:"phone",label:"IL phone (sniffed)",matchedSample:r}:n/s>=.3?{type:"email",label:"Email (sniffed)",matchedSample:n}:o/s>=.3?{type:"financial",label:"Credit card (sniffed)",matchedSample:o}:null}var Va=[{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."}],Ga=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function Ka(e,t,r,n){if(n==="address")return{start:t,end:r};let i=Ga.exec(e.slice(t,r));return i&&t+i[0].length<r?{start:t+i[0].length,end:r}:{start:t,end:r}}function U(e,t,r=()=>!0){let n=[],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||!r(s))continue;let a=(o.index??0)+o[0].indexOf(s);n.push({start:a,end:a+s.length})}return n}var ri=String.raw`[A-Z][a-z']+(?:-[A-Z]?[a-z']+)*`,un=String.raw`${ri}(?:[ \t]+${ri}){0,2}`,Za=new RegExp(String.raw`\b(?:Mr|Mrs|Ms|Miss|Dr|Prof)\.?[ \t]+(${un})`),Xa=new RegExp(String.raw`\b(?:Client|Customer|Patient|Name|Full name|Beneficiary|Insured|Applicant|Tenant|Employee|Holder|Investor)[ \t]*:[ \t]*(${un})`),Ja=new RegExp(String.raw`\b(${un})(?=,[ \t]*\d{1,3}[ \t]*,|[ \t]*\(\d{1,3}\))`,"g"),qa=/^(?: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)$/,Ya=/\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\.?)/,Qa=/\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,ec=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}`,tc=new RegExp(String.raw`\b(?:date\s+of\s+birth|birth\s*date|d\.?o\.?b\.?|born(?:\s+on)?)\s*[:\-]?\s*(${ec})`,"i"),nc=/\b((?!000|666|9\d\d)\d{3}-(?!00)\d{2}-(?!0000)\d{4})\b/,rc=/\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/,ic=/(?<![\w+])(\+(?!972)[1-9][\d\s().-]{7,20}\d)/,ii=e=>e.replace(/\D/g,"").length,oc=[{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=>[...U(Za,e),...U(Xa,e),...U(Ja,e,t=>!qa.test(t.split(/[ \t]/).pop()??""))]},{kind:"address",severity:"medium",hint:"A street address in plaintext.",find:e=>U(Ya,e)},{kind:"reference",severity:"medium",hint:"A policy, claim, account or company number in plaintext.",find:e=>U(Qa,e)},{kind:"dob",severity:"medium",hint:"A date of birth in plaintext.",find:e=>U(tc,e)},{kind:"national_id",severity:"high",hint:"A national ID number (US SSN, UK NINO) in plaintext.",find:e=>[...U(nc,e),...U(rc,e)]},{kind:"phone",severity:"high",hint:"A phone number in international form in plaintext.",find:e=>U(ic,e,t=>ii(t)>=8&&ii(t)<=15)}];function sc(e){let t=new Map;for(let r of e){let n=t.get(r.kind);t.set(r.kind,n?{...n,find:i=>[...n.find(i),...r.find(i)]}:r)}return[...t.values()]}function oi(){let e=Va.map(({type:t,kind:r,severity:n,hint:i})=>{let o=new ge([t]);return{kind:r,severity:n,hint:i,find:s=>o.detect(s).map(a=>Ka(s,a.startIndex,a.endIndex,r))}});return sc([...e,...oc])}var pt={_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 lc=[{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"}],dc=/^(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,uc=/^(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,fc=/^(minor|major|uuid|rssi|tx_?power|beacon_?id|device_?type|firmware_?version|batch_?id|zone_?id)$/i;function si(e,t){if(dc.test(e)||/^name$/i.test(e)||t&&uc.test(t)||fc.test(e))return null;for(let n of lc)if(n.pattern.test(e))return n.type;let r=ti(e);return r?r.type:null}var sf=pt.rules.map(e=>({id:e.id,name:e.name,pattern:new RegExp(e.pattern),severity:e.severity}));var af=512*1024,cf=50*1024*1024;var ci={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 li(e){return ci[e]}function pc(e){return ci[e]??"low"}function di(e,t){let r=[];for(let n of t){let i=n.rows.length;for(let o=0;o<n.headers.length;o++){let s=n.headers[o]??"",a=s?si(s.trim().replace(/["'`׳״:]/g,"").replace(/\s+/g,"_"),n.name)??ut(s)?.type??null:null,c=[];for(let u of n.rows){let d=u[o];typeof d=="string"&&d.length>0&&c.push(d)}let l=c.length>0?ni(c):null;l?r.push(ai(e,n.name,s,l.type,l.label,"value",l.matchedSample,i)):a&&r.push(ai(e,n.name,s,a,ft(a),"header",0,i))}}return r}function ai(e,t,r,n,i,o,s,a){return{file:e,location:t,column:r,type:n,label:i,category:ft(n),severity:pc(n),matchKind:o,hits:s,sampleSize:a}}var hc=new Set(["hex-secret-32","base64-secret"]),mc=[/(?:[$€£]|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 gc(e){let t=new ge(["financial_amount"]);return{kind:"amount",severity:"medium",hint:"A money amount (the amounts dial is on: amounts are treated as sensitive here).",find:r=>{if(!e())return[];let n=t.detect(r).map(o=>({start:o.startIndex,end:o.endIndex}));for(let o of mc){o.lastIndex=0;for(let s of r.matchAll(o))n.push({start:s.index,end:s.index+s[0].length})}n.sort((o,s)=>o.start-s.start||s.end-o.end);let i=[];for(let o of n){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 ui(e={}){let t=e.amounts??(()=>!1),r=[...oi(),gc(t)],n=pt.rules.filter(i=>!hc.has(i.id)).map(i=>({id:i.id,name:i.name,severity:i.severity,pattern:new RegExp(i.pattern)}));return{text:r,amounts:t,header:i=>{let o=ut(i);return o?{type:o.type,label:o.labelHe||o.label}:null},secrets:n,table:i=>di("",[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=>li(i)}}var fi=!1;function pi(){fi||(fi=!0,ht(ui({amounts:cr})))}pi();Yr(process.argv.slice(2)).catch(()=>{process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"ask",permissionDecisionReason:"NoData could not check this file before it is read. Allow anyway?"}}))});