const e=require("fs"),n=require("path"),t=require("fmerge"),r=require("rimraf");let i,o;function s(n,t){const r=e.statSync(n).mtime.getTime();return i>r+1e3*t}function c(e){return e&&"limit"in e}function u(e){return e&&"totalRemoved"in e}function f(e){return u(e)?e.totalRemoved:-2}function l(e){return f(e)>=function(e){return c(e)?e.limit:-1}(e)}function a(e){return e&&"maxLevel"in e}function d(e){return a(e)?e.maxLevel:-1}function m(e){return e&&e.age&&e.age.seconds?e.age.seconds:null}const y=module.exports=function(x,g,v){let A={};if(!l(g)&&e.existsSync(x)){const O=d(g);let h=!1;c(g)&&(g.totalRemoved=u(g)?f(g):0),void 0===v?v=0:v++,v<1?(i=(new Date).getTime(),o=function(e){return!(!e||!("test"in e))&&e.test}(g)):h=function(e,t,r){let i=!1;const o=t&&t.dir;if(o){const u=m(t),f=n.basename(e);Array.isArray(o)?i=-1!==o.indexOf("*")||-1!==o.indexOf(f):f!==o&&"*"!==o||(i=!0),i&&c(t)&&(i=!l(t)),i&&a(t)&&r>0&&(i=r<=d(t)),u&&i&&(i=s(e,u))}return i}(x,g,v),(-1===O||v<O)&&e.readdirSync(x).forEach(function(r){const i=n.join(x,r);let f,a=!1;try{f=e.statSync(i)}catch(e){a=!0}if(a);else if(f.isDirectory()){const e=y(i,g,v);A=t(A,e),u(g)&&(g.totalRemoved+=Object.keys(e).length)}else if(function(e,t={}){let r=!1;const i=t.extensions?t.extensions:null,o=t.files?t.files:null,u=t.prefix?t.prefix:null,f=t&&t.ignore?t.ignore:null,a=n.basename(e);if(o&&(r=Array.isArray(o)?-1!==o.indexOf("*.*")||-1!==o.indexOf(a):"*.*"===o||a===o),!r&&i){const t=n.extname(e);r=Array.isArray(i)?-1!==i.indexOf(t):t===i}if(!r&&u&&(r=0===a.indexOf(u)),r&&c(t)&&(r=!l(t)),r&&f&&(r=Array.isArray(f)?!(-1!==f.indexOf(a)):!(a===f)),r){const n=m(t);n&&(r=s(e,n))}return r}(i,g)){let n;if(o)n=!0;else try{e.unlinkSync(i),n=!0}catch(e){}n&&(A[i]=!0,u(g)&&g.totalRemoved++)}}),h&&(o||r.sync(x),u(g)||(A[x]=!0))}return A};
//# sourceMappingURL=find-remove.modern.js.map
