{"version":3,"sources":["/home/mkabumattar/work/withrawi/rawi/dist/chunk-3ZXX3ML2.cjs","../src/core/file-readers/readers/base.reader.ts"],"names":["AbstractFileReader","BaseFileReader","options","filePath","fs","stat","exists","size"],"mappings":"AAAA;AACA,wDAAwC,ICElBA,CAAAA,CAAf,MAAA,QAA0CC,mBAAe,CAC9D,WAAA,CAAYC,CAAAA,CAA6B,CAAC,CAAA,CAAG,CAC3C,KAAA,CAAMA,CAAO,CACf,CAEA,MAAgB,YAAA,CACdC,CAAAA,CAC0C,CAC1C,GAAM,CAAC,QAAA,CAAUC,CAAE,CAAA,CAAI,MAAM,4DAAA,CAAO,IAAS,GAAA,CACvC,CAAC,IAAA,CAAAC,CAAI,CAAA,CAAID,CAAAA,CAEf,GAAI,CAEF,MAAO,CACL,IAAA,CAAA,CAFY,MAAMC,CAAAA,CAAKF,CAAQ,CAAA,CAAA,CAEnB,IAAA,CACZ,MAAA,CAAQ,CAAA,CACV,CACF,CAAA,UAAQ,CACN,MAAO,CACL,IAAA,CAAM,CAAA,CACN,MAAA,CAAQ,CAAA,CACV,CACF,CACF,CAEA,MAAgB,YAAA,CAAaA,CAAAA,CAAiC,CAC5D,GAAM,CAAC,MAAA,CAAAG,CAAAA,CAAQ,IAAA,CAAAC,CAAI,CAAA,CAAI,MAAM,IAAA,CAAK,YAAA,CAAaJ,CAAQ,CAAA,CAEvD,EAAA,CAAI,CAACG,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,CAAA,gBAAA,EAAmBH,CAAQ,CAAA,CAAA;AD9B2S","file":"/home/mkabumattar/work/withrawi/rawi/dist/chunk-3ZXX3ML2.cjs","sourcesContent":[null,"import type {FileReaderOptions} from '../interfaces/types.js';\nimport {BaseFileReader} from '../interfaces/types.js';\n\nexport abstract class AbstractFileReader extends BaseFileReader {\n  constructor(options: FileReaderOptions = {}) {\n    super(options);\n  }\n\n  protected async getFileStats(\n    filePath: string,\n  ): Promise<{size: number; exists: boolean}> {\n    const {promises: fs} = await import('node:fs');\n    const {stat} = fs;\n\n    try {\n      const stats = await stat(filePath);\n      return {\n        size: stats.size,\n        exists: true,\n      };\n    } catch {\n      return {\n        size: 0,\n        exists: false,\n      };\n    }\n  }\n\n  protected async validateFile(filePath: string): Promise<void> {\n    const {exists, size} = await this.getFileStats(filePath);\n\n    if (!exists) {\n      throw new Error(`File not found: ${filePath}`);\n    }\n\n    this.validateFileSize(size);\n  }\n\n  protected logVerbose(message: string): void {\n    if (this.options.verbose) {\n      console.log(`[FileReader] ${message}`);\n    }\n  }\n\n  protected handleError(error: unknown, filePath: string): never {\n    const errorMessage = error instanceof Error ? error.message : String(error);\n    throw new Error(`Failed to read file \"${filePath}\": ${errorMessage}`);\n  }\n}\n"]}