@tolgee/web
Advanced tools
Comparing version 5.31.1 to 5.31.2
@@ -1,2 +0,2 @@ | ||
var e,t=Object.defineProperty,n=Object.defineProperties,a=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(e,n,a)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a,l=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&s(e,n,t[n]);if(r)for(var n of r(t))i.call(t,n)&&s(e,n,t[n]);return e},c=(e,t)=>n(e,a(t)),u=(e,t)=>{var n={};for(var a in e)o.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&r)for(var a of r(e))t.indexOf(a)<0&&i.call(e,a)&&(n[a]=e[a]);return n};function g(e,t){for(var n=0;n<t.length;n++){const a=t[n];if("string"!=typeof a&&!Array.isArray(a))for(const t in a)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(a,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function d(e){return Boolean(e&&"function"==typeof e.then)}function f(e,t){return d(e)?Promise.resolve(e).then(t):t(e)}function p(e,t,n){function a(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=n();return d(e)?e.catch(a):e}catch(e){a(e)}}function h(e){const t=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),n=t.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...t.slice(0,-2),n].join(", ")} option`}function v(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function m(e){return v(e)||[]}function y(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?m(t):m(null==t?void 0:t[e]);var n}function b(e){return Array.from(new Set(e))}function E(e){return e?e.replace(/\/+$/,""):e}const w=(e,t)=>fetch(e,t);const O=(e=w)=>(t,n)=>{let a=(r=null==n?void 0:n.headers,Object.fromEntries(new Headers(r).entries()));var r;return a["x-api-key"]&&(a=Object.assign({"x-tolgee-sdk-type":"JS","x-tolgee-sdk-version":"5.31.1"},a)),e(t,Object.assign(Object.assign({},n),{headers:a}))};function L(e){let t=[];return Object.freeze({listen(e){const n=t=>{e(t)};return t.push(n),{unsubscribe(){t=t.filter((e=>n!==e))}}},emit(n){e()&&t.forEach((e=>e({value:n})))}})}function k(e,t,n){const a=new Set,r=new Set;let o=[];function i(){if(0===o.length)return;const e=o;o=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));!function(e){const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))}(n?Array.from(n.keys()):void 0)}return Object.freeze({emit(t,n){e()&&(o.push(t),n?setTimeout(i,0):i())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(m(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class A extends Error{constructor(e,t,n=!1){const{language:a,namespace:r}=e;super(`Tolgee: Failed to fetch record for "${a}"${r&&` and "${r}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=r}}class N extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class T extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const j=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):j(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},x=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},R=({language:e,namespace:t})=>t?`${e}:${t}`:e;function C(e,t,n,a,r,o,i){const s=new Map,l=new Map;let c={},u=0;function g(t,n,a){const r=R(t);l.set(r,{data:j(n),version:a}),e.onCacheChange.emit(t)}async function f(a,r){let o;if(r)try{o=await n(a)}catch(t){const n=new A(a,t,!0);e.onError.emit(n),console.warn(n)}return o||(o=await async function(n){function a(t){const a=new A(n,t);throw e.onError.emit(a),console.error(a),a}const r=t(n);if(d(r)){const e=await r.catch(a);if(void 0!==e)return e}const o=c[R(n)];if("function"!=typeof o)return o;try{return await o()}catch(e){a(e)}}(a)),o}const p=Object.freeze({addStaticData(e){e&&(c=Object.assign(Object.assign({},c),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=x(e),a=l.get(e);a&&0!==a.version||g(n,t,0)}})))},invalidate(){s.clear(),u+=1},addRecord(e,t){g(e,t,u)},exists(e,t=!1){const n=l.get(R(e));return n&&t?n.version===u:Boolean(n)},getRecord(e){var t;return null===(t=l.get(R(a(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=l.get(R(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(R({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return b(e)},getTranslationFallback(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(R({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var r;const o=null===(r=l.get(R(t)))||void 0===r?void 0:r.data;null==o||o.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return s.size>0;const t=m(e);return Boolean(Array.from(s.keys()).find((e=>t.includes(x(e).namespace))))},isLoading(e,t){const n=m(t);return Boolean(r()||Array.from(s.keys()).find((t=>{const a=x(t);return(!n.length||n.includes(a.namespace))&&!p.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,t){const n=e.map((e=>{const n=a(e),r=R(n),o=s.get(r);if(o)return{new:!1,promise:o,keyObject:n,cacheKey:r};const i=f(n,t)||Promise.resolve(void 0);return s.set(r,i),{new:!0,promise:i,keyObject:n,cacheKey:r}}));o.notify(),i.notify();const r=await Promise.all(n.map((e=>e.promise)));return n.forEach(((e,t)=>{const n=s.get(e.cacheKey)!==e.promise;if(e.new&&!n){s.delete(e.cacheKey);const n=r[t];n?p.addRecord(e.keyObject,n):p.getRecord(e.keyObject)||p.addRecord(e.keyObject,{})}})),o.notify(),i.notify(),n.map((e=>p.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(l.entries()).map((([e,t])=>Object.assign(Object.assign({},x(e)),{data:t.data})))});return p}function P(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const S="invalid",D={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:S,apiUrl:"https://app.tolgee.io",fetch:O(),onTranslationMissing:({key:e})=>e},I=(...e)=>{let t={};return e.forEach((e=>{t=Object.assign(Object.assign(Object.assign({},t),e),{observerOptions:Object.assign(Object.assign({},t.observerOptions),null==e?void 0:e.observerOptions)})})),t};function U(e,t){const n=I(D,null==t?void 0:t.initialOptions,e);return n.apiUrl=E(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=O(e.fetch)),{initialOptions:n,activeNamespaces:(null==t?void 0:t.activeNamespaces)||new Map,language:null==t?void 0:t.language,pendingLanguage:null==t?void 0:t.language,isInitialLoading:!1,isRunning:!1}}function F(e,t,n,a,r,o,i,s){const l={ui:void 0},c={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,target:t})=>{var n;const i=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:a(t),namespace:r({key:e,ns:t})[0],translation:o({key:e,ns:t})})));null===(n=c.ui)||void 0===n||n.handleElementClick(i,t)},g=(e,t)=>{var n;return(null===(n=c.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function d(e){const t=o({key:e.key,ns:e.ns});return j.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function h(){return{fetch:t().fetch}}function v(e){c.observer=null==e?void 0:e()}function m(){return Boolean(c.observer)}function y(e){e&&c.formatters.push(e)}function b(e){c.finalFormatter=e}function E(e){l.ui=e}function w(){return Boolean(l.ui)}function O(e){c.languageStorage=e}function L(e){c.languageDetector=e}function k(e){e&&c.backends.push(e)}function A(e){c.devBackend=e}const j=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:b,addFormatter:y,setObserver:v,hasObserver:m,setUi:E,hasUi:w,setDevBackend:A,addBackend:k,setLanguageDetector:L,setLanguageStorage:O}))},findPositions:g,run(){var e,n;const{apiKey:a,apiUrl:r,projectId:o,observerOptions:f,tagNewKeys:p}=t();c.ui=null===(e=l.ui)||void 0===e?void 0:e.call(l,{apiKey:a,apiUrl:r,projectId:o,highlight:j.highlight,changeTranslation:i,findPositions:g,onPermanentChange:e=>s.onPermanentChange.emit(e),tagNewKeys:p}),null===(n=c.observer)||void 0===n||n.run({mouseHighlight:!0,options:f,translate:d,onClick:u})},stop(){var e;c.ui=void 0,null===(e=c.observer)||void 0===e||e.stop()},getLanguageStorage:()=>c.languageStorage,getInitialLanguage(){const e=n();return f(p(s.onError,(e=>new T("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=c.languageStorage)||void 0===e?void 0:e.getLanguage(h())})),(t=>e&&!e.includes(t)||!t?function(){if(!c.languageDetector)return;const e=n();return p(s.onError,(e=>new N("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=c.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},h()))}))}():t))},setStoredLanguage:e=>p(s.onError,(e=>new T("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=c.languageStorage)||void 0===t?void 0:t.setLanguage(e,h())})),getDevBackend:()=>c.devBackend,getBackendRecord:async({language:e,namespace:t})=>{for(const n of c.backends){const a=await n.getRecord(Object.assign({language:e,namespace:t},h()));if(void 0!==a)return a}},getBackendDevRecord:async({language:e,namespace:n})=>{var a;const{apiKey:r,apiUrl:o,projectId:i}=t();return null===(a=c.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:n},h()))},getLanguageDetector:()=>c.languageDetector,retranslate(){var e;null===(e=c.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=c.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return c.observer?null===(t=c.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return c.observer?null===(t=c.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(j.getDevBackend()),formatTranslation(n){var a,{formatEnabled:r}=n,o=P(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:u,params:g,ns:d,orEmpty:f}=o,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(o));let v=null!=p?p:f?"":h;const m=e(),y=r||!(null===(a=c.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>c.observer&&!u?c.observer.wrap({key:i,translation:e,defaultValue:l,params:g,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of c.formatters)v=e.format({translation:v,language:m,params:g});c.finalFormatter&&p&&m&&y&&(v=c.finalFormatter.format({translation:v,language:m,params:g}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||S,a=t().onFormatError,r=typeof a;v="string"===r?a:"function"===r?a(n,o):S,v=b(v)}var E;return v}});return j}const _=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const $=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:r,language:o}=e,i=P(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:o};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function M({options:e}){const t=function(e,t){let n=!0;function a(){return n}const r=Object.freeze({onPendingLanguageChange:L(a),onLanguageChange:L(a),onLoadingChange:L(a),onFetchingChange:L(a),onInitialLoaded:L(a),onRunningChange:L(a),onCacheChange:L(a),onUpdate:k(a,e,t),onPermanentChange:L(a),onError:L(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return r.onPendingLanguageChange.listen(t);case"language":return r.onLanguageChange.listen(t);case"loading":return r.onLoadingChange.listen(t);case"fetching":return r.onFetchingChange.listen(t);case"initialLoad":return r.onInitialLoaded.listen(t);case"running":return r.onRunningChange.listen(t);case"cache":return r.onCacheChange.listen(t);case"update":return r.onUpdate.listen(t);case"permanentChange":return r.onPermanentChange.listen(t);case"error":return r.onError.listen(t)}}});return r.onInitialLoaded.listen((()=>r.onUpdate.emit())),r.onLanguageChange.listen((()=>r.onUpdate.emit())),r.onCacheChange.listen((({value:e})=>r.onUpdate.emit([e.namespace],!0))),r}(l,c),n=_(!1,(()=>i.isFetching()),t.onFetchingChange.emit),a=_(!1,(()=>j.isLoading()),t.onLoadingChange.emit),r=function(e,t,n){let a,r=U();const o=Object.freeze({init(e){r=U(e,r)},isRunning:()=>r.isRunning,setRunning(e){r.isRunning!==e&&(r.isRunning=e,n.emit(e))},isInitialLoading:()=>r.isInitialLoading,setInitialLoading(e){r.isInitialLoading=e},getLanguage:()=>r.language||r.initialOptions.language,setLanguage(t){r.language!==t&&(r.language=t,e.emit(t))},getPendingLanguage:()=>r.pendingLanguage||o.getLanguage(),setPendingLanguage(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},r.initialOptions),a),addActiveNs(e){m(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t?r.activeNamespaces.set(e,t+1):r.activeNamespaces.set(e,1)}))},removeActiveNs(e){m(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t&&t>1?r.activeNamespaces.set(e,t-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>b([...r.initialOptions.ns||[r.initialOptions.defaultNs],...m(r.initialOptions.fallbackNs),...r.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||o.getLanguage();return t?b([t,...y(t,r.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>m(r.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?r.initialOptions.defaultNs:e,getAvailableLanguages(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>x(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?o.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:E(e.apiUrl)}):void 0}});return o}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),o=F(r.getLanguage,r.getInitialOptions,r.getAvailableLanguages,u,A,N,p,t),i=C(t,o.getBackendRecord,o.getBackendDevRecord,r.withDefaultNs,r.isInitialLoading,n,a);let s;function l(){return r.getFallbackNs()}function c(e){return r.getDefaultNs(e)}function u(e){return[...m(c(e)),...l()]}function g(e){return[...m(null!=e?e:c()),...r.getRequiredNamespaces()]}function p(e,t,n){const a=r.withDefaultNs(e),o=i.getTranslation(a,t);return i.changeTranslation(a,t,n),{revert(){i.changeTranslation(a,t,o)}}}function v(e){r.init(e),i.addStaticData(r.getInitialOptions().staticData)}function w(e,t){const n=r.getFallbackLangs(e),a=g(t),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}function O(e,t){const n=w(e,t);if(n.length)return f(j.loadRecords(n),(()=>{}))}function A({key:e,ns:t}){const n=r.getFallbackLangs(),a=u(null!=t?t:void 0);return i.getTranslationNs(a,n,e)}function N({key:e,ns:t,language:n}){const a=u(null!=t?t:void 0),o=r.getFallbackLangs(n);return i.getTranslationFallback(a,o,e)}function T(){const e=f(function(){if(r.getLanguage())return;return f(o.getInitialLanguage(),(e=>{const t=e||r.getInitialOptions().defaultLanguage;t&&r.setLanguage(t)}))}(),(()=>O()));if(d(e))return r.setInitialLoading(!0),n.notify(),a.notify(),Promise.resolve(e).then((()=>{r.setInitialLoading(!1),n.notify(),a.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&v(e),t.onUpdate.listen((()=>{r.isRunning()&&o.retranslate()}));const j=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),o),i),{init:v,getTranslation:N,changeTranslation:p,getTranslationNs:A,getDefaultAndFallbackNs:u,findPositions:o.findPositions,getRequiredRecords:w,async changeLanguage(e){r.getPendingLanguage()===e&&r.getLanguage()===e||(r.setPendingLanguage(e),r.isRunning()&&await O(e),e===r.getPendingLanguage()&&(r.setLanguage(e),await o.setStoredLanguage(e)))},async addActiveNs(e,t){t||r.addActiveNs(e),r.isRunning()&&await O(void 0,e)},loadRecords:e=>i.loadRecords(e,j.isDev()),loadRecord:async e=>(await j.loadRecords([e]))[0],isLoading:e=>i.isLoading(r.getLanguage(),e),isLoaded(e){const t=r.getLanguage();if(!t)return!1;const n=r.getFallbackLangs(t),a=g(e),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=$(...e),n=N(t);return o.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(r.getInitialOptions().apiKey&&r.getInitialOptions().apiUrl),run:()=>(function(){if((o.getLanguageDetector()||o.getLanguageStorage())&&!r.getAvailableLanguages())throw new Error(h("availableLanguages"));if(!r.getLanguage()&&!r.getInitialOptions().defaultLanguage)throw new Error(h(["defaultLanguage","language"]))}(),r.isRunning()||(r.setRunning(!0),o.run(),s=T()),Promise.resolve(s)),stop(){r.isRunning()&&(o.stop(),r.setRunning(!1))}}));return j}const K=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=I(e.options,n),t),init(t){const n=function(e){const t=M({options:e});function n(e){const n=t.isRunning();n&&t.stop(),e(),t.isDev()&&t.invalidate(),n&&t.run()}t.isDev()&&t.invalidate();const a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmitterActive:t.setEmitterActive,getLanguage:t.getLanguage,getPendingLanguage:t.getPendingLanguage,changeLanguage:t.changeLanguage,changeTranslation:t.changeTranslation,addActiveNs:t.addActiveNs,removeActiveNs:t.removeActiveNs,loadRecords:t.loadRecords,loadRecord:t.loadRecord,addStaticData:t.addStaticData,getRecord:t.getRecord,getAllRecords:t.getAllRecords,isLoaded:t.isLoaded,getRequiredRecords:t.getRequiredRecords,isInitialLoading:t.isInitialLoading,isLoading:t.isLoading,isFetching:t.isFetching,isRunning:t.isRunning,run:t.run,stop:t.stop,t:t.t,highlight:t.highlight,findPositions:t.findPositions,getInitialOptions:t.getInitialOptions,isDev:t.isDev,wrap:t.wrap,unwrap:t.unwrap,overrideCredentials(e){n((()=>t.overrideCredentials(e)))},addPlugin(e){e&&n((()=>t.addPlugin(a,e)))},updateOptions(e){e&&n((()=>t.init(e)))}});return a}(I(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},B=0,z=1,V=2;class W extends Error{constructor(e,t,n){let a;a=e===B?"Empty parameter":e===z?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function H(e){return/\s/.test(e)}const Y=0,G=1,X=2,q=3,J=4,Z=new Set([X,G,Y]),Q="'",ee=new Set(["{","}",Q]),te=e=>/[0-9a-zA-Z_]/.test(e);function ne(e,t){const[n,a]=function(e){let t=Y,n="",a="",r="";const o=[],i=[];let s=0;function l(t){throw new W(t,s,e)}const c=()=>{o.push(n),n=""},u=()=>{""===a&&l(B),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case Y:r===Q?(n+=r,t=G):"{"===r?(c(),t=q):(n+=r,t=Y);break;case G:ee.has(r)?(n=n.slice(0,-1)+r,t=X):(n+=r,t=Y);break;case X:r===Q?t=Y:(n+=r,t=X);break;case q:"}"===r?(u(),t=Y):H(r)?""!==a&&(u(),t=J):(te(r)||l(z),a+=r,t=q);break;case J:"}"==r?t=Y:H(r)?t=J:l(z)}return Z.has(t)||l(V),c(),[o,i]}(e),r=[n[0]];for(let o=1;o<n.length;o++){const i=null==t?void 0:t[a[o-1]];if(void 0===i)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);r.push(String(i)),r.push(n[o])}return r.join("")}const ae=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>ne(e,t)}),e),re="__tolgee_dev_tools",oe="__tolgee_preferredLanguages",ie="data-tolgee-key-only",se="data-tolgee-restricted",le="_tolgee",ce="_tolgee-highlighter";function ue(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function ge(e){if(ue())throw new Error(`${e}: Can't run on the server`)}function de(e,t){return{oldTextContent:e,keys:t}}function fe(e){return e.textContent}function pe(e,t){e.textContent=t}function he(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,r=void 0===e.ns||void 0===t.ns||-1!==(null==(n=e.ns)?void 0:n.findIndex((e=>{var n;return null==(n=t.ns)?void 0:n.includes(e)})));return a&&r}const ve={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function me({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;const r=function(e){for(;e;){if(null!==e.getAttribute("disabled"))return!1;e=e.parentElement}return!0}(n);let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(ce),Object.entries(ve).forEach((([e,t])=>{o.style[e]=t})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const i=n.getBoundingClientRect();o.style.pointerEvents=r?"none":"auto",o.style.borderWidth=t+"px",o.style.top=i.top-t+"px",o.style.left=i.left-t+"px",o.style.width=i.width+"px",o.style.height=i.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null==(e=t.highlightEl)||e.remove(),t.highlightEl=void 0}}(0,a)}})}const ye={capture:!0},be={capture:!0,passive:!0},Ee=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function we({highlightKeys:e,elementStore:t,onClick:n,options:a}){var r,o;const i=new Set;let s,l,c=[];const u=(null==(r=a.targetElement)?void 0:r.getRootNode())||document,g=(null==(o=a.targetElement)?void 0:o.ownerDocument)||document;function d(){var e;const n=t.get(s);n&&(n.preventClean=!1,null==(e=n.unhighlight)||e.call(n),s=void 0)}function f(){const e=l;let n;if(e&&k()){n=function(e){for(const n of e){const e=L(n,(e=>t.get(e)));if(void 0!==e)return e||void 0}}(u.elementsFromPoint(e.x,e.y)||[])}!function(e){var n;if(s!==e){d();const a=t.get(e);a&&(a.preventClean=!0,null==(n=a.highlight)||n.call(a),s=e)}}(n)}function p(e){l=e,f()}function h(e){for(const[t,n]of Ee.entries())i.has(t)&&!e[n]?i.delete(t):!i.has(t)&&e[n]&&i.add(t)}function v(e){var t;h(e),k()&&(t=e.target,!Boolean(L(t,(e=>e.id===re))))&&(e.stopPropagation(),e.preventDefault())}function m(e){h(e),p({x:e.clientX,y:e.clientY})}function y(e){h(e),f()}function b(e){h(e),f()}function E(){var e;const n=t.get(s);null==(e=null==n?void 0:n.highlight)||e.call(n)}function w(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),k()&&s&&(n(s),d())}function O(e,t,n){g.addEventListener(e,t,n),c.push([e,t,n])}function L(e,t){return e.id===re?null:t(e)?e:(null==e?void 0:e.parentElement)?L(e.parentElement,t):void 0}function k(){for(const t of e)if(!i.has(t))return!1;return!0}return Object.freeze({stop(){!function(){for(const e of c)g.removeEventListener(...e);c=[]}()},run(){O("keydown",y,ye),O("keyup",b,ye),O("mousemove",m,be),O("scroll",E,be),O("click",w,ye),O("mouseenter",v,ye),O("mouseover",v,ye),O("mouseout",v,ye),O("mouseleave",v,ye),O("mousedown",v,ye),O("mouseup",v,ye)}})}function Oe(e,t,n){const a=me({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),r=we({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:s(a)})},options:e});function o(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${se}]`)}function i(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(le),t.remove(e)}function s(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({isRestricted:o,register(e,n,r){if(o(e))return;const i=e;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(le,"true")),s.nodes.set(n,r),a.initHighlighter(i,s)},forEachElement:t.forEachElement,cleanupLingeringKeyAttributes(){t.forEachElement(((e,t)=>{if(!t.preventClean){for(const[e]of t.nodes)if(e.nodeType===Node.ATTRIBUTE_NODE){const n=e;n.name===ie&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&i(e,t)}}))},cleanupRemovedNodes(e){t.forEachElement(((t,n)=>{n.preventClean||(e.has(t)||function(e,t){for(const[n]of e.nodes)t.has(n)&&e.nodes.delete(n)}(n,e),(e.has(t)||0===n.nodes.size)&&i(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>he({key:e,ns:v(n)},{key:t.key,ns:v(t.ns)})))){a.push(r);break}}})),a},run(e){e&&r.run()},stop(){r.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function Le(){let e,t=!1;const n=function(){const e=new Map;return Object.freeze({set(t,n){e.set(t,n)},get:t=>t&&e.get(t),remove:t=>e.delete(t),forEachElement(t){e.forEach(((e,n)=>t(n,e)))}})}();function a({mouseHighlight:e,options:a,wrapper:r,onClick:o}){if(ue())return{stop(){t=!1},wrapper:r};const i=function(e){const t=Object.freeze({getSuitableParent(n){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===a)throw console.error(n),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const t=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(t))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?t.getSuitableParent(a):a}});return t}(a),s=function(e,t){const n=Object.freeze({handleAttributes(n,a=!0){var r,o;const i=[],s=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=null!=(r=s[e.tagName.toUpperCase()])?r:[];"*"in s&&(a=a.concat(s["*"])),i.push(...a.filter((t=>e.hasAttribute(t))).map((t=>e.getAttributeNode(t))).filter((e=>t.testAttribute(e))))}if(a){const e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,(e=>{var t,n;return(null==(t=s[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=s["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=null!=(o=s[n.tagName.toUpperCase()])?o:[];"*"in s&&(a=a.concat(s["*"])),i.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return i},handleChildList(e){const t=[];return t.push(...e.flatMap((e=>n.handleAttributes(e,!0)))),t.push(...e.flatMap((e=>n.handleText(e)))),t},handleText(e){if(e.nodeType===Node.TEXT_NODE)return t.testTextNode(e)?[e]:[];const n=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>t.testTextNode(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;a.nextNode();)n.push(a.currentNode);return n}});return n}(a,r),l=Oe(a,n,o);function c(e){for(const t of e){const e=t.parentElement;if(e&&l.isRestricted(e))continue;const n=fe(t),a=n?r.unwrap(n):null;if(a){const{text:e,keys:r}=a;pe(t,e);const o=de(n,r),s=i.getSuitableParent(t);l.register(s,t,o)}}}function u(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:fe(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===ie)return void u(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(ie);t&&u(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(ie)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){u(n.currentNode.getAttributeNode(ie))}}const d=new MutationObserver((e=>{if(!t)return;const n=e.filter((e=>"childList"===e.type)).flatMap((e=>Array.from(e.removedNodes))),a=new Set(n);for(const e of n){if(e.nodeType===Node.ELEMENT_NODE)for(let t=0;t<e.attributes.length;t++)a.add(e.attributes[t]);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;t.nextNode();){const e=t.currentNode;if(e.nodeType===Node.ELEMENT_NODE){const t=e;for(let e=0;e<t.attributes.length;e++)a.add(t.attributes[e])}a.add(e)}}a.size>0&&l.cleanupRemovedNodes(a),e.some((e=>"attributes"===e.type&&e.attributeName===ie))&&l.cleanupLingeringKeyAttributes();const r=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>r.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>r.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>r.delete(e)));break;case"attributes":t.attributeName===ie&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>r.add(e)))}c([...r])})),f=a.targetElement||document;t=!0,l.run(e),g(f,!0),c(s.handleChildList([f]));const p=new Set;return p.add(ie),Object.values(a.tagAttributes).forEach((e=>e.forEach((e=>p.add(e.toLowerCase()))))),d.observe(f,{attributes:!0,attributeFilter:[...p],childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,l.stop(),d.disconnect()},elementRegistry:l,wrapper:r}}return Object.freeze({run(t){e=a(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null==(a=null==(n=null==e?void 0:e.elementRegistry)?void 0:n.forEachElement)||a.call(n,t)},highlight(t,n){var a;const r=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return r.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){r.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const r=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],o=[];return r.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),r.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{he({key:t,ns:v(n)},{key:e.key,ns:v(e.ns)})&&o.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),o},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var ke="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ae={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),r=[],o=0;;){var i=t<e.length;if(!i||o>=n-1){var s=a.subarray(0,o);if(r.push(String.fromCharCode.apply(null,s)),!i)return r.join("");e=e.subarray(t),t=0,o=0}var l=e[t++];if(0==(128&l))a[o++]=l;else if(192==(224&l)){var c=63&e[t++];a[o++]=(31&l)<<6|c}else if(224==(240&l)){c=63&e[t++];var u=63&e[t++];a[o++]=(31&l)<<12|c<<6|u}else if(240==(248&l)){var g=(7&l)<<18|(c=63&e[t++])<<12|(u=63&e[t++])<<6|63&e[t++];g>65535&&(g-=65536,a[o++]=g>>>10&1023|55296,g=56320|1023&g),a[o++]=g}}}var n="Failed to ",a=function(e,t,a){if(e)throw new Error("".concat(n).concat(t,": the '").concat(a,"' option is unsupported."))},r="function"==typeof Buffer&&Buffer.from,o=r?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,r=Math.max(32,n+(n>>>1)+7),o=new Uint8Array(r>>>3<<3);t<n;){var i=e.charCodeAt(t++);if(i>=55296&&i<=56319){if(t<n){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,i=((1023&i)<<10)+(1023&s)+65536)}if(i>=55296&&i<=56319)continue}if(a+4>o.length){r+=8,r=(r*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(r);l.set(o),o=l}if(0!=(4294967168&i)){if(0==(4294965248&i))o[a++]=i>>>6&31|192;else if(0==(4294901760&i))o[a++]=i>>>12&15|224,o[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;o[a++]=i>>>18&7|240,o[a++]=i>>>12&63|128,o[a++]=i>>>6&63|128}o[a++]=63&i|128}else o[a++]=i}return o.slice?o.slice(0,a):o.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),o(e)};var s=!r&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],c=t;r?c=function(e,t){return(e instanceof Buffer?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)).toString(t)}:s&&(c=function(e){try{return function(e){var t;try{var n=new Blob([e],{type:"text/plain;charset=UTF-8"});t=URL.createObjectURL(n);var a=new XMLHttpRequest;return a.open("GET",t,!1),a.send(),a.responseText}finally{t&&URL.revokeObjectURL(t)}}(e)}catch(n){return t(e)}});var u="construct 'TextDecoder'",g="".concat(n," ").concat(u,": the ");function d(e,t){if(a(t&&t.fatal,u,"fatal"),e=e||"utf-8",!(r?Buffer.isEncoding(e):-1!==l.indexOf(e.toLowerCase())))throw new RangeError("".concat(g," encoding label provided ('").concat(e,"') is invalid."));this.encoding=e,this.fatal=!1,this.ignoreBOM=!1}d.prototype.decode=function(e,t){var n;return a(t&&t.stream,"decode","stream"),n=e instanceof Uint8Array?e:e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer):new Uint8Array(e),c(n,this.encoding)},e.TextEncoder=e.TextEncoder||i,e.TextDecoder=e.TextDecoder||d}("undefined"!=typeof window?window:ke);const Ne=g({__proto__:null,default:Ae},[Ae]);null==(e=console.assert)||e.call(console,Ne);const Te=["",""],je=RegExp(`([${Te.join("")}]{9})+`,"gu");function xe(e){const t=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),n=t.map((e=>function(e){const t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0")).join("");return Array.from(n).map((e=>Te[Number(e)])).join("")}function Re(e){const t=Array.from(e).map((e=>Te.indexOf(e))).map(String).join("").match(/(.{9})/g),n=Uint8Array.from((null==t?void 0:t.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=n,(new TextDecoder).decode(new Uint8Array(a));var a}function Ce({fullKeyEncode:e}){const t=function(){const e=[];return Object.freeze({valueToNumber(t){let n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:t=>e[t]})}();function n(e){const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)}function a(e){return xe(e+"\n")}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(je))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(Re))||[]}(e);a.forEach((e=>{const a=function(e){return e.split("\n").filter((e=>e.length)).map((e=>{if("{"===e[0])return e;{const n=Number(e);return t.numberToValue(n)}}))}(e);a.forEach((e=>{const t=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(e);if(t){const{k:e,d:a,n:r}=t;n.push({key:e,defaultValue:a,ns:r})}}))}));const r=function(e){return e.replace(je,"")}(e);return{text:r,keys:n}},wrap({key:r,defaultValue:o,translation:i,ns:s}){let l;if(e){l=a(n({key:r,ns:s}))}else{const e=n({key:r,ns:s,defaultValue:o}),i=t.valueToNumber(e);l=a(String(i))}const c=i||"";return"string"==typeof c?c+l:c},testTextNode(e){var t,n,a;return null!=(a=(null==(t=e.textContent)?void 0:t.includes(`${Te[0]}${Te[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${Te[1]}${Te[0]}`)))&&a},testAttribute:e=>e.value.includes(`${Te[0]}${Te[0]}`)||e.value.includes(`${Te[1]}${Te[0]}`)})}function Pe(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function Se({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:r,ns:o}=function(e){let t=!1,n="",a="",r="KEY";const o={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{o.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==r||","!==s?"KEY"!==r||"|"!==s?"NAMESPACE"!==r||","!==s?"KEY"!==r||":"!==s?"DEFAULT_VALUE"!==r||":"!==s?"PARAM_NAME"!==r||":"!==s?"PARAM_VALUE"!==r||","!==s?n+=s:(r="PARAM_NAME",o.params[a]=n,n=""):(r="PARAM_VALUE",a=n,n=""):(r="PARAM_NAME",o.defaultValue=n,n=""):(r="PARAM_NAME",o.key=n,n=""):(r="DEFAULT_VALUE",i(n),n=""):(r="NAMESPACE",o.key=n,n=""):(r="DEFAULT_VALUE",o.key=n,n=""):t=!0;return"KEY"===r&&(o.key=n),"DEFAULT_VALUE"===r&&(o.defaultValue=n),"PARAM_VALUE"===r&&(o.params[a]=n),"NAMESPACE"===r&&i(n),o}(e);return{translated:n({key:t,params:a,defaultValue:r,ns:o,noWrap:!0}),key:t,params:a,defaultValue:r,ns:o}}function r(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function o(e){return"string"==typeof e?e.replace(new RegExp("[,:|\\\\]","gs"),"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:n,params:a,defaultValue:r,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${o(e)}:${o(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==r?`,${o(r)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>o(e))).join("|")}`:"";return`${e}${o(n)}${u}${l}${s}${t}`},unwrap(n){const o=new RegExp(`(\\\\?)(${r(e)}(.*?)${r(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=o.exec(n));){let e=s[1];const[t,r,o,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!Pe(d,n)){u+=o;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=n.substring(c),l?{text:u,keys:i}:{text:n,keys:[]}},testTextNode(n){var a,r,o;return null!=(o=(null==(a=n.textContent)?void 0:a.includes(e))&&(null==(r=n.textContent)?void 0:r.includes(t)))&&o},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const De=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=Le();return Object.freeze(c(l({},e),{run(t){const n=Se({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run(c(l({},t),{wrapper:n}))},retranslate(){e.forEachElement(((t,n)=>{for(const[t,a]of n.nodes.entries()){if(a.keyAttributeOnly)return;const n=e.unwrap(a.oldTextContent);n&&pe(t,n.text)}}))},outputNotFormattable:!0}))})):t.setObserver((()=>{const e=Le();return Object.freeze(c(l({},e),{run(t){const n=Ce({fullKeyEncode:t.options.fullKeyEncode});e.run(c(l({},t),{wrapper:n}))},retranslate(){},outputNotFormattable:!1}))})),e),Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Ue(e){const t=Ie.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Fe(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,r=0;const o=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|Ue(e[i]),n+=5,n>=8&&(o[r++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",r=Math.pow(2,16)-1;for(let e=0;e<n;e+=r)e+r>n&&(r=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+r));return a}(o.buffer)}function _e(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Fe(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}const $e=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:r,fetch:o}){var i;const s=null!=(i=_e(t))?i:r;let l=void 0!==s?`${e}/v2/projects/${s}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(l+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===r)throw new Error("You need to specify 'projectId' when using PAT key");return o(l,{headers:{"X-API-Key":t||"","Content-Type":"application/json"},next:{revalidate:0}}).then((e=>{if(e.ok)return e.json().then((e=>e[n]));throw new Error(e.statusText)}))}}),e);function Me({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:r=300}){let o=!1;const i=()=>new Promise(((a,o)=>{const i=function(e,t){const n=n=>{var a,r;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(r=n.data)?void 0:r.data)};return window.addEventListener("message",n,!1),{unsubscribe(){window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(s),l(),a(e)}));window.postMessage({type:e,data:n},window.origin);const s=setTimeout((function(){l(),o()}),r);function l(){i.unsubscribe()}}));return{cancel(){o=!0},promise:(async()=>{for(let e=0;e<a;e++){if(o)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!o)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let Ke=null;function Be(e){var t;return Ke||(Ke=(t=`https://cdn.jsdelivr.net/npm/@tolgee/web@${e}/dist/tolgee-in-context-tools.umd.min.js`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.head.appendChild(a)}))).then((()=>window["@tolgee/in-context-tools"].InContextTools))),Ke}const ze="__tolgee_apiKey",Ve="__tolgee_apiUrl";function We(){const e=sessionStorage.getItem(ze)||void 0,t=sessionStorage.getItem(Ve)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function He(){sessionStorage.removeItem(ze),sessionStorage.removeItem(Ve)}let Ye=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(Ye=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=Me({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:t,attempts:4});return e=n,a}}}();e.on("running",(({value:n})=>{var a;n&&(a=()=>{t.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(He)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return We()&&(async()=>{const e=await Be("5.31.1");return t=>{const n=We();return t.addPlugin(e({credentials:n})),t}})().then((t=>{e.addPlugin(t)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const Ge="__tolgee_currentLanguage";const Xe=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(ge("LanguageStorage"),localStorage.getItem(Ge)||void 0),setLanguage(e){ge("LanguageStorage"),localStorage.setItem(Ge,e)}}),e);function qe(e,t){const n=t.find((t=>t===e));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),r=a(window.navigator.language),o=t.find((e=>a(e)===r));return o||void 0}const Je=()=>(e,t)=>(t.setLanguageDetector({getLanguage:({availableLanguages:e})=>(ge("LanguageDetector"),qe(window.navigator.language,e))}),e);const Ze=(e,t)=>{const n=function(e){const t=e.get("Accept-Language");if(!t)return[];const n=t.split(",").map((e=>{const[t]=e.trim().split(";");return t}));return[...new Set(n.filter((e=>e&&"*"!==e)))]}(e);return n[0]&&qe(n[0],t)};function Qe(e){return e.endsWith("/")?e.slice(0,-1):e}const et={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Qe(n)}/${e}/${t}.json`:`${Qe(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"},timeout:void 0,fallbackOnFail:!1};function tt(e){const t=c(l(l({},et),e),{headers:l(l({},et.headers),null==e?void 0:e.headers)}),{prefix:n,getPath:a,getData:r,headers:o,timeout:i,fallbackOnFail:s}=t,g=u(t,["prefix","getPath","getData","headers","timeout","fallbackOnFail"]);return{async getRecord({namespace:e,language:t,fetch:c}){const d=a({namespace:e,language:t,prefix:n});try{const e=await((e,t,n,a)=>{var r=a,{signal:o}=r,i=u(r,["signal"]);const s=new AbortController;return new Promise(((a,r)=>{const c=e(t,l({signal:s.signal},i));let u=!1;function g(e){!u&&r(e),u=!0}function d(){const e=new Error(`TIMEOUT: ${t}`);s.abort(e),g(e)}if(o&&o.addEventListener("abort",d),void 0!==n){const e=setTimeout(d,n);c.finally((()=>clearTimeout(e)))}c.catch(g).then((function(e){!u&&a(e),u=!0}))}))})(c,d,i,l({headers:o},g));if(!e.ok)throw new Error(`${e.url} ${e.status}`);return await r(e)}catch(e){if(s)return;throw e}}}}const nt=e=>(t,n)=>(n.addBackend(tt(e)),t);function at(){return K().use(Ye())}const rt=()=>e=>e;export{nt as BackendFetch,Ye as BrowserExtensionPlugin,re as DEVTOOLS_ID,$e as DevBackend,rt as DevTools,ae as FormatSimple,Je as LanguageDetector,N as LanguageDetectorError,Xe as LanguageStorage,T as LanguageStorageError,De as ObserverPlugin,oe as PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY,A as RecordFetchError,le as TOLGEE_ATTRIBUTE_NAME,se as TOLGEE_RESTRICT_ATTRIBUTE,ie as TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE,at as Tolgee,K as TolgeeCore,O as createFetchFunction,qe as detectLanguage,Ze as detectLanguageFromHeaders,v as getFallback,m as getFallbackArray,_e as getProjectIdFromApiKey,$ as getTranslateProps,ue as isSSR}; | ||
var e,t=Object.defineProperty,n=Object.defineProperties,a=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(e,n,a)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a,l=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&s(e,n,t[n]);if(r)for(var n of r(t))i.call(t,n)&&s(e,n,t[n]);return e},c=(e,t)=>n(e,a(t)),u=(e,t)=>{var n={};for(var a in e)o.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&r)for(var a of r(e))t.indexOf(a)<0&&i.call(e,a)&&(n[a]=e[a]);return n};function g(e,t){for(var n=0;n<t.length;n++){const a=t[n];if("string"!=typeof a&&!Array.isArray(a))for(const t in a)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(a,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function d(e){return Boolean(e&&"function"==typeof e.then)}function f(e,t){return d(e)?Promise.resolve(e).then(t):t(e)}function p(e,t,n){function a(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=n();return d(e)?e.catch(a):e}catch(e){a(e)}}function h(e){const t=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),n=t.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...t.slice(0,-2),n].join(", ")} option`}function v(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function m(e){return v(e)||[]}function y(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?m(t):m(null==t?void 0:t[e]);var n}function b(e){return Array.from(new Set(e))}function E(e){return e?e.replace(/\/+$/,""):e}const w=(e,t)=>fetch(e,t);const O=(e=w)=>(t,n)=>{let a=(r=null==n?void 0:n.headers,Object.fromEntries(new Headers(r).entries()));var r;return a["x-api-key"]&&(a=Object.assign({"x-tolgee-sdk-type":"JS","x-tolgee-sdk-version":"5.31.2"},a)),e(t,Object.assign(Object.assign({},n),{headers:a}))};function L(e){let t=[];return Object.freeze({listen(e){const n=t=>{e(t)};return t.push(n),{unsubscribe(){t=t.filter((e=>n!==e))}}},emit(n){e()&&t.forEach((e=>e({value:n})))}})}function k(e,t,n){const a=new Set,r=new Set;let o=[];function i(){if(0===o.length)return;const e=o;o=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));!function(e){const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))}(n?Array.from(n.keys()):void 0)}return Object.freeze({emit(t,n){e()&&(o.push(t),n?setTimeout(i,0):i())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(m(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class A extends Error{constructor(e,t,n=!1){const{language:a,namespace:r}=e;super(`Tolgee: Failed to fetch record for "${a}"${r&&` and "${r}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=r}}class N extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class T extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const j=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):j(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},x=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},R=({language:e,namespace:t})=>t?`${e}:${t}`:e;function C(e,t,n,a,r,o,i){const s=new Map,l=new Map;let c={},u=0;function g(t,n,a){const r=R(t);l.set(r,{data:j(n),version:a}),e.onCacheChange.emit(t)}async function f(a,r){let o;if(r)try{o=await n(a)}catch(t){const n=new A(a,t,!0);e.onError.emit(n),console.warn(n)}return o||(o=await async function(n){function a(t){const a=new A(n,t);throw e.onError.emit(a),console.error(a),a}const r=t(n);if(d(r)){const e=await r.catch(a);if(void 0!==e)return e}const o=c[R(n)];if("function"!=typeof o)return o;try{return await o()}catch(e){a(e)}}(a)),o}const p=Object.freeze({addStaticData(e){e&&(c=Object.assign(Object.assign({},c),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=x(e),a=l.get(e);a&&0!==a.version||g(n,t,0)}})))},invalidate(){s.clear(),u+=1},addRecord(e,t){g(e,t,u)},exists(e,t=!1){const n=l.get(R(e));return n&&t?n.version===u:Boolean(n)},getRecord(e){var t;return null===(t=l.get(R(a(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=l.get(R(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(R({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return b(e)},getTranslationFallback(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(R({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var r;const o=null===(r=l.get(R(t)))||void 0===r?void 0:r.data;null==o||o.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return s.size>0;const t=m(e);return Boolean(Array.from(s.keys()).find((e=>t.includes(x(e).namespace))))},isLoading(e,t){const n=m(t);return Boolean(r()||Array.from(s.keys()).find((t=>{const a=x(t);return(!n.length||n.includes(a.namespace))&&!p.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,t){const n=e.map((e=>{const n=a(e),r=R(n),o=s.get(r);if(o)return{new:!1,promise:o,keyObject:n,cacheKey:r};const i=f(n,t)||Promise.resolve(void 0);return s.set(r,i),{new:!0,promise:i,keyObject:n,cacheKey:r}}));o.notify(),i.notify();const r=await Promise.all(n.map((e=>e.promise)));return n.forEach(((e,t)=>{const n=s.get(e.cacheKey)!==e.promise;if(e.new&&!n){s.delete(e.cacheKey);const n=r[t];n?p.addRecord(e.keyObject,n):p.getRecord(e.keyObject)||p.addRecord(e.keyObject,{})}})),o.notify(),i.notify(),n.map((e=>p.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(l.entries()).map((([e,t])=>Object.assign(Object.assign({},x(e)),{data:t.data})))});return p}function P(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const S="invalid",D={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:S,apiUrl:"https://app.tolgee.io",fetch:O(),onTranslationMissing:({key:e})=>e},I=(...e)=>{let t={};return e.forEach((e=>{t=Object.assign(Object.assign(Object.assign({},t),e),{observerOptions:Object.assign(Object.assign({},t.observerOptions),null==e?void 0:e.observerOptions)})})),t};function U(e,t){const n=I(D,null==t?void 0:t.initialOptions,e);return n.apiUrl=E(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=O(e.fetch)),{initialOptions:n,activeNamespaces:(null==t?void 0:t.activeNamespaces)||new Map,language:null==t?void 0:t.language,pendingLanguage:null==t?void 0:t.language,isInitialLoading:!1,isRunning:!1}}function F(e,t,n,a,r,o,i,s){const l={ui:void 0},c={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,target:t})=>{var n;const i=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:a(t),namespace:r({key:e,ns:t})[0],translation:o({key:e,ns:t})})));null===(n=c.ui)||void 0===n||n.handleElementClick(i,t)},g=(e,t)=>{var n;return(null===(n=c.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function d(e){const t=o({key:e.key,ns:e.ns});return j.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function h(){return{fetch:t().fetch}}function v(e){c.observer=null==e?void 0:e()}function m(){return Boolean(c.observer)}function y(e){e&&c.formatters.push(e)}function b(e){c.finalFormatter=e}function E(e){l.ui=e}function w(){return Boolean(l.ui)}function O(e){c.languageStorage=e}function L(e){c.languageDetector=e}function k(e){e&&c.backends.push(e)}function A(e){c.devBackend=e}const j=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:b,addFormatter:y,setObserver:v,hasObserver:m,setUi:E,hasUi:w,setDevBackend:A,addBackend:k,setLanguageDetector:L,setLanguageStorage:O}))},findPositions:g,run(){var e,n;const{apiKey:a,apiUrl:r,projectId:o,observerOptions:f,tagNewKeys:p}=t();c.ui=null===(e=l.ui)||void 0===e?void 0:e.call(l,{apiKey:a,apiUrl:r,projectId:o,highlight:j.highlight,changeTranslation:i,findPositions:g,onPermanentChange:e=>s.onPermanentChange.emit(e),tagNewKeys:p}),null===(n=c.observer)||void 0===n||n.run({mouseHighlight:!0,options:f,translate:d,onClick:u})},stop(){var e;c.ui=void 0,null===(e=c.observer)||void 0===e||e.stop()},getLanguageStorage:()=>c.languageStorage,getInitialLanguage(){const e=n();return f(p(s.onError,(e=>new T("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=c.languageStorage)||void 0===e?void 0:e.getLanguage(h())})),(t=>e&&!e.includes(t)||!t?function(){if(!c.languageDetector)return;const e=n();return p(s.onError,(e=>new N("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=c.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},h()))}))}():t))},setStoredLanguage:e=>p(s.onError,(e=>new T("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=c.languageStorage)||void 0===t?void 0:t.setLanguage(e,h())})),getDevBackend:()=>c.devBackend,getBackendRecord:async({language:e,namespace:t})=>{for(const n of c.backends){const a=await n.getRecord(Object.assign({language:e,namespace:t},h()));if(void 0!==a)return a}},getBackendDevRecord:async({language:e,namespace:n})=>{var a;const{apiKey:r,apiUrl:o,projectId:i}=t();return null===(a=c.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:n},h()))},getLanguageDetector:()=>c.languageDetector,retranslate(){var e;null===(e=c.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=c.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return c.observer?null===(t=c.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return c.observer?null===(t=c.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(j.getDevBackend()),formatTranslation(n){var a,{formatEnabled:r}=n,o=P(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:u,params:g,ns:d,orEmpty:f}=o,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(o));let v=null!=p?p:f?"":h;const m=e(),y=r||!(null===(a=c.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>c.observer&&!u?c.observer.wrap({key:i,translation:e,defaultValue:l,params:g,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of c.formatters)v=e.format({translation:v,language:m,params:g});c.finalFormatter&&p&&m&&y&&(v=c.finalFormatter.format({translation:v,language:m,params:g}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||S,a=t().onFormatError,r=typeof a;v="string"===r?a:"function"===r?a(n,o):S,v=b(v)}var E;return v}});return j}const _=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const $=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:r,language:o}=e,i=P(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:o};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function M({options:e}){const t=function(e,t){let n=!0;function a(){return n}const r=Object.freeze({onPendingLanguageChange:L(a),onLanguageChange:L(a),onLoadingChange:L(a),onFetchingChange:L(a),onInitialLoaded:L(a),onRunningChange:L(a),onCacheChange:L(a),onUpdate:k(a,e,t),onPermanentChange:L(a),onError:L(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return r.onPendingLanguageChange.listen(t);case"language":return r.onLanguageChange.listen(t);case"loading":return r.onLoadingChange.listen(t);case"fetching":return r.onFetchingChange.listen(t);case"initialLoad":return r.onInitialLoaded.listen(t);case"running":return r.onRunningChange.listen(t);case"cache":return r.onCacheChange.listen(t);case"update":return r.onUpdate.listen(t);case"permanentChange":return r.onPermanentChange.listen(t);case"error":return r.onError.listen(t)}}});return r.onInitialLoaded.listen((()=>r.onUpdate.emit())),r.onLanguageChange.listen((()=>r.onUpdate.emit())),r.onCacheChange.listen((({value:e})=>r.onUpdate.emit([e.namespace],!0))),r}(l,c),n=_(!1,(()=>i.isFetching()),t.onFetchingChange.emit),a=_(!1,(()=>j.isLoading()),t.onLoadingChange.emit),r=function(e,t,n){let a,r=U();const o=Object.freeze({init(e){r=U(e,r)},isRunning:()=>r.isRunning,setRunning(e){r.isRunning!==e&&(r.isRunning=e,n.emit(e))},isInitialLoading:()=>r.isInitialLoading,setInitialLoading(e){r.isInitialLoading=e},getLanguage:()=>r.language||r.initialOptions.language,setLanguage(t){r.language!==t&&(r.language=t,e.emit(t))},getPendingLanguage:()=>r.pendingLanguage||o.getLanguage(),setPendingLanguage(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},r.initialOptions),a),addActiveNs(e){m(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t?r.activeNamespaces.set(e,t+1):r.activeNamespaces.set(e,1)}))},removeActiveNs(e){m(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t&&t>1?r.activeNamespaces.set(e,t-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>b([...r.initialOptions.ns||[r.initialOptions.defaultNs],...m(r.initialOptions.fallbackNs),...r.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||o.getLanguage();return t?b([t,...y(t,r.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>m(r.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?r.initialOptions.defaultNs:e,getAvailableLanguages(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>x(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?o.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:E(e.apiUrl)}):void 0}});return o}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),o=F(r.getLanguage,r.getInitialOptions,r.getAvailableLanguages,u,A,N,p,t),i=C(t,o.getBackendRecord,o.getBackendDevRecord,r.withDefaultNs,r.isInitialLoading,n,a);let s;function l(){return r.getFallbackNs()}function c(e){return r.getDefaultNs(e)}function u(e){return[...m(c(e)),...l()]}function g(e){return[...m(null!=e?e:c()),...r.getRequiredNamespaces()]}function p(e,t,n){const a=r.withDefaultNs(e),o=i.getTranslation(a,t);return i.changeTranslation(a,t,n),{revert(){i.changeTranslation(a,t,o)}}}function v(e){r.init(e),i.addStaticData(r.getInitialOptions().staticData)}function w(e,t){const n=r.getFallbackLangs(e),a=g(t),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}function O(e,t){const n=w(e,t);if(n.length)return f(j.loadRecords(n),(()=>{}))}function A({key:e,ns:t}){const n=r.getFallbackLangs(),a=u(null!=t?t:void 0);return i.getTranslationNs(a,n,e)}function N({key:e,ns:t,language:n}){const a=u(null!=t?t:void 0),o=r.getFallbackLangs(n);return i.getTranslationFallback(a,o,e)}function T(){const e=f(function(){if(r.getLanguage())return;return f(o.getInitialLanguage(),(e=>{const t=e||r.getInitialOptions().defaultLanguage;t&&r.setLanguage(t)}))}(),(()=>O()));if(d(e))return r.setInitialLoading(!0),n.notify(),a.notify(),Promise.resolve(e).then((()=>{r.setInitialLoading(!1),n.notify(),a.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&v(e),t.onUpdate.listen((()=>{r.isRunning()&&o.retranslate()}));const j=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),o),i),{init:v,getTranslation:N,changeTranslation:p,getTranslationNs:A,getDefaultAndFallbackNs:u,findPositions:o.findPositions,getRequiredRecords:w,async changeLanguage(e){r.getPendingLanguage()===e&&r.getLanguage()===e||(r.setPendingLanguage(e),r.isRunning()&&await O(e),e===r.getPendingLanguage()&&(r.setLanguage(e),await o.setStoredLanguage(e)))},async addActiveNs(e,t){t||r.addActiveNs(e),r.isRunning()&&await O(void 0,e)},loadRecords:e=>i.loadRecords(e,j.isDev()),loadRecord:async e=>(await j.loadRecords([e]))[0],isLoading:e=>i.isLoading(r.getLanguage(),e),isLoaded(e){const t=r.getLanguage();if(!t)return!1;const n=r.getFallbackLangs(t),a=g(e),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=$(...e),n=N(t);return o.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(r.getInitialOptions().apiKey&&r.getInitialOptions().apiUrl),run:()=>(function(){if((o.getLanguageDetector()||o.getLanguageStorage())&&!r.getAvailableLanguages())throw new Error(h("availableLanguages"));if(!r.getLanguage()&&!r.getInitialOptions().defaultLanguage)throw new Error(h(["defaultLanguage","language"]))}(),r.isRunning()||(r.setRunning(!0),o.run(),s=T()),Promise.resolve(s)),stop(){r.isRunning()&&(o.stop(),r.setRunning(!1))}}));return j}const K=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=I(e.options,n),t),init(t){const n=function(e){const t=M({options:e});function n(e){const n=t.isRunning();n&&t.stop(),e(),t.isDev()&&t.invalidate(),n&&t.run()}t.isDev()&&t.invalidate();const a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmitterActive:t.setEmitterActive,getLanguage:t.getLanguage,getPendingLanguage:t.getPendingLanguage,changeLanguage:t.changeLanguage,changeTranslation:t.changeTranslation,addActiveNs:t.addActiveNs,removeActiveNs:t.removeActiveNs,loadRecords:t.loadRecords,loadRecord:t.loadRecord,addStaticData:t.addStaticData,getRecord:t.getRecord,getAllRecords:t.getAllRecords,isLoaded:t.isLoaded,getRequiredRecords:t.getRequiredRecords,isInitialLoading:t.isInitialLoading,isLoading:t.isLoading,isFetching:t.isFetching,isRunning:t.isRunning,run:t.run,stop:t.stop,t:t.t,highlight:t.highlight,findPositions:t.findPositions,getInitialOptions:t.getInitialOptions,isDev:t.isDev,wrap:t.wrap,unwrap:t.unwrap,overrideCredentials(e){n((()=>t.overrideCredentials(e)))},addPlugin(e){e&&n((()=>t.addPlugin(a,e)))},updateOptions(e){e&&n((()=>t.init(e)))}});return a}(I(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},B=0,z=1,V=2;class W extends Error{constructor(e,t,n){let a;a=e===B?"Empty parameter":e===z?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function H(e){return/\s/.test(e)}const Y=0,G=1,X=2,q=3,J=4,Z=new Set([X,G,Y]),Q="'",ee=new Set(["{","}",Q]),te=e=>/[0-9a-zA-Z_]/.test(e);function ne(e,t){const[n,a]=function(e){let t=Y,n="",a="",r="";const o=[],i=[];let s=0;function l(t){throw new W(t,s,e)}const c=()=>{o.push(n),n=""},u=()=>{""===a&&l(B),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case Y:r===Q?(n+=r,t=G):"{"===r?(c(),t=q):(n+=r,t=Y);break;case G:ee.has(r)?(n=n.slice(0,-1)+r,t=X):(n+=r,t=Y);break;case X:r===Q?t=Y:(n+=r,t=X);break;case q:"}"===r?(u(),t=Y):H(r)?""!==a&&(u(),t=J):(te(r)||l(z),a+=r,t=q);break;case J:"}"==r?t=Y:H(r)?t=J:l(z)}return Z.has(t)||l(V),c(),[o,i]}(e),r=[n[0]];for(let o=1;o<n.length;o++){const i=null==t?void 0:t[a[o-1]];if(void 0===i)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);r.push(String(i)),r.push(n[o])}return r.join("")}const ae=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>ne(e,t)}),e),re="__tolgee_dev_tools",oe="__tolgee_preferredLanguages",ie="data-tolgee-key-only",se="data-tolgee-restricted",le="_tolgee",ce="_tolgee-highlighter";function ue(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function ge(e){if(ue())throw new Error(`${e}: Can't run on the server`)}function de(e,t){return{oldTextContent:e,keys:t}}function fe(e){return e.textContent}function pe(e,t){e.textContent=t}function he(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,r=void 0===e.ns||void 0===t.ns||-1!==(null==(n=e.ns)?void 0:n.findIndex((e=>{var n;return null==(n=t.ns)?void 0:n.includes(e)})));return a&&r}const ve={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function me({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;const r=function(e){for(;e;){if(null!==e.getAttribute("disabled"))return!1;e=e.parentElement}return!0}(n);let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(ce),Object.entries(ve).forEach((([e,t])=>{o.style[e]=t})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const i=n.getBoundingClientRect();o.style.pointerEvents=r?"none":"auto",o.style.borderWidth=t+"px",o.style.top=i.top-t+"px",o.style.left=i.left-t+"px",o.style.width=i.width+"px",o.style.height=i.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null==(e=t.highlightEl)||e.remove(),t.highlightEl=void 0}}(0,a)}})}const ye={capture:!0},be={capture:!0,passive:!0},Ee=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function we({highlightKeys:e,elementStore:t,onClick:n,options:a}){var r,o;const i=new Set;let s,l,c=[];const u=(null==(r=a.targetElement)?void 0:r.getRootNode())||document,g=(null==(o=a.targetElement)?void 0:o.ownerDocument)||document;function d(){var e;const n=t.get(s);n&&(n.preventClean=!1,null==(e=n.unhighlight)||e.call(n),s=void 0)}function f(){const e=l;let n;if(e&&k()){n=function(e){for(const n of e){const e=L(n,(e=>t.get(e)));if(void 0!==e)return e||void 0}}(u.elementsFromPoint(e.x,e.y)||[])}!function(e){var n;if(s!==e){d();const a=t.get(e);a&&(a.preventClean=!0,null==(n=a.highlight)||n.call(a),s=e)}}(n)}function p(e){l=e,f()}function h(e){for(const[t,n]of Ee.entries())i.has(t)&&!e[n]?i.delete(t):!i.has(t)&&e[n]&&i.add(t)}function v(e){var t;h(e),k()&&(t=e.target,!Boolean(L(t,(e=>e.id===re))))&&(e.stopPropagation(),e.preventDefault())}function m(e){h(e),p({x:e.clientX,y:e.clientY})}function y(e){h(e),f()}function b(e){h(e),f()}function E(){var e;const n=t.get(s);null==(e=null==n?void 0:n.highlight)||e.call(n)}function w(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),k()&&s&&(n(s),d())}function O(e,t,n){g.addEventListener(e,t,n),c.push([e,t,n])}function L(e,t){return e.id===re?null:t(e)?e:(null==e?void 0:e.parentElement)?L(e.parentElement,t):void 0}function k(){for(const t of e)if(!i.has(t))return!1;return!0}return Object.freeze({stop(){!function(){for(const e of c)g.removeEventListener(...e);c=[]}()},run(){O("keydown",y,ye),O("keyup",b,ye),O("mousemove",m,be),O("scroll",E,be),O("click",w,ye),O("mouseenter",v,ye),O("mouseover",v,ye),O("mouseout",v,ye),O("mouseleave",v,ye),O("mousedown",v,ye),O("mouseup",v,ye)}})}function Oe(e,t,n){const a=me({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),r=we({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:s(a)})},options:e});function o(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${se}]`)}function i(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(le),t.remove(e)}function s(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({isRestricted:o,register(e,n,r){if(o(e))return;const i=e;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(le,"true")),s.nodes.set(n,r),a.initHighlighter(i,s)},forEachElement:t.forEachElement,cleanupLingeringKeyAttributes(){t.forEachElement(((e,t)=>{if(!t.preventClean){for(const[e]of t.nodes)if(e.nodeType===Node.ATTRIBUTE_NODE){const n=e;n.name===ie&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&i(e,t)}}))},cleanupRemovedNodes(e){t.forEachElement(((t,n)=>{n.preventClean||(e.has(t)||function(e,t){for(const[n]of e.nodes)t.has(n)&&e.nodes.delete(n)}(n,e),(e.has(t)||0===n.nodes.size)&&i(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>he({key:e,ns:v(n)},{key:t.key,ns:v(t.ns)})))){a.push(r);break}}})),a},run(e){e&&r.run()},stop(){r.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function Le(){let e,t=!1;const n=function(){const e=new Map;return Object.freeze({set(t,n){e.set(t,n)},get:t=>t&&e.get(t),remove:t=>e.delete(t),forEachElement(t){e.forEach(((e,n)=>t(n,e)))}})}();function a({mouseHighlight:e,options:a,wrapper:r,onClick:o}){if(ue())return{stop(){t=!1},wrapper:r};const i=function(e){const t=Object.freeze({getSuitableParent(n){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===a)throw console.error(n),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const t=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(t))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?t.getSuitableParent(a):a}});return t}(a),s=function(e,t){const n=Object.freeze({handleAttributes(n,a=!0){var r,o;const i=[],s=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=null!=(r=s[e.tagName.toUpperCase()])?r:[];"*"in s&&(a=a.concat(s["*"])),i.push(...a.filter((t=>e.hasAttribute(t))).map((t=>e.getAttributeNode(t))).filter((e=>t.testAttribute(e))))}if(a){const e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,(e=>{var t,n;return(null==(t=s[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=s["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=null!=(o=s[n.tagName.toUpperCase()])?o:[];"*"in s&&(a=a.concat(s["*"])),i.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return i},handleChildList(e){const t=[];return t.push(...e.flatMap((e=>n.handleAttributes(e,!0)))),t.push(...e.flatMap((e=>n.handleText(e)))),t},handleText(e){if(e.nodeType===Node.TEXT_NODE)return t.testTextNode(e)?[e]:[];const n=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>t.testTextNode(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;a.nextNode();)n.push(a.currentNode);return n}});return n}(a,r),l=Oe(a,n,o);function c(e){for(const t of e){const e=t.parentElement;if(e&&l.isRestricted(e))continue;const n=fe(t),a=n?r.unwrap(n):null;if(a){const{text:e,keys:r}=a;pe(t,e);const o=de(n,r),s=i.getSuitableParent(t);l.register(s,t,o)}}}function u(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:fe(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===ie)return void u(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(ie);t&&u(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(ie)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){u(n.currentNode.getAttributeNode(ie))}}const d=new MutationObserver((e=>{if(!t)return;const n=e.filter((e=>"childList"===e.type)).flatMap((e=>Array.from(e.removedNodes))),a=new Set(n);for(const e of n){if(e.nodeType===Node.ELEMENT_NODE)for(let t=0;t<e.attributes.length;t++)a.add(e.attributes[t]);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;t.nextNode();){const e=t.currentNode;if(e.nodeType===Node.ELEMENT_NODE){const t=e;for(let e=0;e<t.attributes.length;e++)a.add(t.attributes[e])}a.add(e)}}a.size>0&&l.cleanupRemovedNodes(a),e.some((e=>"attributes"===e.type&&e.attributeName===ie))&&l.cleanupLingeringKeyAttributes();const r=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>r.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>r.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>r.delete(e)));break;case"attributes":t.attributeName===ie&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>r.add(e)))}c([...r])})),f=a.targetElement||document;t=!0,l.run(e),g(f,!0),c(s.handleChildList([f]));const p=new Set;return p.add(ie),Object.values(a.tagAttributes).forEach((e=>e.forEach((e=>p.add(e.toLowerCase()))))),d.observe(f,{attributes:!0,attributeFilter:[...p],childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,l.stop(),d.disconnect()},elementRegistry:l,wrapper:r}}return Object.freeze({run(t){e=a(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null==(a=null==(n=null==e?void 0:e.elementRegistry)?void 0:n.forEachElement)||a.call(n,t)},highlight(t,n){var a;const r=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return r.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){r.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const r=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],o=[];return r.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),r.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{he({key:t,ns:v(n)},{key:e.key,ns:v(e.ns)})&&o.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),o},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var ke="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ae={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),r=[],o=0;;){var i=t<e.length;if(!i||o>=n-1){var s=a.subarray(0,o);if(r.push(String.fromCharCode.apply(null,s)),!i)return r.join("");e=e.subarray(t),t=0,o=0}var l=e[t++];if(0==(128&l))a[o++]=l;else if(192==(224&l)){var c=63&e[t++];a[o++]=(31&l)<<6|c}else if(224==(240&l)){c=63&e[t++];var u=63&e[t++];a[o++]=(31&l)<<12|c<<6|u}else if(240==(248&l)){var g=(7&l)<<18|(c=63&e[t++])<<12|(u=63&e[t++])<<6|63&e[t++];g>65535&&(g-=65536,a[o++]=g>>>10&1023|55296,g=56320|1023&g),a[o++]=g}}}var n="Failed to ",a=function(e,t,a){if(e)throw new Error("".concat(n).concat(t,": the '").concat(a,"' option is unsupported."))},r="function"==typeof Buffer&&Buffer.from,o=r?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,r=Math.max(32,n+(n>>>1)+7),o=new Uint8Array(r>>>3<<3);t<n;){var i=e.charCodeAt(t++);if(i>=55296&&i<=56319){if(t<n){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,i=((1023&i)<<10)+(1023&s)+65536)}if(i>=55296&&i<=56319)continue}if(a+4>o.length){r+=8,r=(r*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(r);l.set(o),o=l}if(0!=(4294967168&i)){if(0==(4294965248&i))o[a++]=i>>>6&31|192;else if(0==(4294901760&i))o[a++]=i>>>12&15|224,o[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;o[a++]=i>>>18&7|240,o[a++]=i>>>12&63|128,o[a++]=i>>>6&63|128}o[a++]=63&i|128}else o[a++]=i}return o.slice?o.slice(0,a):o.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),o(e)};var s=!r&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],c=t;r?c=function(e,t){return(e instanceof Buffer?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)).toString(t)}:s&&(c=function(e){try{return function(e){var t;try{var n=new Blob([e],{type:"text/plain;charset=UTF-8"});t=URL.createObjectURL(n);var a=new XMLHttpRequest;return a.open("GET",t,!1),a.send(),a.responseText}finally{t&&URL.revokeObjectURL(t)}}(e)}catch(n){return t(e)}});var u="construct 'TextDecoder'",g="".concat(n," ").concat(u,": the ");function d(e,t){if(a(t&&t.fatal,u,"fatal"),e=e||"utf-8",!(r?Buffer.isEncoding(e):-1!==l.indexOf(e.toLowerCase())))throw new RangeError("".concat(g," encoding label provided ('").concat(e,"') is invalid."));this.encoding=e,this.fatal=!1,this.ignoreBOM=!1}d.prototype.decode=function(e,t){var n;return a(t&&t.stream,"decode","stream"),n=e instanceof Uint8Array?e:e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer):new Uint8Array(e),c(n,this.encoding)},e.TextEncoder=e.TextEncoder||i,e.TextDecoder=e.TextDecoder||d}("undefined"!=typeof window?window:ke);const Ne=g({__proto__:null,default:Ae},[Ae]);null==(e=console.assert)||e.call(console,Ne);const Te=["",""],je=RegExp(`([${Te.join("")}]{9})+`,"gu");function xe(e){const t=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),n=t.map((e=>function(e){const t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0")).join("");return Array.from(n).map((e=>Te[Number(e)])).join("")}function Re(e){const t=Array.from(e).map((e=>Te.indexOf(e))).map(String).join("").match(/(.{9})/g),n=Uint8Array.from((null==t?void 0:t.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=n,(new TextDecoder).decode(new Uint8Array(a));var a}function Ce({fullKeyEncode:e}){const t=function(){const e=[];return Object.freeze({valueToNumber(t){let n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:t=>e[t]})}();function n(e){const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)}function a(e){return xe(e+"\n")}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(je))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(Re))||[]}(e);a.forEach((e=>{const a=function(e){return e.split("\n").filter((e=>e.length)).map((e=>{if("{"===e[0])return e;{const n=Number(e);return t.numberToValue(n)}}))}(e);a.forEach((e=>{const t=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(e);if(t){const{k:e,d:a,n:r}=t;n.push({key:e,defaultValue:a,ns:r})}}))}));const r=function(e){return e.replace(je,"")}(e);return{text:r,keys:n}},wrap({key:r,defaultValue:o,translation:i,ns:s}){let l;if(e){l=a(n({key:r,ns:s}))}else{const e=n({key:r,ns:s,defaultValue:o}),i=t.valueToNumber(e);l=a(String(i))}const c=i||"";return"string"==typeof c?c+l:c},testTextNode(e){var t,n,a;return null!=(a=(null==(t=e.textContent)?void 0:t.includes(`${Te[0]}${Te[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${Te[1]}${Te[0]}`)))&&a},testAttribute:e=>e.value.includes(`${Te[0]}${Te[0]}`)||e.value.includes(`${Te[1]}${Te[0]}`)})}function Pe(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function Se({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:r,ns:o}=function(e){let t=!1,n="",a="",r="KEY";const o={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{o.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==r||","!==s?"KEY"!==r||"|"!==s?"NAMESPACE"!==r||","!==s?"KEY"!==r||":"!==s?"DEFAULT_VALUE"!==r||":"!==s?"PARAM_NAME"!==r||":"!==s?"PARAM_VALUE"!==r||","!==s?n+=s:(r="PARAM_NAME",o.params[a]=n,n=""):(r="PARAM_VALUE",a=n,n=""):(r="PARAM_NAME",o.defaultValue=n,n=""):(r="PARAM_NAME",o.key=n,n=""):(r="DEFAULT_VALUE",i(n),n=""):(r="NAMESPACE",o.key=n,n=""):(r="DEFAULT_VALUE",o.key=n,n=""):t=!0;return"KEY"===r&&(o.key=n),"DEFAULT_VALUE"===r&&(o.defaultValue=n),"PARAM_VALUE"===r&&(o.params[a]=n),"NAMESPACE"===r&&i(n),o}(e);return{translated:n({key:t,params:a,defaultValue:r,ns:o,noWrap:!0}),key:t,params:a,defaultValue:r,ns:o}}function r(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function o(e){return"string"==typeof e?e.replace(new RegExp("[,:|\\\\]","gs"),"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:n,params:a,defaultValue:r,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${o(e)}:${o(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==r?`,${o(r)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>o(e))).join("|")}`:"";return`${e}${o(n)}${u}${l}${s}${t}`},unwrap(n){const o=new RegExp(`(\\\\?)(${r(e)}(.*?)${r(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=o.exec(n));){let e=s[1];const[t,r,o,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!Pe(d,n)){u+=o;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=n.substring(c),l?{text:u,keys:i}:{text:n,keys:[]}},testTextNode(n){var a,r,o;return null!=(o=(null==(a=n.textContent)?void 0:a.includes(e))&&(null==(r=n.textContent)?void 0:r.includes(t)))&&o},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const De=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=Le();return Object.freeze(c(l({},e),{run(t){const n=Se({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run(c(l({},t),{wrapper:n}))},retranslate(){e.forEachElement(((t,n)=>{for(const[t,a]of n.nodes.entries()){if(a.keyAttributeOnly)return;const n=e.unwrap(a.oldTextContent);n&&pe(t,n.text)}}))},outputNotFormattable:!0}))})):t.setObserver((()=>{const e=Le();return Object.freeze(c(l({},e),{run(t){const n=Ce({fullKeyEncode:t.options.fullKeyEncode});e.run(c(l({},t),{wrapper:n}))},retranslate(){},outputNotFormattable:!1}))})),e),Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Ue(e){const t=Ie.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Fe(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,r=0;const o=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|Ue(e[i]),n+=5,n>=8&&(o[r++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",r=Math.pow(2,16)-1;for(let e=0;e<n;e+=r)e+r>n&&(r=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+r));return a}(o.buffer)}function _e(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Fe(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}const $e=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:r,fetch:o}){var i;const s=null!=(i=_e(t))?i:r;let l=void 0!==s?`${e}/v2/projects/${s}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(l+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===r)throw new Error("You need to specify 'projectId' when using PAT key");return o(l,{headers:{"X-API-Key":t||"","Content-Type":"application/json"},next:{revalidate:0}}).then((e=>{if(e.ok)return e.json().then((e=>e[n]));throw new Error(e.statusText)}))}}),e);function Me({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:r=300}){let o=!1;const i=()=>new Promise(((a,o)=>{const i=function(e,t){const n=n=>{var a,r;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(r=n.data)?void 0:r.data)};return window.addEventListener("message",n,!1),{unsubscribe(){window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(s),l(),a(e)}));window.postMessage({type:e,data:n},window.origin);const s=setTimeout((function(){l(),o()}),r);function l(){i.unsubscribe()}}));return{cancel(){o=!0},promise:(async()=>{for(let e=0;e<a;e++){if(o)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!o)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let Ke=null;function Be(e){var t;return Ke||(Ke=(t=`https://cdn.jsdelivr.net/npm/@tolgee/web@${e}/dist/tolgee-in-context-tools.umd.min.js`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.head.appendChild(a)}))).then((()=>window["@tolgee/in-context-tools"].InContextTools))),Ke}const ze="__tolgee_apiKey",Ve="__tolgee_apiUrl";function We(){const e=sessionStorage.getItem(ze)||void 0,t=sessionStorage.getItem(Ve)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function He(){sessionStorage.removeItem(ze),sessionStorage.removeItem(Ve)}let Ye=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(Ye=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=Me({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:t,attempts:4});return e=n,a}}}();e.on("running",(({value:n})=>{var a;n&&(a=()=>{t.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(He)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return We()&&(async()=>{const e=await Be("5.31.2");return t=>{const n=We();return t.addPlugin(e({credentials:n})),t}})().then((t=>{e.addPlugin(t)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const Ge="__tolgee_currentLanguage";const Xe=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(ge("LanguageStorage"),localStorage.getItem(Ge)||void 0),setLanguage(e){ge("LanguageStorage"),localStorage.setItem(Ge,e)}}),e);function qe(e,t){const n=t.find((t=>t===e));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),r=a(window.navigator.language),o=t.find((e=>a(e)===r));return o||void 0}const Je=()=>(e,t)=>(t.setLanguageDetector({getLanguage:({availableLanguages:e})=>(ge("LanguageDetector"),qe(window.navigator.language,e))}),e);const Ze=(e,t)=>{const n=function(e){const t=e.get("Accept-Language");if(!t)return[];const n=t.split(",").map((e=>{const[t]=e.trim().split(";");return t}));return[...new Set(n.filter((e=>e&&"*"!==e)))]}(e);return n[0]&&qe(n[0],t)};function Qe(e){return e.endsWith("/")?e.slice(0,-1):e}const et={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Qe(n)}/${e}/${t}.json`:`${Qe(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"},timeout:void 0,fallbackOnFail:!1};function tt(e){const t=c(l(l({},et),e),{headers:l(l({},et.headers),null==e?void 0:e.headers)}),{prefix:n,getPath:a,getData:r,headers:o,timeout:i,fallbackOnFail:s}=t,g=u(t,["prefix","getPath","getData","headers","timeout","fallbackOnFail"]);return{async getRecord({namespace:e,language:t,fetch:c}){const d=a({namespace:e,language:t,prefix:n});try{const e=await((e,t,n,a)=>{var r=a,{signal:o}=r,i=u(r,["signal"]);const s=new AbortController;return new Promise(((a,r)=>{const c=e(t,l({signal:s.signal},i));let u=!1;function g(e){!u&&r(e),u=!0}function d(){const e=new Error(`TIMEOUT: ${t}`);s.abort(e),g(e)}if(o&&o.addEventListener("abort",d),void 0!==n){const e=setTimeout(d,n);c.finally((()=>clearTimeout(e)))}c.catch(g).then((function(e){!u&&a(e),u=!0}))}))})(c,d,i,l({headers:o},g));if(!e.ok)throw new Error(`${e.url} ${e.status}`);return await r(e)}catch(e){if(s)return;throw e}}}}const nt=e=>(t,n)=>(n.addBackend(tt(e)),t);function at(){return K().use(Ye())}const rt=()=>e=>e;export{nt as BackendFetch,Ye as BrowserExtensionPlugin,re as DEVTOOLS_ID,$e as DevBackend,rt as DevTools,ae as FormatSimple,Je as LanguageDetector,N as LanguageDetectorError,Xe as LanguageStorage,T as LanguageStorageError,De as ObserverPlugin,oe as PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY,A as RecordFetchError,le as TOLGEE_ATTRIBUTE_NAME,se as TOLGEE_RESTRICT_ATTRIBUTE,ie as TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE,at as Tolgee,K as TolgeeCore,O as createFetchFunction,qe as detectLanguage,Ze as detectLanguageFromHeaders,v as getFallback,m as getFallbackArray,_e as getProjectIdFromApiKey,$ as getTranslateProps,ue as isSSR}; | ||
//# sourceMappingURL=tolgee-web.production.esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
!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/web"]={})}(this,(function(e){"use strict";var t,n=Object.defineProperty,a=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,l=(e,t,a)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,c=(e,t)=>{for(var n in t||(t={}))i.call(t,n)&&l(e,n,t[n]);if(o)for(var n of o(t))s.call(t,n)&&l(e,n,t[n]);return e},u=(e,t)=>a(e,r(t)),g=(e,t)=>{var n={};for(var a in e)i.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&o)for(var a of o(e))t.indexOf(a)<0&&s.call(e,a)&&(n[a]=e[a]);return n};function d(e,t){for(var n=0;n<t.length;n++){const a=t[n];if("string"!=typeof a&&!Array.isArray(a))for(const t in a)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(a,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function f(e){return Boolean(e&&"function"==typeof e.then)}function p(e,t){return f(e)?Promise.resolve(e).then(t):t(e)}function h(e,t,n){function a(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=n();return f(e)?e.catch(a):e}catch(e){a(e)}}function v(e){const t=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),n=t.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...t.slice(0,-2),n].join(", ")} option`}function m(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function y(e){return m(e)||[]}function b(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?y(t):y(null==t?void 0:t[e]);var n}function E(e){return Array.from(new Set(e))}function w(e){return e?e.replace(/\/+$/,""):e}const L=(e,t)=>fetch(e,t);const O=(e=L)=>(t,n)=>{let a=(r=null==n?void 0:n.headers,Object.fromEntries(new Headers(r).entries()));var r;return a["x-api-key"]&&(a=Object.assign({"x-tolgee-sdk-type":"JS","x-tolgee-sdk-version":"5.31.1"},a)),e(t,Object.assign(Object.assign({},n),{headers:a}))};function A(e){let t=[];return Object.freeze({listen(e){const n=t=>{e(t)};return t.push(n),{unsubscribe(){t=t.filter((e=>n!==e))}}},emit(n){e()&&t.forEach((e=>e({value:n})))}})}function T(e,t,n){const a=new Set,r=new Set;let o=[];function i(){if(0===o.length)return;const e=o;o=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));!function(e){const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))}(n?Array.from(n.keys()):void 0)}return Object.freeze({emit(t,n){e()&&(o.push(t),n?setTimeout(i,0):i())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(y(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class k extends Error{constructor(e,t,n=!1){const{language:a,namespace:r}=e;super(`Tolgee: Failed to fetch record for "${a}"${r&&` and "${r}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=r}}class N extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class j extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const R=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):R(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},x=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},P=({language:e,namespace:t})=>t?`${e}:${t}`:e;function C(e,t,n,a,r,o,i){const s=new Map,l=new Map;let c={},u=0;function g(t,n,a){const r=P(t);l.set(r,{data:R(n),version:a}),e.onCacheChange.emit(t)}async function d(a,r){let o;if(r)try{o=await n(a)}catch(t){const n=new k(a,t,!0);e.onError.emit(n),console.warn(n)}return o||(o=await async function(n){function a(t){const a=new k(n,t);throw e.onError.emit(a),console.error(a),a}const r=t(n);if(f(r)){const e=await r.catch(a);if(void 0!==e)return e}const o=c[P(n)];if("function"!=typeof o)return o;try{return await o()}catch(e){a(e)}}(a)),o}const p=Object.freeze({addStaticData(e){e&&(c=Object.assign(Object.assign({},c),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=x(e),a=l.get(e);a&&0!==a.version||g(n,t,0)}})))},invalidate(){s.clear(),u+=1},addRecord(e,t){g(e,t,u)},exists(e,t=!1){const n=l.get(P(e));return n&&t?n.version===u:Boolean(n)},getRecord(e){var t;return null===(t=l.get(P(a(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=l.get(P(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(P({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return E(e)},getTranslationFallback(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(P({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var r;const o=null===(r=l.get(P(t)))||void 0===r?void 0:r.data;null==o||o.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return s.size>0;const t=y(e);return Boolean(Array.from(s.keys()).find((e=>t.includes(x(e).namespace))))},isLoading(e,t){const n=y(t);return Boolean(r()||Array.from(s.keys()).find((t=>{const a=x(t);return(!n.length||n.includes(a.namespace))&&!p.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,t){const n=e.map((e=>{const n=a(e),r=P(n),o=s.get(r);if(o)return{new:!1,promise:o,keyObject:n,cacheKey:r};const i=d(n,t)||Promise.resolve(void 0);return s.set(r,i),{new:!0,promise:i,keyObject:n,cacheKey:r}}));o.notify(),i.notify();const r=await Promise.all(n.map((e=>e.promise)));return n.forEach(((e,t)=>{const n=s.get(e.cacheKey)!==e.promise;if(e.new&&!n){s.delete(e.cacheKey);const n=r[t];n?p.addRecord(e.keyObject,n):p.getRecord(e.keyObject)||p.addRecord(e.keyObject,{})}})),o.notify(),i.notify(),n.map((e=>p.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(l.entries()).map((([e,t])=>Object.assign(Object.assign({},x(e)),{data:t.data})))});return p}function S(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const D="invalid",F={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:D,apiUrl:"https://app.tolgee.io",fetch:O(),onTranslationMissing:({key:e})=>e},I=(...e)=>{let t={};return e.forEach((e=>{t=Object.assign(Object.assign(Object.assign({},t),e),{observerOptions:Object.assign(Object.assign({},t.observerOptions),null==e?void 0:e.observerOptions)})})),t};function _(e,t){const n=I(F,null==t?void 0:t.initialOptions,e);return n.apiUrl=w(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=O(e.fetch)),{initialOptions:n,activeNamespaces:(null==t?void 0:t.activeNamespaces)||new Map,language:null==t?void 0:t.language,pendingLanguage:null==t?void 0:t.language,isInitialLoading:!1,isRunning:!1}}function U(e,t,n,a,r,o,i,s){const l={ui:void 0},c={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,target:t})=>{var n;const i=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:a(t),namespace:r({key:e,ns:t})[0],translation:o({key:e,ns:t})})));null===(n=c.ui)||void 0===n||n.handleElementClick(i,t)},g=(e,t)=>{var n;return(null===(n=c.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function d(e){const t=o({key:e.key,ns:e.ns});return k.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function f(){return{fetch:t().fetch}}function v(e){c.observer=null==e?void 0:e()}function m(){return Boolean(c.observer)}function y(e){e&&c.formatters.push(e)}function b(e){c.finalFormatter=e}function E(e){l.ui=e}function w(){return Boolean(l.ui)}function L(e){c.languageStorage=e}function O(e){c.languageDetector=e}function A(e){e&&c.backends.push(e)}function T(e){c.devBackend=e}const k=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:b,addFormatter:y,setObserver:v,hasObserver:m,setUi:E,hasUi:w,setDevBackend:T,addBackend:A,setLanguageDetector:O,setLanguageStorage:L}))},findPositions:g,run(){var e,n;const{apiKey:a,apiUrl:r,projectId:o,observerOptions:f,tagNewKeys:p}=t();c.ui=null===(e=l.ui)||void 0===e?void 0:e.call(l,{apiKey:a,apiUrl:r,projectId:o,highlight:k.highlight,changeTranslation:i,findPositions:g,onPermanentChange:e=>s.onPermanentChange.emit(e),tagNewKeys:p}),null===(n=c.observer)||void 0===n||n.run({mouseHighlight:!0,options:f,translate:d,onClick:u})},stop(){var e;c.ui=void 0,null===(e=c.observer)||void 0===e||e.stop()},getLanguageStorage:()=>c.languageStorage,getInitialLanguage(){const e=n();return p(h(s.onError,(e=>new j("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=c.languageStorage)||void 0===e?void 0:e.getLanguage(f())})),(t=>e&&!e.includes(t)||!t?function(){if(!c.languageDetector)return;const e=n();return h(s.onError,(e=>new N("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=c.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},f()))}))}():t))},setStoredLanguage:e=>h(s.onError,(e=>new j("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=c.languageStorage)||void 0===t?void 0:t.setLanguage(e,f())})),getDevBackend:()=>c.devBackend,getBackendRecord:async({language:e,namespace:t})=>{for(const n of c.backends){const a=await n.getRecord(Object.assign({language:e,namespace:t},f()));if(void 0!==a)return a}},getBackendDevRecord:async({language:e,namespace:n})=>{var a;const{apiKey:r,apiUrl:o,projectId:i}=t();return null===(a=c.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:n},f()))},getLanguageDetector:()=>c.languageDetector,retranslate(){var e;null===(e=c.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=c.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return c.observer?null===(t=c.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return c.observer?null===(t=c.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(k.getDevBackend()),formatTranslation(n){var a,{formatEnabled:r}=n,o=S(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:u,params:g,ns:d,orEmpty:f}=o,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(o));let v=null!=p?p:f?"":h;const m=e(),y=r||!(null===(a=c.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>c.observer&&!u?c.observer.wrap({key:i,translation:e,defaultValue:l,params:g,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of c.formatters)v=e.format({translation:v,language:m,params:g});c.finalFormatter&&p&&m&&y&&(v=c.finalFormatter.format({translation:v,language:m,params:g}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||D,a=t().onFormatError,r=typeof a;v="string"===r?a:"function"===r?a(n,o):D,v=b(v)}var E;return v}});return k}const $=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const M=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:r,language:o}=e,i=S(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:o};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function B({options:e}){const t=function(e,t){let n=!0;function a(){return n}const r=Object.freeze({onPendingLanguageChange:A(a),onLanguageChange:A(a),onLoadingChange:A(a),onFetchingChange:A(a),onInitialLoaded:A(a),onRunningChange:A(a),onCacheChange:A(a),onUpdate:T(a,e,t),onPermanentChange:A(a),onError:A(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return r.onPendingLanguageChange.listen(t);case"language":return r.onLanguageChange.listen(t);case"loading":return r.onLoadingChange.listen(t);case"fetching":return r.onFetchingChange.listen(t);case"initialLoad":return r.onInitialLoaded.listen(t);case"running":return r.onRunningChange.listen(t);case"cache":return r.onCacheChange.listen(t);case"update":return r.onUpdate.listen(t);case"permanentChange":return r.onPermanentChange.listen(t);case"error":return r.onError.listen(t)}}});return r.onInitialLoaded.listen((()=>r.onUpdate.emit())),r.onLanguageChange.listen((()=>r.onUpdate.emit())),r.onCacheChange.listen((({value:e})=>r.onUpdate.emit([e.namespace],!0))),r}(l,c),n=$(!1,(()=>i.isFetching()),t.onFetchingChange.emit),a=$(!1,(()=>j.isLoading()),t.onLoadingChange.emit),r=function(e,t,n){let a,r=_();const o=Object.freeze({init(e){r=_(e,r)},isRunning:()=>r.isRunning,setRunning(e){r.isRunning!==e&&(r.isRunning=e,n.emit(e))},isInitialLoading:()=>r.isInitialLoading,setInitialLoading(e){r.isInitialLoading=e},getLanguage:()=>r.language||r.initialOptions.language,setLanguage(t){r.language!==t&&(r.language=t,e.emit(t))},getPendingLanguage:()=>r.pendingLanguage||o.getLanguage(),setPendingLanguage(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},r.initialOptions),a),addActiveNs(e){y(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t?r.activeNamespaces.set(e,t+1):r.activeNamespaces.set(e,1)}))},removeActiveNs(e){y(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t&&t>1?r.activeNamespaces.set(e,t-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>E([...r.initialOptions.ns||[r.initialOptions.defaultNs],...y(r.initialOptions.fallbackNs),...r.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||o.getLanguage();return t?E([t,...b(t,r.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>y(r.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?r.initialOptions.defaultNs:e,getAvailableLanguages(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>x(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?o.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:w(e.apiUrl)}):void 0}});return o}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),o=U(r.getLanguage,r.getInitialOptions,r.getAvailableLanguages,u,O,k,d,t),i=C(t,o.getBackendRecord,o.getBackendDevRecord,r.withDefaultNs,r.isInitialLoading,n,a);let s;function l(){return r.getFallbackNs()}function c(e){return r.getDefaultNs(e)}function u(e){return[...y(c(e)),...l()]}function g(e){return[...y(null!=e?e:c()),...r.getRequiredNamespaces()]}function d(e,t,n){const a=r.withDefaultNs(e),o=i.getTranslation(a,t);return i.changeTranslation(a,t,n),{revert(){i.changeTranslation(a,t,o)}}}function h(e){r.init(e),i.addStaticData(r.getInitialOptions().staticData)}function m(e,t){const n=r.getFallbackLangs(e),a=g(t),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}function L(e,t){const n=m(e,t);if(n.length)return p(j.loadRecords(n),(()=>{}))}function O({key:e,ns:t}){const n=r.getFallbackLangs(),a=u(null!=t?t:void 0);return i.getTranslationNs(a,n,e)}function k({key:e,ns:t,language:n}){const a=u(null!=t?t:void 0),o=r.getFallbackLangs(n);return i.getTranslationFallback(a,o,e)}function N(){const e=p(function(){if(r.getLanguage())return;return p(o.getInitialLanguage(),(e=>{const t=e||r.getInitialOptions().defaultLanguage;t&&r.setLanguage(t)}))}(),(()=>L()));if(f(e))return r.setInitialLoading(!0),n.notify(),a.notify(),Promise.resolve(e).then((()=>{r.setInitialLoading(!1),n.notify(),a.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&h(e),t.onUpdate.listen((()=>{r.isRunning()&&o.retranslate()}));const j=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),o),i),{init:h,getTranslation:k,changeTranslation:d,getTranslationNs:O,getDefaultAndFallbackNs:u,findPositions:o.findPositions,getRequiredRecords:m,async changeLanguage(e){r.getPendingLanguage()===e&&r.getLanguage()===e||(r.setPendingLanguage(e),r.isRunning()&&await L(e),e===r.getPendingLanguage()&&(r.setLanguage(e),await o.setStoredLanguage(e)))},async addActiveNs(e,t){t||r.addActiveNs(e),r.isRunning()&&await L(void 0,e)},loadRecords:e=>i.loadRecords(e,j.isDev()),loadRecord:async e=>(await j.loadRecords([e]))[0],isLoading:e=>i.isLoading(r.getLanguage(),e),isLoaded(e){const t=r.getLanguage();if(!t)return!1;const n=r.getFallbackLangs(t),a=g(e),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=M(...e),n=k(t);return o.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(r.getInitialOptions().apiKey&&r.getInitialOptions().apiUrl),run:()=>(function(){if((o.getLanguageDetector()||o.getLanguageStorage())&&!r.getAvailableLanguages())throw new Error(v("availableLanguages"));if(!r.getLanguage()&&!r.getInitialOptions().defaultLanguage)throw new Error(v(["defaultLanguage","language"]))}(),r.isRunning()||(r.setRunning(!0),o.run(),s=N()),Promise.resolve(s)),stop(){r.isRunning()&&(o.stop(),r.setRunning(!1))}}));return j}const K=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=I(e.options,n),t),init(t){const n=function(e){const t=B({options:e});function n(e){const n=t.isRunning();n&&t.stop(),e(),t.isDev()&&t.invalidate(),n&&t.run()}t.isDev()&&t.invalidate();const a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmitterActive:t.setEmitterActive,getLanguage:t.getLanguage,getPendingLanguage:t.getPendingLanguage,changeLanguage:t.changeLanguage,changeTranslation:t.changeTranslation,addActiveNs:t.addActiveNs,removeActiveNs:t.removeActiveNs,loadRecords:t.loadRecords,loadRecord:t.loadRecord,addStaticData:t.addStaticData,getRecord:t.getRecord,getAllRecords:t.getAllRecords,isLoaded:t.isLoaded,getRequiredRecords:t.getRequiredRecords,isInitialLoading:t.isInitialLoading,isLoading:t.isLoading,isFetching:t.isFetching,isRunning:t.isRunning,run:t.run,stop:t.stop,t:t.t,highlight:t.highlight,findPositions:t.findPositions,getInitialOptions:t.getInitialOptions,isDev:t.isDev,wrap:t.wrap,unwrap:t.unwrap,overrideCredentials(e){n((()=>t.overrideCredentials(e)))},addPlugin(e){e&&n((()=>t.addPlugin(a,e)))},updateOptions(e){e&&n((()=>t.init(e)))}});return a}(I(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},V=0,z=1,W=2;class G extends Error{constructor(e,t,n){let a;a=e===V?"Empty parameter":e===z?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function Y(e){return/\s/.test(e)}const H=0,X=1,q=2,J=3,Z=4,Q=new Set([q,X,H]),ee="'",te=new Set(["{","}",ee]),ne=e=>/[0-9a-zA-Z_]/.test(e);function ae(e,t){const[n,a]=function(e){let t=H,n="",a="",r="";const o=[],i=[];let s=0;function l(t){throw new G(t,s,e)}const c=()=>{o.push(n),n=""},u=()=>{""===a&&l(V),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case H:r===ee?(n+=r,t=X):"{"===r?(c(),t=J):(n+=r,t=H);break;case X:te.has(r)?(n=n.slice(0,-1)+r,t=q):(n+=r,t=H);break;case q:r===ee?t=H:(n+=r,t=q);break;case J:"}"===r?(u(),t=H):Y(r)?""!==a&&(u(),t=Z):(ne(r)||l(z),a+=r,t=J);break;case Z:"}"==r?t=H:Y(r)?t=Z:l(z)}return Q.has(t)||l(W),c(),[o,i]}(e),r=[n[0]];for(let o=1;o<n.length;o++){const i=null==t?void 0:t[a[o-1]];if(void 0===i)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);r.push(String(i)),r.push(n[o])}return r.join("")}const re="__tolgee_dev_tools",oe="data-tolgee-key-only",ie="data-tolgee-restricted",se="_tolgee",le="_tolgee-highlighter";function ce(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function ue(e){if(ce())throw new Error(`${e}: Can't run on the server`)}function ge(e,t){return{oldTextContent:e,keys:t}}function de(e){return e.textContent}function fe(e,t){e.textContent=t}function pe(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,r=void 0===e.ns||void 0===t.ns||-1!==(null==(n=e.ns)?void 0:n.findIndex((e=>{var n;return null==(n=t.ns)?void 0:n.includes(e)})));return a&&r}const he={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function ve({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;const r=function(e){for(;e;){if(null!==e.getAttribute("disabled"))return!1;e=e.parentElement}return!0}(n);let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(le),Object.entries(he).forEach((([e,t])=>{o.style[e]=t})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const i=n.getBoundingClientRect();o.style.pointerEvents=r?"none":"auto",o.style.borderWidth=t+"px",o.style.top=i.top-t+"px",o.style.left=i.left-t+"px",o.style.width=i.width+"px",o.style.height=i.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null==(e=t.highlightEl)||e.remove(),t.highlightEl=void 0}}(0,a)}})}const me={capture:!0},ye={capture:!0,passive:!0},be=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function Ee({highlightKeys:e,elementStore:t,onClick:n,options:a}){var r,o;const i=new Set;let s,l,c=[];const u=(null==(r=a.targetElement)?void 0:r.getRootNode())||document,g=(null==(o=a.targetElement)?void 0:o.ownerDocument)||document;function d(){var e;const n=t.get(s);n&&(n.preventClean=!1,null==(e=n.unhighlight)||e.call(n),s=void 0)}function f(){const e=l;let n;if(e&&A()){n=function(e){for(const n of e){const e=O(n,(e=>t.get(e)));if(void 0!==e)return e||void 0}}(u.elementsFromPoint(e.x,e.y)||[])}!function(e){var n;if(s!==e){d();const a=t.get(e);a&&(a.preventClean=!0,null==(n=a.highlight)||n.call(a),s=e)}}(n)}function p(e){l=e,f()}function h(e){for(const[t,n]of be.entries())i.has(t)&&!e[n]?i.delete(t):!i.has(t)&&e[n]&&i.add(t)}function v(e){var t;h(e),A()&&(t=e.target,!Boolean(O(t,(e=>e.id===re))))&&(e.stopPropagation(),e.preventDefault())}function m(e){h(e),p({x:e.clientX,y:e.clientY})}function y(e){h(e),f()}function b(e){h(e),f()}function E(){var e;const n=t.get(s);null==(e=null==n?void 0:n.highlight)||e.call(n)}function w(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),A()&&s&&(n(s),d())}function L(e,t,n){g.addEventListener(e,t,n),c.push([e,t,n])}function O(e,t){return e.id===re?null:t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function A(){for(const t of e)if(!i.has(t))return!1;return!0}return Object.freeze({stop(){!function(){for(const e of c)g.removeEventListener(...e);c=[]}()},run(){L("keydown",y,me),L("keyup",b,me),L("mousemove",m,ye),L("scroll",E,ye),L("click",w,me),L("mouseenter",v,me),L("mouseover",v,me),L("mouseout",v,me),L("mouseleave",v,me),L("mousedown",v,me),L("mouseup",v,me)}})}function we(e,t,n){const a=ve({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),r=Ee({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:s(a)})},options:e});function o(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${ie}]`)}function i(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(se),t.remove(e)}function s(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({isRestricted:o,register(e,n,r){if(o(e))return;const i=e;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(se,"true")),s.nodes.set(n,r),a.initHighlighter(i,s)},forEachElement:t.forEachElement,cleanupLingeringKeyAttributes(){t.forEachElement(((e,t)=>{if(!t.preventClean){for(const[e]of t.nodes)if(e.nodeType===Node.ATTRIBUTE_NODE){const n=e;n.name===oe&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&i(e,t)}}))},cleanupRemovedNodes(e){t.forEachElement(((t,n)=>{n.preventClean||(e.has(t)||function(e,t){for(const[n]of e.nodes)t.has(n)&&e.nodes.delete(n)}(n,e),(e.has(t)||0===n.nodes.size)&&i(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>pe({key:e,ns:m(n)},{key:t.key,ns:m(t.ns)})))){a.push(r);break}}})),a},run(e){e&&r.run()},stop(){r.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function Le(){let e,t=!1;const n=function(){const e=new Map;return Object.freeze({set(t,n){e.set(t,n)},get:t=>t&&e.get(t),remove:t=>e.delete(t),forEachElement(t){e.forEach(((e,n)=>t(n,e)))}})}();function a({mouseHighlight:e,options:a,wrapper:r,onClick:o}){if(ce())return{stop(){t=!1},wrapper:r};const i=function(e){const t=Object.freeze({getSuitableParent(n){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===a)throw console.error(n),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const t=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(t))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?t.getSuitableParent(a):a}});return t}(a),s=function(e,t){const n=Object.freeze({handleAttributes(n,a=!0){var r,o;const i=[],s=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=null!=(r=s[e.tagName.toUpperCase()])?r:[];"*"in s&&(a=a.concat(s["*"])),i.push(...a.filter((t=>e.hasAttribute(t))).map((t=>e.getAttributeNode(t))).filter((e=>t.testAttribute(e))))}if(a){const e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,(e=>{var t,n;return(null==(t=s[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=s["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=null!=(o=s[n.tagName.toUpperCase()])?o:[];"*"in s&&(a=a.concat(s["*"])),i.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return i},handleChildList(e){const t=[];return t.push(...e.flatMap((e=>n.handleAttributes(e,!0)))),t.push(...e.flatMap((e=>n.handleText(e)))),t},handleText(e){if(e.nodeType===Node.TEXT_NODE)return t.testTextNode(e)?[e]:[];const n=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>t.testTextNode(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;a.nextNode();)n.push(a.currentNode);return n}});return n}(a,r),l=we(a,n,o);function c(e){for(const t of e){const e=t.parentElement;if(e&&l.isRestricted(e))continue;const n=de(t),a=n?r.unwrap(n):null;if(a){const{text:e,keys:r}=a;fe(t,e);const o=ge(n,r),s=i.getSuitableParent(t);l.register(s,t,o)}}}function u(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:de(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===oe)return void u(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(oe);t&&u(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(oe)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){u(n.currentNode.getAttributeNode(oe))}}const d=new MutationObserver((e=>{if(!t)return;const n=e.filter((e=>"childList"===e.type)).flatMap((e=>Array.from(e.removedNodes))),a=new Set(n);for(const e of n){if(e.nodeType===Node.ELEMENT_NODE)for(let t=0;t<e.attributes.length;t++)a.add(e.attributes[t]);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;t.nextNode();){const e=t.currentNode;if(e.nodeType===Node.ELEMENT_NODE){const t=e;for(let e=0;e<t.attributes.length;e++)a.add(t.attributes[e])}a.add(e)}}a.size>0&&l.cleanupRemovedNodes(a),e.some((e=>"attributes"===e.type&&e.attributeName===oe))&&l.cleanupLingeringKeyAttributes();const r=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>r.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>r.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>r.delete(e)));break;case"attributes":t.attributeName===oe&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>r.add(e)))}c([...r])})),f=a.targetElement||document;t=!0,l.run(e),g(f,!0),c(s.handleChildList([f]));const p=new Set;return p.add(oe),Object.values(a.tagAttributes).forEach((e=>e.forEach((e=>p.add(e.toLowerCase()))))),d.observe(f,{attributes:!0,attributeFilter:[...p],childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,l.stop(),d.disconnect()},elementRegistry:l,wrapper:r}}return Object.freeze({run(t){e=a(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null==(a=null==(n=null==e?void 0:e.elementRegistry)?void 0:n.forEachElement)||a.call(n,t)},highlight(t,n){var a;const r=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return r.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){r.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const r=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],o=[];return r.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),r.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{pe({key:t,ns:m(n)},{key:e.key,ns:m(e.ns)})&&o.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),o},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var Oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ae={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),r=[],o=0;;){var i=t<e.length;if(!i||o>=n-1){var s=a.subarray(0,o);if(r.push(String.fromCharCode.apply(null,s)),!i)return r.join("");e=e.subarray(t),t=0,o=0}var l=e[t++];if(0==(128&l))a[o++]=l;else if(192==(224&l)){var c=63&e[t++];a[o++]=(31&l)<<6|c}else if(224==(240&l)){c=63&e[t++];var u=63&e[t++];a[o++]=(31&l)<<12|c<<6|u}else if(240==(248&l)){var g=(7&l)<<18|(c=63&e[t++])<<12|(u=63&e[t++])<<6|63&e[t++];g>65535&&(g-=65536,a[o++]=g>>>10&1023|55296,g=56320|1023&g),a[o++]=g}}}var n="Failed to ",a=function(e,t,a){if(e)throw new Error("".concat(n).concat(t,": the '").concat(a,"' option is unsupported."))},r="function"==typeof Buffer&&Buffer.from,o=r?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,r=Math.max(32,n+(n>>>1)+7),o=new Uint8Array(r>>>3<<3);t<n;){var i=e.charCodeAt(t++);if(i>=55296&&i<=56319){if(t<n){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,i=((1023&i)<<10)+(1023&s)+65536)}if(i>=55296&&i<=56319)continue}if(a+4>o.length){r+=8,r=(r*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(r);l.set(o),o=l}if(0!=(4294967168&i)){if(0==(4294965248&i))o[a++]=i>>>6&31|192;else if(0==(4294901760&i))o[a++]=i>>>12&15|224,o[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;o[a++]=i>>>18&7|240,o[a++]=i>>>12&63|128,o[a++]=i>>>6&63|128}o[a++]=63&i|128}else o[a++]=i}return o.slice?o.slice(0,a):o.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),o(e)};var s=!r&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],c=t;r?c=function(e,t){return(e instanceof Buffer?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)).toString(t)}:s&&(c=function(e){try{return function(e){var t;try{var n=new Blob([e],{type:"text/plain;charset=UTF-8"});t=URL.createObjectURL(n);var a=new XMLHttpRequest;return a.open("GET",t,!1),a.send(),a.responseText}finally{t&&URL.revokeObjectURL(t)}}(e)}catch(n){return t(e)}});var u="construct 'TextDecoder'",g="".concat(n," ").concat(u,": the ");function d(e,t){if(a(t&&t.fatal,u,"fatal"),e=e||"utf-8",!(r?Buffer.isEncoding(e):-1!==l.indexOf(e.toLowerCase())))throw new RangeError("".concat(g," encoding label provided ('").concat(e,"') is invalid."));this.encoding=e,this.fatal=!1,this.ignoreBOM=!1}d.prototype.decode=function(e,t){var n;return a(t&&t.stream,"decode","stream"),n=e instanceof Uint8Array?e:e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer):new Uint8Array(e),c(n,this.encoding)},e.TextEncoder=e.TextEncoder||i,e.TextDecoder=e.TextDecoder||d}("undefined"!=typeof window?window:Oe);const Te=d({__proto__:null,default:Ae},[Ae]);null==(t=console.assert)||t.call(console,Te);const ke=["",""],Ne=RegExp(`([${ke.join("")}]{9})+`,"gu");function je(e){const t=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),n=t.map((e=>function(e){const t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0")).join("");return Array.from(n).map((e=>ke[Number(e)])).join("")}function Re(e){const t=Array.from(e).map((e=>ke.indexOf(e))).map(String).join("").match(/(.{9})/g),n=Uint8Array.from((null==t?void 0:t.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=n,(new TextDecoder).decode(new Uint8Array(a));var a}function xe({fullKeyEncode:e}){const t=function(){const e=[];return Object.freeze({valueToNumber(t){let n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:t=>e[t]})}();function n(e){const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)}function a(e){return je(e+"\n")}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(Ne))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(Re))||[]}(e);a.forEach((e=>{const a=function(e){return e.split("\n").filter((e=>e.length)).map((e=>{if("{"===e[0])return e;{const n=Number(e);return t.numberToValue(n)}}))}(e);a.forEach((e=>{const t=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(e);if(t){const{k:e,d:a,n:r}=t;n.push({key:e,defaultValue:a,ns:r})}}))}));const r=function(e){return e.replace(Ne,"")}(e);return{text:r,keys:n}},wrap({key:r,defaultValue:o,translation:i,ns:s}){let l;if(e){l=a(n({key:r,ns:s}))}else{const e=n({key:r,ns:s,defaultValue:o}),i=t.valueToNumber(e);l=a(String(i))}const c=i||"";return"string"==typeof c?c+l:c},testTextNode(e){var t,n,a;return null!=(a=(null==(t=e.textContent)?void 0:t.includes(`${ke[0]}${ke[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${ke[1]}${ke[0]}`)))&&a},testAttribute:e=>e.value.includes(`${ke[0]}${ke[0]}`)||e.value.includes(`${ke[1]}${ke[0]}`)})}function Pe(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function Ce({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:r,ns:o}=function(e){let t=!1,n="",a="",r="KEY";const o={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{o.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==r||","!==s?"KEY"!==r||"|"!==s?"NAMESPACE"!==r||","!==s?"KEY"!==r||":"!==s?"DEFAULT_VALUE"!==r||":"!==s?"PARAM_NAME"!==r||":"!==s?"PARAM_VALUE"!==r||","!==s?n+=s:(r="PARAM_NAME",o.params[a]=n,n=""):(r="PARAM_VALUE",a=n,n=""):(r="PARAM_NAME",o.defaultValue=n,n=""):(r="PARAM_NAME",o.key=n,n=""):(r="DEFAULT_VALUE",i(n),n=""):(r="NAMESPACE",o.key=n,n=""):(r="DEFAULT_VALUE",o.key=n,n=""):t=!0;return"KEY"===r&&(o.key=n),"DEFAULT_VALUE"===r&&(o.defaultValue=n),"PARAM_VALUE"===r&&(o.params[a]=n),"NAMESPACE"===r&&i(n),o}(e);return{translated:n({key:t,params:a,defaultValue:r,ns:o,noWrap:!0}),key:t,params:a,defaultValue:r,ns:o}}function r(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function o(e){return"string"==typeof e?e.replace(new RegExp("[,:|\\\\]","gs"),"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:n,params:a,defaultValue:r,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${o(e)}:${o(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==r?`,${o(r)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>o(e))).join("|")}`:"";return`${e}${o(n)}${u}${l}${s}${t}`},unwrap(n){const o=new RegExp(`(\\\\?)(${r(e)}(.*?)${r(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=o.exec(n));){let e=s[1];const[t,r,o,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!Pe(d,n)){u+=o;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=n.substring(c),l?{text:u,keys:i}:{text:n,keys:[]}},testTextNode(n){var a,r,o;return null!=(o=(null==(a=n.textContent)?void 0:a.includes(e))&&(null==(r=n.textContent)?void 0:r.includes(t)))&&o},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const Se="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function De(e){const t=Se.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Fe(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,r=0;const o=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|De(e[i]),n+=5,n>=8&&(o[r++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",r=Math.pow(2,16)-1;for(let e=0;e<n;e+=r)e+r>n&&(r=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+r));return a}(o.buffer)}function Ie(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Fe(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}function _e({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:r=300}){let o=!1;const i=()=>new Promise(((a,o)=>{const i=function(e,t){const n=n=>{var a,r;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(r=n.data)?void 0:r.data)};return window.addEventListener("message",n,!1),{unsubscribe(){window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(s),l(),a(e)}));window.postMessage({type:e,data:n},window.origin);const s=setTimeout((function(){l(),o()}),r);function l(){i.unsubscribe()}}));return{cancel(){o=!0},promise:(async()=>{for(let e=0;e<a;e++){if(o)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!o)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let Ue=null;function $e(e){var t;return Ue||(Ue=(t=`https://cdn.jsdelivr.net/npm/@tolgee/web@${e}/dist/tolgee-in-context-tools.umd.min.js`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.head.appendChild(a)}))).then((()=>window["@tolgee/in-context-tools"].InContextTools))),Ue}const Me="__tolgee_apiKey",Be="__tolgee_apiUrl";function Ke(){const e=sessionStorage.getItem(Me)||void 0,t=sessionStorage.getItem(Be)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Ve(){sessionStorage.removeItem(Me),sessionStorage.removeItem(Be)}e.BrowserExtensionPlugin=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(e.BrowserExtensionPlugin=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=_e({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:t,attempts:4});return e=n,a}}}();e.on("running",(({value:n})=>{var a;n&&(a=()=>{t.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(Ve)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ke()&&(async()=>{const e=await $e("5.31.1");return t=>{const n=Ke();return t.addPlugin(e({credentials:n})),t}})().then((t=>{e.addPlugin(t)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const ze="__tolgee_currentLanguage";function We(e,t){const n=t.find((t=>t===e));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),r=a(window.navigator.language),o=t.find((e=>a(e)===r));return o||void 0}function Ge(e){return e.endsWith("/")?e.slice(0,-1):e}const Ye={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Ge(n)}/${e}/${t}.json`:`${Ge(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"},timeout:void 0,fallbackOnFail:!1};function He(e){const t=u(c(c({},Ye),e),{headers:c(c({},Ye.headers),null==e?void 0:e.headers)}),{prefix:n,getPath:a,getData:r,headers:o,timeout:i,fallbackOnFail:s}=t,l=g(t,["prefix","getPath","getData","headers","timeout","fallbackOnFail"]);return{async getRecord({namespace:e,language:t,fetch:u}){const d=a({namespace:e,language:t,prefix:n});try{const e=await((e,t,n,a)=>{var r=a,{signal:o}=r,i=g(r,["signal"]);const s=new AbortController;return new Promise(((a,r)=>{const l=e(t,c({signal:s.signal},i));let u=!1;function g(e){!u&&r(e),u=!0}function d(){const e=new Error(`TIMEOUT: ${t}`);s.abort(e),g(e)}if(o&&o.addEventListener("abort",d),void 0!==n){const e=setTimeout(d,n);l.finally((()=>clearTimeout(e)))}l.catch(g).then((function(e){!u&&a(e),u=!0}))}))})(u,d,i,c({headers:o},l));if(!e.ok)throw new Error(`${e.url} ${e.status}`);return await r(e)}catch(e){if(s)return;throw e}}}}e.BackendFetch=e=>(t,n)=>(n.addBackend(He(e)),t),e.DEVTOOLS_ID=re,e.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:r,fetch:o}){var i;const s=null!=(i=Ie(t))?i:r;let l=void 0!==s?`${e}/v2/projects/${s}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(l+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===r)throw new Error("You need to specify 'projectId' when using PAT key");return o(l,{headers:{"X-API-Key":t||"","Content-Type":"application/json"},next:{revalidate:0}}).then((e=>{if(e.ok)return e.json().then((e=>e[n]));throw new Error(e.statusText)}))}}),e),e.DevTools=()=>e=>e,e.FormatSimple=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>ae(e,t)}),e),e.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage:({availableLanguages:e})=>(ue("LanguageDetector"),We(window.navigator.language,e))}),e),e.LanguageDetectorError=N,e.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(ue("LanguageStorage"),localStorage.getItem(ze)||void 0),setLanguage(e){ue("LanguageStorage"),localStorage.setItem(ze,e)}}),e),e.LanguageStorageError=j,e.ObserverPlugin=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=Le();return Object.freeze(u(c({},e),{run(t){const n=Ce({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run(u(c({},t),{wrapper:n}))},retranslate(){e.forEachElement(((t,n)=>{for(const[t,a]of n.nodes.entries()){if(a.keyAttributeOnly)return;const n=e.unwrap(a.oldTextContent);n&&fe(t,n.text)}}))},outputNotFormattable:!0}))})):t.setObserver((()=>{const e=Le();return Object.freeze(u(c({},e),{run(t){const n=xe({fullKeyEncode:t.options.fullKeyEncode});e.run(u(c({},t),{wrapper:n}))},retranslate(){},outputNotFormattable:!1}))})),e),e.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",e.RecordFetchError=k,e.TOLGEE_ATTRIBUTE_NAME=se,e.TOLGEE_RESTRICT_ATTRIBUTE=ie,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=oe,e.Tolgee=function(){return K().use(e.BrowserExtensionPlugin())},e.TolgeeCore=K,e.createFetchFunction=O,e.detectLanguage=We,e.detectLanguageFromHeaders=(e,t)=>{const n=function(e){const t=e.get("Accept-Language");if(!t)return[];const n=t.split(",").map((e=>{const[t]=e.trim().split(";");return t}));return[...new Set(n.filter((e=>e&&"*"!==e)))]}(e);return n[0]&&We(n[0],t)},e.getFallback=m,e.getFallbackArray=y,e.getProjectIdFromApiKey=Ie,e.getTranslateProps=M,e.isSSR=ce,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})})); | ||
!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/web"]={})}(this,(function(e){"use strict";var t,n=Object.defineProperty,a=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,l=(e,t,a)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,c=(e,t)=>{for(var n in t||(t={}))i.call(t,n)&&l(e,n,t[n]);if(o)for(var n of o(t))s.call(t,n)&&l(e,n,t[n]);return e},u=(e,t)=>a(e,r(t)),g=(e,t)=>{var n={};for(var a in e)i.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&o)for(var a of o(e))t.indexOf(a)<0&&s.call(e,a)&&(n[a]=e[a]);return n};function d(e,t){for(var n=0;n<t.length;n++){const a=t[n];if("string"!=typeof a&&!Array.isArray(a))for(const t in a)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(a,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function f(e){return Boolean(e&&"function"==typeof e.then)}function p(e,t){return f(e)?Promise.resolve(e).then(t):t(e)}function h(e,t,n){function a(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=n();return f(e)?e.catch(a):e}catch(e){a(e)}}function v(e){const t=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),n=t.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...t.slice(0,-2),n].join(", ")} option`}function m(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function y(e){return m(e)||[]}function b(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?y(t):y(null==t?void 0:t[e]);var n}function E(e){return Array.from(new Set(e))}function w(e){return e?e.replace(/\/+$/,""):e}const L=(e,t)=>fetch(e,t);const O=(e=L)=>(t,n)=>{let a=(r=null==n?void 0:n.headers,Object.fromEntries(new Headers(r).entries()));var r;return a["x-api-key"]&&(a=Object.assign({"x-tolgee-sdk-type":"JS","x-tolgee-sdk-version":"5.31.2"},a)),e(t,Object.assign(Object.assign({},n),{headers:a}))};function A(e){let t=[];return Object.freeze({listen(e){const n=t=>{e(t)};return t.push(n),{unsubscribe(){t=t.filter((e=>n!==e))}}},emit(n){e()&&t.forEach((e=>e({value:n})))}})}function T(e,t,n){const a=new Set,r=new Set;let o=[];function i(){if(0===o.length)return;const e=o;o=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));!function(e){const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))}(n?Array.from(n.keys()):void 0)}return Object.freeze({emit(t,n){e()&&(o.push(t),n?setTimeout(i,0):i())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(y(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class k extends Error{constructor(e,t,n=!1){const{language:a,namespace:r}=e;super(`Tolgee: Failed to fetch record for "${a}"${r&&` and "${r}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=r}}class N extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class j extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const R=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):R(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},x=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},P=({language:e,namespace:t})=>t?`${e}:${t}`:e;function C(e,t,n,a,r,o,i){const s=new Map,l=new Map;let c={},u=0;function g(t,n,a){const r=P(t);l.set(r,{data:R(n),version:a}),e.onCacheChange.emit(t)}async function d(a,r){let o;if(r)try{o=await n(a)}catch(t){const n=new k(a,t,!0);e.onError.emit(n),console.warn(n)}return o||(o=await async function(n){function a(t){const a=new k(n,t);throw e.onError.emit(a),console.error(a),a}const r=t(n);if(f(r)){const e=await r.catch(a);if(void 0!==e)return e}const o=c[P(n)];if("function"!=typeof o)return o;try{return await o()}catch(e){a(e)}}(a)),o}const p=Object.freeze({addStaticData(e){e&&(c=Object.assign(Object.assign({},c),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=x(e),a=l.get(e);a&&0!==a.version||g(n,t,0)}})))},invalidate(){s.clear(),u+=1},addRecord(e,t){g(e,t,u)},exists(e,t=!1){const n=l.get(P(e));return n&&t?n.version===u:Boolean(n)},getRecord(e){var t;return null===(t=l.get(P(a(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=l.get(P(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(P({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return E(e)},getTranslationFallback(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(P({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var r;const o=null===(r=l.get(P(t)))||void 0===r?void 0:r.data;null==o||o.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return s.size>0;const t=y(e);return Boolean(Array.from(s.keys()).find((e=>t.includes(x(e).namespace))))},isLoading(e,t){const n=y(t);return Boolean(r()||Array.from(s.keys()).find((t=>{const a=x(t);return(!n.length||n.includes(a.namespace))&&!p.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,t){const n=e.map((e=>{const n=a(e),r=P(n),o=s.get(r);if(o)return{new:!1,promise:o,keyObject:n,cacheKey:r};const i=d(n,t)||Promise.resolve(void 0);return s.set(r,i),{new:!0,promise:i,keyObject:n,cacheKey:r}}));o.notify(),i.notify();const r=await Promise.all(n.map((e=>e.promise)));return n.forEach(((e,t)=>{const n=s.get(e.cacheKey)!==e.promise;if(e.new&&!n){s.delete(e.cacheKey);const n=r[t];n?p.addRecord(e.keyObject,n):p.getRecord(e.keyObject)||p.addRecord(e.keyObject,{})}})),o.notify(),i.notify(),n.map((e=>p.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(l.entries()).map((([e,t])=>Object.assign(Object.assign({},x(e)),{data:t.data})))});return p}function S(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const D="invalid",F={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:D,apiUrl:"https://app.tolgee.io",fetch:O(),onTranslationMissing:({key:e})=>e},I=(...e)=>{let t={};return e.forEach((e=>{t=Object.assign(Object.assign(Object.assign({},t),e),{observerOptions:Object.assign(Object.assign({},t.observerOptions),null==e?void 0:e.observerOptions)})})),t};function _(e,t){const n=I(F,null==t?void 0:t.initialOptions,e);return n.apiUrl=w(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=O(e.fetch)),{initialOptions:n,activeNamespaces:(null==t?void 0:t.activeNamespaces)||new Map,language:null==t?void 0:t.language,pendingLanguage:null==t?void 0:t.language,isInitialLoading:!1,isRunning:!1}}function U(e,t,n,a,r,o,i,s){const l={ui:void 0},c={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,target:t})=>{var n;const i=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:a(t),namespace:r({key:e,ns:t})[0],translation:o({key:e,ns:t})})));null===(n=c.ui)||void 0===n||n.handleElementClick(i,t)},g=(e,t)=>{var n;return(null===(n=c.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function d(e){const t=o({key:e.key,ns:e.ns});return k.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function f(){return{fetch:t().fetch}}function v(e){c.observer=null==e?void 0:e()}function m(){return Boolean(c.observer)}function y(e){e&&c.formatters.push(e)}function b(e){c.finalFormatter=e}function E(e){l.ui=e}function w(){return Boolean(l.ui)}function L(e){c.languageStorage=e}function O(e){c.languageDetector=e}function A(e){e&&c.backends.push(e)}function T(e){c.devBackend=e}const k=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:b,addFormatter:y,setObserver:v,hasObserver:m,setUi:E,hasUi:w,setDevBackend:T,addBackend:A,setLanguageDetector:O,setLanguageStorage:L}))},findPositions:g,run(){var e,n;const{apiKey:a,apiUrl:r,projectId:o,observerOptions:f,tagNewKeys:p}=t();c.ui=null===(e=l.ui)||void 0===e?void 0:e.call(l,{apiKey:a,apiUrl:r,projectId:o,highlight:k.highlight,changeTranslation:i,findPositions:g,onPermanentChange:e=>s.onPermanentChange.emit(e),tagNewKeys:p}),null===(n=c.observer)||void 0===n||n.run({mouseHighlight:!0,options:f,translate:d,onClick:u})},stop(){var e;c.ui=void 0,null===(e=c.observer)||void 0===e||e.stop()},getLanguageStorage:()=>c.languageStorage,getInitialLanguage(){const e=n();return p(h(s.onError,(e=>new j("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=c.languageStorage)||void 0===e?void 0:e.getLanguage(f())})),(t=>e&&!e.includes(t)||!t?function(){if(!c.languageDetector)return;const e=n();return h(s.onError,(e=>new N("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=c.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},f()))}))}():t))},setStoredLanguage:e=>h(s.onError,(e=>new j("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=c.languageStorage)||void 0===t?void 0:t.setLanguage(e,f())})),getDevBackend:()=>c.devBackend,getBackendRecord:async({language:e,namespace:t})=>{for(const n of c.backends){const a=await n.getRecord(Object.assign({language:e,namespace:t},f()));if(void 0!==a)return a}},getBackendDevRecord:async({language:e,namespace:n})=>{var a;const{apiKey:r,apiUrl:o,projectId:i}=t();return null===(a=c.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:n},f()))},getLanguageDetector:()=>c.languageDetector,retranslate(){var e;null===(e=c.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=c.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return c.observer?null===(t=c.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return c.observer?null===(t=c.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(k.getDevBackend()),formatTranslation(n){var a,{formatEnabled:r}=n,o=S(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:u,params:g,ns:d,orEmpty:f}=o,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(o));let v=null!=p?p:f?"":h;const m=e(),y=r||!(null===(a=c.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>c.observer&&!u?c.observer.wrap({key:i,translation:e,defaultValue:l,params:g,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of c.formatters)v=e.format({translation:v,language:m,params:g});c.finalFormatter&&p&&m&&y&&(v=c.finalFormatter.format({translation:v,language:m,params:g}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||D,a=t().onFormatError,r=typeof a;v="string"===r?a:"function"===r?a(n,o):D,v=b(v)}var E;return v}});return k}const $=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const M=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:r,language:o}=e,i=S(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:o};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function B({options:e}){const t=function(e,t){let n=!0;function a(){return n}const r=Object.freeze({onPendingLanguageChange:A(a),onLanguageChange:A(a),onLoadingChange:A(a),onFetchingChange:A(a),onInitialLoaded:A(a),onRunningChange:A(a),onCacheChange:A(a),onUpdate:T(a,e,t),onPermanentChange:A(a),onError:A(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return r.onPendingLanguageChange.listen(t);case"language":return r.onLanguageChange.listen(t);case"loading":return r.onLoadingChange.listen(t);case"fetching":return r.onFetchingChange.listen(t);case"initialLoad":return r.onInitialLoaded.listen(t);case"running":return r.onRunningChange.listen(t);case"cache":return r.onCacheChange.listen(t);case"update":return r.onUpdate.listen(t);case"permanentChange":return r.onPermanentChange.listen(t);case"error":return r.onError.listen(t)}}});return r.onInitialLoaded.listen((()=>r.onUpdate.emit())),r.onLanguageChange.listen((()=>r.onUpdate.emit())),r.onCacheChange.listen((({value:e})=>r.onUpdate.emit([e.namespace],!0))),r}(l,c),n=$(!1,(()=>i.isFetching()),t.onFetchingChange.emit),a=$(!1,(()=>j.isLoading()),t.onLoadingChange.emit),r=function(e,t,n){let a,r=_();const o=Object.freeze({init(e){r=_(e,r)},isRunning:()=>r.isRunning,setRunning(e){r.isRunning!==e&&(r.isRunning=e,n.emit(e))},isInitialLoading:()=>r.isInitialLoading,setInitialLoading(e){r.isInitialLoading=e},getLanguage:()=>r.language||r.initialOptions.language,setLanguage(t){r.language!==t&&(r.language=t,e.emit(t))},getPendingLanguage:()=>r.pendingLanguage||o.getLanguage(),setPendingLanguage(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},r.initialOptions),a),addActiveNs(e){y(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t?r.activeNamespaces.set(e,t+1):r.activeNamespaces.set(e,1)}))},removeActiveNs(e){y(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t&&t>1?r.activeNamespaces.set(e,t-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>E([...r.initialOptions.ns||[r.initialOptions.defaultNs],...y(r.initialOptions.fallbackNs),...r.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||o.getLanguage();return t?E([t,...b(t,r.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>y(r.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?r.initialOptions.defaultNs:e,getAvailableLanguages(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>x(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?o.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:w(e.apiUrl)}):void 0}});return o}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),o=U(r.getLanguage,r.getInitialOptions,r.getAvailableLanguages,u,O,k,d,t),i=C(t,o.getBackendRecord,o.getBackendDevRecord,r.withDefaultNs,r.isInitialLoading,n,a);let s;function l(){return r.getFallbackNs()}function c(e){return r.getDefaultNs(e)}function u(e){return[...y(c(e)),...l()]}function g(e){return[...y(null!=e?e:c()),...r.getRequiredNamespaces()]}function d(e,t,n){const a=r.withDefaultNs(e),o=i.getTranslation(a,t);return i.changeTranslation(a,t,n),{revert(){i.changeTranslation(a,t,o)}}}function h(e){r.init(e),i.addStaticData(r.getInitialOptions().staticData)}function m(e,t){const n=r.getFallbackLangs(e),a=g(t),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}function L(e,t){const n=m(e,t);if(n.length)return p(j.loadRecords(n),(()=>{}))}function O({key:e,ns:t}){const n=r.getFallbackLangs(),a=u(null!=t?t:void 0);return i.getTranslationNs(a,n,e)}function k({key:e,ns:t,language:n}){const a=u(null!=t?t:void 0),o=r.getFallbackLangs(n);return i.getTranslationFallback(a,o,e)}function N(){const e=p(function(){if(r.getLanguage())return;return p(o.getInitialLanguage(),(e=>{const t=e||r.getInitialOptions().defaultLanguage;t&&r.setLanguage(t)}))}(),(()=>L()));if(f(e))return r.setInitialLoading(!0),n.notify(),a.notify(),Promise.resolve(e).then((()=>{r.setInitialLoading(!1),n.notify(),a.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&h(e),t.onUpdate.listen((()=>{r.isRunning()&&o.retranslate()}));const j=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),o),i),{init:h,getTranslation:k,changeTranslation:d,getTranslationNs:O,getDefaultAndFallbackNs:u,findPositions:o.findPositions,getRequiredRecords:m,async changeLanguage(e){r.getPendingLanguage()===e&&r.getLanguage()===e||(r.setPendingLanguage(e),r.isRunning()&&await L(e),e===r.getPendingLanguage()&&(r.setLanguage(e),await o.setStoredLanguage(e)))},async addActiveNs(e,t){t||r.addActiveNs(e),r.isRunning()&&await L(void 0,e)},loadRecords:e=>i.loadRecords(e,j.isDev()),loadRecord:async e=>(await j.loadRecords([e]))[0],isLoading:e=>i.isLoading(r.getLanguage(),e),isLoaded(e){const t=r.getLanguage();if(!t)return!1;const n=r.getFallbackLangs(t),a=g(e),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=M(...e),n=k(t);return o.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(r.getInitialOptions().apiKey&&r.getInitialOptions().apiUrl),run:()=>(function(){if((o.getLanguageDetector()||o.getLanguageStorage())&&!r.getAvailableLanguages())throw new Error(v("availableLanguages"));if(!r.getLanguage()&&!r.getInitialOptions().defaultLanguage)throw new Error(v(["defaultLanguage","language"]))}(),r.isRunning()||(r.setRunning(!0),o.run(),s=N()),Promise.resolve(s)),stop(){r.isRunning()&&(o.stop(),r.setRunning(!1))}}));return j}const K=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=I(e.options,n),t),init(t){const n=function(e){const t=B({options:e});function n(e){const n=t.isRunning();n&&t.stop(),e(),t.isDev()&&t.invalidate(),n&&t.run()}t.isDev()&&t.invalidate();const a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmitterActive:t.setEmitterActive,getLanguage:t.getLanguage,getPendingLanguage:t.getPendingLanguage,changeLanguage:t.changeLanguage,changeTranslation:t.changeTranslation,addActiveNs:t.addActiveNs,removeActiveNs:t.removeActiveNs,loadRecords:t.loadRecords,loadRecord:t.loadRecord,addStaticData:t.addStaticData,getRecord:t.getRecord,getAllRecords:t.getAllRecords,isLoaded:t.isLoaded,getRequiredRecords:t.getRequiredRecords,isInitialLoading:t.isInitialLoading,isLoading:t.isLoading,isFetching:t.isFetching,isRunning:t.isRunning,run:t.run,stop:t.stop,t:t.t,highlight:t.highlight,findPositions:t.findPositions,getInitialOptions:t.getInitialOptions,isDev:t.isDev,wrap:t.wrap,unwrap:t.unwrap,overrideCredentials(e){n((()=>t.overrideCredentials(e)))},addPlugin(e){e&&n((()=>t.addPlugin(a,e)))},updateOptions(e){e&&n((()=>t.init(e)))}});return a}(I(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},V=0,z=1,W=2;class G extends Error{constructor(e,t,n){let a;a=e===V?"Empty parameter":e===z?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function Y(e){return/\s/.test(e)}const H=0,X=1,q=2,J=3,Z=4,Q=new Set([q,X,H]),ee="'",te=new Set(["{","}",ee]),ne=e=>/[0-9a-zA-Z_]/.test(e);function ae(e,t){const[n,a]=function(e){let t=H,n="",a="",r="";const o=[],i=[];let s=0;function l(t){throw new G(t,s,e)}const c=()=>{o.push(n),n=""},u=()=>{""===a&&l(V),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case H:r===ee?(n+=r,t=X):"{"===r?(c(),t=J):(n+=r,t=H);break;case X:te.has(r)?(n=n.slice(0,-1)+r,t=q):(n+=r,t=H);break;case q:r===ee?t=H:(n+=r,t=q);break;case J:"}"===r?(u(),t=H):Y(r)?""!==a&&(u(),t=Z):(ne(r)||l(z),a+=r,t=J);break;case Z:"}"==r?t=H:Y(r)?t=Z:l(z)}return Q.has(t)||l(W),c(),[o,i]}(e),r=[n[0]];for(let o=1;o<n.length;o++){const i=null==t?void 0:t[a[o-1]];if(void 0===i)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);r.push(String(i)),r.push(n[o])}return r.join("")}const re="__tolgee_dev_tools",oe="data-tolgee-key-only",ie="data-tolgee-restricted",se="_tolgee",le="_tolgee-highlighter";function ce(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function ue(e){if(ce())throw new Error(`${e}: Can't run on the server`)}function ge(e,t){return{oldTextContent:e,keys:t}}function de(e){return e.textContent}function fe(e,t){e.textContent=t}function pe(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,r=void 0===e.ns||void 0===t.ns||-1!==(null==(n=e.ns)?void 0:n.findIndex((e=>{var n;return null==(n=t.ns)?void 0:n.includes(e)})));return a&&r}const he={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function ve({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;const r=function(e){for(;e;){if(null!==e.getAttribute("disabled"))return!1;e=e.parentElement}return!0}(n);let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(le),Object.entries(he).forEach((([e,t])=>{o.style[e]=t})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const i=n.getBoundingClientRect();o.style.pointerEvents=r?"none":"auto",o.style.borderWidth=t+"px",o.style.top=i.top-t+"px",o.style.left=i.left-t+"px",o.style.width=i.width+"px",o.style.height=i.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null==(e=t.highlightEl)||e.remove(),t.highlightEl=void 0}}(0,a)}})}const me={capture:!0},ye={capture:!0,passive:!0},be=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function Ee({highlightKeys:e,elementStore:t,onClick:n,options:a}){var r,o;const i=new Set;let s,l,c=[];const u=(null==(r=a.targetElement)?void 0:r.getRootNode())||document,g=(null==(o=a.targetElement)?void 0:o.ownerDocument)||document;function d(){var e;const n=t.get(s);n&&(n.preventClean=!1,null==(e=n.unhighlight)||e.call(n),s=void 0)}function f(){const e=l;let n;if(e&&A()){n=function(e){for(const n of e){const e=O(n,(e=>t.get(e)));if(void 0!==e)return e||void 0}}(u.elementsFromPoint(e.x,e.y)||[])}!function(e){var n;if(s!==e){d();const a=t.get(e);a&&(a.preventClean=!0,null==(n=a.highlight)||n.call(a),s=e)}}(n)}function p(e){l=e,f()}function h(e){for(const[t,n]of be.entries())i.has(t)&&!e[n]?i.delete(t):!i.has(t)&&e[n]&&i.add(t)}function v(e){var t;h(e),A()&&(t=e.target,!Boolean(O(t,(e=>e.id===re))))&&(e.stopPropagation(),e.preventDefault())}function m(e){h(e),p({x:e.clientX,y:e.clientY})}function y(e){h(e),f()}function b(e){h(e),f()}function E(){var e;const n=t.get(s);null==(e=null==n?void 0:n.highlight)||e.call(n)}function w(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),A()&&s&&(n(s),d())}function L(e,t,n){g.addEventListener(e,t,n),c.push([e,t,n])}function O(e,t){return e.id===re?null:t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function A(){for(const t of e)if(!i.has(t))return!1;return!0}return Object.freeze({stop(){!function(){for(const e of c)g.removeEventListener(...e);c=[]}()},run(){L("keydown",y,me),L("keyup",b,me),L("mousemove",m,ye),L("scroll",E,ye),L("click",w,me),L("mouseenter",v,me),L("mouseover",v,me),L("mouseout",v,me),L("mouseleave",v,me),L("mousedown",v,me),L("mouseup",v,me)}})}function we(e,t,n){const a=ve({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),r=Ee({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:s(a)})},options:e});function o(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${ie}]`)}function i(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(se),t.remove(e)}function s(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({isRestricted:o,register(e,n,r){if(o(e))return;const i=e;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(se,"true")),s.nodes.set(n,r),a.initHighlighter(i,s)},forEachElement:t.forEachElement,cleanupLingeringKeyAttributes(){t.forEachElement(((e,t)=>{if(!t.preventClean){for(const[e]of t.nodes)if(e.nodeType===Node.ATTRIBUTE_NODE){const n=e;n.name===oe&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&i(e,t)}}))},cleanupRemovedNodes(e){t.forEachElement(((t,n)=>{n.preventClean||(e.has(t)||function(e,t){for(const[n]of e.nodes)t.has(n)&&e.nodes.delete(n)}(n,e),(e.has(t)||0===n.nodes.size)&&i(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>pe({key:e,ns:m(n)},{key:t.key,ns:m(t.ns)})))){a.push(r);break}}})),a},run(e){e&&r.run()},stop(){r.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function Le(){let e,t=!1;const n=function(){const e=new Map;return Object.freeze({set(t,n){e.set(t,n)},get:t=>t&&e.get(t),remove:t=>e.delete(t),forEachElement(t){e.forEach(((e,n)=>t(n,e)))}})}();function a({mouseHighlight:e,options:a,wrapper:r,onClick:o}){if(ce())return{stop(){t=!1},wrapper:r};const i=function(e){const t=Object.freeze({getSuitableParent(n){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===a)throw console.error(n),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const t=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(t))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?t.getSuitableParent(a):a}});return t}(a),s=function(e,t){const n=Object.freeze({handleAttributes(n,a=!0){var r,o;const i=[],s=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=null!=(r=s[e.tagName.toUpperCase()])?r:[];"*"in s&&(a=a.concat(s["*"])),i.push(...a.filter((t=>e.hasAttribute(t))).map((t=>e.getAttributeNode(t))).filter((e=>t.testAttribute(e))))}if(a){const e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,(e=>{var t,n;return(null==(t=s[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=s["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=null!=(o=s[n.tagName.toUpperCase()])?o:[];"*"in s&&(a=a.concat(s["*"])),i.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return i},handleChildList(e){const t=[];return t.push(...e.flatMap((e=>n.handleAttributes(e,!0)))),t.push(...e.flatMap((e=>n.handleText(e)))),t},handleText(e){if(e.nodeType===Node.TEXT_NODE)return t.testTextNode(e)?[e]:[];const n=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>t.testTextNode(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;a.nextNode();)n.push(a.currentNode);return n}});return n}(a,r),l=we(a,n,o);function c(e){for(const t of e){const e=t.parentElement;if(e&&l.isRestricted(e))continue;const n=de(t),a=n?r.unwrap(n):null;if(a){const{text:e,keys:r}=a;fe(t,e);const o=ge(n,r),s=i.getSuitableParent(t);l.register(s,t,o)}}}function u(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:de(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===oe)return void u(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(oe);t&&u(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(oe)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){u(n.currentNode.getAttributeNode(oe))}}const d=new MutationObserver((e=>{if(!t)return;const n=e.filter((e=>"childList"===e.type)).flatMap((e=>Array.from(e.removedNodes))),a=new Set(n);for(const e of n){if(e.nodeType===Node.ELEMENT_NODE)for(let t=0;t<e.attributes.length;t++)a.add(e.attributes[t]);const t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;t.nextNode();){const e=t.currentNode;if(e.nodeType===Node.ELEMENT_NODE){const t=e;for(let e=0;e<t.attributes.length;e++)a.add(t.attributes[e])}a.add(e)}}a.size>0&&l.cleanupRemovedNodes(a),e.some((e=>"attributes"===e.type&&e.attributeName===oe))&&l.cleanupLingeringKeyAttributes();const r=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>r.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>r.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>r.delete(e)));break;case"attributes":t.attributeName===oe&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>r.add(e)))}c([...r])})),f=a.targetElement||document;t=!0,l.run(e),g(f,!0),c(s.handleChildList([f]));const p=new Set;return p.add(oe),Object.values(a.tagAttributes).forEach((e=>e.forEach((e=>p.add(e.toLowerCase()))))),d.observe(f,{attributes:!0,attributeFilter:[...p],childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,l.stop(),d.disconnect()},elementRegistry:l,wrapper:r}}return Object.freeze({run(t){e=a(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null==(a=null==(n=null==e?void 0:e.elementRegistry)?void 0:n.forEachElement)||a.call(n,t)},highlight(t,n){var a;const r=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return r.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){r.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const r=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],o=[];return r.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),r.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{pe({key:t,ns:m(n)},{key:e.key,ns:m(e.ns)})&&o.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),o},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var Oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ae={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),r=[],o=0;;){var i=t<e.length;if(!i||o>=n-1){var s=a.subarray(0,o);if(r.push(String.fromCharCode.apply(null,s)),!i)return r.join("");e=e.subarray(t),t=0,o=0}var l=e[t++];if(0==(128&l))a[o++]=l;else if(192==(224&l)){var c=63&e[t++];a[o++]=(31&l)<<6|c}else if(224==(240&l)){c=63&e[t++];var u=63&e[t++];a[o++]=(31&l)<<12|c<<6|u}else if(240==(248&l)){var g=(7&l)<<18|(c=63&e[t++])<<12|(u=63&e[t++])<<6|63&e[t++];g>65535&&(g-=65536,a[o++]=g>>>10&1023|55296,g=56320|1023&g),a[o++]=g}}}var n="Failed to ",a=function(e,t,a){if(e)throw new Error("".concat(n).concat(t,": the '").concat(a,"' option is unsupported."))},r="function"==typeof Buffer&&Buffer.from,o=r?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,r=Math.max(32,n+(n>>>1)+7),o=new Uint8Array(r>>>3<<3);t<n;){var i=e.charCodeAt(t++);if(i>=55296&&i<=56319){if(t<n){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,i=((1023&i)<<10)+(1023&s)+65536)}if(i>=55296&&i<=56319)continue}if(a+4>o.length){r+=8,r=(r*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(r);l.set(o),o=l}if(0!=(4294967168&i)){if(0==(4294965248&i))o[a++]=i>>>6&31|192;else if(0==(4294901760&i))o[a++]=i>>>12&15|224,o[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;o[a++]=i>>>18&7|240,o[a++]=i>>>12&63|128,o[a++]=i>>>6&63|128}o[a++]=63&i|128}else o[a++]=i}return o.slice?o.slice(0,a):o.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),o(e)};var s=!r&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],c=t;r?c=function(e,t){return(e instanceof Buffer?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)).toString(t)}:s&&(c=function(e){try{return function(e){var t;try{var n=new Blob([e],{type:"text/plain;charset=UTF-8"});t=URL.createObjectURL(n);var a=new XMLHttpRequest;return a.open("GET",t,!1),a.send(),a.responseText}finally{t&&URL.revokeObjectURL(t)}}(e)}catch(n){return t(e)}});var u="construct 'TextDecoder'",g="".concat(n," ").concat(u,": the ");function d(e,t){if(a(t&&t.fatal,u,"fatal"),e=e||"utf-8",!(r?Buffer.isEncoding(e):-1!==l.indexOf(e.toLowerCase())))throw new RangeError("".concat(g," encoding label provided ('").concat(e,"') is invalid."));this.encoding=e,this.fatal=!1,this.ignoreBOM=!1}d.prototype.decode=function(e,t){var n;return a(t&&t.stream,"decode","stream"),n=e instanceof Uint8Array?e:e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer):new Uint8Array(e),c(n,this.encoding)},e.TextEncoder=e.TextEncoder||i,e.TextDecoder=e.TextDecoder||d}("undefined"!=typeof window?window:Oe);const Te=d({__proto__:null,default:Ae},[Ae]);null==(t=console.assert)||t.call(console,Te);const ke=["",""],Ne=RegExp(`([${ke.join("")}]{9})+`,"gu");function je(e){const t=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),n=t.map((e=>function(e){const t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0")).join("");return Array.from(n).map((e=>ke[Number(e)])).join("")}function Re(e){const t=Array.from(e).map((e=>ke.indexOf(e))).map(String).join("").match(/(.{9})/g),n=Uint8Array.from((null==t?void 0:t.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=n,(new TextDecoder).decode(new Uint8Array(a));var a}function xe({fullKeyEncode:e}){const t=function(){const e=[];return Object.freeze({valueToNumber(t){let n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:t=>e[t]})}();function n(e){const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)}function a(e){return je(e+"\n")}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(Ne))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(Re))||[]}(e);a.forEach((e=>{const a=function(e){return e.split("\n").filter((e=>e.length)).map((e=>{if("{"===e[0])return e;{const n=Number(e);return t.numberToValue(n)}}))}(e);a.forEach((e=>{const t=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(e);if(t){const{k:e,d:a,n:r}=t;n.push({key:e,defaultValue:a,ns:r})}}))}));const r=function(e){return e.replace(Ne,"")}(e);return{text:r,keys:n}},wrap({key:r,defaultValue:o,translation:i,ns:s}){let l;if(e){l=a(n({key:r,ns:s}))}else{const e=n({key:r,ns:s,defaultValue:o}),i=t.valueToNumber(e);l=a(String(i))}const c=i||"";return"string"==typeof c?c+l:c},testTextNode(e){var t,n,a;return null!=(a=(null==(t=e.textContent)?void 0:t.includes(`${ke[0]}${ke[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${ke[1]}${ke[0]}`)))&&a},testAttribute:e=>e.value.includes(`${ke[0]}${ke[0]}`)||e.value.includes(`${ke[1]}${ke[0]}`)})}function Pe(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function Ce({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:r,ns:o}=function(e){let t=!1,n="",a="",r="KEY";const o={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{o.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==r||","!==s?"KEY"!==r||"|"!==s?"NAMESPACE"!==r||","!==s?"KEY"!==r||":"!==s?"DEFAULT_VALUE"!==r||":"!==s?"PARAM_NAME"!==r||":"!==s?"PARAM_VALUE"!==r||","!==s?n+=s:(r="PARAM_NAME",o.params[a]=n,n=""):(r="PARAM_VALUE",a=n,n=""):(r="PARAM_NAME",o.defaultValue=n,n=""):(r="PARAM_NAME",o.key=n,n=""):(r="DEFAULT_VALUE",i(n),n=""):(r="NAMESPACE",o.key=n,n=""):(r="DEFAULT_VALUE",o.key=n,n=""):t=!0;return"KEY"===r&&(o.key=n),"DEFAULT_VALUE"===r&&(o.defaultValue=n),"PARAM_VALUE"===r&&(o.params[a]=n),"NAMESPACE"===r&&i(n),o}(e);return{translated:n({key:t,params:a,defaultValue:r,ns:o,noWrap:!0}),key:t,params:a,defaultValue:r,ns:o}}function r(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function o(e){return"string"==typeof e?e.replace(new RegExp("[,:|\\\\]","gs"),"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:n,params:a,defaultValue:r,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${o(e)}:${o(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==r?`,${o(r)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>o(e))).join("|")}`:"";return`${e}${o(n)}${u}${l}${s}${t}`},unwrap(n){const o=new RegExp(`(\\\\?)(${r(e)}(.*?)${r(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=o.exec(n));){let e=s[1];const[t,r,o,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!Pe(d,n)){u+=o;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=n.substring(c),l?{text:u,keys:i}:{text:n,keys:[]}},testTextNode(n){var a,r,o;return null!=(o=(null==(a=n.textContent)?void 0:a.includes(e))&&(null==(r=n.textContent)?void 0:r.includes(t)))&&o},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const Se="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function De(e){const t=Se.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Fe(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,r=0;const o=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|De(e[i]),n+=5,n>=8&&(o[r++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",r=Math.pow(2,16)-1;for(let e=0;e<n;e+=r)e+r>n&&(r=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+r));return a}(o.buffer)}function Ie(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Fe(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}function _e({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:r=300}){let o=!1;const i=()=>new Promise(((a,o)=>{const i=function(e,t){const n=n=>{var a,r;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(r=n.data)?void 0:r.data)};return window.addEventListener("message",n,!1),{unsubscribe(){window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(s),l(),a(e)}));window.postMessage({type:e,data:n},window.origin);const s=setTimeout((function(){l(),o()}),r);function l(){i.unsubscribe()}}));return{cancel(){o=!0},promise:(async()=>{for(let e=0;e<a;e++){if(o)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!o)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let Ue=null;function $e(e){var t;return Ue||(Ue=(t=`https://cdn.jsdelivr.net/npm/@tolgee/web@${e}/dist/tolgee-in-context-tools.umd.min.js`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.head.appendChild(a)}))).then((()=>window["@tolgee/in-context-tools"].InContextTools))),Ue}const Me="__tolgee_apiKey",Be="__tolgee_apiUrl";function Ke(){const e=sessionStorage.getItem(Me)||void 0,t=sessionStorage.getItem(Be)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Ve(){sessionStorage.removeItem(Me),sessionStorage.removeItem(Be)}e.BrowserExtensionPlugin=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(e.BrowserExtensionPlugin=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=_e({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:t,attempts:4});return e=n,a}}}();e.on("running",(({value:n})=>{var a;n&&(a=()=>{t.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(Ve)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ke()&&(async()=>{const e=await $e("5.31.2");return t=>{const n=Ke();return t.addPlugin(e({credentials:n})),t}})().then((t=>{e.addPlugin(t)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const ze="__tolgee_currentLanguage";function We(e,t){const n=t.find((t=>t===e));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),r=a(window.navigator.language),o=t.find((e=>a(e)===r));return o||void 0}function Ge(e){return e.endsWith("/")?e.slice(0,-1):e}const Ye={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Ge(n)}/${e}/${t}.json`:`${Ge(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"},timeout:void 0,fallbackOnFail:!1};function He(e){const t=u(c(c({},Ye),e),{headers:c(c({},Ye.headers),null==e?void 0:e.headers)}),{prefix:n,getPath:a,getData:r,headers:o,timeout:i,fallbackOnFail:s}=t,l=g(t,["prefix","getPath","getData","headers","timeout","fallbackOnFail"]);return{async getRecord({namespace:e,language:t,fetch:u}){const d=a({namespace:e,language:t,prefix:n});try{const e=await((e,t,n,a)=>{var r=a,{signal:o}=r,i=g(r,["signal"]);const s=new AbortController;return new Promise(((a,r)=>{const l=e(t,c({signal:s.signal},i));let u=!1;function g(e){!u&&r(e),u=!0}function d(){const e=new Error(`TIMEOUT: ${t}`);s.abort(e),g(e)}if(o&&o.addEventListener("abort",d),void 0!==n){const e=setTimeout(d,n);l.finally((()=>clearTimeout(e)))}l.catch(g).then((function(e){!u&&a(e),u=!0}))}))})(u,d,i,c({headers:o},l));if(!e.ok)throw new Error(`${e.url} ${e.status}`);return await r(e)}catch(e){if(s)return;throw e}}}}e.BackendFetch=e=>(t,n)=>(n.addBackend(He(e)),t),e.DEVTOOLS_ID=re,e.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:r,fetch:o}){var i;const s=null!=(i=Ie(t))?i:r;let l=void 0!==s?`${e}/v2/projects/${s}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(l+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===r)throw new Error("You need to specify 'projectId' when using PAT key");return o(l,{headers:{"X-API-Key":t||"","Content-Type":"application/json"},next:{revalidate:0}}).then((e=>{if(e.ok)return e.json().then((e=>e[n]));throw new Error(e.statusText)}))}}),e),e.DevTools=()=>e=>e,e.FormatSimple=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>ae(e,t)}),e),e.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage:({availableLanguages:e})=>(ue("LanguageDetector"),We(window.navigator.language,e))}),e),e.LanguageDetectorError=N,e.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(ue("LanguageStorage"),localStorage.getItem(ze)||void 0),setLanguage(e){ue("LanguageStorage"),localStorage.setItem(ze,e)}}),e),e.LanguageStorageError=j,e.ObserverPlugin=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=Le();return Object.freeze(u(c({},e),{run(t){const n=Ce({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run(u(c({},t),{wrapper:n}))},retranslate(){e.forEachElement(((t,n)=>{for(const[t,a]of n.nodes.entries()){if(a.keyAttributeOnly)return;const n=e.unwrap(a.oldTextContent);n&&fe(t,n.text)}}))},outputNotFormattable:!0}))})):t.setObserver((()=>{const e=Le();return Object.freeze(u(c({},e),{run(t){const n=xe({fullKeyEncode:t.options.fullKeyEncode});e.run(u(c({},t),{wrapper:n}))},retranslate(){},outputNotFormattable:!1}))})),e),e.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",e.RecordFetchError=k,e.TOLGEE_ATTRIBUTE_NAME=se,e.TOLGEE_RESTRICT_ATTRIBUTE=ie,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=oe,e.Tolgee=function(){return K().use(e.BrowserExtensionPlugin())},e.TolgeeCore=K,e.createFetchFunction=O,e.detectLanguage=We,e.detectLanguageFromHeaders=(e,t)=>{const n=function(e){const t=e.get("Accept-Language");if(!t)return[];const n=t.split(",").map((e=>{const[t]=e.trim().split(";");return t}));return[...new Set(n.filter((e=>e&&"*"!==e)))]}(e);return n[0]&&We(n[0],t)},e.getFallback=m,e.getFallbackArray=y,e.getProjectIdFromApiKey=Ie,e.getTranslateProps=M,e.isSSR=ce,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})})); | ||
//# sourceMappingURL=tolgee-web.production.umd.min.js.map |
{ | ||
"name": "@tolgee/web", | ||
"version": "5.31.1", | ||
"version": "5.31.2", | ||
"description": "Tolgee for web", | ||
@@ -48,3 +48,3 @@ "declaration": true, | ||
"dependencies": { | ||
"@tolgee/core": "5.31.1" | ||
"@tolgee/core": "5.31.2" | ||
}, | ||
@@ -100,3 +100,3 @@ "devDependencies": { | ||
"homepage": "https://github.com/tolgee/tolgee-js#readme", | ||
"gitHead": "c5bea0c25261c6d737d5eb06d4c4b836bdfcd645", | ||
"gitHead": "69a36c2e6d2b80f4877fadeaebc4380f27afa44d", | ||
"publishConfig": { | ||
@@ -103,0 +103,0 @@ "access": "public" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
+ Added@tolgee/core@5.31.2(transitive)
- Removed@tolgee/core@5.31.1(transitive)
Updated@tolgee/core@5.31.2