{"version":3,"file":"hug-ngx-g11n.mjs","names":[],"sources":["../../../projects/lib/new/ngx-g11n.provider.ts","../../../projects/lib/new/ngx-g11n.module.ts"],"sourcesContent":["import {\n    type HttpEvent, type HttpHandlerFn, type HttpRequest, provideHttpClient, withInterceptors,\n} from '@angular/common/http';\nimport { type EnvironmentProviders, inject, LOCALE_ID, makeEnvironmentProviders, type Provider } from '@angular/core';\nimport {\n    DEFAULT_OPTIONS, G11N_OPTIONS, type G11nFeature, type G11nLocale, type G11nOptions, init, LOCALES,\n} from '@hug/ngx-g11n/internal';\nimport type { Observable } from 'rxjs';\n\nexport const withInterceptor = (): G11nFeature<EnvironmentProviders> => ({\n    providers: [\n        provideHttpClient(withInterceptors([\n            (req: HttpRequest<unknown>, next$: HttpHandlerFn): Observable<HttpEvent<unknown>> => {\n                const headers = req.headers.set('Accept-Language', inject(LOCALE_ID));\n                return next$(req.clone({ headers }));\n            },\n        ])),\n    ],\n});\n\nexport const withLocales = (locales: Record<string, G11nLocale>): G11nFeature => ({\n    providers: [\n        { provide: LOCALES, useValue: locales },\n    ],\n});\n\nexport const withOptions = (options: G11nOptions): G11nFeature => ({\n    providers: [\n        { provide: G11N_OPTIONS, useValue: { ...DEFAULT_OPTIONS, ...options } },\n    ],\n});\n\nexport const provideG11n = (...features: G11nFeature<Provider | EnvironmentProviders>[]): EnvironmentProviders =>\n    makeEnvironmentProviders([\n        init(),\n        features.map(feature => feature.providers),\n    ]);\n","import { type EnvironmentProviders, type ModuleWithProviders, NgModule, type Provider } from '@angular/core';\nimport type { G11nFeature } from '@hug/ngx-g11n/internal';\n\nimport { provideG11n } from './ngx-g11n.provider';\n\n@NgModule()\nexport class G11nModule {\n    public static forRoot(...features: G11nFeature<Provider | EnvironmentProviders>[]): ModuleWithProviders<G11nModule> {\n        return {\n            ngModule: G11nModule,\n            providers: [\n                provideG11n(...features),\n            ],\n        };\n    }\n}\n"],"mappings":";;;;AASA,MAAa,yBAA4D,EACrE,WAAW,CACP,kBAAkB,iBAAiB,EAC9B,KAA2B,UAAwD;CAChF,MAAM,UAAU,IAAI,QAAQ,IAAI,mBAAmB,OAAO,SAAS,CAAC;CACpE,OAAO,MAAM,IAAI,MAAM,EAAE,QAAO,CAAE,CAAC;AACvC,CACH,CAAA,CAAC,CACL,EACJ;AAED,MAAa,eAAe,aAAsD,EAC9E,WAAW,CACP;CAAE,SAAS;CAAS,UAAU;AAAO,CACxC,EACJ;AAED,MAAa,eAAe,aAAuC,EAC/D,WAAW,CACP;CAAE,SAAS;CAAc,UAAU;EAAE,GAAG;EAAiB,GAAG;CAAO;AAAE,CACxE,EACJ;AAED,MAAa,eAAe,GAAG,aAC3B,yBAAyB,CACrB,KAAI,GACJ,SAAS,KAAI,YAAW,QAAQ,SAAS,CAC5C,CAAA;AC9BL,IAAa,aAAb,MAAa,WAAU;CACZ,OAAO,QAAQ,GAAG,UAAwD;EAC7E,OAAO;GACH,UAAU;GACV,WAAW,CACP,YAAY,GAAG,QAAQ,CAC1B;EACJ;CACL;CARS,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAU,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAV,OAAA,OAAA,GAAA,oBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAU,CAAA;CAAV,OAAA,OAAA,GAAA,oBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAU,CAAA;;AAAV,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA,EADtB,MAAA,SAAA,CAAA"}