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.4.2 to 5.4.3-prerelease.9ea3f1fa.0

2

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

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="__tolgee_dev_tools",t="data-tolgee-key-only",n="data-tolgee-restricted",a="_tolgee",r="_tolgee-highlighter";function o(){var e,t;return void 0===(null===(t=null===(e=globalThis.window)||void 0===e?void 0:e.document)||void 0===t?void 0:t.createElement)}function i(e){if(o())throw new Error(`${e}: Can't run on the server`)}function s(e,t){return{oldTextContent:e,keys:t}}function l(e){return Boolean(e&&"function"==typeof e.then)}const u=(e,t)=>l(e)?Promise.resolve(e).then(t):t(e),c=e=>`Tolgee: You need to specify '${e}' option`;function g(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function d(e){return g(e)||[]}function f(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?d(t):d(null==t?void 0:t[e]);var n}function p(e){return Array.from(new Set(e))}function v(e){return e?e.replace(/\/+$/,""):e}const h=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})))}})},m=(e,t,n)=>{const a=new Set,r=new Set;let o=[];const i=()=>{if(0===o.length)return;const e=o;o=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));(e=>{const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))})(n?Array.from(n.keys()):void 0)};return Object.freeze({listenSome:e=>{const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(d(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a},listen:e=>{a.add(e);return{unsubscribe:()=>{a.delete(e)}}},emit:(t,n)=>{e()&&(o.push(t),n?setTimeout(i,0):i())}})},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},y=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},E=({language:e,namespace:t})=>t?`${e}:${t}`:e,L=(e,t,n,a,r,o,i)=>{const s=new Map,l=new Map;let u={},c=0;function g(t,n,a){const r=E(t);l.set(r,{data:b(n),version:a}),e.emit(t)}function f(e,t){g(e,t,c)}function v(e,t=!1){const n=l.get(E(e));return n&&t?n.version===c:Boolean(n)}function h(e){var t;return null===(t=l.get(E(a(e))))||void 0===t?void 0:t.data}function m(e){let n;if(!n){const t=u[E(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n}return Object.freeze({addStaticData:function(e){e&&(u=Object.assign(Object.assign({},u),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=y(e),a=l.get(e);a&&0!==a.version||g(n,t,0)}})))},invalidate:function(){s.clear(),c+=1},addRecord:f,exists:v,getRecord:h,getTranslation:function(e,t){var n;return null===(n=l.get(E(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(E({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return p(e)},getTranslationFallback:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(E({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation:function(t,n,a){var r;const o=null===(r=l.get(E(t)))||void 0===r?void 0:r.data;null==o||o.set(n,a),e.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching:function(e){if(r())return!0;if(void 0===e)return s.size>0;const t=d(e);return Boolean(Array.from(s.keys()).find((e=>t.includes(y(e).namespace))))},isLoading:function(e,t){const n=d(t);return Boolean(r()||Array.from(s.keys()).find((t=>{const a=y(t);return(!n.length||n.includes(a.namespace))&&!v({namespace:a.namespace,language:e})})))},loadRecords:async function(e,t){const r=e.map((e=>{const r=a(e),o=E(r),i=s.get(o);if(i)return{new:!1,promise:i,keyObject:r,cacheKey:o};const l=function(e,t){var a;let r;return t&&(r=null===(a=n(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),r||(r=m(e)),r}(r,t)||Promise.resolve(void 0);return s.set(o,l),{new:!0,promise:l,keyObject:r,cacheKey:o}}));o.notify(),i.notify();const l=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=s.get(e.cacheKey)!==e.promise;if(e.new&&!n){s.delete(e.cacheKey);const n=l[t];n?f(e.keyObject,n):h(e.keyObject)||f(e.keyObject,{})}})),o.notify(),i.notify(),r.map((e=>h(e.keyObject)))},getAllRecords:function(){return Array.from(l.entries()).map((([e,t])=>Object.assign(Object.assign({},y(e)),{data:t.data})))}})};function O(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const w="invalid",k={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"]},observerType:"invisible",onFormatError:w,apiUrl:"https://app.tolgee.io"},A=(...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},j=(e,t)=>{const n=A(k,null==t?void 0:t.initialOptions,e);return n.apiUrl=v(n.apiUrl),{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}},x=(e,t,n,a,r,o)=>{const i={ui:void 0},s={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},c=async({keysAndDefaults:e,event:t})=>{var n;const o=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,ns:a({key:e,ns:t}),translation:r({key:e,ns:t})})));null===(n=s.ui)||void 0===n||n.handleElementClick(o,t)},g=(e,t)=>{var n,a;return(null===(a=null===(n=s.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},d=e=>{const t=r({key:e.key,ns:e.ns});return j(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))},f=e=>{s.observer=null==e?void 0:e()},p=()=>Boolean(s.observer),v=e=>{e&&s.formatters.push(e)},h=e=>{s.finalFormatter=e},m=e=>{i.ui=e},b=()=>Boolean(i.ui),y=e=>{s.languageStorage=e},E=e=>{s.languageDetector=e},L=e=>{e&&s.backends.push(e)},k=e=>{s.devBackend=e},A=()=>s.devBackend;function j(n){var a,{formatEnabled:r}=n,o=O(n,["formatEnabled"]);const{key:i,translation:l,defaultValue:u,noWrap:c,params:g,orEmpty:d,ns:f}=o,p=l||u;let v=p||(d?"":i);const h=e(),m=r||!(null===(a=s.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>s.observer&&!c?s.observer.wrap({key:i,translation:e,defaultValue:u,params:g,ns:f}):e;v=b(v);try{if(p&&h&&m)for(const e of s.formatters)v=e.format({translation:v,language:h,params:g});s.finalFormatter&&p&&h&&m&&(v=s.finalFormatter.format({translation:v,language:h,params:g}))}catch(e){console.error(e);const n=("string"==typeof(y=e)?y:"string"==typeof(null==y?void 0:y.message)?y.message:void 0)||w,a=t().onFormatError,r=typeof a;v="string"===r?a:"function"===r?a(n,o):w,v=b(v)}var y;return v}return Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:h,addFormatter:v,setObserver:f,hasObserver:p,setUi:m,hasUi:b,setDevBackend:k,addBackend:L,setLanguageDetector:E,setLanguageStorage:y}))},formatTranslation:j,getDevBackend:A,getBackendRecord:({language:e,namespace:t})=>{for(const n of s.backends){const a=n.getRecord({language:e,namespace:t});if(l(a))return null==a?void 0:a.catch((e=>(console.error(e),{})));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;const{apiKey:r,apiUrl:o,projectId:i}=t();return null===(a=s.devBackend)||void 0===a?void 0:a.getRecord({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:n})},getLanguageDetector:()=>s.languageDetector,getLanguageStorage:()=>s.languageStorage,getInitialLanguage:()=>{var e;const t=n(),a=null===(e=s.languageStorage)||void 0===e?void 0:e.getLanguage();return u(a,(e=>t&&!t.includes(e)||!e?(()=>{if(!s.languageDetector)return;const e=n();return s.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var t;null===(t=s.languageStorage)||void 0===t||t.setLanguage(e)},run:()=>{var e,n;const{apiKey:a,apiUrl:r,projectId:l,observerOptions:u}=t();s.ui=null===(e=i.ui)||void 0===e?void 0:e.call(i,{apiKey:a,apiUrl:r,projectId:l,highlight:g,changeTranslation:o}),null===(n=s.observer)||void 0===n||n.run({mouseHighlight:!0,options:u,translate:d,onClick:c})},stop:()=>{var e;s.ui=void 0,null===(e=s.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=s.observer)||void 0===e||e.retranslate()},highlight:g,unwrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:function(){return Boolean(A())}})},T=(e,t,n)=>{let a=e;return Object.freeze({init:function(e){a=e},notify:function(){const e=t();a!==e&&n(e),a=e}})};const P=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:r}=e,o=O(e,["ns","noWrap","orEmpty","params"]);const i={ns:t,noWrap:n,orEmpty:a};return Object.assign(Object.assign({},i),{params:Object.assign({},o)})}(n)),a)),a},N=({options:e})=>{const t=((e,t)=>{let n=!0;function a(){return n}const r=h(a),o=h(a),i=h(a),s=h(a),l=h(a),u=h(a),c=h(a),g=m(a,e,t);return l.listen((()=>g.emit())),o.listen((()=>g.emit())),c.listen((({value:e})=>{g.emit([e.namespace],!0)})),Object.freeze({onPendingLanguageChange:r,onLanguageChange:o,onLoadingChange:i,onFetchingChange:s,onInitialLoaded:l,onRunningChange:u,onCacheChange:c,onUpdate:g,setEmmiterActive:function(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return r.listen(t);case"language":return o.listen(t);case"loading":return i.listen(t);case"fetching":return s.listen(t);case"initialLoad":return l.listen(t);case"running":return u.listen(t);case"cache":return c.listen(t);case"update":return g.listen(t)}}})})(s,g),n=T(!1,(()=>i.isFetching()),t.onFetchingChange.emit),a=T(!1,(()=>k()),t.onLoadingChange.emit),r=((e,t,n)=>{let a,r=j();function o(){return r.language||r.initialOptions.language}function i(){return Object.assign(Object.assign({},r.initialOptions),a)}return Object.freeze({init:function(e){r=j(e,r)},isRunning:function(){return r.isRunning},setRunning:function(e){r.isRunning!==e&&(r.isRunning=e,n.emit(e))},isInitialLoading:function(){return r.isInitialLoading},setInitialLoading:function(e){r.isInitialLoading=e},getLanguage:o,setLanguage:function(t){r.language!==t&&(r.language=t,e.emit(t))},getPendingLanguage:function(){return r.pendingLanguage||o()},setPendingLanguage:function(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,t.emit(e))},getInitialOptions:i,addActiveNs:function(e){d(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t?r.activeNamespaces.set(e,t+1):r.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){d(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t&&t>1?r.activeNamespaces.set(e,t-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return p([...r.initialOptions.ns||[r.initialOptions.defaultNs],...d(r.initialOptions.fallbackNs),...r.activeNamespaces.keys()])},getFallbackLangs:function(e){const t=e||o();return t?p([t,...f(t,r.initialOptions.fallbackLanguage)]):[]},getFallbackNs:function(){return d(r.initialOptions.fallbackNs)},getDefaultNs:function(e){return void 0===e?r.initialOptions.defaultNs:e},getAvailableLanguages:function(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>y(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?i().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){a=e?Object.assign(Object.assign({},e),{apiUrl:v(e.apiUrl)}):void 0}})})(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),o=x(r.getLanguage,r.getInitialOptions,r.getAvailableLanguages,(function({key:e,ns:t}){const n=r.getFallbackLangs(),a=b(t||void 0);return i.getTranslationNs(a,n,e)}),R,O),i=L(t.onCacheChange,o.getBackendRecord,o.getBackendDevRecord,r.withDefaultNs,r.isInitialLoading,n,a);function s(){return r.getFallbackNs()}function g(e){return r.getDefaultNs(e)}function b(e){return[...d(g(e)),...s()]}function E(e){return[...d(e||g()),...r.getRequiredNamespaces()]}function O(e,t,n){const a=r.withDefaultNs(e),o=i.getTranslation(a,t);return i.changeTranslation(a,t,n),{revert:()=>{i.changeTranslation(a,t,o)}}}function w(e){r.init(e),i.addStaticData(r.getInitialOptions().staticData)}function k(e){return i.isLoading(r.getLanguage(),e)}function A(){return Boolean(r.getInitialOptions().apiKey&&r.getInitialOptions().apiUrl)}function N(e,t){const n=function(e,t){const n=r.getFallbackLangs(e),a=E(t),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}(e,t);if(n.length)return u(D(n),(()=>{}))}function R({key:e,ns:t}){const n=b(t||void 0),a=r.getFallbackLangs();return i.getTranslationFallback(n,a,e)}function S(){const e=u(function(){if(r.getLanguage())return;if(!r.getInitialOptions().defaultLanguage)throw new Error(c("defaultLanguage"));const e=o.getInitialLanguage();return u(e,(e=>{const t=e||r.getInitialOptions().defaultLanguage;t&&r.setLanguage(t)}))}(),(()=>N()));if(l(e))return r.setInitialLoading(!0),n.notify(),a.notify(),Promise.resolve(e).then((()=>{r.setInitialLoading(!1),n.notify(),a.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}function D(e){return i.loadRecords(e,A())}e&&w(e),t.onUpdate.listen((()=>{r.isRunning()&&o.retranslate()}));const $=()=>{const e=o.getLanguageDetector()||o.getLanguageStorage();if(e){if(!r.getAvailableLanguages())throw new Error(c("availableLanguages"))}if(!r.getLanguage()&&!r.getInitialOptions().defaultLanguage)throw e?new Error(c("defaultLanguage")):new Error(c("language"))};return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),o),i),{init:w,changeLanguage:async function(e){r.getPendingLanguage()===e&&r.getLanguage()===e||(r.setPendingLanguage(e),r.isRunning()&&await N(e),e===r.getPendingLanguage()&&(r.setLanguage(e),o.setStoredLanguage(e)))},getTranslation:R,changeTranslation:O,addActiveNs:async function(e,t){t||r.addActiveNs(e),r.isRunning()&&await N(void 0,e)},loadRecords:D,loadRecord:async function(e){return(await D([e]))[0]},isLoading:k,isLoaded:function(e){const t=r.getLanguage();if(!t)return!1;const n=r.getFallbackLangs(t),a=E(e),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=P(...e),n=R(t);return o.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:A,run:function(){let e;return $(),r.isRunning()||(A()&&i.invalidate(),r.setRunning(!0),o.run(),e=S()),Promise.resolve(e)},stop:function(){r.isRunning()&&(o.stop(),r.setRunning(!1))}}))},R=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=A(e.options,n),t),init(t){const n=(e=>{const t=N({options:e}),n=e=>{const n=t.isRunning();n&&t.stop(),e(),n&&t.run()},a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmmiterActive:t.setEmmiterActive,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,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})(A(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},S=0,D=1,$=2;class C 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 I(e){return/\s/.test(e)}const _=0,U=1,F=2,B=3,M=4,V=new Set([F,U,_]),z="'",K=new Set(["{","}",z]),Y=e=>/[0-9a-zA-Z_]/.test(e);function G(e,t){const[n,a]=function(e){let t=_,n="",a="",r="";const o=[],i=[];let s=0;function l(t){throw new C(t,s,e)}const u=()=>{o.push(n),n=""},c=()=>{""===a&&l(S),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case _:r===z?(n+=r,t=U):"{"===r?(u(),t=B):(n+=r,t=_);break;case U:K.has(r)?(n=n.slice(0,-1)+r,t=F):(n+=r,t=_);break;case F:r===z?t=_:(n+=r,t=F);break;case B:"}"===r?(c(),t=_):I(r)?""!==a&&(c(),t=M):(Y(r)||l(D),a+=r,t=B);break;case M:"}"==r?t=_:I(r)?t=M:l(D)}return V.has(t)||l($),u(),[o,i]}(e),r=[n[0]];for(let o=1;o<n.length;o++){const i=null==t?void 0:t[a[o-1]];if(void 0===i)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);r.push(String(i)),r.push(n[o])}return r.join("")}const W={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},X=({highlightColor:e,highlightWidth:t})=>Object.freeze({initHighlighter:function(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(r),Object.entries(W).forEach((([e,t])=>{o.style[e]=t})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const i=n.getBoundingClientRect();o.style.borderWidth=t+"px",o.style.top=i.top-t+"px",o.style.left=i.left-t+"px",o.style.width=i.width+"px",o.style.height=i.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null===(e=t.highlightEl)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,a)}});function H(e,t){var n;const a=function(e){switch(e.nodeType){case Node.ATTRIBUTE_NODE:return e.ownerElement||void 0;case Node.TEXT_NODE:return e.parentElement||void 0;case Node.DOCUMENT_NODE:case Node.ELEMENT_NODE:return e;default:return}}(t),r=[];if(!a)return r;const o=null===document||void 0===document?void 0:document.evaluate(e,a,void 0,XPathResult.ANY_TYPE);let i;for(;i=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)r.push(i);return r}function J(e){return e.textContent}function q(e,t){e.textContent=t}function Z(e,t){if(e.contains(t))return!0;if(t instanceof Attr){const n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}const Q=(e,t)=>{var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,r=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((e=>{var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return a&&r},ee={capture:!0},te={capture:!0,passive:!0},ne=({highlightKeys:t,elementStore:n,onClick:a,options:r})=>{var o,i;let s,l,u=new Set;const c=(null===(o=r.targetElement)||void 0===o?void 0:o.getRootNode())||document,g=(null===(i=r.targetElement)||void 0===i?void 0:i.ownerDocument)||document,d=e=>{var t;if(s!==e){f();const a=n.get(e);a&&(a.preventClean=!0,null===(t=a.highlight)||void 0===t||t.call(a),s=e)}},f=()=>{var e;const t=n.get(s);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),s=void 0)};function p(){const e=l;let t;if(e&&w()){const a=c.elementFromPoint(e.x,e.y);a&&(t=function(e){return O(e,(e=>n.get(e)))}(a))}d(t)}const v=t=>{var n;w()&&(n=t.target,!Boolean(O(n,(t=>t.id===e))))&&(t.stopPropagation(),t.preventDefault())},h=e=>{var t;t={x:e.clientX,y:e.clientY},l=t,p()},m=()=>{u=new Set,p()},b=e=>{const t=e.key;void 0!==t&&u.add(t),p()},y=e=>{u.delete(e.key),p()},E=()=>{var e;const t=n.get(s);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)},L=e=>{v(e),w()&&s&&(a(e,s),f())};function O(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function w(){for(const e of t)if(!u.has(e))return!1;return!0}return Object.freeze({run:function(){g.addEventListener("blur",m,ee),g.addEventListener("keydown",b,ee),g.addEventListener("keyup",y,ee),g.addEventListener("mousemove",h,te),g.addEventListener("scroll",E,te),g.addEventListener("click",L,ee),g.addEventListener("mouseenter",v,ee),g.addEventListener("mouseover",v,ee),g.addEventListener("mouseout",v,ee),g.addEventListener("mouseleave",v,ee),g.addEventListener("mousedown",v,ee),g.addEventListener("mouseup",v,ee)},stop:function(){g.removeEventListener("blur",m,ee),g.removeEventListener("keydown",b,ee),g.removeEventListener("keyup",y,ee),g.removeEventListener("mousemove",h,te),g.removeEventListener("scroll",E,te),g.removeEventListener("click",L,ee),g.removeEventListener("mouseenter",v,ee),g.removeEventListener("mouseover",v,ee),g.removeEventListener("mouseout",v,ee),g.removeEventListener("mouseleave",v,ee),g.removeEventListener("mousedown",v,ee),g.removeEventListener("mouseup",v,ee)}})},ae=(e,t,r)=>{const o=X({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),i=ne({highlightKeys:e.highlightKeys,elementStore:t,onClick:(e,n)=>{const a=t.get(n);r({event:e,keysAndDefaults:l(a)})},options:e});function s(){return e.targetElement||document.body}function l(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:function(r,i,s){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${n}]`)}(r))return;const l=r;let u=t.get(l);u||(u={nodes:new Map},t.set(l,u),l.setAttribute(a,"true")),u.nodes.set(i,s),o.initHighlighter(l,u)},forEachElement:t.forEachElement,findAll:function(e,n){const a=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>Q({key:e,ns:g(n)},{key:t.key,ns:g(t.ns)})))){a.push(r);break}}})),a},refreshAll:function(){t.forEachElement(((e,n)=>{n.preventClean||(function(e){e.nodes=new Map(function*(e){for(const[t,n]of e.nodes.entries())Z(s(),t)&&(yield[t,n])}(e))}(n),0===n.nodes.size&&function(e,n){var r;n.highlightEl&&(null===(r=n.unhighlight)||void 0===r||r.call(n));e.removeAttribute(a),t.remove(e)}(e,n))}))},run:function(e){e&&i.run()},stop:function(){i.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t))}))}})},re=()=>{let e,n=!1;const a=(()=>{const e=new Map;return Object.freeze({set:function(t,n){e.set(t,n)},get:function(t){return t&&e.get(t)},remove:function(t){return e.delete(t)},forEachElement:function(t){e.forEach(((e,n)=>t(n,e)))}})})(),r=({mouseHighlight:e,options:r,wrapper:i,onClick:l})=>{if(o())return;const u=(e=>Object.freeze({getSuitableParent:function t(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(a):a}}))(r),c=((e,t)=>{const n=e=>H(t.getTextXPath(),e),a=n=>{let a=[];for(const[r,o]of Object.entries(e.tagAttributes))for(const e of o){const o=H(t.getAttributeXPath({tag:r,attribute:e}),n);a=[...a,...o]}return a};return Object.freeze({handleAttributes:a,handleChildList:e=>{let t=[];return t=t.concat(a(e)),t=t.concat(n(e)),t},handleText:n})})(r,i),g=ae(r,a,l);function d(e){for(const t of e){const e=J(t),n=e?i.unwrap(e):null;if(n){const{text:a,keys:r}=n;q(t,a);const o=s(e,r),i=u.getSuitableParent(t);g.register(i,t,o)}}}const f=e=>{H(`./descendant-or-self::*[@${t}]`,e).forEach((e=>{const n=e.getAttributeNode(t),a=u.getSuitableParent(n);g.register(a,n,{oldTextContent:"",keys:[{key:J(n)}],keyAttributeOnly:!0})}))},p=new MutationObserver((e=>{if(n)for(const t of e){let e=[];switch(t.type){case"characterData":e=c.handleText(t.target);break;case"childList":f(t.target),e=c.handleChildList(t.target);break;case"attributes":f(t.target),e=c.handleAttributes(t.target)}d(e),g.refreshAll()}})),v=r.targetElement||document.body;return n=!0,g.run(e),f(v),d(c.handleChildList(v)),p.observe(v,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){n=!1,g.stop(),p.disconnect()},elementRegistry:g,wrapper:i}};return Object.freeze({run(t){e=r(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null===(a=null==e?void 0:(n=e.elementRegistry).forEachElement)||void 0===a||a.call(n,t)},highlight(t,n){const a=(null==e?void 0:e.elementRegistry.findAll(t,n))||[];return a.forEach((e=>{var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight(){a.forEach((e=>{var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})},oe=["‌","‍"],ie=RegExp(`([${oe.join("")}]{9})+`,"gu"),se=e=>{const t=(e=>Array.from((new TextEncoder).encode(e)))(e).map(Number),n=t.map((e=>(e=>{const t=8-e.length;return"0".repeat(t)+e})(e.toString(2))+"0")).join("");return Array.from(n).map((e=>oe[Number(e)])).join("")},le=e=>{const t=Array.from(e).map((e=>oe.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},ue=()=>{const e=(()=>{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]})})(),t=e=>JSON.parse(e||"{}");return Object.freeze({unwrap:n=>{const a=[],r=(e=>{var t;const n=null===(t=e.match(ie))||void 0===t?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(le))||[]})(n);r.forEach((n=>{const[r]=(e=>{const t=[];for(const n of e)t.push(n.codePointAt(0));return t})(n),o=e.numberToValue(r),{k:i,d:s,n:l}=t(o);a.push({key:i,defaultValue:s,ns:l})}));const o=(e=>e.replace(ie,""))(n);return{text:o,keys:a}},wrap:({key:t,defaultValue:n,translation:a,ns:r})=>{const o=(e=>{const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)})({key:t,ns:r,defaultValue:n}),i=e.valueToNumber(o),s=a||"",l=se(String.fromCodePoint(i));return"string"==typeof s?s+l:s},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${oe[0]}${oe[0]}') or contains(., '${oe[1]}${oe[0]}')]`,getAttributeXPath:({tag:e,attribute:t})=>`descendant-or-self::${e}/@${t}[contains(., '${oe[0]}${oe[0]}') or contains(., '${oe[1]}${oe[0]}')]`})};function ce(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}const ge=({inputPrefix:e,inputSuffix:t,translate:n})=>{function a(e){const{key:t,params:a,defaultValue:r,ns:o}=function(e){let t=!1,n="",a="",r="KEY";const o={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{o.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==r||","!==s?"KEY"!==r||"|"!==s?"NAMESPACE"!==r||","!==s?"KEY"!==r||":"!==s?"DEFAULT_VALUE"!==r||":"!==s?"PARAM_NAME"!==r||":"!==s?"PARAM_VALUE"!==r||","!==s?n+=s:(r="PARAM_NAME",o.params[a]=n,n=""):(r="PARAM_VALUE",a=n,n=""):(r="PARAM_NAME",o.defaultValue=n,n=""):(r="PARAM_NAME",o.key=n,n=""):(r="DEFAULT_VALUE",i(n),n=""):(r="NAMESPACE",o.key=n,n=""):(r="DEFAULT_VALUE",o.key=n,n=""):t=!0;return"KEY"===r&&(o.key=n),"DEFAULT_VALUE"===r&&(o.defaultValue=n),"PARAM_VALUE"===r&&(o.params[a]=n),"NAMESPACE"===r&&i(n),o}(e);return{translated:n({key:t,params:a,defaultValue:r,ns:o,noWrap:!0}),key:t,params:a,defaultValue:r,ns:o}}const r=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=e=>"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:r,ns:i})=>{let s=Object.entries(a||{}).map((([e,t])=>`${o(e)}:${o(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==r?`,${o(r)}`:"",u="string"==typeof i?[i]:i,c=(null==u?void 0:u.length)?`|${u.map((e=>o(e))).join("|")}`:"";return`${e}${o(n)}${c}${l}${s}${t}`},unwrap:n=>{const o=new RegExp(`(\\\\?)(${r(e)}(.*?)${r(t)})`,"gs"),i=[];let s,l=!1,u=0,c="";for(;null!==(s=o.exec(n));){let e=s[1];const[t,r,o,g]=s,{index:d,input:f}=s;if(c+=f.substr(u,d-u),u=d+t.length,"\\"===e){if(!ce(d,n)){c+=o;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:[]}},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${e}') and contains(., '${t}')]`,getAttributeXPath:({tag:n,attribute:a})=>`descendant-or-self::${n}/@${a}[contains(., '${e}') and contains(., '${t}')]`})},de="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function fe(e){const t=de.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function pe(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,r=0;const o=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|fe(e[i]),n+=5,n>=8&&(o[r++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",r=Math.pow(2,16)-1;for(let e=0;e<n;e+=r)e+r>n&&(r=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+r));return a}(o.buffer)}function ve(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=pe(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}function he({message:e,recievingMessage:t,data:n,attempts:a=1}){let r=!1;const o=()=>new Promise(((a,r)=>{const o=function(e,t){const n=n=>{var a,r;e.includes(null===(a=n.data)||void 0===a?void 0:a.type)&&t(null===(r=n.data)||void 0===r?void 0:r.data)};return window.addEventListener("message",n,!1),{unsubscribe:()=>{window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(i),s(),a(e)}));window.postMessage({type:e,data:n},window.origin);const i=setTimeout((function(){s(),r()}),300);function s(){o.unsubscribe()}}));return{cancel:()=>r=!0,promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await o()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}const me="tolgee-in-context-tools.umd.min.js",be="@tolgee/in-context-tools",ye="InContextTools",Ee="https://cdn.jsdelivr.net/npm";let Le=null;function Oe(e){var t;return Le||(Le=(t=`${Ee}/@tolgee/web@${e}/dist/${me}`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.body.appendChild(a)}))).then((()=>window[be][ye]))),Le}const we="__tolgee_apiKey",ke="__tolgee_apiUrl";function Ae(){const e=sessionStorage.getItem(we)||void 0,t=sessionStorage.getItem(ke)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function je(){sessionStorage.removeItem(we),sessionStorage.removeItem(ke)}exports.BrowserExtensionPlugin=()=>e=>e,"undefined"!=typeof window&&(exports.BrowserExtensionPlugin=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=he({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(je)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ae()&&(async()=>{const e=await Oe("5.4.2");return t=>{const n=Ae();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 xe="__tolgee_currentLanguage";const Te=e=>e.endsWith("/")?e.slice(0,-1):e,Pe={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Te(n)}/${e}/${t}.json`:`${Te(n)}/${t}.json`,getData:e=>e.json(),headers:{Accept:"application/json"}},Ne=e=>{const t=Object.assign(Object.assign(Object.assign({},Pe),e),{headers:Object.assign(Object.assign({},Pe.headers),null==e?void 0:e.headers)}),{prefix:n,getPath:a,getData:r,headers:o}=t,i=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}(t,["prefix","getPath","getData","headers"]);return{getRecord({namespace:e,language:t}){const s=a({namespace:e,language:t,prefix:n});return fetch(s,Object.assign({headers:o},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return r(e)}))}}};exports.BackendFetch=e=>(t,n)=>(n.addBackend(Ne(e)),t),exports.DEVTOOLS_ID=e,exports.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:r}){var o;const i=null!==(o=ve(t))&&void 0!==o?o:r;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===r)throw new Error("You need to specify 'projectId' when using PAT key");return fetch(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),exports.DevTools=()=>e=>e,exports.FormatSimple=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>G(e,t)}),e),exports.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){i("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),r=a(window.navigator.language);return e.find((e=>a(e)===r))||void 0}}),e),exports.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(i("LanguageStorage"),localStorage.getItem(xe)||void 0),setLanguage(e){i("LanguageStorage"),localStorage.setItem(xe,e)}}),e),exports.ObserverPlugin=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=re();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=ge({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run(Object.assign(Object.assign({},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&&q(t,n.text)}}))},outputNotFormattable:!0}))})):t.setObserver((()=>{const e=re();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=ue();e.run(Object.assign(Object.assign({},t),{wrapper:n}))},retranslate(){},outputNotFormattable:!1}))})),e),exports.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",exports.TOLGEE_ATTRIBUTE_NAME=a,exports.TOLGEE_RESTRICT_ATTRIBUTE=n,exports.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=t,exports.Tolgee=()=>R().use(exports.BrowserExtensionPlugin()),exports.TolgeeCore=R,exports.getFallback=g,exports.getFallbackArray=d,exports.getProjectIdFromApiKey=ve,exports.getTranslateProps=P;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="__tolgee_dev_tools",t="data-tolgee-key-only",n="data-tolgee-restricted",a="_tolgee",r="_tolgee-highlighter";function o(){var e,t;return void 0===(null===(t=null===(e=globalThis.window)||void 0===e?void 0:e.document)||void 0===t?void 0:t.createElement)}function i(e){if(o())throw new Error(`${e}: Can't run on the server`)}function s(e,t){return{oldTextContent:e,keys:t}}function l(e){return Boolean(e&&"function"==typeof e.then)}const u=(e,t)=>l(e)?Promise.resolve(e).then(t):t(e),c=e=>`Tolgee: You need to specify '${e}' option`;function g(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function d(e){return g(e)||[]}function f(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?d(t):d(null==t?void 0:t[e]);var n}function p(e){return Array.from(new Set(e))}function v(e){return e?e.replace(/\/+$/,""):e}const h=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})))}})},m=(e,t,n)=>{const a=new Set,r=new Set;let o=[];const i=()=>{if(0===o.length)return;const e=o;o=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));(e=>{const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))})(n?Array.from(n.keys()):void 0)};return Object.freeze({listenSome:e=>{const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(d(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a},listen:e=>{a.add(e);return{unsubscribe:()=>{a.delete(e)}}},emit:(t,n)=>{e()&&(o.push(t),n?setTimeout(i,0):i())}})},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},y=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},E=({language:e,namespace:t})=>t?`${e}:${t}`:e,L=(e,t,n,a,r,o,i)=>{const s=new Map,l=new Map;let u={},c=0;function g(t,n,a){const r=E(t);l.set(r,{data:b(n),version:a}),e.emit(t)}function f(e,t){g(e,t,c)}function v(e,t=!1){const n=l.get(E(e));return n&&t?n.version===c:Boolean(n)}function h(e){var t;return null===(t=l.get(E(a(e))))||void 0===t?void 0:t.data}function m(e){let n;if(!n){const t=u[E(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n}return Object.freeze({addStaticData:function(e){e&&(u=Object.assign(Object.assign({},u),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=y(e),a=l.get(e);a&&0!==a.version||g(n,t,0)}})))},invalidate:function(){s.clear(),c+=1},addRecord:f,exists:v,getRecord:h,getTranslation:function(e,t){var n;return null===(n=l.get(E(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(E({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return p(e)},getTranslationFallback:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(E({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation:function(t,n,a){var r;const o=null===(r=l.get(E(t)))||void 0===r?void 0:r.data;null==o||o.set(n,a),e.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching:function(e){if(r())return!0;if(void 0===e)return s.size>0;const t=d(e);return Boolean(Array.from(s.keys()).find((e=>t.includes(y(e).namespace))))},isLoading:function(e,t){const n=d(t);return Boolean(r()||Array.from(s.keys()).find((t=>{const a=y(t);return(!n.length||n.includes(a.namespace))&&!v({namespace:a.namespace,language:e})})))},loadRecords:async function(e,t){const r=e.map((e=>{const r=a(e),o=E(r),i=s.get(o);if(i)return{new:!1,promise:i,keyObject:r,cacheKey:o};const l=function(e,t){var a;let r;return t&&(r=null===(a=n(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),r||(r=m(e)),r}(r,t)||Promise.resolve(void 0);return s.set(o,l),{new:!0,promise:l,keyObject:r,cacheKey:o}}));o.notify(),i.notify();const l=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=s.get(e.cacheKey)!==e.promise;if(e.new&&!n){s.delete(e.cacheKey);const n=l[t];n?f(e.keyObject,n):h(e.keyObject)||f(e.keyObject,{})}})),o.notify(),i.notify(),r.map((e=>h(e.keyObject)))},getAllRecords:function(){return Array.from(l.entries()).map((([e,t])=>Object.assign(Object.assign({},y(e)),{data:t.data})))}})};function O(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const w="invalid",k={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"]},observerType:"invisible",onFormatError:w,apiUrl:"https://app.tolgee.io"},A=(...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},j=(e,t)=>{const n=A(k,null==t?void 0:t.initialOptions,e);return n.apiUrl=v(n.apiUrl),{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}},x=(e,t,n,a,r,o)=>{const i={ui:void 0},s={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},c=async({keysAndDefaults:e,event:t})=>{var n;const o=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,ns:a({key:e,ns:t}),translation:r({key:e,ns:t})})));null===(n=s.ui)||void 0===n||n.handleElementClick(o,t)},g=(e,t)=>{var n,a;return(null===(a=null===(n=s.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},d=e=>{const t=r({key:e.key,ns:e.ns});return j(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))},f=e=>{s.observer=null==e?void 0:e()},p=()=>Boolean(s.observer),v=e=>{e&&s.formatters.push(e)},h=e=>{s.finalFormatter=e},m=e=>{i.ui=e},b=()=>Boolean(i.ui),y=e=>{s.languageStorage=e},E=e=>{s.languageDetector=e},L=e=>{e&&s.backends.push(e)},k=e=>{s.devBackend=e},A=()=>s.devBackend;function j(n){var a,{formatEnabled:r}=n,o=O(n,["formatEnabled"]);const{key:i,translation:l,defaultValue:u,noWrap:c,params:g,orEmpty:d,ns:f}=o,p=l||u;let v=p||(d?"":i);const h=e(),m=r||!(null===(a=s.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>s.observer&&!c?s.observer.wrap({key:i,translation:e,defaultValue:u,params:g,ns:f}):e;v=b(v);try{if(p&&h&&m)for(const e of s.formatters)v=e.format({translation:v,language:h,params:g});s.finalFormatter&&p&&h&&m&&(v=s.finalFormatter.format({translation:v,language:h,params:g}))}catch(e){console.error(e);const n=("string"==typeof(y=e)?y:"string"==typeof(null==y?void 0:y.message)?y.message:void 0)||w,a=t().onFormatError,r=typeof a;v="string"===r?a:"function"===r?a(n,o):w,v=b(v)}var y;return v}return Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:h,addFormatter:v,setObserver:f,hasObserver:p,setUi:m,hasUi:b,setDevBackend:k,addBackend:L,setLanguageDetector:E,setLanguageStorage:y}))},formatTranslation:j,getDevBackend:A,getBackendRecord:({language:e,namespace:t})=>{for(const n of s.backends){const a=n.getRecord({language:e,namespace:t});if(l(a))return null==a?void 0:a.catch((e=>(console.error(e),{})));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;const{apiKey:r,apiUrl:o,projectId:i}=t();return null===(a=s.devBackend)||void 0===a?void 0:a.getRecord({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:n})},getLanguageDetector:()=>s.languageDetector,getLanguageStorage:()=>s.languageStorage,getInitialLanguage:()=>{var e;const t=n(),a=null===(e=s.languageStorage)||void 0===e?void 0:e.getLanguage();return u(a,(e=>t&&!t.includes(e)||!e?(()=>{if(!s.languageDetector)return;const e=n();return s.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var t;null===(t=s.languageStorage)||void 0===t||t.setLanguage(e)},run:()=>{var e,n;const{apiKey:a,apiUrl:r,projectId:l,observerOptions:u}=t();s.ui=null===(e=i.ui)||void 0===e?void 0:e.call(i,{apiKey:a,apiUrl:r,projectId:l,highlight:g,changeTranslation:o}),null===(n=s.observer)||void 0===n||n.run({mouseHighlight:!0,options:u,translate:d,onClick:c})},stop:()=>{var e;s.ui=void 0,null===(e=s.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=s.observer)||void 0===e||e.retranslate()},highlight:g,unwrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:function(){return Boolean(A())}})},T=(e,t,n)=>{let a=e;return Object.freeze({init:function(e){a=e},notify:function(){const e=t();a!==e&&n(e),a=e}})};const P=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:r}=e,o=O(e,["ns","noWrap","orEmpty","params"]);const i={ns:t,noWrap:n,orEmpty:a};return Object.assign(Object.assign({},i),{params:Object.assign({},o)})}(n)),a)),a},N=({options:e})=>{const t=((e,t)=>{let n=!0;function a(){return n}const r=h(a),o=h(a),i=h(a),s=h(a),l=h(a),u=h(a),c=h(a),g=m(a,e,t);return l.listen((()=>g.emit())),o.listen((()=>g.emit())),c.listen((({value:e})=>{g.emit([e.namespace],!0)})),Object.freeze({onPendingLanguageChange:r,onLanguageChange:o,onLoadingChange:i,onFetchingChange:s,onInitialLoaded:l,onRunningChange:u,onCacheChange:c,onUpdate:g,setEmmiterActive:function(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return r.listen(t);case"language":return o.listen(t);case"loading":return i.listen(t);case"fetching":return s.listen(t);case"initialLoad":return l.listen(t);case"running":return u.listen(t);case"cache":return c.listen(t);case"update":return g.listen(t)}}})})(s,g),n=T(!1,(()=>i.isFetching()),t.onFetchingChange.emit),a=T(!1,(()=>k()),t.onLoadingChange.emit),r=((e,t,n)=>{let a,r=j();function o(){return r.language||r.initialOptions.language}function i(){return Object.assign(Object.assign({},r.initialOptions),a)}return Object.freeze({init:function(e){r=j(e,r)},isRunning:function(){return r.isRunning},setRunning:function(e){r.isRunning!==e&&(r.isRunning=e,n.emit(e))},isInitialLoading:function(){return r.isInitialLoading},setInitialLoading:function(e){r.isInitialLoading=e},getLanguage:o,setLanguage:function(t){r.language!==t&&(r.language=t,e.emit(t))},getPendingLanguage:function(){return r.pendingLanguage||o()},setPendingLanguage:function(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,t.emit(e))},getInitialOptions:i,addActiveNs:function(e){d(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t?r.activeNamespaces.set(e,t+1):r.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){d(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t&&t>1?r.activeNamespaces.set(e,t-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return p([...r.initialOptions.ns||[r.initialOptions.defaultNs],...d(r.initialOptions.fallbackNs),...r.activeNamespaces.keys()])},getFallbackLangs:function(e){const t=e||o();return t?p([t,...f(t,r.initialOptions.fallbackLanguage)]):[]},getFallbackNs:function(){return d(r.initialOptions.fallbackNs)},getDefaultNs:function(e){return void 0===e?r.initialOptions.defaultNs:e},getAvailableLanguages:function(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>y(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?i().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){a=e?Object.assign(Object.assign({},e),{apiUrl:v(e.apiUrl)}):void 0}})})(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),o=x(r.getLanguage,r.getInitialOptions,r.getAvailableLanguages,(function({key:e,ns:t}){const n=r.getFallbackLangs(),a=b(t||void 0);return i.getTranslationNs(a,n,e)}),R,O),i=L(t.onCacheChange,o.getBackendRecord,o.getBackendDevRecord,r.withDefaultNs,r.isInitialLoading,n,a);function s(){return r.getFallbackNs()}function g(e){return r.getDefaultNs(e)}function b(e){return[...d(g(e)),...s()]}function E(e){return[...d(e||g()),...r.getRequiredNamespaces()]}function O(e,t,n){const a=r.withDefaultNs(e),o=i.getTranslation(a,t);return i.changeTranslation(a,t,n),{revert:()=>{i.changeTranslation(a,t,o)}}}function w(e){r.init(e),i.addStaticData(r.getInitialOptions().staticData)}function k(e){return i.isLoading(r.getLanguage(),e)}function A(){return Boolean(r.getInitialOptions().apiKey&&r.getInitialOptions().apiUrl)}function N(e,t){const n=function(e,t){const n=r.getFallbackLangs(e),a=E(t),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}(e,t);if(n.length)return u(D(n),(()=>{}))}function R({key:e,ns:t}){const n=b(t||void 0),a=r.getFallbackLangs();return i.getTranslationFallback(n,a,e)}function S(){const e=u(function(){if(r.getLanguage())return;if(!r.getInitialOptions().defaultLanguage)throw new Error(c("defaultLanguage"));const e=o.getInitialLanguage();return u(e,(e=>{const t=e||r.getInitialOptions().defaultLanguage;t&&r.setLanguage(t)}))}(),(()=>N()));if(l(e))return r.setInitialLoading(!0),n.notify(),a.notify(),Promise.resolve(e).then((()=>{r.setInitialLoading(!1),n.notify(),a.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}function D(e){return i.loadRecords(e,A())}e&&w(e),t.onUpdate.listen((()=>{r.isRunning()&&o.retranslate()}));const $=()=>{const e=o.getLanguageDetector()||o.getLanguageStorage();if(e){if(!r.getAvailableLanguages())throw new Error(c("availableLanguages"))}if(!r.getLanguage()&&!r.getInitialOptions().defaultLanguage)throw e?new Error(c("defaultLanguage")):new Error(c("language"))};return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),o),i),{init:w,changeLanguage:async function(e){r.getPendingLanguage()===e&&r.getLanguage()===e||(r.setPendingLanguage(e),r.isRunning()&&await N(e),e===r.getPendingLanguage()&&(r.setLanguage(e),o.setStoredLanguage(e)))},getTranslation:R,changeTranslation:O,addActiveNs:async function(e,t){t||r.addActiveNs(e),r.isRunning()&&await N(void 0,e)},loadRecords:D,loadRecord:async function(e){return(await D([e]))[0]},isLoading:k,isLoaded:function(e){const t=r.getLanguage();if(!t)return!1;const n=r.getFallbackLangs(t),a=E(e),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=P(...e),n=R(t);return o.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:A,run:function(){let e;return $(),r.isRunning()||(A()&&i.invalidate(),r.setRunning(!0),o.run(),e=S()),Promise.resolve(e)},stop:function(){r.isRunning()&&(o.stop(),r.setRunning(!1))}}))},R=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=A(e.options,n),t),init(t){const n=(e=>{const t=N({options:e}),n=e=>{const n=t.isRunning();n&&t.stop(),e(),n&&t.run()},a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmmiterActive:t.setEmmiterActive,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,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})(A(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},S=0,D=1,$=2;class C 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 I(e){return/\s/.test(e)}const _=0,U=1,F=2,B=3,M=4,V=new Set([F,U,_]),z="'",K=new Set(["{","}",z]),Y=e=>/[0-9a-zA-Z_]/.test(e);function G(e,t){const[n,a]=function(e){let t=_,n="",a="",r="";const o=[],i=[];let s=0;function l(t){throw new C(t,s,e)}const u=()=>{o.push(n),n=""},c=()=>{""===a&&l(S),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case _:r===z?(n+=r,t=U):"{"===r?(u(),t=B):(n+=r,t=_);break;case U:K.has(r)?(n=n.slice(0,-1)+r,t=F):(n+=r,t=_);break;case F:r===z?t=_:(n+=r,t=F);break;case B:"}"===r?(c(),t=_):I(r)?""!==a&&(c(),t=M):(Y(r)||l(D),a+=r,t=B);break;case M:"}"==r?t=_:I(r)?t=M:l(D)}return V.has(t)||l($),u(),[o,i]}(e),r=[n[0]];for(let o=1;o<n.length;o++){const i=null==t?void 0:t[a[o-1]];if(void 0===i)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);r.push(String(i)),r.push(n[o])}return r.join("")}const W={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},X=({highlightColor:e,highlightWidth:t})=>Object.freeze({initHighlighter:function(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(r),Object.entries(W).forEach((([e,t])=>{o.style[e]=t})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const i=n.getBoundingClientRect();o.style.borderWidth=t+"px",o.style.top=i.top-t+"px",o.style.left=i.left-t+"px",o.style.width=i.width+"px",o.style.height=i.height+"px"}}(n,a),function(e,t){t.unhighlight=()=>{var e;null===(e=t.highlightEl)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,a)}});function H(e,t){var n;const a=function(e){switch(e.nodeType){case Node.ATTRIBUTE_NODE:return e.ownerElement||void 0;case Node.TEXT_NODE:return e.parentElement||void 0;case Node.DOCUMENT_NODE:case Node.ELEMENT_NODE:return e;default:return}}(t),r=[];if(!a)return r;const o=null===document||void 0===document?void 0:document.evaluate(e,a,void 0,XPathResult.ANY_TYPE);let i;for(;i=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)r.push(i);return r}function J(e){return e.textContent}function q(e,t){e.textContent=t}function Z(e,t){if(e.contains(t))return!0;if(t instanceof Attr){const n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}const Q=(e,t)=>{var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,r=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((e=>{var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return a&&r},ee={capture:!0},te={capture:!0,passive:!0},ne=({highlightKeys:t,elementStore:n,onClick:a,options:r})=>{var o,i;let s,l,u=new Set;const c=(null===(o=r.targetElement)||void 0===o?void 0:o.getRootNode())||document,g=(null===(i=r.targetElement)||void 0===i?void 0:i.ownerDocument)||document,d=e=>{var t;if(s!==e){f();const a=n.get(e);a&&(a.preventClean=!0,null===(t=a.highlight)||void 0===t||t.call(a),s=e)}},f=()=>{var e;const t=n.get(s);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),s=void 0)};function p(){const e=l;let t;if(e&&w()){const a=c.elementFromPoint(e.x,e.y);a&&(t=function(e){return O(e,(e=>n.get(e)))}(a))}d(t)}const v=t=>{var n;w()&&(n=t.target,!Boolean(O(n,(t=>t.id===e))))&&(t.stopPropagation(),t.preventDefault())},h=e=>{var t;t={x:e.clientX,y:e.clientY},l=t,p()},m=()=>{u=new Set,p()},b=e=>{const t=e.key;void 0!==t&&u.add(t),p()},y=e=>{u.delete(e.key),p()},E=()=>{var e;const t=n.get(s);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)},L=e=>{v(e),w()&&s&&(a(e,s),f())};function O(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function w(){for(const e of t)if(!u.has(e))return!1;return!0}return Object.freeze({run:function(){g.addEventListener("blur",m,ee),g.addEventListener("keydown",b,ee),g.addEventListener("keyup",y,ee),g.addEventListener("mousemove",h,te),g.addEventListener("scroll",E,te),g.addEventListener("click",L,ee),g.addEventListener("mouseenter",v,ee),g.addEventListener("mouseover",v,ee),g.addEventListener("mouseout",v,ee),g.addEventListener("mouseleave",v,ee),g.addEventListener("mousedown",v,ee),g.addEventListener("mouseup",v,ee)},stop:function(){g.removeEventListener("blur",m,ee),g.removeEventListener("keydown",b,ee),g.removeEventListener("keyup",y,ee),g.removeEventListener("mousemove",h,te),g.removeEventListener("scroll",E,te),g.removeEventListener("click",L,ee),g.removeEventListener("mouseenter",v,ee),g.removeEventListener("mouseover",v,ee),g.removeEventListener("mouseout",v,ee),g.removeEventListener("mouseleave",v,ee),g.removeEventListener("mousedown",v,ee),g.removeEventListener("mouseup",v,ee)}})},ae=(e,t,r)=>{const o=X({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),i=ne({highlightKeys:e.highlightKeys,elementStore:t,onClick:(e,n)=>{const a=t.get(n);r({event:e,keysAndDefaults:l(a)})},options:e});function s(){return e.targetElement||document.body}function l(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:function(r,i,s){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${n}]`)}(r))return;const l=r;let u=t.get(l);u||(u={nodes:new Map},t.set(l,u),l.setAttribute(a,"true")),u.nodes.set(i,s),o.initHighlighter(l,u)},forEachElement:t.forEachElement,findAll:function(e,n){const a=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>Q({key:e,ns:g(n)},{key:t.key,ns:g(t.ns)})))){a.push(r);break}}})),a},refreshAll:function(){t.forEachElement(((e,n)=>{n.preventClean||(function(e){e.nodes=new Map(function*(e){for(const[t,n]of e.nodes.entries())Z(s(),t)&&(yield[t,n])}(e))}(n),0===n.nodes.size&&function(e,n){var r;n.highlightEl&&(null===(r=n.unhighlight)||void 0===r||r.call(n));e.removeAttribute(a),t.remove(e)}(e,n))}))},run:function(e){e&&i.run()},stop:function(){i.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t))}))}})},re=()=>{let e,n=!1;const a=(()=>{const e=new Map;return Object.freeze({set:function(t,n){e.set(t,n)},get:function(t){return t&&e.get(t)},remove:function(t){return e.delete(t)},forEachElement:function(t){e.forEach(((e,n)=>t(n,e)))}})})(),r=({mouseHighlight:e,options:r,wrapper:i,onClick:l})=>{if(o())return;const u=(e=>Object.freeze({getSuitableParent:function t(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(a):a}}))(r),c=((e,t)=>{const n=e=>H(t.getTextXPath(),e),a=n=>{let a=[];for(const[r,o]of Object.entries(e.tagAttributes))for(const e of o){const o=H(t.getAttributeXPath({tag:r,attribute:e}),n);a=[...a,...o]}return a};return Object.freeze({handleAttributes:a,handleChildList:e=>{let t=[];return t=t.concat(a(e)),t=t.concat(n(e)),t},handleText:n})})(r,i),g=ae(r,a,l);function d(e){for(const t of e){const e=J(t),n=e?i.unwrap(e):null;if(n){const{text:a,keys:r}=n;q(t,a);const o=s(e,r),i=u.getSuitableParent(t);g.register(i,t,o)}}}const f=e=>{H(`./descendant-or-self::*[@${t}]`,e).forEach((e=>{const n=e.getAttributeNode(t),a=u.getSuitableParent(n);g.register(a,n,{oldTextContent:"",keys:[{key:J(n)}],keyAttributeOnly:!0})}))},p=new MutationObserver((e=>{if(n)for(const t of e){let e=[];switch(t.type){case"characterData":e=c.handleText(t.target);break;case"childList":f(t.target),e=c.handleChildList(t.target);break;case"attributes":f(t.target),e=c.handleAttributes(t.target)}d(e),g.refreshAll()}})),v=r.targetElement||document.body;return n=!0,g.run(e),f(v),d(c.handleChildList(v)),p.observe(v,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){n=!1,g.stop(),p.disconnect()},elementRegistry:g,wrapper:i}};return Object.freeze({run(t){e=r(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null===(a=null==e?void 0:(n=e.elementRegistry).forEachElement)||void 0===a||a.call(n,t)},highlight(t,n){const a=(null==e?void 0:e.elementRegistry.findAll(t,n))||[];return a.forEach((e=>{var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight(){a.forEach((e=>{var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})},oe=["‌","‍"],ie=RegExp(`([${oe.join("")}]{9})+`,"gu"),se=e=>{const t=(e=>Array.from((new TextEncoder).encode(e)))(e).map(Number),n=t.map((e=>(e=>{const t=8-e.length;return"0".repeat(t)+e})(e.toString(2))+"0")).join("");return Array.from(n).map((e=>oe[Number(e)])).join("")},le=e=>{const t=Array.from(e).map((e=>oe.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},ue=()=>{const e=(()=>{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]})})(),t=e=>JSON.parse(e||"{}");return Object.freeze({unwrap:n=>{const a=[],r=(e=>{var t;const n=null===(t=e.match(ie))||void 0===t?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(le))||[]})(n);r.forEach((n=>{const[r]=(e=>{const t=[];for(const n of e)t.push(n.codePointAt(0));return t})(n),o=e.numberToValue(r),{k:i,d:s,n:l}=t(o);a.push({key:i,defaultValue:s,ns:l})}));const o=(e=>e.replace(ie,""))(n);return{text:o,keys:a}},wrap:({key:t,defaultValue:n,translation:a,ns:r})=>{const o=(e=>{const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)})({key:t,ns:r,defaultValue:n}),i=e.valueToNumber(o),s=a||"",l=se(String.fromCodePoint(i));return"string"==typeof s?s+l:s},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${oe[0]}${oe[0]}') or contains(., '${oe[1]}${oe[0]}')]`,getAttributeXPath:({tag:e,attribute:t})=>`descendant-or-self::${e}/@${t}[contains(., '${oe[0]}${oe[0]}') or contains(., '${oe[1]}${oe[0]}')]`})};function ce(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}const ge=({inputPrefix:e,inputSuffix:t,translate:n})=>{function a(e){const{key:t,params:a,defaultValue:r,ns:o}=function(e){let t=!1,n="",a="",r="KEY";const o={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{o.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==r||","!==s?"KEY"!==r||"|"!==s?"NAMESPACE"!==r||","!==s?"KEY"!==r||":"!==s?"DEFAULT_VALUE"!==r||":"!==s?"PARAM_NAME"!==r||":"!==s?"PARAM_VALUE"!==r||","!==s?n+=s:(r="PARAM_NAME",o.params[a]=n,n=""):(r="PARAM_VALUE",a=n,n=""):(r="PARAM_NAME",o.defaultValue=n,n=""):(r="PARAM_NAME",o.key=n,n=""):(r="DEFAULT_VALUE",i(n),n=""):(r="NAMESPACE",o.key=n,n=""):(r="DEFAULT_VALUE",o.key=n,n=""):t=!0;return"KEY"===r&&(o.key=n),"DEFAULT_VALUE"===r&&(o.defaultValue=n),"PARAM_VALUE"===r&&(o.params[a]=n),"NAMESPACE"===r&&i(n),o}(e);return{translated:n({key:t,params:a,defaultValue:r,ns:o,noWrap:!0}),key:t,params:a,defaultValue:r,ns:o}}const r=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=e=>"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:r,ns:i})=>{let s=Object.entries(a||{}).map((([e,t])=>`${o(e)}:${o(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==r?`,${o(r)}`:"",u="string"==typeof i?[i]:i,c=(null==u?void 0:u.length)?`|${u.map((e=>o(e))).join("|")}`:"";return`${e}${o(n)}${c}${l}${s}${t}`},unwrap:n=>{const o=new RegExp(`(\\\\?)(${r(e)}(.*?)${r(t)})`,"gs"),i=[];let s,l=!1,u=0,c="";for(;null!==(s=o.exec(n));){let e=s[1];const[t,r,o,g]=s,{index:d,input:f}=s;if(c+=f.substr(u,d-u),u=d+t.length,"\\"===e){if(!ce(d,n)){c+=o;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:[]}},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${e}') and contains(., '${t}')]`,getAttributeXPath:({tag:n,attribute:a})=>`descendant-or-self::${n}/@${a}[contains(., '${e}') and contains(., '${t}')]`})},de="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function fe(e){const t=de.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function pe(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,r=0;const o=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|fe(e[i]),n+=5,n>=8&&(o[r++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",r=Math.pow(2,16)-1;for(let e=0;e<n;e+=r)e+r>n&&(r=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+r));return a}(o.buffer)}function ve(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=pe(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}function he({message:e,recievingMessage:t,data:n,attempts:a=1}){let r=!1;const o=()=>new Promise(((a,r)=>{const o=function(e,t){const n=n=>{var a,r;e.includes(null===(a=n.data)||void 0===a?void 0:a.type)&&t(null===(r=n.data)||void 0===r?void 0:r.data)};return window.addEventListener("message",n,!1),{unsubscribe:()=>{window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(i),s(),a(e)}));window.postMessage({type:e,data:n},window.origin);const i=setTimeout((function(){s(),r()}),300);function s(){o.unsubscribe()}}));return{cancel:()=>r=!0,promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await o()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}const me="tolgee-in-context-tools.umd.min.js",be="@tolgee/in-context-tools",ye="InContextTools",Ee="https://cdn.jsdelivr.net/npm";let Le=null;function Oe(e){var t;return Le||(Le=(t=`${Ee}/@tolgee/web@${e}/dist/${me}`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.body.appendChild(a)}))).then((()=>window[be][ye]))),Le}const we="__tolgee_apiKey",ke="__tolgee_apiUrl";function Ae(){const e=sessionStorage.getItem(we)||void 0,t=sessionStorage.getItem(ke)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function je(){sessionStorage.removeItem(we),sessionStorage.removeItem(ke)}exports.BrowserExtensionPlugin=()=>e=>e,"undefined"!=typeof window&&(exports.BrowserExtensionPlugin=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=he({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(je)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ae()&&(async()=>{const e=await Oe("5.4.3-prerelease.9ea3f1fa.0");return t=>{const n=Ae();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 xe="__tolgee_currentLanguage";const Te=e=>e.endsWith("/")?e.slice(0,-1):e,Pe={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Te(n)}/${e}/${t}.json`:`${Te(n)}/${t}.json`,getData:e=>e.json(),headers:{Accept:"application/json"}},Ne=e=>{const t=Object.assign(Object.assign(Object.assign({},Pe),e),{headers:Object.assign(Object.assign({},Pe.headers),null==e?void 0:e.headers)}),{prefix:n,getPath:a,getData:r,headers:o}=t,i=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}(t,["prefix","getPath","getData","headers"]);return{getRecord({namespace:e,language:t}){const s=a({namespace:e,language:t,prefix:n});return fetch(s,Object.assign({headers:o},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return r(e)}))}}};exports.BackendFetch=e=>(t,n)=>(n.addBackend(Ne(e)),t),exports.DEVTOOLS_ID=e,exports.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:r}){var o;const i=null!==(o=ve(t))&&void 0!==o?o:r;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===r)throw new Error("You need to specify 'projectId' when using PAT key");return fetch(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),exports.DevTools=()=>e=>e,exports.FormatSimple=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>G(e,t)}),e),exports.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){i("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),r=a(window.navigator.language);return e.find((e=>a(e)===r))||void 0}}),e),exports.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(i("LanguageStorage"),localStorage.getItem(xe)||void 0),setLanguage(e){i("LanguageStorage"),localStorage.setItem(xe,e)}}),e),exports.ObserverPlugin=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=re();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=ge({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run(Object.assign(Object.assign({},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&&q(t,n.text)}}))},outputNotFormattable:!0}))})):t.setObserver((()=>{const e=re();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=ue();e.run(Object.assign(Object.assign({},t),{wrapper:n}))},retranslate(){},outputNotFormattable:!1}))})),e),exports.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",exports.TOLGEE_ATTRIBUTE_NAME=a,exports.TOLGEE_RESTRICT_ATTRIBUTE=n,exports.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=t,exports.Tolgee=()=>R().use(exports.BrowserExtensionPlugin()),exports.TolgeeCore=R,exports.getFallback=g,exports.getFallbackArray=d,exports.getProjectIdFromApiKey=ve,exports.getTranslateProps=P;
//# sourceMappingURL=tolgee-web.production.cjs.min.js.map

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

const e="__tolgee_dev_tools",t="__tolgee_preferredLanguages",n="data-tolgee-key-only",a="data-tolgee-restricted",r="_tolgee",o="_tolgee-highlighter";function i(){var e,t;return void 0===(null===(t=null===(e=globalThis.window)||void 0===e?void 0:e.document)||void 0===t?void 0:t.createElement)}function s(e){if(i())throw new Error(`${e}: Can't run on the server`)}function u(e,t){return{oldTextContent:e,keys:t}}function l(e){return Boolean(e&&"function"==typeof e.then)}const c=(e,t)=>l(e)?Promise.resolve(e).then(t):t(e),g=e=>`Tolgee: You need to specify '${e}' option`;function d(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function f(e){return d(e)||[]}function p(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?f(t):f(null==t?void 0:t[e]);var n}function v(e){return Array.from(new Set(e))}function h(e){return e?e.replace(/\/+$/,""):e}const m=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})))}})},b=(e,t,n)=>{const a=new Set,r=new Set;let o=[];const i=()=>{if(0===o.length)return;const e=o;o=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));(e=>{const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))})(n?Array.from(n.keys()):void 0)};return Object.freeze({listenSome:e=>{const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(f(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a},listen:e=>{a.add(e);return{unsubscribe:()=>{a.delete(e)}}},emit:(t,n)=>{e()&&(o.push(t),n?setTimeout(i,0):i())}})},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},E=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},L=({language:e,namespace:t})=>t?`${e}:${t}`:e,O=(e,t,n,a,r,o,i)=>{const s=new Map,u=new Map;let l={},c=0;function g(t,n,a){const r=L(t);u.set(r,{data:y(n),version:a}),e.emit(t)}function d(e,t){g(e,t,c)}function p(e,t=!1){const n=u.get(L(e));return n&&t?n.version===c:Boolean(n)}function h(e){var t;return null===(t=u.get(L(a(e))))||void 0===t?void 0:t.data}function m(e){let n;if(!n){const t=l[L(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n}return Object.freeze({addStaticData:function(e){e&&(l=Object.assign(Object.assign({},l),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=E(e),a=u.get(e);a&&0!==a.version||g(n,t,0)}})))},invalidate:function(){s.clear(),c+=1},addRecord:d,exists:p,getRecord:h,getTranslation:function(e,t){var n;return null===(n=u.get(L(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=u.get(L({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return v(e)},getTranslationFallback:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=u.get(L({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation:function(t,n,a){var r;const o=null===(r=u.get(L(t)))||void 0===r?void 0:r.data;null==o||o.set(n,a),e.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching:function(e){if(r())return!0;if(void 0===e)return s.size>0;const t=f(e);return Boolean(Array.from(s.keys()).find((e=>t.includes(E(e).namespace))))},isLoading:function(e,t){const n=f(t);return Boolean(r()||Array.from(s.keys()).find((t=>{const a=E(t);return(!n.length||n.includes(a.namespace))&&!p({namespace:a.namespace,language:e})})))},loadRecords:async function(e,t){const r=e.map((e=>{const r=a(e),o=L(r),i=s.get(o);if(i)return{new:!1,promise:i,keyObject:r,cacheKey:o};const u=function(e,t){var a;let r;return t&&(r=null===(a=n(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),r||(r=m(e)),r}(r,t)||Promise.resolve(void 0);return s.set(o,u),{new:!0,promise:u,keyObject:r,cacheKey:o}}));o.notify(),i.notify();const u=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=s.get(e.cacheKey)!==e.promise;if(e.new&&!n){s.delete(e.cacheKey);const n=u[t];n?d(e.keyObject,n):h(e.keyObject)||d(e.keyObject,{})}})),o.notify(),i.notify(),r.map((e=>h(e.keyObject)))},getAllRecords:function(){return Array.from(u.entries()).map((([e,t])=>Object.assign(Object.assign({},E(e)),{data:t.data})))}})};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 r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const k="invalid",j={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"]},observerType:"invisible",onFormatError:k,apiUrl:"https://app.tolgee.io"},A=(...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},x=(e,t)=>{const n=A(j,null==t?void 0:t.initialOptions,e);return n.apiUrl=h(n.apiUrl),{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}},P=(e,t,n,a,r,o)=>{const i={ui:void 0},s={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,event:t})=>{var n;const o=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,ns:a({key:e,ns:t}),translation:r({key:e,ns:t})})));null===(n=s.ui)||void 0===n||n.handleElementClick(o,t)},g=(e,t)=>{var n,a;return(null===(a=null===(n=s.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},d=e=>{const t=r({key:e.key,ns:e.ns});return A(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))},f=e=>{s.observer=null==e?void 0:e()},p=()=>Boolean(s.observer),v=e=>{e&&s.formatters.push(e)},h=e=>{s.finalFormatter=e},m=e=>{i.ui=e},b=()=>Boolean(i.ui),y=e=>{s.languageStorage=e},E=e=>{s.languageDetector=e},L=e=>{e&&s.backends.push(e)},O=e=>{s.devBackend=e},j=()=>s.devBackend;function A(n){var a,{formatEnabled:r}=n,o=w(n,["formatEnabled"]);const{key:i,translation:u,defaultValue:l,noWrap:c,params:g,orEmpty:d,ns:f}=o,p=u||l;let v=p||(d?"":i);const h=e(),m=r||!(null===(a=s.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>s.observer&&!c?s.observer.wrap({key:i,translation:e,defaultValue:l,params:g,ns:f}):e;v=b(v);try{if(p&&h&&m)for(const e of s.formatters)v=e.format({translation:v,language:h,params:g});s.finalFormatter&&p&&h&&m&&(v=s.finalFormatter.format({translation:v,language:h,params:g}))}catch(e){console.error(e);const n=("string"==typeof(y=e)?y:"string"==typeof(null==y?void 0:y.message)?y.message:void 0)||k,a=t().onFormatError,r=typeof a;v="string"===r?a:"function"===r?a(n,o):k,v=b(v)}var y;return v}return Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:h,addFormatter:v,setObserver:f,hasObserver:p,setUi:m,hasUi:b,setDevBackend:O,addBackend:L,setLanguageDetector:E,setLanguageStorage:y}))},formatTranslation:A,getDevBackend:j,getBackendRecord:({language:e,namespace:t})=>{for(const n of s.backends){const a=n.getRecord({language:e,namespace:t});if(l(a))return null==a?void 0:a.catch((e=>(console.error(e),{})));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;const{apiKey:r,apiUrl:o,projectId:i}=t();return null===(a=s.devBackend)||void 0===a?void 0:a.getRecord({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:n})},getLanguageDetector:()=>s.languageDetector,getLanguageStorage:()=>s.languageStorage,getInitialLanguage:()=>{var e;const t=n(),a=null===(e=s.languageStorage)||void 0===e?void 0:e.getLanguage();return c(a,(e=>t&&!t.includes(e)||!e?(()=>{if(!s.languageDetector)return;const e=n();return s.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var t;null===(t=s.languageStorage)||void 0===t||t.setLanguage(e)},run:()=>{var e,n;const{apiKey:a,apiUrl:r,projectId:l,observerOptions:c}=t();s.ui=null===(e=i.ui)||void 0===e?void 0:e.call(i,{apiKey:a,apiUrl:r,projectId:l,highlight:g,changeTranslation:o}),null===(n=s.observer)||void 0===n||n.run({mouseHighlight:!0,options:c,translate:d,onClick:u})},stop:()=>{var e;s.ui=void 0,null===(e=s.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=s.observer)||void 0===e||e.retranslate()},highlight:g,unwrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:function(){return Boolean(j())}})},N=(e,t,n)=>{let a=e;return Object.freeze({init:function(e){a=e},notify:function(){const e=t();a!==e&&n(e),a=e}})};const T=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:r}=e,o=w(e,["ns","noWrap","orEmpty","params"]);const i={ns:t,noWrap:n,orEmpty:a};return Object.assign(Object.assign({},i),{params:Object.assign({},o)})}(n)),a)),a},S=({options:e})=>{const t=((e,t)=>{let n=!0;function a(){return n}const r=m(a),o=m(a),i=m(a),s=m(a),u=m(a),l=m(a),c=m(a),g=b(a,e,t);return u.listen((()=>g.emit())),o.listen((()=>g.emit())),c.listen((({value:e})=>{g.emit([e.namespace],!0)})),Object.freeze({onPendingLanguageChange:r,onLanguageChange:o,onLoadingChange:i,onFetchingChange:s,onInitialLoaded:u,onRunningChange:l,onCacheChange:c,onUpdate:g,setEmmiterActive:function(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return r.listen(t);case"language":return o.listen(t);case"loading":return i.listen(t);case"fetching":return s.listen(t);case"initialLoad":return u.listen(t);case"running":return l.listen(t);case"cache":return c.listen(t);case"update":return g.listen(t)}}})})(s,u),n=N(!1,(()=>i.isFetching()),t.onFetchingChange.emit),a=N(!1,(()=>k()),t.onLoadingChange.emit),r=((e,t,n)=>{let a,r=x();function o(){return r.language||r.initialOptions.language}function i(){return Object.assign(Object.assign({},r.initialOptions),a)}return Object.freeze({init:function(e){r=x(e,r)},isRunning:function(){return r.isRunning},setRunning:function(e){r.isRunning!==e&&(r.isRunning=e,n.emit(e))},isInitialLoading:function(){return r.isInitialLoading},setInitialLoading:function(e){r.isInitialLoading=e},getLanguage:o,setLanguage:function(t){r.language!==t&&(r.language=t,e.emit(t))},getPendingLanguage:function(){return r.pendingLanguage||o()},setPendingLanguage:function(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,t.emit(e))},getInitialOptions:i,addActiveNs:function(e){f(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t?r.activeNamespaces.set(e,t+1):r.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){f(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t&&t>1?r.activeNamespaces.set(e,t-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return v([...r.initialOptions.ns||[r.initialOptions.defaultNs],...f(r.initialOptions.fallbackNs),...r.activeNamespaces.keys()])},getFallbackLangs:function(e){const t=e||o();return t?v([t,...p(t,r.initialOptions.fallbackLanguage)]):[]},getFallbackNs:function(){return f(r.initialOptions.fallbackNs)},getDefaultNs:function(e){return void 0===e?r.initialOptions.defaultNs:e},getAvailableLanguages:function(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>E(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?i().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){a=e?Object.assign(Object.assign({},e),{apiUrl:h(e.apiUrl)}):void 0}})})(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),o=P(r.getLanguage,r.getInitialOptions,r.getAvailableLanguages,(function({key:e,ns:t}){const n=r.getFallbackLangs(),a=d(t||void 0);return i.getTranslationNs(a,n,e)}),S,L),i=O(t.onCacheChange,o.getBackendRecord,o.getBackendDevRecord,r.withDefaultNs,r.isInitialLoading,n,a);function s(){return r.getFallbackNs()}function u(e){return r.getDefaultNs(e)}function d(e){return[...f(u(e)),...s()]}function y(e){return[...f(e||u()),...r.getRequiredNamespaces()]}function L(e,t,n){const a=r.withDefaultNs(e),o=i.getTranslation(a,t);return i.changeTranslation(a,t,n),{revert:()=>{i.changeTranslation(a,t,o)}}}function w(e){r.init(e),i.addStaticData(r.getInitialOptions().staticData)}function k(e){return i.isLoading(r.getLanguage(),e)}function j(){return Boolean(r.getInitialOptions().apiKey&&r.getInitialOptions().apiUrl)}function A(e,t){const n=function(e,t){const n=r.getFallbackLangs(e),a=y(t),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}(e,t);if(n.length)return c(R(n),(()=>{}))}function S({key:e,ns:t}){const n=d(t||void 0),a=r.getFallbackLangs();return i.getTranslationFallback(n,a,e)}function $(){const e=c(function(){if(r.getLanguage())return;if(!r.getInitialOptions().defaultLanguage)throw new Error(g("defaultLanguage"));const e=o.getInitialLanguage();return c(e,(e=>{const t=e||r.getInitialOptions().defaultLanguage;t&&r.setLanguage(t)}))}(),(()=>A()));if(l(e))return r.setInitialLoading(!0),n.notify(),a.notify(),Promise.resolve(e).then((()=>{r.setInitialLoading(!1),n.notify(),a.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}function R(e){return i.loadRecords(e,j())}e&&w(e),t.onUpdate.listen((()=>{r.isRunning()&&o.retranslate()}));const D=()=>{const e=o.getLanguageDetector()||o.getLanguageStorage();if(e){if(!r.getAvailableLanguages())throw new Error(g("availableLanguages"))}if(!r.getLanguage()&&!r.getInitialOptions().defaultLanguage)throw e?new Error(g("defaultLanguage")):new Error(g("language"))};return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),o),i),{init:w,changeLanguage:async function(e){r.getPendingLanguage()===e&&r.getLanguage()===e||(r.setPendingLanguage(e),r.isRunning()&&await A(e),e===r.getPendingLanguage()&&(r.setLanguage(e),o.setStoredLanguage(e)))},getTranslation:S,changeTranslation:L,addActiveNs:async function(e,t){t||r.addActiveNs(e),r.isRunning()&&await A(void 0,e)},loadRecords:R,loadRecord:async function(e){return(await R([e]))[0]},isLoading:k,isLoaded:function(e){const t=r.getLanguage();if(!t)return!1;const n=r.getFallbackLangs(t),a=y(e),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=T(...e),n=S(t);return o.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:j,run:function(){let e;return D(),r.isRunning()||(j()&&i.invalidate(),r.setRunning(!0),o.run(),e=$()),Promise.resolve(e)},stop:function(){r.isRunning()&&(o.stop(),r.setRunning(!1))}}))},$=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=A(e.options,n),t),init(t){const n=(e=>{const t=S({options:e}),n=e=>{const n=t.isRunning();n&&t.stop(),e(),n&&t.run()},a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmmiterActive:t.setEmmiterActive,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,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})(A(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},R=0,D=1,C=2;class I extends Error{constructor(e,t,n){let a;a=e===R?"Empty parameter":e===D?"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 _=0,F=1,M=2,V=3,z=4,B=new Set([M,F,_]),K="'",Y=new Set(["{","}",K]),W=e=>/[0-9a-zA-Z_]/.test(e);function X(e,t){const[n,a]=function(e){let t=_,n="",a="",r="";const o=[],i=[];let s=0;function u(t){throw new I(t,s,e)}const l=()=>{o.push(n),n=""},c=()=>{""===a&&u(R),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case _:r===K?(n+=r,t=F):"{"===r?(l(),t=V):(n+=r,t=_);break;case F:Y.has(r)?(n=n.slice(0,-1)+r,t=M):(n+=r,t=_);break;case M:r===K?t=_:(n+=r,t=M);break;case V:"}"===r?(c(),t=_):U(r)?""!==a&&(c(),t=z):(W(r)||u(D),a+=r,t=V);break;case z:"}"==r?t=_:U(r)?t=z:u(D)}return B.has(t)||u(C),l(),[o,i]}(e),r=[n[0]];for(let o=1;o<n.length;o++){const i=null==t?void 0:t[a[o-1]];if(void 0===i)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);r.push(String(i)),r.push(n[o])}return r.join("")}const G=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>X(e,t)}),e),H={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},J=({highlightColor:e,highlightWidth:t})=>Object.freeze({initHighlighter:function(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;let r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(o),Object.entries(H).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const i=n.getBoundingClientRect();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)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,a)}});function q(e,t){var n;const a=function(e){switch(e.nodeType){case Node.ATTRIBUTE_NODE:return e.ownerElement||void 0;case Node.TEXT_NODE:return e.parentElement||void 0;case Node.DOCUMENT_NODE:case Node.ELEMENT_NODE:return e;default:return}}(t),r=[];if(!a)return r;const o=null===document||void 0===document?void 0:document.evaluate(e,a,void 0,XPathResult.ANY_TYPE);let i;for(;i=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)r.push(i);return r}function Z(e){return e.textContent}function Q(e,t){e.textContent=t}function ee(e,t){if(e.contains(t))return!0;if(t instanceof Attr){const n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}const te=(e,t)=>{var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,r=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((e=>{var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return a&&r},ne={capture:!0},ae={capture:!0,passive:!0},re=({highlightKeys:t,elementStore:n,onClick:a,options:r})=>{var o,i;let s,u,l=new Set;const c=(null===(o=r.targetElement)||void 0===o?void 0:o.getRootNode())||document,g=(null===(i=r.targetElement)||void 0===i?void 0:i.ownerDocument)||document,d=e=>{var t;if(s!==e){f();const a=n.get(e);a&&(a.preventClean=!0,null===(t=a.highlight)||void 0===t||t.call(a),s=e)}},f=()=>{var e;const t=n.get(s);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),s=void 0)};function p(){const e=u;let t;if(e&&w()){const a=c.elementFromPoint(e.x,e.y);a&&(t=function(e){return O(e,(e=>n.get(e)))}(a))}d(t)}const v=t=>{var n;w()&&(n=t.target,!Boolean(O(n,(t=>t.id===e))))&&(t.stopPropagation(),t.preventDefault())},h=e=>{var t;t={x:e.clientX,y:e.clientY},u=t,p()},m=()=>{l=new Set,p()},b=e=>{const t=e.key;void 0!==t&&l.add(t),p()},y=e=>{l.delete(e.key),p()},E=()=>{var e;const t=n.get(s);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)},L=e=>{v(e),w()&&s&&(a(e,s),f())};function O(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function w(){for(const e of t)if(!l.has(e))return!1;return!0}return Object.freeze({run:function(){g.addEventListener("blur",m,ne),g.addEventListener("keydown",b,ne),g.addEventListener("keyup",y,ne),g.addEventListener("mousemove",h,ae),g.addEventListener("scroll",E,ae),g.addEventListener("click",L,ne),g.addEventListener("mouseenter",v,ne),g.addEventListener("mouseover",v,ne),g.addEventListener("mouseout",v,ne),g.addEventListener("mouseleave",v,ne),g.addEventListener("mousedown",v,ne),g.addEventListener("mouseup",v,ne)},stop:function(){g.removeEventListener("blur",m,ne),g.removeEventListener("keydown",b,ne),g.removeEventListener("keyup",y,ne),g.removeEventListener("mousemove",h,ae),g.removeEventListener("scroll",E,ae),g.removeEventListener("click",L,ne),g.removeEventListener("mouseenter",v,ne),g.removeEventListener("mouseover",v,ne),g.removeEventListener("mouseout",v,ne),g.removeEventListener("mouseleave",v,ne),g.removeEventListener("mousedown",v,ne),g.removeEventListener("mouseup",v,ne)}})},oe=(e,t,n)=>{const o=J({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),i=re({highlightKeys:e.highlightKeys,elementStore:t,onClick:(e,a)=>{const r=t.get(a);n({event:e,keysAndDefaults:u(r)})},options:e});function s(){return e.targetElement||document.body}function u(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:function(n,i,s){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${a}]`)}(n))return;const u=n;let l=t.get(u);l||(l={nodes:new Map},t.set(u,l),u.setAttribute(r,"true")),l.nodes.set(i,s),o.initHighlighter(u,l)},forEachElement:t.forEachElement,findAll:function(e,n){const a=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>te({key:e,ns:d(n)},{key:t.key,ns:d(t.ns)})))){a.push(r);break}}})),a},refreshAll:function(){t.forEachElement(((e,n)=>{n.preventClean||(function(e){e.nodes=new Map(function*(e){for(const[t,n]of e.nodes.entries())ee(s(),t)&&(yield[t,n])}(e))}(n),0===n.nodes.size&&function(e,n){var a;n.highlightEl&&(null===(a=n.unhighlight)||void 0===a||a.call(n));e.removeAttribute(r),t.remove(e)}(e,n))}))},run:function(e){e&&i.run()},stop:function(){i.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t))}))}})},ie=()=>{let e,t=!1;const a=(()=>{const e=new Map;return Object.freeze({set:function(t,n){e.set(t,n)},get:function(t){return t&&e.get(t)},remove:function(t){return e.delete(t)},forEachElement:function(t){e.forEach(((e,n)=>t(n,e)))}})})(),r=({mouseHighlight:e,options:r,wrapper:o,onClick:s})=>{if(i())return;const l=(e=>Object.freeze({getSuitableParent:function t(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(a):a}}))(r),c=((e,t)=>{const n=e=>q(t.getTextXPath(),e),a=n=>{let a=[];for(const[r,o]of Object.entries(e.tagAttributes))for(const e of o){const o=q(t.getAttributeXPath({tag:r,attribute:e}),n);a=[...a,...o]}return a};return Object.freeze({handleAttributes:a,handleChildList:e=>{let t=[];return t=t.concat(a(e)),t=t.concat(n(e)),t},handleText:n})})(r,o),g=oe(r,a,s);function d(e){for(const t of e){const e=Z(t),n=e?o.unwrap(e):null;if(n){const{text:a,keys:r}=n;Q(t,a);const o=u(e,r),i=l.getSuitableParent(t);g.register(i,t,o)}}}const f=e=>{q(`./descendant-or-self::*[@${n}]`,e).forEach((e=>{const t=e.getAttributeNode(n),a=l.getSuitableParent(t);g.register(a,t,{oldTextContent:"",keys:[{key:Z(t)}],keyAttributeOnly:!0})}))},p=new MutationObserver((e=>{if(t)for(const t of e){let e=[];switch(t.type){case"characterData":e=c.handleText(t.target);break;case"childList":f(t.target),e=c.handleChildList(t.target);break;case"attributes":f(t.target),e=c.handleAttributes(t.target)}d(e),g.refreshAll()}})),v=r.targetElement||document.body;return t=!0,g.run(e),f(v),d(c.handleChildList(v)),p.observe(v,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,g.stop(),p.disconnect()},elementRegistry:g,wrapper:o}};return Object.freeze({run(t){e=r(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null===(a=null==e?void 0:(n=e.elementRegistry).forEachElement)||void 0===a||a.call(n,t)},highlight(t,n){const a=(null==e?void 0:e.elementRegistry.findAll(t,n))||[];return a.forEach((e=>{var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight(){a.forEach((e=>{var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})},se=["‌","‍"],ue=RegExp(`([${se.join("")}]{9})+`,"gu"),le=e=>{const t=(e=>Array.from((new TextEncoder).encode(e)))(e).map(Number),n=t.map((e=>(e=>{const t=8-e.length;return"0".repeat(t)+e})(e.toString(2))+"0")).join("");return Array.from(n).map((e=>se[Number(e)])).join("")},ce=e=>{const t=Array.from(e).map((e=>se.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},ge=()=>{const e=(()=>{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]})})(),t=e=>JSON.parse(e||"{}");return Object.freeze({unwrap:n=>{const a=[],r=(e=>{var t;const n=null===(t=e.match(ue))||void 0===t?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(ce))||[]})(n);r.forEach((n=>{const[r]=(e=>{const t=[];for(const n of e)t.push(n.codePointAt(0));return t})(n),o=e.numberToValue(r),{k:i,d:s,n:u}=t(o);a.push({key:i,defaultValue:s,ns:u})}));const o=(e=>e.replace(ue,""))(n);return{text:o,keys:a}},wrap:({key:t,defaultValue:n,translation:a,ns:r})=>{const o=(e=>{const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)})({key:t,ns:r,defaultValue:n}),i=e.valueToNumber(o),s=a||"",u=le(String.fromCodePoint(i));return"string"==typeof s?s+u:s},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${se[0]}${se[0]}') or contains(., '${se[1]}${se[0]}')]`,getAttributeXPath:({tag:e,attribute:t})=>`descendant-or-self::${e}/@${t}[contains(., '${se[0]}${se[0]}') or contains(., '${se[1]}${se[0]}')]`})};function de(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}const fe=({inputPrefix:e,inputSuffix:t,translate:n})=>{function a(e){const{key:t,params:a,defaultValue:r,ns:o}=function(e){let t=!1,n="",a="",r="KEY";const o={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{o.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==r||","!==s?"KEY"!==r||"|"!==s?"NAMESPACE"!==r||","!==s?"KEY"!==r||":"!==s?"DEFAULT_VALUE"!==r||":"!==s?"PARAM_NAME"!==r||":"!==s?"PARAM_VALUE"!==r||","!==s?n+=s:(r="PARAM_NAME",o.params[a]=n,n=""):(r="PARAM_VALUE",a=n,n=""):(r="PARAM_NAME",o.defaultValue=n,n=""):(r="PARAM_NAME",o.key=n,n=""):(r="DEFAULT_VALUE",i(n),n=""):(r="NAMESPACE",o.key=n,n=""):(r="DEFAULT_VALUE",o.key=n,n=""):t=!0;return"KEY"===r&&(o.key=n),"DEFAULT_VALUE"===r&&(o.defaultValue=n),"PARAM_VALUE"===r&&(o.params[a]=n),"NAMESPACE"===r&&i(n),o}(e);return{translated:n({key:t,params:a,defaultValue:r,ns:o,noWrap:!0}),key:t,params:a,defaultValue:r,ns:o}}const r=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=e=>"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:r,ns:i})=>{let s=Object.entries(a||{}).map((([e,t])=>`${o(e)}:${o(t)}`)).join(",");s=s.length?`:${s}`:"";const u=void 0!==r?`,${o(r)}`:"",l="string"==typeof i?[i]:i,c=(null==l?void 0:l.length)?`|${l.map((e=>o(e))).join("|")}`:"";return`${e}${o(n)}${c}${u}${s}${t}`},unwrap:n=>{const o=new RegExp(`(\\\\?)(${r(e)}(.*?)${r(t)})`,"gs"),i=[];let s,u=!1,l=0,c="";for(;null!==(s=o.exec(n));){let e=s[1];const[t,r,o,g]=s,{index:d,input:f}=s;if(c+=f.substr(l,d-l),l=d+t.length,"\\"===e){if(!de(d,n)){c+=o;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),u=!0,c+=e+p.translated}return c+=n.substring(l),u?{text:c,keys:i}:{text:n,keys:[]}},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${e}') and contains(., '${t}')]`,getAttributeXPath:({tag:n,attribute:a})=>`descendant-or-self::${n}/@${a}[contains(., '${e}') and contains(., '${t}')]`})},pe=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=ie();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=fe({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run(Object.assign(Object.assign({},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&&Q(t,n.text)}}))},outputNotFormattable:!0}))})):t.setObserver((()=>{const e=ie();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=ge();e.run(Object.assign(Object.assign({},t),{wrapper:n}))},retranslate(){},outputNotFormattable:!1}))})),e),ve="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function he(e){const t=ve.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function me(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,r=0;const o=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|he(e[i]),n+=5,n>=8&&(o[r++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",r=Math.pow(2,16)-1;for(let e=0;e<n;e+=r)e+r>n&&(r=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+r));return a}(o.buffer)}function be(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=me(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}const ye=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:r}){var o;const i=null!==(o=be(t))&&void 0!==o?o:r;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===r)throw new Error("You need to specify 'projectId' when using PAT key");return fetch(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 Ee({message:e,recievingMessage:t,data:n,attempts:a=1}){let r=!1;const o=()=>new Promise(((a,r)=>{const o=function(e,t){const n=n=>{var a,r;e.includes(null===(a=n.data)||void 0===a?void 0:a.type)&&t(null===(r=n.data)||void 0===r?void 0:r.data)};return window.addEventListener("message",n,!1),{unsubscribe:()=>{window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(i),s(),a(e)}));window.postMessage({type:e,data:n},window.origin);const i=setTimeout((function(){s(),r()}),300);function s(){o.unsubscribe()}}));return{cancel:()=>r=!0,promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await o()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}const Le="tolgee-in-context-tools.umd.min.js",Oe="@tolgee/in-context-tools",we="InContextTools",ke="https://cdn.jsdelivr.net/npm";let je=null;function Ae(e){var t;return je||(je=(t=`${ke}/@tolgee/web@${e}/dist/${Le}`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.body.appendChild(a)}))).then((()=>window[Oe][we]))),je}const xe="__tolgee_apiKey",Pe="__tolgee_apiUrl";function Ne(){const e=sessionStorage.getItem(xe)||void 0,t=sessionStorage.getItem(Pe)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Te(){sessionStorage.removeItem(xe),sessionStorage.removeItem(Pe)}let Se=()=>e=>e;"undefined"!=typeof window&&(Se=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=Ee({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(Te)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ne()&&(async()=>{const e=await Ae("5.4.2");return t=>{const n=Ne();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",Re=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(s("LanguageStorage"),localStorage.getItem($e)||void 0),setLanguage(e){s("LanguageStorage"),localStorage.setItem($e,e)}}),e),De=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){s("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),r=a(window.navigator.language);return e.find((e=>a(e)===r))||void 0}}),e);const Ce=e=>e.endsWith("/")?e.slice(0,-1):e,Ie={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Ce(n)}/${e}/${t}.json`:`${Ce(n)}/${t}.json`,getData:e=>e.json(),headers:{Accept:"application/json"}},Ue=e=>{const t=Object.assign(Object.assign(Object.assign({},Ie),e),{headers:Object.assign(Object.assign({},Ie.headers),null==e?void 0:e.headers)}),{prefix:n,getPath:a,getData:r,headers:o}=t,i=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}(t,["prefix","getPath","getData","headers"]);return{getRecord({namespace:e,language:t}){const s=a({namespace:e,language:t,prefix:n});return fetch(s,Object.assign({headers:o},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return r(e)}))}}},_e=e=>(t,n)=>(n.addBackend(Ue(e)),t),Fe=()=>$().use(Se()),Me=()=>e=>e;export{_e as BackendFetch,Se as BrowserExtensionPlugin,e as DEVTOOLS_ID,ye as DevBackend,Me as DevTools,G as FormatSimple,De as LanguageDetector,Re as LanguageStorage,pe as ObserverPlugin,t as PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY,r as TOLGEE_ATTRIBUTE_NAME,a as TOLGEE_RESTRICT_ATTRIBUTE,n as TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE,Fe as Tolgee,$ as TolgeeCore,d as getFallback,f as getFallbackArray,be as getProjectIdFromApiKey,T as getTranslateProps};
const e="__tolgee_dev_tools",t="__tolgee_preferredLanguages",n="data-tolgee-key-only",a="data-tolgee-restricted",r="_tolgee",o="_tolgee-highlighter";function i(){var e,t;return void 0===(null===(t=null===(e=globalThis.window)||void 0===e?void 0:e.document)||void 0===t?void 0:t.createElement)}function s(e){if(i())throw new Error(`${e}: Can't run on the server`)}function u(e,t){return{oldTextContent:e,keys:t}}function l(e){return Boolean(e&&"function"==typeof e.then)}const c=(e,t)=>l(e)?Promise.resolve(e).then(t):t(e),g=e=>`Tolgee: You need to specify '${e}' option`;function d(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function f(e){return d(e)||[]}function p(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?f(t):f(null==t?void 0:t[e]);var n}function v(e){return Array.from(new Set(e))}function h(e){return e?e.replace(/\/+$/,""):e}const m=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})))}})},b=(e,t,n)=>{const a=new Set,r=new Set;let o=[];const i=()=>{if(0===o.length)return;const e=o;o=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));(e=>{const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))})(n?Array.from(n.keys()):void 0)};return Object.freeze({listenSome:e=>{const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(f(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a},listen:e=>{a.add(e);return{unsubscribe:()=>{a.delete(e)}}},emit:(t,n)=>{e()&&(o.push(t),n?setTimeout(i,0):i())}})},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},E=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},L=({language:e,namespace:t})=>t?`${e}:${t}`:e,O=(e,t,n,a,r,o,i)=>{const s=new Map,u=new Map;let l={},c=0;function g(t,n,a){const r=L(t);u.set(r,{data:y(n),version:a}),e.emit(t)}function d(e,t){g(e,t,c)}function p(e,t=!1){const n=u.get(L(e));return n&&t?n.version===c:Boolean(n)}function h(e){var t;return null===(t=u.get(L(a(e))))||void 0===t?void 0:t.data}function m(e){let n;if(!n){const t=l[L(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n}return Object.freeze({addStaticData:function(e){e&&(l=Object.assign(Object.assign({},l),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=E(e),a=u.get(e);a&&0!==a.version||g(n,t,0)}})))},invalidate:function(){s.clear(),c+=1},addRecord:d,exists:p,getRecord:h,getTranslation:function(e,t){var n;return null===(n=u.get(L(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=u.get(L({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return v(e)},getTranslationFallback:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=u.get(L({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation:function(t,n,a){var r;const o=null===(r=u.get(L(t)))||void 0===r?void 0:r.data;null==o||o.set(n,a),e.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching:function(e){if(r())return!0;if(void 0===e)return s.size>0;const t=f(e);return Boolean(Array.from(s.keys()).find((e=>t.includes(E(e).namespace))))},isLoading:function(e,t){const n=f(t);return Boolean(r()||Array.from(s.keys()).find((t=>{const a=E(t);return(!n.length||n.includes(a.namespace))&&!p({namespace:a.namespace,language:e})})))},loadRecords:async function(e,t){const r=e.map((e=>{const r=a(e),o=L(r),i=s.get(o);if(i)return{new:!1,promise:i,keyObject:r,cacheKey:o};const u=function(e,t){var a;let r;return t&&(r=null===(a=n(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),r||(r=m(e)),r}(r,t)||Promise.resolve(void 0);return s.set(o,u),{new:!0,promise:u,keyObject:r,cacheKey:o}}));o.notify(),i.notify();const u=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=s.get(e.cacheKey)!==e.promise;if(e.new&&!n){s.delete(e.cacheKey);const n=u[t];n?d(e.keyObject,n):h(e.keyObject)||d(e.keyObject,{})}})),o.notify(),i.notify(),r.map((e=>h(e.keyObject)))},getAllRecords:function(){return Array.from(u.entries()).map((([e,t])=>Object.assign(Object.assign({},E(e)),{data:t.data})))}})};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 r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const k="invalid",j={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"]},observerType:"invisible",onFormatError:k,apiUrl:"https://app.tolgee.io"},A=(...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},x=(e,t)=>{const n=A(j,null==t?void 0:t.initialOptions,e);return n.apiUrl=h(n.apiUrl),{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}},P=(e,t,n,a,r,o)=>{const i={ui:void 0},s={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},u=async({keysAndDefaults:e,event:t})=>{var n;const o=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,ns:a({key:e,ns:t}),translation:r({key:e,ns:t})})));null===(n=s.ui)||void 0===n||n.handleElementClick(o,t)},g=(e,t)=>{var n,a;return(null===(a=null===(n=s.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},d=e=>{const t=r({key:e.key,ns:e.ns});return A(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))},f=e=>{s.observer=null==e?void 0:e()},p=()=>Boolean(s.observer),v=e=>{e&&s.formatters.push(e)},h=e=>{s.finalFormatter=e},m=e=>{i.ui=e},b=()=>Boolean(i.ui),y=e=>{s.languageStorage=e},E=e=>{s.languageDetector=e},L=e=>{e&&s.backends.push(e)},O=e=>{s.devBackend=e},j=()=>s.devBackend;function A(n){var a,{formatEnabled:r}=n,o=w(n,["formatEnabled"]);const{key:i,translation:u,defaultValue:l,noWrap:c,params:g,orEmpty:d,ns:f}=o,p=u||l;let v=p||(d?"":i);const h=e(),m=r||!(null===(a=s.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>s.observer&&!c?s.observer.wrap({key:i,translation:e,defaultValue:l,params:g,ns:f}):e;v=b(v);try{if(p&&h&&m)for(const e of s.formatters)v=e.format({translation:v,language:h,params:g});s.finalFormatter&&p&&h&&m&&(v=s.finalFormatter.format({translation:v,language:h,params:g}))}catch(e){console.error(e);const n=("string"==typeof(y=e)?y:"string"==typeof(null==y?void 0:y.message)?y.message:void 0)||k,a=t().onFormatError,r=typeof a;v="string"===r?a:"function"===r?a(n,o):k,v=b(v)}var y;return v}return Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:h,addFormatter:v,setObserver:f,hasObserver:p,setUi:m,hasUi:b,setDevBackend:O,addBackend:L,setLanguageDetector:E,setLanguageStorage:y}))},formatTranslation:A,getDevBackend:j,getBackendRecord:({language:e,namespace:t})=>{for(const n of s.backends){const a=n.getRecord({language:e,namespace:t});if(l(a))return null==a?void 0:a.catch((e=>(console.error(e),{})));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;const{apiKey:r,apiUrl:o,projectId:i}=t();return null===(a=s.devBackend)||void 0===a?void 0:a.getRecord({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:n})},getLanguageDetector:()=>s.languageDetector,getLanguageStorage:()=>s.languageStorage,getInitialLanguage:()=>{var e;const t=n(),a=null===(e=s.languageStorage)||void 0===e?void 0:e.getLanguage();return c(a,(e=>t&&!t.includes(e)||!e?(()=>{if(!s.languageDetector)return;const e=n();return s.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var t;null===(t=s.languageStorage)||void 0===t||t.setLanguage(e)},run:()=>{var e,n;const{apiKey:a,apiUrl:r,projectId:l,observerOptions:c}=t();s.ui=null===(e=i.ui)||void 0===e?void 0:e.call(i,{apiKey:a,apiUrl:r,projectId:l,highlight:g,changeTranslation:o}),null===(n=s.observer)||void 0===n||n.run({mouseHighlight:!0,options:c,translate:d,onClick:u})},stop:()=>{var e;s.ui=void 0,null===(e=s.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=s.observer)||void 0===e||e.retranslate()},highlight:g,unwrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:function(){return Boolean(j())}})},N=(e,t,n)=>{let a=e;return Object.freeze({init:function(e){a=e},notify:function(){const e=t();a!==e&&n(e),a=e}})};const T=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:r}=e,o=w(e,["ns","noWrap","orEmpty","params"]);const i={ns:t,noWrap:n,orEmpty:a};return Object.assign(Object.assign({},i),{params:Object.assign({},o)})}(n)),a)),a},S=({options:e})=>{const t=((e,t)=>{let n=!0;function a(){return n}const r=m(a),o=m(a),i=m(a),s=m(a),u=m(a),l=m(a),c=m(a),g=b(a,e,t);return u.listen((()=>g.emit())),o.listen((()=>g.emit())),c.listen((({value:e})=>{g.emit([e.namespace],!0)})),Object.freeze({onPendingLanguageChange:r,onLanguageChange:o,onLoadingChange:i,onFetchingChange:s,onInitialLoaded:u,onRunningChange:l,onCacheChange:c,onUpdate:g,setEmmiterActive:function(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return r.listen(t);case"language":return o.listen(t);case"loading":return i.listen(t);case"fetching":return s.listen(t);case"initialLoad":return u.listen(t);case"running":return l.listen(t);case"cache":return c.listen(t);case"update":return g.listen(t)}}})})(s,u),n=N(!1,(()=>i.isFetching()),t.onFetchingChange.emit),a=N(!1,(()=>k()),t.onLoadingChange.emit),r=((e,t,n)=>{let a,r=x();function o(){return r.language||r.initialOptions.language}function i(){return Object.assign(Object.assign({},r.initialOptions),a)}return Object.freeze({init:function(e){r=x(e,r)},isRunning:function(){return r.isRunning},setRunning:function(e){r.isRunning!==e&&(r.isRunning=e,n.emit(e))},isInitialLoading:function(){return r.isInitialLoading},setInitialLoading:function(e){r.isInitialLoading=e},getLanguage:o,setLanguage:function(t){r.language!==t&&(r.language=t,e.emit(t))},getPendingLanguage:function(){return r.pendingLanguage||o()},setPendingLanguage:function(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,t.emit(e))},getInitialOptions:i,addActiveNs:function(e){f(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t?r.activeNamespaces.set(e,t+1):r.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){f(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t&&t>1?r.activeNamespaces.set(e,t-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return v([...r.initialOptions.ns||[r.initialOptions.defaultNs],...f(r.initialOptions.fallbackNs),...r.activeNamespaces.keys()])},getFallbackLangs:function(e){const t=e||o();return t?v([t,...p(t,r.initialOptions.fallbackLanguage)]):[]},getFallbackNs:function(){return f(r.initialOptions.fallbackNs)},getDefaultNs:function(e){return void 0===e?r.initialOptions.defaultNs:e},getAvailableLanguages:function(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>E(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?i().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){a=e?Object.assign(Object.assign({},e),{apiUrl:h(e.apiUrl)}):void 0}})})(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),o=P(r.getLanguage,r.getInitialOptions,r.getAvailableLanguages,(function({key:e,ns:t}){const n=r.getFallbackLangs(),a=d(t||void 0);return i.getTranslationNs(a,n,e)}),S,L),i=O(t.onCacheChange,o.getBackendRecord,o.getBackendDevRecord,r.withDefaultNs,r.isInitialLoading,n,a);function s(){return r.getFallbackNs()}function u(e){return r.getDefaultNs(e)}function d(e){return[...f(u(e)),...s()]}function y(e){return[...f(e||u()),...r.getRequiredNamespaces()]}function L(e,t,n){const a=r.withDefaultNs(e),o=i.getTranslation(a,t);return i.changeTranslation(a,t,n),{revert:()=>{i.changeTranslation(a,t,o)}}}function w(e){r.init(e),i.addStaticData(r.getInitialOptions().staticData)}function k(e){return i.isLoading(r.getLanguage(),e)}function j(){return Boolean(r.getInitialOptions().apiKey&&r.getInitialOptions().apiUrl)}function A(e,t){const n=function(e,t){const n=r.getFallbackLangs(e),a=y(t),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}(e,t);if(n.length)return c(R(n),(()=>{}))}function S({key:e,ns:t}){const n=d(t||void 0),a=r.getFallbackLangs();return i.getTranslationFallback(n,a,e)}function $(){const e=c(function(){if(r.getLanguage())return;if(!r.getInitialOptions().defaultLanguage)throw new Error(g("defaultLanguage"));const e=o.getInitialLanguage();return c(e,(e=>{const t=e||r.getInitialOptions().defaultLanguage;t&&r.setLanguage(t)}))}(),(()=>A()));if(l(e))return r.setInitialLoading(!0),n.notify(),a.notify(),Promise.resolve(e).then((()=>{r.setInitialLoading(!1),n.notify(),a.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}function R(e){return i.loadRecords(e,j())}e&&w(e),t.onUpdate.listen((()=>{r.isRunning()&&o.retranslate()}));const D=()=>{const e=o.getLanguageDetector()||o.getLanguageStorage();if(e){if(!r.getAvailableLanguages())throw new Error(g("availableLanguages"))}if(!r.getLanguage()&&!r.getInitialOptions().defaultLanguage)throw e?new Error(g("defaultLanguage")):new Error(g("language"))};return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),o),i),{init:w,changeLanguage:async function(e){r.getPendingLanguage()===e&&r.getLanguage()===e||(r.setPendingLanguage(e),r.isRunning()&&await A(e),e===r.getPendingLanguage()&&(r.setLanguage(e),o.setStoredLanguage(e)))},getTranslation:S,changeTranslation:L,addActiveNs:async function(e,t){t||r.addActiveNs(e),r.isRunning()&&await A(void 0,e)},loadRecords:R,loadRecord:async function(e){return(await R([e]))[0]},isLoading:k,isLoaded:function(e){const t=r.getLanguage();if(!t)return!1;const n=r.getFallbackLangs(t),a=y(e),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=T(...e),n=S(t);return o.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:j,run:function(){let e;return D(),r.isRunning()||(j()&&i.invalidate(),r.setRunning(!0),o.run(),e=$()),Promise.resolve(e)},stop:function(){r.isRunning()&&(o.stop(),r.setRunning(!1))}}))},$=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=A(e.options,n),t),init(t){const n=(e=>{const t=S({options:e}),n=e=>{const n=t.isRunning();n&&t.stop(),e(),n&&t.run()},a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmmiterActive:t.setEmmiterActive,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,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})(A(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},R=0,D=1,C=2;class I extends Error{constructor(e,t,n){let a;a=e===R?"Empty parameter":e===D?"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 _=0,F=1,M=2,V=3,z=4,B=new Set([M,F,_]),K="'",Y=new Set(["{","}",K]),W=e=>/[0-9a-zA-Z_]/.test(e);function X(e,t){const[n,a]=function(e){let t=_,n="",a="",r="";const o=[],i=[];let s=0;function u(t){throw new I(t,s,e)}const l=()=>{o.push(n),n=""},c=()=>{""===a&&u(R),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case _:r===K?(n+=r,t=F):"{"===r?(l(),t=V):(n+=r,t=_);break;case F:Y.has(r)?(n=n.slice(0,-1)+r,t=M):(n+=r,t=_);break;case M:r===K?t=_:(n+=r,t=M);break;case V:"}"===r?(c(),t=_):U(r)?""!==a&&(c(),t=z):(W(r)||u(D),a+=r,t=V);break;case z:"}"==r?t=_:U(r)?t=z:u(D)}return B.has(t)||u(C),l(),[o,i]}(e),r=[n[0]];for(let o=1;o<n.length;o++){const i=null==t?void 0:t[a[o-1]];if(void 0===i)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);r.push(String(i)),r.push(n[o])}return r.join("")}const G=()=>(e,t)=>(t.setFinalFormatter({format:({translation:e,params:t})=>X(e,t)}),e),H={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},J=({highlightColor:e,highlightWidth:t})=>Object.freeze({initHighlighter:function(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;let r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(o),Object.entries(H).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const i=n.getBoundingClientRect();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)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,a)}});function q(e,t){var n;const a=function(e){switch(e.nodeType){case Node.ATTRIBUTE_NODE:return e.ownerElement||void 0;case Node.TEXT_NODE:return e.parentElement||void 0;case Node.DOCUMENT_NODE:case Node.ELEMENT_NODE:return e;default:return}}(t),r=[];if(!a)return r;const o=null===document||void 0===document?void 0:document.evaluate(e,a,void 0,XPathResult.ANY_TYPE);let i;for(;i=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)r.push(i);return r}function Z(e){return e.textContent}function Q(e,t){e.textContent=t}function ee(e,t){if(e.contains(t))return!0;if(t instanceof Attr){const n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}const te=(e,t)=>{var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,r=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((e=>{var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return a&&r},ne={capture:!0},ae={capture:!0,passive:!0},re=({highlightKeys:t,elementStore:n,onClick:a,options:r})=>{var o,i;let s,u,l=new Set;const c=(null===(o=r.targetElement)||void 0===o?void 0:o.getRootNode())||document,g=(null===(i=r.targetElement)||void 0===i?void 0:i.ownerDocument)||document,d=e=>{var t;if(s!==e){f();const a=n.get(e);a&&(a.preventClean=!0,null===(t=a.highlight)||void 0===t||t.call(a),s=e)}},f=()=>{var e;const t=n.get(s);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),s=void 0)};function p(){const e=u;let t;if(e&&w()){const a=c.elementFromPoint(e.x,e.y);a&&(t=function(e){return O(e,(e=>n.get(e)))}(a))}d(t)}const v=t=>{var n;w()&&(n=t.target,!Boolean(O(n,(t=>t.id===e))))&&(t.stopPropagation(),t.preventDefault())},h=e=>{var t;t={x:e.clientX,y:e.clientY},u=t,p()},m=()=>{l=new Set,p()},b=e=>{const t=e.key;void 0!==t&&l.add(t),p()},y=e=>{l.delete(e.key),p()},E=()=>{var e;const t=n.get(s);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)},L=e=>{v(e),w()&&s&&(a(e,s),f())};function O(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function w(){for(const e of t)if(!l.has(e))return!1;return!0}return Object.freeze({run:function(){g.addEventListener("blur",m,ne),g.addEventListener("keydown",b,ne),g.addEventListener("keyup",y,ne),g.addEventListener("mousemove",h,ae),g.addEventListener("scroll",E,ae),g.addEventListener("click",L,ne),g.addEventListener("mouseenter",v,ne),g.addEventListener("mouseover",v,ne),g.addEventListener("mouseout",v,ne),g.addEventListener("mouseleave",v,ne),g.addEventListener("mousedown",v,ne),g.addEventListener("mouseup",v,ne)},stop:function(){g.removeEventListener("blur",m,ne),g.removeEventListener("keydown",b,ne),g.removeEventListener("keyup",y,ne),g.removeEventListener("mousemove",h,ae),g.removeEventListener("scroll",E,ae),g.removeEventListener("click",L,ne),g.removeEventListener("mouseenter",v,ne),g.removeEventListener("mouseover",v,ne),g.removeEventListener("mouseout",v,ne),g.removeEventListener("mouseleave",v,ne),g.removeEventListener("mousedown",v,ne),g.removeEventListener("mouseup",v,ne)}})},oe=(e,t,n)=>{const o=J({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),i=re({highlightKeys:e.highlightKeys,elementStore:t,onClick:(e,a)=>{const r=t.get(a);n({event:e,keysAndDefaults:u(r)})},options:e});function s(){return e.targetElement||document.body}function u(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:function(n,i,s){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${a}]`)}(n))return;const u=n;let l=t.get(u);l||(l={nodes:new Map},t.set(u,l),u.setAttribute(r,"true")),l.nodes.set(i,s),o.initHighlighter(u,l)},forEachElement:t.forEachElement,findAll:function(e,n){const a=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>te({key:e,ns:d(n)},{key:t.key,ns:d(t.ns)})))){a.push(r);break}}})),a},refreshAll:function(){t.forEachElement(((e,n)=>{n.preventClean||(function(e){e.nodes=new Map(function*(e){for(const[t,n]of e.nodes.entries())ee(s(),t)&&(yield[t,n])}(e))}(n),0===n.nodes.size&&function(e,n){var a;n.highlightEl&&(null===(a=n.unhighlight)||void 0===a||a.call(n));e.removeAttribute(r),t.remove(e)}(e,n))}))},run:function(e){e&&i.run()},stop:function(){i.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t))}))}})},ie=()=>{let e,t=!1;const a=(()=>{const e=new Map;return Object.freeze({set:function(t,n){e.set(t,n)},get:function(t){return t&&e.get(t)},remove:function(t){return e.delete(t)},forEachElement:function(t){e.forEach(((e,n)=>t(n,e)))}})})(),r=({mouseHighlight:e,options:r,wrapper:o,onClick:s})=>{if(i())return;const l=(e=>Object.freeze({getSuitableParent:function t(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(a):a}}))(r),c=((e,t)=>{const n=e=>q(t.getTextXPath(),e),a=n=>{let a=[];for(const[r,o]of Object.entries(e.tagAttributes))for(const e of o){const o=q(t.getAttributeXPath({tag:r,attribute:e}),n);a=[...a,...o]}return a};return Object.freeze({handleAttributes:a,handleChildList:e=>{let t=[];return t=t.concat(a(e)),t=t.concat(n(e)),t},handleText:n})})(r,o),g=oe(r,a,s);function d(e){for(const t of e){const e=Z(t),n=e?o.unwrap(e):null;if(n){const{text:a,keys:r}=n;Q(t,a);const o=u(e,r),i=l.getSuitableParent(t);g.register(i,t,o)}}}const f=e=>{q(`./descendant-or-self::*[@${n}]`,e).forEach((e=>{const t=e.getAttributeNode(n),a=l.getSuitableParent(t);g.register(a,t,{oldTextContent:"",keys:[{key:Z(t)}],keyAttributeOnly:!0})}))},p=new MutationObserver((e=>{if(t)for(const t of e){let e=[];switch(t.type){case"characterData":e=c.handleText(t.target);break;case"childList":f(t.target),e=c.handleChildList(t.target);break;case"attributes":f(t.target),e=c.handleAttributes(t.target)}d(e),g.refreshAll()}})),v=r.targetElement||document.body;return t=!0,g.run(e),f(v),d(c.handleChildList(v)),p.observe(v,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,g.stop(),p.disconnect()},elementRegistry:g,wrapper:o}};return Object.freeze({run(t){e=r(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null===(a=null==e?void 0:(n=e.elementRegistry).forEachElement)||void 0===a||a.call(n,t)},highlight(t,n){const a=(null==e?void 0:e.elementRegistry.findAll(t,n))||[];return a.forEach((e=>{var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight(){a.forEach((e=>{var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})},se=["‌","‍"],ue=RegExp(`([${se.join("")}]{9})+`,"gu"),le=e=>{const t=(e=>Array.from((new TextEncoder).encode(e)))(e).map(Number),n=t.map((e=>(e=>{const t=8-e.length;return"0".repeat(t)+e})(e.toString(2))+"0")).join("");return Array.from(n).map((e=>se[Number(e)])).join("")},ce=e=>{const t=Array.from(e).map((e=>se.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},ge=()=>{const e=(()=>{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]})})(),t=e=>JSON.parse(e||"{}");return Object.freeze({unwrap:n=>{const a=[],r=(e=>{var t;const n=null===(t=e.match(ue))||void 0===t?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(ce))||[]})(n);r.forEach((n=>{const[r]=(e=>{const t=[];for(const n of e)t.push(n.codePointAt(0));return t})(n),o=e.numberToValue(r),{k:i,d:s,n:u}=t(o);a.push({key:i,defaultValue:s,ns:u})}));const o=(e=>e.replace(ue,""))(n);return{text:o,keys:a}},wrap:({key:t,defaultValue:n,translation:a,ns:r})=>{const o=(e=>{const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)})({key:t,ns:r,defaultValue:n}),i=e.valueToNumber(o),s=a||"",u=le(String.fromCodePoint(i));return"string"==typeof s?s+u:s},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${se[0]}${se[0]}') or contains(., '${se[1]}${se[0]}')]`,getAttributeXPath:({tag:e,attribute:t})=>`descendant-or-self::${e}/@${t}[contains(., '${se[0]}${se[0]}') or contains(., '${se[1]}${se[0]}')]`})};function de(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}const fe=({inputPrefix:e,inputSuffix:t,translate:n})=>{function a(e){const{key:t,params:a,defaultValue:r,ns:o}=function(e){let t=!1,n="",a="",r="KEY";const o={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{o.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==r||","!==s?"KEY"!==r||"|"!==s?"NAMESPACE"!==r||","!==s?"KEY"!==r||":"!==s?"DEFAULT_VALUE"!==r||":"!==s?"PARAM_NAME"!==r||":"!==s?"PARAM_VALUE"!==r||","!==s?n+=s:(r="PARAM_NAME",o.params[a]=n,n=""):(r="PARAM_VALUE",a=n,n=""):(r="PARAM_NAME",o.defaultValue=n,n=""):(r="PARAM_NAME",o.key=n,n=""):(r="DEFAULT_VALUE",i(n),n=""):(r="NAMESPACE",o.key=n,n=""):(r="DEFAULT_VALUE",o.key=n,n=""):t=!0;return"KEY"===r&&(o.key=n),"DEFAULT_VALUE"===r&&(o.defaultValue=n),"PARAM_VALUE"===r&&(o.params[a]=n),"NAMESPACE"===r&&i(n),o}(e);return{translated:n({key:t,params:a,defaultValue:r,ns:o,noWrap:!0}),key:t,params:a,defaultValue:r,ns:o}}const r=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=e=>"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:r,ns:i})=>{let s=Object.entries(a||{}).map((([e,t])=>`${o(e)}:${o(t)}`)).join(",");s=s.length?`:${s}`:"";const u=void 0!==r?`,${o(r)}`:"",l="string"==typeof i?[i]:i,c=(null==l?void 0:l.length)?`|${l.map((e=>o(e))).join("|")}`:"";return`${e}${o(n)}${c}${u}${s}${t}`},unwrap:n=>{const o=new RegExp(`(\\\\?)(${r(e)}(.*?)${r(t)})`,"gs"),i=[];let s,u=!1,l=0,c="";for(;null!==(s=o.exec(n));){let e=s[1];const[t,r,o,g]=s,{index:d,input:f}=s;if(c+=f.substr(l,d-l),l=d+t.length,"\\"===e){if(!de(d,n)){c+=o;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),u=!0,c+=e+p.translated}return c+=n.substring(l),u?{text:c,keys:i}:{text:n,keys:[]}},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${e}') and contains(., '${t}')]`,getAttributeXPath:({tag:n,attribute:a})=>`descendant-or-self::${n}/@${a}[contains(., '${e}') and contains(., '${t}')]`})},pe=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=ie();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=fe({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run(Object.assign(Object.assign({},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&&Q(t,n.text)}}))},outputNotFormattable:!0}))})):t.setObserver((()=>{const e=ie();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=ge();e.run(Object.assign(Object.assign({},t),{wrapper:n}))},retranslate(){},outputNotFormattable:!1}))})),e),ve="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function he(e){const t=ve.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function me(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,r=0;const o=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|he(e[i]),n+=5,n>=8&&(o[r++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",r=Math.pow(2,16)-1;for(let e=0;e<n;e+=r)e+r>n&&(r=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+r));return a}(o.buffer)}function be(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=me(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}const ye=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:r}){var o;const i=null!==(o=be(t))&&void 0!==o?o:r;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===r)throw new Error("You need to specify 'projectId' when using PAT key");return fetch(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 Ee({message:e,recievingMessage:t,data:n,attempts:a=1}){let r=!1;const o=()=>new Promise(((a,r)=>{const o=function(e,t){const n=n=>{var a,r;e.includes(null===(a=n.data)||void 0===a?void 0:a.type)&&t(null===(r=n.data)||void 0===r?void 0:r.data)};return window.addEventListener("message",n,!1),{unsubscribe:()=>{window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(i),s(),a(e)}));window.postMessage({type:e,data:n},window.origin);const i=setTimeout((function(){s(),r()}),300);function s(){o.unsubscribe()}}));return{cancel:()=>r=!0,promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await o()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}const Le="tolgee-in-context-tools.umd.min.js",Oe="@tolgee/in-context-tools",we="InContextTools",ke="https://cdn.jsdelivr.net/npm";let je=null;function Ae(e){var t;return je||(je=(t=`${ke}/@tolgee/web@${e}/dist/${Le}`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.body.appendChild(a)}))).then((()=>window[Oe][we]))),je}const xe="__tolgee_apiKey",Pe="__tolgee_apiUrl";function Ne(){const e=sessionStorage.getItem(xe)||void 0,t=sessionStorage.getItem(Pe)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Te(){sessionStorage.removeItem(xe),sessionStorage.removeItem(Pe)}let Se=()=>e=>e;"undefined"!=typeof window&&(Se=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=Ee({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(Te)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ne()&&(async()=>{const e=await Ae("5.4.3-prerelease.9ea3f1fa.0");return t=>{const n=Ne();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",Re=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(s("LanguageStorage"),localStorage.getItem($e)||void 0),setLanguage(e){s("LanguageStorage"),localStorage.setItem($e,e)}}),e),De=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){s("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),r=a(window.navigator.language);return e.find((e=>a(e)===r))||void 0}}),e);const Ce=e=>e.endsWith("/")?e.slice(0,-1):e,Ie={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Ce(n)}/${e}/${t}.json`:`${Ce(n)}/${t}.json`,getData:e=>e.json(),headers:{Accept:"application/json"}},Ue=e=>{const t=Object.assign(Object.assign(Object.assign({},Ie),e),{headers:Object.assign(Object.assign({},Ie.headers),null==e?void 0:e.headers)}),{prefix:n,getPath:a,getData:r,headers:o}=t,i=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}(t,["prefix","getPath","getData","headers"]);return{getRecord({namespace:e,language:t}){const s=a({namespace:e,language:t,prefix:n});return fetch(s,Object.assign({headers:o},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return r(e)}))}}},_e=e=>(t,n)=>(n.addBackend(Ue(e)),t),Fe=()=>$().use(Se()),Me=()=>e=>e;export{_e as BackendFetch,Se as BrowserExtensionPlugin,e as DEVTOOLS_ID,ye as DevBackend,Me as DevTools,G as FormatSimple,De as LanguageDetector,Re as LanguageStorage,pe as ObserverPlugin,t as PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY,r as TOLGEE_ATTRIBUTE_NAME,a as TOLGEE_RESTRICT_ATTRIBUTE,n as TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE,Fe as Tolgee,$ as TolgeeCore,d as getFallback,f as getFallbackArray,be as getProjectIdFromApiKey,T 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"]=e["@tolgee/web"]||{},e["@tolgee/web"].production={}))}(this,(function(e){"use strict";const t="__tolgee_dev_tools",n="data-tolgee-key-only",a="data-tolgee-restricted",r="_tolgee",o="_tolgee-highlighter";function i(){var e,t;return void 0===(null===(t=null===(e=globalThis.window)||void 0===e?void 0:e.document)||void 0===t?void 0:t.createElement)}function s(e){if(i())throw new Error(`${e}: Can't run on the server`)}function l(e,t){return{oldTextContent:e,keys:t}}function u(e){return Boolean(e&&"function"==typeof e.then)}const c=(e,t)=>u(e)?Promise.resolve(e).then(t):t(e),g=e=>`Tolgee: You need to specify '${e}' option`;function d(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function f(e){return d(e)||[]}function p(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?f(t):f(null==t?void 0:t[e]);var n}function v(e){return Array.from(new Set(e))}function h(e){return e?e.replace(/\/+$/,""):e}const m=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})))}})},b=(e,t,n)=>{const a=new Set,r=new Set;let o=[];const i=()=>{if(0===o.length)return;const e=o;o=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));(e=>{const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))})(n?Array.from(n.keys()):void 0)};return Object.freeze({listenSome:e=>{const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(f(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a},listen:e=>{a.add(e);return{unsubscribe:()=>{a.delete(e)}}},emit:(t,n)=>{e()&&(o.push(t),n?setTimeout(i,0):i())}})},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},E=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},L=({language:e,namespace:t})=>t?`${e}:${t}`:e,O=(e,t,n,a,r,o,i)=>{const s=new Map,l=new Map;let u={},c=0;function g(t,n,a){const r=L(t);l.set(r,{data:y(n),version:a}),e.emit(t)}function d(e,t){g(e,t,c)}function p(e,t=!1){const n=l.get(L(e));return n&&t?n.version===c:Boolean(n)}function h(e){var t;return null===(t=l.get(L(a(e))))||void 0===t?void 0:t.data}function m(e){let n;if(!n){const t=u[L(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n}return Object.freeze({addStaticData:function(e){e&&(u=Object.assign(Object.assign({},u),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=E(e),a=l.get(e);a&&0!==a.version||g(n,t,0)}})))},invalidate:function(){s.clear(),c+=1},addRecord:d,exists:p,getRecord:h,getTranslation:function(e,t){var n;return null===(n=l.get(L(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(L({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return v(e)},getTranslationFallback:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(L({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation:function(t,n,a){var r;const o=null===(r=l.get(L(t)))||void 0===r?void 0:r.data;null==o||o.set(n,a),e.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching:function(e){if(r())return!0;if(void 0===e)return s.size>0;const t=f(e);return Boolean(Array.from(s.keys()).find((e=>t.includes(E(e).namespace))))},isLoading:function(e,t){const n=f(t);return Boolean(r()||Array.from(s.keys()).find((t=>{const a=E(t);return(!n.length||n.includes(a.namespace))&&!p({namespace:a.namespace,language:e})})))},loadRecords:async function(e,t){const r=e.map((e=>{const r=a(e),o=L(r),i=s.get(o);if(i)return{new:!1,promise:i,keyObject:r,cacheKey:o};const l=function(e,t){var a;let r;return t&&(r=null===(a=n(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),r||(r=m(e)),r}(r,t)||Promise.resolve(void 0);return s.set(o,l),{new:!0,promise:l,keyObject:r,cacheKey:o}}));o.notify(),i.notify();const l=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=s.get(e.cacheKey)!==e.promise;if(e.new&&!n){s.delete(e.cacheKey);const n=l[t];n?d(e.keyObject,n):h(e.keyObject)||d(e.keyObject,{})}})),o.notify(),i.notify(),r.map((e=>h(e.keyObject)))},getAllRecords:function(){return Array.from(l.entries()).map((([e,t])=>Object.assign(Object.assign({},E(e)),{data:t.data})))}})};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 r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const k="invalid",j={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"]},observerType:"invisible",onFormatError:k,apiUrl:"https://app.tolgee.io"},A=(...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},T=(e,t)=>{const n=A(j,null==t?void 0:t.initialOptions,e);return n.apiUrl=h(n.apiUrl),{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}},P=(e,t,n,a,r,o)=>{const i={ui:void 0},s={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},l=async({keysAndDefaults:e,event:t})=>{var n;const o=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,ns:a({key:e,ns:t}),translation:r({key:e,ns:t})})));null===(n=s.ui)||void 0===n||n.handleElementClick(o,t)},g=(e,t)=>{var n,a;return(null===(a=null===(n=s.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},d=e=>{const t=r({key:e.key,ns:e.ns});return A(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))},f=e=>{s.observer=null==e?void 0:e()},p=()=>Boolean(s.observer),v=e=>{e&&s.formatters.push(e)},h=e=>{s.finalFormatter=e},m=e=>{i.ui=e},b=()=>Boolean(i.ui),y=e=>{s.languageStorage=e},E=e=>{s.languageDetector=e},L=e=>{e&&s.backends.push(e)},O=e=>{s.devBackend=e},j=()=>s.devBackend;function A(n){var a,{formatEnabled:r}=n,o=w(n,["formatEnabled"]);const{key:i,translation:l,defaultValue:u,noWrap:c,params:g,orEmpty:d,ns:f}=o,p=l||u;let v=p||(d?"":i);const h=e(),m=r||!(null===(a=s.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>s.observer&&!c?s.observer.wrap({key:i,translation:e,defaultValue:u,params:g,ns:f}):e;v=b(v);try{if(p&&h&&m)for(const e of s.formatters)v=e.format({translation:v,language:h,params:g});s.finalFormatter&&p&&h&&m&&(v=s.finalFormatter.format({translation:v,language:h,params:g}))}catch(e){console.error(e);const n=("string"==typeof(y=e)?y:"string"==typeof(null==y?void 0:y.message)?y.message:void 0)||k,a=t().onFormatError,r=typeof a;v="string"===r?a:"function"===r?a(n,o):k,v=b(v)}var y;return v}return Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:h,addFormatter:v,setObserver:f,hasObserver:p,setUi:m,hasUi:b,setDevBackend:O,addBackend:L,setLanguageDetector:E,setLanguageStorage:y}))},formatTranslation:A,getDevBackend:j,getBackendRecord:({language:e,namespace:t})=>{for(const n of s.backends){const a=n.getRecord({language:e,namespace:t});if(u(a))return null==a?void 0:a.catch((e=>(console.error(e),{})));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;const{apiKey:r,apiUrl:o,projectId:i}=t();return null===(a=s.devBackend)||void 0===a?void 0:a.getRecord({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:n})},getLanguageDetector:()=>s.languageDetector,getLanguageStorage:()=>s.languageStorage,getInitialLanguage:()=>{var e;const t=n(),a=null===(e=s.languageStorage)||void 0===e?void 0:e.getLanguage();return c(a,(e=>t&&!t.includes(e)||!e?(()=>{if(!s.languageDetector)return;const e=n();return s.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var t;null===(t=s.languageStorage)||void 0===t||t.setLanguage(e)},run:()=>{var e,n;const{apiKey:a,apiUrl:r,projectId:u,observerOptions:c}=t();s.ui=null===(e=i.ui)||void 0===e?void 0:e.call(i,{apiKey:a,apiUrl:r,projectId:u,highlight:g,changeTranslation:o}),null===(n=s.observer)||void 0===n||n.run({mouseHighlight:!0,options:c,translate:d,onClick:l})},stop:()=>{var e;s.ui=void 0,null===(e=s.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=s.observer)||void 0===e||e.retranslate()},highlight:g,unwrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:function(){return Boolean(j())}})},x=(e,t,n)=>{let a=e;return Object.freeze({init:function(e){a=e},notify:function(){const e=t();a!==e&&n(e),a=e}})};const N=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:r}=e,o=w(e,["ns","noWrap","orEmpty","params"]);const i={ns:t,noWrap:n,orEmpty:a};return Object.assign(Object.assign({},i),{params:Object.assign({},o)})}(n)),a)),a},R=({options:e})=>{const t=((e,t)=>{let n=!0;function a(){return n}const r=m(a),o=m(a),i=m(a),s=m(a),l=m(a),u=m(a),c=m(a),g=b(a,e,t);return l.listen((()=>g.emit())),o.listen((()=>g.emit())),c.listen((({value:e})=>{g.emit([e.namespace],!0)})),Object.freeze({onPendingLanguageChange:r,onLanguageChange:o,onLoadingChange:i,onFetchingChange:s,onInitialLoaded:l,onRunningChange:u,onCacheChange:c,onUpdate:g,setEmmiterActive:function(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return r.listen(t);case"language":return o.listen(t);case"loading":return i.listen(t);case"fetching":return s.listen(t);case"initialLoad":return l.listen(t);case"running":return u.listen(t);case"cache":return c.listen(t);case"update":return g.listen(t)}}})})(s,l),n=x(!1,(()=>i.isFetching()),t.onFetchingChange.emit),a=x(!1,(()=>k()),t.onLoadingChange.emit),r=((e,t,n)=>{let a,r=T();function o(){return r.language||r.initialOptions.language}function i(){return Object.assign(Object.assign({},r.initialOptions),a)}return Object.freeze({init:function(e){r=T(e,r)},isRunning:function(){return r.isRunning},setRunning:function(e){r.isRunning!==e&&(r.isRunning=e,n.emit(e))},isInitialLoading:function(){return r.isInitialLoading},setInitialLoading:function(e){r.isInitialLoading=e},getLanguage:o,setLanguage:function(t){r.language!==t&&(r.language=t,e.emit(t))},getPendingLanguage:function(){return r.pendingLanguage||o()},setPendingLanguage:function(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,t.emit(e))},getInitialOptions:i,addActiveNs:function(e){f(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t?r.activeNamespaces.set(e,t+1):r.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){f(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t&&t>1?r.activeNamespaces.set(e,t-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return v([...r.initialOptions.ns||[r.initialOptions.defaultNs],...f(r.initialOptions.fallbackNs),...r.activeNamespaces.keys()])},getFallbackLangs:function(e){const t=e||o();return t?v([t,...p(t,r.initialOptions.fallbackLanguage)]):[]},getFallbackNs:function(){return f(r.initialOptions.fallbackNs)},getDefaultNs:function(e){return void 0===e?r.initialOptions.defaultNs:e},getAvailableLanguages:function(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>E(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?i().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){a=e?Object.assign(Object.assign({},e),{apiUrl:h(e.apiUrl)}):void 0}})})(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),o=P(r.getLanguage,r.getInitialOptions,r.getAvailableLanguages,(function({key:e,ns:t}){const n=r.getFallbackLangs(),a=d(t||void 0);return i.getTranslationNs(a,n,e)}),R,L),i=O(t.onCacheChange,o.getBackendRecord,o.getBackendDevRecord,r.withDefaultNs,r.isInitialLoading,n,a);function s(){return r.getFallbackNs()}function l(e){return r.getDefaultNs(e)}function d(e){return[...f(l(e)),...s()]}function y(e){return[...f(e||l()),...r.getRequiredNamespaces()]}function L(e,t,n){const a=r.withDefaultNs(e),o=i.getTranslation(a,t);return i.changeTranslation(a,t,n),{revert:()=>{i.changeTranslation(a,t,o)}}}function w(e){r.init(e),i.addStaticData(r.getInitialOptions().staticData)}function k(e){return i.isLoading(r.getLanguage(),e)}function j(){return Boolean(r.getInitialOptions().apiKey&&r.getInitialOptions().apiUrl)}function A(e,t){const n=function(e,t){const n=r.getFallbackLangs(e),a=y(t),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}(e,t);if(n.length)return c(D(n),(()=>{}))}function R({key:e,ns:t}){const n=d(t||void 0),a=r.getFallbackLangs();return i.getTranslationFallback(n,a,e)}function S(){const e=c(function(){if(r.getLanguage())return;if(!r.getInitialOptions().defaultLanguage)throw new Error(g("defaultLanguage"));const e=o.getInitialLanguage();return c(e,(e=>{const t=e||r.getInitialOptions().defaultLanguage;t&&r.setLanguage(t)}))}(),(()=>A()));if(u(e))return r.setInitialLoading(!0),n.notify(),a.notify(),Promise.resolve(e).then((()=>{r.setInitialLoading(!1),n.notify(),a.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}function D(e){return i.loadRecords(e,j())}e&&w(e),t.onUpdate.listen((()=>{r.isRunning()&&o.retranslate()}));const $=()=>{const e=o.getLanguageDetector()||o.getLanguageStorage();if(e){if(!r.getAvailableLanguages())throw new Error(g("availableLanguages"))}if(!r.getLanguage()&&!r.getInitialOptions().defaultLanguage)throw e?new Error(g("defaultLanguage")):new Error(g("language"))};return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),o),i),{init:w,changeLanguage:async function(e){r.getPendingLanguage()===e&&r.getLanguage()===e||(r.setPendingLanguage(e),r.isRunning()&&await A(e),e===r.getPendingLanguage()&&(r.setLanguage(e),o.setStoredLanguage(e)))},getTranslation:R,changeTranslation:L,addActiveNs:async function(e,t){t||r.addActiveNs(e),r.isRunning()&&await A(void 0,e)},loadRecords:D,loadRecord:async function(e){return(await D([e]))[0]},isLoading:k,isLoaded:function(e){const t=r.getLanguage();if(!t)return!1;const n=r.getFallbackLangs(t),a=y(e),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=N(...e),n=R(t);return o.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:j,run:function(){let e;return $(),r.isRunning()||(j()&&i.invalidate(),r.setRunning(!0),o.run(),e=S()),Promise.resolve(e)},stop:function(){r.isRunning()&&(o.stop(),r.setRunning(!1))}}))},S=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=A(e.options,n),t),init(t){const n=(e=>{const t=R({options:e}),n=e=>{const n=t.isRunning();n&&t.stop(),e(),n&&t.run()},a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmmiterActive:t.setEmmiterActive,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,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})(A(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},D=0,$=1,C=2;class I extends Error{constructor(e,t,n){let a;a=e===D?"Empty parameter":e===$?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function _(e){return/\s/.test(e)}const U=0,F=1,B=2,M=3,V=4,z=new Set([B,F,U]),K="'",Y=new Set(["{","}",K]),G=e=>/[0-9a-zA-Z_]/.test(e);function W(e,t){const[n,a]=function(e){let t=U,n="",a="",r="";const o=[],i=[];let s=0;function l(t){throw new I(t,s,e)}const u=()=>{o.push(n),n=""},c=()=>{""===a&&l(D),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case U:r===K?(n+=r,t=F):"{"===r?(u(),t=M):(n+=r,t=U);break;case F:Y.has(r)?(n=n.slice(0,-1)+r,t=B):(n+=r,t=U);break;case B:r===K?t=U:(n+=r,t=B);break;case M:"}"===r?(c(),t=U):_(r)?""!==a&&(c(),t=V):(G(r)||l($),a+=r,t=M);break;case V:"}"==r?t=U:_(r)?t=V:l($)}return z.has(t)||l(C),u(),[o,i]}(e),r=[n[0]];for(let o=1;o<n.length;o++){const i=null==t?void 0:t[a[o-1]];if(void 0===i)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);r.push(String(i)),r.push(n[o])}return r.join("")}const X={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},H=({highlightColor:e,highlightWidth:t})=>Object.freeze({initHighlighter:function(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;let r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(o),Object.entries(X).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const i=n.getBoundingClientRect();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)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,a)}});function J(e,t){var n;const a=function(e){switch(e.nodeType){case Node.ATTRIBUTE_NODE:return e.ownerElement||void 0;case Node.TEXT_NODE:return e.parentElement||void 0;case Node.DOCUMENT_NODE:case Node.ELEMENT_NODE:return e;default:return}}(t),r=[];if(!a)return r;const o=null===document||void 0===document?void 0:document.evaluate(e,a,void 0,XPathResult.ANY_TYPE);let i;for(;i=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)r.push(i);return r}function q(e){return e.textContent}function Z(e,t){e.textContent=t}function Q(e,t){if(e.contains(t))return!0;if(t instanceof Attr){const n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}const ee=(e,t)=>{var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,r=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((e=>{var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return a&&r},te={capture:!0},ne={capture:!0,passive:!0},ae=({highlightKeys:e,elementStore:n,onClick:a,options:r})=>{var o,i;let s,l,u=new Set;const c=(null===(o=r.targetElement)||void 0===o?void 0:o.getRootNode())||document,g=(null===(i=r.targetElement)||void 0===i?void 0:i.ownerDocument)||document,d=e=>{var t;if(s!==e){f();const a=n.get(e);a&&(a.preventClean=!0,null===(t=a.highlight)||void 0===t||t.call(a),s=e)}},f=()=>{var e;const t=n.get(s);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),s=void 0)};function p(){const e=l;let t;if(e&&w()){const a=c.elementFromPoint(e.x,e.y);a&&(t=function(e){return O(e,(e=>n.get(e)))}(a))}d(t)}const v=e=>{var n;w()&&(n=e.target,!Boolean(O(n,(e=>e.id===t))))&&(e.stopPropagation(),e.preventDefault())},h=e=>{var t;t={x:e.clientX,y:e.clientY},l=t,p()},m=()=>{u=new Set,p()},b=e=>{const t=e.key;void 0!==t&&u.add(t),p()},y=e=>{u.delete(e.key),p()},E=()=>{var e;const t=n.get(s);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)},L=e=>{v(e),w()&&s&&(a(e,s),f())};function O(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function w(){for(const t of e)if(!u.has(t))return!1;return!0}return Object.freeze({run:function(){g.addEventListener("blur",m,te),g.addEventListener("keydown",b,te),g.addEventListener("keyup",y,te),g.addEventListener("mousemove",h,ne),g.addEventListener("scroll",E,ne),g.addEventListener("click",L,te),g.addEventListener("mouseenter",v,te),g.addEventListener("mouseover",v,te),g.addEventListener("mouseout",v,te),g.addEventListener("mouseleave",v,te),g.addEventListener("mousedown",v,te),g.addEventListener("mouseup",v,te)},stop:function(){g.removeEventListener("blur",m,te),g.removeEventListener("keydown",b,te),g.removeEventListener("keyup",y,te),g.removeEventListener("mousemove",h,ne),g.removeEventListener("scroll",E,ne),g.removeEventListener("click",L,te),g.removeEventListener("mouseenter",v,te),g.removeEventListener("mouseover",v,te),g.removeEventListener("mouseout",v,te),g.removeEventListener("mouseleave",v,te),g.removeEventListener("mousedown",v,te),g.removeEventListener("mouseup",v,te)}})},re=(e,t,n)=>{const o=H({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),i=ae({highlightKeys:e.highlightKeys,elementStore:t,onClick:(e,a)=>{const r=t.get(a);n({event:e,keysAndDefaults:l(r)})},options:e});function s(){return e.targetElement||document.body}function l(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:function(n,i,s){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${a}]`)}(n))return;const l=n;let u=t.get(l);u||(u={nodes:new Map},t.set(l,u),l.setAttribute(r,"true")),u.nodes.set(i,s),o.initHighlighter(l,u)},forEachElement:t.forEachElement,findAll:function(e,n){const a=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>ee({key:e,ns:d(n)},{key:t.key,ns:d(t.ns)})))){a.push(r);break}}})),a},refreshAll:function(){t.forEachElement(((e,n)=>{n.preventClean||(function(e){e.nodes=new Map(function*(e){for(const[t,n]of e.nodes.entries())Q(s(),t)&&(yield[t,n])}(e))}(n),0===n.nodes.size&&function(e,n){var a;n.highlightEl&&(null===(a=n.unhighlight)||void 0===a||a.call(n));e.removeAttribute(r),t.remove(e)}(e,n))}))},run:function(e){e&&i.run()},stop:function(){i.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t))}))}})},oe=()=>{let e,t=!1;const a=(()=>{const e=new Map;return Object.freeze({set:function(t,n){e.set(t,n)},get:function(t){return t&&e.get(t)},remove:function(t){return e.delete(t)},forEachElement:function(t){e.forEach(((e,n)=>t(n,e)))}})})(),r=({mouseHighlight:e,options:r,wrapper:o,onClick:s})=>{if(i())return;const u=(e=>Object.freeze({getSuitableParent:function t(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(a):a}}))(r),c=((e,t)=>{const n=e=>J(t.getTextXPath(),e),a=n=>{let a=[];for(const[r,o]of Object.entries(e.tagAttributes))for(const e of o){const o=J(t.getAttributeXPath({tag:r,attribute:e}),n);a=[...a,...o]}return a};return Object.freeze({handleAttributes:a,handleChildList:e=>{let t=[];return t=t.concat(a(e)),t=t.concat(n(e)),t},handleText:n})})(r,o),g=re(r,a,s);function d(e){for(const t of e){const e=q(t),n=e?o.unwrap(e):null;if(n){const{text:a,keys:r}=n;Z(t,a);const o=l(e,r),i=u.getSuitableParent(t);g.register(i,t,o)}}}const f=e=>{J(`./descendant-or-self::*[@${n}]`,e).forEach((e=>{const t=e.getAttributeNode(n),a=u.getSuitableParent(t);g.register(a,t,{oldTextContent:"",keys:[{key:q(t)}],keyAttributeOnly:!0})}))},p=new MutationObserver((e=>{if(t)for(const t of e){let e=[];switch(t.type){case"characterData":e=c.handleText(t.target);break;case"childList":f(t.target),e=c.handleChildList(t.target);break;case"attributes":f(t.target),e=c.handleAttributes(t.target)}d(e),g.refreshAll()}})),v=r.targetElement||document.body;return t=!0,g.run(e),f(v),d(c.handleChildList(v)),p.observe(v,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,g.stop(),p.disconnect()},elementRegistry:g,wrapper:o}};return Object.freeze({run(t){e=r(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null===(a=null==e?void 0:(n=e.elementRegistry).forEachElement)||void 0===a||a.call(n,t)},highlight(t,n){const a=(null==e?void 0:e.elementRegistry.findAll(t,n))||[];return a.forEach((e=>{var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight(){a.forEach((e=>{var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})},ie=["‌","‍"],se=RegExp(`([${ie.join("")}]{9})+`,"gu"),le=e=>{const t=(e=>Array.from((new TextEncoder).encode(e)))(e).map(Number),n=t.map((e=>(e=>{const t=8-e.length;return"0".repeat(t)+e})(e.toString(2))+"0")).join("");return Array.from(n).map((e=>ie[Number(e)])).join("")},ue=e=>{const t=Array.from(e).map((e=>ie.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},ce=()=>{const e=(()=>{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]})})(),t=e=>JSON.parse(e||"{}");return Object.freeze({unwrap:n=>{const a=[],r=(e=>{var t;const n=null===(t=e.match(se))||void 0===t?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(ue))||[]})(n);r.forEach((n=>{const[r]=(e=>{const t=[];for(const n of e)t.push(n.codePointAt(0));return t})(n),o=e.numberToValue(r),{k:i,d:s,n:l}=t(o);a.push({key:i,defaultValue:s,ns:l})}));const o=(e=>e.replace(se,""))(n);return{text:o,keys:a}},wrap:({key:t,defaultValue:n,translation:a,ns:r})=>{const o=(e=>{const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)})({key:t,ns:r,defaultValue:n}),i=e.valueToNumber(o),s=a||"",l=le(String.fromCodePoint(i));return"string"==typeof s?s+l:s},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${ie[0]}${ie[0]}') or contains(., '${ie[1]}${ie[0]}')]`,getAttributeXPath:({tag:e,attribute:t})=>`descendant-or-self::${e}/@${t}[contains(., '${ie[0]}${ie[0]}') or contains(., '${ie[1]}${ie[0]}')]`})};function ge(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}const de=({inputPrefix:e,inputSuffix:t,translate:n})=>{function a(e){const{key:t,params:a,defaultValue:r,ns:o}=function(e){let t=!1,n="",a="",r="KEY";const o={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{o.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==r||","!==s?"KEY"!==r||"|"!==s?"NAMESPACE"!==r||","!==s?"KEY"!==r||":"!==s?"DEFAULT_VALUE"!==r||":"!==s?"PARAM_NAME"!==r||":"!==s?"PARAM_VALUE"!==r||","!==s?n+=s:(r="PARAM_NAME",o.params[a]=n,n=""):(r="PARAM_VALUE",a=n,n=""):(r="PARAM_NAME",o.defaultValue=n,n=""):(r="PARAM_NAME",o.key=n,n=""):(r="DEFAULT_VALUE",i(n),n=""):(r="NAMESPACE",o.key=n,n=""):(r="DEFAULT_VALUE",o.key=n,n=""):t=!0;return"KEY"===r&&(o.key=n),"DEFAULT_VALUE"===r&&(o.defaultValue=n),"PARAM_VALUE"===r&&(o.params[a]=n),"NAMESPACE"===r&&i(n),o}(e);return{translated:n({key:t,params:a,defaultValue:r,ns:o,noWrap:!0}),key:t,params:a,defaultValue:r,ns:o}}const r=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=e=>"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:r,ns:i})=>{let s=Object.entries(a||{}).map((([e,t])=>`${o(e)}:${o(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==r?`,${o(r)}`:"",u="string"==typeof i?[i]:i,c=(null==u?void 0:u.length)?`|${u.map((e=>o(e))).join("|")}`:"";return`${e}${o(n)}${c}${l}${s}${t}`},unwrap:n=>{const o=new RegExp(`(\\\\?)(${r(e)}(.*?)${r(t)})`,"gs"),i=[];let s,l=!1,u=0,c="";for(;null!==(s=o.exec(n));){let e=s[1];const[t,r,o,g]=s,{index:d,input:f}=s;if(c+=f.substr(u,d-u),u=d+t.length,"\\"===e){if(!ge(d,n)){c+=o;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:[]}},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${e}') and contains(., '${t}')]`,getAttributeXPath:({tag:n,attribute:a})=>`descendant-or-self::${n}/@${a}[contains(., '${e}') and contains(., '${t}')]`})},fe="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function pe(e){const t=fe.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function ve(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,r=0;const o=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|pe(e[i]),n+=5,n>=8&&(o[r++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",r=Math.pow(2,16)-1;for(let e=0;e<n;e+=r)e+r>n&&(r=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+r));return a}(o.buffer)}function he(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=ve(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}function me({message:e,recievingMessage:t,data:n,attempts:a=1}){let r=!1;const o=()=>new Promise(((a,r)=>{const o=function(e,t){const n=n=>{var a,r;e.includes(null===(a=n.data)||void 0===a?void 0:a.type)&&t(null===(r=n.data)||void 0===r?void 0:r.data)};return window.addEventListener("message",n,!1),{unsubscribe:()=>{window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(i),s(),a(e)}));window.postMessage({type:e,data:n},window.origin);const i=setTimeout((function(){s(),r()}),300);function s(){o.unsubscribe()}}));return{cancel:()=>r=!0,promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await o()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}const be="tolgee-in-context-tools.umd.min.js",ye="@tolgee/in-context-tools",Ee="InContextTools",Le="https://cdn.jsdelivr.net/npm";let Oe=null;function we(e){var t;return Oe||(Oe=(t=`${Le}/@tolgee/web@${e}/dist/${be}`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.body.appendChild(a)}))).then((()=>window[ye][Ee]))),Oe}const ke="__tolgee_apiKey",je="__tolgee_apiUrl";function Ae(){const e=sessionStorage.getItem(ke)||void 0,t=sessionStorage.getItem(je)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Te(){sessionStorage.removeItem(ke),sessionStorage.removeItem(je)}e.BrowserExtensionPlugin=()=>e=>e,"undefined"!=typeof window&&(e.BrowserExtensionPlugin=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=me({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:t,attempts:4});return e=n,a}}}();e.on("running",(({value:n})=>{var a;n&&(a=()=>{t.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(Te)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ae()&&(async()=>{const e=await we("5.4.2");return t=>{const n=Ae();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 Pe="__tolgee_currentLanguage";const xe=e=>e.endsWith("/")?e.slice(0,-1):e,Ne={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${xe(n)}/${e}/${t}.json`:`${xe(n)}/${t}.json`,getData:e=>e.json(),headers:{Accept:"application/json"}},Re=e=>{const t=Object.assign(Object.assign(Object.assign({},Ne),e),{headers:Object.assign(Object.assign({},Ne.headers),null==e?void 0:e.headers)}),{prefix:n,getPath:a,getData:r,headers:o}=t,i=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}(t,["prefix","getPath","getData","headers"]);return{getRecord({namespace:e,language:t}){const s=a({namespace:e,language:t,prefix:n});return fetch(s,Object.assign({headers:o},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return r(e)}))}}};e.BackendFetch=e=>(t,n)=>(n.addBackend(Re(e)),t),e.DEVTOOLS_ID=t,e.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:r}){var o;const i=null!==(o=he(t))&&void 0!==o?o:r;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===r)throw new Error("You need to specify 'projectId' when using PAT key");return fetch(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})=>W(e,t)}),e),e.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){s("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),r=a(window.navigator.language);return e.find((e=>a(e)===r))||void 0}}),e),e.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(s("LanguageStorage"),localStorage.getItem(Pe)||void 0),setLanguage(e){s("LanguageStorage"),localStorage.setItem(Pe,e)}}),e),e.ObserverPlugin=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=oe();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=de({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run(Object.assign(Object.assign({},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&&Z(t,n.text)}}))},outputNotFormattable:!0}))})):t.setObserver((()=>{const e=oe();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=ce();e.run(Object.assign(Object.assign({},t),{wrapper:n}))},retranslate(){},outputNotFormattable:!1}))})),e),e.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",e.TOLGEE_ATTRIBUTE_NAME=r,e.TOLGEE_RESTRICT_ATTRIBUTE=a,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=n,e.Tolgee=()=>S().use(e.BrowserExtensionPlugin()),e.TolgeeCore=S,e.getFallback=d,e.getFallbackArray=f,e.getProjectIdFromApiKey=he,e.getTranslateProps=N,Object.defineProperty(e,"__esModule",{value:!0})}));
!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"]=e["@tolgee/web"]||{},e["@tolgee/web"].production={}))}(this,(function(e){"use strict";const t="__tolgee_dev_tools",n="data-tolgee-key-only",a="data-tolgee-restricted",r="_tolgee",o="_tolgee-highlighter";function i(){var e,t;return void 0===(null===(t=null===(e=globalThis.window)||void 0===e?void 0:e.document)||void 0===t?void 0:t.createElement)}function s(e){if(i())throw new Error(`${e}: Can't run on the server`)}function l(e,t){return{oldTextContent:e,keys:t}}function u(e){return Boolean(e&&"function"==typeof e.then)}const c=(e,t)=>u(e)?Promise.resolve(e).then(t):t(e),g=e=>`Tolgee: You need to specify '${e}' option`;function d(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function f(e){return d(e)||[]}function p(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?f(t):f(null==t?void 0:t[e]);var n}function v(e){return Array.from(new Set(e))}function h(e){return e?e.replace(/\/+$/,""):e}const m=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})))}})},b=(e,t,n)=>{const a=new Set,r=new Set;let o=[];const i=()=>{if(0===o.length)return;const e=o;o=[],a.forEach((e=>{e({value:void 0})}));let n=new Set;e.forEach((e=>{void 0===e?n=void 0:void 0!==n&&e.forEach((e=>n.add(e)))}));(e=>{const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))})(n?Array.from(n.keys()):void 0)};return Object.freeze({listenSome:e=>{const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(f(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a},listen:e=>{a.add(e);return{unsubscribe:()=>{a.delete(e)}}},emit:(t,n)=>{e()&&(o.push(t),n?setTimeout(i,0):i())}})},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},E=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},L=({language:e,namespace:t})=>t?`${e}:${t}`:e,O=(e,t,n,a,r,o,i)=>{const s=new Map,l=new Map;let u={},c=0;function g(t,n,a){const r=L(t);l.set(r,{data:y(n),version:a}),e.emit(t)}function d(e,t){g(e,t,c)}function p(e,t=!1){const n=l.get(L(e));return n&&t?n.version===c:Boolean(n)}function h(e){var t;return null===(t=l.get(L(a(e))))||void 0===t?void 0:t.data}function m(e){let n;if(!n){const t=u[L(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n}return Object.freeze({addStaticData:function(e){e&&(u=Object.assign(Object.assign({},u),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=E(e),a=l.get(e);a&&0!==a.version||g(n,t,0)}})))},invalidate:function(){s.clear(),c+=1},addRecord:d,exists:p,getRecord:h,getTranslation:function(e,t){var n;return null===(n=l.get(L(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(L({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return v(e)},getTranslationFallback:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=l.get(L({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation:function(t,n,a){var r;const o=null===(r=l.get(L(t)))||void 0===r?void 0:r.data;null==o||o.set(n,a),e.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching:function(e){if(r())return!0;if(void 0===e)return s.size>0;const t=f(e);return Boolean(Array.from(s.keys()).find((e=>t.includes(E(e).namespace))))},isLoading:function(e,t){const n=f(t);return Boolean(r()||Array.from(s.keys()).find((t=>{const a=E(t);return(!n.length||n.includes(a.namespace))&&!p({namespace:a.namespace,language:e})})))},loadRecords:async function(e,t){const r=e.map((e=>{const r=a(e),o=L(r),i=s.get(o);if(i)return{new:!1,promise:i,keyObject:r,cacheKey:o};const l=function(e,t){var a;let r;return t&&(r=null===(a=n(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),r||(r=m(e)),r}(r,t)||Promise.resolve(void 0);return s.set(o,l),{new:!0,promise:l,keyObject:r,cacheKey:o}}));o.notify(),i.notify();const l=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=s.get(e.cacheKey)!==e.promise;if(e.new&&!n){s.delete(e.cacheKey);const n=l[t];n?d(e.keyObject,n):h(e.keyObject)||d(e.keyObject,{})}})),o.notify(),i.notify(),r.map((e=>h(e.keyObject)))},getAllRecords:function(){return Array.from(l.entries()).map((([e,t])=>Object.assign(Object.assign({},E(e)),{data:t.data})))}})};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 r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const k="invalid",j={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"]},observerType:"invisible",onFormatError:k,apiUrl:"https://app.tolgee.io"},A=(...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},T=(e,t)=>{const n=A(j,null==t?void 0:t.initialOptions,e);return n.apiUrl=h(n.apiUrl),{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}},P=(e,t,n,a,r,o)=>{const i={ui:void 0},s={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},l=async({keysAndDefaults:e,event:t})=>{var n;const o=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,ns:a({key:e,ns:t}),translation:r({key:e,ns:t})})));null===(n=s.ui)||void 0===n||n.handleElementClick(o,t)},g=(e,t)=>{var n,a;return(null===(a=null===(n=s.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},d=e=>{const t=r({key:e.key,ns:e.ns});return A(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))},f=e=>{s.observer=null==e?void 0:e()},p=()=>Boolean(s.observer),v=e=>{e&&s.formatters.push(e)},h=e=>{s.finalFormatter=e},m=e=>{i.ui=e},b=()=>Boolean(i.ui),y=e=>{s.languageStorage=e},E=e=>{s.languageDetector=e},L=e=>{e&&s.backends.push(e)},O=e=>{s.devBackend=e},j=()=>s.devBackend;function A(n){var a,{formatEnabled:r}=n,o=w(n,["formatEnabled"]);const{key:i,translation:l,defaultValue:u,noWrap:c,params:g,orEmpty:d,ns:f}=o,p=l||u;let v=p||(d?"":i);const h=e(),m=r||!(null===(a=s.observer)||void 0===a?void 0:a.outputNotFormattable),b=e=>s.observer&&!c?s.observer.wrap({key:i,translation:e,defaultValue:u,params:g,ns:f}):e;v=b(v);try{if(p&&h&&m)for(const e of s.formatters)v=e.format({translation:v,language:h,params:g});s.finalFormatter&&p&&h&&m&&(v=s.finalFormatter.format({translation:v,language:h,params:g}))}catch(e){console.error(e);const n=("string"==typeof(y=e)?y:"string"==typeof(null==y?void 0:y.message)?y.message:void 0)||k,a=t().onFormatError,r=typeof a;v="string"===r?a:"function"===r?a(n,o):k,v=b(v)}var y;return v}return Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:h,addFormatter:v,setObserver:f,hasObserver:p,setUi:m,hasUi:b,setDevBackend:O,addBackend:L,setLanguageDetector:E,setLanguageStorage:y}))},formatTranslation:A,getDevBackend:j,getBackendRecord:({language:e,namespace:t})=>{for(const n of s.backends){const a=n.getRecord({language:e,namespace:t});if(u(a))return null==a?void 0:a.catch((e=>(console.error(e),{})));if(void 0!==a)return a}},getBackendDevRecord:({language:e,namespace:n})=>{var a;const{apiKey:r,apiUrl:o,projectId:i}=t();return null===(a=s.devBackend)||void 0===a?void 0:a.getRecord({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:n})},getLanguageDetector:()=>s.languageDetector,getLanguageStorage:()=>s.languageStorage,getInitialLanguage:()=>{var e;const t=n(),a=null===(e=s.languageStorage)||void 0===e?void 0:e.getLanguage();return c(a,(e=>t&&!t.includes(e)||!e?(()=>{if(!s.languageDetector)return;const e=n();return s.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var t;null===(t=s.languageStorage)||void 0===t||t.setLanguage(e)},run:()=>{var e,n;const{apiKey:a,apiUrl:r,projectId:u,observerOptions:c}=t();s.ui=null===(e=i.ui)||void 0===e?void 0:e.call(i,{apiKey:a,apiUrl:r,projectId:u,highlight:g,changeTranslation:o}),null===(n=s.observer)||void 0===n||n.run({mouseHighlight:!0,options:c,translate:d,onClick:l})},stop:()=>{var e;s.ui=void 0,null===(e=s.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=s.observer)||void 0===e||e.retranslate()},highlight:g,unwrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap:e=>{var t;return s.observer?null===(t=s.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:function(){return Boolean(j())}})},x=(e,t,n)=>{let a=e;return Object.freeze({init:function(e){a=e},notify:function(){const e=t();a!==e&&n(e),a=e}})};const N=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:r}=e,o=w(e,["ns","noWrap","orEmpty","params"]);const i={ns:t,noWrap:n,orEmpty:a};return Object.assign(Object.assign({},i),{params:Object.assign({},o)})}(n)),a)),a},R=({options:e})=>{const t=((e,t)=>{let n=!0;function a(){return n}const r=m(a),o=m(a),i=m(a),s=m(a),l=m(a),u=m(a),c=m(a),g=b(a,e,t);return l.listen((()=>g.emit())),o.listen((()=>g.emit())),c.listen((({value:e})=>{g.emit([e.namespace],!0)})),Object.freeze({onPendingLanguageChange:r,onLanguageChange:o,onLoadingChange:i,onFetchingChange:s,onInitialLoaded:l,onRunningChange:u,onCacheChange:c,onUpdate:g,setEmmiterActive:function(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return r.listen(t);case"language":return o.listen(t);case"loading":return i.listen(t);case"fetching":return s.listen(t);case"initialLoad":return l.listen(t);case"running":return u.listen(t);case"cache":return c.listen(t);case"update":return g.listen(t)}}})})(s,l),n=x(!1,(()=>i.isFetching()),t.onFetchingChange.emit),a=x(!1,(()=>k()),t.onLoadingChange.emit),r=((e,t,n)=>{let a,r=T();function o(){return r.language||r.initialOptions.language}function i(){return Object.assign(Object.assign({},r.initialOptions),a)}return Object.freeze({init:function(e){r=T(e,r)},isRunning:function(){return r.isRunning},setRunning:function(e){r.isRunning!==e&&(r.isRunning=e,n.emit(e))},isInitialLoading:function(){return r.isInitialLoading},setInitialLoading:function(e){r.isInitialLoading=e},getLanguage:o,setLanguage:function(t){r.language!==t&&(r.language=t,e.emit(t))},getPendingLanguage:function(){return r.pendingLanguage||o()},setPendingLanguage:function(e){r.pendingLanguage!==e&&(r.pendingLanguage=e,t.emit(e))},getInitialOptions:i,addActiveNs:function(e){f(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t?r.activeNamespaces.set(e,t+1):r.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){f(e).forEach((e=>{const t=r.activeNamespaces.get(e);void 0!==t&&t>1?r.activeNamespaces.set(e,t-1):r.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return v([...r.initialOptions.ns||[r.initialOptions.defaultNs],...f(r.initialOptions.fallbackNs),...r.activeNamespaces.keys()])},getFallbackLangs:function(e){const t=e||o();return t?v([t,...p(t,r.initialOptions.fallbackLanguage)]):[]},getFallbackNs:function(){return f(r.initialOptions.fallbackNs)},getDefaultNs:function(e){return void 0===e?r.initialOptions.defaultNs:e},getAvailableLanguages:function(){if(r.initialOptions.availableLanguages)return r.initialOptions.availableLanguages;if(r.initialOptions.staticData){const e=Object.keys(r.initialOptions.staticData).map((e=>E(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?i().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){a=e?Object.assign(Object.assign({},e),{apiUrl:h(e.apiUrl)}):void 0}})})(t.onLanguageChange,t.onPendingLanguageChange,t.onRunningChange),o=P(r.getLanguage,r.getInitialOptions,r.getAvailableLanguages,(function({key:e,ns:t}){const n=r.getFallbackLangs(),a=d(t||void 0);return i.getTranslationNs(a,n,e)}),R,L),i=O(t.onCacheChange,o.getBackendRecord,o.getBackendDevRecord,r.withDefaultNs,r.isInitialLoading,n,a);function s(){return r.getFallbackNs()}function l(e){return r.getDefaultNs(e)}function d(e){return[...f(l(e)),...s()]}function y(e){return[...f(e||l()),...r.getRequiredNamespaces()]}function L(e,t,n){const a=r.withDefaultNs(e),o=i.getTranslation(a,t);return i.changeTranslation(a,t,n),{revert:()=>{i.changeTranslation(a,t,o)}}}function w(e){r.init(e),i.addStaticData(r.getInitialOptions().staticData)}function k(e){return i.isLoading(r.getLanguage(),e)}function j(){return Boolean(r.getInitialOptions().apiKey&&r.getInitialOptions().apiUrl)}function A(e,t){const n=function(e,t){const n=r.getFallbackLangs(e),a=y(t),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t},!0)||o.push({language:e,namespace:t})}))})),o}(e,t);if(n.length)return c(D(n),(()=>{}))}function R({key:e,ns:t}){const n=d(t||void 0),a=r.getFallbackLangs();return i.getTranslationFallback(n,a,e)}function S(){const e=c(function(){if(r.getLanguage())return;if(!r.getInitialOptions().defaultLanguage)throw new Error(g("defaultLanguage"));const e=o.getInitialLanguage();return c(e,(e=>{const t=e||r.getInitialOptions().defaultLanguage;t&&r.setLanguage(t)}))}(),(()=>A()));if(u(e))return r.setInitialLoading(!0),n.notify(),a.notify(),Promise.resolve(e).then((()=>{r.setInitialLoading(!1),n.notify(),a.notify(),t.onInitialLoaded.emit()}));t.onInitialLoaded.emit()}function D(e){return i.loadRecords(e,j())}e&&w(e),t.onUpdate.listen((()=>{r.isRunning()&&o.retranslate()}));const $=()=>{const e=o.getLanguageDetector()||o.getLanguageStorage();if(e){if(!r.getAvailableLanguages())throw new Error(g("availableLanguages"))}if(!r.getLanguage()&&!r.getInitialOptions().defaultLanguage)throw e?new Error(g("defaultLanguage")):new Error(g("language"))};return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),o),i),{init:w,changeLanguage:async function(e){r.getPendingLanguage()===e&&r.getLanguage()===e||(r.setPendingLanguage(e),r.isRunning()&&await A(e),e===r.getPendingLanguage()&&(r.setLanguage(e),o.setStoredLanguage(e)))},getTranslation:R,changeTranslation:L,addActiveNs:async function(e,t){t||r.addActiveNs(e),r.isRunning()&&await A(void 0,e)},loadRecords:D,loadRecord:async function(e){return(await D([e]))[0]},isLoading:k,isLoaded:function(e){const t=r.getLanguage();if(!t)return!1;const n=r.getFallbackLangs(t),a=y(e),o=[];return n.forEach((e=>{a.forEach((t=>{i.exists({language:e,namespace:t})||o.push({language:e,namespace:t})}))})),0===o.length},t:(...e)=>{const t=N(...e),n=R(t);return o.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:j,run:function(){let e;return $(),r.isRunning()||(j()&&i.invalidate(),r.setRunning(!0),o.run(),e=S()),Promise.resolve(e)},stop:function(){r.isRunning()&&(o.stop(),r.setRunning(!1))}}))},S=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=A(e.options,n),t),init(t){const n=(e=>{const t=R({options:e}),n=e=>{const n=t.isRunning();n&&t.stop(),e(),n&&t.run()},a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmmiterActive:t.setEmmiterActive,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,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})(A(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},D=0,$=1,C=2;class I extends Error{constructor(e,t,n){let a;a=e===D?"Empty parameter":e===$?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function _(e){return/\s/.test(e)}const U=0,F=1,B=2,M=3,V=4,z=new Set([B,F,U]),K="'",Y=new Set(["{","}",K]),G=e=>/[0-9a-zA-Z_]/.test(e);function W(e,t){const[n,a]=function(e){let t=U,n="",a="",r="";const o=[],i=[];let s=0;function l(t){throw new I(t,s,e)}const u=()=>{o.push(n),n=""},c=()=>{""===a&&l(D),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case U:r===K?(n+=r,t=F):"{"===r?(u(),t=M):(n+=r,t=U);break;case F:Y.has(r)?(n=n.slice(0,-1)+r,t=B):(n+=r,t=U);break;case B:r===K?t=U:(n+=r,t=B);break;case M:"}"===r?(c(),t=U):_(r)?""!==a&&(c(),t=V):(G(r)||l($),a+=r,t=M);break;case V:"}"==r?t=U:_(r)?t=V:l($)}return z.has(t)||l(C),u(),[o,i]}(e),r=[n[0]];for(let o=1;o<n.length;o++){const i=null==t?void 0:t[a[o-1]];if(void 0===i)throw new Error(`Missing parameter "${a[o-1]}" in "${e}"`);r.push(String(i)),r.push(n[o])}return r.join("")}const X={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"},H=({highlightColor:e,highlightWidth:t})=>Object.freeze({initHighlighter:function(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;let r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(o),Object.entries(X).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const i=n.getBoundingClientRect();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)||void 0===e||e.remove(),t.highlightEl=void 0}}(0,a)}});function J(e,t){var n;const a=function(e){switch(e.nodeType){case Node.ATTRIBUTE_NODE:return e.ownerElement||void 0;case Node.TEXT_NODE:return e.parentElement||void 0;case Node.DOCUMENT_NODE:case Node.ELEMENT_NODE:return e;default:return}}(t),r=[];if(!a)return r;const o=null===document||void 0===document?void 0:document.evaluate(e,a,void 0,XPathResult.ANY_TYPE);let i;for(;i=null===(n=null==o?void 0:o.iterateNext)||void 0===n?void 0:n.call(o);)r.push(i);return r}function q(e){return e.textContent}function Z(e,t){e.textContent=t}function Q(e,t){if(e.contains(t))return!0;if(t instanceof Attr){const n=t.ownerElement&&Object.values(t.ownerElement.attributes).indexOf(t)>-1;if(e.contains(t.ownerElement)&&n)return!0}return!1}const ee=(e,t)=>{var n;const a=void 0===e.key||void 0===t.key||t.key===e.key,r=void 0===e.ns||void 0===t.ns||-1!==(null===(n=e.ns)||void 0===n?void 0:n.findIndex((e=>{var n;return null===(n=t.ns)||void 0===n?void 0:n.includes(e)})));return a&&r},te={capture:!0},ne={capture:!0,passive:!0},ae=({highlightKeys:e,elementStore:n,onClick:a,options:r})=>{var o,i;let s,l,u=new Set;const c=(null===(o=r.targetElement)||void 0===o?void 0:o.getRootNode())||document,g=(null===(i=r.targetElement)||void 0===i?void 0:i.ownerDocument)||document,d=e=>{var t;if(s!==e){f();const a=n.get(e);a&&(a.preventClean=!0,null===(t=a.highlight)||void 0===t||t.call(a),s=e)}},f=()=>{var e;const t=n.get(s);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),s=void 0)};function p(){const e=l;let t;if(e&&w()){const a=c.elementFromPoint(e.x,e.y);a&&(t=function(e){return O(e,(e=>n.get(e)))}(a))}d(t)}const v=e=>{var n;w()&&(n=e.target,!Boolean(O(n,(e=>e.id===t))))&&(e.stopPropagation(),e.preventDefault())},h=e=>{var t;t={x:e.clientX,y:e.clientY},l=t,p()},m=()=>{u=new Set,p()},b=e=>{const t=e.key;void 0!==t&&u.add(t),p()},y=e=>{u.delete(e.key),p()},E=()=>{var e;const t=n.get(s);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)},L=e=>{v(e),w()&&s&&(a(e,s),f())};function O(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?O(e.parentElement,t):void 0}function w(){for(const t of e)if(!u.has(t))return!1;return!0}return Object.freeze({run:function(){g.addEventListener("blur",m,te),g.addEventListener("keydown",b,te),g.addEventListener("keyup",y,te),g.addEventListener("mousemove",h,ne),g.addEventListener("scroll",E,ne),g.addEventListener("click",L,te),g.addEventListener("mouseenter",v,te),g.addEventListener("mouseover",v,te),g.addEventListener("mouseout",v,te),g.addEventListener("mouseleave",v,te),g.addEventListener("mousedown",v,te),g.addEventListener("mouseup",v,te)},stop:function(){g.removeEventListener("blur",m,te),g.removeEventListener("keydown",b,te),g.removeEventListener("keyup",y,te),g.removeEventListener("mousemove",h,ne),g.removeEventListener("scroll",E,ne),g.removeEventListener("click",L,te),g.removeEventListener("mouseenter",v,te),g.removeEventListener("mouseover",v,te),g.removeEventListener("mouseout",v,te),g.removeEventListener("mouseleave",v,te),g.removeEventListener("mousedown",v,te),g.removeEventListener("mouseup",v,te)}})},re=(e,t,n)=>{const o=H({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),i=ae({highlightKeys:e.highlightKeys,elementStore:t,onClick:(e,a)=>{const r=t.get(a);n({event:e,keysAndDefaults:l(r)})},options:e});function s(){return e.targetElement||document.body}function l(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:function(n,i,s){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${a}]`)}(n))return;const l=n;let u=t.get(l);u||(u={nodes:new Map},t.set(l,u),l.setAttribute(r,"true")),u.nodes.set(i,s),o.initHighlighter(l,u)},forEachElement:t.forEachElement,findAll:function(e,n){const a=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>ee({key:e,ns:d(n)},{key:t.key,ns:d(t.ns)})))){a.push(r);break}}})),a},refreshAll:function(){t.forEachElement(((e,n)=>{n.preventClean||(function(e){e.nodes=new Map(function*(e){for(const[t,n]of e.nodes.entries())Q(s(),t)&&(yield[t,n])}(e))}(n),0===n.nodes.size&&function(e,n){var a;n.highlightEl&&(null===(a=n.unhighlight)||void 0===a||a.call(n));e.removeAttribute(r),t.remove(e)}(e,n))}))},run:function(e){e&&i.run()},stop:function(){i.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t))}))}})},oe=()=>{let e,t=!1;const a=(()=>{const e=new Map;return Object.freeze({set:function(t,n){e.set(t,n)},get:function(t){return t&&e.get(t)},remove:function(t){return e.delete(t)},forEachElement:function(t){e.forEach(((e,n)=>t(n,e)))}})})(),r=({mouseHighlight:e,options:r,wrapper:o,onClick:s})=>{if(i())return;const u=(e=>Object.freeze({getSuitableParent:function t(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(a):a}}))(r),c=((e,t)=>{const n=e=>J(t.getTextXPath(),e),a=n=>{let a=[];for(const[r,o]of Object.entries(e.tagAttributes))for(const e of o){const o=J(t.getAttributeXPath({tag:r,attribute:e}),n);a=[...a,...o]}return a};return Object.freeze({handleAttributes:a,handleChildList:e=>{let t=[];return t=t.concat(a(e)),t=t.concat(n(e)),t},handleText:n})})(r,o),g=re(r,a,s);function d(e){for(const t of e){const e=q(t),n=e?o.unwrap(e):null;if(n){const{text:a,keys:r}=n;Z(t,a);const o=l(e,r),i=u.getSuitableParent(t);g.register(i,t,o)}}}const f=e=>{J(`./descendant-or-self::*[@${n}]`,e).forEach((e=>{const t=e.getAttributeNode(n),a=u.getSuitableParent(t);g.register(a,t,{oldTextContent:"",keys:[{key:q(t)}],keyAttributeOnly:!0})}))},p=new MutationObserver((e=>{if(t)for(const t of e){let e=[];switch(t.type){case"characterData":e=c.handleText(t.target);break;case"childList":f(t.target),e=c.handleChildList(t.target);break;case"attributes":f(t.target),e=c.handleAttributes(t.target)}d(e),g.refreshAll()}})),v=r.targetElement||document.body;return t=!0,g.run(e),f(v),d(c.handleChildList(v)),p.observe(v,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,g.stop(),p.disconnect()},elementRegistry:g,wrapper:o}};return Object.freeze({run(t){e=r(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null===(a=null==e?void 0:(n=e.elementRegistry).forEachElement)||void 0===a||a.call(n,t)},highlight(t,n){const a=(null==e?void 0:e.elementRegistry.findAll(t,n))||[];return a.forEach((e=>{var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight(){a.forEach((e=>{var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})},ie=["‌","‍"],se=RegExp(`([${ie.join("")}]{9})+`,"gu"),le=e=>{const t=(e=>Array.from((new TextEncoder).encode(e)))(e).map(Number),n=t.map((e=>(e=>{const t=8-e.length;return"0".repeat(t)+e})(e.toString(2))+"0")).join("");return Array.from(n).map((e=>ie[Number(e)])).join("")},ue=e=>{const t=Array.from(e).map((e=>ie.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},ce=()=>{const e=(()=>{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]})})(),t=e=>JSON.parse(e||"{}");return Object.freeze({unwrap:n=>{const a=[],r=(e=>{var t;const n=null===(t=e.match(se))||void 0===t?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(ue))||[]})(n);r.forEach((n=>{const[r]=(e=>{const t=[];for(const n of e)t.push(n.codePointAt(0));return t})(n),o=e.numberToValue(r),{k:i,d:s,n:l}=t(o);a.push({key:i,defaultValue:s,ns:l})}));const o=(e=>e.replace(se,""))(n);return{text:o,keys:a}},wrap:({key:t,defaultValue:n,translation:a,ns:r})=>{const o=(e=>{const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)})({key:t,ns:r,defaultValue:n}),i=e.valueToNumber(o),s=a||"",l=le(String.fromCodePoint(i));return"string"==typeof s?s+l:s},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${ie[0]}${ie[0]}') or contains(., '${ie[1]}${ie[0]}')]`,getAttributeXPath:({tag:e,attribute:t})=>`descendant-or-self::${e}/@${t}[contains(., '${ie[0]}${ie[0]}') or contains(., '${ie[1]}${ie[0]}')]`})};function ge(e,t){let n=0;for(;e>-1&&"\\"===t[e-1];)n++,e--;return n%2==1}const de=({inputPrefix:e,inputSuffix:t,translate:n})=>{function a(e){const{key:t,params:a,defaultValue:r,ns:o}=function(e){let t=!1,n="",a="",r="KEY";const o={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{o.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==r||","!==s?"KEY"!==r||"|"!==s?"NAMESPACE"!==r||","!==s?"KEY"!==r||":"!==s?"DEFAULT_VALUE"!==r||":"!==s?"PARAM_NAME"!==r||":"!==s?"PARAM_VALUE"!==r||","!==s?n+=s:(r="PARAM_NAME",o.params[a]=n,n=""):(r="PARAM_VALUE",a=n,n=""):(r="PARAM_NAME",o.defaultValue=n,n=""):(r="PARAM_NAME",o.key=n,n=""):(r="DEFAULT_VALUE",i(n),n=""):(r="NAMESPACE",o.key=n,n=""):(r="DEFAULT_VALUE",o.key=n,n=""):t=!0;return"KEY"===r&&(o.key=n),"DEFAULT_VALUE"===r&&(o.defaultValue=n),"PARAM_VALUE"===r&&(o.params[a]=n),"NAMESPACE"===r&&i(n),o}(e);return{translated:n({key:t,params:a,defaultValue:r,ns:o,noWrap:!0}),key:t,params:a,defaultValue:r,ns:o}}const r=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=e=>"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:r,ns:i})=>{let s=Object.entries(a||{}).map((([e,t])=>`${o(e)}:${o(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==r?`,${o(r)}`:"",u="string"==typeof i?[i]:i,c=(null==u?void 0:u.length)?`|${u.map((e=>o(e))).join("|")}`:"";return`${e}${o(n)}${c}${l}${s}${t}`},unwrap:n=>{const o=new RegExp(`(\\\\?)(${r(e)}(.*?)${r(t)})`,"gs"),i=[];let s,l=!1,u=0,c="";for(;null!==(s=o.exec(n));){let e=s[1];const[t,r,o,g]=s,{index:d,input:f}=s;if(c+=f.substr(u,d-u),u=d+t.length,"\\"===e){if(!ge(d,n)){c+=o;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:[]}},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${e}') and contains(., '${t}')]`,getAttributeXPath:({tag:n,attribute:a})=>`descendant-or-self::${n}/@${a}[contains(., '${e}') and contains(., '${t}')]`})},fe="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function pe(e){const t=fe.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function ve(e){const t=(e=e.toUpperCase()).length;let n=0,a=0,r=0;const o=new Uint8Array(5*t/8|0);for(let i=0;i<t;i++)a=a<<5|pe(e[i]),n+=5,n>=8&&(o[r++]=a>>>n-8&255,n-=8);return function(e){const t=new Uint8Array(e),n=t.length;let a="",r=Math.pow(2,16)-1;for(let e=0;e<n;e+=r)e+r>n&&(r=n-e),a+=String.fromCharCode.apply(null,t.subarray(e,e+r));return a}(o.buffer)}function he(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=ve(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}function me({message:e,recievingMessage:t,data:n,attempts:a=1}){let r=!1;const o=()=>new Promise(((a,r)=>{const o=function(e,t){const n=n=>{var a,r;e.includes(null===(a=n.data)||void 0===a?void 0:a.type)&&t(null===(r=n.data)||void 0===r?void 0:r.data)};return window.addEventListener("message",n,!1),{unsubscribe:()=>{window.removeEventListener("message",n)}}}(t,(function(e){clearTimeout(i),s(),a(e)}));window.postMessage({type:e,data:n},window.origin);const i=setTimeout((function(){s(),r()}),300);function s(){o.unsubscribe()}}));return{cancel:()=>r=!0,promise:(async()=>{for(let e=0;e<a;e++){if(r)return new Promise((()=>{}));try{return await o()}catch(e){continue}}if(!r)throw`Didn't recieve ${t.join(" or ")} in time.`;return new Promise((()=>{}))})()}}const be="tolgee-in-context-tools.umd.min.js",ye="@tolgee/in-context-tools",Ee="InContextTools",Le="https://cdn.jsdelivr.net/npm";let Oe=null;function we(e){var t;return Oe||(Oe=(t=`${Le}/@tolgee/web@${e}/dist/${be}`,new Promise(((e,n)=>{const a=document.createElement("script");a.src=t,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>n(e.error))),document.body.appendChild(a)}))).then((()=>window[ye][Ee]))),Oe}const ke="__tolgee_apiKey",je="__tolgee_apiUrl";function Ae(){const e=sessionStorage.getItem(ke)||void 0,t=sessionStorage.getItem(je)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Te(){sessionStorage.removeItem(ke),sessionStorage.removeItem(je)}e.BrowserExtensionPlugin=()=>e=>e,"undefined"!=typeof window&&(e.BrowserExtensionPlugin=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=me({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:t,attempts:4});return e=n,a}}}();e.on("running",(({value:n})=>{var a;n&&(a=()=>{t.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(Te)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ae()&&(async()=>{const e=await we("5.4.3-prerelease.9ea3f1fa.0");return t=>{const n=Ae();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 Pe="__tolgee_currentLanguage";const xe=e=>e.endsWith("/")?e.slice(0,-1):e,Ne={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${xe(n)}/${e}/${t}.json`:`${xe(n)}/${t}.json`,getData:e=>e.json(),headers:{Accept:"application/json"}},Re=e=>{const t=Object.assign(Object.assign(Object.assign({},Ne),e),{headers:Object.assign(Object.assign({},Ne.headers),null==e?void 0:e.headers)}),{prefix:n,getPath:a,getData:r,headers:o}=t,i=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}(t,["prefix","getPath","getData","headers"]);return{getRecord({namespace:e,language:t}){const s=a({namespace:e,language:t,prefix:n});return fetch(s,Object.assign({headers:o},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return r(e)}))}}};e.BackendFetch=e=>(t,n)=>(n.addBackend(Re(e)),t),e.DEVTOOLS_ID=t,e.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:r}){var o;const i=null!==(o=he(t))&&void 0!==o?o:r;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===r)throw new Error("You need to specify 'projectId' when using PAT key");return fetch(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})=>W(e,t)}),e),e.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){s("LanguageDetector");const t=window.navigator.language,n=e.find((e=>e===t));if(n)return n;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),r=a(window.navigator.language);return e.find((e=>a(e)===r))||void 0}}),e),e.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(s("LanguageStorage"),localStorage.getItem(Pe)||void 0),setLanguage(e){s("LanguageStorage"),localStorage.setItem(Pe,e)}}),e),e.ObserverPlugin=()=>(e,t)=>("text"===e.getInitialOptions().observerType?t.setObserver((()=>{const e=oe();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=de({inputPrefix:t.options.inputPrefix,inputSuffix:t.options.inputSuffix,translate:t.translate});e.run(Object.assign(Object.assign({},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&&Z(t,n.text)}}))},outputNotFormattable:!0}))})):t.setObserver((()=>{const e=oe();return Object.freeze(Object.assign(Object.assign({},e),{run(t){const n=ce();e.run(Object.assign(Object.assign({},t),{wrapper:n}))},retranslate(){},outputNotFormattable:!1}))})),e),e.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",e.TOLGEE_ATTRIBUTE_NAME=r,e.TOLGEE_RESTRICT_ATTRIBUTE=a,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=n,e.Tolgee=()=>S().use(e.BrowserExtensionPlugin()),e.TolgeeCore=S,e.getFallback=d,e.getFallbackArray=f,e.getProjectIdFromApiKey=he,e.getTranslateProps=N,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=tolgee-web.production.umd.min.js.map
{
"name": "@tolgee/web",
"version": "5.4.2",
"version": "5.4.3-prerelease.9ea3f1fa.0",
"description": "Tolgee for web",

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

"dependencies": {
"@tolgee/core": "5.4.0"
"@tolgee/core": "5.4.3-prerelease.9ea3f1fa.0"
},

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

"homepage": "https://github.com/tolgee/tolgee-js#readme",
"gitHead": "d0d75b1f60db15dd4add2af5fc45158764f01e63",
"gitHead": "4d7f0ce39b3300ed143ba85ab4c8e53e4b919801",
"publishConfig": {

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

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is 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 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 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

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

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