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