vendor: 8,808 bytes, line 1
1import{A as E,B as _,C as N,M as O,Nb as K,P as m,Sa as T,fa as A,ia as V,p as l,qa as p,r as f,ra as x,ta as w,ua as r,w as S,xb as g}from"./chunk-7XWZXWBR.js";import{a as j}from"./chunk-OXVY4BEJ.js";var L=class{},U=(()=>{class i extends L{getTranslation(e){return l({})}static \u0275fac=(()=>{let e;return function(n){return(e||(e=T(i)))(n||i)}})();static \u0275prov=p({token:i,factory:i.\u0275fac})}return i})(),D=class{},G=(()=>{class i{handle(e){return e.key}static \u0275fac=function(t){return new(t||i)};static \u0275prov=p({token:i,factory:i.\u0275fac})}return i})();function d(i){return typeof i<"u"&&i!==null}function P(i){return i&&typeof i=="object"&&!Array.isArray(i)}function q(i,c){let e=Object.assign({},i);return P(i)&&P(c)&&Object.keys(c).forEach(t=>{P(c[t])?t in i?e[t]=q(i[t],c[t]):Object.assign(e,{[t]:c[t]}):Object.assign(e,{[t]:c[t]})}),e}var C=class{},B=(()=>{class i extends C{templateMatcher=/{{\s?([^{}\s]*)\s?}}/g;interpolate(e,t){let n;return typeof e=="string"?n=this.interpolateString(e,t):typeof e=="function"?n=this.interpolateFunction(e,t):n=e,n}getValue(e,t){let n=typeof t=="string"?t.split("."):[t];t="";do t+=n.shift(),d(e)&&d(e[t])&&(typeof e[t]=="object"||!n.length)?(e=e[t],t=""):n.length?t+=".":e=void 0;while(n.length);return e}interpolateFunction(e,t){return e(t)}interpolateString(e,t){return t?e.replace(this.templateMatcher,(n,s)=>{let a=this.getValue(t,s);return d(a)?a:n}):e}static \u0275fac=(()=>{let e;return function(n){return(e||(e=T(i)))(n||i)}})();static \u0275prov=p({token:i,factory:i.\u0275fac})}return i})(),v=class{},H=(()=>{class i extends v{compile(e,t){return e}compileTranslations(e,t){return e}static \u0275fac=(()=>{let e;return function(n){return(e||(e=T(i)))(n||i)}})();static \u0275prov=p({token:i,factory:i.\u0275fac})}return i})(),y=class{defaultLang;currentLang=this.defaultLang;translations={};langs=[];onTranslationChange=new g;onLangChange=new g;onDefaultLangChange=new g},F=new w("USE_STORE"),M=new w("USE_DEFAULT_LANG"),R=new w("DEFAULT_LANGUAGE"),I=new w("USE_EXTEND"),$=(()=>{class i{store;currentLoader;compiler;parser;missingTranslationHandler;useDefaultLang;isolate;extend;loadingTranslations;pending=!1;_onTranslationChange=new g;_onLangChange=new g;_onDefaultLangChange=new g;_defaultLang;_currentLang;_langs=[];_translations={};_translationRequests={};get onTranslationChange(){return this.isolate?this._onTranslationChange:this.store.onTranslationChange}get onLangChange(){return this.isolate?this._onLangChange:this.store.onLangChange}get onDefaultLangChange(){return this.isolate?this._onDefaultLangChange:this.store.onDefaultLangChange}get defaultLang(){return this.isolate?this._defaultLang:this.store.defaultLang}set defaultLang(e){this.isolate?this._defaultLang=e:this.store.defaultLang=e}get currentLang(){return this.isolate?this._currentLang:this.store.currentLang}set currentLang(e){this.isolate?this._currentLang=e:this.store.currentLang=e}get langs(){return this.isolate?this._langs:this.store.langs}set langs(e){this.isolate?this._langs=e:this.store.langs=e}get translations(){return this.isolate?this._translations:this.store.translations}set translations(e){this.isolate?this._translations=e:this.store.translations=e}constructor(e,t,n,s,a,o=!0,u=!1,h=!1,b){this.store=e,this.currentLoader=t,this.compiler=n,this.parser=s,this.missingTranslationHandler=a,this.useDefaultLang=o,this.isolate=u,this.extend=h,b&&this.setDefaultLang(b)}setDefaultLang(e){if(e===this.defaultLang)return;let t=this.retrieveTranslations(e);typeof t<"u"?(this.defaultLang==null&&(this.defaultLang=e),t.pipe(m(1)).subscribe(n=>{this.changeDefaultLang(e)})):this.changeDefaultLang(e)}getDefaultLang(){return this.defaultLang}use(e){if(e===this.currentLang)return l(this.translations[e]);let t=this.retrieveTranslations(e);return typeof t<"u"?(this.currentLang||(this.currentLang=e),t.pipe(m(1)).subscribe(n=>{this.changeLang(e)}),t):(this.changeLang(e),l(this.translations[e]))}retrieveTranslations(e){let t;return(typeof this.translations[e]>"u"||this.extend)&&(this._translationRequests[e]=this._translationRequests[e]||this.getTranslation(e),t=this._translationRequests[e]),t}getTranslation(e){this.pending=!0;let t=this.currentLoader.getTranslation(e).pipe(A(1),m(1));return this.loadingTranslations=t.pipe(S(n=>this.compiler.compileTranslations(n,e)),A(1),m(1)),this.loadingTranslations.subscribe({next:n=>{this.translations[e]=this.extend&&this.translations[e]?j(j({},n),this.translations[e]):n,this.updateLangs(),this.pending=!1},error:n=>{this.pending=!1}}),t}setTranslation(e,t,n=!1){t=this.compiler.compileTranslations(t,e),(n||this.extend)&&this.translations[e]?this.translations[e]=q(this.translations[e],t):this.translations[e]=t,this.updateLangs(),this.onTranslationChange.emit({lang:e,translations:this.translations[e]})}getLangs(){return this.langs}addLangs(e){e.forEach(t=>{this.langs.indexOf(t)===-1&&this.langs.push(t)})}updateLangs(){this.addLangs(Object.keys(this.translations))}getParsedResult(e,t,n){let s;if(t instanceof Array){let a={},o=!1;for(let u of t)a[u]=this.getParsedResult(e,u,n),f(a[u])&&(o=!0);if(o){let u=t.map(h=>f(a[h])?a[h]:l(a[h]));return N(u).pipe(S(h=>{let b={};return h.forEach((J,X)=>{b[t[X]]=J}),b}))}return a}if(e&&(s=this.parser.interpolate(this.parser.getValue(e,t),n)),typeof s>"u"&&this.defaultLang!=null&&this.defaultLang!==this.currentLang&&this.useDefaultLang&&(s=this.parser.interpolate(this.parser.getValue(this.translations[this.defaultLang],t),n)),typeof s>"u"){let a={key:t,translateService:this};typeof n<"u"&&(a.interpolateParams=n),s=this.missingTranslationHandler.handle(a)}return typeof s<"u"?s:t}get(e,t){if(!d(e)||!e.length)throw new Error('Parameter "key" required');if(this.pending)return this.loadingTranslations.pipe(O(n=>(n=this.getParsedResult(n,e,t),f(n)?n:l(n))));{let n=this.getParsedResult(this.translations[this.currentLang],e,t);return f(n)?n:l(n)}}getStreamOnTranslationChange(e,t){if(!d(e)||!e.length)throw new Error('Parameter "key" required');return E(_(()=>this.get(e,t)),this.onTranslationChange.pipe(V(n=>{let s=this.getParsedResult(n.translations,e,t);return typeof s.subscribe=="function"?s:l(s)})))}stream(e,t){if(!d(e)||!e.length)throw new Error('Parameter "key" required');return E(_(()=>this.get(e,t)),this.onLangChange.pipe(V(n=>{let s=this.getParsedResult(n.translations,e,t);return f(s)?s:l(s)})))}instant(e,t){if(!d(e)||!e.length)throw new Error('Parameter "key" required');let n=this.getParsedResult(this.translations[this.currentLang],e,t);if(f(n)){if(e instanceof Array){let s={};return e.forEach((a,o)=>{s[e[o]]=e[o]}),s}return e}else return n}set(e,t,n=this.currentLang){this.translations[n][e]=this.compiler.compile(t,n),this.updateLangs(),this.onTranslationChange.emit({lang:n,translations:this.translations[n]})}changeLang(e){this.currentLang=e,this.onLangChange.emit({lang:e,translations:this.translations[e]}),this.defaultLang==null&&this.changeDefaultLang(e)}changeDefaultLang(e){this.defaultLang=e,this.onDefaultLangChange.emit({lang:e,translations:this.translations[e]})}reloadLang(e){return this.resetLang(e),this.getTranslation(e)}resetLang(e){this._translationRequests[e]=void 0,this.translations[e]=void 0}getBrowserLang(){if(typeof window>"u"||typeof window.navigator>"u")return;let e=window.navigator.languages?window.navigator.languages[0]:null;if(e=e||window.navigator.language||window.navigator.browserLanguage||window.navigator.userLanguage,!(typeof e>"u"))return e.indexOf("-")!==-1&&(e=e.split("-")[0]),e.indexOf("_")!==-1&&(e=e.split("_")[0]),e}getBrowserCultureLang(){if(typeof window>"u"||typeof window.navigator>"u")return;let e=window.navigator.languages?window.navigator.languages[0]:null;return e=e||window.navigator.language||window.navigator.browserLanguage||window.navigator.userLanguage,e}static \u0275fac=function(t){return new(t||i)(r(y),r(L),r(v),r(C),r(D),r(M),r(F),r(I),r(R))};static \u0275prov=p({token:i,factory:i.\u0275fac})}return i})();var ue=(()=>{class i{static forRoot(e={}){return{ngModule:i,providers:[e.loader||{provide:L,useClass:U},e.compiler||{provide:v,useClass:H},e.parser||{provide:C,useClass:B},e.missingTranslationHandler||{provide:D,useClass:G},y,{provide:F,useValue:e.isolate},{provide:M,useValue:e.useDefaultLang},{provide:I,useValue:e.extend},{provide:R,useValue:e.defaultLanguage},$]}}static forChild(e={}){return{ngModule:i,providers:[e.loader||{provide:L,useClass:U},e.compiler||{provide:v,useClass:H},e.parser||{provide:C,useClass:B},e.missingTranslationHandler||{provide:D,useClass:G},{provide:F,useValue:e.isolate},{provide:M,useValue:e.useDefaultLang},{provide:I,useValue:e.extend},{provide:R,useValue:e.defaultLanguage},$]}}static \u0275fac=function(t){return new(t||i)};static \u0275mod=K({type:i});static \u0275inj=x({})}return i})();export{L as a,$ as b,ue as c};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.