import{__exports as t}from"../../../../../_virtual/deep.mjs";import{__require as e}from"../../utils/index.mjs";import{__require as i}from"../matchers/partial.mjs";var r;function s(){if(r)return t;r=1,Object.defineProperty(t,"__esModule",{value:!0});const s=e(),n=i();return t.default=class{constructor(t,e){this._settings=t,this._micromatchOptions=e}getFilter(t,e,i){const r=this._getMatcher(e),s=this._getNegativePatternsRe(i);return e=>this._filter(t,e,r,s)}_getMatcher(t){return new n.default(t,this._settings,this._micromatchOptions)}_getNegativePatternsRe(t){const e=t.filter(s.pattern.isAffectDepthOfReadingPattern);return s.pattern.convertPatternsToRe(e,this._micromatchOptions)}_filter(t,e,i,r){if(this._isSkippedByDeep(t,e.path))return!1;if(this._isSkippedSymbolicLink(e))return!1;const n=s.path.removeLeadingDotSegment(e.path);return!this._isSkippedByPositivePatterns(n,i)&&this._isSkippedByNegativePatterns(n,r)}_isSkippedByDeep(t,e){return this._settings.deep!==1/0&&this._getEntryLevel(t,e)>=this._settings.deep}_getEntryLevel(t,e){const i=e.split("/").length;if(""===t)return i;return i-t.split("/").length}_isSkippedSymbolicLink(t){return!this._settings.followSymbolicLinks&&t.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(t,e){return!this._settings.baseNameMatch&&!e.match(t)}_isSkippedByNegativePatterns(t,e){return!s.pattern.matchAny(t,e)}},t}export{s as __require};