import{__exports as t}from"../../../../../_virtual/sync5.mjs";import{__require as e}from"../../../fs.scandir/out/index.mjs";import{__require as s}from"./common.mjs";import{__require as r}from"./reader.mjs";var i;function o(){if(i)return t;i=1,Object.defineProperty(t,"__esModule",{value:!0});const o=e(),a=s(),n=r();class h extends n.default{constructor(){super(...arguments),this._scandir=o.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(t,e){this._queue.add({directory:t,base:e})}_handleQueue(){for(const t of this._queue.values())this._handleDirectory(t.directory,t.base)}_handleDirectory(t,e){try{const s=this._scandir(t,this._settings.fsScandirSettings);for(const t of s)this._handleEntry(t,e)}catch(t){this._handleError(t)}}_handleError(t){if(a.isFatalError(this._settings,t))throw t}_handleEntry(t,e){const s=t.path;void 0!==e&&(t.path=a.joinPathSegments(e,t.name,this._settings.pathSegmentSeparator)),a.isAppliedFilter(this._settings.entryFilter,t)&&this._pushToStorage(t),t.dirent.isDirectory()&&a.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(s,void 0===e?void 0:t.path)}_pushToStorage(t){this._storage.push(t)}}return t.default=h,t}export{o as __require};