import{logger as e}from"../../../logger/index.mjs";import{extractJson as t,generateText as n}from"@intlayer/ai";import{readFileSync as r}from"node:fs";import{dirname as i,join as a}from"node:path";import{fileURLToPath as o}from"node:url";import{DefaultValues as s}from"@intlayer/config/client";import{getLocaleName as c}from"@intlayer/core/localization";const l=r(a(i(o(import.meta.url)),`./PROMPT.md`),`utf-8`),u={},d=e=>`${e}: ${c(e,s.Internationalization.DEFAULT_LOCALE)}`,f=e=>!e||e.length===0?``:[`Based on the dictionary content, identify specific tags from the list below that would be relevant:`,e.map(({key:e,description:t})=>`- ${e}: ${t}`).join(`

`)].join(`

`),p=async({fileContent:r,filePath:i,locales:a,defaultLocale:o,tags:s,aiConfig:c,applicationContext:u})=>{let p=a.filter(e=>e!==o),m=l.replace(`{{defaultLocale}}`,d(o)).replace(`{{otherLocales}}`,`{${p.map(d).join(`, `)}}`).replace(`{{filePath}}`,i??``).replace(`{{applicationContext}}`,u??``).replace(`{{tagsInstructions}}`,f(s)),{text:h,usage:g}=await n({...c,messages:[{role:`system`,content:m},{role:`user`,content:[`**File to Audit:**`,r].join(`
`)}]});return e.info(`${g?.totalTokens??0} tokens used in the request`),{fileContent:t(h),tokenUsed:g?.totalTokens??0}};export{u as aiDefaultOptions,p as auditDictionary};
//# sourceMappingURL=index.mjs.map