@tolgee/core 4.7.0 → 4.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tolgee.cjs.js +2 -4
- package/dist/tolgee.cjs.js.map +1 -1
- package/dist/tolgee.cjs.min.js +1 -1
- package/dist/tolgee.cjs.min.js.map +1 -1
- package/dist/{tolgee.esm.js → tolgee.esm.min.mjs} +2 -2
- package/dist/tolgee.esm.min.mjs.map +1 -0
- package/dist/tolgee.esm.mjs +5690 -0
- package/dist/tolgee.esm.mjs.map +1 -0
- package/dist/tolgee.umd.js +2 -4
- package/dist/tolgee.umd.js.map +1 -1
- package/dist/tolgee.umd.min.js +1 -1
- package/dist/tolgee.umd.min.js.map +1 -1
- package/package.json +10 -9
- package/src/Constants/Global.ts +9 -0
- package/src/Constants/ModifierKey.ts +6 -0
- package/src/Errors/ApiHttpError.ts +8 -0
- package/src/Observer.test.ts +119 -0
- package/src/Observer.ts +68 -0
- package/src/Properties.test.ts +150 -0
- package/src/Properties.ts +112 -0
- package/src/Tolgee.test.ts +473 -0
- package/src/Tolgee.ts +335 -0
- package/src/TolgeeConfig.test.ts +21 -0
- package/src/TolgeeConfig.ts +134 -0
- package/src/__integration/FormatterIcu.test.ts +80 -0
- package/src/__integration/FormatterMissing.ts +54 -0
- package/src/__integration/Tolgee.test.ts +90 -0
- package/src/__integration/TolgeeInvisible.test.ts +145 -0
- package/src/__integration/mockTranslations.ts +6 -0
- package/src/__integration/testConfig.ts +16 -0
- package/src/__testFixtures/classMock.ts +11 -0
- package/src/__testFixtures/createElement.ts +43 -0
- package/src/__testFixtures/createTestDom.ts +25 -0
- package/src/__testFixtures/mocked.ts +25 -0
- package/src/__testFixtures/setupAfterEnv.ts +34 -0
- package/src/helpers/NodeHelper.ts +90 -0
- package/src/helpers/TextHelper.test.ts +62 -0
- package/src/helpers/TextHelper.ts +58 -0
- package/src/helpers/commonTypes.ts +8 -0
- package/src/helpers/encoderPolyfill.ts +96 -0
- package/src/helpers/secret.test.ts +61 -0
- package/src/helpers/secret.ts +68 -0
- package/src/helpers/sleep.ts +2 -0
- package/src/highlighter/HighlightFunctionsInitializer.test.ts +40 -0
- package/src/highlighter/HighlightFunctionsInitializer.ts +61 -0
- package/src/highlighter/MouseEventHandler.test.ts +151 -0
- package/src/highlighter/MouseEventHandler.ts +191 -0
- package/src/highlighter/TranslationHighlighter.test.ts +177 -0
- package/src/highlighter/TranslationHighlighter.ts +113 -0
- package/src/index.ts +10 -0
- package/src/internal.ts +2 -0
- package/src/modules/IcuFormatter.ts +17 -0
- package/src/modules/index.ts +1 -0
- package/src/services/ApiHttpService.ts +85 -0
- package/src/services/CoreService.test.ts +142 -0
- package/src/services/CoreService.ts +76 -0
- package/src/services/DependencyService.test.ts +51 -0
- package/src/services/DependencyService.ts +116 -0
- package/src/services/ElementRegistrar.test.ts +131 -0
- package/src/services/ElementRegistrar.ts +108 -0
- package/src/services/EventEmitter.ts +52 -0
- package/src/services/EventService.ts +14 -0
- package/src/services/ModuleService.ts +14 -0
- package/src/services/ScreenshotService.ts +31 -0
- package/src/services/Subscription.ts +7 -0
- package/src/services/TextService.test.ts +88 -0
- package/src/services/TextService.ts +82 -0
- package/src/services/TranslationService.test.ts +358 -0
- package/src/services/TranslationService.ts +417 -0
- package/src/services/__mocks__/CoreService.ts +17 -0
- package/src/toolsManager/Messages.test.ts +79 -0
- package/src/toolsManager/Messages.ts +60 -0
- package/src/toolsManager/PluginManager.test.ts +108 -0
- package/src/toolsManager/PluginManager.ts +129 -0
- package/src/types/DTOs.ts +25 -0
- package/src/types/apiSchema.generated.ts +6208 -0
- package/src/types.ts +146 -0
- package/src/wrappers/AbstractWrapper.ts +14 -0
- package/src/wrappers/NodeHandler.ts +143 -0
- package/src/wrappers/WrappedHandler.ts +28 -0
- package/src/wrappers/invisible/AttributeHandler.ts +23 -0
- package/src/wrappers/invisible/Coder.ts +65 -0
- package/src/wrappers/invisible/ContentHandler.ts +15 -0
- package/src/wrappers/invisible/CoreHandler.ts +17 -0
- package/src/wrappers/invisible/InvisibleWrapper.ts +59 -0
- package/src/wrappers/invisible/ValueMemory.test.ts +25 -0
- package/src/wrappers/invisible/ValueMemory.ts +16 -0
- package/src/wrappers/text/AttributeHandler.test.ts +117 -0
- package/src/wrappers/text/AttributeHandler.ts +25 -0
- package/src/wrappers/text/Coder.test.ts +298 -0
- package/src/wrappers/text/Coder.ts +202 -0
- package/src/wrappers/text/ContentHandler.test.ts +185 -0
- package/src/wrappers/text/ContentHandler.ts +21 -0
- package/src/wrappers/text/CoreHandler.test.ts +106 -0
- package/src/wrappers/text/CoreHandler.ts +45 -0
- package/src/wrappers/text/TextWrapper.ts +69 -0
- package/dist/tolgee.esm.js.map +0 -1
package/dist/tolgee.umd.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/core"]={})}(this,(function(e){"use strict";var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function i(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function u(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var c,l="__tolgee_preferredLanguages",h="__tolgee_currentLanguage",p=function(){function e(){}return Object.defineProperty(e.prototype,"currentLanguage",{get:function(){var e;return(null===(e=this.config)||void 0===e?void 0:e.forceLanguage)?this.config.forceLanguage:(this._currentLanguage||(this._currentLanguage=this.getInitialLanguage()),this._currentLanguage)},set:function(e){var t;if(!e)throw new Error("Setting invalid language value ".concat(e));this._currentLanguage=e,(null===(t=this.config)||void 0===t?void 0:t.enableLanguageStore)&&"undefined"!=typeof localStorage&&localStorage.setItem(h,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"preferredLanguages",{get:function(){return new Set(JSON.parse(localStorage.getItem(l)))},set:function(e){localStorage.setItem(l,JSON.stringify(Array.from(e)))},enumerable:!1,configurable:!0}),e.prototype.getInitialLanguage=function(){if(this.config.enableLanguageStore){var e=this.getStoredLanguage();if(e)return e}if(this.config.enableLanguageDetection){var t=this.getLanguageByNavigator();if(t)return t}return this.config.defaultLanguage},e.prototype.getStoredLanguage=function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(h);if(!this.config.availableLanguages)return e;if(this.config.availableLanguages.indexOf(e)>-1)return e}},e.prototype.getLanguageByNavigator=function(){if("undefined"!=typeof window&&this.config.availableLanguages){var e=window.navigator.language,t=this.config.availableLanguages.find((function(t){return t===e}));if(t)return t;var n=function(e){return e.replace(/^(.+?)(-.*)?$/,"$1")},r=n(window.navigator.language),i=this.config.availableLanguages.find((function(e){return n(e)===r}));if(i)return i}},e}(),f=function(){function e(e){this.onUnsubscribe=e}return e.prototype.unsubscribe=function(){this.onUnsubscribe()},e}(),d=function(){function e(){this.idCounter=0,this._subscriptions=new Map}return Object.defineProperty(e.prototype,"subscriptions",{get:function(){return this._subscriptions},enumerable:!1,configurable:!0}),e.prototype.emit=function(e){var t,n,r=[];try{for(var i=s(this.subscriptions.values()),o=i.next();!o.done;o=i.next()){var a=(0,o.value)(e);"function"==typeof(null==a?void 0:a.then)&&r.push(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}if(0!==r.length)return new Promise((function(e){return Promise.all(r).then((function(){return e()}))}))},e.prototype.subscribe=function(e){var t=this,n=this.idCounter++,r=new f((function(){return t.unsubscribe(n)}));return this.subscriptions.set(n,e),r},e.prototype.unsubscribe=function(e){this._subscriptions.delete(e)||console.warn("Event to unsubscribe was not found")},e}(),g=function(){this.TRANSLATION_CHANGED=new d,this.LANGUAGE_CHANGED=new d,this.LANGUAGE_LOADED=new d,this.ELEMENT_REGISTERED=new d},v=function(e){function t(n,r){var i=e.call(this,"Api http error")||this;return i.response=n,i.code=r,Object.setPrototypeOf(i,t.prototype),i}return n(t,e),t}(Error),y=function(){function e(e){this.properties=e}return e.handleErrors=function(e){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:if(!(e.status>=400))return[3,5];t=new v(e),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e.json()];case 2:return n=r.sent(),t.code=n.code,[3,4];case 3:return r.sent(),console.warn("Tolgee server responded with invalid status code."),[3,4];case 4:throw t;case 5:return[2,e]}}))}))},e.prototype.fetch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return i(this,void 0,void 0,(function(){var n,i,s;return o(this,(function(o){return"object"==typeof t[0]?[2,fetch(r(r({},t[0]),{url:this.getUrl(t[0].url)})).then((function(t){return e.handleErrors(t)}))]:(n=a(t),i=n[0],s=n.slice(1),[2,fetch.apply(void 0,u([this.getUrl(i)],a(s),!1)).then((function(t){return e.handleErrors(t)}))])}))}))},e.prototype.fetchJson=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.fetch.apply(this,u([],a(e),!1)).then((function(e){return e.json()}))]}))}))},e.prototype.post=function(e,t,n){void 0===n&&(n={});for(var s=[],c=3;c<arguments.length;c++)s[c-3]=arguments[c];return i(this,void 0,void 0,(function(){return o(this,(function(i){return[2,this.fetch.apply(this,u([e,r({body:JSON.stringify(t),method:"POST",headers:{"Content-Type":"application/json"}},n)],a(s),!1))]}))}))},e.prototype.postJson=function(e,t,n){void 0===n&&(n={});for(var r=[],s=3;s<arguments.length;s++)r[s-3]=arguments[s];return i(this,void 0,void 0,(function(){return o(this,(function(i){return[2,this.post.apply(this,u([e,t,n],a(r),!1)).then((function(e){return e.json()}))]}))}))},e.prototype.getUrl=function(e){var t=e.indexOf("?")<0?"?":"&";return"".concat(this.properties.config.apiUrl,"/").concat(e).concat(t,"ak=").concat(this.properties.config.apiKey)},e}(),m=function(e,t,n){this.key=e,this.translations=t,this.id=n},E=function(){function e(e,t,n,s){var c=this;this.properties=e,this.coreService=t,this.apiHttpService=n,this.eventService=s,this.translationsCache=new Map,this.fetchPromises={},this.fetchedDev={},this.updateTranslationInCache=function(e){return i(c,void 0,void 0,(function(){var t,n=this;return o(this,(function(r){switch(r.label){case 0:return t={},Object.entries(e.translations).forEach((function(r){var i=a(r,2),o=i[0],s=i[1],u=n.translationsCache.get(o);u&&(u[e.name]=s.text),t[o]=s.text})),[4,this.eventService.TRANSLATION_CHANGED.emit(new m(e.name,t,e.id))];case 1:return r.sent(),[2]}}))}))},this.getTranslationsOfKey=function(e,t){return void 0===t&&(t=new Set([c.properties.currentLanguage])),i(c,void 0,void 0,(function(){var n,i,s,c,l,h,p,f,d,g,y;return o(this,(function(o){switch(o.label){case 0:this.coreService.checkScope("translations.view"),o.label=1;case 1:return o.trys.push([1,3,,7]),n=u([],a(t),!1),i=n.map((function(e){return"languages=".concat(e)})).join("&"),[4,this.apiHttpService.fetchJson("v2/projects/translations?".concat(i,"&filterKeyName=").concat(encodeURIComponent(e)))];case 2:return s=o.sent(),c=n.reduce((function(e,t){var n;return r(r({},e),((n={})[t]="",n))}),{}),(null==(l=null===(g=null===(d=s._embedded)||void 0===d?void 0:d.keys)||void 0===g?void 0:g[0])?void 0:l.translations)&&Object.entries(l.translations).forEach((function(e){var t=a(e,2),n=t[0],r=t[1];return c[n]=r.text})),h=null===(y=s.selectedLanguages)||void 0===y?void 0:y.map((function(e){return e.tag})),[2,[l,h]];case 3:return(p=o.sent())instanceof v&&404===p.response.status&&"language_not_found"===p.code?(f=this.properties,[4,this.coreService.getLanguages()]):[3,5];case 4:return f.preferredLanguages=o.sent(),console.error("Requested language not found, refreshing the page!"),location.reload(),[3,6];case 5:throw p;case 6:return[3,7];case 7:return[2]}}))}))}}return e.translationByValue=function(e,t){return e||(t||void 0)},e.prototype.initStatic=function(){var e,t=this;"object"==typeof(null===(e=this.properties.config)||void 0===e?void 0:e.staticData)&&Object.entries(this.properties.config.staticData).forEach((function(e){var n=a(e,2),r=n[0],i=n[1];"function"!=typeof i&&t.setLanguageData(r,i)}))},e.prototype.getCachedTranslations=function(){return this.translationsCache},e.prototype.loadTranslations=function(e){return void 0===e&&(e=this.properties.currentLanguage),i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this.isFetchNeeded(e)?(this.fetchPromises[e]instanceof Promise||(this.fetchPromises[e]=this.fetchTranslations(e)),[4,this.fetchPromises[e]]):[3,2];case 1:t.sent(),this.eventService.LANGUAGE_LOADED.emit(e),t.label=2;case 2:return this.fetchPromises[e]=void 0,[2,this.translationsCache.get(e)]}}))}))},e.prototype.getTranslation=function(t,n,r){return void 0===n&&(n=this.properties.currentLanguage),i(this,void 0,void 0,(function(){var i,s;return o(this,(function(o){switch(o.label){case 0:return this.isFetchNeeded(n)?[4,this.loadTranslations(n)]:[3,2];case 1:o.sent(),o.label=2;case 2:return(i=this.getFromCache(t,n))?[3,5]:(s=this.properties.config.fallbackLanguage,this.isFetchNeeded(s)?[4,this.loadTranslations(this.properties.config.fallbackLanguage)]:[3,4]);case 3:o.sent(),o.label=4;case 4:i=this.getFromCache(t,this.properties.config.fallbackLanguage),o.label=5;case 5:return[2,e.translationByValue(i,r)]}}))}))},e.prototype.updateKeyComplex=function(e,t){var n,s;return i(this,void 0,void 0,(function(){var i;return o(this,(function(o){switch(o.label){case 0:return this.coreService.checkScope("translations.edit"),[4,this.apiHttpService.postJson("v2/projects/keys/".concat(e,"/complex-update"),r(r({},t),{screenshotUploadedImageIds:(null===(n=t.screenshotUploadedImageIds)||void 0===n?void 0:n.length)?t.screenshotUploadedImageIds:void 0,screenshotIdsToDelete:(null===(s=t.screenshotIdsToDelete)||void 0===s?void 0:s.length)?t.screenshotIdsToDelete:void 0}),{method:"put"})];case 1:return i=o.sent(),[4,this.updateTranslationInCache(i)];case 2:return o.sent(),[2,i]}}))}))},e.prototype.createKey=function(e){var t;return i(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.coreService.checkScope("keys.edit"),[4,this.apiHttpService.postJson("v2/projects/keys/create",r(r({},e),{screenshotUploadedImageIds:(null===(t=e.screenshotUploadedImageIds)||void 0===t?void 0:t.length)?e.screenshotUploadedImageIds:void 0}))];case 1:return n=i.sent(),[4,this.updateTranslationInCache(n)];case 2:return i.sent(),[2,n]}}))}))},e.prototype.setTranslations=function(e){return i(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return this.coreService.checkScope("translations.edit"),[4,this.apiHttpService.postJson("v2/projects/translations",e)];case 1:return t=n.sent(),[4,this.updateTranslationInCache({id:t.keyId,name:t.keyName,translations:t.translations})];case 2:return n.sent(),[2,t]}}))}))},e.prototype.changeTranslations=function(e){var t=e.key,n=e.translations;return i(this,void 0,void 0,(function(){var e,r=this;return o(this,(function(s){switch(s.label){case 0:return e={},Object.entries(n).forEach((function(n){var i=a(n,2),o=i[0],s=i[1],u=r.translationsCache.get(o);u&&(e[o]=u[t],u[t]=s)})),[4,this.eventService.TRANSLATION_CHANGED.emit({key:t,translations:n})];case 1:return s.sent(),[2,function(){return i(r,void 0,void 0,(function(){var n=this;return o(this,(function(r){switch(r.label){case 0:return Object.entries(e).forEach((function(e){var r=a(e,2),i=r[0],o=r[1],s=n.translationsCache.get(i);s&&(s[t]=o)})),[4,this.eventService.TRANSLATION_CHANGED.emit({key:t,translations:e})];case 1:return r.sent(),[2]}}))}))}]}}))}))},e.prototype.getFromCacheOrFallback=function(t,n,r){void 0===n&&(n=this.properties.currentLanguage);var i=this.properties.config.fallbackLanguage,o=this.getFromCache(t,n)||this.getFromCache(t,i);if(o||this.isLoaded(n)&&this.isLoaded(i))return e.translationByValue(o,r)},e.prototype.isFetchNeeded=function(e){var t="development"===this.properties.mode,n=void 0!==this.translationsCache.get(e),r=Boolean(this.fetchedDev[e]);return t&&!r||!n},e.prototype.isLoaded=function(e){return void 0!==this.translationsCache.get(e)},e.prototype.fetchTranslations=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return"development"===this.properties.mode?[4,this.fetchTranslationsDevelopment(e)]:[3,2];case 1:return[2,t.sent()];case 2:return[4,this.fetchTranslationsProduction(e)];case 3:return[2,t.sent()]}}))}))},e.prototype.fetchTranslationsProduction=function(e){var t,n;return i(this,void 0,void 0,(function(){var r,i,s,a;return o(this,(function(o){switch(o.label){case 0:return"function"!=typeof(r=null===(n=null===(t=this.properties.config)||void 0===t?void 0:t.staticData)||void 0===n?void 0:n[e])?[3,2]:[4,r()];case 1:return a=o.sent(),this.setLanguageData(e,a),[2];case 2:if(void 0!==r)return this.setLanguageData(e,r),[2];o.label=3;case 3:i="".concat(this.properties.config.filesUrlPrefix||"/").concat(e,".json"),o.label=4;case 4:return o.trys.push([4,10,,11]),[4,fetch(i)];case 5:if((s=o.sent()).status>=400)return console.error("Server responded with error status while loading localization data."),this.setLanguageData(e,{}),[2];o.label=6;case 6:return o.trys.push([6,8,,9]),[4,s.json()];case 7:return a=o.sent(),this.setLanguageData(e,a),[3,9];case 8:return o.sent(),console.error("Error parsing json retrieved from ".concat(i,".")),this.setEmptyLanguageData(e),[3,9];case 9:return[3,11];case 10:return o.sent(),console.error("Error fetching localization data from ".concat(i,".")),this.setEmptyLanguageData(e),[3,11];case 11:return[2]}}))}))},e.prototype.fetchTranslationsDevelopment=function(e){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return[4,this.coreService.loadApiKeyDetails()];case 1:r.sent(),this.coreService.checkScope("translations.view"),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.apiHttpService.fetchJson("v2/projects/translations/".concat(e))];case 3:return t=r.sent(),this.fetchedDev[e]=!0,this.setLanguageData(e,t[e]||{}),[3,5];case 4:return n=r.sent(),console.error("Error while fetching localization data from API.",n),this.setEmptyLanguageData(e),[2];case 5:return[2]}}))}))},e.prototype.setEmptyLanguageData=function(e){this.translationsCache.set(e,{})},e.prototype.setLanguageData=function(e,t){var n=function(e){var t={};return Object.entries(e).forEach((function(e){var r=a(e,2),i=r[0],o=r[1];o&&("object"!=typeof o?t[i]=o:Object.entries(n(o)).forEach((function(e){var n=a(e,2),r=n[0],o=n[1];t[i+"."+r]=o})))})),t};this.translationsCache.set(e,n(t))},e.prototype.getFromCache=function(e,t){void 0===t&&(t=this.properties.currentLanguage);var n=this.translationsCache.get(t);if(void 0!==n)return n[e]},e}(),b=function(){function e(e,t,n){var r=this;this.properties=e,this.translationService=t,this.moduleService=n,this.format=function(e,t,n){try{var i=e;return r.moduleService.formatter&&(i=r.moduleService.formatter.format({translation:i,params:t,language:n||r.properties.currentLanguage})),i}catch(e){console.error(e)}}}return e.prototype.translate=function(e,t,n,r,s){return void 0===n&&(n=this.properties.currentLanguage),i(this,void 0,void 0,(function(){var i;return o(this,(function(o){switch(o.label){case 0:return[4,this.translationService.getTranslation(e,n,s)];case 1:return i=o.sent(),[2,this.formatTranslation(e,i,t,n,r)]}}))}))},e.prototype.instant=function(e,t,n,r,i){void 0===n&&(n=this.properties.currentLanguage);var o=this.translationService.getFromCacheOrFallback(e,n,i);return this.formatTranslation(e,o,t,n,r)},e.prototype.formatTranslation=function(e,t,n,r,i){return void 0!==t?this.format(t,n,r):i?"":e},e}();e.ModifierKey=void 0,(c=e.ModifierKey||(e.ModifierKey={}))[c.Alt=0]="Alt",c[c.Control=1]="Control",c[c.Shift=2]="Shift",c[c.Meta=3]="Meta";var w="data-tolgee-restricted",_="_tolgee",T="_tolgee-target",S="data-tolgee-key-only",A="_tolgee-highlighter",L="__tolgee_dev_tools",P={capture:!0},N={capture:!0,passive:!0},C=function(){function t(t){var n=this;this.dependencies=t,this.keysDown=new Set,this.mouseOnChanged=new d,this.keysChanged=new d,this.highlight=function(e){n.highlighted!==e&&(n.unhighlight(),e&&(e._tolgee.preventClean=!0,e._tolgee.highlight(),n.highlighted=e,n.mouseOnChanged.emit(e)))},this.unhighlight=function(){n.highlighted&&(n.highlighted._tolgee.preventClean=!1,n.highlighted._tolgee.unhighlight(),n.highlighted=void 0,n.mouseOnChanged.emit(n.highlighted))},this.blockEvents=function(e){n.areKeysDown()&&!n.isInUiDialog(e.target)&&(e.stopPropagation(),e.preventDefault())},this.onMouseMove=function(e){n.updateCursorPosition({x:e.clientX,y:e.clientY})},this.onBlur=function(){n.keysDown=new Set,n.keysChanged.emit(n.areKeysDown()),n.updateHighlight()},this.onKeyDown=function(t){var r=e.ModifierKey[t.key];void 0!==r&&(n.keysDown.add(r),n.keysChanged.emit(n.areKeysDown())),n.updateHighlight()},this.onKeyUp=function(t){n.keysDown.delete(e.ModifierKey[t.key]),n.keysChanged.emit(n.areKeysDown()),n.updateHighlight()},this.onScroll=function(){var e;null===(e=n.highlighted)||void 0===e||e._tolgee.highlight()},this.onClick=function(e){if(n.blockEvents(e),n.areKeysDown()){var t=n.getClosestTolgeeElement(e.target);t&&t===n.highlighted&&(n.dependencies.translationHighlighter.translationEdit(e,t),n.unhighlight())}}}return t.prototype.run=function(){"undefined"!=typeof window&&this.initEventListeners()},t.prototype.stop=function(){"undefined"!=typeof window&&this.removeEventListeners()},t.prototype.updateHighlight=function(){var e,t=this.cursorPosition;t&&this.areKeysDown()&&(e=this.getClosestTolgeeElement(document.elementFromPoint(t.x,t.y))),this.highlight(e)},t.prototype.updateCursorPosition=function(e){this.cursorPosition=e,this.updateHighlight()},t.prototype.initEventListeners=function(){window.addEventListener("blur",this.onBlur,P),window.addEventListener("keydown",this.onKeyDown,P),window.addEventListener("keyup",this.onKeyUp,P),window.addEventListener("mousemove",this.onMouseMove,N),window.addEventListener("scroll",this.onScroll,N),window.addEventListener("click",this.onClick,P),window.addEventListener("mouseenter",this.blockEvents,P),window.addEventListener("mouseover",this.blockEvents,P),window.addEventListener("mouseout",this.blockEvents,P),window.addEventListener("mouseleave",this.blockEvents,P),window.addEventListener("mousedown",this.blockEvents,P),window.addEventListener("mouseup",this.blockEvents,P)},t.prototype.removeEventListeners=function(){window.removeEventListener("blur",this.onBlur,P),window.removeEventListener("keydown",this.onKeyDown,P),window.removeEventListener("keyup",this.onKeyUp,P),window.removeEventListener("mousemove",this.onMouseMove,N),window.removeEventListener("scroll",this.onScroll,N),window.removeEventListener("click",this.onClick,P),window.removeEventListener("mouseenter",this.blockEvents,P),window.removeEventListener("mouseover",this.blockEvents,P),window.removeEventListener("mouseout",this.blockEvents,P),window.removeEventListener("mouseleave",this.blockEvents,P),window.removeEventListener("mousedown",this.blockEvents,P),window.removeEventListener("mouseup",this.blockEvents,P)},t.prototype.isInUiDialog=function(e){return Boolean(this.findAncestor(e,(function(e){return e.id===L})))},t.prototype.getClosestTolgeeElement=function(e){return this.findAncestor(e,(function(e){return null==e?void 0:e._tolgee}))},t.prototype.findAncestor=function(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?this.findAncestor(e.parentElement,t):void 0},t.prototype.areKeysDown=function(){var e,t;try{for(var n=s(this.dependencies.properties.config.highlightKeys),r=n.next();!r.done;r=n.next()){var i=r.value;if(!this.keysDown.has(i))return!1}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return!0},t}(),O=function(){function e(e){var t=this;this.dependencies=e,this.translationEdit=function(e,n){return i(t,void 0,void 0,(function(){var t,r;return o(this,(function(i){switch(i.label){case 0:return[4,this.getRenderer()];case 1:return"object"!=typeof(t=i.sent())?[3,3]:[4,this.getKeyAndDefault(e,n)];case 2:return(r=i.sent())?(t.renderViewer(r.key,r.defaultValue),[2]):[2];case 3:return[2]}}))}))}}return e.getKeyOptions=function(e){return Array.from(e._tolgee.nodes).reduce((function(e,t){return u(u([],a(e),!1),a(t._tolgee.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue}}))),!1)}),[])},e.prototype.listen=function(e){this.dependencies.highlightFunctionInitializer.initFunctions(e)},e.prototype.getRenderer=function(){return i(this,void 0,void 0,(function(){var e,t,n,r,i,a,u,c,l,h;return o(this,(function(o){switch(o.label){case 0:if(void 0!==this._renderer)return[3,11];e=[this.dependencies.properties.config.ui,window["@tolgee/ui"]],o.label=1;case 1:o.trys.push([1,8,9,10]),t=s(e),n=t.next(),o.label=2;case 2:return n.done?[3,7]:(r=n.value)instanceof Promise?[4,r]:[3,4];case 3:return a=o.sent(),[3,5];case 4:a=r,o.label=5;case 5:if("function"==typeof(u="object"==typeof(i=a)?null==i?void 0:i.UI:i))return this._renderer=new u(this.dependencies),[3,7];o.label=6;case 6:return n=t.next(),[3,2];case 7:return[3,10];case 8:return c=o.sent(),l={error:c},[3,10];case 9:try{n&&!n.done&&(h=t.return)&&h.call(t)}finally{if(l)throw l.error}return[7];case 10:void 0===this._renderer&&console.warn('Tolgee UI is not provided. To translate interactively provide tolgee ui constructor to "ui" configuration property. To disable highlighting use production mode.'),o.label=11;case 11:return[2,this._renderer]}}))}))},e.prototype.getKeyAndDefault=function(t,n){return i(this,void 0,void 0,(function(){var r,i,s,a;return o(this,(function(o){switch(o.label){case 0:return n._tolgee.wrappedWithElementOnlyKey?[2,{key:n._tolgee.wrappedWithElementOnlyKey,defaultValue:n._tolgee.wrappedWithElementOnlyDefaultHtml}]:(r=e.getKeyOptions(n),(i=new Set(r.map((function(e){return e.key})))).size>1?[4,this.getRenderer()]:[3,3]);case 1:return[4,o.sent().getKey({keys:i,openEvent:t})];case 2:if(s=o.sent(),a=r.find((function(e){return e.key===s})))return[2,a];o.label=3;case 3:return 1===i.size?[2,r[0]]:(console.error("No key to translate. This seems like a bug in tolgee."),[2])}}))}))},e}(),I=function(){function e(){}return e.evaluate=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Array.from(this.evaluateGenerator.apply(this,u([],a(e),!1)))},e.evaluateToSingle=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.evaluate.apply(this,u([],a(e),!1));if(1===n.length)return n[0];if(n.length<1)throw new Error("No element found");throw new Error("Multiple elements found")},e.closestElement=function(e){return e instanceof Text?e.parentElement:e},e.getParentElement=function(e){return e.parentElement?e.parentElement:e.ownerElement?e.ownerElement:void 0},e.isElementTargetElement=function(e){return e.hasAttribute(T)},e.markElementAsTargetElement=function(e){e.setAttribute(T,"")},e.unmarkElementAsTargetElement=function(e){e.removeAttribute(T)},e.nodeContains=function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1},e.evaluateGenerator=function(e,t){var n,r;return o(this,(function(i){switch(i.label){case 0:r=document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i.label=1;case 1:return null===(n=r.iterateNext())?[3,3]:[4,n];case 2:return i.sent(),[3,1];case 3:return[2]}}))},e.getNodeText=function(e){return e.textContent},e.setNodeText=function(e,t){e.textContent=t},e}(),R=function(){function e(e,t,n){this.properties=e,this.translationHighlighter=t,this.eventService=n,this.registeredElements=new Set}return e.prototype.register=function(e){(void 0!==this.getActiveNodes(e).next().value||e._tolgee.wrappedWithElementOnlyKey)&&("development"!==this.properties.mode||this.registeredElements.has(e)||this.translationHighlighter.listen(e),this.registeredElements.add(e),this.eventService.ELEMENT_REGISTERED.emit(e))},e.prototype.refreshAll=function(){var e,t;try{for(var n=s(this.registeredElements),r=n.next();!r.done;r=n.next()){var i=r.value;i._tolgee.preventClean||(this.cleanElementInactiveNodes(i),0!==i._tolgee.nodes.size||i._tolgee.wrappedWithElementOnlyKey||this.cleanElement(i))}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.prototype.cleanAll=function(){var e,t;try{for(var n=s(this.registeredElements),r=n.next();!r.done;r=n.next()){var i=r.value;this.cleanElement(i)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.prototype.findAllByKey=function(e){var t,n,r,i,o=[];try{for(var a=s(this.registeredElements),u=a.next();!u.done;u=a.next()){var c=u.value;if(c._tolgee.wrappedWithElementOnlyKey!==e)try{for(var l=(r=void 0,s(c._tolgee.nodes)),h=l.next();!h.done;h=l.next()){if(h.value._tolgee.keys.findIndex((function(t){return t.key===e}))>-1){o.push(c);break}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}else o.push(c)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},e.prototype.cleanElementInactiveNodes=function(e){this.isElementActive(e)&&(e._tolgee.nodes=new Set(this.getActiveNodes(e)))},e.prototype.cleanElement=function(e){e._tolgee.preventClean||(e._tolgee.highlightEl&&e._tolgee.unhighlight(),e.removeAttribute(_),delete e._tolgee,this.registeredElements.delete(e))},e.prototype.getActiveNodes=function(e){var t,n,r,i,a,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,7]),t=s(e._tolgee.nodes),n=t.next(),o.label=1;case 1:return n.done?[3,4]:(r=n.value,I.nodeContains(this.properties.config.targetElement,r)?[4,r]:[3,3]);case 2:o.sent(),o.label=3;case 3:return n=t.next(),[3,1];case 4:return[3,7];case 5:return i=o.sent(),a={error:i},[3,7];case 6:try{n&&!n.done&&(u=t.return)&&u.call(t)}finally{if(a)throw a.error}return[7];case 7:return[2]}}))},e.prototype.isElementActive=function(e){return this.properties.config.targetElement.contains(e)},e}(),k=function(){function e(e,t,n){this.properties=e,this.textWrapper=t,this.nodeRegistrar=n,this._observer=void 0,this._observing=!1}return Object.defineProperty(e.prototype,"observer",{get:function(){var e=this;return this._observer||"undefined"==typeof window||(this._observer=new MutationObserver((function(t){return i(e,void 0,void 0,(function(){var e,n,r,i,a,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,9,10,11]),e=s(t),n=e.next(),o.label=1;case 1:return n.done?[3,8]:(r=n.value,this._observing?"characterData"!==r.type?[3,3]:[4,this.textWrapper.handleText(r.target)]:[2]);case 2:return o.sent(),[3,7];case 3:return"childList"!==r.type?[3,5]:[4,this.textWrapper.handleSubtree(r.target)];case 4:return o.sent(),[3,7];case 5:return"attributes"!==r.type?[3,7]:[4,this.textWrapper.handleAttribute(r.target)];case 6:o.sent(),o.label=7;case 7:return n=e.next(),[3,1];case 8:return[3,11];case 9:return i=o.sent(),a={error:i},[3,11];case 10:try{n&&!n.done&&(u=e.return)&&u.call(e)}finally{if(a)throw a.error}return[7];case 11:return this.nodeRegistrar.refreshAll(),[2]}}))}))}))),this._observer},enumerable:!1,configurable:!0}),e.prototype.observe=function(){this.observer&&(this._observing||(this._observing=!0,this.observer.observe(this.properties.config.targetElement,{attributes:!0,childList:!0,subtree:!0,characterData:!0})))},e.prototype.stopObserving=function(){this.observer&&(this._observing=!1,this.observer.disconnect())},e}(),D=function(){function e(e,t){this.properties=e,this.apiHttpService=t}return e.prototype.getLanguages=function(){return i(this,void 0,void 0,(function(){var e,t;return o(this,(function(n){switch(n.label){case 0:return this.languagePromise instanceof Promise||(this.languagePromise=this.apiHttpService.fetchJson("v2/projects/languages?size=1000")),t=Set.bind,[4,this.languagePromise];case 1:return e=new(t.apply(Set,[void 0,n.sent()._embedded.languages.map((function(e){return e.tag}))])),this.properties.preferredLanguages=new Set(Array.from(this.properties.preferredLanguages).filter((function(t){return e.has(t)}))),[2,e]}}))}))},e.prototype.getLanguagesFull=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.getLanguages(),[4,this.languagePromise];case 1:return[2,e.sent()._embedded.languages]}}))}))},e.prototype.getApiKeyDetails=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.apiHttpService.fetchJson("v2/api-keys/current")];case 1:return[2,t.sent()];case 2:return e=t.sent(),console.error(e),console.error("Error getting scopes. Trying to switch to production mode!"),this.properties.mode="production",[3,3];case 3:return[2]}}))}))},e.prototype.isAuthorizedTo=function(e){return this.properties.scopes.indexOf(e)>-1},e.prototype.checkScope=function(e){if(!this.isAuthorizedTo(e))throw new Error("Api key not permitted to do this, please add 'translations.view' scope.")},e.prototype.loadApiKeyDetails=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return void 0!==this.properties.scopes?[3,2]:[4,this.getApiKeyDetails()];case 1:e=t.sent(),this.properties.scopes=e.scopes,this.properties.projectId=e.projectId,this.properties.permittedLanguageIds=e.permittedLanguageIds,t.label=2;case 2:return[2]}}))}))},e}(),U=function(){if("undefined"!=typeof document)return document.body},x=function(t){this.inputPrefix="%-%tolgee:",this.inputSuffix="%-%",this.defaultLanguage="en",this.enableLanguageStore=!0,this.enableLanguageDetection=!0,this.filesUrlPrefix="i18n/",this.tagAttributes={textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},this.highlightKeys=[e.ModifierKey.Alt],this.passToParent=["option","optgroup"],this.restrictedElements=["script","style"],this.highlightColor="rgb(255, 0, 0)",this.highlightWidth=5,this.wrapperMode="text",this.preloadFallback=!1,Object.defineProperty(this,"targetElement",{set:function(e){if(void 0!==this.targetElement)throw new Error("Target element is already defined!");if(void 0===e&&(this._targetElement=U()),I.isElementTargetElement(e))throw console.error("Target element: ",this._targetElement),new Error("An tolgee instance is inited with provided target element");this._targetElement=e,I.markElementAsTargetElement(this._targetElement)},get:function(){return this._targetElement}}),Object.assign(this,t||{}),"undefined"!=typeof sessionStorage&&(this.apiUrl=sessionStorage.getItem("__tolgee_apiUrl")||this.apiUrl,this.apiKey=sessionStorage.getItem("__tolgee_apiKey")||this.apiKey),void 0===this._targetElement&&(this._targetElement=U()),this.fallbackLanguage=this.fallbackLanguage||this.defaultLanguage,void 0===this.watch&&(this.watch=Boolean(this.apiKey&&this.apiUrl)),void 0===this.availableLanguages&&this.staticData&&(this.availableLanguages=Object.keys(this.staticData))},M=function(){function e(e,t,n,s,a){var u=this;this.messages=e,this.properties=t,this.eventService=n,this.elementRegistrar=s,this.translationService=a,this.handshakeSucceed=!1,this.takeScreenshot=function(e){return new Promise((function(t,n){u.translationService.changeTranslations(e).then((function(r){return i(u,void 0,void 0,(function(){var i,s,a=this;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.highlightAllByKey(e.key),[4,(u=100,new Promise((function(e){return setTimeout(e,u)})))];case 1:return o.sent(),this.messages.send("TOLGEE_TAKE_SCREENSHOT"),i=this.messages.listen("TOLGEE_SCREENSHOT_TAKEN",(function(n){a.unhighlightAllByKey(e.key),t(n),r(),i()})),[3,3];case 2:return s=o.sent(),r(),n(s),[3,3];case 3:return[2]}var u}))}))})).catch((function(e){n(e)}))}))},this.handshake=function(){var e=r(r({},u.properties),{config:r(r({},u.properties.config),{staticData:void 0,targetElement:void 0,_targetElement:void 0,ui:void 0}),uiPresent:Boolean(u.properties.config.ui),uiVersion:"4.7.0"}),t=null,n=function(){u.messages.send("TOLGEE_READY",e)},i=function(){clearInterval(t)};u.messages.listen("TOLGEE_PLUGIN_READY",(function(){u.handshakeSucceed=!0,u.messages.send("TOLGEE_READY",e),i()})),n();var o=0;t=setInterval((function(){!u.handshakeSucceed&&o<5?(n(),o+=1):i()}),200)}}return e.prototype.run=function(){try{this.messages.startListening(),this.handshake()}catch(e){console.warn(e),console.warn("Can not start communication with browser plugin. Check waning above.")}},e.prototype.stop=function(){this.messages.stopListening()},e.prototype.highlightAllByKey=function(e){this.elementRegistrar.findAllByKey(e).forEach((function(e){return e._tolgee.highlight()}))},e.prototype.unhighlightAllByKey=function(e){this.elementRegistrar.findAllByKey(e).forEach((function(e){return e._tolgee.unhighlight()}))},e}(),G=function(){function e(){var e=this;this.listeners=[],this.startListening=function(){var t=function(t){t.source==window&&e.listeners.forEach((function(e){e.type==t.data.type&&e.callback(t.data.data)}))};window.addEventListener("message",t,!1),"function"==typeof e._stopListening&&e._stopListening(),e._stopListening=function(){window.removeEventListener("message",t,!1)}},this.listen=function(t,n){var r={type:t,callback:n};return e.listeners.push(r),function(){e.listeners.splice(e.listeners.indexOf(r),1)}},this.send=function(e,t){try{window.postMessage({type:e,data:t},window.origin)}catch(e){console.warn("Cannot send message.",e)}}}return e.prototype.stopListening=function(){this._stopListening()},e}(),H={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},F=function(){function e(e){this.properties=e}return e.prototype.initFunctions=function(e){this.initHighlightFunction(e),this.initUnhighlightFunction(e)},e.prototype.initHighlightFunction=function(e){var t=this;e._tolgee.highlight=function(){var n=t.properties.config.highlightColor,r=t.properties.config.highlightWidth;if(e.isConnected){var i=e._tolgee.highlightEl;i||((i=document.createElement("div")).classList.add(A),Object.entries(H).forEach((function(e){var t=a(e,2),n=t[0],r=t[1];i.style[n]=r})),i.style.borderColor=n,e._tolgee.highlightEl=i,document.body.appendChild(i));var o=e.getBoundingClientRect();i.style.borderWidth=r+"px",i.style.top=o.top-r+"px",i.style.left=o.left-r+"px",i.style.width=o.width+"px",i.style.height=o.height+"px"}}},e.prototype.initUnhighlightFunction=function(e){e._tolgee.unhighlight=function(){var t;null===(t=e._tolgee.highlightEl)||void 0===t||t.remove(),e._tolgee.highlightEl=null}},e}(),j=function(){function e(e,t){this.coreService=e,this.apiHttpService=t}return e.prototype.uploadImage=function(e){return i(this,void 0,void 0,(function(){var t;return o(this,(function(n){return(t=new FormData).append("image",e),[2,this.apiHttpService.postJson("v2/image-upload",void 0,{headers:{},body:t})]}))}))},e.prototype.deleteImages=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.apiHttpService.post("v2/image-upload/".concat(e.join(",")),void 0,{method:"delete"})]}))}))},e}(),K=function(){var e=this;this.formatter=null,this.addModule=function(t){if("formatter"!==t.type)throw new Error("Module with unknown type");var n=new t;e.formatter=n}},V=function(){function e(e,t,n){this.properties=e,this.elementRegistrar=t,this.wrapper=n}return e.initParentElement=function(e){return void 0===e._tolgee&&(e._tolgee={nodes:new Set},e.setAttribute(_,"")),e},e.prototype.filterRestricted=function(e){var t=this.properties.config.restrictedElements;return e.filter((function(e){var n=I.closestElement(e);return!!n&&(-1===t.indexOf(n.tagName.toLowerCase())&&null===n.closest("[".concat(w,'="true"]')))}))},e.prototype.handleNodes=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,a,u,c,l,h,p,f,d;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,7]),t=s(e),n=t.next(),o.label=1;case 1:return n.done?[3,4]:(void 0===(r=n.value)._tolgee&&(r._tolgee={}),!0===(null==(i=r._tolgee)?void 0:i.locked)?[3,3]:(this.lockNode(r),[4,this.wrapper.unwrap(I.getNodeText(r))]));case 2:(a=o.sent())&&(u=a.text,c=a.keys,l=this.translateChildNode(r,u,c),(h=this.getParentElement(l))._tolgee.nodes.add(l),this.elementRegistrar.register(h)),this.unlockNode(r),o.label=3;case 3:return n=t.next(),[3,1];case 4:return[3,7];case 5:return p=o.sent(),f={error:p},[3,7];case 6:try{n&&!n.done&&(d=t.return)&&d.call(t)}finally{if(f)throw f.error}return[7];case 7:return[2]}}))}))},e.prototype.translateChildNode=function(e,t,n){return e._tolgee={oldTextContent:I.getNodeText(e),keys:n},I.setNodeText(e,t),e},e.prototype.lockNode=function(e){void 0===e._tolgee&&(e._tolgee={});var t=e._tolgee;return!0!==(null==t?void 0:t.locked)&&(t.locked=!0),e},e.prototype.unlockNode=function(e){e._tolgee&&(e._tolgee.locked=!1)},e.prototype.getParentElement=function(t){var n=this.getSuitableParent(t);return e.initParentElement(n)},e.prototype.getSuitableParent=function(e){var t=I.getParentElement(e);if(void 0===t)throw console.error(e),new Error("No suitable parent found for node above.");if(!this.properties.config.passToParent)return t;if(Array.isArray(this.properties.config.passToParent)){if(-1===this.properties.config.passToParent.findIndex((function(e){return t.tagName.toLowerCase()===e.toLowerCase()})))return t}return"function"!=typeof this.properties.config.passToParent||this.properties.config.passToParent(t)?this.getSuitableParent(t):t},e}(),X=function(){function e(e,t){this.properties=e,this.nodeHandler=t}return e.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,u,c,l,h,p,f,d,g,v,y,m,E,b,w;return o(this,(function(o){switch(o.label){case 0:t=this.properties.config.inputPrefix,n=this.properties.config.inputSuffix,o.label=1;case 1:o.trys.push([1,12,13,14]),r=s(Object.entries(this.properties.config.tagAttributes)),i=r.next(),o.label=2;case 2:if(i.done)return[3,11];u=a(i.value,2),c=u[0],l=u[1],o.label=3;case 3:o.trys.push([3,8,9,10]),b=void 0,h=s(l),p=h.next(),o.label=4;case 4:return p.done?[3,7]:(f=p.value,d="descendant-or-self::".concat(c,"/@").concat(f,"[contains(., '").concat(t,"') and contains(., '").concat(n,"')]"),g=I.evaluate(d,e),[4,this.nodeHandler.handleNodes(g)]);case 5:o.sent(),o.label=6;case 6:return p=h.next(),[3,4];case 7:return[3,10];case 8:return v=o.sent(),b={error:v},[3,10];case 9:try{p&&!p.done&&(w=h.return)&&w.call(h)}finally{if(b)throw b.error}return[7];case 10:return i=r.next(),[3,2];case 11:return[3,14];case 12:return y=o.sent(),m={error:y},[3,14];case 13:try{i&&!i.done&&(E=r.return)&&E.call(r)}finally{if(m)throw m.error}return[7];case 14:return[2]}}))}))},e}(),B=function(){function e(){}return e.splitOnNonEscapedDelimiter=function(e,t){for(var n=[],r="",i=!1,o=0;o<e.length;o++){var s=e[o];"\\"!==s||i?i?(i=!1,r+=s):s!==t?r+=s:(n.push(r),r=""):i=!0}return n.push(r),n},e.isCharEscaped=function(e,t){for(var n=0;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1},e.removeEscapes=function(e){for(var t="",n=!1,r=0;r<e.length;r++){var i=e[r];"\\"!==i||n?n?(n=!1,t+=i):t+=i:n=!0}return t},e}(),W=function(){function e(e,t){this.properties=e,this.textService=t,this.escapeForRegExp=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},this.escapeParam=function(e){return"string"==typeof e?e.replace(/[,:\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn('Parameters of type "'.concat(typeof e,'" are not supported in "text" wrapper mode.')),e)}}return Object.defineProperty(e.prototype,"rawUnWrapRegex",{get:function(){var e=this.escapeForRegExp(this.properties.config.inputPrefix),t=this.escapeForRegExp(this.properties.config.inputSuffix);return"(\\\\?)(".concat(e,"(.*?)").concat(t,")")},enumerable:!1,configurable:!0}),e.parseUnwrapped=function(e){var t,n,r=!1,i="",o="",a="KEY",u={key:"",params:{},defaultValue:void 0};try{for(var c=s(e),l=c.next();!l.done;l=c.next()){var h=l.value;"\\"!==h||r?r?(r=!1,i+=h):"KEY"!==a||","!==h?"KEY"!==a||":"!==h?"DEFAULT_VALUE"!==a||":"!==h?"PARAM_NAME"!==a||":"!==h?"PARAM_VALUE"!==a||","!==h?i+=h:(a="PARAM_NAME",u.params[o]=i,i=""):(a="PARAM_VALUE",o=i,i=""):(a="PARAM_NAME",u.defaultValue=i,i=""):(a="PARAM_NAME",u.key=i,i=""):(a="DEFAULT_VALUE",u.key=i,i=""):r=!0}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return"KEY"===a&&(u.key=i),"DEFAULT_VALUE"===a&&(u.defaultValue=i),"PARAM_VALUE"===a&&(u.params[o]=i),u},e.prototype.unwrap=function(e){for(var t,n=new RegExp(this.rawUnWrapRegex,"gs"),r=[],i=!1,o=0,s="";null!==(t=n.exec(e));){var u=t[1],c=a(t,4),l=c[0];c[1];var h=c[2],p=c[3],f=t.index;if(s+=t.input.substr(o,f-o),o=f+l.length,"\\"===u){if(!B.isCharEscaped(f,e)){s+=h;continue}u=""}var d=this.getTranslatedWithMetadata(p);r.push({key:d.key,params:d.params,defaultValue:d.defaultValue}),i=!0,s+=u+d.translated}if(s+=e.substring(o),i)return{text:s,keys:r}},e.prototype.wrap=function(e,t,n){var r=this;void 0===t&&(t={}),void 0===n&&(n=void 0);var i=Object.entries(t).map((function(e){var t=a(e,2),n=t[0],i=t[1];return"".concat(r.escapeParam(n),":").concat(r.escapeParam(i))})).join(",");i=i.length?":".concat(i):"";var o=void 0!==n?",".concat(this.escapeParam(n)):"";return"".concat(this.properties.config.inputPrefix).concat(this.escapeParam(e)).concat(o).concat(i).concat(this.properties.config.inputSuffix)},e.prototype.getTranslatedWithMetadata=function(t){var n=e.parseUnwrapped(t),r=n.key,i=n.params,o=n.defaultValue;return{translated:this.textService.instant(r,i,void 0,!1,o),key:r,params:i,defaultValue:o}},e}(),z=function(){function e(e,t,n,r,i,o){this.textHandler=e,this.eventService=t,this.properties=n,this.attributeHandler=r,this.coder=i,this.wrappedHandler=o,"undefined"!=typeof window&&(t.LANGUAGE_CHANGED.subscribe(this.refresh.bind(this)),t.TRANSLATION_CHANGED.subscribe(this.refresh.bind(this)))}return e.prototype.handleSubtree=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.attributeHandler.handle(e)];case 1:return t.sent(),[4,this.textHandler.handle(e)];case 2:return t.sent(),[4,this.wrappedHandler.handle(e)];case 3:return t.sent(),[2]}}))}))},e.prototype.refresh=function(){return i(this,void 0,void 0,(function(){var e,t,n,r,i,a,u,c,l,h,p,f,d,g;return o(this,(function(o){switch(o.label){case 0:e=I.evaluate("//*[@_tolgee]",this.properties.config.targetElement),o.label=1;case 1:o.trys.push([1,12,13,14]),t=s(e),n=t.next(),o.label=2;case 2:if(n.done)return[3,11];r=n.value,o.label=3;case 3:o.trys.push([3,8,9,10]),d=void 0,i=s(r._tolgee.nodes),a=i.next(),o.label=4;case 4:return a.done?[3,7]:(u=a.value,[4,this.coder.unwrap(u._tolgee.oldTextContent)]);case 5:(c=o.sent())&&I.setNodeText(u,c.text),o.label=6;case 6:return a=i.next(),[3,4];case 7:return[3,10];case 8:return l=o.sent(),d={error:l},[3,10];case 9:try{a&&!a.done&&(g=i.return)&&g.call(i)}finally{if(d)throw d.error}return[7];case 10:return n=t.next(),[3,2];case 11:return[3,14];case 12:return h=o.sent(),p={error:h},[3,14];case 13:try{n&&!n.done&&(f=t.return)&&f.call(t)}finally{if(p)throw p.error}return[7];case 14:return[2]}}))}))},e}(),Y=function(){function e(e,t){this.properties=e,this.nodeHandler=t}return e.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,s;return o(this,(function(o){switch(o.label){case 0:return t=this.properties.config.inputPrefix,n=this.properties.config.inputSuffix,r="./descendant-or-self::text()[contains(., '".concat(t,"') and contains(., '").concat(n,"')]"),i=I.evaluate(r,e),s=this.nodeHandler.filterRestricted(i),[4,this.nodeHandler.handleNodes(s)];case 1:return o.sent(),[2]}}))}))},e}(),J=function(){function e(e,t){this.elementRegistrar=e,this.nodeHandler=t}return e.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,n,r=this;return o(this,(function(i){return t="./descendant-or-self::*[@".concat(S,"]"),n=I.evaluate(t,e),this.nodeHandler.filterRestricted(n).forEach((function(e){var t=V.initParentElement(e);t._tolgee.wrappedWithElementOnlyKey=e.getAttribute(S),t._tolgee.wrappedWithElementOnlyDefaultHtml=e.innerHTML,r.elementRegistrar.register(t)})),[2]}))}))},e}(),q=function(){function e(e,t,n,r){this.coder=new W(t,n),this.nodeHandler=new V(t,r,this),this.textHandler=new Y(t,this.nodeHandler),this.attributeHandler=new X(t,this.nodeHandler),this.wrappedHandler=new J(r,this.nodeHandler),this.coreHandler=new z(this.textHandler,e,t,this.attributeHandler,this.coder,this.wrappedHandler)}return e.prototype.handleText=function(e){return this.textHandler.handle(e)},e.prototype.handleSubtree=function(e){return this.coreHandler.handleSubtree(e)},e.prototype.handleAttribute=function(e){return this.attributeHandler.handle(e)},e.prototype.wrap=function(e,t,n,r){return void 0===t&&(t={}),void 0===n&&(n=void 0),this.coder.wrap(e,t,n)},e.prototype.unwrap=function(e){return this.coder.unwrap(e)},e}();function Z(){}function $(){}Z.prototype.encode=function(e){for(var t=[],n=e.length,r=0;r<n;){var i=e.codePointAt(r),o=0,s=0;for(i<=127?(o=0,s=0):i<=2047?(o=6,s=192):i<=65535?(o=12,s=224):i<=2097151&&(o=18,s=240),t.push(s|i>>o),o-=6;o>=0;)t.push(128|i>>o&63),o-=6;r+=i>=65536?2:1}return t},$.prototype.decode=function(e){for(var t="",n=0;n<e.length;){var r=e[n],i=0,o=0;if(r<=127?(i=0,o=255&r):r<=223?(i=1,o=31&r):r<=239?(i=2,o=15&r):r<=244&&(i=3,o=7&r),e.length-n-i>0)for(var s=0;s<i;)o=o<<6|63&(r=e[n+s+1]),s+=1;else o=65533,i=e.length-n;t+=String.fromCodePoint(o),n+=i+1}return t};var Q,ee,te,ne="undefined"==typeof TextEncoder?Z:TextEncoder,re="undefined"==typeof TextDecoder?$:TextDecoder,ie=["",""],oe=RegExp("([".concat(ie.join(""),"]{9})+"),"gu"),se=function(e){var t=function(e){return Array.from((new ne).encode(e))}(e).map(Number).map((function(e){return function(e){var t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0"})).join("");return Array.from(t).map((function(e){return ie[Number(e)]})).join("")},ae=function(e){var t,n=Array.from(e).map((function(e){return ie.indexOf(e)})).map(String).join("").match(/(.{9})/g),r=Uint8Array.from(n.map((function(e){return parseInt(e.slice(0,8),2)})));return t=r,(new re).decode(new Uint8Array(t))},ue=function(){function e(e,t){this.properties=e,this.nodeHandler=t}return e.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,u,c,l,h,p,f,d,g,v,y,m,E;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,11,12,13]),t=s(Object.entries(this.properties.config.tagAttributes)),n=t.next(),o.label=1;case 1:if(n.done)return[3,10];r=a(n.value,2),i=r[0],u=r[1],o.label=2;case 2:o.trys.push([2,7,8,9]),m=void 0,c=s(u),l=c.next(),o.label=3;case 3:return l.done?[3,6]:(h=l.value,p="descendant-or-self::".concat(i,"/@").concat(h,"[contains(., '").concat(ie[0],"')]"),f=I.evaluate(p,e),[4,this.nodeHandler.handleNodes(f)]);case 4:o.sent(),o.label=5;case 5:return l=c.next(),[3,3];case 6:return[3,9];case 7:return d=o.sent(),m={error:d},[3,9];case 8:try{l&&!l.done&&(E=c.return)&&E.call(c)}finally{if(m)throw m.error}return[7];case 9:return n=t.next(),[3,1];case 10:return[3,13];case 11:return g=o.sent(),v={error:g},[3,13];case 12:try{n&&!n.done&&(y=t.return)&&y.call(t)}finally{if(v)throw v.error}return[7];case 13:return[2]}}))}))},e}(),ce=function(){function e(){this.values=[]}return e.prototype.valueToNumber=function(e){var t=this.values.indexOf(e);return-1===t&&(t=this.values.length,this.values.push(e)),t},e.prototype.numberToValue=function(e){return this.values[e]},e}(),le=function(){function e(){this.keyMemory=new ce,this.defaultMemory=new ce}return e.prototype.unwrap=function(e){var t=this,n=[];(function(e){var t,n=null===(t=e.match(oe))||void 0===t?void 0:t.filter((function(e){return e.length>8}));return(null==n?void 0:n.map(ae))||[]})(e).forEach((function(e){var r=a(function(e){var t,n,r=[];try{for(var i=s(e),o=i.next();!o.done;o=i.next()){var a=o.value;r.push(a.codePointAt(0))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(e),2),i=r[0],o=r[1],u=t.keyMemory.numberToValue(i),c=void 0!==o?t.defaultMemory.numberToValue(o):void 0;n.push({key:u,params:void 0,defaultValue:c})}));var r=function(e){return e.replace(oe,"")}(e);if(n.length)return{text:r,keys:n}},e.prototype.wrap=function(e,t,n,r){void 0===n&&(n=void 0),void 0===r&&(r=void 0);var i=[this.keyMemory.valueToNumber(e)];n&&i.push(this.defaultMemory.valueToNumber(n));var o=r||"",s=se(String.fromCodePoint.apply(String,u([],a(i),!1)));return"string"==typeof o?o+s:Array.isArray(o)?u(u([],a(o),!1),[s],!1):[o,s]},e}(),he=function(){function e(e,t,n){this.textHandler=e,this.attributeHandler=t,this.wrappedHandler=n}return e.prototype.handleSubtree=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.attributeHandler.handle(e)];case 1:return t.sent(),[4,this.textHandler.handle(e)];case 2:return t.sent(),[4,this.wrappedHandler.handle(e)];case 3:return t.sent(),[2]}}))}))},e}(),pe=function(){function e(e){this.nodeHandler=e}return e.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,n,r;return o(this,(function(i){switch(i.label){case 0:return t="./descendant-or-self::text()[contains(., '".concat(ie[0],"')]"),n=I.evaluate(t,e),r=this.nodeHandler.filterRestricted(n),[4,this.nodeHandler.handleNodes(r)];case 1:return i.sent(),[2]}}))}))},e}(),fe=function(){function e(e,t){this.coder=new le,this.nodeHandler=new V(e,t,this),this.textHandler=new pe(this.nodeHandler),this.attributeHandler=new ue(e,this.nodeHandler),this.wrappedHandler=new J(t,this.nodeHandler),this.coreHandler=new he(this.textHandler,this.attributeHandler,this.wrappedHandler)}return e.prototype.handleText=function(e){return this.textHandler.handle(e)},e.prototype.handleSubtree=function(e){return this.coreHandler.handleSubtree(e)},e.prototype.handleAttribute=function(e){return this.attributeHandler.handle(e)},e.prototype.wrap=function(e,t,n,r){return void 0===t&&(t={}),void 0===n&&(n=void 0),void 0===r&&(r=""),this.coder.wrap(e,t,n,r)},e.prototype.unwrap=function(e){return this.coder.unwrap(e)},e}(),de=function(){function e(){var e=this;this.properties=new p,this.eventService=new g,this.apiHttpService=new y(this.properties),this.mouseEventHandler=new C(this),this.moduleService=new K,this.coreService=new D(this.properties,this.apiHttpService),this.screenshotService=new j(this.coreService,this.apiHttpService),this.translationService=new E(this.properties,this.coreService,this.apiHttpService,this.eventService),this.textService=new b(this.properties,this.translationService,this.moduleService),this.highlightFunctionInitializer=new F(this.properties),this.translationHighlighter=new O(this),this.elementRegistrar=new R(this.properties,this.translationHighlighter,this.eventService),this.messages=new G,this.pluginManager=new M(this.messages,this.properties,this.eventService,this.elementRegistrar,this.translationService),this.run=function(){e.mouseEventHandler.run()},this.stop=function(){e.observer.stopObserving(),e.elementRegistrar.cleanAll(),e.mouseEventHandler.stop(),I.unmarkElementAsTargetElement(e.properties.config.targetElement)},this.translationHighlighter.pluginManager=this.pluginManager}return e.prototype.init=function(e){if(this.properties.config)throw new Error("Duplicate initialization of config");this.properties.config=new x(e),"invisible"===this.properties.config.wrapperMode?this.wrapper=new fe(this.properties,this.elementRegistrar):this.wrapper=new q(this.eventService,this.properties,this.textService,this.elementRegistrar),this.observer=new k(this.properties,this.wrapper,this.elementRegistrar),this.translationService.initStatic()},e}(),ge=function(){function e(){var e=this;this.stop=function(){e.dependencyService.stop()},this.dependencyService=new de}return Object.defineProperty(e.prototype,"properties",{get:function(){return this.dependencyService.properties},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lang",{get:function(){return this.properties.currentLanguage},set:function(e){var t=this;this.properties.currentLanguage=e,this.dependencyService.translationService.loadTranslations(e).then((function(){t.emitLangChangeEvent(e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultLanguage",{get:function(){return this.properties.config.defaultLanguage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLangChange",{get:function(){return this.dependencyService.eventService.LANGUAGE_CHANGED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTranslationChange",{get:function(){return this.dependencyService.eventService.TRANSLATION_CHANGED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLangLoaded",{get:function(){return this.dependencyService.eventService.LANGUAGE_LOADED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initialLoading",{get:function(){var e,t,n=this.properties.currentLanguage,r=this.properties.config.fallbackLanguage,i=this.properties.config.preloadFallback,o=function(e){return void 0!==e&&"function"!=typeof e};return!o(null===(e=this.properties.config.staticData)||void 0===e?void 0:e[n])||!!i&&!o(null===(t=this.properties.config.staticData)||void 0===t?void 0:t[r])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coreService",{get:function(){return this.dependencyService.coreService},enumerable:!1,configurable:!0}),e.use=function(t){return(new e).use(t)},e.init=function(t){return(new e).init(t)},e.prototype.changeLanguage=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.dependencyService.translationService.loadTranslations(e)];case 1:return t.sent(),this.properties.currentLanguage=e,this.emitLangChangeEvent(e),[2]}}))}))},e.prototype.use=function(e){return this.dependencyService.moduleService.addModule(e),this},e.prototype.init=function(e){this.dependencyService.init(e);var t=this.dependencyService.properties.config,n=t.apiKey,r=t.apiUrl;return this.dependencyService.properties.mode=n&&r?"development":"production",this},e.prototype.run=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:if(this.dependencyService.run(),"development"!==this.properties.mode)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.coreService.loadApiKeyDetails()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.error("Couldn't connect to Tolgee"),console.error(e),this.properties.mode="production",[3,4];case 4:return[4,this.dependencyService.translationService.loadTranslations()];case 5:return t.sent(),[4,this.dependencyService.pluginManager.run()];case 6:return t.sent(),this.properties.config.preloadFallback?[4,this.dependencyService.translationService.loadTranslations(this.properties.config.fallbackLanguage)]:[3,8];case 7:t.sent(),t.label=8;case 8:return[4,this.refresh()];case 9:return t.sent(),this.properties.config.watch&&this.dependencyService.observer.observe(),[2]}}))}))},e.prototype.refresh=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.dependencyService.wrapper.handleSubtree(this.properties.config.targetElement)]}))}))},e.prototype.translate=function(e,t,n,r){return void 0===t&&(t={}),void 0===n&&(n=!1),void 0===r&&(r=void 0),i(this,void 0,void 0,(function(){var i,s,a,u;return o(this,(function(o){switch(o.label){case 0:return i="string"==typeof e?e:e.key,s=void 0,"object"==typeof e&&(t=void 0!==(a=e).params?a.params:t,n=void 0!==a.noWrap?a.noWrap:n,r=void 0!==a.defaultValue?a.defaultValue:r,s=a.orEmpty),[4,this.dependencyService.textService.translate(i,t,void 0,s,r)];case 1:return u=o.sent(),"development"!==this.properties.mode||n?[3,3]:[4,this.coreService.loadApiKeyDetails()];case 2:return o.sent(),[2,this.dependencyService.wrapper.wrap(i,t,r,u)];case 3:return[2,u]}}))}))},e.prototype.wrap=function(e,t,n,r){return"development"===this.properties.mode?this.dependencyService.wrapper.wrap(e,t,n,r):r||n},e.prototype.instant=function(e,t,n,r,i){void 0===t&&(t={}),void 0===n&&(n=!1);var o="string"==typeof e?e:e.key;if("object"==typeof e){var s=e;t=void 0!==s.params?s.params:t,n=void 0!==s.noWrap?s.noWrap:n,i=void 0!==s.defaultValue?s.defaultValue:i,r=void 0!==s.orEmpty?s.orEmpty:r}var a=this.dependencyService.textService.instant(o,t,void 0,r,i);return"development"!==this.properties.mode||n?a:this.dependencyService.wrapper.wrap(o,t,i,a)},e.prototype.getCachedTranslations=function(){return this.dependencyService.translationService.getCachedTranslations()},e.prototype.loadTranslations=function(e){return this.dependencyService.translationService.loadTranslations(e)},e.prototype.emitLangChangeEvent=function(e){this.onLangChange.emit(e)},e}();function ve(e){return e.type===ee.literal}function ye(e){return e.type===ee.argument}function me(e){return e.type===ee.number}function Ee(e){return e.type===ee.date}function be(e){return e.type===ee.time}function we(e){return e.type===ee.select}function _e(e){return e.type===ee.plural}function Te(e){return e.type===ee.pound}function Se(e){return e.type===ee.tag}function Ae(e){return!(!e||"object"!=typeof e||e.type!==te.number)}function Le(e){return!(!e||"object"!=typeof e||e.type!==te.dateTime)}!function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"}(Q||(Q={})),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"}(ee||(ee={})),function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"}(te||(te={}));var Pe=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,Ne=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function Ce(e){var t={};return e.replace(Ne,(function(e){var n=e.length;switch(e[0]){case"G":t.era=4===n?"long":5===n?"narrow":"short";break;case"y":t.year=2===n?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":t.month=["numeric","2-digit","short","long","narrow"][n-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":t.day=["numeric","2-digit"][n-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":t.weekday=4===n?"short":5===n?"narrow":"short";break;case"e":if(n<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][n-4];break;case"c":if(n<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][n-4];break;case"a":t.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":t.hourCycle="h12",t.hour=["numeric","2-digit"][n-1];break;case"H":t.hourCycle="h23",t.hour=["numeric","2-digit"][n-1];break;case"K":t.hourCycle="h11",t.hour=["numeric","2-digit"][n-1];break;case"k":t.hourCycle="h24",t.hour=["numeric","2-digit"][n-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":t.minute=["numeric","2-digit"][n-1];break;case"s":t.second=["numeric","2-digit"][n-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":t.timeZoneName=n<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""})),t}var Oe=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;var Ie,Re=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,ke=/^(@+)?(\+|#+)?[rs]?$/g,De=/(\*)(0+)|(#+)(0+)|(0+)/g,Ue=/^(0+)$/;function xe(e){var t={};return"r"===e[e.length-1]?t.roundingPriority="morePrecision":"s"===e[e.length-1]&&(t.roundingPriority="lessPrecision"),e.replace(ke,(function(e,n,r){return"string"!=typeof r?(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length):"+"===r?t.minimumSignificantDigits=n.length:"#"===n[0]?t.maximumSignificantDigits=n.length:(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length+("string"==typeof r?r.length:0)),""})),t}function Me(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function Ge(e){var t;if("E"===e[0]&&"E"===e[1]?(t={notation:"engineering"},e=e.slice(2)):"E"===e[0]&&(t={notation:"scientific"},e=e.slice(1)),t){var n=e.slice(0,2);if("+!"===n?(t.signDisplay="always",e=e.slice(2)):"+?"===n&&(t.signDisplay="exceptZero",e=e.slice(2)),!Ue.test(e))throw new Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}function He(e){var t=Me(e);return t||{}}function Fe(e){for(var t={},n=0,i=e;n<i.length;n++){var o=i[n];switch(o.stem){case"percent":case"%":t.style="percent";continue;case"%x100":t.style="percent",t.scale=100;continue;case"currency":t.style="currency",t.currency=o.options[0];continue;case"group-off":case",_":t.useGrouping=!1;continue;case"precision-integer":case".":t.maximumFractionDigits=0;continue;case"measure-unit":case"unit":t.style="unit",t.unit=o.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":case"K":t.notation="compact",t.compactDisplay="short";continue;case"compact-long":case"KK":t.notation="compact",t.compactDisplay="long";continue;case"scientific":t=r(r(r({},t),{notation:"scientific"}),o.options.reduce((function(e,t){return r(r({},e),He(t))}),{}));continue;case"engineering":t=r(r(r({},t),{notation:"engineering"}),o.options.reduce((function(e,t){return r(r({},e),He(t))}),{}));continue;case"notation-simple":t.notation="standard";continue;case"unit-width-narrow":t.currencyDisplay="narrowSymbol",t.unitDisplay="narrow";continue;case"unit-width-short":t.currencyDisplay="code",t.unitDisplay="short";continue;case"unit-width-full-name":t.currencyDisplay="name",t.unitDisplay="long";continue;case"unit-width-iso-code":t.currencyDisplay="symbol";continue;case"scale":t.scale=parseFloat(o.options[0]);continue;case"integer-width":if(o.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");o.options[0].replace(De,(function(e,n,r,i,o,s){if(n)t.minimumIntegerDigits=r.length;else{if(i&&o)throw new Error("We currently do not support maximum integer digits");if(s)throw new Error("We currently do not support exact integer digits")}return""}));continue}if(Ue.test(o.stem))t.minimumIntegerDigits=o.stem.length;else if(Re.test(o.stem)){if(o.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");o.stem.replace(Re,(function(e,n,r,i,o,s){return"*"===r?t.minimumFractionDigits=n.length:i&&"#"===i[0]?t.maximumFractionDigits=i.length:o&&s?(t.minimumFractionDigits=o.length,t.maximumFractionDigits=o.length+s.length):(t.minimumFractionDigits=n.length,t.maximumFractionDigits=n.length),""}));var s=o.options[0];"w"===s?t=r(r({},t),{trailingZeroDisplay:"stripIfInteger"}):s&&(t=r(r({},t),xe(s)))}else if(ke.test(o.stem))t=r(r({},t),xe(o.stem));else{var a=Me(o.stem);a&&(t=r(r({},t),a));var u=Ge(o.stem);u&&(t=r(r({},t),u))}}return t}var je=new RegExp("^".concat(Pe.source,"*")),Ke=new RegExp("".concat(Pe.source,"*$"));function Ve(e,t){return{start:e,end:t}}var Xe=!!String.prototype.startsWith,Be=!!String.fromCodePoint,We=!!Object.fromEntries,ze=!!String.prototype.codePointAt,Ye=!!String.prototype.trimStart,Je=!!String.prototype.trimEnd,qe=!!Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},Ze=!0;try{Ze="a"===(null===(Ie=ot("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu").exec("a"))||void 0===Ie?void 0:Ie[0])}catch(e){Ze=!1}var $e,Qe=Xe?function(e,t,n){return e.startsWith(t,n)}:function(e,t,n){return e.slice(n,n+t.length)===t},et=Be?String.fromCodePoint:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n,r="",i=e.length,o=0;i>o;){if((n=e[o++])>1114111)throw RangeError(n+" is not a valid code point");r+=n<65536?String.fromCharCode(n):String.fromCharCode(55296+((n-=65536)>>10),n%1024+56320)}return r},tt=We?Object.fromEntries:function(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],s=i[1];t[o]=s}return t},nt=ze?function(e,t){return e.codePointAt(t)}:function(e,t){var n=e.length;if(!(t<0||t>=n)){var r,i=e.charCodeAt(t);return i<55296||i>56319||t+1===n||(r=e.charCodeAt(t+1))<56320||r>57343?i:r-56320+(i-55296<<10)+65536}},rt=Ye?function(e){return e.trimStart()}:function(e){return e.replace(je,"")},it=Je?function(e){return e.trimEnd()}:function(e){return e.replace(Ke,"")};function ot(e,t){return new RegExp(e,t)}if(Ze){var st=ot("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");$e=function(e,t){var n;return st.lastIndex=t,null!==(n=st.exec(e)[1])&&void 0!==n?n:""}}else $e=function(e,t){for(var n=[];;){var r=nt(e,t);if(void 0===r||ct(r)||lt(r))break;n.push(r),t+=r>=65536?2:1}return et.apply(void 0,n)};var at=function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,n){for(var r=[];!this.isEOF();){var i=this.char();if(123===i){if((o=this.parseArgument(e,n)).err)return o;r.push(o.val)}else{if(125===i&&e>0)break;if(35!==i||"plural"!==t&&"selectordinal"!==t){if(60===i&&!this.ignoreTag&&47===this.peek()){if(n)break;return this.error(Q.UNMATCHED_CLOSING_TAG,Ve(this.clonePosition(),this.clonePosition()))}if(60===i&&!this.ignoreTag&&ut(this.peek()||0)){if((o=this.parseTag(e,t)).err)return o;r.push(o.val)}else{var o;if((o=this.parseLiteral(e,t)).err)return o;r.push(o.val)}}else{var s=this.clonePosition();this.bump(),r.push({type:ee.pound,location:Ve(s,this.clonePosition())})}}}return{val:r,err:null}},e.prototype.parseTag=function(e,t){var n=this.clonePosition();this.bump();var r=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:ee.literal,value:"<".concat(r,"/>"),location:Ve(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var i=this.parseMessage(e+1,t,!0);if(i.err)return i;var o=i.val,s=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!ut(this.char()))return this.error(Q.INVALID_TAG,Ve(s,this.clonePosition()));var a=this.clonePosition();return r!==this.parseTagName()?this.error(Q.UNMATCHED_CLOSING_TAG,Ve(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:ee.tag,value:r,children:o,location:Ve(n,this.clonePosition())},err:null}:this.error(Q.INVALID_TAG,Ve(s,this.clonePosition())))}return this.error(Q.UNCLOSED_TAG,Ve(n,this.clonePosition()))}return this.error(Q.INVALID_TAG,Ve(n,this.clonePosition()))},e.prototype.parseTagName=function(){var e,t=this.offset();for(this.bump();!this.isEOF()&&(45===(e=this.char())||46===e||e>=48&&e<=57||95===e||e>=97&&e<=122||e>=65&&e<=90||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(e,t){for(var n=this.clonePosition(),r="";;){var i=this.tryParseQuote(t);if(i)r+=i;else{var o=this.tryParseUnquoted(e,t);if(o)r+=o;else{var s=this.tryParseLeftAngleBracket();if(!s)break;r+=s}}}var a=Ve(n,this.clonePosition());return{val:{type:ee.literal,value:r,location:a},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60!==this.char()||!this.ignoreTag&&(ut(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e},e.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(39===n){if(39!==this.peek()){this.bump();break}t.push(39),this.bump()}else t.push(n);this.bump()}return et.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var n=this.char();return 60===n||123===n||35===n&&("plural"===t||"selectordinal"===t)||125===n&&e>0?null:(this.bump(),et(n))},e.prototype.parseArgument=function(e,t){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Ve(n,this.clonePosition()));if(125===this.char())return this.bump(),this.error(Q.EMPTY_ARGUMENT,Ve(n,this.clonePosition()));var r=this.parseIdentifierIfPossible().value;if(!r)return this.error(Q.MALFORMED_ARGUMENT,Ve(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Ve(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:ee.argument,value:r,location:Ve(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Ve(n,this.clonePosition())):this.parseArgumentOptions(e,t,r,n);default:return this.error(Q.MALFORMED_ARGUMENT,Ve(n,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),n=$e(this.message,t),r=t+n.length;return this.bumpTo(r),{value:n,location:Ve(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,n,i){var o,s=this.clonePosition(),a=this.parseIdentifierIfPossible().value,u=this.clonePosition();switch(a){case"":return this.error(Q.EXPECT_ARGUMENT_TYPE,Ve(s,u));case"number":case"date":case"time":this.bumpSpace();var c=null;if(this.bumpIf(",")){this.bumpSpace();var l=this.clonePosition();if((y=this.parseSimpleArgStyleIfPossible()).err)return y;if(0===(f=it(y.val)).length)return this.error(Q.EXPECT_ARGUMENT_STYLE,Ve(this.clonePosition(),this.clonePosition()));c={style:f,styleLocation:Ve(l,this.clonePosition())}}if((m=this.tryParseArgumentClose(i)).err)return m;var h=Ve(i,this.clonePosition());if(c&&Qe(null==c?void 0:c.style,"::",0)){var p=rt(c.style.slice(2));if("number"===a)return(y=this.parseNumberSkeletonFromString(p,c.styleLocation)).err?y:{val:{type:ee.number,value:n,location:h,style:y.val},err:null};if(0===p.length)return this.error(Q.EXPECT_DATE_TIME_SKELETON,h);var f={type:te.dateTime,pattern:p,location:c.styleLocation,parsedOptions:this.shouldParseSkeletons?Ce(p):{}};return{val:{type:"date"===a?ee.date:ee.time,value:n,location:h,style:f},err:null}}return{val:{type:"number"===a?ee.number:"date"===a?ee.date:ee.time,value:n,location:h,style:null!==(o=null==c?void 0:c.style)&&void 0!==o?o:null},err:null};case"plural":case"selectordinal":case"select":var d=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(Q.EXPECT_SELECT_ARGUMENT_OPTIONS,Ve(d,r({},d)));this.bumpSpace();var g=this.parseIdentifierIfPossible(),v=0;if("select"!==a&&"offset"===g.value){if(!this.bumpIf(":"))return this.error(Q.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Ve(this.clonePosition(),this.clonePosition()));var y;if(this.bumpSpace(),(y=this.tryParseDecimalInteger(Q.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Q.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return y;this.bumpSpace(),g=this.parseIdentifierIfPossible(),v=y.val}var m,E=this.tryParsePluralOrSelectOptions(e,a,t,g);if(E.err)return E;if((m=this.tryParseArgumentClose(i)).err)return m;var b=Ve(i,this.clonePosition());return"select"===a?{val:{type:ee.select,value:n,options:tt(E.val),location:b},err:null}:{val:{type:ee.plural,value:n,options:tt(E.val),offset:v,pluralType:"plural"===a?"cardinal":"ordinal",location:b},err:null};default:return this.error(Q.INVALID_ARGUMENT_TYPE,Ve(s,u))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Ve(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();){switch(this.char()){case 39:this.bump();var n=this.clonePosition();if(!this.bumpUntil("'"))return this.error(Q.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Ve(n,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var n=[];try{n=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");for(var t=[],n=0,r=e.split(Oe).filter((function(e){return e.length>0}));n<r.length;n++){var i=r[n].split("/");if(0===i.length)throw new Error("Invalid number skeleton");for(var o=i[0],s=i.slice(1),a=0,u=s;a<u.length;a++)if(0===u[a].length)throw new Error("Invalid number skeleton");t.push({stem:o,options:s})}return t}(e)}catch(e){return this.error(Q.INVALID_NUMBER_SKELETON,t)}return{val:{type:te.number,tokens:n,location:t,parsedOptions:this.shouldParseSkeletons?Fe(n):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(e,t,n,r){for(var i,o=!1,s=[],a=new Set,u=r.value,c=r.location;;){if(0===u.length){var l=this.clonePosition();if("select"===t||!this.bumpIf("="))break;var h=this.tryParseDecimalInteger(Q.EXPECT_PLURAL_ARGUMENT_SELECTOR,Q.INVALID_PLURAL_ARGUMENT_SELECTOR);if(h.err)return h;c=Ve(l,this.clonePosition()),u=this.message.slice(l.offset,this.offset())}if(a.has(u))return this.error("select"===t?Q.DUPLICATE_SELECT_ARGUMENT_SELECTOR:Q.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,c);"other"===u&&(o=!0),this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?Q.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:Q.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,Ve(this.clonePosition(),this.clonePosition()));var f=this.parseMessage(e+1,t,n);if(f.err)return f;var d=this.tryParseArgumentClose(p);if(d.err)return d;s.push([u,{value:f.val,location:Ve(p,this.clonePosition())}]),a.add(u),this.bumpSpace(),u=(i=this.parseIdentifierIfPossible()).value,c=i.location}return 0===s.length?this.error("select"===t?Q.EXPECT_SELECT_ARGUMENT_SELECTOR:Q.EXPECT_PLURAL_ARGUMENT_SELECTOR,Ve(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!o?this.error(Q.MISSING_OTHER_CLAUSE,Ve(this.clonePosition(),this.clonePosition())):{val:s,err:null}},e.prototype.tryParseDecimalInteger=function(e,t){var n=1,r=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(n=-1);for(var i=!1,o=0;!this.isEOF();){var s=this.char();if(!(s>=48&&s<=57))break;i=!0,o=10*o+(s-48),this.bump()}var a=Ve(r,this.clonePosition());return i?qe(o*=n)?{val:o,err:null}:this.error(t,a):this.error(e,a)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=nt(this.message,e);if(void 0===t)throw Error("Offset ".concat(e," is at invalid UTF-16 code unit boundary"));return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(Qe(this.message,e,this.offset())){for(var t=0;t<e.length;t++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(e){var t=this.offset(),n=this.message.indexOf(e,t);return n>=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&ct(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),n=this.message.charCodeAt(t+(e>=65536?2:1));return null!=n?n:null},e}();function ut(e){return e>=97&&e<=122||e>=65&&e<=90}function ct(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}function lt(e){return e>=33&&e<=35||36===e||e>=37&&e<=39||40===e||41===e||42===e||43===e||44===e||45===e||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||91===e||92===e||93===e||94===e||96===e||123===e||124===e||125===e||126===e||161===e||e>=162&&e<=165||166===e||167===e||169===e||171===e||172===e||174===e||176===e||177===e||182===e||187===e||191===e||215===e||247===e||e>=8208&&e<=8213||e>=8214&&e<=8215||8216===e||8217===e||8218===e||e>=8219&&e<=8220||8221===e||8222===e||8223===e||e>=8224&&e<=8231||e>=8240&&e<=8248||8249===e||8250===e||e>=8251&&e<=8254||e>=8257&&e<=8259||8260===e||8261===e||8262===e||e>=8263&&e<=8273||8274===e||8275===e||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||8608===e||e>=8609&&e<=8610||8611===e||e>=8612&&e<=8613||8614===e||e>=8615&&e<=8621||8622===e||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||8658===e||8659===e||8660===e||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||8968===e||8969===e||8970===e||8971===e||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||9001===e||9002===e||e>=9003&&e<=9083||9084===e||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||9655===e||e>=9656&&e<=9664||9665===e||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||9839===e||e>=9840&&e<=10087||10088===e||10089===e||10090===e||10091===e||10092===e||10093===e||10094===e||10095===e||10096===e||10097===e||10098===e||10099===e||10100===e||10101===e||e>=10132&&e<=10175||e>=10176&&e<=10180||10181===e||10182===e||e>=10183&&e<=10213||10214===e||10215===e||10216===e||10217===e||10218===e||10219===e||10220===e||10221===e||10222===e||10223===e||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||10627===e||10628===e||10629===e||10630===e||10631===e||10632===e||10633===e||10634===e||10635===e||10636===e||10637===e||10638===e||10639===e||10640===e||10641===e||10642===e||10643===e||10644===e||10645===e||10646===e||10647===e||10648===e||e>=10649&&e<=10711||10712===e||10713===e||10714===e||10715===e||e>=10716&&e<=10747||10748===e||10749===e||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||11158===e||e>=11159&&e<=11263||e>=11776&&e<=11777||11778===e||11779===e||11780===e||11781===e||e>=11782&&e<=11784||11785===e||11786===e||11787===e||11788===e||11789===e||e>=11790&&e<=11798||11799===e||e>=11800&&e<=11801||11802===e||11803===e||11804===e||11805===e||e>=11806&&e<=11807||11808===e||11809===e||11810===e||11811===e||11812===e||11813===e||11814===e||11815===e||11816===e||11817===e||e>=11818&&e<=11822||11823===e||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||11840===e||11841===e||11842===e||e>=11843&&e<=11855||e>=11856&&e<=11857||11858===e||e>=11859&&e<=11903||e>=12289&&e<=12291||12296===e||12297===e||12298===e||12299===e||12300===e||12301===e||12302===e||12303===e||12304===e||12305===e||e>=12306&&e<=12307||12308===e||12309===e||12310===e||12311===e||12312===e||12313===e||12314===e||12315===e||12316===e||12317===e||e>=12318&&e<=12319||12320===e||12336===e||64830===e||64831===e||e>=65093&&e<=65094}function ht(e){e.forEach((function(e){if(delete e.location,we(e)||_e(e))for(var t in e.options)delete e.options[t].location,ht(e.options[t].value);else me(e)&&Ae(e.style)||(Ee(e)||be(e))&&Le(e.style)?delete e.style.location:Se(e)&&ht(e.children)}))}function pt(e,t){void 0===t&&(t={}),t=r({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var n=new at(e,t).parse();if(n.err){var i=SyntaxError(Q[n.err.kind]);throw i.location=n.err.location,i.originalMessage=n.err.message,i}return(null==t?void 0:t.captureLocation)||ht(n.val),n.val}function ft(e,t){var n=t&&t.cache?t.cache:wt,r=t&&t.serializer?t.serializer:mt;return(t&&t.strategy?t.strategy:yt)(e,{cache:n,serializer:r})}function dt(e,t,n,r){var i,o=null==(i=r)||"number"==typeof i||"boolean"==typeof i?r:n(r),s=t.get(o);return void 0===s&&(s=e.call(this,r),t.set(o,s)),s}function gt(e,t,n){var r=Array.prototype.slice.call(arguments,3),i=n(r),o=t.get(i);return void 0===o&&(o=e.apply(this,r),t.set(i,o)),o}function vt(e,t,n,r,i){return n.bind(t,e,r,i)}function yt(e,t){return vt(e,this,1===e.length?dt:gt,t.cache.create(),t.serializer)}var mt=function(){return JSON.stringify(arguments)};function Et(){this.cache=Object.create(null)}Et.prototype.get=function(e){return this.cache[e]},Et.prototype.set=function(e,t){this.cache[e]=t};var bt,wt={create:function(){return new Et}},_t={variadic:function(e,t){return vt(e,this,gt,t.cache.create(),t.serializer)},monadic:function(e,t){return vt(e,this,dt,t.cache.create(),t.serializer)}};!function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"}(bt||(bt={}));var Tt,St=function(e){function t(t,n,r){var i=e.call(this,t)||this;return i.code=n,i.originalMessage=r,i}return n(t,e),t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),At=function(e){function t(t,n,r,i){return e.call(this,'Invalid values for "'.concat(t,'": "').concat(n,'". Options are "').concat(Object.keys(r).join('", "'),'"'),bt.INVALID_VALUE,i)||this}return n(t,e),t}(St),Lt=function(e){function t(t,n,r){return e.call(this,'Value for "'.concat(t,'" must be of type ').concat(n),bt.INVALID_VALUE,r)||this}return n(t,e),t}(St),Pt=function(e){function t(t,n){return e.call(this,'The intl string context variable "'.concat(t,'" was not provided to the string "').concat(n,'"'),bt.MISSING_VALUE,n)||this}return n(t,e),t}(St);function Nt(e){return"function"==typeof e}function Ct(e,t,n,r,i,o,s){if(1===e.length&&ve(e[0]))return[{type:Tt.literal,value:e[0].value}];for(var a=[],u=0,c=e;u<c.length;u++){var l=c[u];if(ve(l))a.push({type:Tt.literal,value:l.value});else if(Te(l))"number"==typeof o&&a.push({type:Tt.literal,value:n.getNumberFormat(t).format(o)});else{var h=l.value;if(!i||!(h in i))throw new Pt(h,s);var p=i[h];if(ye(l))p&&"string"!=typeof p&&"number"!=typeof p||(p="string"==typeof p||"number"==typeof p?String(p):""),a.push({type:"string"==typeof p?Tt.literal:Tt.object,value:p});else if(Ee(l)){var f="string"==typeof l.style?r.date[l.style]:Le(l.style)?l.style.parsedOptions:void 0;a.push({type:Tt.literal,value:n.getDateTimeFormat(t,f).format(p)})}else if(be(l)){f="string"==typeof l.style?r.time[l.style]:Le(l.style)?l.style.parsedOptions:void 0;a.push({type:Tt.literal,value:n.getDateTimeFormat(t,f).format(p)})}else if(me(l)){(f="string"==typeof l.style?r.number[l.style]:Ae(l.style)?l.style.parsedOptions:void 0)&&f.scale&&(p*=f.scale||1),a.push({type:Tt.literal,value:n.getNumberFormat(t,f).format(p)})}else{if(Se(l)){var d=l.children,g=l.value,v=i[g];if(!Nt(v))throw new Lt(g,"function",s);var y=v(Ct(d,t,n,r,i,o).map((function(e){return e.value})));Array.isArray(y)||(y=[y]),a.push.apply(a,y.map((function(e){return{type:"string"==typeof e?Tt.literal:Tt.object,value:e}})))}if(we(l)){if(!(m=l.options[p]||l.options.other))throw new At(l.value,p,Object.keys(l.options),s);a.push.apply(a,Ct(m.value,t,n,r,i))}else if(_e(l)){var m;if(!(m=l.options["=".concat(p)])){if(!Intl.PluralRules)throw new St('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',bt.MISSING_INTL_API,s);var E=n.getPluralRules(t,{type:l.pluralType}).select(p-(l.offset||0));m=l.options[E]||l.options.other}if(!m)throw new At(l.value,p,Object.keys(l.options),s);a.push.apply(a,Ct(m.value,t,n,r,i,p-(l.offset||0)))}else;}}}return function(e){return e.length<2?e:e.reduce((function(e,t){var n=e[e.length-1];return n&&n.type===Tt.literal&&t.type===Tt.literal?n.value+=t.value:e.push(t),e}),[])}(a)}function Ot(e,t){return t?Object.keys(e).reduce((function(n,i){var o,s;return n[i]=(o=e[i],(s=t[i])?r(r(r({},o||{}),s||{}),Object.keys(o).reduce((function(e,t){return e[t]=r(r({},o[t]),s[t]||{}),e}),{})):o),n}),r({},e)):e}function It(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,n){e[t]=n}}}}}!function(e){e[e.literal=0]="literal",e[e.object=1]="object"}(Tt||(Tt={}));var Rt,kt=function(){function e(t,n,r,i){var o,s=this;if(void 0===n&&(n=e.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=s.formatToParts(e);if(1===t.length)return t[0].value;var n=t.reduce((function(e,t){return e.length&&t.type===Tt.literal&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e}),[]);return n.length<=1?n[0]||"":n},this.formatToParts=function(e){return Ct(s.ast,s.locales,s.formatters,s.formats,e,void 0,s.message)},this.resolvedOptions=function(){return{locale:Intl.NumberFormat.supportedLocalesOf(s.locales)[0]}},this.getAst=function(){return s.ast},"string"==typeof t){if(this.message=t,!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=e.__parse(t,{ignoreTag:null==i?void 0:i.ignoreTag})}else this.ast=t;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=Ot(e.formats,r),this.locales=n,this.formatters=i&&i.formatters||(void 0===(o=this.formatterCache)&&(o={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:ft((function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.NumberFormat).bind.apply(e,u([void 0],t,!1)))}),{cache:It(o.number),strategy:_t.variadic}),getDateTimeFormat:ft((function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.DateTimeFormat).bind.apply(e,u([void 0],t,!1)))}),{cache:It(o.dateTime),strategy:_t.variadic}),getPluralRules:ft((function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.PluralRules).bind.apply(e,u([void 0],t,!1)))}),{cache:It(o.pluralRules),strategy:_t.variadic})})}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=(new Intl.NumberFormat).resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.__parse=pt,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}(),Dt=((Rt=function(){function e(){this.cache=new Map}return e.prototype.format=function(e){var t=e.translation,n=e.language,r=e.params,i=!Object.values(r).find((function(e){return"function"==typeof e}));return new kt(t,n,void 0,{ignoreTag:i}).format(r)},e}()).type="formatter",Rt);e.DEVTOOLS_ID=L,e.IcuFormatter=Dt,e.NodeHelper=I,e.RESTRICTED_ASCENDANT_ATTRIBUTE=w,e.TOLGEE_ATTRIBUTE_NAME=_,e.TOLGEE_HIGHLIGHTER_CLASS=A,e.TOLGEE_TARGET_ATTRIBUTE=T,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=S,e.TextHelper=B,e.Tolgee=ge,e.TolgeeConfig=x,e.TranslationData=m,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/core"]={})}(this,(function(e){"use strict";var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function i(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function u(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var c,l="__tolgee_preferredLanguages",h="__tolgee_currentLanguage",p=function(){function e(){}return Object.defineProperty(e.prototype,"currentLanguage",{get:function(){var e;return(null===(e=this.config)||void 0===e?void 0:e.forceLanguage)?this.config.forceLanguage:(this._currentLanguage||(this._currentLanguage=this.getInitialLanguage()),this._currentLanguage)},set:function(e){var t;if(!e)throw new Error("Setting invalid language value ".concat(e));this._currentLanguage=e,(null===(t=this.config)||void 0===t?void 0:t.enableLanguageStore)&&"undefined"!=typeof localStorage&&localStorage.setItem(h,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"preferredLanguages",{get:function(){return new Set(JSON.parse(localStorage.getItem(l)))},set:function(e){localStorage.setItem(l,JSON.stringify(Array.from(e)))},enumerable:!1,configurable:!0}),e.prototype.getInitialLanguage=function(){if(this.config.enableLanguageStore){var e=this.getStoredLanguage();if(e)return e}if(this.config.enableLanguageDetection){var t=this.getLanguageByNavigator();if(t)return t}return this.config.defaultLanguage},e.prototype.getStoredLanguage=function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(h);if(!this.config.availableLanguages)return e;if(this.config.availableLanguages.indexOf(e)>-1)return e}},e.prototype.getLanguageByNavigator=function(){if("undefined"!=typeof window&&this.config.availableLanguages){var e=window.navigator.language,t=this.config.availableLanguages.find((function(t){return t===e}));if(t)return t;var n=function(e){return e.replace(/^(.+?)(-.*)?$/,"$1")},r=n(window.navigator.language),i=this.config.availableLanguages.find((function(e){return n(e)===r}));if(i)return i}},e}(),f=function(){function e(e){this.onUnsubscribe=e}return e.prototype.unsubscribe=function(){this.onUnsubscribe()},e}(),d=function(){function e(){this.idCounter=0,this._subscriptions=new Map}return Object.defineProperty(e.prototype,"subscriptions",{get:function(){return this._subscriptions},enumerable:!1,configurable:!0}),e.prototype.emit=function(e){var t,n,r=[];try{for(var i=s(this.subscriptions.values()),o=i.next();!o.done;o=i.next()){var a=(0,o.value)(e);"function"==typeof(null==a?void 0:a.then)&&r.push(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}if(0!==r.length)return new Promise((function(e){return Promise.all(r).then((function(){return e()}))}))},e.prototype.subscribe=function(e){var t=this,n=this.idCounter++,r=new f((function(){return t.unsubscribe(n)}));return this.subscriptions.set(n,e),r},e.prototype.unsubscribe=function(e){this._subscriptions.delete(e)||console.warn("Event to unsubscribe was not found")},e}(),g=function(){this.TRANSLATION_CHANGED=new d,this.LANGUAGE_CHANGED=new d,this.LANGUAGE_LOADED=new d,this.ELEMENT_REGISTERED=new d},v=function(e){function t(n,r){var i=e.call(this,"Api http error")||this;return i.response=n,i.code=r,Object.setPrototypeOf(i,t.prototype),i}return n(t,e),t}(Error),y=function(){function e(e){this.properties=e}return e.handleErrors=function(e){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:if(!(e.status>=400))return[3,5];t=new v(e),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e.json()];case 2:return n=r.sent(),t.code=n.code,[3,4];case 3:return r.sent(),console.warn("Tolgee server responded with invalid status code."),[3,4];case 4:throw t;case 5:return[2,e]}}))}))},e.prototype.fetch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return i(this,void 0,void 0,(function(){var n,i,s;return o(this,(function(o){return"object"==typeof t[0]?[2,fetch(r(r({},t[0]),{url:this.getUrl(t[0].url)})).then((function(t){return e.handleErrors(t)}))]:(n=a(t),i=n[0],s=n.slice(1),[2,fetch.apply(void 0,u([this.getUrl(i)],a(s),!1)).then((function(t){return e.handleErrors(t)}))])}))}))},e.prototype.fetchJson=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.fetch.apply(this,u([],a(e),!1)).then((function(e){return e.json()}))]}))}))},e.prototype.post=function(e,t,n){void 0===n&&(n={});for(var s=[],c=3;c<arguments.length;c++)s[c-3]=arguments[c];return i(this,void 0,void 0,(function(){return o(this,(function(i){return[2,this.fetch.apply(this,u([e,r({body:JSON.stringify(t),method:"POST",headers:{"Content-Type":"application/json"}},n)],a(s),!1))]}))}))},e.prototype.postJson=function(e,t,n){void 0===n&&(n={});for(var r=[],s=3;s<arguments.length;s++)r[s-3]=arguments[s];return i(this,void 0,void 0,(function(){return o(this,(function(i){return[2,this.post.apply(this,u([e,t,n],a(r),!1)).then((function(e){return e.json()}))]}))}))},e.prototype.getUrl=function(e){var t=e.indexOf("?")<0?"?":"&";return"".concat(this.properties.config.apiUrl,"/").concat(e).concat(t,"ak=").concat(this.properties.config.apiKey)},e}(),m=function(e,t,n){this.key=e,this.translations=t,this.id=n},E=function(){function e(e,t,n,s){var c=this;this.properties=e,this.coreService=t,this.apiHttpService=n,this.eventService=s,this.translationsCache=new Map,this.fetchPromises={},this.fetchedDev={},this.updateTranslationInCache=function(e){return i(c,void 0,void 0,(function(){var t,n=this;return o(this,(function(r){switch(r.label){case 0:return t={},Object.entries(e.translations).forEach((function(r){var i=a(r,2),o=i[0],s=i[1],u=n.translationsCache.get(o);u&&(u[e.name]=s.text),t[o]=s.text})),[4,this.eventService.TRANSLATION_CHANGED.emit(new m(e.name,t,e.id))];case 1:return r.sent(),[2]}}))}))},this.getTranslationsOfKey=function(e,t){return void 0===t&&(t=new Set([c.properties.currentLanguage])),i(c,void 0,void 0,(function(){var n,i,s,c,l,h,p,f,d,g,y;return o(this,(function(o){switch(o.label){case 0:this.coreService.checkScope("translations.view"),o.label=1;case 1:return o.trys.push([1,3,,7]),n=u([],a(t),!1),i=n.map((function(e){return"languages=".concat(e)})).join("&"),[4,this.apiHttpService.fetchJson("v2/projects/translations?".concat(i,"&filterKeyName=").concat(encodeURIComponent(e)))];case 2:return s=o.sent(),c=n.reduce((function(e,t){var n;return r(r({},e),((n={})[t]="",n))}),{}),(null==(l=null===(g=null===(d=s._embedded)||void 0===d?void 0:d.keys)||void 0===g?void 0:g[0])?void 0:l.translations)&&Object.entries(l.translations).forEach((function(e){var t=a(e,2),n=t[0],r=t[1];return c[n]=r.text})),h=null===(y=s.selectedLanguages)||void 0===y?void 0:y.map((function(e){return e.tag})),[2,[l,h]];case 3:return(p=o.sent())instanceof v&&404===p.response.status&&"language_not_found"===p.code?(f=this.properties,[4,this.coreService.getLanguages()]):[3,5];case 4:return f.preferredLanguages=o.sent(),console.error("Requested language not found, refreshing the page!"),location.reload(),[3,6];case 5:throw p;case 6:return[3,7];case 7:return[2]}}))}))}}return e.translationByValue=function(e,t){return e||(t||void 0)},e.prototype.initStatic=function(){var e,t=this;"object"==typeof(null===(e=this.properties.config)||void 0===e?void 0:e.staticData)&&Object.entries(this.properties.config.staticData).forEach((function(e){var n=a(e,2),r=n[0],i=n[1];"function"!=typeof i&&t.setLanguageData(r,i)}))},e.prototype.getCachedTranslations=function(){return this.translationsCache},e.prototype.loadTranslations=function(e){return void 0===e&&(e=this.properties.currentLanguage),i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this.isFetchNeeded(e)?(this.fetchPromises[e]instanceof Promise||(this.fetchPromises[e]=this.fetchTranslations(e)),[4,this.fetchPromises[e]]):[3,2];case 1:t.sent(),this.eventService.LANGUAGE_LOADED.emit(e),t.label=2;case 2:return this.fetchPromises[e]=void 0,[2,this.translationsCache.get(e)]}}))}))},e.prototype.getTranslation=function(t,n,r){return void 0===n&&(n=this.properties.currentLanguage),i(this,void 0,void 0,(function(){var i,s;return o(this,(function(o){switch(o.label){case 0:return this.isFetchNeeded(n)?[4,this.loadTranslations(n)]:[3,2];case 1:o.sent(),o.label=2;case 2:return(i=this.getFromCache(t,n))?[3,5]:(s=this.properties.config.fallbackLanguage,this.isFetchNeeded(s)?[4,this.loadTranslations(this.properties.config.fallbackLanguage)]:[3,4]);case 3:o.sent(),o.label=4;case 4:i=this.getFromCache(t,this.properties.config.fallbackLanguage),o.label=5;case 5:return[2,e.translationByValue(i,r)]}}))}))},e.prototype.updateKeyComplex=function(e,t){var n,s;return i(this,void 0,void 0,(function(){var i;return o(this,(function(o){switch(o.label){case 0:return this.coreService.checkScope("translations.edit"),[4,this.apiHttpService.postJson("v2/projects/keys/".concat(e,"/complex-update"),r(r({},t),{screenshotUploadedImageIds:(null===(n=t.screenshotUploadedImageIds)||void 0===n?void 0:n.length)?t.screenshotUploadedImageIds:void 0,screenshotIdsToDelete:(null===(s=t.screenshotIdsToDelete)||void 0===s?void 0:s.length)?t.screenshotIdsToDelete:void 0}),{method:"put"})];case 1:return i=o.sent(),[4,this.updateTranslationInCache(i)];case 2:return o.sent(),[2,i]}}))}))},e.prototype.createKey=function(e){var t;return i(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return this.coreService.checkScope("keys.edit"),[4,this.apiHttpService.postJson("v2/projects/keys/create",r(r({},e),{screenshotUploadedImageIds:(null===(t=e.screenshotUploadedImageIds)||void 0===t?void 0:t.length)?e.screenshotUploadedImageIds:void 0}))];case 1:return n=i.sent(),[4,this.updateTranslationInCache(n)];case 2:return i.sent(),[2,n]}}))}))},e.prototype.setTranslations=function(e){return i(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return this.coreService.checkScope("translations.edit"),[4,this.apiHttpService.postJson("v2/projects/translations",e)];case 1:return t=n.sent(),[4,this.updateTranslationInCache({id:t.keyId,name:t.keyName,translations:t.translations})];case 2:return n.sent(),[2,t]}}))}))},e.prototype.changeTranslations=function(e){var t=e.key,n=e.translations;return i(this,void 0,void 0,(function(){var e,r=this;return o(this,(function(s){switch(s.label){case 0:return e={},Object.entries(n).forEach((function(n){var i=a(n,2),o=i[0],s=i[1],u=r.translationsCache.get(o);u&&(e[o]=u[t],u[t]=s)})),[4,this.eventService.TRANSLATION_CHANGED.emit({key:t,translations:n})];case 1:return s.sent(),[2,function(){return i(r,void 0,void 0,(function(){var n=this;return o(this,(function(r){switch(r.label){case 0:return Object.entries(e).forEach((function(e){var r=a(e,2),i=r[0],o=r[1],s=n.translationsCache.get(i);s&&(s[t]=o)})),[4,this.eventService.TRANSLATION_CHANGED.emit({key:t,translations:e})];case 1:return r.sent(),[2]}}))}))}]}}))}))},e.prototype.getFromCacheOrFallback=function(t,n,r){void 0===n&&(n=this.properties.currentLanguage);var i=this.properties.config.fallbackLanguage,o=this.getFromCache(t,n)||this.getFromCache(t,i);if(o||this.isLoaded(n)&&this.isLoaded(i))return e.translationByValue(o,r)},e.prototype.isFetchNeeded=function(e){var t="development"===this.properties.mode,n=void 0!==this.translationsCache.get(e),r=Boolean(this.fetchedDev[e]);return t&&!r||!n},e.prototype.isLoaded=function(e){return void 0!==this.translationsCache.get(e)},e.prototype.fetchTranslations=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return"development"===this.properties.mode?[4,this.fetchTranslationsDevelopment(e)]:[3,2];case 1:return[2,t.sent()];case 2:return[4,this.fetchTranslationsProduction(e)];case 3:return[2,t.sent()]}}))}))},e.prototype.fetchTranslationsProduction=function(e){var t,n;return i(this,void 0,void 0,(function(){var r,i,s,a;return o(this,(function(o){switch(o.label){case 0:return"function"!=typeof(r=null===(n=null===(t=this.properties.config)||void 0===t?void 0:t.staticData)||void 0===n?void 0:n[e])?[3,2]:[4,r()];case 1:return a=o.sent(),this.setLanguageData(e,a),[2];case 2:if(void 0!==r)return this.setLanguageData(e,r),[2];o.label=3;case 3:i="".concat(this.properties.config.filesUrlPrefix||"/").concat(e,".json"),o.label=4;case 4:return o.trys.push([4,10,,11]),[4,fetch(i)];case 5:if((s=o.sent()).status>=400)return console.error("Server responded with error status while loading localization data."),this.setLanguageData(e,{}),[2];o.label=6;case 6:return o.trys.push([6,8,,9]),[4,s.json()];case 7:return a=o.sent(),this.setLanguageData(e,a),[3,9];case 8:return o.sent(),console.error("Error parsing json retrieved from ".concat(i,".")),this.setEmptyLanguageData(e),[3,9];case 9:return[3,11];case 10:return o.sent(),console.error("Error fetching localization data from ".concat(i,".")),this.setEmptyLanguageData(e),[3,11];case 11:return[2]}}))}))},e.prototype.fetchTranslationsDevelopment=function(e){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return[4,this.coreService.loadApiKeyDetails()];case 1:r.sent(),this.coreService.checkScope("translations.view"),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.apiHttpService.fetchJson("v2/projects/translations/".concat(e))];case 3:return t=r.sent(),this.fetchedDev[e]=!0,this.setLanguageData(e,t[e]||{}),[3,5];case 4:return n=r.sent(),console.error("Error while fetching localization data from API.",n),this.setEmptyLanguageData(e),[2];case 5:return[2]}}))}))},e.prototype.setEmptyLanguageData=function(e){this.translationsCache.set(e,{})},e.prototype.setLanguageData=function(e,t){var n=function(e){var t={};return Object.entries(e).forEach((function(e){var r=a(e,2),i=r[0],o=r[1];o&&("object"!=typeof o?t[i]=o:Object.entries(n(o)).forEach((function(e){var n=a(e,2),r=n[0],o=n[1];t[i+"."+r]=o})))})),t};this.translationsCache.set(e,n(t))},e.prototype.getFromCache=function(e,t){void 0===t&&(t=this.properties.currentLanguage);var n=this.translationsCache.get(t);if(void 0!==n)return n[e]},e}(),b=function(){function e(e,t,n){var r=this;this.properties=e,this.translationService=t,this.moduleService=n,this.format=function(e,t,n){try{var i=e;return r.moduleService.formatter&&(i=r.moduleService.formatter.format({translation:i,params:t,language:n||r.properties.currentLanguage})),i}catch(e){console.error(e)}}}return e.prototype.translate=function(e,t,n,r,s){return void 0===n&&(n=this.properties.currentLanguage),i(this,void 0,void 0,(function(){var i;return o(this,(function(o){switch(o.label){case 0:return[4,this.translationService.getTranslation(e,n,s)];case 1:return i=o.sent(),[2,this.formatTranslation(e,i,t,n,r)]}}))}))},e.prototype.instant=function(e,t,n,r,i){void 0===n&&(n=this.properties.currentLanguage);var o=this.translationService.getFromCacheOrFallback(e,n,i);return this.formatTranslation(e,o,t,n,r)},e.prototype.formatTranslation=function(e,t,n,r,i){return void 0!==t?this.format(t,n,r):i?"":e},e}();e.ModifierKey=void 0,(c=e.ModifierKey||(e.ModifierKey={}))[c.Alt=0]="Alt",c[c.Control=1]="Control",c[c.Shift=2]="Shift",c[c.Meta=3]="Meta";var w="data-tolgee-restricted",_="_tolgee",T="_tolgee-target",S="data-tolgee-key-only",A="_tolgee-highlighter",L="__tolgee_dev_tools",P={capture:!0},N={capture:!0,passive:!0},C=function(){function t(t){var n=this;this.dependencies=t,this.keysDown=new Set,this.mouseOnChanged=new d,this.keysChanged=new d,this.highlight=function(e){n.highlighted!==e&&(n.unhighlight(),e&&(e._tolgee.preventClean=!0,e._tolgee.highlight(),n.highlighted=e,n.mouseOnChanged.emit(e)))},this.unhighlight=function(){n.highlighted&&(n.highlighted._tolgee.preventClean=!1,n.highlighted._tolgee.unhighlight(),n.highlighted=void 0,n.mouseOnChanged.emit(n.highlighted))},this.blockEvents=function(e){n.areKeysDown()&&!n.isInUiDialog(e.target)&&(e.stopPropagation(),e.preventDefault())},this.onMouseMove=function(e){n.updateCursorPosition({x:e.clientX,y:e.clientY})},this.onBlur=function(){n.keysDown=new Set,n.keysChanged.emit(n.areKeysDown()),n.updateHighlight()},this.onKeyDown=function(t){var r=e.ModifierKey[t.key];void 0!==r&&(n.keysDown.add(r),n.keysChanged.emit(n.areKeysDown())),n.updateHighlight()},this.onKeyUp=function(t){n.keysDown.delete(e.ModifierKey[t.key]),n.keysChanged.emit(n.areKeysDown()),n.updateHighlight()},this.onScroll=function(){var e;null===(e=n.highlighted)||void 0===e||e._tolgee.highlight()},this.onClick=function(e){if(n.blockEvents(e),n.areKeysDown()){var t=n.getClosestTolgeeElement(e.target);t&&t===n.highlighted&&(n.dependencies.translationHighlighter.translationEdit(e,t),n.unhighlight())}}}return t.prototype.run=function(){"undefined"!=typeof window&&this.initEventListeners()},t.prototype.stop=function(){"undefined"!=typeof window&&this.removeEventListeners()},t.prototype.updateHighlight=function(){var e,t=this.cursorPosition;t&&this.areKeysDown()&&(e=this.getClosestTolgeeElement(document.elementFromPoint(t.x,t.y))),this.highlight(e)},t.prototype.updateCursorPosition=function(e){this.cursorPosition=e,this.updateHighlight()},t.prototype.initEventListeners=function(){window.addEventListener("blur",this.onBlur,P),window.addEventListener("keydown",this.onKeyDown,P),window.addEventListener("keyup",this.onKeyUp,P),window.addEventListener("mousemove",this.onMouseMove,N),window.addEventListener("scroll",this.onScroll,N),window.addEventListener("click",this.onClick,P),window.addEventListener("mouseenter",this.blockEvents,P),window.addEventListener("mouseover",this.blockEvents,P),window.addEventListener("mouseout",this.blockEvents,P),window.addEventListener("mouseleave",this.blockEvents,P),window.addEventListener("mousedown",this.blockEvents,P),window.addEventListener("mouseup",this.blockEvents,P)},t.prototype.removeEventListeners=function(){window.removeEventListener("blur",this.onBlur,P),window.removeEventListener("keydown",this.onKeyDown,P),window.removeEventListener("keyup",this.onKeyUp,P),window.removeEventListener("mousemove",this.onMouseMove,N),window.removeEventListener("scroll",this.onScroll,N),window.removeEventListener("click",this.onClick,P),window.removeEventListener("mouseenter",this.blockEvents,P),window.removeEventListener("mouseover",this.blockEvents,P),window.removeEventListener("mouseout",this.blockEvents,P),window.removeEventListener("mouseleave",this.blockEvents,P),window.removeEventListener("mousedown",this.blockEvents,P),window.removeEventListener("mouseup",this.blockEvents,P)},t.prototype.isInUiDialog=function(e){return Boolean(this.findAncestor(e,(function(e){return e.id===L})))},t.prototype.getClosestTolgeeElement=function(e){return this.findAncestor(e,(function(e){return null==e?void 0:e._tolgee}))},t.prototype.findAncestor=function(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?this.findAncestor(e.parentElement,t):void 0},t.prototype.areKeysDown=function(){var e,t;try{for(var n=s(this.dependencies.properties.config.highlightKeys),r=n.next();!r.done;r=n.next()){var i=r.value;if(!this.keysDown.has(i))return!1}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return!0},t}(),O=function(){function e(e){var t=this;this.dependencies=e,this.translationEdit=function(e,n){return i(t,void 0,void 0,(function(){var t,r;return o(this,(function(i){switch(i.label){case 0:return[4,this.getRenderer()];case 1:return"object"!=typeof(t=i.sent())?[3,3]:[4,this.getKeyAndDefault(e,n)];case 2:return(r=i.sent())?(t.renderViewer(r.key,r.defaultValue),[2]):[2];case 3:return[2]}}))}))}}return e.getKeyOptions=function(e){return Array.from(e._tolgee.nodes).reduce((function(e,t){return u(u([],a(e),!1),a(t._tolgee.keys.map((function(e){return{key:e.key,defaultValue:e.defaultValue}}))),!1)}),[])},e.prototype.listen=function(e){this.dependencies.highlightFunctionInitializer.initFunctions(e)},e.prototype.getRenderer=function(){return i(this,void 0,void 0,(function(){var e,t,n,r,i,a,u,c,l,h;return o(this,(function(o){switch(o.label){case 0:if(void 0!==this._renderer)return[3,11];e=[this.dependencies.properties.config.ui,window["@tolgee/ui"]],o.label=1;case 1:o.trys.push([1,8,9,10]),t=s(e),n=t.next(),o.label=2;case 2:return n.done?[3,7]:(r=n.value)instanceof Promise?[4,r]:[3,4];case 3:return a=o.sent(),[3,5];case 4:a=r,o.label=5;case 5:if("function"==typeof(u="object"==typeof(i=a)?null==i?void 0:i.UI:i))return this._renderer=new u(this.dependencies),[3,7];o.label=6;case 6:return n=t.next(),[3,2];case 7:return[3,10];case 8:return c=o.sent(),l={error:c},[3,10];case 9:try{n&&!n.done&&(h=t.return)&&h.call(t)}finally{if(l)throw l.error}return[7];case 10:void 0===this._renderer&&console.warn('Tolgee UI is not provided. To translate interactively provide tolgee ui constructor to "ui" configuration property. To disable highlighting use production mode.'),o.label=11;case 11:return[2,this._renderer]}}))}))},e.prototype.getKeyAndDefault=function(t,n){return i(this,void 0,void 0,(function(){var r,i,s,a;return o(this,(function(o){switch(o.label){case 0:return n._tolgee.wrappedWithElementOnlyKey?[2,{key:n._tolgee.wrappedWithElementOnlyKey,defaultValue:n._tolgee.wrappedWithElementOnlyDefaultHtml}]:(r=e.getKeyOptions(n),(i=new Set(r.map((function(e){return e.key})))).size>1?[4,this.getRenderer()]:[3,3]);case 1:return[4,o.sent().getKey({keys:i,openEvent:t})];case 2:if(s=o.sent(),a=r.find((function(e){return e.key===s})))return[2,a];o.label=3;case 3:return 1===i.size?[2,r[0]]:(console.error("No key to translate. This seems like a bug in tolgee."),[2])}}))}))},e}(),I=function(){function e(){}return e.evaluate=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Array.from(this.evaluateGenerator.apply(this,u([],a(e),!1)))},e.evaluateToSingle=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.evaluate.apply(this,u([],a(e),!1));if(1===n.length)return n[0];if(n.length<1)throw new Error("No element found");throw new Error("Multiple elements found")},e.closestElement=function(e){return e instanceof Text?e.parentElement:e},e.getParentElement=function(e){return e.parentElement?e.parentElement:e.ownerElement?e.ownerElement:void 0},e.isElementTargetElement=function(e){return e.hasAttribute(T)},e.markElementAsTargetElement=function(e){e.setAttribute(T,"")},e.unmarkElementAsTargetElement=function(e){e.removeAttribute(T)},e.nodeContains=function(e,t){if(e.contains(t))return!0;if(t instanceof Attr){var n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1},e.evaluateGenerator=function(e,t){var n,r;return o(this,(function(i){switch(i.label){case 0:r=document.evaluate(e,t,void 0,XPathResult.ANY_TYPE),i.label=1;case 1:return null===(n=r.iterateNext())?[3,3]:[4,n];case 2:return i.sent(),[3,1];case 3:return[2]}}))},e.getNodeText=function(e){return e.textContent},e.setNodeText=function(e,t){e.textContent=t},e}(),R=function(){function e(e,t,n){this.properties=e,this.translationHighlighter=t,this.eventService=n,this.registeredElements=new Set}return e.prototype.register=function(e){(void 0!==this.getActiveNodes(e).next().value||e._tolgee.wrappedWithElementOnlyKey)&&("development"!==this.properties.mode||this.registeredElements.has(e)||this.translationHighlighter.listen(e),this.registeredElements.add(e),this.eventService.ELEMENT_REGISTERED.emit(e))},e.prototype.refreshAll=function(){var e,t;try{for(var n=s(this.registeredElements),r=n.next();!r.done;r=n.next()){var i=r.value;i._tolgee.preventClean||(this.cleanElementInactiveNodes(i),0!==i._tolgee.nodes.size||i._tolgee.wrappedWithElementOnlyKey||this.cleanElement(i))}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.prototype.cleanAll=function(){var e,t;try{for(var n=s(this.registeredElements),r=n.next();!r.done;r=n.next()){var i=r.value;this.cleanElement(i)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.prototype.findAllByKey=function(e){var t,n,r,i,o=[];try{for(var a=s(this.registeredElements),u=a.next();!u.done;u=a.next()){var c=u.value;if(c._tolgee.wrappedWithElementOnlyKey!==e)try{for(var l=(r=void 0,s(c._tolgee.nodes)),h=l.next();!h.done;h=l.next()){if(h.value._tolgee.keys.findIndex((function(t){return t.key===e}))>-1){o.push(c);break}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}else o.push(c)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},e.prototype.cleanElementInactiveNodes=function(e){this.isElementActive(e)&&(e._tolgee.nodes=new Set(this.getActiveNodes(e)))},e.prototype.cleanElement=function(e){e._tolgee.preventClean||(e._tolgee.highlightEl&&e._tolgee.unhighlight(),e.removeAttribute(_),delete e._tolgee,this.registeredElements.delete(e))},e.prototype.getActiveNodes=function(e){var t,n,r,i,a,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,7]),t=s(e._tolgee.nodes),n=t.next(),o.label=1;case 1:return n.done?[3,4]:(r=n.value,I.nodeContains(this.properties.config.targetElement,r)?[4,r]:[3,3]);case 2:o.sent(),o.label=3;case 3:return n=t.next(),[3,1];case 4:return[3,7];case 5:return i=o.sent(),a={error:i},[3,7];case 6:try{n&&!n.done&&(u=t.return)&&u.call(t)}finally{if(a)throw a.error}return[7];case 7:return[2]}}))},e.prototype.isElementActive=function(e){return this.properties.config.targetElement.contains(e)},e}(),k=function(){function e(e,t,n){this.properties=e,this.textWrapper=t,this.nodeRegistrar=n,this._observer=void 0,this._observing=!1}return Object.defineProperty(e.prototype,"observer",{get:function(){var e=this;return this._observer||"undefined"==typeof window||(this._observer=new MutationObserver((function(t){return i(e,void 0,void 0,(function(){var e,n,r,i,a,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,9,10,11]),e=s(t),n=e.next(),o.label=1;case 1:return n.done?[3,8]:(r=n.value,this._observing?"characterData"!==r.type?[3,3]:[4,this.textWrapper.handleText(r.target)]:[2]);case 2:return o.sent(),[3,7];case 3:return"childList"!==r.type?[3,5]:[4,this.textWrapper.handleSubtree(r.target)];case 4:return o.sent(),[3,7];case 5:return"attributes"!==r.type?[3,7]:[4,this.textWrapper.handleAttribute(r.target)];case 6:o.sent(),o.label=7;case 7:return n=e.next(),[3,1];case 8:return[3,11];case 9:return i=o.sent(),a={error:i},[3,11];case 10:try{n&&!n.done&&(u=e.return)&&u.call(e)}finally{if(a)throw a.error}return[7];case 11:return this.nodeRegistrar.refreshAll(),[2]}}))}))}))),this._observer},enumerable:!1,configurable:!0}),e.prototype.observe=function(){this.observer&&(this._observing||(this._observing=!0,this.observer.observe(this.properties.config.targetElement,{attributes:!0,childList:!0,subtree:!0,characterData:!0})))},e.prototype.stopObserving=function(){this.observer&&(this._observing=!1,this.observer.disconnect())},e}(),D=function(){function e(e,t){this.properties=e,this.apiHttpService=t}return e.prototype.getLanguages=function(){return i(this,void 0,void 0,(function(){var e,t;return o(this,(function(n){switch(n.label){case 0:return this.languagePromise instanceof Promise||(this.languagePromise=this.apiHttpService.fetchJson("v2/projects/languages?size=1000")),t=Set.bind,[4,this.languagePromise];case 1:return e=new(t.apply(Set,[void 0,n.sent()._embedded.languages.map((function(e){return e.tag}))])),this.properties.preferredLanguages=new Set(Array.from(this.properties.preferredLanguages).filter((function(t){return e.has(t)}))),[2,e]}}))}))},e.prototype.getLanguagesFull=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.getLanguages(),[4,this.languagePromise];case 1:return[2,e.sent()._embedded.languages]}}))}))},e.prototype.getApiKeyDetails=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.apiHttpService.fetchJson("v2/api-keys/current")];case 1:return[2,t.sent()];case 2:return e=t.sent(),console.error(e),console.error("Error getting scopes. Trying to switch to production mode!"),this.properties.mode="production",[3,3];case 3:return[2]}}))}))},e.prototype.isAuthorizedTo=function(e){return this.properties.scopes.indexOf(e)>-1},e.prototype.checkScope=function(e){if(!this.isAuthorizedTo(e))throw new Error("Api key not permitted to do this, please add 'translations.view' scope.")},e.prototype.loadApiKeyDetails=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return void 0!==this.properties.scopes?[3,2]:[4,this.getApiKeyDetails()];case 1:e=t.sent(),this.properties.scopes=e.scopes,this.properties.projectId=e.projectId,this.properties.permittedLanguageIds=e.permittedLanguageIds,t.label=2;case 2:return[2]}}))}))},e}(),U=function(){if("undefined"!=typeof document)return document.body},x=function(t){this.inputPrefix="%-%tolgee:",this.inputSuffix="%-%",this.defaultLanguage="en",this.enableLanguageStore=!0,this.enableLanguageDetection=!0,this.filesUrlPrefix="i18n/",this.tagAttributes={textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},this.highlightKeys=[e.ModifierKey.Alt],this.passToParent=["option","optgroup"],this.restrictedElements=["script","style"],this.highlightColor="rgb(255, 0, 0)",this.highlightWidth=5,this.wrapperMode="text",this.preloadFallback=!1,Object.defineProperty(this,"targetElement",{set:function(e){if(void 0!==this.targetElement)throw new Error("Target element is already defined!");if(void 0===e&&(this._targetElement=U()),I.isElementTargetElement(e))throw console.error("Target element: ",this._targetElement),new Error("An tolgee instance is inited with provided target element");this._targetElement=e,I.markElementAsTargetElement(this._targetElement)},get:function(){return this._targetElement}}),Object.assign(this,t||{}),"undefined"!=typeof sessionStorage&&(this.apiUrl=sessionStorage.getItem("__tolgee_apiUrl")||this.apiUrl,this.apiKey=sessionStorage.getItem("__tolgee_apiKey")||this.apiKey),void 0===this._targetElement&&(this._targetElement=U()),this.fallbackLanguage=this.fallbackLanguage||this.defaultLanguage,void 0===this.watch&&(this.watch=Boolean(this.apiKey&&this.apiUrl)),void 0===this.availableLanguages&&this.staticData&&(this.availableLanguages=Object.keys(this.staticData))},M=function(){function e(e,t,n,s,a){var u=this;this.messages=e,this.properties=t,this.eventService=n,this.elementRegistrar=s,this.translationService=a,this.handshakeSucceed=!1,this.takeScreenshot=function(e){return new Promise((function(t,n){u.translationService.changeTranslations(e).then((function(r){return i(u,void 0,void 0,(function(){var i,s,a=this;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.highlightAllByKey(e.key),[4,(u=100,new Promise((function(e){return setTimeout(e,u)})))];case 1:return o.sent(),this.messages.send("TOLGEE_TAKE_SCREENSHOT"),i=this.messages.listen("TOLGEE_SCREENSHOT_TAKEN",(function(n){a.unhighlightAllByKey(e.key),t(n),r(),i()})),[3,3];case 2:return s=o.sent(),r(),n(s),[3,3];case 3:return[2]}var u}))}))})).catch((function(e){n(e)}))}))},this.handshake=function(){var e=r(r({},u.properties),{config:r(r({},u.properties.config),{staticData:void 0,targetElement:void 0,_targetElement:void 0,ui:void 0}),uiPresent:Boolean(u.properties.config.ui),uiVersion:"4.7.2"}),t=null,n=function(){u.messages.send("TOLGEE_READY",e)},i=function(){clearInterval(t)};u.messages.listen("TOLGEE_PLUGIN_READY",(function(){u.handshakeSucceed=!0,u.messages.send("TOLGEE_READY",e),i()})),n();var o=0;t=setInterval((function(){!u.handshakeSucceed&&o<5?(n(),o+=1):i()}),200)}}return e.prototype.run=function(){try{this.messages.startListening(),this.handshake()}catch(e){console.warn(e),console.warn("Can not start communication with browser plugin. Check waning above.")}},e.prototype.stop=function(){this.messages.stopListening()},e.prototype.highlightAllByKey=function(e){this.elementRegistrar.findAllByKey(e).forEach((function(e){return e._tolgee.highlight()}))},e.prototype.unhighlightAllByKey=function(e){this.elementRegistrar.findAllByKey(e).forEach((function(e){return e._tolgee.unhighlight()}))},e}(),G=function(){function e(){var e=this;this.listeners=[],this.startListening=function(){var t=function(t){t.source==window&&e.listeners.forEach((function(e){e.type==t.data.type&&e.callback(t.data.data)}))};window.addEventListener("message",t,!1),"function"==typeof e._stopListening&&e._stopListening(),e._stopListening=function(){window.removeEventListener("message",t,!1)}},this.listen=function(t,n){var r={type:t,callback:n};return e.listeners.push(r),function(){e.listeners.splice(e.listeners.indexOf(r),1)}},this.send=function(e,t){try{window.postMessage({type:e,data:t},window.origin)}catch(e){console.warn("Cannot send message.",e)}}}return e.prototype.stopListening=function(){this._stopListening()},e}(),H={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},F=function(){function e(e){this.properties=e}return e.prototype.initFunctions=function(e){this.initHighlightFunction(e),this.initUnhighlightFunction(e)},e.prototype.initHighlightFunction=function(e){var t=this;e._tolgee.highlight=function(){var n=t.properties.config.highlightColor,r=t.properties.config.highlightWidth;if(e.isConnected){var i=e._tolgee.highlightEl;i||((i=document.createElement("div")).classList.add(A),Object.entries(H).forEach((function(e){var t=a(e,2),n=t[0],r=t[1];i.style[n]=r})),i.style.borderColor=n,e._tolgee.highlightEl=i,document.body.appendChild(i));var o=e.getBoundingClientRect();i.style.borderWidth=r+"px",i.style.top=o.top-r+"px",i.style.left=o.left-r+"px",i.style.width=o.width+"px",i.style.height=o.height+"px"}}},e.prototype.initUnhighlightFunction=function(e){e._tolgee.unhighlight=function(){var t;null===(t=e._tolgee.highlightEl)||void 0===t||t.remove(),e._tolgee.highlightEl=null}},e}(),j=function(){function e(e,t){this.coreService=e,this.apiHttpService=t}return e.prototype.uploadImage=function(e){return i(this,void 0,void 0,(function(){var t;return o(this,(function(n){return(t=new FormData).append("image",e),[2,this.apiHttpService.postJson("v2/image-upload",void 0,{headers:{},body:t})]}))}))},e.prototype.deleteImages=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.apiHttpService.post("v2/image-upload/".concat(e.join(",")),void 0,{method:"delete"})]}))}))},e}(),K=function(){var e=this;this.formatter=null,this.addModule=function(t){if("formatter"!==t.type)throw new Error("Module with unknown type");var n=new t;e.formatter=n}},V=function(){function e(e,t,n){this.properties=e,this.elementRegistrar=t,this.wrapper=n}return e.initParentElement=function(e){return void 0===e._tolgee&&(e._tolgee={nodes:new Set},e.setAttribute(_,"")),e},e.prototype.filterRestricted=function(e){var t=this.properties.config.restrictedElements;return e.filter((function(e){var n=I.closestElement(e);return!!n&&(-1===t.indexOf(n.tagName.toLowerCase())&&null===n.closest("[".concat(w,'="true"]')))}))},e.prototype.handleNodes=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,a,u,c,l,h,p,f,d;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,7]),t=s(e),n=t.next(),o.label=1;case 1:return n.done?[3,4]:(void 0===(r=n.value)._tolgee&&(r._tolgee={}),!0===(null==(i=r._tolgee)?void 0:i.locked)?[3,3]:(this.lockNode(r),[4,this.wrapper.unwrap(I.getNodeText(r))]));case 2:(a=o.sent())&&(u=a.text,c=a.keys,l=this.translateChildNode(r,u,c),(h=this.getParentElement(l))._tolgee.nodes.add(l),this.elementRegistrar.register(h)),this.unlockNode(r),o.label=3;case 3:return n=t.next(),[3,1];case 4:return[3,7];case 5:return p=o.sent(),f={error:p},[3,7];case 6:try{n&&!n.done&&(d=t.return)&&d.call(t)}finally{if(f)throw f.error}return[7];case 7:return[2]}}))}))},e.prototype.translateChildNode=function(e,t,n){return e._tolgee={oldTextContent:I.getNodeText(e),keys:n},I.setNodeText(e,t),e},e.prototype.lockNode=function(e){void 0===e._tolgee&&(e._tolgee={});var t=e._tolgee;return!0!==(null==t?void 0:t.locked)&&(t.locked=!0),e},e.prototype.unlockNode=function(e){e._tolgee&&(e._tolgee.locked=!1)},e.prototype.getParentElement=function(t){var n=this.getSuitableParent(t);return e.initParentElement(n)},e.prototype.getSuitableParent=function(e){var t=I.getParentElement(e);if(void 0===t)throw console.error(e),new Error("No suitable parent found for node above.");if(!this.properties.config.passToParent)return t;if(Array.isArray(this.properties.config.passToParent)){if(-1===this.properties.config.passToParent.findIndex((function(e){return t.tagName.toLowerCase()===e.toLowerCase()})))return t}return"function"!=typeof this.properties.config.passToParent||this.properties.config.passToParent(t)?this.getSuitableParent(t):t},e}(),X=function(){function e(e,t){this.properties=e,this.nodeHandler=t}return e.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,u,c,l,h,p,f,d,g,v,y,m,E,b,w;return o(this,(function(o){switch(o.label){case 0:t=this.properties.config.inputPrefix,n=this.properties.config.inputSuffix,o.label=1;case 1:o.trys.push([1,12,13,14]),r=s(Object.entries(this.properties.config.tagAttributes)),i=r.next(),o.label=2;case 2:if(i.done)return[3,11];u=a(i.value,2),c=u[0],l=u[1],o.label=3;case 3:o.trys.push([3,8,9,10]),b=void 0,h=s(l),p=h.next(),o.label=4;case 4:return p.done?[3,7]:(f=p.value,d="descendant-or-self::".concat(c,"/@").concat(f,"[contains(., '").concat(t,"') and contains(., '").concat(n,"')]"),g=I.evaluate(d,e),[4,this.nodeHandler.handleNodes(g)]);case 5:o.sent(),o.label=6;case 6:return p=h.next(),[3,4];case 7:return[3,10];case 8:return v=o.sent(),b={error:v},[3,10];case 9:try{p&&!p.done&&(w=h.return)&&w.call(h)}finally{if(b)throw b.error}return[7];case 10:return i=r.next(),[3,2];case 11:return[3,14];case 12:return y=o.sent(),m={error:y},[3,14];case 13:try{i&&!i.done&&(E=r.return)&&E.call(r)}finally{if(m)throw m.error}return[7];case 14:return[2]}}))}))},e}(),B=function(){function e(){}return e.splitOnNonEscapedDelimiter=function(e,t){for(var n=[],r="",i=!1,o=0;o<e.length;o++){var s=e[o];"\\"!==s||i?i?(i=!1,r+=s):s!==t?r+=s:(n.push(r),r=""):i=!0}return n.push(r),n},e.isCharEscaped=function(e,t){for(var n=0;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1},e.removeEscapes=function(e){for(var t="",n=!1,r=0;r<e.length;r++){var i=e[r];"\\"!==i||n?n?(n=!1,t+=i):t+=i:n=!0}return t},e}(),W=function(){function e(e,t){this.properties=e,this.textService=t,this.escapeForRegExp=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},this.escapeParam=function(e){return"string"==typeof e?e.replace(/[,:\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn('Parameters of type "'.concat(typeof e,'" are not supported in "text" wrapper mode.')),e)}}return Object.defineProperty(e.prototype,"rawUnWrapRegex",{get:function(){var e=this.escapeForRegExp(this.properties.config.inputPrefix),t=this.escapeForRegExp(this.properties.config.inputSuffix);return"(\\\\?)(".concat(e,"(.*?)").concat(t,")")},enumerable:!1,configurable:!0}),e.parseUnwrapped=function(e){var t,n,r=!1,i="",o="",a="KEY",u={key:"",params:{},defaultValue:void 0};try{for(var c=s(e),l=c.next();!l.done;l=c.next()){var h=l.value;"\\"!==h||r?r?(r=!1,i+=h):"KEY"!==a||","!==h?"KEY"!==a||":"!==h?"DEFAULT_VALUE"!==a||":"!==h?"PARAM_NAME"!==a||":"!==h?"PARAM_VALUE"!==a||","!==h?i+=h:(a="PARAM_NAME",u.params[o]=i,i=""):(a="PARAM_VALUE",o=i,i=""):(a="PARAM_NAME",u.defaultValue=i,i=""):(a="PARAM_NAME",u.key=i,i=""):(a="DEFAULT_VALUE",u.key=i,i=""):r=!0}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return"KEY"===a&&(u.key=i),"DEFAULT_VALUE"===a&&(u.defaultValue=i),"PARAM_VALUE"===a&&(u.params[o]=i),u},e.prototype.unwrap=function(e){for(var t,n=new RegExp(this.rawUnWrapRegex,"gs"),r=[],i=!1,o=0,s="";null!==(t=n.exec(e));){var u=t[1],c=a(t,4),l=c[0];c[1];var h=c[2],p=c[3],f=t.index;if(s+=t.input.substr(o,f-o),o=f+l.length,"\\"===u){if(!B.isCharEscaped(f,e)){s+=h;continue}u=""}var d=this.getTranslatedWithMetadata(p);r.push({key:d.key,params:d.params,defaultValue:d.defaultValue}),i=!0,s+=u+d.translated}if(s+=e.substring(o),i)return{text:s,keys:r}},e.prototype.wrap=function(e,t,n){var r=this;void 0===t&&(t={}),void 0===n&&(n=void 0);var i=Object.entries(t).map((function(e){var t=a(e,2),n=t[0],i=t[1];return"".concat(r.escapeParam(n),":").concat(r.escapeParam(i))})).join(",");i=i.length?":".concat(i):"";var o=void 0!==n?",".concat(this.escapeParam(n)):"";return"".concat(this.properties.config.inputPrefix).concat(this.escapeParam(e)).concat(o).concat(i).concat(this.properties.config.inputSuffix)},e.prototype.getTranslatedWithMetadata=function(t){var n=e.parseUnwrapped(t),r=n.key,i=n.params,o=n.defaultValue;return{translated:this.textService.instant(r,i,void 0,!1,o),key:r,params:i,defaultValue:o}},e}(),z=function(){function e(e,t,n,r,i,o){this.textHandler=e,this.eventService=t,this.properties=n,this.attributeHandler=r,this.coder=i,this.wrappedHandler=o,"undefined"!=typeof window&&(t.LANGUAGE_CHANGED.subscribe(this.refresh.bind(this)),t.TRANSLATION_CHANGED.subscribe(this.refresh.bind(this)))}return e.prototype.handleSubtree=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.attributeHandler.handle(e)];case 1:return t.sent(),[4,this.textHandler.handle(e)];case 2:return t.sent(),[4,this.wrappedHandler.handle(e)];case 3:return t.sent(),[2]}}))}))},e.prototype.refresh=function(){return i(this,void 0,void 0,(function(){var e,t,n,r,i,a,u,c,l,h,p,f,d,g;return o(this,(function(o){switch(o.label){case 0:e=I.evaluate("//*[@_tolgee]",this.properties.config.targetElement),o.label=1;case 1:o.trys.push([1,12,13,14]),t=s(e),n=t.next(),o.label=2;case 2:if(n.done)return[3,11];r=n.value,o.label=3;case 3:o.trys.push([3,8,9,10]),d=void 0,i=s(r._tolgee.nodes),a=i.next(),o.label=4;case 4:return a.done?[3,7]:(u=a.value,[4,this.coder.unwrap(u._tolgee.oldTextContent)]);case 5:(c=o.sent())&&I.setNodeText(u,c.text),o.label=6;case 6:return a=i.next(),[3,4];case 7:return[3,10];case 8:return l=o.sent(),d={error:l},[3,10];case 9:try{a&&!a.done&&(g=i.return)&&g.call(i)}finally{if(d)throw d.error}return[7];case 10:return n=t.next(),[3,2];case 11:return[3,14];case 12:return h=o.sent(),p={error:h},[3,14];case 13:try{n&&!n.done&&(f=t.return)&&f.call(t)}finally{if(p)throw p.error}return[7];case 14:return[2]}}))}))},e}(),Y=function(){function e(e,t){this.properties=e,this.nodeHandler=t}return e.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,s;return o(this,(function(o){switch(o.label){case 0:return t=this.properties.config.inputPrefix,n=this.properties.config.inputSuffix,r="./descendant-or-self::text()[contains(., '".concat(t,"') and contains(., '").concat(n,"')]"),i=I.evaluate(r,e),s=this.nodeHandler.filterRestricted(i),[4,this.nodeHandler.handleNodes(s)];case 1:return o.sent(),[2]}}))}))},e}(),J=function(){function e(e,t){this.elementRegistrar=e,this.nodeHandler=t}return e.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,n,r=this;return o(this,(function(i){return t="./descendant-or-self::*[@".concat(S,"]"),n=I.evaluate(t,e),this.nodeHandler.filterRestricted(n).forEach((function(e){var t=V.initParentElement(e);t._tolgee.wrappedWithElementOnlyKey=e.getAttribute(S),t._tolgee.wrappedWithElementOnlyDefaultHtml=e.innerHTML,r.elementRegistrar.register(t)})),[2]}))}))},e}(),q=function(){function e(e,t,n,r){this.coder=new W(t,n),this.nodeHandler=new V(t,r,this),this.textHandler=new Y(t,this.nodeHandler),this.attributeHandler=new X(t,this.nodeHandler),this.wrappedHandler=new J(r,this.nodeHandler),this.coreHandler=new z(this.textHandler,e,t,this.attributeHandler,this.coder,this.wrappedHandler)}return e.prototype.handleText=function(e){return this.textHandler.handle(e)},e.prototype.handleSubtree=function(e){return this.coreHandler.handleSubtree(e)},e.prototype.handleAttribute=function(e){return this.attributeHandler.handle(e)},e.prototype.wrap=function(e,t,n,r){return void 0===t&&(t={}),void 0===n&&(n=void 0),this.coder.wrap(e,t,n)},e.prototype.unwrap=function(e){return this.coder.unwrap(e)},e}();function Z(){}function $(){}Z.prototype.encode=function(e){for(var t=[],n=e.length,r=0;r<n;){var i=e.codePointAt(r),o=0,s=0;for(i<=127?(o=0,s=0):i<=2047?(o=6,s=192):i<=65535?(o=12,s=224):i<=2097151&&(o=18,s=240),t.push(s|i>>o),o-=6;o>=0;)t.push(128|i>>o&63),o-=6;r+=i>=65536?2:1}return t},$.prototype.decode=function(e){for(var t="",n=0;n<e.length;){var r=e[n],i=0,o=0;if(r<=127?(i=0,o=255&r):r<=223?(i=1,o=31&r):r<=239?(i=2,o=15&r):r<=244&&(i=3,o=7&r),e.length-n-i>0)for(var s=0;s<i;)o=o<<6|63&(r=e[n+s+1]),s+=1;else o=65533,i=e.length-n;t+=String.fromCodePoint(o),n+=i+1}return t};var Q,ee,te,ne="undefined"==typeof TextEncoder?Z:TextEncoder,re="undefined"==typeof TextDecoder?$:TextDecoder,ie=["",""],oe=RegExp("([".concat(ie.join(""),"]{9})+"),"gu"),se=function(e){var t=function(e){return Array.from((new ne).encode(e))}(e).map(Number).map((function(e){return function(e){var t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0"})).join("");return Array.from(t).map((function(e){return ie[Number(e)]})).join("")},ae=function(e){var t,n=Array.from(e).map((function(e){return ie.indexOf(e)})).map(String).join("").match(/(.{9})/g),r=Uint8Array.from(n.map((function(e){return parseInt(e.slice(0,8),2)})));return t=r,(new re).decode(new Uint8Array(t))},ue=function(){function e(e,t){this.properties=e,this.nodeHandler=t}return e.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,u,c,l,h,p,f,d,g,v,y,m,E;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,11,12,13]),t=s(Object.entries(this.properties.config.tagAttributes)),n=t.next(),o.label=1;case 1:if(n.done)return[3,10];r=a(n.value,2),i=r[0],u=r[1],o.label=2;case 2:o.trys.push([2,7,8,9]),m=void 0,c=s(u),l=c.next(),o.label=3;case 3:return l.done?[3,6]:(h=l.value,p="descendant-or-self::".concat(i,"/@").concat(h,"[contains(., '").concat(ie[0],"')]"),f=I.evaluate(p,e),[4,this.nodeHandler.handleNodes(f)]);case 4:o.sent(),o.label=5;case 5:return l=c.next(),[3,3];case 6:return[3,9];case 7:return d=o.sent(),m={error:d},[3,9];case 8:try{l&&!l.done&&(E=c.return)&&E.call(c)}finally{if(m)throw m.error}return[7];case 9:return n=t.next(),[3,1];case 10:return[3,13];case 11:return g=o.sent(),v={error:g},[3,13];case 12:try{n&&!n.done&&(y=t.return)&&y.call(t)}finally{if(v)throw v.error}return[7];case 13:return[2]}}))}))},e}(),ce=function(){function e(){this.values=[]}return e.prototype.valueToNumber=function(e){var t=this.values.indexOf(e);return-1===t&&(t=this.values.length,this.values.push(e)),t},e.prototype.numberToValue=function(e){return this.values[e]},e}(),le=function(){function e(){this.keyMemory=new ce,this.defaultMemory=new ce}return e.prototype.unwrap=function(e){var t=this,n=[];(function(e){var t,n=null===(t=e.match(oe))||void 0===t?void 0:t.filter((function(e){return e.length>8}));return(null==n?void 0:n.map(ae))||[]})(e).forEach((function(e){var r=a(function(e){var t,n,r=[];try{for(var i=s(e),o=i.next();!o.done;o=i.next()){var a=o.value;r.push(a.codePointAt(0))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(e),2),i=r[0],o=r[1],u=t.keyMemory.numberToValue(i),c=void 0!==o?t.defaultMemory.numberToValue(o):void 0;n.push({key:u,params:void 0,defaultValue:c})}));var r=function(e){return e.replace(oe,"")}(e);if(n.length)return{text:r,keys:n}},e.prototype.wrap=function(e,t,n,r){void 0===n&&(n=void 0),void 0===r&&(r=void 0);var i=[this.keyMemory.valueToNumber(e)];n&&i.push(this.defaultMemory.valueToNumber(n));var o=r||"",s=se(String.fromCodePoint.apply(String,u([],a(i),!1)));return"string"==typeof o?o+s:Array.isArray(o)?u(u([],a(o),!1),[s],!1):[o,s]},e}(),he=function(){function e(e,t,n){this.textHandler=e,this.attributeHandler=t,this.wrappedHandler=n}return e.prototype.handleSubtree=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.attributeHandler.handle(e)];case 1:return t.sent(),[4,this.textHandler.handle(e)];case 2:return t.sent(),[4,this.wrappedHandler.handle(e)];case 3:return t.sent(),[2]}}))}))},e}(),pe=function(){function e(e){this.nodeHandler=e}return e.prototype.handle=function(e){return i(this,void 0,void 0,(function(){var t,n,r;return o(this,(function(i){switch(i.label){case 0:return t="./descendant-or-self::text()[contains(., '".concat(ie[0],"')]"),n=I.evaluate(t,e),r=this.nodeHandler.filterRestricted(n),[4,this.nodeHandler.handleNodes(r)];case 1:return i.sent(),[2]}}))}))},e}(),fe=function(){function e(e,t){this.coder=new le,this.nodeHandler=new V(e,t,this),this.textHandler=new pe(this.nodeHandler),this.attributeHandler=new ue(e,this.nodeHandler),this.wrappedHandler=new J(t,this.nodeHandler),this.coreHandler=new he(this.textHandler,this.attributeHandler,this.wrappedHandler)}return e.prototype.handleText=function(e){return this.textHandler.handle(e)},e.prototype.handleSubtree=function(e){return this.coreHandler.handleSubtree(e)},e.prototype.handleAttribute=function(e){return this.attributeHandler.handle(e)},e.prototype.wrap=function(e,t,n,r){return void 0===t&&(t={}),void 0===n&&(n=void 0),void 0===r&&(r=""),this.coder.wrap(e,t,n,r)},e.prototype.unwrap=function(e){return this.coder.unwrap(e)},e}(),de=function(){function e(){var e=this;this.properties=new p,this.eventService=new g,this.apiHttpService=new y(this.properties),this.mouseEventHandler=new C(this),this.moduleService=new K,this.coreService=new D(this.properties,this.apiHttpService),this.screenshotService=new j(this.coreService,this.apiHttpService),this.translationService=new E(this.properties,this.coreService,this.apiHttpService,this.eventService),this.textService=new b(this.properties,this.translationService,this.moduleService),this.highlightFunctionInitializer=new F(this.properties),this.translationHighlighter=new O(this),this.elementRegistrar=new R(this.properties,this.translationHighlighter,this.eventService),this.messages=new G,this.pluginManager=new M(this.messages,this.properties,this.eventService,this.elementRegistrar,this.translationService),this.run=function(){e.mouseEventHandler.run()},this.stop=function(){e.observer.stopObserving(),e.elementRegistrar.cleanAll(),e.mouseEventHandler.stop(),I.unmarkElementAsTargetElement(e.properties.config.targetElement)},this.translationHighlighter.pluginManager=this.pluginManager}return e.prototype.init=function(e){if(this.properties.config)throw new Error("Duplicate initialization of config");this.properties.config=new x(e),"invisible"===this.properties.config.wrapperMode?this.wrapper=new fe(this.properties,this.elementRegistrar):this.wrapper=new q(this.eventService,this.properties,this.textService,this.elementRegistrar),this.observer=new k(this.properties,this.wrapper,this.elementRegistrar),this.translationService.initStatic()},e}(),ge=function(){function e(){var e=this;this.stop=function(){e.dependencyService.stop()},this.dependencyService=new de}return Object.defineProperty(e.prototype,"properties",{get:function(){return this.dependencyService.properties},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lang",{get:function(){return this.properties.currentLanguage},set:function(e){var t=this;this.properties.currentLanguage=e,this.dependencyService.translationService.loadTranslations(e).then((function(){t.emitLangChangeEvent(e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultLanguage",{get:function(){return this.properties.config.defaultLanguage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLangChange",{get:function(){return this.dependencyService.eventService.LANGUAGE_CHANGED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTranslationChange",{get:function(){return this.dependencyService.eventService.TRANSLATION_CHANGED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLangLoaded",{get:function(){return this.dependencyService.eventService.LANGUAGE_LOADED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initialLoading",{get:function(){var e,t,n=this.properties.currentLanguage,r=this.properties.config.fallbackLanguage,i=this.properties.config.preloadFallback,o=function(e){return void 0!==e&&"function"!=typeof e};return!o(null===(e=this.properties.config.staticData)||void 0===e?void 0:e[n])||!!i&&!o(null===(t=this.properties.config.staticData)||void 0===t?void 0:t[r])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coreService",{get:function(){return this.dependencyService.coreService},enumerable:!1,configurable:!0}),e.use=function(t){return(new e).use(t)},e.init=function(t){return(new e).init(t)},e.prototype.changeLanguage=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.dependencyService.translationService.loadTranslations(e)];case 1:return t.sent(),this.properties.currentLanguage=e,this.emitLangChangeEvent(e),[2]}}))}))},e.prototype.use=function(e){return this.dependencyService.moduleService.addModule(e),this},e.prototype.init=function(e){this.dependencyService.init(e);var t=this.dependencyService.properties.config,n=t.apiKey,r=t.apiUrl;return this.dependencyService.properties.mode=n&&r?"development":"production",this},e.prototype.run=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:if(this.dependencyService.run(),"development"!==this.properties.mode)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.coreService.loadApiKeyDetails()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.error("Couldn't connect to Tolgee"),console.error(e),this.properties.mode="production",[3,4];case 4:return[4,this.dependencyService.translationService.loadTranslations()];case 5:return t.sent(),[4,this.dependencyService.pluginManager.run()];case 6:return t.sent(),this.properties.config.preloadFallback?[4,this.dependencyService.translationService.loadTranslations(this.properties.config.fallbackLanguage)]:[3,8];case 7:t.sent(),t.label=8;case 8:return[4,this.refresh()];case 9:return t.sent(),this.properties.config.watch&&this.dependencyService.observer.observe(),[2]}}))}))},e.prototype.refresh=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.dependencyService.wrapper.handleSubtree(this.properties.config.targetElement)]}))}))},e.prototype.translate=function(e,t,n,r){return void 0===t&&(t={}),void 0===n&&(n=!1),void 0===r&&(r=void 0),i(this,void 0,void 0,(function(){var i,s,a,u;return o(this,(function(o){switch(o.label){case 0:return i="string"==typeof e?e:e.key,s=void 0,"object"==typeof e&&(t=void 0!==(a=e).params?a.params:t,n=void 0!==a.noWrap?a.noWrap:n,r=void 0!==a.defaultValue?a.defaultValue:r,s=a.orEmpty),[4,this.dependencyService.textService.translate(i,t,void 0,s,r)];case 1:return u=o.sent(),"development"!==this.properties.mode||n?[3,3]:[4,this.coreService.loadApiKeyDetails()];case 2:return o.sent(),[2,this.dependencyService.wrapper.wrap(i,t,r,u)];case 3:return[2,u]}}))}))},e.prototype.wrap=function(e,t,n,r){return"development"===this.properties.mode?this.dependencyService.wrapper.wrap(e,t,n,r):r||n},e.prototype.instant=function(e,t,n,r,i){void 0===t&&(t={}),void 0===n&&(n=!1);var o="string"==typeof e?e:e.key;if("object"==typeof e){var s=e;t=void 0!==s.params?s.params:t,n=void 0!==s.noWrap?s.noWrap:n,i=void 0!==s.defaultValue?s.defaultValue:i,r=void 0!==s.orEmpty?s.orEmpty:r}var a=this.dependencyService.textService.instant(o,t,void 0,r,i);return"development"!==this.properties.mode||n?a:this.dependencyService.wrapper.wrap(o,t,i,a)},e.prototype.getCachedTranslations=function(){return this.dependencyService.translationService.getCachedTranslations()},e.prototype.loadTranslations=function(e){return this.dependencyService.translationService.loadTranslations(e)},e.prototype.emitLangChangeEvent=function(e){this.onLangChange.emit(e)},e}();function ve(e){return e.type===ee.literal}function ye(e){return e.type===ee.argument}function me(e){return e.type===ee.number}function Ee(e){return e.type===ee.date}function be(e){return e.type===ee.time}function we(e){return e.type===ee.select}function _e(e){return e.type===ee.plural}function Te(e){return e.type===ee.pound}function Se(e){return e.type===ee.tag}function Ae(e){return!(!e||"object"!=typeof e||e.type!==te.number)}function Le(e){return!(!e||"object"!=typeof e||e.type!==te.dateTime)}!function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"}(Q||(Q={})),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"}(ee||(ee={})),function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"}(te||(te={}));var Pe=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,Ne=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function Ce(e){var t={};return e.replace(Ne,(function(e){var n=e.length;switch(e[0]){case"G":t.era=4===n?"long":5===n?"narrow":"short";break;case"y":t.year=2===n?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":t.month=["numeric","2-digit","short","long","narrow"][n-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":t.day=["numeric","2-digit"][n-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":t.weekday=4===n?"short":5===n?"narrow":"short";break;case"e":if(n<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][n-4];break;case"c":if(n<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][n-4];break;case"a":t.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":t.hourCycle="h12",t.hour=["numeric","2-digit"][n-1];break;case"H":t.hourCycle="h23",t.hour=["numeric","2-digit"][n-1];break;case"K":t.hourCycle="h11",t.hour=["numeric","2-digit"][n-1];break;case"k":t.hourCycle="h24",t.hour=["numeric","2-digit"][n-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":t.minute=["numeric","2-digit"][n-1];break;case"s":t.second=["numeric","2-digit"][n-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":t.timeZoneName=n<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""})),t}var Oe=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;var Ie,Re=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,ke=/^(@+)?(\+|#+)?[rs]?$/g,De=/(\*)(0+)|(#+)(0+)|(0+)/g,Ue=/^(0+)$/;function xe(e){var t={};return"r"===e[e.length-1]?t.roundingPriority="morePrecision":"s"===e[e.length-1]&&(t.roundingPriority="lessPrecision"),e.replace(ke,(function(e,n,r){return"string"!=typeof r?(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length):"+"===r?t.minimumSignificantDigits=n.length:"#"===n[0]?t.maximumSignificantDigits=n.length:(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length+("string"==typeof r?r.length:0)),""})),t}function Me(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function Ge(e){var t;if("E"===e[0]&&"E"===e[1]?(t={notation:"engineering"},e=e.slice(2)):"E"===e[0]&&(t={notation:"scientific"},e=e.slice(1)),t){var n=e.slice(0,2);if("+!"===n?(t.signDisplay="always",e=e.slice(2)):"+?"===n&&(t.signDisplay="exceptZero",e=e.slice(2)),!Ue.test(e))throw new Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}function He(e){var t=Me(e);return t||{}}function Fe(e){for(var t={},n=0,i=e;n<i.length;n++){var o=i[n];switch(o.stem){case"percent":case"%":t.style="percent";continue;case"%x100":t.style="percent",t.scale=100;continue;case"currency":t.style="currency",t.currency=o.options[0];continue;case"group-off":case",_":t.useGrouping=!1;continue;case"precision-integer":case".":t.maximumFractionDigits=0;continue;case"measure-unit":case"unit":t.style="unit",t.unit=o.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":case"K":t.notation="compact",t.compactDisplay="short";continue;case"compact-long":case"KK":t.notation="compact",t.compactDisplay="long";continue;case"scientific":t=r(r(r({},t),{notation:"scientific"}),o.options.reduce((function(e,t){return r(r({},e),He(t))}),{}));continue;case"engineering":t=r(r(r({},t),{notation:"engineering"}),o.options.reduce((function(e,t){return r(r({},e),He(t))}),{}));continue;case"notation-simple":t.notation="standard";continue;case"unit-width-narrow":t.currencyDisplay="narrowSymbol",t.unitDisplay="narrow";continue;case"unit-width-short":t.currencyDisplay="code",t.unitDisplay="short";continue;case"unit-width-full-name":t.currencyDisplay="name",t.unitDisplay="long";continue;case"unit-width-iso-code":t.currencyDisplay="symbol";continue;case"scale":t.scale=parseFloat(o.options[0]);continue;case"integer-width":if(o.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");o.options[0].replace(De,(function(e,n,r,i,o,s){if(n)t.minimumIntegerDigits=r.length;else{if(i&&o)throw new Error("We currently do not support maximum integer digits");if(s)throw new Error("We currently do not support exact integer digits")}return""}));continue}if(Ue.test(o.stem))t.minimumIntegerDigits=o.stem.length;else if(Re.test(o.stem)){if(o.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");o.stem.replace(Re,(function(e,n,r,i,o,s){return"*"===r?t.minimumFractionDigits=n.length:i&&"#"===i[0]?t.maximumFractionDigits=i.length:o&&s?(t.minimumFractionDigits=o.length,t.maximumFractionDigits=o.length+s.length):(t.minimumFractionDigits=n.length,t.maximumFractionDigits=n.length),""}));var s=o.options[0];"w"===s?t=r(r({},t),{trailingZeroDisplay:"stripIfInteger"}):s&&(t=r(r({},t),xe(s)))}else if(ke.test(o.stem))t=r(r({},t),xe(o.stem));else{var a=Me(o.stem);a&&(t=r(r({},t),a));var u=Ge(o.stem);u&&(t=r(r({},t),u))}}return t}var je=new RegExp("^".concat(Pe.source,"*")),Ke=new RegExp("".concat(Pe.source,"*$"));function Ve(e,t){return{start:e,end:t}}var Xe=!!String.prototype.startsWith,Be=!!String.fromCodePoint,We=!!Object.fromEntries,ze=!!String.prototype.codePointAt,Ye=!!String.prototype.trimStart,Je=!!String.prototype.trimEnd,qe=!!Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},Ze=!0;try{Ze="a"===(null===(Ie=ot("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu").exec("a"))||void 0===Ie?void 0:Ie[0])}catch(e){Ze=!1}var $e,Qe=Xe?function(e,t,n){return e.startsWith(t,n)}:function(e,t,n){return e.slice(n,n+t.length)===t},et=Be?String.fromCodePoint:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n,r="",i=e.length,o=0;i>o;){if((n=e[o++])>1114111)throw RangeError(n+" is not a valid code point");r+=n<65536?String.fromCharCode(n):String.fromCharCode(55296+((n-=65536)>>10),n%1024+56320)}return r},tt=We?Object.fromEntries:function(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],s=i[1];t[o]=s}return t},nt=ze?function(e,t){return e.codePointAt(t)}:function(e,t){var n=e.length;if(!(t<0||t>=n)){var r,i=e.charCodeAt(t);return i<55296||i>56319||t+1===n||(r=e.charCodeAt(t+1))<56320||r>57343?i:r-56320+(i-55296<<10)+65536}},rt=Ye?function(e){return e.trimStart()}:function(e){return e.replace(je,"")},it=Je?function(e){return e.trimEnd()}:function(e){return e.replace(Ke,"")};function ot(e,t){return new RegExp(e,t)}if(Ze){var st=ot("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");$e=function(e,t){var n;return st.lastIndex=t,null!==(n=st.exec(e)[1])&&void 0!==n?n:""}}else $e=function(e,t){for(var n=[];;){var r=nt(e,t);if(void 0===r||ct(r)||lt(r))break;n.push(r),t+=r>=65536?2:1}return et.apply(void 0,n)};var at=function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,n){for(var r=[];!this.isEOF();){var i=this.char();if(123===i){if((o=this.parseArgument(e,n)).err)return o;r.push(o.val)}else{if(125===i&&e>0)break;if(35!==i||"plural"!==t&&"selectordinal"!==t){if(60===i&&!this.ignoreTag&&47===this.peek()){if(n)break;return this.error(Q.UNMATCHED_CLOSING_TAG,Ve(this.clonePosition(),this.clonePosition()))}if(60===i&&!this.ignoreTag&&ut(this.peek()||0)){if((o=this.parseTag(e,t)).err)return o;r.push(o.val)}else{var o;if((o=this.parseLiteral(e,t)).err)return o;r.push(o.val)}}else{var s=this.clonePosition();this.bump(),r.push({type:ee.pound,location:Ve(s,this.clonePosition())})}}}return{val:r,err:null}},e.prototype.parseTag=function(e,t){var n=this.clonePosition();this.bump();var r=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:ee.literal,value:"<".concat(r,"/>"),location:Ve(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var i=this.parseMessage(e+1,t,!0);if(i.err)return i;var o=i.val,s=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!ut(this.char()))return this.error(Q.INVALID_TAG,Ve(s,this.clonePosition()));var a=this.clonePosition();return r!==this.parseTagName()?this.error(Q.UNMATCHED_CLOSING_TAG,Ve(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:ee.tag,value:r,children:o,location:Ve(n,this.clonePosition())},err:null}:this.error(Q.INVALID_TAG,Ve(s,this.clonePosition())))}return this.error(Q.UNCLOSED_TAG,Ve(n,this.clonePosition()))}return this.error(Q.INVALID_TAG,Ve(n,this.clonePosition()))},e.prototype.parseTagName=function(){var e,t=this.offset();for(this.bump();!this.isEOF()&&(45===(e=this.char())||46===e||e>=48&&e<=57||95===e||e>=97&&e<=122||e>=65&&e<=90||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(e,t){for(var n=this.clonePosition(),r="";;){var i=this.tryParseQuote(t);if(i)r+=i;else{var o=this.tryParseUnquoted(e,t);if(o)r+=o;else{var s=this.tryParseLeftAngleBracket();if(!s)break;r+=s}}}var a=Ve(n,this.clonePosition());return{val:{type:ee.literal,value:r,location:a},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60!==this.char()||!this.ignoreTag&&(ut(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e},e.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(39===n){if(39!==this.peek()){this.bump();break}t.push(39),this.bump()}else t.push(n);this.bump()}return et.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var n=this.char();return 60===n||123===n||35===n&&("plural"===t||"selectordinal"===t)||125===n&&e>0?null:(this.bump(),et(n))},e.prototype.parseArgument=function(e,t){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Ve(n,this.clonePosition()));if(125===this.char())return this.bump(),this.error(Q.EMPTY_ARGUMENT,Ve(n,this.clonePosition()));var r=this.parseIdentifierIfPossible().value;if(!r)return this.error(Q.MALFORMED_ARGUMENT,Ve(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Ve(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:ee.argument,value:r,location:Ve(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Ve(n,this.clonePosition())):this.parseArgumentOptions(e,t,r,n);default:return this.error(Q.MALFORMED_ARGUMENT,Ve(n,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),n=$e(this.message,t),r=t+n.length;return this.bumpTo(r),{value:n,location:Ve(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,n,i){var o,s=this.clonePosition(),a=this.parseIdentifierIfPossible().value,u=this.clonePosition();switch(a){case"":return this.error(Q.EXPECT_ARGUMENT_TYPE,Ve(s,u));case"number":case"date":case"time":this.bumpSpace();var c=null;if(this.bumpIf(",")){this.bumpSpace();var l=this.clonePosition();if((y=this.parseSimpleArgStyleIfPossible()).err)return y;if(0===(f=it(y.val)).length)return this.error(Q.EXPECT_ARGUMENT_STYLE,Ve(this.clonePosition(),this.clonePosition()));c={style:f,styleLocation:Ve(l,this.clonePosition())}}if((m=this.tryParseArgumentClose(i)).err)return m;var h=Ve(i,this.clonePosition());if(c&&Qe(null==c?void 0:c.style,"::",0)){var p=rt(c.style.slice(2));if("number"===a)return(y=this.parseNumberSkeletonFromString(p,c.styleLocation)).err?y:{val:{type:ee.number,value:n,location:h,style:y.val},err:null};if(0===p.length)return this.error(Q.EXPECT_DATE_TIME_SKELETON,h);var f={type:te.dateTime,pattern:p,location:c.styleLocation,parsedOptions:this.shouldParseSkeletons?Ce(p):{}};return{val:{type:"date"===a?ee.date:ee.time,value:n,location:h,style:f},err:null}}return{val:{type:"number"===a?ee.number:"date"===a?ee.date:ee.time,value:n,location:h,style:null!==(o=null==c?void 0:c.style)&&void 0!==o?o:null},err:null};case"plural":case"selectordinal":case"select":var d=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(Q.EXPECT_SELECT_ARGUMENT_OPTIONS,Ve(d,r({},d)));this.bumpSpace();var g=this.parseIdentifierIfPossible(),v=0;if("select"!==a&&"offset"===g.value){if(!this.bumpIf(":"))return this.error(Q.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Ve(this.clonePosition(),this.clonePosition()));var y;if(this.bumpSpace(),(y=this.tryParseDecimalInteger(Q.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Q.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return y;this.bumpSpace(),g=this.parseIdentifierIfPossible(),v=y.val}var m,E=this.tryParsePluralOrSelectOptions(e,a,t,g);if(E.err)return E;if((m=this.tryParseArgumentClose(i)).err)return m;var b=Ve(i,this.clonePosition());return"select"===a?{val:{type:ee.select,value:n,options:tt(E.val),location:b},err:null}:{val:{type:ee.plural,value:n,options:tt(E.val),offset:v,pluralType:"plural"===a?"cardinal":"ordinal",location:b},err:null};default:return this.error(Q.INVALID_ARGUMENT_TYPE,Ve(s,u))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Ve(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();){switch(this.char()){case 39:this.bump();var n=this.clonePosition();if(!this.bumpUntil("'"))return this.error(Q.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Ve(n,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var n=[];try{n=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");for(var t=[],n=0,r=e.split(Oe).filter((function(e){return e.length>0}));n<r.length;n++){var i=r[n].split("/");if(0===i.length)throw new Error("Invalid number skeleton");for(var o=i[0],s=i.slice(1),a=0,u=s;a<u.length;a++)if(0===u[a].length)throw new Error("Invalid number skeleton");t.push({stem:o,options:s})}return t}(e)}catch(e){return this.error(Q.INVALID_NUMBER_SKELETON,t)}return{val:{type:te.number,tokens:n,location:t,parsedOptions:this.shouldParseSkeletons?Fe(n):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(e,t,n,r){for(var i,o=!1,s=[],a=new Set,u=r.value,c=r.location;;){if(0===u.length){var l=this.clonePosition();if("select"===t||!this.bumpIf("="))break;var h=this.tryParseDecimalInteger(Q.EXPECT_PLURAL_ARGUMENT_SELECTOR,Q.INVALID_PLURAL_ARGUMENT_SELECTOR);if(h.err)return h;c=Ve(l,this.clonePosition()),u=this.message.slice(l.offset,this.offset())}if(a.has(u))return this.error("select"===t?Q.DUPLICATE_SELECT_ARGUMENT_SELECTOR:Q.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,c);"other"===u&&(o=!0),this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?Q.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:Q.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,Ve(this.clonePosition(),this.clonePosition()));var f=this.parseMessage(e+1,t,n);if(f.err)return f;var d=this.tryParseArgumentClose(p);if(d.err)return d;s.push([u,{value:f.val,location:Ve(p,this.clonePosition())}]),a.add(u),this.bumpSpace(),u=(i=this.parseIdentifierIfPossible()).value,c=i.location}return 0===s.length?this.error("select"===t?Q.EXPECT_SELECT_ARGUMENT_SELECTOR:Q.EXPECT_PLURAL_ARGUMENT_SELECTOR,Ve(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!o?this.error(Q.MISSING_OTHER_CLAUSE,Ve(this.clonePosition(),this.clonePosition())):{val:s,err:null}},e.prototype.tryParseDecimalInteger=function(e,t){var n=1,r=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(n=-1);for(var i=!1,o=0;!this.isEOF();){var s=this.char();if(!(s>=48&&s<=57))break;i=!0,o=10*o+(s-48),this.bump()}var a=Ve(r,this.clonePosition());return i?qe(o*=n)?{val:o,err:null}:this.error(t,a):this.error(e,a)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=nt(this.message,e);if(void 0===t)throw Error("Offset ".concat(e," is at invalid UTF-16 code unit boundary"));return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(Qe(this.message,e,this.offset())){for(var t=0;t<e.length;t++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(e){var t=this.offset(),n=this.message.indexOf(e,t);return n>=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&ct(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),n=this.message.charCodeAt(t+(e>=65536?2:1));return null!=n?n:null},e}();function ut(e){return e>=97&&e<=122||e>=65&&e<=90}function ct(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}function lt(e){return e>=33&&e<=35||36===e||e>=37&&e<=39||40===e||41===e||42===e||43===e||44===e||45===e||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||91===e||92===e||93===e||94===e||96===e||123===e||124===e||125===e||126===e||161===e||e>=162&&e<=165||166===e||167===e||169===e||171===e||172===e||174===e||176===e||177===e||182===e||187===e||191===e||215===e||247===e||e>=8208&&e<=8213||e>=8214&&e<=8215||8216===e||8217===e||8218===e||e>=8219&&e<=8220||8221===e||8222===e||8223===e||e>=8224&&e<=8231||e>=8240&&e<=8248||8249===e||8250===e||e>=8251&&e<=8254||e>=8257&&e<=8259||8260===e||8261===e||8262===e||e>=8263&&e<=8273||8274===e||8275===e||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||8608===e||e>=8609&&e<=8610||8611===e||e>=8612&&e<=8613||8614===e||e>=8615&&e<=8621||8622===e||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||8658===e||8659===e||8660===e||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||8968===e||8969===e||8970===e||8971===e||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||9001===e||9002===e||e>=9003&&e<=9083||9084===e||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||9655===e||e>=9656&&e<=9664||9665===e||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||9839===e||e>=9840&&e<=10087||10088===e||10089===e||10090===e||10091===e||10092===e||10093===e||10094===e||10095===e||10096===e||10097===e||10098===e||10099===e||10100===e||10101===e||e>=10132&&e<=10175||e>=10176&&e<=10180||10181===e||10182===e||e>=10183&&e<=10213||10214===e||10215===e||10216===e||10217===e||10218===e||10219===e||10220===e||10221===e||10222===e||10223===e||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||10627===e||10628===e||10629===e||10630===e||10631===e||10632===e||10633===e||10634===e||10635===e||10636===e||10637===e||10638===e||10639===e||10640===e||10641===e||10642===e||10643===e||10644===e||10645===e||10646===e||10647===e||10648===e||e>=10649&&e<=10711||10712===e||10713===e||10714===e||10715===e||e>=10716&&e<=10747||10748===e||10749===e||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||11158===e||e>=11159&&e<=11263||e>=11776&&e<=11777||11778===e||11779===e||11780===e||11781===e||e>=11782&&e<=11784||11785===e||11786===e||11787===e||11788===e||11789===e||e>=11790&&e<=11798||11799===e||e>=11800&&e<=11801||11802===e||11803===e||11804===e||11805===e||e>=11806&&e<=11807||11808===e||11809===e||11810===e||11811===e||11812===e||11813===e||11814===e||11815===e||11816===e||11817===e||e>=11818&&e<=11822||11823===e||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||11840===e||11841===e||11842===e||e>=11843&&e<=11855||e>=11856&&e<=11857||11858===e||e>=11859&&e<=11903||e>=12289&&e<=12291||12296===e||12297===e||12298===e||12299===e||12300===e||12301===e||12302===e||12303===e||12304===e||12305===e||e>=12306&&e<=12307||12308===e||12309===e||12310===e||12311===e||12312===e||12313===e||12314===e||12315===e||12316===e||12317===e||e>=12318&&e<=12319||12320===e||12336===e||64830===e||64831===e||e>=65093&&e<=65094}function ht(e){e.forEach((function(e){if(delete e.location,we(e)||_e(e))for(var t in e.options)delete e.options[t].location,ht(e.options[t].value);else me(e)&&Ae(e.style)||(Ee(e)||be(e))&&Le(e.style)?delete e.style.location:Se(e)&&ht(e.children)}))}function pt(e,t){void 0===t&&(t={}),t=r({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var n=new at(e,t).parse();if(n.err){var i=SyntaxError(Q[n.err.kind]);throw i.location=n.err.location,i.originalMessage=n.err.message,i}return(null==t?void 0:t.captureLocation)||ht(n.val),n.val}function ft(e,t){var n=t&&t.cache?t.cache:wt,r=t&&t.serializer?t.serializer:mt;return(t&&t.strategy?t.strategy:yt)(e,{cache:n,serializer:r})}function dt(e,t,n,r){var i,o=null==(i=r)||"number"==typeof i||"boolean"==typeof i?r:n(r),s=t.get(o);return void 0===s&&(s=e.call(this,r),t.set(o,s)),s}function gt(e,t,n){var r=Array.prototype.slice.call(arguments,3),i=n(r),o=t.get(i);return void 0===o&&(o=e.apply(this,r),t.set(i,o)),o}function vt(e,t,n,r,i){return n.bind(t,e,r,i)}function yt(e,t){return vt(e,this,1===e.length?dt:gt,t.cache.create(),t.serializer)}var mt=function(){return JSON.stringify(arguments)};function Et(){this.cache=Object.create(null)}Et.prototype.get=function(e){return this.cache[e]},Et.prototype.set=function(e,t){this.cache[e]=t};var bt,wt={create:function(){return new Et}},_t={variadic:function(e,t){return vt(e,this,gt,t.cache.create(),t.serializer)},monadic:function(e,t){return vt(e,this,dt,t.cache.create(),t.serializer)}};!function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"}(bt||(bt={}));var Tt,St=function(e){function t(t,n,r){var i=e.call(this,t)||this;return i.code=n,i.originalMessage=r,i}return n(t,e),t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),At=function(e){function t(t,n,r,i){return e.call(this,'Invalid values for "'.concat(t,'": "').concat(n,'". Options are "').concat(Object.keys(r).join('", "'),'"'),bt.INVALID_VALUE,i)||this}return n(t,e),t}(St),Lt=function(e){function t(t,n,r){return e.call(this,'Value for "'.concat(t,'" must be of type ').concat(n),bt.INVALID_VALUE,r)||this}return n(t,e),t}(St),Pt=function(e){function t(t,n){return e.call(this,'The intl string context variable "'.concat(t,'" was not provided to the string "').concat(n,'"'),bt.MISSING_VALUE,n)||this}return n(t,e),t}(St);function Nt(e){return"function"==typeof e}function Ct(e,t,n,r,i,o,s){if(1===e.length&&ve(e[0]))return[{type:Tt.literal,value:e[0].value}];for(var a=[],u=0,c=e;u<c.length;u++){var l=c[u];if(ve(l))a.push({type:Tt.literal,value:l.value});else if(Te(l))"number"==typeof o&&a.push({type:Tt.literal,value:n.getNumberFormat(t).format(o)});else{var h=l.value;if(!i||!(h in i))throw new Pt(h,s);var p=i[h];if(ye(l))p&&"string"!=typeof p&&"number"!=typeof p||(p="string"==typeof p||"number"==typeof p?String(p):""),a.push({type:"string"==typeof p?Tt.literal:Tt.object,value:p});else if(Ee(l)){var f="string"==typeof l.style?r.date[l.style]:Le(l.style)?l.style.parsedOptions:void 0;a.push({type:Tt.literal,value:n.getDateTimeFormat(t,f).format(p)})}else if(be(l)){f="string"==typeof l.style?r.time[l.style]:Le(l.style)?l.style.parsedOptions:void 0;a.push({type:Tt.literal,value:n.getDateTimeFormat(t,f).format(p)})}else if(me(l)){(f="string"==typeof l.style?r.number[l.style]:Ae(l.style)?l.style.parsedOptions:void 0)&&f.scale&&(p*=f.scale||1),a.push({type:Tt.literal,value:n.getNumberFormat(t,f).format(p)})}else{if(Se(l)){var d=l.children,g=l.value,v=i[g];if(!Nt(v))throw new Lt(g,"function",s);var y=v(Ct(d,t,n,r,i,o).map((function(e){return e.value})));Array.isArray(y)||(y=[y]),a.push.apply(a,y.map((function(e){return{type:"string"==typeof e?Tt.literal:Tt.object,value:e}})))}if(we(l)){if(!(m=l.options[p]||l.options.other))throw new At(l.value,p,Object.keys(l.options),s);a.push.apply(a,Ct(m.value,t,n,r,i))}else if(_e(l)){var m;if(!(m=l.options["=".concat(p)])){if(!Intl.PluralRules)throw new St('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',bt.MISSING_INTL_API,s);var E=n.getPluralRules(t,{type:l.pluralType}).select(p-(l.offset||0));m=l.options[E]||l.options.other}if(!m)throw new At(l.value,p,Object.keys(l.options),s);a.push.apply(a,Ct(m.value,t,n,r,i,p-(l.offset||0)))}else;}}}return function(e){return e.length<2?e:e.reduce((function(e,t){var n=e[e.length-1];return n&&n.type===Tt.literal&&t.type===Tt.literal?n.value+=t.value:e.push(t),e}),[])}(a)}function Ot(e,t){return t?Object.keys(e).reduce((function(n,i){var o,s;return n[i]=(o=e[i],(s=t[i])?r(r(r({},o||{}),s||{}),Object.keys(o).reduce((function(e,t){return e[t]=r(r({},o[t]),s[t]||{}),e}),{})):o),n}),r({},e)):e}function It(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,n){e[t]=n}}}}}!function(e){e[e.literal=0]="literal",e[e.object=1]="object"}(Tt||(Tt={}));var Rt,kt=function(){function e(t,n,r,i){var o,s=this;if(void 0===n&&(n=e.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=s.formatToParts(e);if(1===t.length)return t[0].value;var n=t.reduce((function(e,t){return e.length&&t.type===Tt.literal&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e}),[]);return n.length<=1?n[0]||"":n},this.formatToParts=function(e){return Ct(s.ast,s.locales,s.formatters,s.formats,e,void 0,s.message)},this.resolvedOptions=function(){return{locale:Intl.NumberFormat.supportedLocalesOf(s.locales)[0]}},this.getAst=function(){return s.ast},"string"==typeof t){if(this.message=t,!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=e.__parse(t,{ignoreTag:null==i?void 0:i.ignoreTag})}else this.ast=t;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=Ot(e.formats,r),this.locales=n,this.formatters=i&&i.formatters||(void 0===(o=this.formatterCache)&&(o={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:ft((function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.NumberFormat).bind.apply(e,u([void 0],t,!1)))}),{cache:It(o.number),strategy:_t.variadic}),getDateTimeFormat:ft((function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.DateTimeFormat).bind.apply(e,u([void 0],t,!1)))}),{cache:It(o.dateTime),strategy:_t.variadic}),getPluralRules:ft((function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.PluralRules).bind.apply(e,u([void 0],t,!1)))}),{cache:It(o.pluralRules),strategy:_t.variadic})})}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=(new Intl.NumberFormat).resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.__parse=pt,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}(),Dt=((Rt=function(){function e(){this.cache=new Map}return e.prototype.format=function(e){var t=e.translation,n=e.language,r=e.params,i=!Object.values(r).find((function(e){return"function"==typeof e}));return new kt(t,n,void 0,{ignoreTag:i}).format(r)},e}()).type="formatter",Rt);e.DEVTOOLS_ID=L,e.IcuFormatter=Dt,e.NodeHelper=I,e.RESTRICTED_ASCENDANT_ATTRIBUTE=w,e.TOLGEE_ATTRIBUTE_NAME=_,e.TOLGEE_HIGHLIGHTER_CLASS=A,e.TOLGEE_TARGET_ATTRIBUTE=T,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=S,e.TextHelper=B,e.Tolgee=ge,e.TolgeeConfig=x,e.TranslationData=m,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=tolgee.umd.min.js.map
|