Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tolgee/web

Package Overview
Dependencies
Maintainers
2
Versions
229
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tolgee/web - npm Package Compare versions

Comparing version 5.23.0 to 5.23.1-prerelease.88c01ea6.0

2

dist/tolgee-web.production.esm.min.js

@@ -1,2 +0,2 @@

var e;function t(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 n(e){return Boolean(e&&"function"==typeof e.then)}function a(e,t){return n(e)?Promise.resolve(e).then(t):t(e)}function o(e,t,a){function o(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=a();return n(e)?e.catch(o):e}catch(e){o(e)}}function r(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 i(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function s(e){return i(e)||[]}function l(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?s(t):s(null==t?void 0:t[e]);var n}function c(e){return Array.from(new Set(e))}function u(e){return e?e.replace(/\/+$/,""):e}const g=(e,t)=>fetch(e,t),d=(e=g)=>(t,n)=>e(t,Object.assign(Object.assign({},n),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.23.0"},null==n?void 0:n.headers)}));function f(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 p(e,t,n){const a=new Set,o=new Set;let r=[];function i(){if(0===r.length)return;const e=r;r=[],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());o.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()&&(r.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};o.add(t);const a={unsubscribe:()=>{o.delete(t)},subscribeNs:e=>(s(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class h extends Error{constructor(e,t,n=!1){const{language:a,namespace:o}=e;super(`Tolgee: Failed to fetch record for "${a}"${o&&` and "${o}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=o}}class v extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class m extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const y=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):y(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},b=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},E=({language:e,namespace:t})=>t?`${e}:${t}`:e;function L(e,t,a,o,r,i,l){const u=new Map,g=new Map;let d={},f=0;function p(t,n,a){const o=E(t);g.set(o,{data:y(n),version:a}),e.onCacheChange.emit(t)}function v(a){let o;if(!o){const e=d[E(a)];"function"==typeof e&&(o=e())}return o||(o=t(a)),n(o)?null==o?void 0:o.catch((t=>{const n=new h(a,t);throw e.onError.emit(n),console.error(n),n})):o}const m=Object.freeze({addStaticData(e){e&&(d=Object.assign(Object.assign({},d),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=b(e),a=g.get(e);a&&0!==a.version||p(n,t,0)}})))},invalidate(){u.clear(),f+=1},addRecord(e,t){p(e,t,f)},exists(e,t=!1){const n=g.get(E(e));return n&&t?n.version===f:Boolean(n)},getRecord(e){var t;return null===(t=g.get(E(o(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=g.get(E(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(E({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[o]}return c(e)},getTranslationFallback(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(E({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var o;const r=null===(o=g.get(E(t)))||void 0===o?void 0:o.data;null==r||r.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return u.size>0;const t=s(e);return Boolean(Array.from(u.keys()).find((e=>t.includes(b(e).namespace))))},isLoading(e,t){const n=s(t);return Boolean(r()||Array.from(u.keys()).find((t=>{const a=b(t);return(!n.length||n.includes(a.namespace))&&!m.exists({namespace:a.namespace,language:e})})))},async loadRecords(t,n){const r=t.map((t=>{const r=o(t),i=E(r),s=u.get(i);if(s)return{new:!1,promise:s,keyObject:r,cacheKey:i};const l=function(t,n){var o;let r;return n&&(r=null===(o=a(t))||void 0===o?void 0:o.catch((n=>{const a=new h(t,n,!0);return e.onError.emit(a),console.warn(a),v(t)}))),r||(r=v(t)),r}(r,n)||Promise.resolve(void 0);return u.set(i,l),{new:!0,promise:l,keyObject:r,cacheKey:i}}));i.notify(),l.notify();const s=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=u.get(e.cacheKey)!==e.promise;if(e.new&&!n){u.delete(e.cacheKey);const n=s[t];n?m.addRecord(e.keyObject,n):m.getRecord(e.keyObject)||m.addRecord(e.keyObject,{})}})),i.notify(),l.notify(),r.map((e=>m.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(g.entries()).map((([e,t])=>Object.assign(Object.assign({},b(e)),{data:t.data})))});return m}function w(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 o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n}const O="invalid",A={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:O,apiUrl:"https://app.tolgee.io",fetch:d(),onTranslationMissing:({key:e})=>e},k=(...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 N(e,t){const n=k(A,null==t?void 0:t.initialOptions,e);return n.apiUrl=u(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=d(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 T(e,t,n,r,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,target:t})=>{var n;const a=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:r(t),namespace:i({key:e,ns:t})[0],translation:s({key:e,ns:t})})));null===(n=g.ui)||void 0===n||n.handleElementClick(a,t)},f=(e,t)=>{var n;return(null===(n=g.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function p(e){const t=s({key:e.key,ns:e.ns});return x.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function h(){return{fetch:t().fetch}}function y(e){g.observer=null==e?void 0:e()}function b(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function L(e){g.finalFormatter=e}function A(e){u.ui=e}function k(){return Boolean(u.ui)}function N(e){g.languageStorage=e}function T(e){g.languageDetector=e}function j(e){e&&g.backends.push(e)}function C(e){g.devBackend=e}const x=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:L,addFormatter:E,setObserver:y,hasObserver:b,setUi:A,hasUi:k,setDevBackend:C,addBackend:j,setLanguageDetector:T,setLanguageStorage:N}))},findPositions:f,run(){var e,n;const{apiKey:a,apiUrl:o,projectId:r,observerOptions:i}=t();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:a,apiUrl:o,projectId:r,highlight:x.highlight,changeTranslation:l,findPositions:f,onPermanentChange:e=>c.onPermanentChange.emit(e)}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){const e=n();return a(o(c.onError,(e=>new m("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(h())})),(t=>e&&!e.includes(t)||!t?function(){if(!g.languageDetector)return;const e=n();return o(c.onError,(e=>new v("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=g.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},h()))}))}():t))},setStoredLanguage:e=>o(c.onError,(e=>new m("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=g.languageStorage)||void 0===t?void 0:t.setLanguage(e,h())})),getDevBackend:()=>g.devBackend,getBackendRecord:({language:e,namespace:t})=>{for(const n of g.backends){const a=n.getRecord(Object.assign({language:e,namespace:t},h()));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;const{apiKey:o,apiUrl:r,projectId:i}=t();return null===(a=g.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},h()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=g.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(x.getDevBackend()),formatTranslation(n){var a,{formatEnabled:o}=n,r=w(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(r));let v=null!=p?p:f?"":h;const m=e(),y=o||!(null===(a=g.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of g.formatters)v=e.format({translation:v,language:m,params:u});g.finalFormatter&&p&&m&&y&&(v=g.finalFormatter.format({translation:v,language:m,params:u}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||O,a=t().onFormatError,o=typeof a;v="string"===o?a:"function"===o?a(n,r):O,v=b(v)}var E;return v}});return x}const j=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const C=(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:o,language:r}=e,i=w(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function x({options:e}){const t=function(e,t){let n=!0;function a(){return n}const o=Object.freeze({onPendingLanguageChange:f(a),onLanguageChange:f(a),onLoadingChange:f(a),onFetchingChange:f(a),onInitialLoaded:f(a),onRunningChange:f(a),onCacheChange:f(a),onUpdate:p(a,e,t),onPermanentChange:f(a),onError:f(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(t);case"language":return o.onLanguageChange.listen(t);case"loading":return o.onLoadingChange.listen(t);case"fetching":return o.onFetchingChange.listen(t);case"initialLoad":return o.onInitialLoaded.listen(t);case"running":return o.onRunningChange.listen(t);case"cache":return o.onCacheChange.listen(t);case"update":return o.onUpdate.listen(t);case"permanentChange":return o.onPermanentChange.listen(t);case"error":return o.onError.listen(t)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(m,y),o=j(!1,(()=>h.isFetching()),t.onFetchingChange.emit),i=j(!1,(()=>S.isLoading()),t.onLoadingChange.emit),g=function(e,t,n){let a,o=N();const r=Object.freeze({init(e){o=N(e,o)},isRunning:()=>o.isRunning,setRunning(e){o.isRunning!==e&&(o.isRunning=e,n.emit(e))},isInitialLoading:()=>o.isInitialLoading,setInitialLoading(e){o.isInitialLoading=e},getLanguage:()=>o.language||o.initialOptions.language,setLanguage(t){o.language!==t&&(o.language=t,e.emit(t))},getPendingLanguage:()=>o.pendingLanguage||r.getLanguage(),setPendingLanguage(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},o.initialOptions),a),addActiveNs(e){s(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t?o.activeNamespaces.set(e,t+1):o.activeNamespaces.set(e,1)}))},removeActiveNs(e){s(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t&&t>1?o.activeNamespaces.set(e,t-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>c([...o.initialOptions.ns||[o.initialOptions.defaultNs],...s(o.initialOptions.fallbackNs),...o.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||r.getLanguage();return t?c([t,...l(t,o.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>s(o.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?o.initialOptions.defaultNs:e,getAvailableLanguages(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>b(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?r.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:u(e.apiUrl)}):void 0}});return r}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),d=T(g.getLanguage,g.getInitialOptions,g.getAvailableLanguages,E,x,R,O,t),h=L(t,d.getBackendRecord,d.getBackendDevRecord,g.withDefaultNs,g.isInitialLoading,o,i);let v;function m(){return g.getFallbackNs()}function y(e){return g.getDefaultNs(e)}function E(e){return[...s(y(e)),...m()]}function w(e){return[...s(null!=e?e:y()),...g.getRequiredNamespaces()]}function O(e,t,n){const a=g.withDefaultNs(e),o=h.getTranslation(a,t);return h.changeTranslation(a,t,n),{revert(){h.changeTranslation(a,t,o)}}}function A(e){g.init(e),h.addStaticData(g.getInitialOptions().staticData)}function k(e,t){const n=function(e,t){const n=g.getFallbackLangs(e),a=w(t),o=[];return n.forEach((e=>{a.forEach((t=>{h.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}(e,t);if(n.length)return a(S.loadRecords(n),(()=>{}))}function x({key:e,ns:t}){const n=g.getFallbackLangs(),a=E(null!=t?t:void 0);return h.getTranslationNs(a,n,e)}function R({key:e,ns:t,language:n}){const a=E(null!=t?t:void 0),o=g.getFallbackLangs(n);return h.getTranslationFallback(a,o,e)}function P(){const e=a(function(){if(g.getLanguage())return;return a(d.getInitialLanguage(),(e=>{const t=e||g.getInitialOptions().defaultLanguage;t&&g.setLanguage(t)}))}(),(()=>k()));if(n(e))return g.setInitialLoading(!0),o.notify(),i.notify(),Promise.resolve(e).then((()=>{g.setInitialLoading(!1),o.notify(),i.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&A(e),t.onUpdate.listen((()=>{g.isRunning()&&d.retranslate()}));const S=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),g),d),h),{init:A,getTranslation:R,changeTranslation:O,getTranslationNs:x,getDefaultAndFallbackNs:E,findPositions:d.findPositions,async changeLanguage(e){g.getPendingLanguage()===e&&g.getLanguage()===e||(g.setPendingLanguage(e),g.isRunning()&&await k(e),e===g.getPendingLanguage()&&(g.setLanguage(e),await d.setStoredLanguage(e)))},async addActiveNs(e,t){t||g.addActiveNs(e),g.isRunning()&&await k(void 0,e)},loadRecords:e=>h.loadRecords(e,S.isDev()),loadRecord:async e=>(await S.loadRecords([e]))[0],isLoading:e=>h.isLoading(g.getLanguage(),e),isLoaded(e){const t=g.getLanguage();if(!t)return!1;const n=g.getFallbackLangs(t),a=w(e),o=[];return n.forEach((e=>{a.forEach((t=>{h.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=C(...e),n=R(t);return d.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(g.getInitialOptions().apiKey&&g.getInitialOptions().apiUrl),run:()=>(function(){if((d.getLanguageDetector()||d.getLanguageStorage())&&!g.getAvailableLanguages())throw new Error(r("availableLanguages"));if(!g.getLanguage()&&!g.getInitialOptions().defaultLanguage)throw new Error(r(["defaultLanguage","language"]))}(),g.isRunning()||(g.setRunning(!0),d.run(),v=P()),Promise.resolve(v)),stop(){g.isRunning()&&(d.stop(),g.setRunning(!1))}}));return S}const R=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=k(e.options,n),t),init(t){const n=function(e){const t=x({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,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}(k(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},P=0,S=1,D=2;class I extends Error{constructor(e,t,n){let a;a=e===P?"Empty parameter":e===S?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function U(e){return/\s/.test(e)}const F=0,_=1,$=2,M=3,K=4,B=new Set([$,_,F]),V="'",z=new Set(["{","}",V]),W=e=>/[0-9a-zA-Z_]/.test(e);function Y(e,t){const[n,a]=function(e){let t=F,n="",a="",o="";const r=[],i=[];let s=0;function l(t){throw new I(t,s,e)}const c=()=>{r.push(n),n=""},u=()=>{""===a&&l(P),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],t){case F:o===V?(n+=o,t=_):"{"===o?(c(),t=M):(n+=o,t=F);break;case _:z.has(o)?(n=n.slice(0,-1)+o,t=$):(n+=o,t=F);break;case $:o===V?t=F:(n+=o,t=$);break;case M:"}"===o?(u(),t=F):U(o)?""!==a&&(u(),t=K):(W(o)||l(S),a+=o,t=M);break;case K:"}"==o?t=F:U(o)?t=K:l(S)}return B.has(t)||l(D),c(),[r,i]}(e),o=[n[0]];for(let r=1;r<n.length;r++){const i=null==t?void 0:t[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(n[r])}return o.join("")}const H=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>Y(e,t)}),e),X="__tolgee_dev_tools",G="__tolgee_preferredLanguages",J="data-tolgee-key-only",q="data-tolgee-restricted",Z="_tolgee",Q="_tolgee-highlighter";function ee(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function te(e){if(ee())throw new Error(`${e}: Can't run on the server`)}function ne(e,t){return{oldTextContent:e,keys:t}}const ae={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function oe({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(Q),Object.entries(ae).forEach((([e,t])=>{o.style[e]=t})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const r=n.getBoundingClientRect();o.style.borderWidth=t+"px",o.style.top=r.top-t+"px",o.style.left=r.left-t+"px",o.style.width=r.width+"px",o.style.height=r.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null==(e=t.highlightEl)||e.remove(),t.highlightEl=void 0}}(0,a)}})}function re(e){return e.textContent}function ie(e,t){e.textContent=t}function se(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,o=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&&o}const le={capture:!0},ce={capture:!0,passive:!0},ue=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function ge({highlightKeys:e,elementStore:t,onClick:n,options:a}){var o,r;const i=new Set;let s,l,c=[];const u=(null==(o=a.targetElement)?void 0:o.getRootNode())||document,g=(null==(r=a.targetElement)?void 0:r.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 ue.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===X))))&&(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 L(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),A()&&s&&(n(s),d())}function w(e,t,n){g.addEventListener(e,t,n),c.push([e,t,n])}function O(e,t){return e.id===X?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(){w("keydown",y,le),w("keyup",b,le),w("mousemove",m,ce),w("scroll",E,ce),w("click",L,le),w("mouseenter",v,le),w("mouseover",v,le),w("mouseout",v,le),w("mouseleave",v,le),w("mousedown",v,le),w("mouseup",v,le)}})}function de(e,t,n){const a=oe({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),o=ge({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:s(a)})},options:e});function r(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(Z),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({register(n,o,r){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${q}]`)}(n))return;const i=n;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(Z,"true")),s.nodes.set(o,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===J&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&r(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)&&r(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,o)=>{for(const t of o.nodes.values()){if(t.keys.find((t=>se({key:e,ns:i(n)},{key:t.key,ns:i(t.ns)})))){a.push(o);break}}})),a},run(e){e&&o.run()},stop(){o.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function fe(){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:o,onClick:r}){if(ee())return{stop(){t=!1},wrapper:o};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){const o=[],r=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=r[e.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.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=r[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=r["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=r[n.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return o},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,o),l=de(a,n,r);function c(e){for(const t of e){const e=re(t),n=e?o.unwrap(e):null;if(n){const{text:a,keys:o}=n;ie(t,a);const r=ne(e,o),s=i.getSuitableParent(t);l.register(s,t,r)}}}function u(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:re(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===J)return void u(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(J);t&&u(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(J)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){u(n.currentNode.getAttributeNode(J))}}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===J))&&l.cleanupLingeringKeyAttributes();const o=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>o.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>o.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>o.delete(e)));break;case"attributes":t.attributeName===J&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>o.add(e)))}c([...o])})),f=a.targetElement||document.body;t=!0,l.run(e),g(f,!0),c(s.handleChildList([f]));const p=new Set;return p.add(J),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:o}}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 o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return o.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){o.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],r=[];return o.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),o.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{se({key:t,ns:i(n)},{key:e.key,ns:i(e.ns)})&&r.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),r},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},he={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),o=[],r=0;;){var i=t<e.length;if(!i||r>=n-1){var s=a.subarray(0,r);if(o.push(String.fromCharCode.apply(null,s)),!i)return o.join("");e=e.subarray(t),t=0,r=0}var l=e[t++];if(0==(128&l))a[r++]=l;else if(192==(224&l)){var c=63&e[t++];a[r++]=(31&l)<<6|c}else if(224==(240&l)){c=63&e[t++];var u=63&e[t++];a[r++]=(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[r++]=g>>>10&1023|55296,g=56320|1023&g),a[r++]=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."))},o="function"==typeof Buffer&&Buffer.from,r=o?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,o=Math.max(32,n+(n>>>1)+7),r=new Uint8Array(o>>>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>r.length){o+=8,o=(o*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(o);l.set(r),r=l}if(0!=(4294967168&i)){if(0==(4294965248&i))r[a++]=i>>>6&31|192;else if(0==(4294901760&i))r[a++]=i>>>12&15|224,r[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;r[a++]=i>>>18&7|240,r[a++]=i>>>12&63|128,r[a++]=i>>>6&63|128}r[a++]=63&i|128}else r[a++]=i}return r.slice?r.slice(0,a):r.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),r(e)};var s=!o&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],c=t;o?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",!(o?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:pe);const ve=t({__proto__:null,default:he},[he]);null==(e=console.assert)||e.call(console,ve);const me=["‌","‍"],ye=RegExp(`([${me.join("")}]{9})+`,"gu");function be(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=>me[Number(e)])).join("")}function Ee(e){const t=Array.from(e).map((e=>me.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 Le({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)}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(ye))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(Ee))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[n]=function(e){const t=[];for(const n of e)t.push(n.codePointAt(0));return t}(e);return t.numberToValue(n)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:t,n:a}=o;n.push({key:e,defaultValue:t,ns:a})}}));const o=function(e){return e.replace(ye,"")}(e);return{text:o,keys:n}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=be(n({key:a,ns:i}))}else{const e=n({key:a,ns:i,defaultValue:o}),r=t.valueToNumber(e);s=be(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},testTextNode(e){var t,n;return((null==(t=e.textContent)?void 0:t.includes(`${me[0]}${me[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${me[1]}${me[0]}`)))??!1},testAttribute:e=>e.value.includes(`${me[0]}${me[0]}`)||e.value.includes(`${me[1]}${me[0]}`)})}function we(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function Oe({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:o,ns:r}=function(e){let t=!1,n="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==o||","!==s?"KEY"!==o||"|"!==s?"NAMESPACE"!==o||","!==s?"KEY"!==o||":"!==s?"DEFAULT_VALUE"!==o||":"!==s?"PARAM_NAME"!==o||":"!==s?"PARAM_VALUE"!==o||","!==s?n+=s:(o="PARAM_NAME",r.params[a]=n,n=""):(o="PARAM_VALUE",a=n,n=""):(o="PARAM_NAME",r.defaultValue=n,n=""):(o="PARAM_NAME",r.key=n,n=""):(o="DEFAULT_VALUE",i(n),n=""):(o="NAMESPACE",r.key=n,n=""):(o="DEFAULT_VALUE",r.key=n,n=""):t=!0;return"KEY"===o&&(r.key=n),"DEFAULT_VALUE"===o&&(r.defaultValue=n),"PARAM_VALUE"===o&&(r.params[a]=n),"NAMESPACE"===o&&i(n),r}(e);return{translated:n({key:t,params:a,defaultValue:o,ns:r,noWrap:!0}),key:t,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/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:o,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${r(e)}:${r(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(n)}${u}${l}${s}${t}`},unwrap(n){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(n));){let e=s[1];const[t,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!we(d,n)){u+=r;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,o;return((null==(a=n.textContent)?void 0:a.includes(e))&&(null==(o=n.textContent)?void 0:o.includes(t)))??!1},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const Ae=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=fe();return Object.freeze({...e,run(t){const n=Oe({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run({...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&&ie(t,n.text)}}))},outputNotFormattable:!0})})):t.setObserver((()=>{const e=fe();return Object.freeze({...e,run(t){const n=Le({fullKeyEncode:t.options.fullKeyEncode});e.run({...t,wrapper:n})},retranslate(){},outputNotFormattable:!1})})),e),ke="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Ne(e){const t=ke.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Te(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,o=0;const r=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|Ne(e[i]),n+=5,n>=8&&(r[o++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<n;e+=o)e+o>n&&(o=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+o));return a}(r.buffer)}function je(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Te(n).split("_");return Number(e)}}catch{console.warn("Tolgee: Api key can't be parsed")}}const Ce=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:o,fetch:r}){const i=je(t)??o;let s=void 0!==i?`${e}/v2/projects/${i}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(s+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(s,{headers:{"X-API-Key":t||"","Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>e[n]));throw new Error(e.statusText)}))}}),e);function xe({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:o=300}){let r=!1;const i=()=>new Promise(((a,r)=>{const i=function(e,t){const n=n=>{var a,o;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(o=n.data)?void 0:o.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(),r()}),o);function l(){i.unsubscribe()}}));return{cancel(){r=!0},promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let Re=null;function Pe(e){var t;return Re||(Re=(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))),Re}const Se="__tolgee_apiKey",De="__tolgee_apiUrl";function Ie(){const e=sessionStorage.getItem(Se)||void 0,t=sessionStorage.getItem(De)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Ue(){sessionStorage.removeItem(Se),sessionStorage.removeItem(De)}let Fe=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(Fe=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=xe({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(Ue)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ie()&&(async()=>{const e=await Pe("5.23.0");return t=>{const n=Ie();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 _e="__tolgee_currentLanguage";const $e=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(te("LanguageStorage"),localStorage.getItem(_e)||void 0),setLanguage(e){te("LanguageStorage"),localStorage.setItem(_e,e)}}),e);const Me=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){te("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e);function Ke(e){return e.endsWith("/")?e.slice(0,-1):e}const Be={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Ke(n)}/${e}/${t}.json`:`${Ke(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};const Ve=e=>(t,n)=>(n.addBackend(function(e){const{prefix:t,getPath:n,getData:a,headers:o,...r}={...Be,...e,headers:{...Be.headers,...null==e?void 0:e.headers}};return{getRecord:({namespace:e,language:i,fetch:s})=>s(n({namespace:e,language:i,prefix:t}),{headers:o,...r}).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return a(e)}))}}(e)),t);function ze(){return R().use(Fe())}const We=()=>e=>e;export{Ve as BackendFetch,Fe as BrowserExtensionPlugin,X as DEVTOOLS_ID,Ce as DevBackend,We as DevTools,H as FormatSimple,Me as LanguageDetector,v as LanguageDetectorError,$e as LanguageStorage,m as LanguageStorageError,Ae as ObserverPlugin,G as PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY,h as RecordFetchError,Z as TOLGEE_ATTRIBUTE_NAME,q as TOLGEE_RESTRICT_ATTRIBUTE,J as TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE,ze as Tolgee,R as TolgeeCore,d as createFetchFunction,i as getFallback,s as getFallbackArray,je as getProjectIdFromApiKey,C as getTranslateProps};
var e;function t(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 n(e){return Boolean(e&&"function"==typeof e.then)}function a(e,t){return n(e)?Promise.resolve(e).then(t):t(e)}function o(e,t,a){function o(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=a();return n(e)?e.catch(o):e}catch(e){o(e)}}function r(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 i(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function s(e){return i(e)||[]}function l(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?s(t):s(null==t?void 0:t[e]);var n}function c(e){return Array.from(new Set(e))}function u(e){return e?e.replace(/\/+$/,""):e}const g=(e,t)=>fetch(e,t),d=(e=g)=>(t,n)=>e(t,Object.assign(Object.assign({},n),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.23.1-prerelease.88c01ea6.0"},null==n?void 0:n.headers)}));function f(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 p(e,t,n){const a=new Set,o=new Set;let r=[];function i(){if(0===r.length)return;const e=r;r=[],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());o.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()&&(r.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};o.add(t);const a={unsubscribe:()=>{o.delete(t)},subscribeNs:e=>(s(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class h extends Error{constructor(e,t,n=!1){const{language:a,namespace:o}=e;super(`Tolgee: Failed to fetch record for "${a}"${o&&` and "${o}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=o}}class v extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class m extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const y=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):y(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},b=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},E=({language:e,namespace:t})=>t?`${e}:${t}`:e;function L(e,t,a,o,r,i,l){const u=new Map,g=new Map;let d={},f=0;function p(t,n,a){const o=E(t);g.set(o,{data:y(n),version:a}),e.onCacheChange.emit(t)}function v(a){let o;if(!o){const e=d[E(a)];"function"==typeof e&&(o=e())}return o||(o=t(a)),n(o)?null==o?void 0:o.catch((t=>{const n=new h(a,t);throw e.onError.emit(n),console.error(n),n})):o}const m=Object.freeze({addStaticData(e){e&&(d=Object.assign(Object.assign({},d),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=b(e),a=g.get(e);a&&0!==a.version||p(n,t,0)}})))},invalidate(){u.clear(),f+=1},addRecord(e,t){p(e,t,f)},exists(e,t=!1){const n=g.get(E(e));return n&&t?n.version===f:Boolean(n)},getRecord(e){var t;return null===(t=g.get(E(o(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=g.get(E(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(E({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[o]}return c(e)},getTranslationFallback(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(E({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var o;const r=null===(o=g.get(E(t)))||void 0===o?void 0:o.data;null==r||r.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return u.size>0;const t=s(e);return Boolean(Array.from(u.keys()).find((e=>t.includes(b(e).namespace))))},isLoading(e,t){const n=s(t);return Boolean(r()||Array.from(u.keys()).find((t=>{const a=b(t);return(!n.length||n.includes(a.namespace))&&!m.exists({namespace:a.namespace,language:e})})))},async loadRecords(t,n){const r=t.map((t=>{const r=o(t),i=E(r),s=u.get(i);if(s)return{new:!1,promise:s,keyObject:r,cacheKey:i};const l=function(t,n){var o;let r;return n&&(r=null===(o=a(t))||void 0===o?void 0:o.catch((n=>{const a=new h(t,n,!0);return e.onError.emit(a),console.warn(a),v(t)}))),r||(r=v(t)),r}(r,n)||Promise.resolve(void 0);return u.set(i,l),{new:!0,promise:l,keyObject:r,cacheKey:i}}));i.notify(),l.notify();const s=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=u.get(e.cacheKey)!==e.promise;if(e.new&&!n){u.delete(e.cacheKey);const n=s[t];n?m.addRecord(e.keyObject,n):m.getRecord(e.keyObject)||m.addRecord(e.keyObject,{})}})),i.notify(),l.notify(),r.map((e=>m.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(g.entries()).map((([e,t])=>Object.assign(Object.assign({},b(e)),{data:t.data})))});return m}function w(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 o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n}const O="invalid",A={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:O,apiUrl:"https://app.tolgee.io",fetch:d(),onTranslationMissing:({key:e})=>e},k=(...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 N(e,t){const n=k(A,null==t?void 0:t.initialOptions,e);return n.apiUrl=u(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=d(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 T(e,t,n,r,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,target:t})=>{var n;const a=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:r(t),namespace:i({key:e,ns:t})[0],translation:s({key:e,ns:t})})));null===(n=g.ui)||void 0===n||n.handleElementClick(a,t)},f=(e,t)=>{var n;return(null===(n=g.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function p(e){const t=s({key:e.key,ns:e.ns});return x.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function h(){return{fetch:t().fetch}}function y(e){g.observer=null==e?void 0:e()}function b(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function L(e){g.finalFormatter=e}function A(e){u.ui=e}function k(){return Boolean(u.ui)}function N(e){g.languageStorage=e}function T(e){g.languageDetector=e}function j(e){e&&g.backends.push(e)}function C(e){g.devBackend=e}const x=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:L,addFormatter:E,setObserver:y,hasObserver:b,setUi:A,hasUi:k,setDevBackend:C,addBackend:j,setLanguageDetector:T,setLanguageStorage:N}))},findPositions:f,run(){var e,n;const{apiKey:a,apiUrl:o,projectId:r,observerOptions:i}=t();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:a,apiUrl:o,projectId:r,highlight:x.highlight,changeTranslation:l,findPositions:f,onPermanentChange:e=>c.onPermanentChange.emit(e)}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){const e=n();return a(o(c.onError,(e=>new m("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(h())})),(t=>e&&!e.includes(t)||!t?function(){if(!g.languageDetector)return;const e=n();return o(c.onError,(e=>new v("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=g.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},h()))}))}():t))},setStoredLanguage:e=>o(c.onError,(e=>new m("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=g.languageStorage)||void 0===t?void 0:t.setLanguage(e,h())})),getDevBackend:()=>g.devBackend,getBackendRecord:({language:e,namespace:t})=>{for(const n of g.backends){const a=n.getRecord(Object.assign({language:e,namespace:t},h()));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;const{apiKey:o,apiUrl:r,projectId:i}=t();return null===(a=g.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},h()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=g.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(x.getDevBackend()),formatTranslation(n){var a,{formatEnabled:o}=n,r=w(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(r));let v=null!=p?p:f?"":h;const m=e(),y=o||!(null===(a=g.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of g.formatters)v=e.format({translation:v,language:m,params:u});g.finalFormatter&&p&&m&&y&&(v=g.finalFormatter.format({translation:v,language:m,params:u}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||O,a=t().onFormatError,o=typeof a;v="string"===o?a:"function"===o?a(n,r):O,v=b(v)}var E;return v}});return x}const j=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const C=(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:o,language:r}=e,i=w(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function x({options:e}){const t=function(e,t){let n=!0;function a(){return n}const o=Object.freeze({onPendingLanguageChange:f(a),onLanguageChange:f(a),onLoadingChange:f(a),onFetchingChange:f(a),onInitialLoaded:f(a),onRunningChange:f(a),onCacheChange:f(a),onUpdate:p(a,e,t),onPermanentChange:f(a),onError:f(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(t);case"language":return o.onLanguageChange.listen(t);case"loading":return o.onLoadingChange.listen(t);case"fetching":return o.onFetchingChange.listen(t);case"initialLoad":return o.onInitialLoaded.listen(t);case"running":return o.onRunningChange.listen(t);case"cache":return o.onCacheChange.listen(t);case"update":return o.onUpdate.listen(t);case"permanentChange":return o.onPermanentChange.listen(t);case"error":return o.onError.listen(t)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(m,y),o=j(!1,(()=>h.isFetching()),t.onFetchingChange.emit),i=j(!1,(()=>S.isLoading()),t.onLoadingChange.emit),g=function(e,t,n){let a,o=N();const r=Object.freeze({init(e){o=N(e,o)},isRunning:()=>o.isRunning,setRunning(e){o.isRunning!==e&&(o.isRunning=e,n.emit(e))},isInitialLoading:()=>o.isInitialLoading,setInitialLoading(e){o.isInitialLoading=e},getLanguage:()=>o.language||o.initialOptions.language,setLanguage(t){o.language!==t&&(o.language=t,e.emit(t))},getPendingLanguage:()=>o.pendingLanguage||r.getLanguage(),setPendingLanguage(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},o.initialOptions),a),addActiveNs(e){s(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t?o.activeNamespaces.set(e,t+1):o.activeNamespaces.set(e,1)}))},removeActiveNs(e){s(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t&&t>1?o.activeNamespaces.set(e,t-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>c([...o.initialOptions.ns||[o.initialOptions.defaultNs],...s(o.initialOptions.fallbackNs),...o.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||r.getLanguage();return t?c([t,...l(t,o.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>s(o.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?o.initialOptions.defaultNs:e,getAvailableLanguages(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>b(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?r.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:u(e.apiUrl)}):void 0}});return r}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),d=T(g.getLanguage,g.getInitialOptions,g.getAvailableLanguages,E,x,R,O,t),h=L(t,d.getBackendRecord,d.getBackendDevRecord,g.withDefaultNs,g.isInitialLoading,o,i);let v;function m(){return g.getFallbackNs()}function y(e){return g.getDefaultNs(e)}function E(e){return[...s(y(e)),...m()]}function w(e){return[...s(null!=e?e:y()),...g.getRequiredNamespaces()]}function O(e,t,n){const a=g.withDefaultNs(e),o=h.getTranslation(a,t);return h.changeTranslation(a,t,n),{revert(){h.changeTranslation(a,t,o)}}}function A(e){g.init(e),h.addStaticData(g.getInitialOptions().staticData)}function k(e,t){const n=function(e,t){const n=g.getFallbackLangs(e),a=w(t),o=[];return n.forEach((e=>{a.forEach((t=>{h.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}(e,t);if(n.length)return a(S.loadRecords(n),(()=>{}))}function x({key:e,ns:t}){const n=g.getFallbackLangs(),a=E(null!=t?t:void 0);return h.getTranslationNs(a,n,e)}function R({key:e,ns:t,language:n}){const a=E(null!=t?t:void 0),o=g.getFallbackLangs(n);return h.getTranslationFallback(a,o,e)}function P(){const e=a(function(){if(g.getLanguage())return;return a(d.getInitialLanguage(),(e=>{const t=e||g.getInitialOptions().defaultLanguage;t&&g.setLanguage(t)}))}(),(()=>k()));if(n(e))return g.setInitialLoading(!0),o.notify(),i.notify(),Promise.resolve(e).then((()=>{g.setInitialLoading(!1),o.notify(),i.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&A(e),t.onUpdate.listen((()=>{g.isRunning()&&d.retranslate()}));const S=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),g),d),h),{init:A,getTranslation:R,changeTranslation:O,getTranslationNs:x,getDefaultAndFallbackNs:E,findPositions:d.findPositions,async changeLanguage(e){g.getPendingLanguage()===e&&g.getLanguage()===e||(g.setPendingLanguage(e),g.isRunning()&&await k(e),e===g.getPendingLanguage()&&(g.setLanguage(e),await d.setStoredLanguage(e)))},async addActiveNs(e,t){t||g.addActiveNs(e),g.isRunning()&&await k(void 0,e)},loadRecords:e=>h.loadRecords(e,S.isDev()),loadRecord:async e=>(await S.loadRecords([e]))[0],isLoading:e=>h.isLoading(g.getLanguage(),e),isLoaded(e){const t=g.getLanguage();if(!t)return!1;const n=g.getFallbackLangs(t),a=w(e),o=[];return n.forEach((e=>{a.forEach((t=>{h.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=C(...e),n=R(t);return d.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(g.getInitialOptions().apiKey&&g.getInitialOptions().apiUrl),run:()=>(function(){if((d.getLanguageDetector()||d.getLanguageStorage())&&!g.getAvailableLanguages())throw new Error(r("availableLanguages"));if(!g.getLanguage()&&!g.getInitialOptions().defaultLanguage)throw new Error(r(["defaultLanguage","language"]))}(),g.isRunning()||(g.setRunning(!0),d.run(),v=P()),Promise.resolve(v)),stop(){g.isRunning()&&(d.stop(),g.setRunning(!1))}}));return S}const R=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=k(e.options,n),t),init(t){const n=function(e){const t=x({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,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}(k(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},P=0,S=1,D=2;class I extends Error{constructor(e,t,n){let a;a=e===P?"Empty parameter":e===S?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function U(e){return/\s/.test(e)}const F=0,_=1,$=2,M=3,K=4,B=new Set([$,_,F]),V="'",z=new Set(["{","}",V]),W=e=>/[0-9a-zA-Z_]/.test(e);function Y(e,t){const[n,a]=function(e){let t=F,n="",a="",o="";const r=[],i=[];let s=0;function l(t){throw new I(t,s,e)}const c=()=>{r.push(n),n=""},u=()=>{""===a&&l(P),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],t){case F:o===V?(n+=o,t=_):"{"===o?(c(),t=M):(n+=o,t=F);break;case _:z.has(o)?(n=n.slice(0,-1)+o,t=$):(n+=o,t=F);break;case $:o===V?t=F:(n+=o,t=$);break;case M:"}"===o?(u(),t=F):U(o)?""!==a&&(u(),t=K):(W(o)||l(S),a+=o,t=M);break;case K:"}"==o?t=F:U(o)?t=K:l(S)}return B.has(t)||l(D),c(),[r,i]}(e),o=[n[0]];for(let r=1;r<n.length;r++){const i=null==t?void 0:t[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(n[r])}return o.join("")}const H=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>Y(e,t)}),e),X="__tolgee_dev_tools",G="__tolgee_preferredLanguages",J="data-tolgee-key-only",q="data-tolgee-restricted",Z="_tolgee",Q="_tolgee-highlighter";function ee(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function te(e){if(ee())throw new Error(`${e}: Can't run on the server`)}function ne(e,t){return{oldTextContent:e,keys:t}}function ae(e){return e.textContent}function oe(e,t){e.textContent=t}function re(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,o=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&&o}const ie={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function se({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;const o=function(e){for(;e;){if(null!==e.getAttribute("disabled"))return!1;e=e.parentElement}return!0}(n);let r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(Q),Object.entries(ie).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const i=n.getBoundingClientRect();r.style.pointerEvents=o?"none":"auto",r.style.borderWidth=t+"px",r.style.top=i.top-t+"px",r.style.left=i.left-t+"px",r.style.width=i.width+"px",r.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 le={capture:!0},ce={capture:!0,passive:!0},ue=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function ge({highlightKeys:e,elementStore:t,onClick:n,options:a}){var o,r;const i=new Set;let s,l,c=[];const u=(null==(o=a.targetElement)?void 0:o.getRootNode())||document,g=(null==(r=a.targetElement)?void 0:r.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 ue.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===X))))&&(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 L(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),A()&&s&&(n(s),d())}function w(e,t,n){g.addEventListener(e,t,n),c.push([e,t,n])}function O(e,t){return e.id===X?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(){w("keydown",y,le),w("keyup",b,le),w("mousemove",m,ce),w("scroll",E,ce),w("click",L,le),w("mouseenter",v,le),w("mouseover",v,le),w("mouseout",v,le),w("mouseleave",v,le),w("mousedown",v,le),w("mouseup",v,le)}})}function de(e,t,n){const a=se({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),o=ge({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:s(a)})},options:e});function r(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(Z),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({register(n,o,r){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${q}]`)}(n))return;const i=n;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(Z,"true")),s.nodes.set(o,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===J&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&r(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)&&r(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,o)=>{for(const t of o.nodes.values()){if(t.keys.find((t=>re({key:e,ns:i(n)},{key:t.key,ns:i(t.ns)})))){a.push(o);break}}})),a},run(e){e&&o.run()},stop(){o.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function fe(){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:o,onClick:r}){if(ee())return{stop(){t=!1},wrapper:o};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){const o=[],r=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=r[e.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.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=r[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=r["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=r[n.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return o},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,o),l=de(a,n,r);function c(e){for(const t of e){const e=ae(t),n=e?o.unwrap(e):null;if(n){const{text:a,keys:o}=n;oe(t,a);const r=ne(e,o),s=i.getSuitableParent(t);l.register(s,t,r)}}}function u(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:ae(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===J)return void u(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(J);t&&u(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(J)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){u(n.currentNode.getAttributeNode(J))}}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===J))&&l.cleanupLingeringKeyAttributes();const o=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>o.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>o.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>o.delete(e)));break;case"attributes":t.attributeName===J&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>o.add(e)))}c([...o])})),f=a.targetElement||document.body;t=!0,l.run(e),g(f,!0),c(s.handleChildList([f]));const p=new Set;return p.add(J),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:o}}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 o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return o.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){o.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],r=[];return o.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),o.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{re({key:t,ns:i(n)},{key:e.key,ns:i(e.ns)})&&r.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),r},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},he={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),o=[],r=0;;){var i=t<e.length;if(!i||r>=n-1){var s=a.subarray(0,r);if(o.push(String.fromCharCode.apply(null,s)),!i)return o.join("");e=e.subarray(t),t=0,r=0}var l=e[t++];if(0==(128&l))a[r++]=l;else if(192==(224&l)){var c=63&e[t++];a[r++]=(31&l)<<6|c}else if(224==(240&l)){c=63&e[t++];var u=63&e[t++];a[r++]=(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[r++]=g>>>10&1023|55296,g=56320|1023&g),a[r++]=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."))},o="function"==typeof Buffer&&Buffer.from,r=o?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,o=Math.max(32,n+(n>>>1)+7),r=new Uint8Array(o>>>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>r.length){o+=8,o=(o*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(o);l.set(r),r=l}if(0!=(4294967168&i)){if(0==(4294965248&i))r[a++]=i>>>6&31|192;else if(0==(4294901760&i))r[a++]=i>>>12&15|224,r[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;r[a++]=i>>>18&7|240,r[a++]=i>>>12&63|128,r[a++]=i>>>6&63|128}r[a++]=63&i|128}else r[a++]=i}return r.slice?r.slice(0,a):r.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),r(e)};var s=!o&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],c=t;o?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",!(o?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:pe);const ve=t({__proto__:null,default:he},[he]);null==(e=console.assert)||e.call(console,ve);const me=["‌","‍"],ye=RegExp(`([${me.join("")}]{9})+`,"gu");function be(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=>me[Number(e)])).join("")}function Ee(e){const t=Array.from(e).map((e=>me.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 Le({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)}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(ye))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(Ee))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[n]=function(e){const t=[];for(const n of e)t.push(n.codePointAt(0));return t}(e);return t.numberToValue(n)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:t,n:a}=o;n.push({key:e,defaultValue:t,ns:a})}}));const o=function(e){return e.replace(ye,"")}(e);return{text:o,keys:n}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=be(n({key:a,ns:i}))}else{const e=n({key:a,ns:i,defaultValue:o}),r=t.valueToNumber(e);s=be(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},testTextNode(e){var t,n;return((null==(t=e.textContent)?void 0:t.includes(`${me[0]}${me[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${me[1]}${me[0]}`)))??!1},testAttribute:e=>e.value.includes(`${me[0]}${me[0]}`)||e.value.includes(`${me[1]}${me[0]}`)})}function we(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function Oe({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:o,ns:r}=function(e){let t=!1,n="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==o||","!==s?"KEY"!==o||"|"!==s?"NAMESPACE"!==o||","!==s?"KEY"!==o||":"!==s?"DEFAULT_VALUE"!==o||":"!==s?"PARAM_NAME"!==o||":"!==s?"PARAM_VALUE"!==o||","!==s?n+=s:(o="PARAM_NAME",r.params[a]=n,n=""):(o="PARAM_VALUE",a=n,n=""):(o="PARAM_NAME",r.defaultValue=n,n=""):(o="PARAM_NAME",r.key=n,n=""):(o="DEFAULT_VALUE",i(n),n=""):(o="NAMESPACE",r.key=n,n=""):(o="DEFAULT_VALUE",r.key=n,n=""):t=!0;return"KEY"===o&&(r.key=n),"DEFAULT_VALUE"===o&&(r.defaultValue=n),"PARAM_VALUE"===o&&(r.params[a]=n),"NAMESPACE"===o&&i(n),r}(e);return{translated:n({key:t,params:a,defaultValue:o,ns:r,noWrap:!0}),key:t,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/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:o,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${r(e)}:${r(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(n)}${u}${l}${s}${t}`},unwrap(n){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(n));){let e=s[1];const[t,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!we(d,n)){u+=r;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,o;return((null==(a=n.textContent)?void 0:a.includes(e))&&(null==(o=n.textContent)?void 0:o.includes(t)))??!1},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const Ae=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=fe();return Object.freeze({...e,run(t){const n=Oe({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run({...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&&oe(t,n.text)}}))},outputNotFormattable:!0})})):t.setObserver((()=>{const e=fe();return Object.freeze({...e,run(t){const n=Le({fullKeyEncode:t.options.fullKeyEncode});e.run({...t,wrapper:n})},retranslate(){},outputNotFormattable:!1})})),e),ke="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Ne(e){const t=ke.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Te(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,o=0;const r=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|Ne(e[i]),n+=5,n>=8&&(r[o++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<n;e+=o)e+o>n&&(o=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+o));return a}(r.buffer)}function je(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Te(n).split("_");return Number(e)}}catch{console.warn("Tolgee: Api key can't be parsed")}}const Ce=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:o,fetch:r}){const i=je(t)??o;let s=void 0!==i?`${e}/v2/projects/${i}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(s+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(s,{headers:{"X-API-Key":t||"","Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>e[n]));throw new Error(e.statusText)}))}}),e);function xe({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:o=300}){let r=!1;const i=()=>new Promise(((a,r)=>{const i=function(e,t){const n=n=>{var a,o;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(o=n.data)?void 0:o.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(),r()}),o);function l(){i.unsubscribe()}}));return{cancel(){r=!0},promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let Re=null;function Pe(e){var t;return Re||(Re=(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))),Re}const Se="__tolgee_apiKey",De="__tolgee_apiUrl";function Ie(){const e=sessionStorage.getItem(Se)||void 0,t=sessionStorage.getItem(De)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Ue(){sessionStorage.removeItem(Se),sessionStorage.removeItem(De)}let Fe=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(Fe=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=xe({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(Ue)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ie()&&(async()=>{const e=await Pe("5.23.1-prerelease.88c01ea6.0");return t=>{const n=Ie();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 _e="__tolgee_currentLanguage";const $e=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(te("LanguageStorage"),localStorage.getItem(_e)||void 0),setLanguage(e){te("LanguageStorage"),localStorage.setItem(_e,e)}}),e);const Me=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){te("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e);function Ke(e){return e.endsWith("/")?e.slice(0,-1):e}const Be={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Ke(n)}/${e}/${t}.json`:`${Ke(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};const Ve=e=>(t,n)=>(n.addBackend(function(e){const{prefix:t,getPath:n,getData:a,headers:o,...r}={...Be,...e,headers:{...Be.headers,...null==e?void 0:e.headers}};return{getRecord:({namespace:e,language:i,fetch:s})=>s(n({namespace:e,language:i,prefix:t}),{headers:o,...r}).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return a(e)}))}}(e)),t);function ze(){return R().use(Fe())}const We=()=>e=>e;export{Ve as BackendFetch,Fe as BrowserExtensionPlugin,X as DEVTOOLS_ID,Ce as DevBackend,We as DevTools,H as FormatSimple,Me as LanguageDetector,v as LanguageDetectorError,$e as LanguageStorage,m as LanguageStorageError,Ae as ObserverPlugin,G as PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY,h as RecordFetchError,Z as TOLGEE_ATTRIBUTE_NAME,q as TOLGEE_RESTRICT_ATTRIBUTE,J as TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE,ze as Tolgee,R as TolgeeCore,d as createFetchFunction,i as getFallback,s as getFallbackArray,je as getProjectIdFromApiKey,C as getTranslateProps};
//# 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;function n(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 a(e){return Boolean(e&&"function"==typeof e.then)}function o(e,t){return a(e)?Promise.resolve(e).then(t):t(e)}function r(e,t,n){function o(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=n();return a(e)?e.catch(o):e}catch(e){o(e)}}function i(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 s(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function l(e){return s(e)||[]}function u(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?l(t):l(null==t?void 0:t[e]);var n}function c(e){return Array.from(new Set(e))}function g(e){return e?e.replace(/\/+$/,""):e}const d=(e,t)=>fetch(e,t),f=(e=d)=>(t,n)=>e(t,Object.assign(Object.assign({},n),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.23.0"},null==n?void 0:n.headers)}));function p(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 h(e,t,n){const a=new Set,o=new Set;let r=[];function i(){if(0===r.length)return;const e=r;r=[],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());o.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()&&(r.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};o.add(t);const a={unsubscribe:()=>{o.delete(t)},subscribeNs:e=>(l(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class v extends Error{constructor(e,t,n=!1){const{language:a,namespace:o}=e;super(`Tolgee: Failed to fetch record for "${a}"${o&&` and "${o}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=o}}class m extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class y extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const b=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):b(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},E=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},L=({language:e,namespace:t})=>t?`${e}:${t}`:e;function O(e,t,n,o,r,i,s){const u=new Map,g=new Map;let d={},f=0;function p(t,n,a){const o=L(t);g.set(o,{data:b(n),version:a}),e.onCacheChange.emit(t)}function h(n){let o;if(!o){const e=d[L(n)];"function"==typeof e&&(o=e())}return o||(o=t(n)),a(o)?null==o?void 0:o.catch((t=>{const a=new v(n,t);throw e.onError.emit(a),console.error(a),a})):o}const m=Object.freeze({addStaticData(e){e&&(d=Object.assign(Object.assign({},d),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=E(e),a=g.get(e);a&&0!==a.version||p(n,t,0)}})))},invalidate(){u.clear(),f+=1},addRecord(e,t){p(e,t,f)},exists(e,t=!1){const n=g.get(L(e));return n&&t?n.version===f:Boolean(n)},getRecord(e){var t;return null===(t=g.get(L(o(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=g.get(L(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(L({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[o]}return c(e)},getTranslationFallback(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(L({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var o;const r=null===(o=g.get(L(t)))||void 0===o?void 0:o.data;null==r||r.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return u.size>0;const t=l(e);return Boolean(Array.from(u.keys()).find((e=>t.includes(E(e).namespace))))},isLoading(e,t){const n=l(t);return Boolean(r()||Array.from(u.keys()).find((t=>{const a=E(t);return(!n.length||n.includes(a.namespace))&&!m.exists({namespace:a.namespace,language:e})})))},async loadRecords(t,a){const r=t.map((t=>{const r=o(t),i=L(r),s=u.get(i);if(s)return{new:!1,promise:s,keyObject:r,cacheKey:i};const l=function(t,a){var o;let r;return a&&(r=null===(o=n(t))||void 0===o?void 0:o.catch((n=>{const a=new v(t,n,!0);return e.onError.emit(a),console.warn(a),h(t)}))),r||(r=h(t)),r}(r,a)||Promise.resolve(void 0);return u.set(i,l),{new:!0,promise:l,keyObject:r,cacheKey:i}}));i.notify(),s.notify();const l=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=u.get(e.cacheKey)!==e.promise;if(e.new&&!n){u.delete(e.cacheKey);const n=l[t];n?m.addRecord(e.keyObject,n):m.getRecord(e.keyObject)||m.addRecord(e.keyObject,{})}})),i.notify(),s.notify(),r.map((e=>m.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(g.entries()).map((([e,t])=>Object.assign(Object.assign({},E(e)),{data:t.data})))});return m}function w(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 o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n}const A="invalid",T={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:A,apiUrl:"https://app.tolgee.io",fetch:f(),onTranslationMissing:({key:e})=>e},k=(...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 N(e,t){const n=k(T,null==t?void 0:t.initialOptions,e);return n.apiUrl=g(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=f(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 j(e,t,n,a,i,s,l,u){const c={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,target:t})=>{var n;const o=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:a(t),namespace:i({key:e,ns:t})[0],translation:s({key:e,ns:t})})));null===(n=g.ui)||void 0===n||n.handleElementClick(o,t)},f=(e,t)=>{var n;return(null===(n=g.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function p(e){const t=s({key:e.key,ns:e.ns});return C.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function h(){return{fetch:t().fetch}}function v(e){g.observer=null==e?void 0:e()}function b(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function L(e){g.finalFormatter=e}function O(e){c.ui=e}function T(){return Boolean(c.ui)}function k(e){g.languageStorage=e}function N(e){g.languageDetector=e}function j(e){e&&g.backends.push(e)}function x(e){g.devBackend=e}const C=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:L,addFormatter:E,setObserver:v,hasObserver:b,setUi:O,hasUi:T,setDevBackend:x,addBackend:j,setLanguageDetector:N,setLanguageStorage:k}))},findPositions:f,run(){var e,n;const{apiKey:a,apiUrl:o,projectId:r,observerOptions:i}=t();g.ui=null===(e=c.ui)||void 0===e?void 0:e.call(c,{apiKey:a,apiUrl:o,projectId:r,highlight:C.highlight,changeTranslation:l,findPositions:f,onPermanentChange:e=>u.onPermanentChange.emit(e)}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){const e=n();return o(r(u.onError,(e=>new y("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(h())})),(t=>e&&!e.includes(t)||!t?function(){if(!g.languageDetector)return;const e=n();return r(u.onError,(e=>new m("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=g.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},h()))}))}():t))},setStoredLanguage:e=>r(u.onError,(e=>new y("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=g.languageStorage)||void 0===t?void 0:t.setLanguage(e,h())})),getDevBackend:()=>g.devBackend,getBackendRecord:({language:e,namespace:t})=>{for(const n of g.backends){const a=n.getRecord(Object.assign({language:e,namespace:t},h()));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;const{apiKey:o,apiUrl:r,projectId:i}=t();return null===(a=g.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},h()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=g.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(C.getDevBackend()),formatTranslation(n){var a,{formatEnabled:o}=n,r=w(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:u,params:c,ns:d,orEmpty:f}=r,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(r));let v=null!=p?p:f?"":h;const m=e(),y=o||!(null===(a=g.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>g.observer&&!u?g.observer.wrap({key:i,translation:e,defaultValue:l,params:c,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of g.formatters)v=e.format({translation:v,language:m,params:c});g.finalFormatter&&p&&m&&y&&(v=g.finalFormatter.format({translation:v,language:m,params:c}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||A,a=t().onFormatError,o=typeof a;v="string"===o?a:"function"===o?a(n,r):A,v=b(v)}var E;return v}});return C}const x=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const C=(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:o,language:r}=e,i=w(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function R({options:e}){const t=function(e,t){let n=!0;function a(){return n}const o=Object.freeze({onPendingLanguageChange:p(a),onLanguageChange:p(a),onLoadingChange:p(a),onFetchingChange:p(a),onInitialLoaded:p(a),onRunningChange:p(a),onCacheChange:p(a),onUpdate:h(a,e,t),onPermanentChange:p(a),onError:p(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(t);case"language":return o.onLanguageChange.listen(t);case"loading":return o.onLoadingChange.listen(t);case"fetching":return o.onFetchingChange.listen(t);case"initialLoad":return o.onInitialLoaded.listen(t);case"running":return o.onRunningChange.listen(t);case"cache":return o.onCacheChange.listen(t);case"update":return o.onUpdate.listen(t);case"permanentChange":return o.onPermanentChange.listen(t);case"error":return o.onError.listen(t)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(m,y),n=x(!1,(()=>f.isFetching()),t.onFetchingChange.emit),r=x(!1,(()=>S.isLoading()),t.onLoadingChange.emit),s=function(e,t,n){let a,o=N();const r=Object.freeze({init(e){o=N(e,o)},isRunning:()=>o.isRunning,setRunning(e){o.isRunning!==e&&(o.isRunning=e,n.emit(e))},isInitialLoading:()=>o.isInitialLoading,setInitialLoading(e){o.isInitialLoading=e},getLanguage:()=>o.language||o.initialOptions.language,setLanguage(t){o.language!==t&&(o.language=t,e.emit(t))},getPendingLanguage:()=>o.pendingLanguage||r.getLanguage(),setPendingLanguage(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},o.initialOptions),a),addActiveNs(e){l(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t?o.activeNamespaces.set(e,t+1):o.activeNamespaces.set(e,1)}))},removeActiveNs(e){l(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t&&t>1?o.activeNamespaces.set(e,t-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>c([...o.initialOptions.ns||[o.initialOptions.defaultNs],...l(o.initialOptions.fallbackNs),...o.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||r.getLanguage();return t?c([t,...u(t,o.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>l(o.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?o.initialOptions.defaultNs:e,getAvailableLanguages(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>E(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?r.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:g(e.apiUrl)}):void 0}});return r}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),d=j(s.getLanguage,s.getInitialOptions,s.getAvailableLanguages,b,k,R,w,t),f=O(t,d.getBackendRecord,d.getBackendDevRecord,s.withDefaultNs,s.isInitialLoading,n,r);let v;function m(){return s.getFallbackNs()}function y(e){return s.getDefaultNs(e)}function b(e){return[...l(y(e)),...m()]}function L(e){return[...l(null!=e?e:y()),...s.getRequiredNamespaces()]}function w(e,t,n){const a=s.withDefaultNs(e),o=f.getTranslation(a,t);return f.changeTranslation(a,t,n),{revert(){f.changeTranslation(a,t,o)}}}function A(e){s.init(e),f.addStaticData(s.getInitialOptions().staticData)}function T(e,t){const n=function(e,t){const n=s.getFallbackLangs(e),a=L(t),o=[];return n.forEach((e=>{a.forEach((t=>{f.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}(e,t);if(n.length)return o(S.loadRecords(n),(()=>{}))}function k({key:e,ns:t}){const n=s.getFallbackLangs(),a=b(null!=t?t:void 0);return f.getTranslationNs(a,n,e)}function R({key:e,ns:t,language:n}){const a=b(null!=t?t:void 0),o=s.getFallbackLangs(n);return f.getTranslationFallback(a,o,e)}function P(){const e=o(function(){if(s.getLanguage())return;return o(d.getInitialLanguage(),(e=>{const t=e||s.getInitialOptions().defaultLanguage;t&&s.setLanguage(t)}))}(),(()=>T()));if(a(e))return s.setInitialLoading(!0),n.notify(),r.notify(),Promise.resolve(e).then((()=>{s.setInitialLoading(!1),n.notify(),r.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&A(e),t.onUpdate.listen((()=>{s.isRunning()&&d.retranslate()}));const S=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),s),d),f),{init:A,getTranslation:R,changeTranslation:w,getTranslationNs:k,getDefaultAndFallbackNs:b,findPositions:d.findPositions,async changeLanguage(e){s.getPendingLanguage()===e&&s.getLanguage()===e||(s.setPendingLanguage(e),s.isRunning()&&await T(e),e===s.getPendingLanguage()&&(s.setLanguage(e),await d.setStoredLanguage(e)))},async addActiveNs(e,t){t||s.addActiveNs(e),s.isRunning()&&await T(void 0,e)},loadRecords:e=>f.loadRecords(e,S.isDev()),loadRecord:async e=>(await S.loadRecords([e]))[0],isLoading:e=>f.isLoading(s.getLanguage(),e),isLoaded(e){const t=s.getLanguage();if(!t)return!1;const n=s.getFallbackLangs(t),a=L(e),o=[];return n.forEach((e=>{a.forEach((t=>{f.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=C(...e),n=R(t);return d.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(s.getInitialOptions().apiKey&&s.getInitialOptions().apiUrl),run:()=>(function(){if((d.getLanguageDetector()||d.getLanguageStorage())&&!s.getAvailableLanguages())throw new Error(i("availableLanguages"));if(!s.getLanguage()&&!s.getInitialOptions().defaultLanguage)throw new Error(i(["defaultLanguage","language"]))}(),s.isRunning()||(s.setRunning(!0),d.run(),v=P()),Promise.resolve(v)),stop(){s.isRunning()&&(d.stop(),s.setRunning(!1))}}));return S}const P=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=k(e.options,n),t),init(t){const n=function(e){const t=R({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,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}(k(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},S=0,D=1,_=2;class I extends Error{constructor(e,t,n){let a;a=e===S?"Empty parameter":e===D?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function F(e){return/\s/.test(e)}const U=0,$=1,M=2,B=3,K=4,V=new Set([M,$,U]),z="'",W=new Set(["{","}",z]),G=e=>/[0-9a-zA-Z_]/.test(e);function Y(e,t){const[n,a]=function(e){let t=U,n="",a="",o="";const r=[],i=[];let s=0;function l(t){throw new I(t,s,e)}const u=()=>{r.push(n),n=""},c=()=>{""===a&&l(S),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],t){case U:o===z?(n+=o,t=$):"{"===o?(u(),t=B):(n+=o,t=U);break;case $:W.has(o)?(n=n.slice(0,-1)+o,t=M):(n+=o,t=U);break;case M:o===z?t=U:(n+=o,t=M);break;case B:"}"===o?(c(),t=U):F(o)?""!==a&&(c(),t=K):(G(o)||l(D),a+=o,t=B);break;case K:"}"==o?t=U:F(o)?t=K:l(D)}return V.has(t)||l(_),u(),[r,i]}(e),o=[n[0]];for(let r=1;r<n.length;r++){const i=null==t?void 0:t[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(n[r])}return o.join("")}const H="__tolgee_dev_tools",X="data-tolgee-key-only",J="data-tolgee-restricted",q="_tolgee",Z="_tolgee-highlighter";function Q(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function ee(e){if(Q())throw new Error(`${e}: Can't run on the server`)}function te(e,t){return{oldTextContent:e,keys:t}}const ne={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function ae({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(Z),Object.entries(ne).forEach((([e,t])=>{o.style[e]=t})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const r=n.getBoundingClientRect();o.style.borderWidth=t+"px",o.style.top=r.top-t+"px",o.style.left=r.left-t+"px",o.style.width=r.width+"px",o.style.height=r.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null==(e=t.highlightEl)||e.remove(),t.highlightEl=void 0}}(0,a)}})}function oe(e){return e.textContent}function re(e,t){e.textContent=t}function ie(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,o=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&&o}const se={capture:!0},le={capture:!0,passive:!0},ue=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function ce({highlightKeys:e,elementStore:t,onClick:n,options:a}){var o,r;const i=new Set;let s,l,u=[];const c=(null==(o=a.targetElement)?void 0:o.getRootNode())||document,g=(null==(r=a.targetElement)?void 0:r.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=w(n,(e=>t.get(e)));if(void 0!==e)return e||void 0}}(c.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 ue.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(w(t,(e=>e.id===H))))&&(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 L(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),A()&&s&&(n(s),d())}function O(e,t,n){g.addEventListener(e,t,n),u.push([e,t,n])}function w(e,t){return e.id===H?null:t(e)?e:(null==e?void 0:e.parentElement)?w(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 u)g.removeEventListener(...e);u=[]}()},run(){O("keydown",y,se),O("keyup",b,se),O("mousemove",m,le),O("scroll",E,le),O("click",L,se),O("mouseenter",v,se),O("mouseover",v,se),O("mouseout",v,se),O("mouseleave",v,se),O("mousedown",v,se),O("mouseup",v,se)}})}function ge(e,t,n){const a=ae({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),o=ce({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:i(a)})},options:e});function r(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(q),t.remove(e)}function i(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({register(n,o,r){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${J}]`)}(n))return;const i=n;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(q,"true")),s.nodes.set(o,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===X&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&r(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)&&r(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,o)=>{for(const t of o.nodes.values()){if(t.keys.find((t=>ie({key:e,ns:s(n)},{key:t.key,ns:s(t.ns)})))){a.push(o);break}}})),a},run(e){e&&o.run()},stop(){o.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function de(){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:o,onClick:r}){if(Q())return{stop(){t=!1},wrapper:o};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){const o=[],r=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=r[e.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.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=r[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=r["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=r[n.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return o},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,o),l=ge(a,n,r);function u(e){for(const t of e){const e=oe(t),n=e?o.unwrap(e):null;if(n){const{text:a,keys:o}=n;re(t,a);const r=te(e,o),s=i.getSuitableParent(t);l.register(s,t,r)}}}function c(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:oe(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===X)return void c(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(X);t&&c(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(X)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){c(n.currentNode.getAttributeNode(X))}}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===X))&&l.cleanupLingeringKeyAttributes();const o=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>o.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>o.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>o.delete(e)));break;case"attributes":t.attributeName===X&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>o.add(e)))}u([...o])})),f=a.targetElement||document.body;t=!0,l.run(e),g(f,!0),u(s.handleChildList([f]));const p=new Set;return p.add(X),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:o}}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 o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return o.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){o.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],r=[];return o.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),o.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{ie({key:t,ns:s(n)},{key:e.key,ns:s(e.ns)})&&r.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),r},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},pe={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),o=[],r=0;;){var i=t<e.length;if(!i||r>=n-1){var s=a.subarray(0,r);if(o.push(String.fromCharCode.apply(null,s)),!i)return o.join("");e=e.subarray(t),t=0,r=0}var l=e[t++];if(0==(128&l))a[r++]=l;else if(192==(224&l)){var u=63&e[t++];a[r++]=(31&l)<<6|u}else if(224==(240&l)){u=63&e[t++];var c=63&e[t++];a[r++]=(31&l)<<12|u<<6|c}else if(240==(248&l)){var g=(7&l)<<18|(u=63&e[t++])<<12|(c=63&e[t++])<<6|63&e[t++];g>65535&&(g-=65536,a[r++]=g>>>10&1023|55296,g=56320|1023&g),a[r++]=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."))},o="function"==typeof Buffer&&Buffer.from,r=o?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,o=Math.max(32,n+(n>>>1)+7),r=new Uint8Array(o>>>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>r.length){o+=8,o=(o*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(o);l.set(r),r=l}if(0!=(4294967168&i)){if(0==(4294965248&i))r[a++]=i>>>6&31|192;else if(0==(4294901760&i))r[a++]=i>>>12&15|224,r[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;r[a++]=i>>>18&7|240,r[a++]=i>>>12&63|128,r[a++]=i>>>6&63|128}r[a++]=63&i|128}else r[a++]=i}return r.slice?r.slice(0,a):r.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),r(e)};var s=!o&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],u=t;o?u=function(e,t){return(e instanceof Buffer?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)).toString(t)}:s&&(u=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 c="construct 'TextDecoder'",g="".concat(n," ").concat(c,": the ");function d(e,t){if(a(t&&t.fatal,c,"fatal"),e=e||"utf-8",!(o?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),u(n,this.encoding)},e.TextEncoder=e.TextEncoder||i,e.TextDecoder=e.TextDecoder||d}("undefined"!=typeof window?window:fe);const he=n({__proto__:null,default:pe},[pe]);null==(t=console.assert)||t.call(console,he);const ve=["‌","‍"],me=RegExp(`([${ve.join("")}]{9})+`,"gu");function ye(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=>ve[Number(e)])).join("")}function be(e){const t=Array.from(e).map((e=>ve.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 Ee({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)}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(me))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(be))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[n]=function(e){const t=[];for(const n of e)t.push(n.codePointAt(0));return t}(e);return t.numberToValue(n)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:t,n:a}=o;n.push({key:e,defaultValue:t,ns:a})}}));const o=function(e){return e.replace(me,"")}(e);return{text:o,keys:n}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=ye(n({key:a,ns:i}))}else{const e=n({key:a,ns:i,defaultValue:o}),r=t.valueToNumber(e);s=ye(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},testTextNode(e){var t,n;return((null==(t=e.textContent)?void 0:t.includes(`${ve[0]}${ve[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${ve[1]}${ve[0]}`)))??!1},testAttribute:e=>e.value.includes(`${ve[0]}${ve[0]}`)||e.value.includes(`${ve[1]}${ve[0]}`)})}function Le(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function Oe({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:o,ns:r}=function(e){let t=!1,n="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==o||","!==s?"KEY"!==o||"|"!==s?"NAMESPACE"!==o||","!==s?"KEY"!==o||":"!==s?"DEFAULT_VALUE"!==o||":"!==s?"PARAM_NAME"!==o||":"!==s?"PARAM_VALUE"!==o||","!==s?n+=s:(o="PARAM_NAME",r.params[a]=n,n=""):(o="PARAM_VALUE",a=n,n=""):(o="PARAM_NAME",r.defaultValue=n,n=""):(o="PARAM_NAME",r.key=n,n=""):(o="DEFAULT_VALUE",i(n),n=""):(o="NAMESPACE",r.key=n,n=""):(o="DEFAULT_VALUE",r.key=n,n=""):t=!0;return"KEY"===o&&(r.key=n),"DEFAULT_VALUE"===o&&(r.defaultValue=n),"PARAM_VALUE"===o&&(r.params[a]=n),"NAMESPACE"===o&&i(n),r}(e);return{translated:n({key:t,params:a,defaultValue:o,ns:r,noWrap:!0}),key:t,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/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:o,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${r(e)}:${r(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",u="string"==typeof i?[i]:i,c=(null==u?void 0:u.length)?`|${u.map((e=>r(e))).join("|")}`:"";return`${e}${r(n)}${c}${l}${s}${t}`},unwrap(n){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(t)})`,"gs"),i=[];let s,l=!1,u=0,c="";for(;null!==(s=r.exec(n));){let e=s[1];const[t,o,r,g]=s,{index:d,input:f}=s;if(c+=f.substr(u,d-u),u=d+t.length,"\\"===e){if(!Le(d,n)){c+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,c+=e+p.translated}return c+=n.substring(u),l?{text:c,keys:i}:{text:n,keys:[]}},testTextNode(n){var a,o;return((null==(a=n.textContent)?void 0:a.includes(e))&&(null==(o=n.textContent)?void 0:o.includes(t)))??!1},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const we="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Ae(e){const t=we.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Te(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,o=0;const r=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|Ae(e[i]),n+=5,n>=8&&(r[o++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<n;e+=o)e+o>n&&(o=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+o));return a}(r.buffer)}function ke(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Te(n).split("_");return Number(e)}}catch{console.warn("Tolgee: Api key can't be parsed")}}function Ne({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:o=300}){let r=!1;const i=()=>new Promise(((a,r)=>{const i=function(e,t){const n=n=>{var a,o;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(o=n.data)?void 0:o.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(),r()}),o);function l(){i.unsubscribe()}}));return{cancel(){r=!0},promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let je=null;function xe(e){var t;return je||(je=(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))),je}const Ce="__tolgee_apiKey",Re="__tolgee_apiUrl";function Pe(){const e=sessionStorage.getItem(Ce)||void 0,t=sessionStorage.getItem(Re)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Se(){sessionStorage.removeItem(Ce),sessionStorage.removeItem(Re)}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}=Ne({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(Se)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Pe()&&(async()=>{const e=await xe("5.23.0");return t=>{const n=Pe();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 De="__tolgee_currentLanguage";function _e(e){return e.endsWith("/")?e.slice(0,-1):e}const Ie={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${_e(n)}/${e}/${t}.json`:`${_e(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};e.BackendFetch=e=>(t,n)=>(n.addBackend(function(e){const{prefix:t,getPath:n,getData:a,headers:o,...r}={...Ie,...e,headers:{...Ie.headers,...null==e?void 0:e.headers}};return{getRecord:({namespace:e,language:i,fetch:s})=>s(n({namespace:e,language:i,prefix:t}),{headers:o,...r}).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return a(e)}))}}(e)),t),e.DEVTOOLS_ID=H,e.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:o,fetch:r}){const i=ke(t)??o;let s=void 0!==i?`${e}/v2/projects/${i}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(s+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(s,{headers:{"X-API-Key":t||"","Content-Type":"application/json"}}).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})=>Y(e,t)}),e),e.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){ee("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e),e.LanguageDetectorError=m,e.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(ee("LanguageStorage"),localStorage.getItem(De)||void 0),setLanguage(e){ee("LanguageStorage"),localStorage.setItem(De,e)}}),e),e.LanguageStorageError=y,e.ObserverPlugin=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=de();return Object.freeze({...e,run(t){const n=Oe({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run({...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&&re(t,n.text)}}))},outputNotFormattable:!0})})):t.setObserver((()=>{const e=de();return Object.freeze({...e,run(t){const n=Ee({fullKeyEncode:t.options.fullKeyEncode});e.run({...t,wrapper:n})},retranslate(){},outputNotFormattable:!1})})),e),e.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",e.RecordFetchError=v,e.TOLGEE_ATTRIBUTE_NAME=q,e.TOLGEE_RESTRICT_ATTRIBUTE=J,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=X,e.Tolgee=function(){return P().use(e.BrowserExtensionPlugin())},e.TolgeeCore=P,e.createFetchFunction=f,e.getFallback=s,e.getFallbackArray=l,e.getProjectIdFromApiKey=ke,e.getTranslateProps=C,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;function n(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 a(e){return Boolean(e&&"function"==typeof e.then)}function o(e,t){return a(e)?Promise.resolve(e).then(t):t(e)}function r(e,t,n){function o(n){const a=t(n);throw e.emit(a),console.error(a),a}try{const e=n();return a(e)?e.catch(o):e}catch(e){o(e)}}function i(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 s(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function l(e){return s(e)||[]}function u(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?l(t):l(null==t?void 0:t[e]);var n}function c(e){return Array.from(new Set(e))}function g(e){return e?e.replace(/\/+$/,""):e}const d=(e,t)=>fetch(e,t),f=(e=d)=>(t,n)=>e(t,Object.assign(Object.assign({},n),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.23.1-prerelease.88c01ea6.0"},null==n?void 0:n.headers)}));function p(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 h(e,t,n){const a=new Set,o=new Set;let r=[];function i(){if(0===r.length)return;const e=r;r=[],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());o.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()&&(r.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};o.add(t);const a={unsubscribe:()=>{o.delete(t)},subscribeNs:e=>(l(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}class v extends Error{constructor(e,t,n=!1){const{language:a,namespace:o}=e;super(`Tolgee: Failed to fetch record for "${a}"${o&&` and "${o}"`}`),this.cause=t,this.isDev=n,this.name="RecordFetchError",this.language=a,this.namespace=o}}class m extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageDetectorError"}}class y extends Error{constructor(e,t){super(e),this.cause=t,this.name="LanguageStorageError"}}const b=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):b(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},E=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},L=({language:e,namespace:t})=>t?`${e}:${t}`:e;function O(e,t,n,o,r,i,s){const u=new Map,g=new Map;let d={},f=0;function p(t,n,a){const o=L(t);g.set(o,{data:b(n),version:a}),e.onCacheChange.emit(t)}function h(n){let o;if(!o){const e=d[L(n)];"function"==typeof e&&(o=e())}return o||(o=t(n)),a(o)?null==o?void 0:o.catch((t=>{const a=new v(n,t);throw e.onError.emit(a),console.error(a),a})):o}const m=Object.freeze({addStaticData(e){e&&(d=Object.assign(Object.assign({},d),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=E(e),a=g.get(e);a&&0!==a.version||p(n,t,0)}})))},invalidate(){u.clear(),f+=1},addRecord(e,t){p(e,t,f)},exists(e,t=!1){const n=g.get(L(e));return n&&t?n.version===f:Boolean(n)},getRecord(e){var t;return null===(t=g.get(L(o(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=g.get(L(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(L({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[o]}return c(e)},getTranslationFallback(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=g.get(L({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var o;const r=null===(o=g.get(L(t)))||void 0===o?void 0:o.data;null==r||r.set(n,a),e.onCacheChange.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return u.size>0;const t=l(e);return Boolean(Array.from(u.keys()).find((e=>t.includes(E(e).namespace))))},isLoading(e,t){const n=l(t);return Boolean(r()||Array.from(u.keys()).find((t=>{const a=E(t);return(!n.length||n.includes(a.namespace))&&!m.exists({namespace:a.namespace,language:e})})))},async loadRecords(t,a){const r=t.map((t=>{const r=o(t),i=L(r),s=u.get(i);if(s)return{new:!1,promise:s,keyObject:r,cacheKey:i};const l=function(t,a){var o;let r;return a&&(r=null===(o=n(t))||void 0===o?void 0:o.catch((n=>{const a=new v(t,n,!0);return e.onError.emit(a),console.warn(a),h(t)}))),r||(r=h(t)),r}(r,a)||Promise.resolve(void 0);return u.set(i,l),{new:!0,promise:l,keyObject:r,cacheKey:i}}));i.notify(),s.notify();const l=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=u.get(e.cacheKey)!==e.promise;if(e.new&&!n){u.delete(e.cacheKey);const n=l[t];n?m.addRecord(e.keyObject,n):m.getRecord(e.keyObject)||m.addRecord(e.keyObject,{})}})),i.notify(),s.notify(),r.map((e=>m.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(g.entries()).map((([e,t])=>Object.assign(Object.assign({},E(e)),{data:t.data})))});return m}function w(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 o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n}const A="invalid",T={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:A,apiUrl:"https://app.tolgee.io",fetch:f(),onTranslationMissing:({key:e})=>e},k=(...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 N(e,t){const n=k(T,null==t?void 0:t.initialOptions,e);return n.apiUrl=g(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=f(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 j(e,t,n,a,i,s,l,u){const c={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,target:t})=>{var n;const o=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:a(t),namespace:i({key:e,ns:t})[0],translation:s({key:e,ns:t})})));null===(n=g.ui)||void 0===n||n.handleElementClick(o,t)},f=(e,t)=>{var n;return(null===(n=g.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function p(e){const t=s({key:e.key,ns:e.ns});return C.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function h(){return{fetch:t().fetch}}function v(e){g.observer=null==e?void 0:e()}function b(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function L(e){g.finalFormatter=e}function O(e){c.ui=e}function T(){return Boolean(c.ui)}function k(e){g.languageStorage=e}function N(e){g.languageDetector=e}function j(e){e&&g.backends.push(e)}function x(e){g.devBackend=e}const C=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:L,addFormatter:E,setObserver:v,hasObserver:b,setUi:O,hasUi:T,setDevBackend:x,addBackend:j,setLanguageDetector:N,setLanguageStorage:k}))},findPositions:f,run(){var e,n;const{apiKey:a,apiUrl:o,projectId:r,observerOptions:i}=t();g.ui=null===(e=c.ui)||void 0===e?void 0:e.call(c,{apiKey:a,apiUrl:o,projectId:r,highlight:C.highlight,changeTranslation:l,findPositions:f,onPermanentChange:e=>u.onPermanentChange.emit(e)}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){const e=n();return o(r(u.onError,(e=>new y("Tolgee: Failed to load language",e)),(()=>{var e;return null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(h())})),(t=>e&&!e.includes(t)||!t?function(){if(!g.languageDetector)return;const e=n();return r(u.onError,(e=>new m("Tolgee: Failed to detect language",e)),(()=>{var t;return null===(t=g.languageDetector)||void 0===t?void 0:t.getLanguage(Object.assign({availableLanguages:e},h()))}))}():t))},setStoredLanguage:e=>r(u.onError,(e=>new y("Tolgee: Failed to store language",e)),(()=>{var t;return null===(t=g.languageStorage)||void 0===t?void 0:t.setLanguage(e,h())})),getDevBackend:()=>g.devBackend,getBackendRecord:({language:e,namespace:t})=>{for(const n of g.backends){const a=n.getRecord(Object.assign({language:e,namespace:t},h()));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;const{apiKey:o,apiUrl:r,projectId:i}=t();return null===(a=g.devBackend)||void 0===a?void 0:a.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},h()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=g.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(C.getDevBackend()),formatTranslation(n){var a,{formatEnabled:o}=n,r=w(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:u,params:c,ns:d,orEmpty:f}=r,p=null!=s?s:l;let h="";null==s&&(h=t().onTranslationMissing(r));let v=null!=p?p:f?"":h;const m=e(),y=o||!(null===(a=g.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>g.observer&&!u?g.observer.wrap({key:i,translation:e,defaultValue:l,params:c,ns:d}):e;v=b(v);try{if(p&&m&&y)for(const e of g.formatters)v=e.format({translation:v,language:m,params:c});g.finalFormatter&&p&&m&&y&&(v=g.finalFormatter.format({translation:v,language:m,params:c}))}catch(e){console.error(e);const n=("string"==typeof(E=e)?E:"string"==typeof(null==E?void 0:E.message)?E.message:void 0)||A,a=t().onFormatError,o=typeof a;v="string"===o?a:"function"===o?a(n,r):A,v=b(v)}var E;return v}});return C}const x=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const C=(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:o,language:r}=e,i=w(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function R({options:e}){const t=function(e,t){let n=!0;function a(){return n}const o=Object.freeze({onPendingLanguageChange:p(a),onLanguageChange:p(a),onLoadingChange:p(a),onFetchingChange:p(a),onInitialLoaded:p(a),onRunningChange:p(a),onCacheChange:p(a),onUpdate:h(a,e,t),onPermanentChange:p(a),onError:p(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(t);case"language":return o.onLanguageChange.listen(t);case"loading":return o.onLoadingChange.listen(t);case"fetching":return o.onFetchingChange.listen(t);case"initialLoad":return o.onInitialLoaded.listen(t);case"running":return o.onRunningChange.listen(t);case"cache":return o.onCacheChange.listen(t);case"update":return o.onUpdate.listen(t);case"permanentChange":return o.onPermanentChange.listen(t);case"error":return o.onError.listen(t)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(m,y),n=x(!1,(()=>f.isFetching()),t.onFetchingChange.emit),r=x(!1,(()=>S.isLoading()),t.onLoadingChange.emit),s=function(e,t,n){let a,o=N();const r=Object.freeze({init(e){o=N(e,o)},isRunning:()=>o.isRunning,setRunning(e){o.isRunning!==e&&(o.isRunning=e,n.emit(e))},isInitialLoading:()=>o.isInitialLoading,setInitialLoading(e){o.isInitialLoading=e},getLanguage:()=>o.language||o.initialOptions.language,setLanguage(t){o.language!==t&&(o.language=t,e.emit(t))},getPendingLanguage:()=>o.pendingLanguage||r.getLanguage(),setPendingLanguage(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},o.initialOptions),a),addActiveNs(e){l(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t?o.activeNamespaces.set(e,t+1):o.activeNamespaces.set(e,1)}))},removeActiveNs(e){l(e).forEach((e=>{const t=o.activeNamespaces.get(e);void 0!==t&&t>1?o.activeNamespaces.set(e,t-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>c([...o.initialOptions.ns||[o.initialOptions.defaultNs],...l(o.initialOptions.fallbackNs),...o.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||r.getLanguage();return t?c([t,...u(t,o.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>l(o.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?o.initialOptions.defaultNs:e,getAvailableLanguages(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>E(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?r.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:g(e.apiUrl)}):void 0}});return r}(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),d=j(s.getLanguage,s.getInitialOptions,s.getAvailableLanguages,b,k,R,w,t),f=O(t,d.getBackendRecord,d.getBackendDevRecord,s.withDefaultNs,s.isInitialLoading,n,r);let v;function m(){return s.getFallbackNs()}function y(e){return s.getDefaultNs(e)}function b(e){return[...l(y(e)),...m()]}function L(e){return[...l(null!=e?e:y()),...s.getRequiredNamespaces()]}function w(e,t,n){const a=s.withDefaultNs(e),o=f.getTranslation(a,t);return f.changeTranslation(a,t,n),{revert(){f.changeTranslation(a,t,o)}}}function A(e){s.init(e),f.addStaticData(s.getInitialOptions().staticData)}function T(e,t){const n=function(e,t){const n=s.getFallbackLangs(e),a=L(t),o=[];return n.forEach((e=>{a.forEach((t=>{f.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}(e,t);if(n.length)return o(S.loadRecords(n),(()=>{}))}function k({key:e,ns:t}){const n=s.getFallbackLangs(),a=b(null!=t?t:void 0);return f.getTranslationNs(a,n,e)}function R({key:e,ns:t,language:n}){const a=b(null!=t?t:void 0),o=s.getFallbackLangs(n);return f.getTranslationFallback(a,o,e)}function P(){const e=o(function(){if(s.getLanguage())return;return o(d.getInitialLanguage(),(e=>{const t=e||s.getInitialOptions().defaultLanguage;t&&s.setLanguage(t)}))}(),(()=>T()));if(a(e))return s.setInitialLoading(!0),n.notify(),r.notify(),Promise.resolve(e).then((()=>{s.setInitialLoading(!1),n.notify(),r.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}e&&A(e),t.onUpdate.listen((()=>{s.isRunning()&&d.retranslate()}));const S=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),s),d),f),{init:A,getTranslation:R,changeTranslation:w,getTranslationNs:k,getDefaultAndFallbackNs:b,findPositions:d.findPositions,async changeLanguage(e){s.getPendingLanguage()===e&&s.getLanguage()===e||(s.setPendingLanguage(e),s.isRunning()&&await T(e),e===s.getPendingLanguage()&&(s.setLanguage(e),await d.setStoredLanguage(e)))},async addActiveNs(e,t){t||s.addActiveNs(e),s.isRunning()&&await T(void 0,e)},loadRecords:e=>f.loadRecords(e,S.isDev()),loadRecord:async e=>(await S.loadRecords([e]))[0],isLoading:e=>f.isLoading(s.getLanguage(),e),isLoaded(e){const t=s.getLanguage();if(!t)return!1;const n=s.getFallbackLangs(t),a=L(e),o=[];return n.forEach((e=>{a.forEach((t=>{f.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=C(...e),n=R(t);return d.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(s.getInitialOptions().apiKey&&s.getInitialOptions().apiUrl),run:()=>(function(){if((d.getLanguageDetector()||d.getLanguageStorage())&&!s.getAvailableLanguages())throw new Error(i("availableLanguages"));if(!s.getLanguage()&&!s.getInitialOptions().defaultLanguage)throw new Error(i(["defaultLanguage","language"]))}(),s.isRunning()||(s.setRunning(!0),d.run(),v=P()),Promise.resolve(v)),stop(){s.isRunning()&&(d.stop(),s.setRunning(!1))}}));return S}const P=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=k(e.options,n),t),init(t){const n=function(e){const t=R({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,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}(k(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},S=0,D=1,_=2;class I extends Error{constructor(e,t,n){let a;a=e===S?"Empty parameter":e===D?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function F(e){return/\s/.test(e)}const U=0,$=1,M=2,B=3,K=4,V=new Set([M,$,U]),z="'",W=new Set(["{","}",z]),G=e=>/[0-9a-zA-Z_]/.test(e);function Y(e,t){const[n,a]=function(e){let t=U,n="",a="",o="";const r=[],i=[];let s=0;function l(t){throw new I(t,s,e)}const u=()=>{r.push(n),n=""},c=()=>{""===a&&l(S),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],t){case U:o===z?(n+=o,t=$):"{"===o?(u(),t=B):(n+=o,t=U);break;case $:W.has(o)?(n=n.slice(0,-1)+o,t=M):(n+=o,t=U);break;case M:o===z?t=U:(n+=o,t=M);break;case B:"}"===o?(c(),t=U):F(o)?""!==a&&(c(),t=K):(G(o)||l(D),a+=o,t=B);break;case K:"}"==o?t=U:F(o)?t=K:l(D)}return V.has(t)||l(_),u(),[r,i]}(e),o=[n[0]];for(let r=1;r<n.length;r++){const i=null==t?void 0:t[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(n[r])}return o.join("")}const H="__tolgee_dev_tools",X="data-tolgee-key-only",J="data-tolgee-restricted",q="_tolgee",Z="_tolgee-highlighter";function Q(){var e,t;return void 0===(null==(t=null==(e=globalThis.window)?void 0:e.document)?void 0:t.createElement)}function ee(e){if(Q())throw new Error(`${e}: Can't run on the server`)}function te(e,t){return{oldTextContent:e,keys:t}}function ne(e){return e.textContent}function ae(e,t){e.textContent=t}function oe(e,t){var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,o=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&&o}const re={position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function ie({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;const o=function(e){for(;e;){if(null!==e.getAttribute("disabled"))return!1;e=e.parentElement}return!0}(n);let r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(Z),Object.entries(re).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const i=n.getBoundingClientRect();r.style.pointerEvents=o?"none":"auto",r.style.borderWidth=t+"px",r.style.top=i.top-t+"px",r.style.left=i.left-t+"px",r.style.width=i.width+"px",r.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 se={capture:!0},le={capture:!0,passive:!0},ue=new Map([["Control","ctrlKey"],["Alt","altKey"],["Meta","metaKey"],["Shift","shiftKey"]]);function ce({highlightKeys:e,elementStore:t,onClick:n,options:a}){var o,r;const i=new Set;let s,l,u=[];const c=(null==(o=a.targetElement)?void 0:o.getRootNode())||document,g=(null==(r=a.targetElement)?void 0:r.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=w(n,(e=>t.get(e)));if(void 0!==e)return e||void 0}}(c.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 ue.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(w(t,(e=>e.id===H))))&&(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 L(e){v(e),h(e),p({x:e.clientX,y:e.clientY}),A()&&s&&(n(s),d())}function O(e,t,n){g.addEventListener(e,t,n),u.push([e,t,n])}function w(e,t){return e.id===H?null:t(e)?e:(null==e?void 0:e.parentElement)?w(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 u)g.removeEventListener(...e);u=[]}()},run(){O("keydown",y,se),O("keyup",b,se),O("mousemove",m,le),O("scroll",E,le),O("click",L,se),O("mouseenter",v,se),O("mouseover",v,se),O("mouseout",v,se),O("mouseleave",v,se),O("mousedown",v,se),O("mouseup",v,se)}})}function ge(e,t,n){const a=ie({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),o=ce({highlightKeys:e.highlightKeys,elementStore:t,onClick(e){const a=t.get(e);n({target:e,keysAndDefaults:i(a)})},options:e});function r(e,n){var a;n.highlightEl&&(null==(a=n.unhighlight)||a.call(n)),e.removeAttribute(q),t.remove(e)}function i(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({register(n,o,r){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${J}]`)}(n))return;const i=n;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(q,"true")),s.nodes.set(o,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===X&&null===n.ownerElement&&t.nodes.delete(n)}0===t.nodes.size&&r(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)&&r(t,n))}))},findAll(e,n){const a=[];return t.forEachElement(((t,o)=>{for(const t of o.nodes.values()){if(t.keys.find((t=>oe({key:e,ns:s(n)},{key:t.key,ns:s(t.ns)})))){a.push(o);break}}})),a},run(e){e&&o.run()},stop(){o.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null==(n=t.unhighlight)||n.call(t))}))}})}function de(){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:o,onClick:r}){if(Q())return{stop(){t=!1},wrapper:o};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){const o=[],r=Object.fromEntries(Object.entries(e.tagAttributes).map((([e,t])=>[e.toUpperCase(),t])));if(n.nodeType===Node.ELEMENT_NODE){const e=n;let a=r[e.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.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=r[e.tagName.toUpperCase()])?void 0:t.some((t=>e.hasAttribute(t))))||(null==(n=r["*"])?void 0:n.some((t=>e.hasAttribute(t))))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}));for(;e.nextNode();){const n=e.currentNode;let a=r[n.tagName.toUpperCase()]??[];"*"in r&&(a=a.concat(r["*"])),o.push(...a.filter((e=>n.hasAttribute(e))).map((e=>n.getAttributeNode(e))).filter((e=>t.testAttribute(e))))}}return o},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,o),l=ge(a,n,r);function u(e){for(const t of e){const e=ne(t),n=e?o.unwrap(e):null;if(n){const{text:a,keys:o}=n;ae(t,a);const r=te(e,o),s=i.getSuitableParent(t);l.register(s,t,r)}}}function c(e){const t=i.getSuitableParent(e);l.register(t,e,{oldTextContent:"",keys:[{key:ne(e)}],keyAttributeOnly:!0})}function g(e,t){if(e.nodeType===Node.ATTRIBUTE_NODE){const t=e;if(t.name===X)return void c(t)}if(e.nodeType===Node.ELEMENT_NODE){const t=e.getAttributeNode(X);t&&c(t)}if(!t)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>e.hasAttribute(X)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP));for(;n.nextNode();){c(n.currentNode.getAttributeNode(X))}}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===X))&&l.cleanupLingeringKeyAttributes();const o=new Set;for(const t of e)switch(t.type){case"characterData":s.handleText(t.target).forEach((e=>o.add(e)));break;case"childList":g(t.target,!0),t.addedNodes.length>0&&s.handleChildList(Array.from(t.addedNodes)).forEach((e=>o.add(e))),t.removedNodes.length>0&&s.handleChildList(Array.from(t.removedNodes)).forEach((e=>o.delete(e)));break;case"attributes":t.attributeName===X&&g(t.target,!1),s.handleAttributes(t.target,!1).forEach((e=>o.add(e)))}u([...o])})),f=a.targetElement||document.body;t=!0,l.run(e),g(f,!0),u(s.handleChildList([f]));const p=new Set;return p.add(X),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:o}}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 o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[];return o.forEach((e=>{var t;return null==(t=e.highlight)?void 0:t.call(e)})),{unhighlight(){o.forEach((e=>{var t;return null==(t=e.unhighlight)?void 0:t.call(e)}))}}},findPositions(t,n){var a;const o=(null==(a=null==e?void 0:e.elementRegistry)?void 0:a.findAll(t,n))||[],r=[];return o.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),o.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{oe({key:t,ns:s(n)},{key:e.key,ns:s(e.ns)})&&r.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),r},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}var fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},pe={};!function(e){function t(e){for(var t=0,n=Math.min(65536,e.length+1),a=new Uint16Array(n),o=[],r=0;;){var i=t<e.length;if(!i||r>=n-1){var s=a.subarray(0,r);if(o.push(String.fromCharCode.apply(null,s)),!i)return o.join("");e=e.subarray(t),t=0,r=0}var l=e[t++];if(0==(128&l))a[r++]=l;else if(192==(224&l)){var u=63&e[t++];a[r++]=(31&l)<<6|u}else if(224==(240&l)){u=63&e[t++];var c=63&e[t++];a[r++]=(31&l)<<12|u<<6|c}else if(240==(248&l)){var g=(7&l)<<18|(u=63&e[t++])<<12|(c=63&e[t++])<<6|63&e[t++];g>65535&&(g-=65536,a[r++]=g>>>10&1023|55296,g=56320|1023&g),a[r++]=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."))},o="function"==typeof Buffer&&Buffer.from,r=o?function(e){return Buffer.from(e)}:function(e){for(var t=0,n=e.length,a=0,o=Math.max(32,n+(n>>>1)+7),r=new Uint8Array(o>>>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>r.length){o+=8,o=(o*=1+t/e.length*2)>>>3<<3;var l=new Uint8Array(o);l.set(r),r=l}if(0!=(4294967168&i)){if(0==(4294965248&i))r[a++]=i>>>6&31|192;else if(0==(4294901760&i))r[a++]=i>>>12&15|224,r[a++]=i>>>6&63|128;else{if(0!=(4292870144&i))continue;r[a++]=i>>>18&7|240,r[a++]=i>>>12&63|128,r[a++]=i>>>6&63|128}r[a++]=63&i|128}else r[a++]=i}return r.slice?r.slice(0,a):r.subarray(0,a)};function i(){this.encoding="utf-8"}i.prototype.encode=function(e,t){return a(t&&t.stream,"encode","stream"),r(e)};var s=!o&&"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL,l=["utf-8","utf8","unicode-1-1-utf-8"],u=t;o?u=function(e,t){return(e instanceof Buffer?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)).toString(t)}:s&&(u=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 c="construct 'TextDecoder'",g="".concat(n," ").concat(c,": the ");function d(e,t){if(a(t&&t.fatal,c,"fatal"),e=e||"utf-8",!(o?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),u(n,this.encoding)},e.TextEncoder=e.TextEncoder||i,e.TextDecoder=e.TextDecoder||d}("undefined"!=typeof window?window:fe);const he=n({__proto__:null,default:pe},[pe]);null==(t=console.assert)||t.call(console,he);const ve=["‌","‍"],me=RegExp(`([${ve.join("")}]{9})+`,"gu");function ye(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=>ve[Number(e)])).join("")}function be(e){const t=Array.from(e).map((e=>ve.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 Ee({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)}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null==(t=e.match(me))?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(be))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[n]=function(e){const t=[];for(const n of e)t.push(n.codePointAt(0));return t}(e);return t.numberToValue(n)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:t,n:a}=o;n.push({key:e,defaultValue:t,ns:a})}}));const o=function(e){return e.replace(me,"")}(e);return{text:o,keys:n}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=ye(n({key:a,ns:i}))}else{const e=n({key:a,ns:i,defaultValue:o}),r=t.valueToNumber(e);s=ye(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},testTextNode(e){var t,n;return((null==(t=e.textContent)?void 0:t.includes(`${ve[0]}${ve[0]}`))||(null==(n=e.textContent)?void 0:n.includes(`${ve[1]}${ve[0]}`)))??!1},testAttribute:e=>e.value.includes(`${ve[0]}${ve[0]}`)||e.value.includes(`${ve[1]}${ve[0]}`)})}function Le(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}function Oe({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:o,ns:r}=function(e){let t=!1,n="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==o||","!==s?"KEY"!==o||"|"!==s?"NAMESPACE"!==o||","!==s?"KEY"!==o||":"!==s?"DEFAULT_VALUE"!==o||":"!==s?"PARAM_NAME"!==o||":"!==s?"PARAM_VALUE"!==o||","!==s?n+=s:(o="PARAM_NAME",r.params[a]=n,n=""):(o="PARAM_VALUE",a=n,n=""):(o="PARAM_NAME",r.defaultValue=n,n=""):(o="PARAM_NAME",r.key=n,n=""):(o="DEFAULT_VALUE",i(n),n=""):(o="NAMESPACE",r.key=n,n=""):(o="DEFAULT_VALUE",r.key=n,n=""):t=!0;return"KEY"===o&&(r.key=n),"DEFAULT_VALUE"===o&&(r.defaultValue=n),"PARAM_VALUE"===o&&(r.params[a]=n),"NAMESPACE"===o&&i(n),r}(e);return{translated:n({key:t,params:a,defaultValue:o,ns:r,noWrap:!0}),key:t,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/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:o,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${r(e)}:${r(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",u="string"==typeof i?[i]:i,c=(null==u?void 0:u.length)?`|${u.map((e=>r(e))).join("|")}`:"";return`${e}${r(n)}${c}${l}${s}${t}`},unwrap(n){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(t)})`,"gs"),i=[];let s,l=!1,u=0,c="";for(;null!==(s=r.exec(n));){let e=s[1];const[t,o,r,g]=s,{index:d,input:f}=s;if(c+=f.substr(u,d-u),u=d+t.length,"\\"===e){if(!Le(d,n)){c+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,c+=e+p.translated}return c+=n.substring(u),l?{text:c,keys:i}:{text:n,keys:[]}},testTextNode(n){var a,o;return((null==(a=n.textContent)?void 0:a.includes(e))&&(null==(o=n.textContent)?void 0:o.includes(t)))??!1},testAttribute:n=>n.value.includes(e)&&n.value.includes(t)})}const we="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Ae(e){const t=we.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function Te(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,o=0;const r=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|Ae(e[i]),n+=5,n>=8&&(r[o++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<n;e+=o)e+o>n&&(o=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+o));return a}(r.buffer)}function ke(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=Te(n).split("_");return Number(e)}}catch{console.warn("Tolgee: Api key can't be parsed")}}function Ne({message:e,recievingMessage:t,data:n,attempts:a=1,timeout:o=300}){let r=!1;const i=()=>new Promise(((a,r)=>{const i=function(e,t){const n=n=>{var a,o;e.includes(null==(a=n.data)?void 0:a.type)&&t(null==(o=n.data)?void 0:o.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(),r()}),o);function l(){i.unsubscribe()}}));return{cancel(){r=!0},promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await i()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}let je=null;function xe(e){var t;return je||(je=(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))),je}const Ce="__tolgee_apiKey",Re="__tolgee_apiUrl";function Pe(){const e=sessionStorage.getItem(Ce)||void 0,t=sessionStorage.getItem(Re)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Se(){sessionStorage.removeItem(Ce),sessionStorage.removeItem(Re)}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}=Ne({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(Se)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Pe()&&(async()=>{const e=await xe("5.23.1-prerelease.88c01ea6.0");return t=>{const n=Pe();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 De="__tolgee_currentLanguage";function _e(e){return e.endsWith("/")?e.slice(0,-1):e}const Ie={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${_e(n)}/${e}/${t}.json`:`${_e(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};e.BackendFetch=e=>(t,n)=>(n.addBackend(function(e){const{prefix:t,getPath:n,getData:a,headers:o,...r}={...Ie,...e,headers:{...Ie.headers,...null==e?void 0:e.headers}};return{getRecord:({namespace:e,language:i,fetch:s})=>s(n({namespace:e,language:i,prefix:t}),{headers:o,...r}).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return a(e)}))}}(e)),t),e.DEVTOOLS_ID=H,e.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:o,fetch:r}){const i=ke(t)??o;let s=void 0!==i?`${e}/v2/projects/${i}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(s+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(s,{headers:{"X-API-Key":t||"","Content-Type":"application/json"}}).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})=>Y(e,t)}),e),e.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){ee("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e),e.LanguageDetectorError=m,e.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(ee("LanguageStorage"),localStorage.getItem(De)||void 0),setLanguage(e){ee("LanguageStorage"),localStorage.setItem(De,e)}}),e),e.LanguageStorageError=y,e.ObserverPlugin=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=de();return Object.freeze({...e,run(t){const n=Oe({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run({...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&&ae(t,n.text)}}))},outputNotFormattable:!0})})):t.setObserver((()=>{const e=de();return Object.freeze({...e,run(t){const n=Ee({fullKeyEncode:t.options.fullKeyEncode});e.run({...t,wrapper:n})},retranslate(){},outputNotFormattable:!1})})),e),e.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",e.RecordFetchError=v,e.TOLGEE_ATTRIBUTE_NAME=q,e.TOLGEE_RESTRICT_ATTRIBUTE=J,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=X,e.Tolgee=function(){return P().use(e.BrowserExtensionPlugin())},e.TolgeeCore=P,e.createFetchFunction=f,e.getFallback=s,e.getFallbackArray=l,e.getProjectIdFromApiKey=ke,e.getTranslateProps=C,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
//# sourceMappingURL=tolgee-web.production.umd.min.js.map
import { KeyDescriptorInternal } from '../../types';
export declare function xPathEvaluate<T extends Node>(expression: string, targetNode: Node): Node[];
export declare function closestElement(node: Node): Element | undefined;
export declare function getNodeText(node: Node): string;
export declare function setNodeText(node: Node, text: string): void;
export declare function nodeContains(descendant: Node, node: Node): boolean;
export declare function compareDescriptors(descriptor: KeyDescriptorInternal, criteria: KeyDescriptorInternal): boolean;
export declare function elementClickable(el: HTMLElement): boolean;

@@ -8,3 +8,3 @@ import type { BackendGetRecordProps, DevCredentials, KeyAndParams, TreeTranslationsData } from '@tolgee/core';

};
export type TolgeeElement = Element & ElementCSSInlineStyle & {
export type TolgeeElement = HTMLElement & {
_tolgee?: boolean;

@@ -11,0 +11,0 @@ };

{
"name": "@tolgee/web",
"version": "5.23.0",
"version": "5.23.1-prerelease.88c01ea6.0",
"description": "Tolgee for web",

@@ -48,3 +48,3 @@ "declaration": true,

"dependencies": {
"@tolgee/core": "5.23.0"
"@tolgee/core": "5.23.1-prerelease.88c01ea6.0"
},

@@ -99,3 +99,3 @@ "devDependencies": {

"homepage": "https://github.com/tolgee/tolgee-js#readme",
"gitHead": "8583a512984d3fa33a670123fbbb4f9c7ef4d517",
"gitHead": "d449fa43c12410d4c64ec59ee448e483e90b1ddc",
"publishConfig": {

@@ -102,0 +102,0 @@ "access": "public"

import { TOLGEE_HIGHLIGHTER_CLASS } from '../../constants';
import { ElementMeta, TolgeeElement } from '../../types';
import { elementClickable } from './helpers';

@@ -28,2 +29,3 @@ const HIGHLIGHTER_BASE_STYLE: Partial<CSSStyleDeclaration> = {

}
const clickable = elementClickable(element);
let highlightEl = elementMeta.highlightEl;

@@ -45,2 +47,3 @@ if (!highlightEl) {

highlightEl.style.pointerEvents = clickable ? 'none' : 'auto';
highlightEl.style.borderWidth = highlightWidth + 'px';

@@ -47,0 +50,0 @@ highlightEl.style.top = shape.top - highlightWidth + 'px';

import { KeyDescriptorInternal } from '../../types';
export function xPathEvaluate<T extends Node>(
expression: string,
targetNode: Node
): Node[] {
const searchableElement = closestElement(targetNode);
const result: Node[] = [];
if (!searchableElement) {
return result;
}
const evaluated = document?.evaluate(
expression,
searchableElement,
undefined,
XPathResult.ANY_TYPE
);
let node: Node | null | undefined;
while ((node = evaluated?.iterateNext?.())) {
result.push(node as T);
}
return result;
}
export function closestElement(node: Node): Element | undefined {
switch (node.nodeType) {
case Node.ATTRIBUTE_NODE:
return (node as Attr).ownerElement || undefined;
case Node.TEXT_NODE:
return (node.parentElement as Element) || undefined;
case Node.DOCUMENT_NODE:
case Node.ELEMENT_NODE:
return node as Element;
default:
// we are not interested in other nodes
return undefined;
}
}
export function getNodeText(node: Node) {

@@ -51,17 +11,2 @@ return node.textContent;

export function nodeContains(descendant: Node, node: Node) {
if (descendant.contains(node)) {
return true;
}
if (node instanceof Attr) {
const ownerContainsAttr =
node.ownerElement &&
Object.values(node.ownerElement.attributes).indexOf(node) > -1;
if (descendant.contains(node.ownerElement) && ownerContainsAttr) {
return true;
}
}
return false;
}
export function compareDescriptors(

@@ -82,1 +27,11 @@ descriptor: KeyDescriptorInternal,

}
export function elementClickable(el: HTMLElement) {
while (el) {
if (el.getAttribute('disabled') !== null) {
return false;
}
el = el.parentElement;
}
return true;
}

@@ -16,6 +16,5 @@ import type {

export type TolgeeElement = Element &
ElementCSSInlineStyle & {
_tolgee?: boolean;
};
export type TolgeeElement = HTMLElement & {
_tolgee?: boolean;
};

@@ -22,0 +21,0 @@ export type BackendOptions = Omit<RequestInfo, 'headers'> & {

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc