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.6.0-prerelease.b5ab209e.0 to 5.6.0

2

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

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

"use strict";function e(e){return Boolean(e&&"function"==typeof e.then)}Object.defineProperty(exports,"__esModule",{value:!0});const t=(t,n)=>e(t)?Promise.resolve(t).then(n):n(t),n=e=>`Tolgee: You need to specify '${e}' option`;function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function r(e){return a(e)||[]}function o(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?r(t):r(null==t?void 0:t[e]);var n}function i(e){return Array.from(new Set(e))}function s(e){return e?e.replace(/\/+$/,""):e}const l=e=>{let t=[];return Object.freeze({listen:e=>{const n=t=>{e(t)};return t.push(n),{unsubscribe:()=>{t=t.filter((e=>n!==e))}}},emit:n=>{e()&&t.forEach((e=>e({value:n})))}})},u=(e,t,n)=>{const a=new Set,o=new Set;let i=[];const s=()=>{if(0===i.length)return;const e=i;i=[],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());o.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))})(n?Array.from(n.keys()):void 0)};return Object.freeze({listenSome:e=>{const t={fn:t=>{e(t)},namespaces:new Set};o.add(t);const a={unsubscribe:()=>{o.delete(t)},subscribeNs:e=>(r(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()&&(i.push(t),n?setTimeout(s,0):s())}})},c=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):c(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},g=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},d=({language:e,namespace:t})=>t?`${e}:${t}`:e,f=(e,t,n,a,o,s,l)=>{const u=new Map,f=new Map;let p={},v=0;function h(t,n,a){const r=d(t);f.set(r,{data:c(n),version:a}),e.emit(t)}function m(e,t){h(e,t,v)}function b(e,t=!1){const n=f.get(d(e));return n&&t?n.version===v:Boolean(n)}function y(e){var t;return null===(t=f.get(d(a(e))))||void 0===t?void 0:t.data}function E(e){let n;if(!n){const t=p[d(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n}return Object.freeze({addStaticData:function(e){e&&(p=Object.assign(Object.assign({},p),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=g(e),a=f.get(e);a&&0!==a.version||h(n,t,0)}})))},invalidate:function(){u.clear(),v+=1},addRecord:m,exists:b,getRecord:y,getTranslation:function(e,t){var n;return null===(n=f.get(d(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=f.get(d({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return i(e)},getTranslationFallback:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=f.get(d({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=f.get(d(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(o())return!0;if(void 0===e)return u.size>0;const t=r(e);return Boolean(Array.from(u.keys()).find((e=>t.includes(g(e).namespace))))},isLoading:function(e,t){const n=r(t);return Boolean(o()||Array.from(u.keys()).find((t=>{const a=g(t);return(!n.length||n.includes(a.namespace))&&!b({namespace:a.namespace,language:e})})))},loadRecords:async function(e,t){const r=e.map((e=>{const r=a(e),o=d(r),i=u.get(o);if(i)return{new:!1,promise:i,keyObject:r,cacheKey:o};const s=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"),E(e))))),r||(r=E(e)),r}(r,t)||Promise.resolve(void 0);return u.set(o,s),{new:!0,promise:s,keyObject:r,cacheKey:o}}));s.notify(),l.notify();const o=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=u.get(e.cacheKey)!==e.promise;if(e.new&&!n){u.delete(e.cacheKey);const n=o[t];n?m(e.keyObject,n):y(e.keyObject)||m(e.keyObject,{})}})),s.notify(),l.notify(),r.map((e=>y(e.keyObject)))},getAllRecords:function(){return Array.from(f.entries()).map((([e,t])=>Object.assign(Object.assign({},g(e)),{data:t.data})))}})};function p(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const v="invalid",h={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:v,apiUrl:"https://app.tolgee.io"},m=(...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},b=(e,t)=>{const n=m(h,null==t?void 0:t.initialOptions,e);return n.apiUrl=s(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}},y=(n,a,r,o,i,s)=>{const l={ui:void 0},u={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 a=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,ns:o({key:e,ns:t}),translation:i({key:e,ns:t})})));null===(n=u.ui)||void 0===n||n.handleElementClick(a,t)},g=(e,t)=>{var n,a;return(null===(a=null===(n=u.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},d=(e,t)=>{var n;return(null===(n=u.observer)||void 0===n?void 0:n.findPositions(e,t))||[]},f=e=>{const t=i({key:e.key,ns:e.ns});return x(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))},h=e=>{u.observer=null==e?void 0:e()},m=()=>Boolean(u.observer),b=e=>{e&&u.formatters.push(e)},y=e=>{u.finalFormatter=e},E=e=>{l.ui=e},L=()=>Boolean(l.ui),O=e=>{u.languageStorage=e},w=e=>{u.languageDetector=e},k=e=>{e&&u.backends.push(e)},A=e=>{u.devBackend=e},j=()=>u.devBackend;function x(e){var t,{formatEnabled:r}=e,o=p(e,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:g,orEmpty:d,ns:f}=o,h=s||l;let m=h||(d?"":i);const b=n(),y=r||!(null===(t=u.observer)||void 0===t?void 0:t.outputNotFormattable),E=e=>u.observer&&!c?u.observer.wrap({key:i,translation:e,defaultValue:l,params:g,ns:f}):e;m=E(m);try{if(h&&b&&y)for(const e of u.formatters)m=e.format({translation:m,language:b,params:g});u.finalFormatter&&h&&b&&y&&(m=u.finalFormatter.format({translation:m,language:b,params:g}))}catch(e){console.error(e);const t=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||v,n=a().onFormatError,r=typeof n;m="string"===r?n:"function"===r?n(t,o):v,m=E(m)}var L;return m}return Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:y,addFormatter:b,setObserver:h,hasObserver:m,setUi:E,hasUi:L,setDevBackend:A,addBackend:k,setLanguageDetector:w,setLanguageStorage:O}))},formatTranslation:x,getDevBackend:j,getBackendRecord:({language:t,namespace:n})=>{for(const a of u.backends){const r=a.getRecord({language:t,namespace:n});if(e(r))return null==r?void 0:r.catch((e=>(console.error(e),{})));if(void 0!==r)return r}},getBackendDevRecord:({language:e,namespace:t})=>{var n;const{apiKey:r,apiUrl:o,projectId:i}=a();return null===(n=u.devBackend)||void 0===n?void 0:n.getRecord({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:t})},getLanguageDetector:()=>u.languageDetector,getLanguageStorage:()=>u.languageStorage,getInitialLanguage:()=>{var e;const n=r(),a=null===(e=u.languageStorage)||void 0===e?void 0:e.getLanguage();return t(a,(e=>n&&!n.includes(e)||!e?(()=>{if(!u.languageDetector)return;const e=r();return u.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var t;null===(t=u.languageStorage)||void 0===t||t.setLanguage(e)},run:()=>{var e,t;const{apiKey:n,apiUrl:r,projectId:o,observerOptions:i}=a();u.ui=null===(e=l.ui)||void 0===e?void 0:e.call(l,{apiKey:n,apiUrl:r,projectId:o,highlight:g,changeTranslation:s,findPositions:d}),null===(t=u.observer)||void 0===t||t.run({mouseHighlight:!0,options:i,translate:f,onClick:c})},stop:()=>{var e;u.ui=void 0,null===(e=u.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=u.observer)||void 0===e||e.retranslate()},highlight:g,unwrap:e=>{var t;return u.observer?null===(t=u.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap:e=>{var t;return u.observer?null===(t=u.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:function(){return Boolean(j())}})},E=(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 L=(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=p(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},O=({options:a})=>{const c=((e,t)=>{let n=!0;function a(){return n}const r=l(a),o=l(a),i=l(a),s=l(a),c=l(a),g=l(a),d=l(a),f=u(a,e,t);return c.listen((()=>f.emit())),o.listen((()=>f.emit())),d.listen((({value:e})=>{f.emit([e.namespace],!0)})),Object.freeze({onPendingLanguageChange:r,onLanguageChange:o,onLoadingChange:i,onFetchingChange:s,onInitialLoaded:c,onRunningChange:g,onCacheChange:d,onUpdate:f,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 c.listen(t);case"running":return g.listen(t);case"cache":return d.listen(t);case"update":return f.listen(t)}}})})(O,w),d=E(!1,(()=>m.isFetching()),c.onFetchingChange.emit),p=E(!1,(()=>T()),c.onLoadingChange.emit),v=((e,t,n)=>{let a,l=b();function u(){return l.language||l.initialOptions.language}function c(){return Object.assign(Object.assign({},l.initialOptions),a)}return Object.freeze({init:function(e){l=b(e,l)},isRunning:function(){return l.isRunning},setRunning:function(e){l.isRunning!==e&&(l.isRunning=e,n.emit(e))},isInitialLoading:function(){return l.isInitialLoading},setInitialLoading:function(e){l.isInitialLoading=e},getLanguage:u,setLanguage:function(t){l.language!==t&&(l.language=t,e.emit(t))},getPendingLanguage:function(){return l.pendingLanguage||u()},setPendingLanguage:function(e){l.pendingLanguage!==e&&(l.pendingLanguage=e,t.emit(e))},getInitialOptions:c,addActiveNs:function(e){r(e).forEach((e=>{const t=l.activeNamespaces.get(e);void 0!==t?l.activeNamespaces.set(e,t+1):l.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){r(e).forEach((e=>{const t=l.activeNamespaces.get(e);void 0!==t&&t>1?l.activeNamespaces.set(e,t-1):l.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return i([...l.initialOptions.ns||[l.initialOptions.defaultNs],...r(l.initialOptions.fallbackNs),...l.activeNamespaces.keys()])},getFallbackLangs:function(e){const t=e||u();return t?i([t,...o(t,l.initialOptions.fallbackLanguage)]):[]},getFallbackNs:function(){return r(l.initialOptions.fallbackNs)},getDefaultNs:function(e){return void 0===e?l.initialOptions.defaultNs:e},getAvailableLanguages:function(){if(l.initialOptions.availableLanguages)return l.initialOptions.availableLanguages;if(l.initialOptions.staticData){const e=Object.keys(l.initialOptions.staticData).map((e=>g(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?c().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){a=e?Object.assign(Object.assign({},e),{apiUrl:s(e.apiUrl)}):void 0}})})(c.onLanguageChange,c.onPendingLanguageChange,c.onRunningChange),h=y(v.getLanguage,v.getInitialOptions,v.getAvailableLanguages,(function({key:e,ns:t}){const n=v.getFallbackLangs(),a=k(t||void 0);return m.getTranslationNs(a,n,e)}),R,j),m=f(c.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,v.withDefaultNs,v.isInitialLoading,d,p);function O(){return v.getFallbackNs()}function w(e){return v.getDefaultNs(e)}function k(e){return[...r(w(e)),...O()]}function A(e){return[...r(e||w()),...v.getRequiredNamespaces()]}function j(e,t,n){const a=v.withDefaultNs(e),r=m.getTranslation(a,t);return m.changeTranslation(a,t,n),{revert:()=>{m.changeTranslation(a,t,r)}}}function x(e){v.init(e),m.addStaticData(v.getInitialOptions().staticData)}function T(e){return m.isLoading(v.getLanguage(),e)}function P(){return Boolean(v.getInitialOptions().apiKey&&v.getInitialOptions().apiUrl)}function N(e,n){const a=function(e,t){const n=v.getFallbackLangs(e),a=A(t),r=[];return n.forEach((e=>{a.forEach((t=>{m.exists({language:e,namespace:t},!0)||r.push({language:e,namespace:t})}))})),r}(e,n);if(a.length)return t(D(a),(()=>{}))}function R({key:e,ns:t}){const n=k(t||void 0),a=v.getFallbackLangs();return m.getTranslationFallback(n,a,e)}function S(){const a=t(function(){if(v.getLanguage())return;if(!v.getInitialOptions().defaultLanguage)throw new Error(n("defaultLanguage"));const e=h.getInitialLanguage();return t(e,(e=>{const t=e||v.getInitialOptions().defaultLanguage;t&&v.setLanguage(t)}))}(),(()=>N()));if(e(a))return v.setInitialLoading(!0),d.notify(),p.notify(),Promise.resolve(a).then((()=>{v.setInitialLoading(!1),d.notify(),p.notify(),c.onInitialLoaded.emit()}));c.onInitialLoaded.emit()}function D(e){return m.loadRecords(e,P())}a&&x(a),c.onUpdate.listen((()=>{v.isRunning()&&h.retranslate()}));const $=()=>{const e=h.getLanguageDetector()||h.getLanguageStorage();if(e){if(!v.getAvailableLanguages())throw new Error(n("availableLanguages"))}if(!v.getLanguage()&&!v.getInitialOptions().defaultLanguage)throw e?new Error(n("defaultLanguage")):new Error(n("language"))};return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c),v),h),m),{init:x,changeLanguage:async function(e){v.getPendingLanguage()===e&&v.getLanguage()===e||(v.setPendingLanguage(e),v.isRunning()&&await N(e),e===v.getPendingLanguage()&&(v.setLanguage(e),h.setStoredLanguage(e)))},getTranslation:R,changeTranslation:j,addActiveNs:async function(e,t){t||v.addActiveNs(e),v.isRunning()&&await N(void 0,e)},loadRecords:D,loadRecord:async function(e){return(await D([e]))[0]},isLoading:T,isLoaded:function(e){const t=v.getLanguage();if(!t)return!1;const n=v.getFallbackLangs(t),a=A(e),r=[];return n.forEach((e=>{a.forEach((t=>{m.exists({language:e,namespace:t})||r.push({language:e,namespace:t})}))})),0===r.length},t:(...e)=>{const t=L(...e),n=R(t);return h.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:P,run:function(){let e;return $(),v.isRunning()||(P()&&m.invalidate(),v.setRunning(!0),h.run(),e=S()),Promise.resolve(e)},stop:function(){v.isRunning()&&(h.stop(),v.setRunning(!1))}}))},w=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=m(e.options,n),t),init(t){const n=(e=>{const t=O({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})(m(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},k=0,A=1,j=2;class x extends Error{constructor(e,t,n){let a;a=e===k?"Empty parameter":e===A?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function T(e){return/\s/.test(e)}const P=0,N=1,R=2,S=3,D=4,$=new Set([R,N,P]),C="'",I=new Set(["{","}",C]),_=e=>/[0-9a-zA-Z_]/.test(e);function U(e,t){const[n,a]=function(e){let t=P,n="",a="",r="";const o=[],i=[];let s=0;function l(t){throw new x(t,s,e)}const u=()=>{o.push(n),n=""},c=()=>{""===a&&l(k),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case P:r===C?(n+=r,t=N):"{"===r?(u(),t=S):(n+=r,t=P);break;case N:I.has(r)?(n=n.slice(0,-1)+r,t=R):(n+=r,t=P);break;case R:r===C?t=P:(n+=r,t=R);break;case S:"}"===r?(c(),t=P):T(r)?""!==a&&(c(),t=D):(_(r)||l(A),a+=r,t=S);break;case D:"}"==r?t=P:T(r)?t=D:l(A)}return $.has(t)||l(j),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 F="__tolgee_dev_tools",B="data-tolgee-key-only",M="data-tolgee-restricted",V="_tolgee",z="_tolgee-highlighter";function K(){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 Y(e){if(K())throw new Error(`${e}: Can't run on the server`)}function G(e,t){return{oldTextContent:e,keys:t}}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 r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(z),Object.entries(W).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const o=n.getBoundingClientRect();r.style.borderWidth=t+"px",r.style.top=o.top-t+"px",r.style.left=o.left-t+"px",r.style.width=o.width+"px",r.style.height=o.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:e,elementStore:t,onClick:n,options:a})=>{var r,o;let i,s,l=new Set;const u=(null===(r=a.targetElement)||void 0===r?void 0:r.getRootNode())||document,c=(null===(o=a.targetElement)||void 0===o?void 0:o.ownerDocument)||document,g=e=>{var n;if(i!==e){d();const a=t.get(e);a&&(a.preventClean=!0,null===(n=a.highlight)||void 0===n||n.call(a),i=e)}},d=()=>{var e;const n=t.get(i);n&&(n.preventClean=!1,null===(e=n.unhighlight)||void 0===e||e.call(n),i=void 0)};function f(){const e=s;let n;if(e&&O()){const a=u.elementFromPoint(e.x,e.y);a&&(n=function(e){return L(e,(e=>t.get(e)))}(a))}g(n)}const p=e=>{var t;O()&&(t=e.target,!Boolean(L(t,(e=>e.id===F))))&&(e.stopPropagation(),e.preventDefault())},v=e=>{var t;t={x:e.clientX,y:e.clientY},s=t,f()},h=()=>{l=new Set,f()},m=e=>{const t=e.key;void 0!==t&&l.add(t),f()},b=e=>{l.delete(e.key),f()},y=()=>{var e;const n=t.get(i);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)},E=e=>{p(e),O()&&i&&(n(e,i),d())};function L(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?L(e.parentElement,t):void 0}function O(){for(const t of e)if(!l.has(t))return!1;return!0}return Object.freeze({run:function(){c.addEventListener("blur",h,ee),c.addEventListener("keydown",m,ee),c.addEventListener("keyup",b,ee),c.addEventListener("mousemove",v,te),c.addEventListener("scroll",y,te),c.addEventListener("click",E,ee),c.addEventListener("mouseenter",p,ee),c.addEventListener("mouseover",p,ee),c.addEventListener("mouseout",p,ee),c.addEventListener("mouseleave",p,ee),c.addEventListener("mousedown",p,ee),c.addEventListener("mouseup",p,ee)},stop:function(){c.removeEventListener("blur",h,ee),c.removeEventListener("keydown",m,ee),c.removeEventListener("keyup",b,ee),c.removeEventListener("mousemove",v,te),c.removeEventListener("scroll",y,te),c.removeEventListener("click",E,ee),c.removeEventListener("mouseenter",p,ee),c.removeEventListener("mouseover",p,ee),c.removeEventListener("mouseout",p,ee),c.removeEventListener("mouseleave",p,ee),c.removeEventListener("mousedown",p,ee),c.removeEventListener("mouseup",p,ee)}})},ae=(e,t,n)=>{const r=X({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),o=ne({highlightKeys:e.highlightKeys,elementStore:t,onClick:(e,a)=>{const r=t.get(a);n({event:e,keysAndDefaults:s(r)})},options:e});function i(){return e.targetElement||document.body}function s(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({register:function(n,a,o){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${M}]`)}(n))return;const i=n;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(V,"true")),s.nodes.set(a,o),r.initHighlighter(i,s)},forEachElement:t.forEachElement,findAll:function(e,n){const r=[];return t.forEachElement(((t,o)=>{for(const t of o.nodes.values()){if(t.keys.find((t=>Q({key:e,ns:a(n)},{key:t.key,ns:a(t.ns)})))){r.push(o);break}}})),r},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(i(),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(V),t.remove(e)}(e,n))}))},run:function(e){e&&o.run()},stop:function(){o.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t))}))}})},re=()=>{let e,t=!1;const n=(()=>{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:a,wrapper:r,onClick:o})=>{if(K())return;const i=(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}}))(a),s=((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})})(a,r),l=ae(a,n,o);function u(e){for(const t of e){const e=J(t),n=e?r.unwrap(e):null;if(n){const{text:a,keys:r}=n;q(t,a);const o=G(e,r),s=i.getSuitableParent(t);l.register(s,t,o)}}}const c=e=>{H(`./descendant-or-self::*[@${B}]`,e).forEach((e=>{const t=e.getAttributeNode(B),n=i.getSuitableParent(t);l.register(n,t,{oldTextContent:"",keys:[{key:J(t)}],keyAttributeOnly:!0})}))},g=new MutationObserver((e=>{if(t)for(const t of e){let e=[];switch(t.type){case"characterData":e=s.handleText(t.target);break;case"childList":c(t.target),e=s.handleChildList(t.target);break;case"attributes":c(t.target),e=s.handleAttributes(t.target)}u(e),l.refreshAll()}})),d=a.targetElement||document.body;return t=!0,l.run(e),c(d),u(s.handleChildList(d)),g.observe(d,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,l.stop(),g.disconnect()},elementRegistry:l,wrapper:r}};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)}))}}},findPositions(t,n){const r=(null==e?void 0:e.elementRegistry.findAll(t,n))||[],o=[];return r.forEach((e=>{const r=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{Q({key:t,ns:a(n)},{key:e.key,ns:a(e.ns)})&&o.push({position:{x:r.x,y:r.y,width:r.width,height:r.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),o},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})},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.6.0-prerelease.b5ab209e.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=F,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})=>U(e,t)}),e),exports.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){Y("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:()=>(Y("LanguageStorage"),localStorage.getItem(xe)||void 0),setLanguage(e){Y("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=V,exports.TOLGEE_RESTRICT_ATTRIBUTE=M,exports.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=B,exports.Tolgee=()=>w().use(exports.BrowserExtensionPlugin()),exports.TolgeeCore=w,exports.getFallback=a,exports.getFallbackArray=r,exports.getProjectIdFromApiKey=ve,exports.getTranslateProps=L;
"use strict";function e(e){return Boolean(e&&"function"==typeof e.then)}Object.defineProperty(exports,"__esModule",{value:!0});const t=(t,n)=>e(t)?Promise.resolve(t).then(n):n(t),n=e=>`Tolgee: You need to specify '${e}' option`;function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function r(e){return a(e)||[]}function o(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?r(t):r(null==t?void 0:t[e]);var n}function i(e){return Array.from(new Set(e))}function s(e){return e?e.replace(/\/+$/,""):e}const l=e=>{let t=[];return Object.freeze({listen:e=>{const n=t=>{e(t)};return t.push(n),{unsubscribe:()=>{t=t.filter((e=>n!==e))}}},emit:n=>{e()&&t.forEach((e=>e({value:n})))}})},u=(e,t,n)=>{const a=new Set,o=new Set;let i=[];const s=()=>{if(0===i.length)return;const e=i;i=[],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());o.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))})(n?Array.from(n.keys()):void 0)};return Object.freeze({listenSome:e=>{const t={fn:t=>{e(t)},namespaces:new Set};o.add(t);const a={unsubscribe:()=>{o.delete(t)},subscribeNs:e=>(r(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()&&(i.push(t),n?setTimeout(s,0):s())}})},c=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):c(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},g=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},d=({language:e,namespace:t})=>t?`${e}:${t}`:e,f=(e,t,n,a,o,s,l)=>{const u=new Map,f=new Map;let p={},v=0;function h(t,n,a){const r=d(t);f.set(r,{data:c(n),version:a}),e.emit(t)}function m(e,t){h(e,t,v)}function b(e,t=!1){const n=f.get(d(e));return n&&t?n.version===v:Boolean(n)}function y(e){var t;return null===(t=f.get(d(a(e))))||void 0===t?void 0:t.data}function E(e){let n;if(!n){const t=p[d(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n}return Object.freeze({addStaticData:function(e){e&&(p=Object.assign(Object.assign({},p),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=g(e),a=f.get(e);a&&0!==a.version||h(n,t,0)}})))},invalidate:function(){u.clear(),v+=1},addRecord:m,exists:b,getRecord:y,getTranslation:function(e,t){var n;return null===(n=f.get(d(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=f.get(d({language:e,namespace:r})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[r]}return i(e)},getTranslationFallback:function(e,t,n){var a;for(const r of e)for(const e of t){const t=null===(a=f.get(d({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=f.get(d(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(o())return!0;if(void 0===e)return u.size>0;const t=r(e);return Boolean(Array.from(u.keys()).find((e=>t.includes(g(e).namespace))))},isLoading:function(e,t){const n=r(t);return Boolean(o()||Array.from(u.keys()).find((t=>{const a=g(t);return(!n.length||n.includes(a.namespace))&&!b({namespace:a.namespace,language:e})})))},loadRecords:async function(e,t){const r=e.map((e=>{const r=a(e),o=d(r),i=u.get(o);if(i)return{new:!1,promise:i,keyObject:r,cacheKey:o};const s=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"),E(e))))),r||(r=E(e)),r}(r,t)||Promise.resolve(void 0);return u.set(o,s),{new:!0,promise:s,keyObject:r,cacheKey:o}}));s.notify(),l.notify();const o=await Promise.all(r.map((e=>e.promise)));return r.forEach(((e,t)=>{const n=u.get(e.cacheKey)!==e.promise;if(e.new&&!n){u.delete(e.cacheKey);const n=o[t];n?m(e.keyObject,n):y(e.keyObject)||m(e.keyObject,{})}})),s.notify(),l.notify(),r.map((e=>y(e.keyObject)))},getAllRecords:function(){return Array.from(f.entries()).map((([e,t])=>Object.assign(Object.assign({},g(e)),{data:t.data})))}})};function p(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}const v="invalid",h={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:v,apiUrl:"https://app.tolgee.io"},m=(...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},b=(e,t)=>{const n=m(h,null==t?void 0:t.initialOptions,e);return n.apiUrl=s(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}},y=(n,a,r,o,i,s)=>{const l={ui:void 0},u={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 a=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,ns:o({key:e,ns:t}),translation:i({key:e,ns:t})})));null===(n=u.ui)||void 0===n||n.handleElementClick(a,t)},g=(e,t)=>{var n,a;return(null===(a=null===(n=u.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},d=(e,t)=>{var n;return(null===(n=u.observer)||void 0===n?void 0:n.findPositions(e,t))||[]},f=e=>{const t=i({key:e.key,ns:e.ns});return x(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))},h=e=>{u.observer=null==e?void 0:e()},m=()=>Boolean(u.observer),b=e=>{e&&u.formatters.push(e)},y=e=>{u.finalFormatter=e},E=e=>{l.ui=e},L=()=>Boolean(l.ui),O=e=>{u.languageStorage=e},w=e=>{u.languageDetector=e},k=e=>{e&&u.backends.push(e)},A=e=>{u.devBackend=e},j=()=>u.devBackend;function x(e){var t,{formatEnabled:r}=e,o=p(e,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:g,orEmpty:d,ns:f}=o,h=s||l;let m=h||(d?"":i);const b=n(),y=r||!(null===(t=u.observer)||void 0===t?void 0:t.outputNotFormattable),E=e=>u.observer&&!c?u.observer.wrap({key:i,translation:e,defaultValue:l,params:g,ns:f}):e;m=E(m);try{if(h&&b&&y)for(const e of u.formatters)m=e.format({translation:m,language:b,params:g});u.finalFormatter&&h&&b&&y&&(m=u.finalFormatter.format({translation:m,language:b,params:g}))}catch(e){console.error(e);const t=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||v,n=a().onFormatError,r=typeof n;m="string"===r?n:"function"===r?n(t,o):v,m=E(m)}var L;return m}return Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:y,addFormatter:b,setObserver:h,hasObserver:m,setUi:E,hasUi:L,setDevBackend:A,addBackend:k,setLanguageDetector:w,setLanguageStorage:O}))},formatTranslation:x,getDevBackend:j,getBackendRecord:({language:t,namespace:n})=>{for(const a of u.backends){const r=a.getRecord({language:t,namespace:n});if(e(r))return null==r?void 0:r.catch((e=>(console.error(e),{})));if(void 0!==r)return r}},getBackendDevRecord:({language:e,namespace:t})=>{var n;const{apiKey:r,apiUrl:o,projectId:i}=a();return null===(n=u.devBackend)||void 0===n?void 0:n.getRecord({apiKey:r,apiUrl:o,projectId:i,language:e,namespace:t})},getLanguageDetector:()=>u.languageDetector,getLanguageStorage:()=>u.languageStorage,getInitialLanguage:()=>{var e;const n=r(),a=null===(e=u.languageStorage)||void 0===e?void 0:e.getLanguage();return t(a,(e=>n&&!n.includes(e)||!e?(()=>{if(!u.languageDetector)return;const e=r();return u.languageDetector.getLanguage({availableLanguages:e})})():e))},setStoredLanguage:e=>{var t;null===(t=u.languageStorage)||void 0===t||t.setLanguage(e)},run:()=>{var e,t;const{apiKey:n,apiUrl:r,projectId:o,observerOptions:i}=a();u.ui=null===(e=l.ui)||void 0===e?void 0:e.call(l,{apiKey:n,apiUrl:r,projectId:o,highlight:g,changeTranslation:s,findPositions:d}),null===(t=u.observer)||void 0===t||t.run({mouseHighlight:!0,options:i,translate:f,onClick:c})},stop:()=>{var e;u.ui=void 0,null===(e=u.observer)||void 0===e||e.stop()},retranslate:()=>{var e;null===(e=u.observer)||void 0===e||e.retranslate()},highlight:g,unwrap:e=>{var t;return u.observer?null===(t=u.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap:e=>{var t;return u.observer?null===(t=u.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:function(){return Boolean(j())}})},E=(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 L=(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=p(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},O=({options:a})=>{const c=((e,t)=>{let n=!0;function a(){return n}const r=l(a),o=l(a),i=l(a),s=l(a),c=l(a),g=l(a),d=l(a),f=u(a,e,t);return c.listen((()=>f.emit())),o.listen((()=>f.emit())),d.listen((({value:e})=>{f.emit([e.namespace],!0)})),Object.freeze({onPendingLanguageChange:r,onLanguageChange:o,onLoadingChange:i,onFetchingChange:s,onInitialLoaded:c,onRunningChange:g,onCacheChange:d,onUpdate:f,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 c.listen(t);case"running":return g.listen(t);case"cache":return d.listen(t);case"update":return f.listen(t)}}})})(O,w),d=E(!1,(()=>m.isFetching()),c.onFetchingChange.emit),p=E(!1,(()=>T()),c.onLoadingChange.emit),v=((e,t,n)=>{let a,l=b();function u(){return l.language||l.initialOptions.language}function c(){return Object.assign(Object.assign({},l.initialOptions),a)}return Object.freeze({init:function(e){l=b(e,l)},isRunning:function(){return l.isRunning},setRunning:function(e){l.isRunning!==e&&(l.isRunning=e,n.emit(e))},isInitialLoading:function(){return l.isInitialLoading},setInitialLoading:function(e){l.isInitialLoading=e},getLanguage:u,setLanguage:function(t){l.language!==t&&(l.language=t,e.emit(t))},getPendingLanguage:function(){return l.pendingLanguage||u()},setPendingLanguage:function(e){l.pendingLanguage!==e&&(l.pendingLanguage=e,t.emit(e))},getInitialOptions:c,addActiveNs:function(e){r(e).forEach((e=>{const t=l.activeNamespaces.get(e);void 0!==t?l.activeNamespaces.set(e,t+1):l.activeNamespaces.set(e,1)}))},removeActiveNs:function(e){r(e).forEach((e=>{const t=l.activeNamespaces.get(e);void 0!==t&&t>1?l.activeNamespaces.set(e,t-1):l.activeNamespaces.delete(e)}))},getRequiredNamespaces:function(){return i([...l.initialOptions.ns||[l.initialOptions.defaultNs],...r(l.initialOptions.fallbackNs),...l.activeNamespaces.keys()])},getFallbackLangs:function(e){const t=e||u();return t?i([t,...o(t,l.initialOptions.fallbackLanguage)]):[]},getFallbackNs:function(){return r(l.initialOptions.fallbackNs)},getDefaultNs:function(e){return void 0===e?l.initialOptions.defaultNs:e},getAvailableLanguages:function(){if(l.initialOptions.availableLanguages)return l.initialOptions.availableLanguages;if(l.initialOptions.staticData){const e=Object.keys(l.initialOptions.staticData).map((e=>g(e).language));return Array.from(new Set(e))}},withDefaultNs:function(e){return{namespace:void 0===e.namespace?c().defaultNs:e.namespace,language:e.language}},overrideCredentials:function(e){a=e?Object.assign(Object.assign({},e),{apiUrl:s(e.apiUrl)}):void 0}})})(c.onLanguageChange,c.onPendingLanguageChange,c.onRunningChange),h=y(v.getLanguage,v.getInitialOptions,v.getAvailableLanguages,(function({key:e,ns:t}){const n=v.getFallbackLangs(),a=k(t||void 0);return m.getTranslationNs(a,n,e)}),R,j),m=f(c.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,v.withDefaultNs,v.isInitialLoading,d,p);function O(){return v.getFallbackNs()}function w(e){return v.getDefaultNs(e)}function k(e){return[...r(w(e)),...O()]}function A(e){return[...r(e||w()),...v.getRequiredNamespaces()]}function j(e,t,n){const a=v.withDefaultNs(e),r=m.getTranslation(a,t);return m.changeTranslation(a,t,n),{revert:()=>{m.changeTranslation(a,t,r)}}}function x(e){v.init(e),m.addStaticData(v.getInitialOptions().staticData)}function T(e){return m.isLoading(v.getLanguage(),e)}function P(){return Boolean(v.getInitialOptions().apiKey&&v.getInitialOptions().apiUrl)}function N(e,n){const a=function(e,t){const n=v.getFallbackLangs(e),a=A(t),r=[];return n.forEach((e=>{a.forEach((t=>{m.exists({language:e,namespace:t},!0)||r.push({language:e,namespace:t})}))})),r}(e,n);if(a.length)return t(D(a),(()=>{}))}function R({key:e,ns:t}){const n=k(t||void 0),a=v.getFallbackLangs();return m.getTranslationFallback(n,a,e)}function S(){const a=t(function(){if(v.getLanguage())return;if(!v.getInitialOptions().defaultLanguage)throw new Error(n("defaultLanguage"));const e=h.getInitialLanguage();return t(e,(e=>{const t=e||v.getInitialOptions().defaultLanguage;t&&v.setLanguage(t)}))}(),(()=>N()));if(e(a))return v.setInitialLoading(!0),d.notify(),p.notify(),Promise.resolve(a).then((()=>{v.setInitialLoading(!1),d.notify(),p.notify(),c.onInitialLoaded.emit()}));c.onInitialLoaded.emit()}function D(e){return m.loadRecords(e,P())}a&&x(a),c.onUpdate.listen((()=>{v.isRunning()&&h.retranslate()}));const $=()=>{const e=h.getLanguageDetector()||h.getLanguageStorage();if(e){if(!v.getAvailableLanguages())throw new Error(n("availableLanguages"))}if(!v.getLanguage()&&!v.getInitialOptions().defaultLanguage)throw e?new Error(n("defaultLanguage")):new Error(n("language"))};return Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c),v),h),m),{init:x,changeLanguage:async function(e){v.getPendingLanguage()===e&&v.getLanguage()===e||(v.setPendingLanguage(e),v.isRunning()&&await N(e),e===v.getPendingLanguage()&&(v.setLanguage(e),h.setStoredLanguage(e)))},getTranslation:R,changeTranslation:j,addActiveNs:async function(e,t){t||v.addActiveNs(e),v.isRunning()&&await N(void 0,e)},loadRecords:D,loadRecord:async function(e){return(await D([e]))[0]},isLoading:T,isLoaded:function(e){const t=v.getLanguage();if(!t)return!1;const n=v.getFallbackLangs(t),a=A(e),r=[];return n.forEach((e=>{a.forEach((t=>{m.exists({language:e,namespace:t})||r.push({language:e,namespace:t})}))})),0===r.length},t:(...e)=>{const t=L(...e),n=R(t);return h.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:P,run:function(){let e;return $(),v.isRunning()||(P()&&m.invalidate(),v.setRunning(!0),h.run(),e=S()),Promise.resolve(e)},stop:function(){v.isRunning()&&(h.stop(),v.setRunning(!1))}}))},w=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=m(e.options,n),t),init(t){const n=(e=>{const t=O({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})(m(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},k=0,A=1,j=2;class x extends Error{constructor(e,t,n){let a;a=e===k?"Empty parameter":e===A?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function T(e){return/\s/.test(e)}const P=0,N=1,R=2,S=3,D=4,$=new Set([R,N,P]),C="'",I=new Set(["{","}",C]),_=e=>/[0-9a-zA-Z_]/.test(e);function U(e,t){const[n,a]=function(e){let t=P,n="",a="",r="";const o=[],i=[];let s=0;function l(t){throw new x(t,s,e)}const u=()=>{o.push(n),n=""},c=()=>{""===a&&l(k),i.push(a),a=""};for(s=0;s<e.length;s++)switch(r=e[s],t){case P:r===C?(n+=r,t=N):"{"===r?(u(),t=S):(n+=r,t=P);break;case N:I.has(r)?(n=n.slice(0,-1)+r,t=R):(n+=r,t=P);break;case R:r===C?t=P:(n+=r,t=R);break;case S:"}"===r?(c(),t=P):T(r)?""!==a&&(c(),t=D):(_(r)||l(A),a+=r,t=S);break;case D:"}"==r?t=P:T(r)?t=D:l(A)}return $.has(t)||l(j),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 F="__tolgee_dev_tools",B="data-tolgee-key-only",M="data-tolgee-restricted",V="_tolgee",z="_tolgee-highlighter";function K(){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 Y(e){if(K())throw new Error(`${e}: Can't run on the server`)}function G(e,t){return{oldTextContent:e,keys:t}}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 r=a.highlightEl;r||(r=document.createElement("div"),r.classList.add(z),Object.entries(W).forEach((([e,t])=>{r.style[e]=t})),r.style.borderColor=e,a.highlightEl=r,document.body.appendChild(r));const o=n.getBoundingClientRect();r.style.borderWidth=t+"px",r.style.top=o.top-t+"px",r.style.left=o.left-t+"px",r.style.width=o.width+"px",r.style.height=o.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:e,elementStore:t,onClick:n,options:a})=>{var r,o;let i,s,l=new Set;const u=(null===(r=a.targetElement)||void 0===r?void 0:r.getRootNode())||document,c=(null===(o=a.targetElement)||void 0===o?void 0:o.ownerDocument)||document,g=e=>{var n;if(i!==e){d();const a=t.get(e);a&&(a.preventClean=!0,null===(n=a.highlight)||void 0===n||n.call(a),i=e)}},d=()=>{var e;const n=t.get(i);n&&(n.preventClean=!1,null===(e=n.unhighlight)||void 0===e||e.call(n),i=void 0)};function f(){const e=s;let n;if(e&&O()){const a=u.elementFromPoint(e.x,e.y);a&&(n=function(e){return L(e,(e=>t.get(e)))}(a))}g(n)}const p=e=>{var t;O()&&(t=e.target,!Boolean(L(t,(e=>e.id===F))))&&(e.stopPropagation(),e.preventDefault())},v=e=>{var t;t={x:e.clientX,y:e.clientY},s=t,f()},h=()=>{l=new Set,f()},m=e=>{const t=e.key;void 0!==t&&l.add(t),f()},b=e=>{l.delete(e.key),f()},y=()=>{var e;const n=t.get(i);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)},E=e=>{p(e),O()&&i&&(n(e,i),d())};function L(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?L(e.parentElement,t):void 0}function O(){for(const t of e)if(!l.has(t))return!1;return!0}return Object.freeze({run:function(){c.addEventListener("blur",h,ee),c.addEventListener("keydown",m,ee),c.addEventListener("keyup",b,ee),c.addEventListener("mousemove",v,te),c.addEventListener("scroll",y,te),c.addEventListener("click",E,ee),c.addEventListener("mouseenter",p,ee),c.addEventListener("mouseover",p,ee),c.addEventListener("mouseout",p,ee),c.addEventListener("mouseleave",p,ee),c.addEventListener("mousedown",p,ee),c.addEventListener("mouseup",p,ee)},stop:function(){c.removeEventListener("blur",h,ee),c.removeEventListener("keydown",m,ee),c.removeEventListener("keyup",b,ee),c.removeEventListener("mousemove",v,te),c.removeEventListener("scroll",y,te),c.removeEventListener("click",E,ee),c.removeEventListener("mouseenter",p,ee),c.removeEventListener("mouseover",p,ee),c.removeEventListener("mouseout",p,ee),c.removeEventListener("mouseleave",p,ee),c.removeEventListener("mousedown",p,ee),c.removeEventListener("mouseup",p,ee)}})},ae=(e,t,n)=>{const r=X({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),o=ne({highlightKeys:e.highlightKeys,elementStore:t,onClick:(e,a)=>{const r=t.get(a);n({event:e,keysAndDefaults:s(r)})},options:e});function i(){return e.targetElement||document.body}function s(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({register:function(n,a,o){if(function(t){return-1!==e.restrictedElements.indexOf(t.tagName.toLowerCase())||null!==t.closest(`[${M}]`)}(n))return;const i=n;let s=t.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),t.set(i,s),i.setAttribute(V,"true")),s.nodes.set(a,o),r.initHighlighter(i,s)},forEachElement:t.forEachElement,findAll:function(e,n){const r=[];return t.forEachElement(((t,o)=>{for(const t of o.nodes.values()){if(t.keys.find((t=>Q({key:e,ns:a(n)},{key:t.key,ns:a(t.ns)})))){r.push(o);break}}})),r},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(i(),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(V),t.remove(e)}(e,n))}))},run:function(e){e&&o.run()},stop:function(){o.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t))}))}})},re=()=>{let e,t=!1;const n=(()=>{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:a,wrapper:r,onClick:o})=>{if(K())return;const i=(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}}))(a),s=((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})})(a,r),l=ae(a,n,o);function u(e){for(const t of e){const e=J(t),n=e?r.unwrap(e):null;if(n){const{text:a,keys:r}=n;q(t,a);const o=G(e,r),s=i.getSuitableParent(t);l.register(s,t,o)}}}const c=e=>{H(`./descendant-or-self::*[@${B}]`,e).forEach((e=>{const t=e.getAttributeNode(B),n=i.getSuitableParent(t);l.register(n,t,{oldTextContent:"",keys:[{key:J(t)}],keyAttributeOnly:!0})}))},g=new MutationObserver((e=>{if(t)for(const t of e){let e=[];switch(t.type){case"characterData":e=s.handleText(t.target);break;case"childList":c(t.target),e=s.handleChildList(t.target);break;case"attributes":c(t.target),e=s.handleAttributes(t.target)}u(e),l.refreshAll()}})),d=a.targetElement||document.body;return t=!0,l.run(e),c(d),u(s.handleChildList(d)),g.observe(d,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){t=!1,l.stop(),g.disconnect()},elementRegistry:l,wrapper:r}};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)}))}}},findPositions(t,n){const r=(null==e?void 0:e.elementRegistry.findAll(t,n))||[],o=[];return r.forEach((e=>{const r=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{Q({key:t,ns:a(n)},{key:e.key,ns:a(e.ns)})&&o.push({position:{x:r.x,y:r.y,width:r.width,height:r.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),o},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})},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.6.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=F,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})=>U(e,t)}),e),exports.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){Y("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:()=>(Y("LanguageStorage"),localStorage.getItem(xe)||void 0),setLanguage(e){Y("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=V,exports.TOLGEE_RESTRICT_ATTRIBUTE=M,exports.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=B,exports.Tolgee=()=>w().use(exports.BrowserExtensionPlugin()),exports.TolgeeCore=w,exports.getFallback=a,exports.getFallbackArray=r,exports.getProjectIdFromApiKey=ve,exports.getTranslateProps=L;
//# sourceMappingURL=tolgee-web.production.cjs.min.js.map

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

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

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

"dependencies": {
"@tolgee/core": "5.6.0-prerelease.b5ab209e.0"
"@tolgee/core": "5.6.0"
},

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

"homepage": "https://github.com/tolgee/tolgee-js#readme",
"gitHead": "bfb41a3dc1c220d02a17a485e7f062d4e2a19dca",
"gitHead": "f6f402b6c1694df89da3597cb2038f501978bfba",
"publishConfig": {

@@ -105,0 +105,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