1import{A as f,x as l}from"./chunk-XNTCN5LM.js";import{Y as m}from"./chunk-5LGYDGR4.js";import{a as d,b as g}from"./chunk-HIUAR4UN.js";var p=["arse","asshole","bastard","bitch","cunt","damn","dick","douchebag","fuck","jackass","piss","prick","pussy","shit","slut","twat","wanker","whore"],h=class c{static{this.multipleSpaceRegex=new RegExp("\\s{2,}")}static{this.countryCodePostalRegexMap={US:/^\d{5}[ |-]\d{4}$|^\d{5}$|^\d{9}$/,CA:/^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i}}static validateEitherEmailOrUsername(){return e=>e.value?e.value.indexOf("@")!==-1?new f(e.value,[l.required,l.pattern(/^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/)]).valid?null:{validEmail:!0}:new f(e.value,[l.required,l.minLength(6),l.maxLength(20),l.pattern(/^[a-z|A-Z|0-9|_-]*$/)]).valid?null:{validUsername:!0}:null}static compareControls(e,r,t=(a,s)=>a===s?{controlsMatch:!0}:{controlsMatch:null}){return a=>{let s,i,n=a.get(r);a.get(e)?(s=a.get(e),i=s?.value):i=e;let o={has_errors:!1};if(n||(o.controls_not_found=o.controls_not_found??[],o.controls_not_found.push({name:r}),o.has_errors=!0),i&&n?.value){let u=t(i,n.value);u&&(u[Object.keys(u)[0]]!=null?(o.has_errors=!0,u=Object.assign(u,n.errors),n.setErrors(u)):n.errors&&(delete n.errors[Object.keys(u)[0]],Object.keys(n.errors).length==0&&n.setErrors(null)))}return o.has_errors?o:null}}static trimSpaces(){return e=>{let r={has_errors:!1},t="";return e.value&&(t=e.value),(t&&t.trim()!==t||this.multipleSpaceRegex.test(t))&&(r.hasSpaces=!0,r.has_errors=!0),r.has_errors?r:null}}static passwordChange(e){return c.compareControls("oldPassword","newPassword")(e)}static passwordUser(e){return c.compareControls("userName","password",(r,t)=>t.toLowerCase().includes(r.toLowerCase())?{containsUsername:!0}:{containsUsername:null})(e)}static postalCodePattern(){return e=>{let r={has_errors:!1},t=e.get("countryCode"),a=this.countryCodePostalRegexMap[t?.value],s=e.get("postalCode");
1return s?.value&&a&&!a.test(s.value)&&(r.invalidPattern=!0,r.has_errors=!0,s.setErrors(g(d({},s.errors||{}),{invalidPattern:r.invalidPattern}))),r.has_errors?r:null}}static ageValidator(e,r){return t=>{if(!t.value)return null;let a={has_errors:!1},s=new Date(t.value),i=new Date;if(Number.isNaN(s.getTime())||s.getTime()>i.getTime())return a.minAge=!0,a.has_errors=!0,a;let n=this.differenceInYears(i,s);return e!==void 0&&n<e?(a.minAge=!0,a.has_errors=!0,a):r!==void 0&&n>r?(a.maxAge=!0,a.has_errors=!0,a.ageDifference=n,a):null}}static differenceInYears(e,r){let t=e.getTime()-r.getTime(),a=new Date(t);return Math.abs(a.getFullYear()-new Date(0).getFullYear())}static integerValidator(){return e=>Number.isSafeInteger(e.value)?null:{notInteger:e.value}}static maxDecimalDigitValidator(e){return r=>{if(Number.isNaN(r.value))return{notInteger:r.value};let t=this.countDecimalDigits(r.value);return t<=e?null:{maxDecimalDigit:{actual:t,max:e}}}}static numericValidator(){return e=>this.numbericRegex.test(e.value)?null:{numeric:e.value}}static{this.numbericRegex=/^\d+(?:(?:\.|,){1}\d+)?$/}static{this.countDecimalDigits=e=>Math.floor(e)===e?0:e.toString().split(".")[1].length}static profanityRegExp(e){let r=[...e].sort((t,a)=>a.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");return new RegExp(r,"i")}static{this.PROFANITY_BLOCKLIST_REGEXP=c.profanityRegExp(p)}static noProfanity(){return e=>{let r=e.value??"",t=r.replace(/[^a-zA-Z\s]/g,"");return r&&this.PROFANITY_BLOCKLIST_REGEXP.test(t)?{profanity:!0}:null}}static{this.\u0275fac=function(r){return new(r||c)}}static{this.\u0275prov=m({token:c,factory:c.\u0275fac,providedIn:"root"})}};export{h as a};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.