@tolgee/web
Advanced tools
Comparing version 5.13.2 to 5.13.3-prerelease.5f76277d.0
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return Boolean(e&&"function"==typeof e.then)}function t(t,n){return e(t)?Promise.resolve(t).then(n):n(t)}function n(e){const t=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),n=t.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...t.slice(0,-2),n].join(", ")} option`}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function o(e){return a(e)||[]}function r(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?o(t):o(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}Object.defineProperty(exports,"__esModule",{value:!0});const l=(e,t)=>fetch(e,t),c=(e=l)=>(t,n)=>e(t,Object.assign(Object.assign({},n),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.13.2"},null==n?void 0:n.headers)}));function 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})))}})}function g(e,t,n){const a=new Set,r=new Set;let i=[];function 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)))}));!function(e){const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))}(n?Array.from(n.keys()):void 0)}return Object.freeze({emit(t,n){e()&&(i.push(t),n?setTimeout(s,0):s())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(o(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}const d=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):d(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},f=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},p=({language:e,namespace:t})=>t?`${e}:${t}`:e;function v(e,t,n,a,r,s,l){const c=new Map,u=new Map;let g={},v=0;function h(t,n,a){const o=p(t);u.set(o,{data:d(n),version:a}),e.emit(t)}function m(e){let n;if(!n){const t=g[p(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n}const b=Object.freeze({addStaticData(e){e&&(g=Object.assign(Object.assign({},g),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=f(e),a=u.get(e);a&&0!==a.version||h(n,t,0)}})))},invalidate(){c.clear(),v+=1},addRecord(e,t){h(e,t,v)},exists(e,t=!1){const n=u.get(p(e));return n&&t?n.version===v:Boolean(n)},getRecord(e){var t;return null===(t=u.get(p(a(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=u.get(p(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=u.get(p({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[o]}return i(e)},getTranslationFallback(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=u.get(p({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var o;const r=null===(o=u.get(p(t)))||void 0===o?void 0:o.data;null==r||r.set(n,a),e.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return c.size>0;const t=o(e);return Boolean(Array.from(c.keys()).find((e=>t.includes(f(e).namespace))))},isLoading(e,t){const n=o(t);return Boolean(r()||Array.from(c.keys()).find((t=>{const a=f(t);return(!n.length||n.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,t){const o=e.map((e=>{const o=a(e),r=p(o),i=c.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"),m(e))))),o||(o=m(e)),o}(o,t)||Promise.resolve(void 0);return c.set(r,s),{new:!0,promise:s,keyObject:o,cacheKey:r}}));s.notify(),l.notify();const r=await Promise.all(o.map((e=>e.promise)));return o.forEach(((e,t)=>{const n=c.get(e.cacheKey)!==e.promise;if(e.new&&!n){c.delete(e.cacheKey);const n=r[t];n?b.addRecord(e.keyObject,n):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),s.notify(),l.notify(),o.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(u.entries()).map((([e,t])=>Object.assign(Object.assign({},f(e)),{data:t.data})))});return b}function h(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 m="invalid",b={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:m,apiUrl:"https://app.tolgee.io",fetch:c(),onTranslationMissing:({key:e})=>e},y=(...e)=>{let t={};return e.forEach((e=>{t=Object.assign(Object.assign(Object.assign({},t),e),{observerOptions:Object.assign(Object.assign({},t.observerOptions),null==e?void 0:e.observerOptions)})})),t};function E(e,t){const n=y(b,null==t?void 0:t.initialOptions,e);return n.apiUrl=s(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=c(e.fetch)),{initialOptions:n,activeNamespaces:(null==t?void 0:t.activeNamespaces)||new Map,language:null==t?void 0:t.language,pendingLanguage:null==t?void 0:t.language,isInitialLoading:!1,isRunning:!1}}function O(n,a,o,r,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,event:t})=>{var n;const a=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:r(t),namespace:i({key:e,ns:t})[0],translation:s({key:e,ns:t})})));null===(n=g.ui)||void 0===n||n.handleElementClick(a,t)},f=(e,t)=>{var n;return(null===(n=g.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function p(e){const t=s({key:e.key,ns:e.ns});return T.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function v(){return{fetch:a().fetch}}function b(e){g.observer=null==e?void 0:e()}function y(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function O(e){g.finalFormatter=e}function L(e){u.ui=e}function w(){return Boolean(u.ui)}function k(e){g.languageStorage=e}function j(e){g.languageDetector=e}function A(e){e&&g.backends.push(e)}function x(e){g.devBackend=e}const T=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:O,addFormatter:E,setObserver:b,hasObserver:y,setUi:L,hasUi:w,setDevBackend:x,addBackend:A,setLanguageDetector:j,setLanguageStorage:k}))},run(){var e,t;const{apiKey:n,apiUrl:o,projectId:r,observerOptions:i}=a();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:n,apiUrl:o,projectId:r,highlight:T.highlight,changeTranslation:l,findPositions:f,onPermanentChange:c}),null===(t=g.observer)||void 0===t||t.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){var e;const n=o();return t(null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(v()),(e=>n&&!n.includes(e)||!e?function(){if(!g.languageDetector)return;const e=o();return g.languageDetector.getLanguage(Object.assign({availableLanguages:e},v()))}():e))},setStoredLanguage(e){var t;null===(t=g.languageStorage)||void 0===t||t.setLanguage(e,v())},getDevBackend:()=>g.devBackend,getBackendRecord:({language:t,namespace:n})=>{for(const a of g.backends){const o=a.getRecord(Object.assign({language:t,namespace:n},v()));if(e(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=g.devBackend)||void 0===n?void 0:n.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:t},v()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=g.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(T.getDevBackend()),formatTranslation(e){var t,{formatEnabled:o}=e,r=h(e,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let v="";null==s&&(v=a().onTranslationMissing(r));let b=null!=p?p:f?"":v;const y=n(),E=o||!(null===(t=g.observer)||void 0===t?void 0:t.outputNotFormattable),O=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;b=O(b);try{if(p&&y&&E)for(const e of g.formatters)b=e.format({translation:b,language:y,params:u});g.finalFormatter&&p&&y&&E&&(b=g.finalFormatter.format({translation:b,language:y,params:u}))}catch(e){console.error(e);const t=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||m,n=a().onFormatError,o=typeof n;b="string"===o?n:"function"===o?n(t,r):m,b=O(b)}var L;return b}});return T}const L=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const w=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:o,language:r}=e,i=h(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function k({options:a}){const l=function(e,t){let n=!0;function a(){return n}const o=Object.freeze({onPendingLanguageChange:u(a),onLanguageChange:u(a),onLoadingChange:u(a),onFetchingChange:u(a),onInitialLoaded:u(a),onRunningChange:u(a),onCacheChange:u(a),onUpdate:g(a,e,t),onPermanentChange:u(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(t);case"language":return o.onLanguageChange.listen(t);case"loading":return o.onLoadingChange.listen(t);case"fetching":return o.onFetchingChange.listen(t);case"initialLoad":return o.onInitialLoaded.listen(t);case"running":return o.onRunningChange.listen(t);case"cache":return o.onCacheChange.listen(t);case"update":return o.onUpdate.listen(t);case"permanentChange":return o.onPermanentChange.listen(t)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(y,k),c=L(!1,(()=>m.isFetching()),l.onFetchingChange.emit),d=L(!1,(()=>C.isLoading()),l.onLoadingChange.emit),p=function(e,t,n){let a,l=E();const c=Object.freeze({init(e){l=E(e,l)},isRunning:()=>l.isRunning,setRunning(e){l.isRunning!==e&&(l.isRunning=e,n.emit(e))},isInitialLoading:()=>l.isInitialLoading,setInitialLoading(e){l.isInitialLoading=e},getLanguage:()=>l.language||l.initialOptions.language,setLanguage(t){l.language!==t&&(l.language=t,e.emit(t))},getPendingLanguage:()=>l.pendingLanguage||c.getLanguage(),setPendingLanguage(e){l.pendingLanguage!==e&&(l.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},l.initialOptions),a),addActiveNs(e){o(e).forEach((e=>{const t=l.activeNamespaces.get(e);void 0!==t?l.activeNamespaces.set(e,t+1):l.activeNamespaces.set(e,1)}))},removeActiveNs(e){o(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:()=>i([...l.initialOptions.ns||[l.initialOptions.defaultNs],...o(l.initialOptions.fallbackNs),...l.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||c.getLanguage();return t?i([t,...r(t,l.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>o(l.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?l.initialOptions.defaultNs:e,getAvailableLanguages(){if(l.initialOptions.availableLanguages)return l.initialOptions.availableLanguages;if(l.initialOptions.staticData){const e=Object.keys(l.initialOptions.staticData).map((e=>f(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:s(e.apiUrl)}):void 0}});return c}(l.onLanguageChange,l.onPendingLanguageChange,l.onRunningChange),h=O(p.getLanguage,p.getInitialOptions,p.getAvailableLanguages,j,N,R,x,(function(e){l.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=v(l.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,p.withDefaultNs,p.isInitialLoading,c,d);let b;function y(){return p.getFallbackNs()}function k(e){return p.getDefaultNs(e)}function j(e){return[...o(k(e)),...y()]}function A(e){return[...o(null!=e?e:k()),...p.getRequiredNamespaces()]}function x(e,t,n){const a=p.withDefaultNs(e),o=m.getTranslation(a,t);return m.changeTranslation(a,t,n),{revert(){m.changeTranslation(a,t,o)}}}function T(e){p.init(e),m.addStaticData(p.getInitialOptions().staticData)}function P(e,n){const a=function(e,t){const n=p.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,n);if(a.length)return t(C.loadRecords(a),(()=>{}))}function N({key:e,ns:t}){const n=p.getFallbackLangs(),a=j(null!=t?t:void 0);return m.getTranslationNs(a,n,e)}function R({key:e,ns:t,language:n}){const a=j(null!=t?t:void 0),o=p.getFallbackLangs(n);return m.getTranslationFallback(a,o,e)}function S(){const n=t(function(){if(p.getLanguage())return;return t(h.getInitialLanguage(),(e=>{const t=e||p.getInitialOptions().defaultLanguage;t&&p.setLanguage(t)}))}(),(()=>P()));if(e(n))return p.setInitialLoading(!0),c.notify(),d.notify(),Promise.resolve(n).then((()=>{p.setInitialLoading(!1),c.notify(),d.notify(),l.onInitialLoaded.emit()}));l.onInitialLoaded.emit()}a&&T(a),l.onUpdate.listen((()=>{p.isRunning()&&h.retranslate()}));const C=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),p),h),m),{init:T,getTranslation:R,changeTranslation:x,getTranslationNs:N,getDefaultAndFallbackNs:j,async changeLanguage(e){p.getPendingLanguage()===e&&p.getLanguage()===e||(p.setPendingLanguage(e),p.isRunning()&&await P(e),e===p.getPendingLanguage()&&(p.setLanguage(e),h.setStoredLanguage(e)))},async addActiveNs(e,t){t||p.addActiveNs(e),p.isRunning()&&await P(void 0,e)},loadRecords:e=>m.loadRecords(e,C.isDev()),loadRecord:async e=>(await C.loadRecords([e]))[0],isLoading:e=>m.isLoading(p.getLanguage(),e),isLoaded(e){const t=p.getLanguage();if(!t)return!1;const n=p.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=w(...e),n=R(t);return h.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(p.getInitialOptions().apiKey&&p.getInitialOptions().apiUrl),run:()=>(function(){if((h.getLanguageDetector()||h.getLanguageStorage())&&!p.getAvailableLanguages())throw new Error(n("availableLanguages"));if(!p.getLanguage()&&!p.getInitialOptions().defaultLanguage)throw new Error(n(["defaultLanguage","language"]))}(),p.isRunning()||(p.setRunning(!0),h.run(),b=S()),Promise.resolve(b)),stop(){p.isRunning()&&(h.stop(),p.setRunning(!1))}}));return C}const j=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=y(e.options,n),t),init(t){const n=function(e){const t=k({options:e});function n(e){const n=t.isRunning();n&&t.stop(),e(),t.isDev()&&t.invalidate(),n&&t.run()}t.isDev()&&t.invalidate();const a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmitterActive:t.setEmitterActive,getLanguage:t.getLanguage,getPendingLanguage:t.getPendingLanguage,changeLanguage:t.changeLanguage,changeTranslation:t.changeTranslation,addActiveNs:t.addActiveNs,removeActiveNs:t.removeActiveNs,loadRecords:t.loadRecords,loadRecord:t.loadRecord,addStaticData:t.addStaticData,getRecord:t.getRecord,getAllRecords:t.getAllRecords,isLoaded:t.isLoaded,isInitialLoading:t.isInitialLoading,isLoading:t.isLoading,isFetching:t.isFetching,isRunning:t.isRunning,run:t.run,stop:t.stop,t:t.t,highlight:t.highlight,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}(y(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},A=0,x=1,T=2;class P extends Error{constructor(e,t,n){let a;a=e===A?"Empty parameter":e===x?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function N(e){return/\s/.test(e)}const R=0,S=1,C=2,D=3,I=4,$=new Set([C,S,R]),_="'",U=new Set(["{","}",_]),F=e=>/[0-9a-zA-Z_]/.test(e);function M(e,t){const[n,a]=function(e){let t=R,n="",a="",o="";const r=[],i=[];let s=0;function l(t){throw new P(t,s,e)}const c=()=>{r.push(n),n=""},u=()=>{""===a&&l(A),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],t){case R:o===_?(n+=o,t=S):"{"===o?(c(),t=D):(n+=o,t=R);break;case S:U.has(o)?(n=n.slice(0,-1)+o,t=C):(n+=o,t=R);break;case C:o===_?t=R:(n+=o,t=C);break;case D:"}"===o?(u(),t=R):N(o)?""!==a&&(u(),t=I):(F(o)||l(x),a+=o,t=D);break;case I:"}"==o?t=R:N(o)?t=I:l(x)}return $.has(t)||l(T),c(),[r,i]}(e),o=[n[0]];for(let r=1;r<n.length;r++){const i=null==t?void 0:t[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(n[r])}return o.join("")}const B="__tolgee_dev_tools",K="data-tolgee-key-only",V="data-tolgee-restricted",z="_tolgee",Y="_tolgee-highlighter";function G(){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 W(e){if(G())throw new Error(`${e}: Can't run on the server`)}function X(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"};function J({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(Y),Object.entries(H).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 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),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 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}function te(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}const ne={capture:!0},ae={capture:!0,passive:!0};function oe({highlightKeys:e,elementStore:t,onClick:n,options:a}){var o,r;let i,s,l=new Set;const c=(null===(o=a.targetElement)||void 0===o?void 0:o.getRootNode())||document,u=(null===(r=a.targetElement)||void 0===r?void 0:r.ownerDocument)||document;function g(){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 d(){const e=s;let n;if(e&&O()){const a=c.elementFromPoint(e.x,e.y);a&&(n=function(e){return E(e,(e=>t.get(e)))}(a))}!function(e){var n;if(i!==e){g();const a=t.get(e);a&&(a.preventClean=!0,null===(n=a.highlight)||void 0===n||n.call(a),i=e)}}(n)}function f(e){var t;O()&&(t=e.target,!Boolean(E(t,(e=>e.id===B))))&&(e.stopPropagation(),e.preventDefault())}function p(e){var t;t={x:e.clientX,y:e.clientY},s=t,d()}function v(){l=new Set,d()}function h(e){const t=e.key;void 0!==t&&l.add(t),d()}function m(e){l.delete(e.key),d()}function b(){var e;const n=t.get(i);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)}function y(e){f(e),O()&&i&&(n(e,i),g())}function E(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?E(e.parentElement,t):void 0}function O(){for(const t of e)if(!l.has(t))return!1;return!0}return Object.freeze({stop(){u.removeEventListener("blur",v,ne),u.removeEventListener("keydown",h,ne),u.removeEventListener("keyup",m,ne),u.removeEventListener("mousemove",p,ae),u.removeEventListener("scroll",b,ae),u.removeEventListener("click",y,ne),u.removeEventListener("mouseenter",f,ne),u.removeEventListener("mouseover",f,ne),u.removeEventListener("mouseout",f,ne),u.removeEventListener("mouseleave",f,ne),u.removeEventListener("mousedown",f,ne),u.removeEventListener("mouseup",f,ne)},run(){u.addEventListener("blur",v,ne),u.addEventListener("keydown",h,ne),u.addEventListener("keyup",m,ne),u.addEventListener("mousemove",p,ae),u.addEventListener("scroll",b,ae),u.addEventListener("click",y,ne),u.addEventListener("mouseenter",f,ne),u.addEventListener("mouseover",f,ne),u.addEventListener("mouseout",f,ne),u.addEventListener("mouseleave",f,ne),u.addEventListener("mousedown",f,ne),u.addEventListener("mouseup",f,ne)}})}function re(e,t,n){const o=J({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),r=oe({highlightKeys:e.highlightKeys,elementStore:t,onClick(e,a){const o=t.get(a);n({event:e,keysAndDefaults:l(o)})},options:e});function i(e){e.nodes=new Map(function*(e){for(const[t,n]of e.nodes.entries())ee(s(),t)&&(yield[t,n])}(e))}function s(){return e.targetElement||document.body}function l(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({register(n,a,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(a,r),o.initHighlighter(i,s)},forEachElement:t.forEachElement,refreshAll(){t.forEachElement(((e,n)=>{n.preventClean||(i(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))}))},findAll(e,n){const o=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>te({key:e,ns:a(n)},{key:t.key,ns:a(t.ns)})))){o.push(r);break}}})),o},run(e){e&&r.run()},stop(){r.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t))}))}})}function ie(){let e,t=!1;const n=function(){const e=new Map;return Object.freeze({set(t,n){e.set(t,n)},get:t=>t&&e.get(t),remove:t=>e.delete(t),forEachElement(t){e.forEach(((e,n)=>t(n,e)))}})}();function o({mouseHighlight:e,options:a,wrapper:o,onClick:r}){if(G())return{stop(){t=!1},wrapper:o};const i=function(e){const t=Object.freeze({getSuitableParent(n){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===a)throw console.error(n),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const t=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(t))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?t.getSuitableParent(a):a}});return t}(a),s=function(e,t){const n=Object.freeze({handleAttributes(n){let a=[];for(const[o,r]of Object.entries(e.tagAttributes))for(const e of r){const r=q(t.getAttributeXPath({tag:o,attribute:e}),n);a=[...a,...r]}return a},handleChildList(e){let t=[];return t=t.concat(n.handleAttributes(e)),t=t.concat(n.handleText(e)),t},handleText:e=>q(t.getTextXPath(),e)});return n}(a,o),l=re(a,n,r);function c(e){for(const t of e){const e=Z(t),n=e?o.unwrap(e):null;if(n){const{text:a,keys:o}=n;Q(t,a);const r=X(e,o),s=i.getSuitableParent(t);l.register(s,t,r)}}}function u(e){q(`./descendant-or-self::*[@${K}]`,e).forEach((e=>{const t=e.getAttributeNode(K),n=i.getSuitableParent(t);l.register(n,t,{oldTextContent:"",keys:[{key:Z(t)}],keyAttributeOnly:!0})}))}const 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":u(t.target),e=s.handleChildList(t.target);break;case"attributes":u(t.target),e=s.handleAttributes(t.target)}c(e)}l.refreshAll()}})),d=a.targetElement||document.body;return t=!0,l.run(e),u(d),c(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=o(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null===(a=null===(n=null==e?void 0:e.elementRegistry)||void 0===n?void 0:n.forEachElement)||void 0===a||a.call(n,t)},highlight(t,n){var a;const o=(null===(a=null==e?void 0:e.elementRegistry)||void 0===a?void 0:a.findAll(t,n))||[];return o.forEach((e=>{var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight(){o.forEach((e=>{var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}},findPositions(t,n){var o;const r=(null===(o=null==e?void 0:e.elementRegistry)||void 0===o?void 0:o.findAll(t,n))||[],i=[];return r.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),r.forEach((e=>{const o=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{te({key:t,ns:a(n)},{key:e.key,ns:a(e.ns)})&&i.push({position:{x:o.x,y:o.y,width:o.width,height:o.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),i},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}const se=["",""],le=RegExp(`([${se.join("")}]{9})+`,"gu");function ce(e){const t=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),n=t.map((e=>function(e){const t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0")).join("");return Array.from(n).map((e=>se[Number(e)])).join("")}function ue(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}function ge({fullKeyEncode:e}){const t=function(){const e=[];return Object.freeze({valueToNumber(t){let n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:t=>e[t]})}();function n(e){const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null===(t=e.match(le))||void 0===t?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(ue))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[n]=function(e){const t=[];for(const n of e)t.push(n.codePointAt(0));return t}(e);return t.numberToValue(n)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:t,n:a}=o;n.push({key:e,defaultValue:t,ns:a})}}));const o=function(e){return e.replace(le,"")}(e);return{text:o,keys:n}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=ce(n({key:a,ns:i}))}else{const e=n({key:a,ns:i,defaultValue:o}),r=t.valueToNumber(e);s=ce(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},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}function fe({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:o,ns:r}=function(e){let t=!1,n="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==o||","!==s?"KEY"!==o||"|"!==s?"NAMESPACE"!==o||","!==s?"KEY"!==o||":"!==s?"DEFAULT_VALUE"!==o||":"!==s?"PARAM_NAME"!==o||":"!==s?"PARAM_VALUE"!==o||","!==s?n+=s:(o="PARAM_NAME",r.params[a]=n,n=""):(o="PARAM_VALUE",a=n,n=""):(o="PARAM_NAME",r.defaultValue=n,n=""):(o="PARAM_NAME",r.key=n,n=""):(o="DEFAULT_VALUE",i(n),n=""):(o="NAMESPACE",r.key=n,n=""):(o="DEFAULT_VALUE",r.key=n,n=""):t=!0;return"KEY"===o&&(r.key=n),"DEFAULT_VALUE"===o&&(r.defaultValue=n),"PARAM_VALUE"===o&&(r.params[a]=n),"NAMESPACE"===o&&i(n),r}(e);return{translated:n({key:t,params:a,defaultValue:o,ns:r,noWrap:!0}),key:t,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:n,params:a,defaultValue:o,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${r(e)}:${r(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(n)}${u}${l}${s}${t}`},unwrap(n){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(n));){let e=s[1];const[t,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!de(d,n)){u+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=n.substring(c),l?{text:u,keys:i}:{text:n,keys:[]}},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}')]`})}const pe="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function ve(e){const t=pe.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function he(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|ve(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 me(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=he(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}function be({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 ye="tolgee-in-context-tools.umd.min.js",Ee="@tolgee/in-context-tools",Oe="InContextTools",Le="https://cdn.jsdelivr.net/npm";let we=null;function ke(e){var t;return we||(we=(t=`${Le}/@tolgee/web@${e}/dist/${ye}`,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[Ee][Oe]))),we}const je="__tolgee_apiKey",Ae="__tolgee_apiUrl";function xe(){const e=sessionStorage.getItem(je)||void 0,t=sessionStorage.getItem(Ae)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Te(){sessionStorage.removeItem(je),sessionStorage.removeItem(Ae)}exports.BrowserExtensionPlugin=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(exports.BrowserExtensionPlugin=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=be({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 xe()&&(async()=>{const e=await ke("5.13.2");return t=>{const n=xe();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";function Ne(e){return e.endsWith("/")?e.slice(0,-1):e}const Re={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Ne(n)}/${e}/${t}.json`:`${Ne(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};function Se(e){const t=Object.assign(Object.assign(Object.assign({},Re),e),{headers:Object.assign(Object.assign({},Re.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,fetch:s})=>s(a({namespace:e,language:t,prefix:n}),Object.assign({headers:r},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return o(e)}))}}exports.BackendFetch=e=>(t,n)=>(n.addBackend(Se(e)),t),exports.DEVTOOLS_ID=B,exports.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:o,fetch:r}){var i;const s=null!==(i=me(t))&&void 0!==i?i:o;let l=void 0!==s?`${e}/v2/projects/${s}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(l+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(l,{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})=>M(e,t)}),e),exports.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){W("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),exports.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(W("LanguageStorage"),localStorage.getItem(Pe)||void 0),setLanguage(e){W("LanguageStorage"),localStorage.setItem(Pe,e)}}),e),exports.ObserverPlugin=()=>(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({fullKeyEncode:t.options.fullKeyEncode});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=z,exports.TOLGEE_RESTRICT_ATTRIBUTE=V,exports.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=K,exports.Tolgee=function(){return j().use(exports.BrowserExtensionPlugin())},exports.TolgeeCore=j,exports.createFetchFunction=c,exports.getFallback=a,exports.getFallbackArray=o,exports.getProjectIdFromApiKey=me,exports.getTranslateProps=w; | ||
"use strict";function e(e){return Boolean(e&&"function"==typeof e.then)}function t(t,n){return e(t)?Promise.resolve(t).then(n):n(t)}function n(e){const t=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),n=t.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...t.slice(0,-2),n].join(", ")} option`}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function o(e){return a(e)||[]}function r(e,t){return"object"!=typeof(n=t)||Array.isArray(n)||null===n?o(t):o(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}Object.defineProperty(exports,"__esModule",{value:!0});const l=(e,t)=>fetch(e,t),c=(e=l)=>(t,n)=>e(t,Object.assign(Object.assign({},n),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.13.3-prerelease.5f76277d.0"},null==n?void 0:n.headers)}));function 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})))}})}function g(e,t,n){const a=new Set,r=new Set;let i=[];function 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)))}));!function(e){const n=new Set(t());r.forEach((t=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>n.has(e)||t.namespaces.has(e)))))&&t.fn({value:void 0})}))}(n?Array.from(n.keys()):void 0)}return Object.freeze({emit(t,n){e()&&(i.push(t),n?setTimeout(s,0):s())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const t={fn:t=>{e(t)},namespaces:new Set};r.add(t);const a={unsubscribe:()=>{r.delete(t)},subscribeNs:e=>(o(e).forEach((e=>t.namespaces.add(e))),void 0===e&&t.namespaces.add(n()),a)};return a}})}const d=e=>{const t=new Map;return Object.entries(e).forEach((([e,n])=>{null!=n&&("object"!=typeof n?t.set(e,n):d(n).forEach(((n,a)=>{t.set(e+"."+a,n)})))})),t},f=e=>{const[t,...n]=e.split(":");return{language:t,namespace:n.join(":")||""}},p=({language:e,namespace:t})=>t?`${e}:${t}`:e;function v(e,t,n,a,r,s,l){const c=new Map,u=new Map;let g={},v=0;function h(t,n,a){const o=p(t);u.set(o,{data:d(n),version:a}),e.emit(t)}function m(e){let n;if(!n){const t=g[p(e)];"function"==typeof t&&(n=t())}return n||(n=t(e)),n}const b=Object.freeze({addStaticData(e){e&&(g=Object.assign(Object.assign({},g),e),Object.entries(e).forEach((([e,t])=>{if("function"!=typeof t){const n=f(e),a=u.get(e);a&&0!==a.version||h(n,t,0)}})))},invalidate(){c.clear(),v+=1},addRecord(e,t){h(e,t,v)},exists(e,t=!1){const n=u.get(p(e));return n&&t?n.version===v:Boolean(n)},getRecord(e){var t;return null===(t=u.get(p(a(e))))||void 0===t?void 0:t.data},getTranslation(e,t){var n;return null===(n=u.get(p(e)))||void 0===n?void 0:n.data.get(t)},getTranslationNs(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=u.get(p({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return[o]}return i(e)},getTranslationFallback(e,t,n){var a;for(const o of e)for(const e of t){const t=null===(a=u.get(p({language:e,namespace:o})))||void 0===a?void 0:a.data.get(n);if(null!=t)return t}},changeTranslation(t,n,a){var o;const r=null===(o=u.get(p(t)))||void 0===o?void 0:o.data;null==r||r.set(n,a),e.emit(Object.assign(Object.assign({},t),{key:n}))},isFetching(e){if(r())return!0;if(void 0===e)return c.size>0;const t=o(e);return Boolean(Array.from(c.keys()).find((e=>t.includes(f(e).namespace))))},isLoading(e,t){const n=o(t);return Boolean(r()||Array.from(c.keys()).find((t=>{const a=f(t);return(!n.length||n.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,t){const o=e.map((e=>{const o=a(e),r=p(o),i=c.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"),m(e))))),o||(o=m(e)),o}(o,t)||Promise.resolve(void 0);return c.set(r,s),{new:!0,promise:s,keyObject:o,cacheKey:r}}));s.notify(),l.notify();const r=await Promise.all(o.map((e=>e.promise)));return o.forEach(((e,t)=>{const n=c.get(e.cacheKey)!==e.promise;if(e.new&&!n){c.delete(e.cacheKey);const n=r[t];n?b.addRecord(e.keyObject,n):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),s.notify(),l.notify(),o.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(u.entries()).map((([e,t])=>Object.assign(Object.assign({},f(e)),{data:t.data})))});return b}function h(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 m="invalid",b={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:m,apiUrl:"https://app.tolgee.io",fetch:c(),onTranslationMissing:({key:e})=>e},y=(...e)=>{let t={};return e.forEach((e=>{t=Object.assign(Object.assign(Object.assign({},t),e),{observerOptions:Object.assign(Object.assign({},t.observerOptions),null==e?void 0:e.observerOptions)})})),t};function E(e,t){const n=y(b,null==t?void 0:t.initialOptions,e);return n.apiUrl=s(n.apiUrl),(null==e?void 0:e.fetch)&&(n.fetch=c(e.fetch)),{initialOptions:n,activeNamespaces:(null==t?void 0:t.activeNamespaces)||new Map,language:null==t?void 0:t.language,pendingLanguage:null==t?void 0:t.language,isInitialLoading:!1,isRunning:!1}}function O(n,a,o,r,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,event:t})=>{var n;const a=e.map((({key:e,ns:t,defaultValue:n})=>({key:e,defaultValue:n,fallbackNamespaces:r(t),namespace:i({key:e,ns:t})[0],translation:s({key:e,ns:t})})));null===(n=g.ui)||void 0===n||n.handleElementClick(a,t)},f=(e,t)=>{var n;return(null===(n=g.observer)||void 0===n?void 0:n.findPositions(e,t))||[]};function p(e){const t=s({key:e.key,ns:e.ns});return T.formatTranslation(Object.assign(Object.assign({},e),{translation:t,formatEnabled:!0}))}function v(){return{fetch:a().fetch}}function b(e){g.observer=null==e?void 0:e()}function y(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function O(e){g.finalFormatter=e}function L(e){u.ui=e}function w(){return Boolean(u.ui)}function k(e){g.languageStorage=e}function j(e){g.languageDetector=e}function A(e){e&&g.backends.push(e)}function x(e){g.devBackend=e}const T=Object.freeze({addPlugin:function(e,t){t(e,Object.freeze({setFinalFormatter:O,addFormatter:E,setObserver:b,hasObserver:y,setUi:L,hasUi:w,setDevBackend:x,addBackend:A,setLanguageDetector:j,setLanguageStorage:k}))},run(){var e,t;const{apiKey:n,apiUrl:o,projectId:r,observerOptions:i}=a();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:n,apiUrl:o,projectId:r,highlight:T.highlight,changeTranslation:l,findPositions:f,onPermanentChange:c}),null===(t=g.observer)||void 0===t||t.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){var e;const n=o();return t(null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(v()),(e=>n&&!n.includes(e)||!e?function(){if(!g.languageDetector)return;const e=o();return g.languageDetector.getLanguage(Object.assign({availableLanguages:e},v()))}():e))},setStoredLanguage(e){var t;null===(t=g.languageStorage)||void 0===t||t.setLanguage(e,v())},getDevBackend:()=>g.devBackend,getBackendRecord:({language:t,namespace:n})=>{for(const a of g.backends){const o=a.getRecord(Object.assign({language:t,namespace:n},v()));if(e(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=g.devBackend)||void 0===n?void 0:n.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:t},v()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,t)=>{var n,a;return(null===(a=null===(n=g.observer)||void 0===n?void 0:n.highlight)||void 0===a?void 0:a.call(n,e,t))||{unhighlight(){}}},unwrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.unwrap(e):{text:e,keys:[]}},wrap(e){var t;return g.observer?null===(t=g.observer)||void 0===t?void 0:t.wrap(e):e.translation},hasDevBackend:()=>Boolean(T.getDevBackend()),formatTranslation(e){var t,{formatEnabled:o}=e,r=h(e,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let v="";null==s&&(v=a().onTranslationMissing(r));let b=null!=p?p:f?"":v;const y=n(),E=o||!(null===(t=g.observer)||void 0===t?void 0:t.outputNotFormattable),O=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;b=O(b);try{if(p&&y&&E)for(const e of g.formatters)b=e.format({translation:b,language:y,params:u});g.finalFormatter&&p&&y&&E&&(b=g.finalFormatter.format({translation:b,language:y,params:u}))}catch(e){console.error(e);const t=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||m,n=a().onFormatError,o=typeof n;b="string"===o?n:"function"===o?n(t,r):m,b=O(b)}var L;return b}});return T}const L=(e,t,n)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=t();a!==e&&n(e),a=e}})};const w=(e,...t)=>{let n,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof t[0]?(a.defaultValue=t[0],n=t[1]):"object"==typeof t[0]&&(n=t[0])),n&&(a=Object.assign(Object.assign({},function(e){var{ns:t,noWrap:n,orEmpty:a,params:o,language:r}=e,i=h(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:t,noWrap:n,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(n)),a)),a};function k({options:a}){const l=function(e,t){let n=!0;function a(){return n}const o=Object.freeze({onPendingLanguageChange:u(a),onLanguageChange:u(a),onLoadingChange:u(a),onFetchingChange:u(a),onInitialLoaded:u(a),onRunningChange:u(a),onCacheChange:u(a),onUpdate:g(a,e,t),onPermanentChange:u(a),setEmitterActive(e){n=e},on:(e,t)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(t);case"language":return o.onLanguageChange.listen(t);case"loading":return o.onLoadingChange.listen(t);case"fetching":return o.onFetchingChange.listen(t);case"initialLoad":return o.onInitialLoaded.listen(t);case"running":return o.onRunningChange.listen(t);case"cache":return o.onCacheChange.listen(t);case"update":return o.onUpdate.listen(t);case"permanentChange":return o.onPermanentChange.listen(t)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(y,k),c=L(!1,(()=>m.isFetching()),l.onFetchingChange.emit),d=L(!1,(()=>C.isLoading()),l.onLoadingChange.emit),p=function(e,t,n){let a,l=E();const c=Object.freeze({init(e){l=E(e,l)},isRunning:()=>l.isRunning,setRunning(e){l.isRunning!==e&&(l.isRunning=e,n.emit(e))},isInitialLoading:()=>l.isInitialLoading,setInitialLoading(e){l.isInitialLoading=e},getLanguage:()=>l.language||l.initialOptions.language,setLanguage(t){l.language!==t&&(l.language=t,e.emit(t))},getPendingLanguage:()=>l.pendingLanguage||c.getLanguage(),setPendingLanguage(e){l.pendingLanguage!==e&&(l.pendingLanguage=e,t.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},l.initialOptions),a),addActiveNs(e){o(e).forEach((e=>{const t=l.activeNamespaces.get(e);void 0!==t?l.activeNamespaces.set(e,t+1):l.activeNamespaces.set(e,1)}))},removeActiveNs(e){o(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:()=>i([...l.initialOptions.ns||[l.initialOptions.defaultNs],...o(l.initialOptions.fallbackNs),...l.activeNamespaces.keys()]),getFallbackLangs(e){const t=e||c.getLanguage();return t?i([t,...r(t,l.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>o(l.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?l.initialOptions.defaultNs:e,getAvailableLanguages(){if(l.initialOptions.availableLanguages)return l.initialOptions.availableLanguages;if(l.initialOptions.staticData){const e=Object.keys(l.initialOptions.staticData).map((e=>f(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:s(e.apiUrl)}):void 0}});return c}(l.onLanguageChange,l.onPendingLanguageChange,l.onRunningChange),h=O(p.getLanguage,p.getInitialOptions,p.getAvailableLanguages,j,N,R,x,(function(e){l.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=v(l.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,p.withDefaultNs,p.isInitialLoading,c,d);let b;function y(){return p.getFallbackNs()}function k(e){return p.getDefaultNs(e)}function j(e){return[...o(k(e)),...y()]}function A(e){return[...o(null!=e?e:k()),...p.getRequiredNamespaces()]}function x(e,t,n){const a=p.withDefaultNs(e),o=m.getTranslation(a,t);return m.changeTranslation(a,t,n),{revert(){m.changeTranslation(a,t,o)}}}function T(e){p.init(e),m.addStaticData(p.getInitialOptions().staticData)}function P(e,n){const a=function(e,t){const n=p.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,n);if(a.length)return t(C.loadRecords(a),(()=>{}))}function N({key:e,ns:t}){const n=p.getFallbackLangs(),a=j(null!=t?t:void 0);return m.getTranslationNs(a,n,e)}function R({key:e,ns:t,language:n}){const a=j(null!=t?t:void 0),o=p.getFallbackLangs(n);return m.getTranslationFallback(a,o,e)}function S(){const n=t(function(){if(p.getLanguage())return;return t(h.getInitialLanguage(),(e=>{const t=e||p.getInitialOptions().defaultLanguage;t&&p.setLanguage(t)}))}(),(()=>P()));if(e(n))return p.setInitialLoading(!0),c.notify(),d.notify(),Promise.resolve(n).then((()=>{p.setInitialLoading(!1),c.notify(),d.notify(),l.onInitialLoaded.emit()}));l.onInitialLoaded.emit()}a&&T(a),l.onUpdate.listen((()=>{p.isRunning()&&h.retranslate()}));const C=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),p),h),m),{init:T,getTranslation:R,changeTranslation:x,getTranslationNs:N,getDefaultAndFallbackNs:j,async changeLanguage(e){p.getPendingLanguage()===e&&p.getLanguage()===e||(p.setPendingLanguage(e),p.isRunning()&&await P(e),e===p.getPendingLanguage()&&(p.setLanguage(e),h.setStoredLanguage(e)))},async addActiveNs(e,t){t||p.addActiveNs(e),p.isRunning()&&await P(void 0,e)},loadRecords:e=>m.loadRecords(e,C.isDev()),loadRecord:async e=>(await C.loadRecords([e]))[0],isLoading:e=>m.isLoading(p.getLanguage(),e),isLoaded(e){const t=p.getLanguage();if(!t)return!1;const n=p.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=w(...e),n=R(t);return h.formatTranslation(Object.assign(Object.assign({},t),{translation:n}))},isDev:()=>Boolean(p.getInitialOptions().apiKey&&p.getInitialOptions().apiUrl),run:()=>(function(){if((h.getLanguageDetector()||h.getLanguageStorage())&&!p.getAvailableLanguages())throw new Error(n("availableLanguages"));if(!p.getLanguage()&&!p.getInitialOptions().defaultLanguage)throw new Error(n(["defaultLanguage","language"]))}(),p.isRunning()||(p.setRunning(!0),h.run(),b=S()),Promise.resolve(b)),stop(){p.isRunning()&&(h.stop(),p.setRunning(!1))}}));return C}const j=()=>{const e={plugins:[],options:{}},t=Object.freeze({use:n=>(e.plugins.push(n),t),updateDefaults:n=>(e.options=y(e.options,n),t),init(t){const n=function(e){const t=k({options:e});function n(e){const n=t.isRunning();n&&t.stop(),e(),t.isDev()&&t.invalidate(),n&&t.run()}t.isDev()&&t.invalidate();const a=Object.freeze({on:t.on,onNsUpdate:t.onUpdate.listenSome,setEmitterActive:t.setEmitterActive,getLanguage:t.getLanguage,getPendingLanguage:t.getPendingLanguage,changeLanguage:t.changeLanguage,changeTranslation:t.changeTranslation,addActiveNs:t.addActiveNs,removeActiveNs:t.removeActiveNs,loadRecords:t.loadRecords,loadRecord:t.loadRecord,addStaticData:t.addStaticData,getRecord:t.getRecord,getAllRecords:t.getAllRecords,isLoaded:t.isLoaded,isInitialLoading:t.isInitialLoading,isLoading:t.isLoading,isFetching:t.isFetching,isRunning:t.isRunning,run:t.run,stop:t.stop,t:t.t,highlight:t.highlight,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}(y(e.options,t));return e.plugins.forEach(n.addPlugin),n}});return t},A=0,x=1,T=2;class P extends Error{constructor(e,t,n){let a;a=e===A?"Empty parameter":e===x?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${t} in "${n}"`),this.code=e,this.index=t}}function N(e){return/\s/.test(e)}const R=0,S=1,C=2,D=3,I=4,$=new Set([C,S,R]),_="'",U=new Set(["{","}",_]),F=e=>/[0-9a-zA-Z_]/.test(e);function M(e,t){const[n,a]=function(e){let t=R,n="",a="",o="";const r=[],i=[];let s=0;function l(t){throw new P(t,s,e)}const c=()=>{r.push(n),n=""},u=()=>{""===a&&l(A),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],t){case R:o===_?(n+=o,t=S):"{"===o?(c(),t=D):(n+=o,t=R);break;case S:U.has(o)?(n=n.slice(0,-1)+o,t=C):(n+=o,t=R);break;case C:o===_?t=R:(n+=o,t=C);break;case D:"}"===o?(u(),t=R):N(o)?""!==a&&(u(),t=I):(F(o)||l(x),a+=o,t=D);break;case I:"}"==o?t=R:N(o)?t=I:l(x)}return $.has(t)||l(T),c(),[r,i]}(e),o=[n[0]];for(let r=1;r<n.length;r++){const i=null==t?void 0:t[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(n[r])}return o.join("")}const B="__tolgee_dev_tools",K="data-tolgee-key-only",V="data-tolgee-restricted",z="_tolgee",Y="_tolgee-highlighter";function G(){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 W(e){if(G())throw new Error(`${e}: Can't run on the server`)}function X(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"};function J({highlightColor:e,highlightWidth:t}){return Object.freeze({initHighlighter(n,a){!function(n,a){a.highlight=()=>{if(!n.isConnected)return;let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(Y),Object.entries(H).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 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),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 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}function te(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}const ne={capture:!0},ae={capture:!0,passive:!0};function oe({highlightKeys:e,elementStore:t,onClick:n,options:a}){var o,r;let i,s,l=new Set;const c=(null===(o=a.targetElement)||void 0===o?void 0:o.getRootNode())||document,u=(null===(r=a.targetElement)||void 0===r?void 0:r.ownerDocument)||document;function g(){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 d(){const e=s;let n;if(e&&O()){const a=c.elementFromPoint(e.x,e.y);a&&(n=function(e){return E(e,(e=>t.get(e)))}(a))}!function(e){var n;if(i!==e){g();const a=t.get(e);a&&(a.preventClean=!0,null===(n=a.highlight)||void 0===n||n.call(a),i=e)}}(n)}function f(e){var t;O()&&(t=e.target,!Boolean(E(t,(e=>e.id===B))))&&(e.stopPropagation(),e.preventDefault())}function p(e){var t;t={x:e.clientX,y:e.clientY},s=t,d()}function v(){l=new Set,d()}function h(e){const t=e.key;void 0!==t&&l.add(t),d()}function m(e){l.delete(e.key),d()}function b(){var e;const n=t.get(i);null===(e=null==n?void 0:n.highlight)||void 0===e||e.call(n)}function y(e){f(e),O()&&i&&(n(e,i),g())}function E(e,t){return t(e)?e:(null==e?void 0:e.parentElement)?E(e.parentElement,t):void 0}function O(){for(const t of e)if(!l.has(t))return!1;return!0}return Object.freeze({stop(){u.removeEventListener("blur",v,ne),u.removeEventListener("keydown",h,ne),u.removeEventListener("keyup",m,ne),u.removeEventListener("mousemove",p,ae),u.removeEventListener("scroll",b,ae),u.removeEventListener("click",y,ne),u.removeEventListener("mouseenter",f,ne),u.removeEventListener("mouseover",f,ne),u.removeEventListener("mouseout",f,ne),u.removeEventListener("mouseleave",f,ne),u.removeEventListener("mousedown",f,ne),u.removeEventListener("mouseup",f,ne)},run(){u.addEventListener("blur",v,ne),u.addEventListener("keydown",h,ne),u.addEventListener("keyup",m,ne),u.addEventListener("mousemove",p,ae),u.addEventListener("scroll",b,ae),u.addEventListener("click",y,ne),u.addEventListener("mouseenter",f,ne),u.addEventListener("mouseover",f,ne),u.addEventListener("mouseout",f,ne),u.addEventListener("mouseleave",f,ne),u.addEventListener("mousedown",f,ne),u.addEventListener("mouseup",f,ne)}})}function re(e,t,n){const o=J({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),r=oe({highlightKeys:e.highlightKeys,elementStore:t,onClick(e,a){const o=t.get(a);n({event:e,keysAndDefaults:l(o)})},options:e});function i(e){e.nodes=new Map(function*(e){for(const[t,n]of e.nodes.entries())ee(s(),t)&&(yield[t,n])}(e))}function s(){return e.targetElement||document.body}function l(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,t)=>[...e,...t.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({register(n,a,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(a,r),o.initHighlighter(i,s)},forEachElement:t.forEachElement,refreshAll(){t.forEachElement(((e,n)=>{n.preventClean||(i(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))}))},findAll(e,n){const o=[];return t.forEachElement(((t,r)=>{for(const t of r.nodes.values()){if(t.keys.find((t=>te({key:e,ns:a(n)},{key:t.key,ns:a(t.ns)})))){o.push(r);break}}})),o},run(e){e&&r.run()},stop(){r.stop(),t.forEachElement(((e,t)=>{var n;t.highlightEl&&(null===(n=t.unhighlight)||void 0===n||n.call(t))}))}})}function ie(){let e,t=!1;const n=function(){const e=new Map;return Object.freeze({set(t,n){e.set(t,n)},get:t=>t&&e.get(t),remove:t=>e.delete(t),forEachElement(t){e.forEach(((e,n)=>t(n,e)))}})}();function o({mouseHighlight:e,options:a,wrapper:o,onClick:r}){if(G())return{stop(){t=!1},wrapper:o};const i=function(e){const t=Object.freeze({getSuitableParent(n){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(n);if(void 0===a)throw console.error(n),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const t=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(t))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?t.getSuitableParent(a):a}});return t}(a),s=function(e,t){const n=Object.freeze({handleAttributes(n){let a=[];for(const[o,r]of Object.entries(e.tagAttributes))for(const e of r){const r=q(t.getAttributeXPath({tag:o,attribute:e}),n);a=[...a,...r]}return a},handleChildList(e){let t=[];return t=t.concat(n.handleAttributes(e)),t=t.concat(n.handleText(e)),t},handleText:e=>q(t.getTextXPath(),e)});return n}(a,o),l=re(a,n,r);function c(e){for(const t of e){const e=Z(t),n=e?o.unwrap(e):null;if(n){const{text:a,keys:o}=n;Q(t,a);const r=X(e,o),s=i.getSuitableParent(t);l.register(s,t,r)}}}function u(e){q(`./descendant-or-self::*[@${K}]`,e).forEach((e=>{const t=e.getAttributeNode(K),n=i.getSuitableParent(t);l.register(n,t,{oldTextContent:"",keys:[{key:Z(t)}],keyAttributeOnly:!0})}))}const 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":u(t.target),e=s.handleChildList(t.target);break;case"attributes":u(t.target),e=s.handleAttributes(t.target)}c(e)}l.refreshAll()}})),d=a.targetElement||document.body;return t=!0,l.run(e),u(d),c(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=o(t)},stop(){null==e||e.stop()},forEachElement(t){var n,a;null===(a=null===(n=null==e?void 0:e.elementRegistry)||void 0===n?void 0:n.forEachElement)||void 0===a||a.call(n,t)},highlight(t,n){var a;const o=(null===(a=null==e?void 0:e.elementRegistry)||void 0===a?void 0:a.findAll(t,n))||[];return o.forEach((e=>{var t;return null===(t=e.highlight)||void 0===t?void 0:t.call(e)})),{unhighlight(){o.forEach((e=>{var t;return null===(t=e.unhighlight)||void 0===t?void 0:t.call(e)}))}}},findPositions(t,n){var o;const r=(null===(o=null==e?void 0:e.elementRegistry)||void 0===o?void 0:o.findAll(t,n))||[],i=[];return r.sort(((e,t)=>e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),r.forEach((e=>{const o=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{te({key:t,ns:a(n)},{key:e.key,ns:a(e.ns)})&&i.push({position:{x:o.x,y:o.y,width:o.width,height:o.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),i},unwrap:t=>e?e.wrapper.unwrap(t):{text:t,keys:[]},wrap:t=>e?e.wrapper.wrap(t):t.translation||""})}const se=["",""],le=RegExp(`([${se.join("")}]{9})+`,"gu");function ce(e){const t=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),n=t.map((e=>function(e){const t=8-e.length;return"0".repeat(t)+e}(e.toString(2))+"0")).join("");return Array.from(n).map((e=>se[Number(e)])).join("")}function ue(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}function ge({fullKeyEncode:e}){const t=function(){const e=[];return Object.freeze({valueToNumber(t){let n=e.indexOf(t);return-1===n&&(n=e.length,e.push(t)),n},numberToValue:t=>e[t]})}();function n(e){const t={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(t)}return Object.freeze({unwrap(e){const n=[],a=function(e){var t;const n=null===(t=e.match(le))||void 0===t?void 0:t.filter((e=>e.length>8));return(null==n?void 0:n.map(ue))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[n]=function(e){const t=[];for(const n of e)t.push(n.codePointAt(0));return t}(e);return t.numberToValue(n)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:t,n:a}=o;n.push({key:e,defaultValue:t,ns:a})}}));const o=function(e){return e.replace(le,"")}(e);return{text:o,keys:n}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=ce(n({key:a,ns:i}))}else{const e=n({key:a,ns:i,defaultValue:o}),r=t.valueToNumber(e);s=ce(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},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}function fe({inputPrefix:e,inputSuffix:t,translate:n}){function a(e){const{key:t,params:a,defaultValue:o,ns:r}=function(e){let t=!1,n="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||t?t?(t=!1,n+=s):"KEY"!==o||","!==s?"KEY"!==o||"|"!==s?"NAMESPACE"!==o||","!==s?"KEY"!==o||":"!==s?"DEFAULT_VALUE"!==o||":"!==s?"PARAM_NAME"!==o||":"!==s?"PARAM_VALUE"!==o||","!==s?n+=s:(o="PARAM_NAME",r.params[a]=n,n=""):(o="PARAM_VALUE",a=n,n=""):(o="PARAM_NAME",r.defaultValue=n,n=""):(o="PARAM_NAME",r.key=n,n=""):(o="DEFAULT_VALUE",i(n),n=""):(o="NAMESPACE",r.key=n,n=""):(o="DEFAULT_VALUE",r.key=n,n=""):t=!0;return"KEY"===o&&(r.key=n),"DEFAULT_VALUE"===o&&(r.defaultValue=n),"PARAM_VALUE"===o&&(r.params[a]=n),"NAMESPACE"===o&&i(n),r}(e);return{translated:n({key:t,params:a,defaultValue:o,ns:r,noWrap:!0}),key:t,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:n,params:a,defaultValue:o,ns:i}){let s=Object.entries(a||{}).map((([e,t])=>`${r(e)}:${r(t)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(n)}${u}${l}${s}${t}`},unwrap(n){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(t)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(n));){let e=s[1];const[t,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+t.length,"\\"===e){if(!de(d,n)){u+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=n.substring(c),l?{text:u,keys:i}:{text:n,keys:[]}},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}')]`})}const pe="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function ve(e){const t=pe.indexOf(e);if(-1===t)throw new Error("Invalid character found: "+e);return t}function he(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|ve(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 me(e){if(e)try{const[t,n]=e.split("_");if("tgpak"===t){const[e]=he(n).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}function be({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 ye="tolgee-in-context-tools.umd.min.js",Ee="@tolgee/in-context-tools",Oe="InContextTools",Le="https://cdn.jsdelivr.net/npm";let we=null;function ke(e){var t;return we||(we=(t=`${Le}/@tolgee/web@${e}/dist/${ye}`,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[Ee][Oe]))),we}const je="__tolgee_apiKey",Ae="__tolgee_apiUrl";function xe(){const e=sessionStorage.getItem(je)||void 0,t=sessionStorage.getItem(Ae)||void 0;if(e&&t)return{apiKey:e,apiUrl:t}}function Te(){sessionStorage.removeItem(je),sessionStorage.removeItem(Ae)}exports.BrowserExtensionPlugin=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(exports.BrowserExtensionPlugin=()=>e=>{const t=function(){let e;return{update:async function(t){null==e||e();const{cancel:n,promise:a}=be({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 xe()&&(async()=>{const e=await ke("5.13.3-prerelease.5f76277d.0");return t=>{const n=xe();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";function Ne(e){return e.endsWith("/")?e.slice(0,-1):e}const Re={prefix:"/i18n",getPath:({namespace:e,language:t,prefix:n})=>e?`${Ne(n)}/${e}/${t}.json`:`${Ne(n)}/${t}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};function Se(e){const t=Object.assign(Object.assign(Object.assign({},Re),e),{headers:Object.assign(Object.assign({},Re.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,fetch:s})=>s(a({namespace:e,language:t,prefix:n}),Object.assign({headers:r},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return o(e)}))}}exports.BackendFetch=e=>(t,n)=>(n.addBackend(Se(e)),t),exports.DEVTOOLS_ID=B,exports.DevBackend=()=>(e,t)=>(t.setDevBackend({getRecord({apiUrl:e,apiKey:t,language:n,namespace:a,projectId:o,fetch:r}){var i;const s=null!==(i=me(t))&&void 0!==i?i:o;let l=void 0!==s?`${e}/v2/projects/${s}/translations/${n}`:`${e}/v2/projects/translations/${n}`;if(a&&(l+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[t]=e.split("_");return"tgpak"===t?"tgpak":"tgpat"===t?"tgpat":"legacy"}(t)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(l,{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})=>M(e,t)}),e),exports.LanguageDetector=()=>(e,t)=>(t.setLanguageDetector({getLanguage({availableLanguages:e}){W("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),exports.LanguageStorage=()=>(e,t)=>(t.setLanguageStorage({getLanguage:()=>(W("LanguageStorage"),localStorage.getItem(Pe)||void 0),setLanguage(e){W("LanguageStorage"),localStorage.setItem(Pe,e)}}),e),exports.ObserverPlugin=()=>(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({fullKeyEncode:t.options.fullKeyEncode});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=z,exports.TOLGEE_RESTRICT_ATTRIBUTE=V,exports.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=K,exports.Tolgee=function(){return j().use(exports.BrowserExtensionPlugin())},exports.TolgeeCore=j,exports.createFetchFunction=c,exports.getFallback=a,exports.getFallbackArray=o,exports.getProjectIdFromApiKey=me,exports.getTranslateProps=w; | ||
//# sourceMappingURL=tolgee-web.production.cjs.min.js.map |
@@ -1,2 +0,2 @@ | ||
function e(e){return Boolean(e&&"function"==typeof e.then)}function n(n,t){return e(n)?Promise.resolve(n).then(t):t(n)}function t(e){const n=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),t=n.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...n.slice(0,-2),t].join(", ")} option`}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function o(e){return a(e)||[]}function r(e,n){return"object"!=typeof(t=n)||Array.isArray(t)||null===t?o(n):o(null==n?void 0:n[e]);var t}function i(e){return Array.from(new Set(e))}function s(e){return e?e.replace(/\/+$/,""):e}const l=(e,n)=>fetch(e,n),c=(e=l)=>(n,t)=>e(n,Object.assign(Object.assign({},t),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.13.2"},null==t?void 0:t.headers)}));function u(e){let n=[];return Object.freeze({listen(e){const t=n=>{e(n)};return n.push(t),{unsubscribe(){n=n.filter((e=>t!==e))}}},emit(t){e()&&n.forEach((e=>e({value:t})))}})}function g(e,n,t){const a=new Set,r=new Set;let i=[];function s(){if(0===i.length)return;const e=i;i=[],a.forEach((e=>{e({value:void 0})}));let t=new Set;e.forEach((e=>{void 0===e?t=void 0:void 0!==t&&e.forEach((e=>t.add(e)))}));!function(e){const t=new Set(n());r.forEach((n=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>t.has(e)||n.namespaces.has(e)))))&&n.fn({value:void 0})}))}(t?Array.from(t.keys()):void 0)}return Object.freeze({emit(n,t){e()&&(i.push(n),t?setTimeout(s,0):s())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const n={fn:n=>{e(n)},namespaces:new Set};r.add(n);const a={unsubscribe:()=>{r.delete(n)},subscribeNs:e=>(o(e).forEach((e=>n.namespaces.add(e))),void 0===e&&n.namespaces.add(t()),a)};return a}})}const d=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):d(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},f=e=>{const[n,...t]=e.split(":");return{language:n,namespace:t.join(":")||""}},p=({language:e,namespace:n})=>n?`${e}:${n}`:e;function v(e,n,t,a,r,s,l){const c=new Map,u=new Map;let g={},v=0;function h(n,t,a){const o=p(n);u.set(o,{data:d(t),version:a}),e.emit(n)}function m(e){let t;if(!t){const n=g[p(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t}const b=Object.freeze({addStaticData(e){e&&(g=Object.assign(Object.assign({},g),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=f(e),a=u.get(e);a&&0!==a.version||h(t,n,0)}})))},invalidate(){c.clear(),v+=1},addRecord(e,n){h(e,n,v)},exists(e,n=!1){const t=u.get(p(e));return t&&n?t.version===v:Boolean(t)},getRecord(e){var n;return null===(n=u.get(p(a(e))))||void 0===n?void 0:n.data},getTranslation(e,n){var t;return null===(t=u.get(p(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs(e,n,t){var a;for(const o of e)for(const e of n){const n=null===(a=u.get(p({language:e,namespace:o})))||void 0===a?void 0:a.data.get(t);if(null!=n)return[o]}return i(e)},getTranslationFallback(e,n,t){var a;for(const o of e)for(const e of n){const n=null===(a=u.get(p({language:e,namespace:o})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation(n,t,a){var o;const r=null===(o=u.get(p(n)))||void 0===o?void 0:o.data;null==r||r.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching(e){if(r())return!0;if(void 0===e)return c.size>0;const n=o(e);return Boolean(Array.from(c.keys()).find((e=>n.includes(f(e).namespace))))},isLoading(e,n){const t=o(n);return Boolean(r()||Array.from(c.keys()).find((n=>{const a=f(n);return(!t.length||t.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,n){const o=e.map((e=>{const o=a(e),r=p(o),i=c.get(r);if(i)return{new:!1,promise:i,keyObject:o,cacheKey:r};const s=function(e,n){var a;let o;return n&&(o=null===(a=t(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),o||(o=m(e)),o}(o,n)||Promise.resolve(void 0);return c.set(r,s),{new:!0,promise:s,keyObject:o,cacheKey:r}}));s.notify(),l.notify();const r=await Promise.all(o.map((e=>e.promise)));return o.forEach(((e,n)=>{const t=c.get(e.cacheKey)!==e.promise;if(e.new&&!t){c.delete(e.cacheKey);const t=r[n];t?b.addRecord(e.keyObject,t):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),s.notify(),l.notify(),o.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(u.entries()).map((([e,n])=>Object.assign(Object.assign({},f(e)),{data:n.data})))});return b}function h(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}const m="invalid",b={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:m,apiUrl:"https://app.tolgee.io",fetch:c(),onTranslationMissing:({key:e})=>e},y=(...e)=>{let n={};return e.forEach((e=>{n=Object.assign(Object.assign(Object.assign({},n),e),{observerOptions:Object.assign(Object.assign({},n.observerOptions),null==e?void 0:e.observerOptions)})})),n};function E(e,n){const t=y(b,null==n?void 0:n.initialOptions,e);return t.apiUrl=s(t.apiUrl),(null==e?void 0:e.fetch)&&(t.fetch=c(e.fetch)),{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}}function O(t,a,o,r,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,event:n})=>{var t;const a=e.map((({key:e,ns:n,defaultValue:t})=>({key:e,defaultValue:t,fallbackNamespaces:r(n),namespace:i({key:e,ns:n})[0],translation:s({key:e,ns:n})})));null===(t=g.ui)||void 0===t||t.handleElementClick(a,n)},f=(e,n)=>{var t;return(null===(t=g.observer)||void 0===t?void 0:t.findPositions(e,n))||[]};function p(e){const n=s({key:e.key,ns:e.ns});return N.formatTranslation(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))}function v(){return{fetch:a().fetch}}function b(e){g.observer=null==e?void 0:e()}function y(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function O(e){g.finalFormatter=e}function L(e){u.ui=e}function w(){return Boolean(u.ui)}function k(e){g.languageStorage=e}function j(e){g.languageDetector=e}function A(e){e&&g.backends.push(e)}function P(e){g.devBackend=e}const N=Object.freeze({addPlugin:function(e,n){n(e,Object.freeze({setFinalFormatter:O,addFormatter:E,setObserver:b,hasObserver:y,setUi:L,hasUi:w,setDevBackend:P,addBackend:A,setLanguageDetector:j,setLanguageStorage:k}))},run(){var e,n;const{apiKey:t,apiUrl:o,projectId:r,observerOptions:i}=a();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:t,apiUrl:o,projectId:r,highlight:N.highlight,changeTranslation:l,findPositions:f,onPermanentChange:c}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){var e;const t=o();return n(null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(v()),(e=>t&&!t.includes(e)||!e?function(){if(!g.languageDetector)return;const e=o();return g.languageDetector.getLanguage(Object.assign({availableLanguages:e},v()))}():e))},setStoredLanguage(e){var n;null===(n=g.languageStorage)||void 0===n||n.setLanguage(e,v())},getDevBackend:()=>g.devBackend,getBackendRecord:({language:n,namespace:t})=>{for(const a of g.backends){const o=a.getRecord(Object.assign({language:n,namespace:t},v()));if(e(o))return null==o?void 0:o.catch((e=>(console.error(e),{})));if(void 0!==o)return o}},getBackendDevRecord:({language:e,namespace:n})=>{var t;const{apiKey:o,apiUrl:r,projectId:i}=a();return null===(t=g.devBackend)||void 0===t?void 0:t.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},v()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,n)=>{var t,a;return(null===(a=null===(t=g.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},unwrap(e){var n;return g.observer?null===(n=g.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}},wrap(e){var n;return g.observer?null===(n=g.observer)||void 0===n?void 0:n.wrap(e):e.translation},hasDevBackend:()=>Boolean(N.getDevBackend()),formatTranslation(e){var n,{formatEnabled:o}=e,r=h(e,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let v="";null==s&&(v=a().onTranslationMissing(r));let b=null!=p?p:f?"":v;const y=t(),E=o||!(null===(n=g.observer)||void 0===n?void 0:n.outputNotFormattable),O=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;b=O(b);try{if(p&&y&&E)for(const e of g.formatters)b=e.format({translation:b,language:y,params:u});g.finalFormatter&&p&&y&&E&&(b=g.finalFormatter.format({translation:b,language:y,params:u}))}catch(e){console.error(e);const n=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||m,t=a().onFormatError,o=typeof t;b="string"===o?t:"function"===o?t(n,r):m,b=O(b)}var L;return b}});return N}const L=(e,n,t)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=n();a!==e&&t(e),a=e}})};const w=(e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},function(e){var{ns:n,noWrap:t,orEmpty:a,params:o,language:r}=e,i=h(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:n,noWrap:t,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(t)),a)),a};function k({options:a}){const l=function(e,n){let t=!0;function a(){return t}const o=Object.freeze({onPendingLanguageChange:u(a),onLanguageChange:u(a),onLoadingChange:u(a),onFetchingChange:u(a),onInitialLoaded:u(a),onRunningChange:u(a),onCacheChange:u(a),onUpdate:g(a,e,n),onPermanentChange:u(a),setEmitterActive(e){t=e},on:(e,n)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(n);case"language":return o.onLanguageChange.listen(n);case"loading":return o.onLoadingChange.listen(n);case"fetching":return o.onFetchingChange.listen(n);case"initialLoad":return o.onInitialLoaded.listen(n);case"running":return o.onRunningChange.listen(n);case"cache":return o.onCacheChange.listen(n);case"update":return o.onUpdate.listen(n);case"permanentChange":return o.onPermanentChange.listen(n)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(y,k),c=L(!1,(()=>m.isFetching()),l.onFetchingChange.emit),d=L(!1,(()=>R.isLoading()),l.onLoadingChange.emit),p=function(e,n,t){let a,l=E();const c=Object.freeze({init(e){l=E(e,l)},isRunning:()=>l.isRunning,setRunning(e){l.isRunning!==e&&(l.isRunning=e,t.emit(e))},isInitialLoading:()=>l.isInitialLoading,setInitialLoading(e){l.isInitialLoading=e},getLanguage:()=>l.language||l.initialOptions.language,setLanguage(n){l.language!==n&&(l.language=n,e.emit(n))},getPendingLanguage:()=>l.pendingLanguage||c.getLanguage(),setPendingLanguage(e){l.pendingLanguage!==e&&(l.pendingLanguage=e,n.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},l.initialOptions),a),addActiveNs(e){o(e).forEach((e=>{const n=l.activeNamespaces.get(e);void 0!==n?l.activeNamespaces.set(e,n+1):l.activeNamespaces.set(e,1)}))},removeActiveNs(e){o(e).forEach((e=>{const n=l.activeNamespaces.get(e);void 0!==n&&n>1?l.activeNamespaces.set(e,n-1):l.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>i([...l.initialOptions.ns||[l.initialOptions.defaultNs],...o(l.initialOptions.fallbackNs),...l.activeNamespaces.keys()]),getFallbackLangs(e){const n=e||c.getLanguage();return n?i([n,...r(n,l.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>o(l.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?l.initialOptions.defaultNs:e,getAvailableLanguages(){if(l.initialOptions.availableLanguages)return l.initialOptions.availableLanguages;if(l.initialOptions.staticData){const e=Object.keys(l.initialOptions.staticData).map((e=>f(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:s(e.apiUrl)}):void 0}});return c}(l.onLanguageChange,l.onPendingLanguageChange,l.onRunningChange),h=O(p.getLanguage,p.getInitialOptions,p.getAvailableLanguages,j,T,C,P,(function(e){l.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=v(l.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,p.withDefaultNs,p.isInitialLoading,c,d);let b;function y(){return p.getFallbackNs()}function k(e){return p.getDefaultNs(e)}function j(e){return[...o(k(e)),...y()]}function A(e){return[...o(null!=e?e:k()),...p.getRequiredNamespaces()]}function P(e,n,t){const a=p.withDefaultNs(e),o=m.getTranslation(a,n);return m.changeTranslation(a,n,t),{revert(){m.changeTranslation(a,n,o)}}}function N(e){p.init(e),m.addStaticData(p.getInitialOptions().staticData)}function x(e,t){const a=function(e,n){const t=p.getFallbackLangs(e),a=A(n),o=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n},!0)||o.push({language:e,namespace:n})}))})),o}(e,t);if(a.length)return n(R.loadRecords(a),(()=>{}))}function T({key:e,ns:n}){const t=p.getFallbackLangs(),a=j(null!=n?n:void 0);return m.getTranslationNs(a,t,e)}function C({key:e,ns:n,language:t}){const a=j(null!=n?n:void 0),o=p.getFallbackLangs(t);return m.getTranslationFallback(a,o,e)}function S(){const t=n(function(){if(p.getLanguage())return;return n(h.getInitialLanguage(),(e=>{const n=e||p.getInitialOptions().defaultLanguage;n&&p.setLanguage(n)}))}(),(()=>x()));if(e(t))return p.setInitialLoading(!0),c.notify(),d.notify(),Promise.resolve(t).then((()=>{p.setInitialLoading(!1),c.notify(),d.notify(),l.onInitialLoaded.emit()}));l.onInitialLoaded.emit()}a&&N(a),l.onUpdate.listen((()=>{p.isRunning()&&h.retranslate()}));const R=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),p),h),m),{init:N,getTranslation:C,changeTranslation:P,getTranslationNs:T,getDefaultAndFallbackNs:j,async changeLanguage(e){p.getPendingLanguage()===e&&p.getLanguage()===e||(p.setPendingLanguage(e),p.isRunning()&&await x(e),e===p.getPendingLanguage()&&(p.setLanguage(e),h.setStoredLanguage(e)))},async addActiveNs(e,n){n||p.addActiveNs(e),p.isRunning()&&await x(void 0,e)},loadRecords:e=>m.loadRecords(e,R.isDev()),loadRecord:async e=>(await R.loadRecords([e]))[0],isLoading:e=>m.isLoading(p.getLanguage(),e),isLoaded(e){const n=p.getLanguage();if(!n)return!1;const t=p.getFallbackLangs(n),a=A(e),o=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n})||o.push({language:e,namespace:n})}))})),0===o.length},t:(...e)=>{const n=w(...e),t=C(n);return h.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:()=>Boolean(p.getInitialOptions().apiKey&&p.getInitialOptions().apiUrl),run:()=>(function(){if((h.getLanguageDetector()||h.getLanguageStorage())&&!p.getAvailableLanguages())throw new Error(t("availableLanguages"));if(!p.getLanguage()&&!p.getInitialOptions().defaultLanguage)throw new Error(t(["defaultLanguage","language"]))}(),p.isRunning()||(p.setRunning(!0),h.run(),b=S()),Promise.resolve(b)),stop(){p.isRunning()&&(h.stop(),p.setRunning(!1))}}));return R}const j=()=>{const e={plugins:[],options:{}},n=Object.freeze({use:t=>(e.plugins.push(t),n),updateDefaults:t=>(e.options=y(e.options,t),n),init(n){const t=function(e){const n=k({options:e});function t(e){const t=n.isRunning();t&&n.stop(),e(),n.isDev()&&n.invalidate(),t&&n.run()}n.isDev()&&n.invalidate();const a=Object.freeze({on:n.on,onNsUpdate:n.onUpdate.listenSome,setEmitterActive:n.setEmitterActive,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,overrideCredentials(e){t((()=>n.overrideCredentials(e)))},addPlugin(e){e&&t((()=>n.addPlugin(a,e)))},updateOptions(e){e&&t((()=>n.init(e)))}});return a}(y(e.options,n));return e.plugins.forEach(t.addPlugin),t}});return n},A=0,P=1,N=2;class x extends Error{constructor(e,n,t){let a;a=e===A?"Empty parameter":e===P?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${n} in "${t}"`),this.code=e,this.index=n}}function T(e){return/\s/.test(e)}const C=0,S=1,R=2,D=3,$=4,I=new Set([R,S,C]),U="'",_=new Set(["{","}",U]),F=e=>/[0-9a-zA-Z_]/.test(e);function M(e,n){const[t,a]=function(e){let n=C,t="",a="",o="";const r=[],i=[];let s=0;function l(n){throw new x(n,s,e)}const c=()=>{r.push(t),t=""},u=()=>{""===a&&l(A),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],n){case C:o===U?(t+=o,n=S):"{"===o?(c(),n=D):(t+=o,n=C);break;case S:_.has(o)?(t=t.slice(0,-1)+o,n=R):(t+=o,n=C);break;case R:o===U?n=C:(t+=o,n=R);break;case D:"}"===o?(u(),n=C):T(o)?""!==a&&(u(),n=$):(F(o)||l(P),a+=o,n=D);break;case $:"}"==o?n=C:T(o)?n=$:l(P)}return I.has(n)||l(N),c(),[r,i]}(e),o=[t[0]];for(let r=1;r<t.length;r++){const i=null==n?void 0:n[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(t[r])}return o.join("")}const V=()=>(e,n)=>(n.setFinalFormatter({format:({translation:e,params:n})=>M(e,n)}),e),K="__tolgee_dev_tools",z="__tolgee_preferredLanguages",B="data-tolgee-key-only",X="data-tolgee-restricted",W="_tolgee",Y="_tolgee-highlighter";function G(){var e,n;return void 0===(null===(n=null===(e=globalThis.window)||void 0===e?void 0:e.document)||void 0===n?void 0:n.createElement)}function H(e){if(G())throw new Error(`${e}: Can't run on the server`)}function J(e,n){return{oldTextContent:e,keys:n}}const q={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function Z({highlightColor:e,highlightWidth:n}){return Object.freeze({initHighlighter(t,a){!function(t,a){a.highlight=()=>{if(!t.isConnected)return;let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(Y),Object.entries(q).forEach((([e,n])=>{o.style[e]=n})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const r=t.getBoundingClientRect();o.style.borderWidth=n+"px",o.style.top=r.top-n+"px",o.style.left=r.left-n+"px",o.style.width=r.width+"px",o.style.height=r.height+"px"}}(t,a),function(e,n){n.unhighlight=()=>{var e;null===(e=n.highlightEl)||void 0===e||e.remove(),n.highlightEl=void 0}}(0,a)}})}function Q(e,n){var t;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}}(n),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===(t=null==r?void 0:r.iterateNext)||void 0===t?void 0:t.call(r);)o.push(i);return o}function ee(e){return e.textContent}function ne(e,n){e.textContent=n}function te(e,n){if(e.contains(n))return!0;if(n instanceof Attr){const t=n.ownerElement&&Object.values(n.ownerElement.attributes).indexOf(n)>-1;if(e.contains(n.ownerElement)&&t)return!0}return!1}function ae(e,n){var t;const a=void 0===e.key||void 0===n.key||n.key===e.key,o=void 0===e.ns||void 0===n.ns||-1!==(null===(t=e.ns)||void 0===t?void 0:t.findIndex((e=>{var t;return null===(t=n.ns)||void 0===t?void 0:t.includes(e)})));return a&&o}const oe={capture:!0},re={capture:!0,passive:!0};function ie({highlightKeys:e,elementStore:n,onClick:t,options:a}){var o,r;let i,s,l=new Set;const c=(null===(o=a.targetElement)||void 0===o?void 0:o.getRootNode())||document,u=(null===(r=a.targetElement)||void 0===r?void 0:r.ownerDocument)||document;function g(){var e;const t=n.get(i);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),i=void 0)}function d(){const e=s;let t;if(e&&O()){const a=c.elementFromPoint(e.x,e.y);a&&(t=function(e){return E(e,(e=>n.get(e)))}(a))}!function(e){var t;if(i!==e){g();const a=n.get(e);a&&(a.preventClean=!0,null===(t=a.highlight)||void 0===t||t.call(a),i=e)}}(t)}function f(e){var n;O()&&(n=e.target,!Boolean(E(n,(e=>e.id===K))))&&(e.stopPropagation(),e.preventDefault())}function p(e){var n;n={x:e.clientX,y:e.clientY},s=n,d()}function v(){l=new Set,d()}function h(e){const n=e.key;void 0!==n&&l.add(n),d()}function m(e){l.delete(e.key),d()}function b(){var e;const t=n.get(i);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)}function y(e){f(e),O()&&i&&(t(e,i),g())}function E(e,n){return n(e)?e:(null==e?void 0:e.parentElement)?E(e.parentElement,n):void 0}function O(){for(const n of e)if(!l.has(n))return!1;return!0}return Object.freeze({stop(){u.removeEventListener("blur",v,oe),u.removeEventListener("keydown",h,oe),u.removeEventListener("keyup",m,oe),u.removeEventListener("mousemove",p,re),u.removeEventListener("scroll",b,re),u.removeEventListener("click",y,oe),u.removeEventListener("mouseenter",f,oe),u.removeEventListener("mouseover",f,oe),u.removeEventListener("mouseout",f,oe),u.removeEventListener("mouseleave",f,oe),u.removeEventListener("mousedown",f,oe),u.removeEventListener("mouseup",f,oe)},run(){u.addEventListener("blur",v,oe),u.addEventListener("keydown",h,oe),u.addEventListener("keyup",m,oe),u.addEventListener("mousemove",p,re),u.addEventListener("scroll",b,re),u.addEventListener("click",y,oe),u.addEventListener("mouseenter",f,oe),u.addEventListener("mouseover",f,oe),u.addEventListener("mouseout",f,oe),u.addEventListener("mouseleave",f,oe),u.addEventListener("mousedown",f,oe),u.addEventListener("mouseup",f,oe)}})}function se(e,n,t){const o=Z({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),r=ie({highlightKeys:e.highlightKeys,elementStore:n,onClick(e,a){const o=n.get(a);t({event:e,keysAndDefaults:l(o)})},options:e});function i(e){e.nodes=new Map(function*(e){for(const[n,t]of e.nodes.entries())te(s(),n)&&(yield[n,t])}(e))}function s(){return e.targetElement||document.body}function l(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,n)=>[...e,...n.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({register(t,a,r){if(function(n){return-1!==e.restrictedElements.indexOf(n.tagName.toLowerCase())||null!==n.closest(`[${X}]`)}(t))return;const i=t;let s=n.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),n.set(i,s),i.setAttribute(W,"true")),s.nodes.set(a,r),o.initHighlighter(i,s)},forEachElement:n.forEachElement,refreshAll(){n.forEachElement(((e,t)=>{t.preventClean||(i(t),0===t.nodes.size&&function(e,t){var a;t.highlightEl&&(null===(a=t.unhighlight)||void 0===a||a.call(t)),e.removeAttribute(W),n.remove(e)}(e,t))}))},findAll(e,t){const o=[];return n.forEachElement(((n,r)=>{for(const n of r.nodes.values()){if(n.keys.find((n=>ae({key:e,ns:a(t)},{key:n.key,ns:a(n.ns)})))){o.push(r);break}}})),o},run(e){e&&r.run()},stop(){r.stop(),n.forEachElement(((e,n)=>{var t;n.highlightEl&&(null===(t=n.unhighlight)||void 0===t||t.call(n))}))}})}function le(){let e,n=!1;const t=function(){const e=new Map;return Object.freeze({set(n,t){e.set(n,t)},get:n=>n&&e.get(n),remove:n=>e.delete(n),forEachElement(n){e.forEach(((e,t)=>n(t,e)))}})}();function o({mouseHighlight:e,options:a,wrapper:o,onClick:r}){if(G())return{stop(){n=!1},wrapper:o};const i=function(e){const n=Object.freeze({getSuitableParent(t){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(t);if(void 0===a)throw console.error(t),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const n=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(n))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?n.getSuitableParent(a):a}});return n}(a),s=function(e,n){const t=Object.freeze({handleAttributes(t){let a=[];for(const[o,r]of Object.entries(e.tagAttributes))for(const e of r){const r=Q(n.getAttributeXPath({tag:o,attribute:e}),t);a=[...a,...r]}return a},handleChildList(e){let n=[];return n=n.concat(t.handleAttributes(e)),n=n.concat(t.handleText(e)),n},handleText:e=>Q(n.getTextXPath(),e)});return t}(a,o),l=se(a,t,r);function c(e){for(const n of e){const e=ee(n),t=e?o.unwrap(e):null;if(t){const{text:a,keys:o}=t;ne(n,a);const r=J(e,o),s=i.getSuitableParent(n);l.register(s,n,r)}}}function u(e){Q(`./descendant-or-self::*[@${B}]`,e).forEach((e=>{const n=e.getAttributeNode(B),t=i.getSuitableParent(n);l.register(t,n,{oldTextContent:"",keys:[{key:ee(n)}],keyAttributeOnly:!0})}))}const g=new MutationObserver((e=>{if(n){for(const n of e){let e=[];switch(n.type){case"characterData":e=s.handleText(n.target);break;case"childList":u(n.target),e=s.handleChildList(n.target);break;case"attributes":u(n.target),e=s.handleAttributes(n.target)}c(e)}l.refreshAll()}})),d=a.targetElement||document.body;return n=!0,l.run(e),u(d),c(s.handleChildList(d)),g.observe(d,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){n=!1,l.stop(),g.disconnect()},elementRegistry:l,wrapper:o}}return Object.freeze({run(n){e=o(n)},stop(){null==e||e.stop()},forEachElement(n){var t,a;null===(a=null===(t=null==e?void 0:e.elementRegistry)||void 0===t?void 0:t.forEachElement)||void 0===a||a.call(t,n)},highlight(n,t){var a;const o=(null===(a=null==e?void 0:e.elementRegistry)||void 0===a?void 0:a.findAll(n,t))||[];return o.forEach((e=>{var n;return null===(n=e.highlight)||void 0===n?void 0:n.call(e)})),{unhighlight(){o.forEach((e=>{var n;return null===(n=e.unhighlight)||void 0===n?void 0:n.call(e)}))}}},findPositions(n,t){var o;const r=(null===(o=null==e?void 0:e.elementRegistry)||void 0===o?void 0:o.findAll(n,t))||[],i=[];return r.sort(((e,n)=>e.element.compareDocumentPosition(n.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),r.forEach((e=>{const o=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{ae({key:n,ns:a(t)},{key:e.key,ns:a(e.ns)})&&i.push({position:{x:o.x,y:o.y,width:o.width,height:o.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),i},unwrap:n=>e?e.wrapper.unwrap(n):{text:n,keys:[]},wrap:n=>e?e.wrapper.wrap(n):n.translation||""})}const ce=["",""],ue=RegExp(`([${ce.join("")}]{9})+`,"gu");function ge(e){const n=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),t=n.map((e=>function(e){const n=8-e.length;return"0".repeat(n)+e}(e.toString(2))+"0")).join("");return Array.from(t).map((e=>ce[Number(e)])).join("")}function de(e){const n=Array.from(e).map((e=>ce.indexOf(e))).map(String).join("").match(/(.{9})/g),t=Uint8Array.from((null==n?void 0:n.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=t,(new TextDecoder).decode(new Uint8Array(a));var a}function fe({fullKeyEncode:e}){const n=function(){const e=[];return Object.freeze({valueToNumber(n){let t=e.indexOf(n);return-1===t&&(t=e.length,e.push(n)),t},numberToValue:n=>e[n]})}();function t(e){const n={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(n)}return Object.freeze({unwrap(e){const t=[],a=function(e){var n;const t=null===(n=e.match(ue))||void 0===n?void 0:n.filter((e=>e.length>8));return(null==t?void 0:t.map(de))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[t]=function(e){const n=[];for(const t of e)n.push(t.codePointAt(0));return n}(e);return n.numberToValue(t)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:n,n:a}=o;t.push({key:e,defaultValue:n,ns:a})}}));const o=function(e){return e.replace(ue,"")}(e);return{text:o,keys:t}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=ge(t({key:a,ns:i}))}else{const e=t({key:a,ns:i,defaultValue:o}),r=n.valueToNumber(e);s=ge(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${ce[0]}${ce[0]}') or contains(., '${ce[1]}${ce[0]}')]`,getAttributeXPath:({tag:e,attribute:n})=>`descendant-or-self::${e}/@${n}[contains(., '${ce[0]}${ce[0]}') or contains(., '${ce[1]}${ce[0]}')]`})}function pe(e,n){let t=0;for(;e>-1&&"\\"===n[e-1];)t++,e--;return t%2==1}function ve({inputPrefix:e,inputSuffix:n,translate:t}){function a(e){const{key:n,params:a,defaultValue:o,ns:r}=function(e){let n=!1,t="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||n?n?(n=!1,t+=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?t+=s:(o="PARAM_NAME",r.params[a]=t,t=""):(o="PARAM_VALUE",a=t,t=""):(o="PARAM_NAME",r.defaultValue=t,t=""):(o="PARAM_NAME",r.key=t,t=""):(o="DEFAULT_VALUE",i(t),t=""):(o="NAMESPACE",r.key=t,t=""):(o="DEFAULT_VALUE",r.key=t,t=""):n=!0;return"KEY"===o&&(r.key=t),"DEFAULT_VALUE"===o&&(r.defaultValue=t),"PARAM_VALUE"===o&&(r.params[a]=t),"NAMESPACE"===o&&i(t),r}(e);return{translated:t({key:n,params:a,defaultValue:o,ns:r,noWrap:!0}),key:n,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:t,params:a,defaultValue:o,ns:i}){let s=Object.entries(a||{}).map((([e,n])=>`${r(e)}:${r(n)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(t)}${u}${l}${s}${n}`},unwrap(t){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(n)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(t));){let e=s[1];const[n,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+n.length,"\\"===e){if(!pe(d,t)){u+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=t.substring(c),l?{text:u,keys:i}:{text:t,keys:[]}},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${e}') and contains(., '${n}')]`,getAttributeXPath:({tag:t,attribute:a})=>`descendant-or-self::${t}/@${a}[contains(., '${e}') and contains(., '${n}')]`})}const he=()=>(e,n)=>("text"===e.getInitialOptions().observerType?n.setObserver((()=>{const e=le();return Object.freeze(Object.assign(Object.assign({},e),{run(n){const t=ve({inputPrefix:n.options.inputPrefix,inputSuffix:n.options.inputSuffix,translate:n.translate});e.run(Object.assign(Object.assign({},n),{wrapper:t}))},retranslate(){e.forEachElement(((n,t)=>{for(const[n,a]of t.nodes.entries()){if(a.keyAttributeOnly)return;const t=e.unwrap(a.oldTextContent);t&&ne(n,t.text)}}))},outputNotFormattable:!0}))})):n.setObserver((()=>{const e=le();return Object.freeze(Object.assign(Object.assign({},e),{run(n){const t=fe({fullKeyEncode:n.options.fullKeyEncode});e.run(Object.assign(Object.assign({},n),{wrapper:t}))},retranslate(){},outputNotFormattable:!1}))})),e),me="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function be(e){const n=me.indexOf(e);if(-1===n)throw new Error("Invalid character found: "+e);return n}function ye(e){const n=(e=e.toUpperCase()).length;let t=0,a=0,o=0;const r=new Uint8Array(5*n/8|0);for(let i=0;i<n;i++)a=a<<5|be(e[i]),t+=5,t>=8&&(r[o++]=a>>>t-8&255,t-=8);return function(e){const n=new Uint8Array(e),t=n.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<t;e+=o)e+o>t&&(o=t-e),a+=String.fromCharCode.apply(null,n.subarray(e,e+o));return a}(r.buffer)}function Ee(e){if(e)try{const[n,t]=e.split("_");if("tgpak"===n){const[e]=ye(t).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}const Oe=()=>(e,n)=>(n.setDevBackend({getRecord({apiUrl:e,apiKey:n,language:t,namespace:a,projectId:o,fetch:r}){var i;const s=null!==(i=Ee(n))&&void 0!==i?i:o;let l=void 0!==s?`${e}/v2/projects/${s}/translations/${t}`:`${e}/v2/projects/translations/${t}`;if(a&&(l+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[n]=e.split("_");return"tgpak"===n?"tgpak":"tgpat"===n?"tgpat":"legacy"}(n)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(l,{headers:{"X-API-Key":n||"","Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>e[t]));throw new Error(e.statusText)}))}}),e);function Le({message:e,recievingMessage:n,data:t,attempts:a=1}){let o=!1;const r=()=>new Promise(((a,o)=>{const r=function(e,n){const t=t=>{var a,o;e.includes(null===(a=t.data)||void 0===a?void 0:a.type)&&n(null===(o=t.data)||void 0===o?void 0:o.data)};return window.addEventListener("message",t,!1),{unsubscribe(){window.removeEventListener("message",t)}}}(n,(function(e){clearTimeout(i),s(),a(e)}));window.postMessage({type:e,data:t},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 ${n.join(" or ")} in time.`;return new Promise((()=>{}))})()}}const we="tolgee-in-context-tools.umd.min.js",ke="@tolgee/in-context-tools",je="InContextTools",Ae="https://cdn.jsdelivr.net/npm";let Pe=null;function Ne(e){var n;return Pe||(Pe=(n=`${Ae}/@tolgee/web@${e}/dist/${we}`,new Promise(((e,t)=>{const a=document.createElement("script");a.src=n,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>t(e.error))),document.body.appendChild(a)}))).then((()=>window[ke][je]))),Pe}const xe="__tolgee_apiKey",Te="__tolgee_apiUrl";function Ce(){const e=sessionStorage.getItem(xe)||void 0,n=sessionStorage.getItem(Te)||void 0;if(e&&n)return{apiKey:e,apiUrl:n}}function Se(){sessionStorage.removeItem(xe),sessionStorage.removeItem(Te)}let Re=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(Re=()=>e=>{const n=function(){let e;return{update:async function(n){null==e||e();const{cancel:t,promise:a}=Le({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:n,attempts:4});return e=t,a}}}();e.on("running",(({value:t})=>{var a;t&&(a=()=>{n.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(Se)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ce()&&(async()=>{const e=await Ne("5.13.2");return n=>{const t=Ce();return n.addPlugin(e({credentials:t})),n}})().then((n=>{e.addPlugin(n)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const De="__tolgee_currentLanguage";const $e=()=>(e,n)=>(n.setLanguageStorage({getLanguage:()=>(H("LanguageStorage"),localStorage.getItem(De)||void 0),setLanguage(e){H("LanguageStorage"),localStorage.setItem(De,e)}}),e);const Ie=()=>(e,n)=>(n.setLanguageDetector({getLanguage({availableLanguages:e}){H("LanguageDetector");const n=window.navigator.language,t=e.find((e=>e===n));if(t)return t;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e);function Ue(e){return e.endsWith("/")?e.slice(0,-1):e}const _e={prefix:"/i18n",getPath:({namespace:e,language:n,prefix:t})=>e?`${Ue(t)}/${e}/${n}.json`:`${Ue(t)}/${n}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};function Fe(e){const n=Object.assign(Object.assign(Object.assign({},_e),e),{headers:Object.assign(Object.assign({},_e.headers),null==e?void 0:e.headers)}),{prefix:t,getPath:a,getData:o,headers:r}=n,i=function(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}(n,["prefix","getPath","getData","headers"]);return{getRecord:({namespace:e,language:n,fetch:s})=>s(a({namespace:e,language:n,prefix:t}),Object.assign({headers:r},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return o(e)}))}}const Me=e=>(n,t)=>(t.addBackend(Fe(e)),n);function Ve(){return j().use(Re())}const Ke=()=>e=>e;export{Me as BackendFetch,Re as BrowserExtensionPlugin,K as DEVTOOLS_ID,Oe as DevBackend,Ke as DevTools,V as FormatSimple,Ie as LanguageDetector,$e as LanguageStorage,he as ObserverPlugin,z as PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY,W as TOLGEE_ATTRIBUTE_NAME,X as TOLGEE_RESTRICT_ATTRIBUTE,B as TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE,Ve as Tolgee,j as TolgeeCore,c as createFetchFunction,a as getFallback,o as getFallbackArray,Ee as getProjectIdFromApiKey,w as getTranslateProps}; | ||
function e(e){return Boolean(e&&"function"==typeof e.then)}function n(n,t){return e(n)?Promise.resolve(n).then(t):t(n)}function t(e){const n=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),t=n.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...n.slice(0,-2),t].join(", ")} option`}function a(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function o(e){return a(e)||[]}function r(e,n){return"object"!=typeof(t=n)||Array.isArray(t)||null===t?o(n):o(null==n?void 0:n[e]);var t}function i(e){return Array.from(new Set(e))}function s(e){return e?e.replace(/\/+$/,""):e}const l=(e,n)=>fetch(e,n),c=(e=l)=>(n,t)=>e(n,Object.assign(Object.assign({},t),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.13.3-prerelease.5f76277d.0"},null==t?void 0:t.headers)}));function u(e){let n=[];return Object.freeze({listen(e){const t=n=>{e(n)};return n.push(t),{unsubscribe(){n=n.filter((e=>t!==e))}}},emit(t){e()&&n.forEach((e=>e({value:t})))}})}function g(e,n,t){const a=new Set,r=new Set;let i=[];function s(){if(0===i.length)return;const e=i;i=[],a.forEach((e=>{e({value:void 0})}));let t=new Set;e.forEach((e=>{void 0===e?t=void 0:void 0!==t&&e.forEach((e=>t.add(e)))}));!function(e){const t=new Set(n());r.forEach((n=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>t.has(e)||n.namespaces.has(e)))))&&n.fn({value:void 0})}))}(t?Array.from(t.keys()):void 0)}return Object.freeze({emit(n,t){e()&&(i.push(n),t?setTimeout(s,0):s())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const n={fn:n=>{e(n)},namespaces:new Set};r.add(n);const a={unsubscribe:()=>{r.delete(n)},subscribeNs:e=>(o(e).forEach((e=>n.namespaces.add(e))),void 0===e&&n.namespaces.add(t()),a)};return a}})}const d=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):d(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},f=e=>{const[n,...t]=e.split(":");return{language:n,namespace:t.join(":")||""}},p=({language:e,namespace:n})=>n?`${e}:${n}`:e;function v(e,n,t,a,r,s,l){const c=new Map,u=new Map;let g={},v=0;function h(n,t,a){const o=p(n);u.set(o,{data:d(t),version:a}),e.emit(n)}function m(e){let t;if(!t){const n=g[p(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t}const b=Object.freeze({addStaticData(e){e&&(g=Object.assign(Object.assign({},g),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=f(e),a=u.get(e);a&&0!==a.version||h(t,n,0)}})))},invalidate(){c.clear(),v+=1},addRecord(e,n){h(e,n,v)},exists(e,n=!1){const t=u.get(p(e));return t&&n?t.version===v:Boolean(t)},getRecord(e){var n;return null===(n=u.get(p(a(e))))||void 0===n?void 0:n.data},getTranslation(e,n){var t;return null===(t=u.get(p(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs(e,n,t){var a;for(const o of e)for(const e of n){const n=null===(a=u.get(p({language:e,namespace:o})))||void 0===a?void 0:a.data.get(t);if(null!=n)return[o]}return i(e)},getTranslationFallback(e,n,t){var a;for(const o of e)for(const e of n){const n=null===(a=u.get(p({language:e,namespace:o})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation(n,t,a){var o;const r=null===(o=u.get(p(n)))||void 0===o?void 0:o.data;null==r||r.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching(e){if(r())return!0;if(void 0===e)return c.size>0;const n=o(e);return Boolean(Array.from(c.keys()).find((e=>n.includes(f(e).namespace))))},isLoading(e,n){const t=o(n);return Boolean(r()||Array.from(c.keys()).find((n=>{const a=f(n);return(!t.length||t.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,n){const o=e.map((e=>{const o=a(e),r=p(o),i=c.get(r);if(i)return{new:!1,promise:i,keyObject:o,cacheKey:r};const s=function(e,n){var a;let o;return n&&(o=null===(a=t(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),o||(o=m(e)),o}(o,n)||Promise.resolve(void 0);return c.set(r,s),{new:!0,promise:s,keyObject:o,cacheKey:r}}));s.notify(),l.notify();const r=await Promise.all(o.map((e=>e.promise)));return o.forEach(((e,n)=>{const t=c.get(e.cacheKey)!==e.promise;if(e.new&&!t){c.delete(e.cacheKey);const t=r[n];t?b.addRecord(e.keyObject,t):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),s.notify(),l.notify(),o.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(u.entries()).map((([e,n])=>Object.assign(Object.assign({},f(e)),{data:n.data})))});return b}function h(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}const m="invalid",b={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:m,apiUrl:"https://app.tolgee.io",fetch:c(),onTranslationMissing:({key:e})=>e},y=(...e)=>{let n={};return e.forEach((e=>{n=Object.assign(Object.assign(Object.assign({},n),e),{observerOptions:Object.assign(Object.assign({},n.observerOptions),null==e?void 0:e.observerOptions)})})),n};function E(e,n){const t=y(b,null==n?void 0:n.initialOptions,e);return t.apiUrl=s(t.apiUrl),(null==e?void 0:e.fetch)&&(t.fetch=c(e.fetch)),{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}}function O(t,a,o,r,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,event:n})=>{var t;const a=e.map((({key:e,ns:n,defaultValue:t})=>({key:e,defaultValue:t,fallbackNamespaces:r(n),namespace:i({key:e,ns:n})[0],translation:s({key:e,ns:n})})));null===(t=g.ui)||void 0===t||t.handleElementClick(a,n)},f=(e,n)=>{var t;return(null===(t=g.observer)||void 0===t?void 0:t.findPositions(e,n))||[]};function p(e){const n=s({key:e.key,ns:e.ns});return N.formatTranslation(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))}function v(){return{fetch:a().fetch}}function b(e){g.observer=null==e?void 0:e()}function y(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function O(e){g.finalFormatter=e}function L(e){u.ui=e}function w(){return Boolean(u.ui)}function k(e){g.languageStorage=e}function j(e){g.languageDetector=e}function A(e){e&&g.backends.push(e)}function P(e){g.devBackend=e}const N=Object.freeze({addPlugin:function(e,n){n(e,Object.freeze({setFinalFormatter:O,addFormatter:E,setObserver:b,hasObserver:y,setUi:L,hasUi:w,setDevBackend:P,addBackend:A,setLanguageDetector:j,setLanguageStorage:k}))},run(){var e,n;const{apiKey:t,apiUrl:o,projectId:r,observerOptions:i}=a();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:t,apiUrl:o,projectId:r,highlight:N.highlight,changeTranslation:l,findPositions:f,onPermanentChange:c}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){var e;const t=o();return n(null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(v()),(e=>t&&!t.includes(e)||!e?function(){if(!g.languageDetector)return;const e=o();return g.languageDetector.getLanguage(Object.assign({availableLanguages:e},v()))}():e))},setStoredLanguage(e){var n;null===(n=g.languageStorage)||void 0===n||n.setLanguage(e,v())},getDevBackend:()=>g.devBackend,getBackendRecord:({language:n,namespace:t})=>{for(const a of g.backends){const o=a.getRecord(Object.assign({language:n,namespace:t},v()));if(e(o))return null==o?void 0:o.catch((e=>(console.error(e),{})));if(void 0!==o)return o}},getBackendDevRecord:({language:e,namespace:n})=>{var t;const{apiKey:o,apiUrl:r,projectId:i}=a();return null===(t=g.devBackend)||void 0===t?void 0:t.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},v()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,n)=>{var t,a;return(null===(a=null===(t=g.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},unwrap(e){var n;return g.observer?null===(n=g.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}},wrap(e){var n;return g.observer?null===(n=g.observer)||void 0===n?void 0:n.wrap(e):e.translation},hasDevBackend:()=>Boolean(N.getDevBackend()),formatTranslation(e){var n,{formatEnabled:o}=e,r=h(e,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let v="";null==s&&(v=a().onTranslationMissing(r));let b=null!=p?p:f?"":v;const y=t(),E=o||!(null===(n=g.observer)||void 0===n?void 0:n.outputNotFormattable),O=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;b=O(b);try{if(p&&y&&E)for(const e of g.formatters)b=e.format({translation:b,language:y,params:u});g.finalFormatter&&p&&y&&E&&(b=g.finalFormatter.format({translation:b,language:y,params:u}))}catch(e){console.error(e);const n=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||m,t=a().onFormatError,o=typeof t;b="string"===o?t:"function"===o?t(n,r):m,b=O(b)}var L;return b}});return N}const L=(e,n,t)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=n();a!==e&&t(e),a=e}})};const w=(e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},function(e){var{ns:n,noWrap:t,orEmpty:a,params:o,language:r}=e,i=h(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:n,noWrap:t,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(t)),a)),a};function k({options:a}){const l=function(e,n){let t=!0;function a(){return t}const o=Object.freeze({onPendingLanguageChange:u(a),onLanguageChange:u(a),onLoadingChange:u(a),onFetchingChange:u(a),onInitialLoaded:u(a),onRunningChange:u(a),onCacheChange:u(a),onUpdate:g(a,e,n),onPermanentChange:u(a),setEmitterActive(e){t=e},on:(e,n)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(n);case"language":return o.onLanguageChange.listen(n);case"loading":return o.onLoadingChange.listen(n);case"fetching":return o.onFetchingChange.listen(n);case"initialLoad":return o.onInitialLoaded.listen(n);case"running":return o.onRunningChange.listen(n);case"cache":return o.onCacheChange.listen(n);case"update":return o.onUpdate.listen(n);case"permanentChange":return o.onPermanentChange.listen(n)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(y,k),c=L(!1,(()=>m.isFetching()),l.onFetchingChange.emit),d=L(!1,(()=>R.isLoading()),l.onLoadingChange.emit),p=function(e,n,t){let a,l=E();const c=Object.freeze({init(e){l=E(e,l)},isRunning:()=>l.isRunning,setRunning(e){l.isRunning!==e&&(l.isRunning=e,t.emit(e))},isInitialLoading:()=>l.isInitialLoading,setInitialLoading(e){l.isInitialLoading=e},getLanguage:()=>l.language||l.initialOptions.language,setLanguage(n){l.language!==n&&(l.language=n,e.emit(n))},getPendingLanguage:()=>l.pendingLanguage||c.getLanguage(),setPendingLanguage(e){l.pendingLanguage!==e&&(l.pendingLanguage=e,n.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},l.initialOptions),a),addActiveNs(e){o(e).forEach((e=>{const n=l.activeNamespaces.get(e);void 0!==n?l.activeNamespaces.set(e,n+1):l.activeNamespaces.set(e,1)}))},removeActiveNs(e){o(e).forEach((e=>{const n=l.activeNamespaces.get(e);void 0!==n&&n>1?l.activeNamespaces.set(e,n-1):l.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>i([...l.initialOptions.ns||[l.initialOptions.defaultNs],...o(l.initialOptions.fallbackNs),...l.activeNamespaces.keys()]),getFallbackLangs(e){const n=e||c.getLanguage();return n?i([n,...r(n,l.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>o(l.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?l.initialOptions.defaultNs:e,getAvailableLanguages(){if(l.initialOptions.availableLanguages)return l.initialOptions.availableLanguages;if(l.initialOptions.staticData){const e=Object.keys(l.initialOptions.staticData).map((e=>f(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:s(e.apiUrl)}):void 0}});return c}(l.onLanguageChange,l.onPendingLanguageChange,l.onRunningChange),h=O(p.getLanguage,p.getInitialOptions,p.getAvailableLanguages,j,T,C,P,(function(e){l.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=v(l.onCacheChange,h.getBackendRecord,h.getBackendDevRecord,p.withDefaultNs,p.isInitialLoading,c,d);let b;function y(){return p.getFallbackNs()}function k(e){return p.getDefaultNs(e)}function j(e){return[...o(k(e)),...y()]}function A(e){return[...o(null!=e?e:k()),...p.getRequiredNamespaces()]}function P(e,n,t){const a=p.withDefaultNs(e),o=m.getTranslation(a,n);return m.changeTranslation(a,n,t),{revert(){m.changeTranslation(a,n,o)}}}function N(e){p.init(e),m.addStaticData(p.getInitialOptions().staticData)}function x(e,t){const a=function(e,n){const t=p.getFallbackLangs(e),a=A(n),o=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n},!0)||o.push({language:e,namespace:n})}))})),o}(e,t);if(a.length)return n(R.loadRecords(a),(()=>{}))}function T({key:e,ns:n}){const t=p.getFallbackLangs(),a=j(null!=n?n:void 0);return m.getTranslationNs(a,t,e)}function C({key:e,ns:n,language:t}){const a=j(null!=n?n:void 0),o=p.getFallbackLangs(t);return m.getTranslationFallback(a,o,e)}function S(){const t=n(function(){if(p.getLanguage())return;return n(h.getInitialLanguage(),(e=>{const n=e||p.getInitialOptions().defaultLanguage;n&&p.setLanguage(n)}))}(),(()=>x()));if(e(t))return p.setInitialLoading(!0),c.notify(),d.notify(),Promise.resolve(t).then((()=>{p.setInitialLoading(!1),c.notify(),d.notify(),l.onInitialLoaded.emit()}));l.onInitialLoaded.emit()}a&&N(a),l.onUpdate.listen((()=>{p.isRunning()&&h.retranslate()}));const R=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),p),h),m),{init:N,getTranslation:C,changeTranslation:P,getTranslationNs:T,getDefaultAndFallbackNs:j,async changeLanguage(e){p.getPendingLanguage()===e&&p.getLanguage()===e||(p.setPendingLanguage(e),p.isRunning()&&await x(e),e===p.getPendingLanguage()&&(p.setLanguage(e),h.setStoredLanguage(e)))},async addActiveNs(e,n){n||p.addActiveNs(e),p.isRunning()&&await x(void 0,e)},loadRecords:e=>m.loadRecords(e,R.isDev()),loadRecord:async e=>(await R.loadRecords([e]))[0],isLoading:e=>m.isLoading(p.getLanguage(),e),isLoaded(e){const n=p.getLanguage();if(!n)return!1;const t=p.getFallbackLangs(n),a=A(e),o=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n})||o.push({language:e,namespace:n})}))})),0===o.length},t:(...e)=>{const n=w(...e),t=C(n);return h.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:()=>Boolean(p.getInitialOptions().apiKey&&p.getInitialOptions().apiUrl),run:()=>(function(){if((h.getLanguageDetector()||h.getLanguageStorage())&&!p.getAvailableLanguages())throw new Error(t("availableLanguages"));if(!p.getLanguage()&&!p.getInitialOptions().defaultLanguage)throw new Error(t(["defaultLanguage","language"]))}(),p.isRunning()||(p.setRunning(!0),h.run(),b=S()),Promise.resolve(b)),stop(){p.isRunning()&&(h.stop(),p.setRunning(!1))}}));return R}const j=()=>{const e={plugins:[],options:{}},n=Object.freeze({use:t=>(e.plugins.push(t),n),updateDefaults:t=>(e.options=y(e.options,t),n),init(n){const t=function(e){const n=k({options:e});function t(e){const t=n.isRunning();t&&n.stop(),e(),n.isDev()&&n.invalidate(),t&&n.run()}n.isDev()&&n.invalidate();const a=Object.freeze({on:n.on,onNsUpdate:n.onUpdate.listenSome,setEmitterActive:n.setEmitterActive,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,overrideCredentials(e){t((()=>n.overrideCredentials(e)))},addPlugin(e){e&&t((()=>n.addPlugin(a,e)))},updateOptions(e){e&&t((()=>n.init(e)))}});return a}(y(e.options,n));return e.plugins.forEach(t.addPlugin),t}});return n},A=0,P=1,N=2;class x extends Error{constructor(e,n,t){let a;a=e===A?"Empty parameter":e===P?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${n} in "${t}"`),this.code=e,this.index=n}}function T(e){return/\s/.test(e)}const C=0,S=1,R=2,D=3,$=4,I=new Set([R,S,C]),U="'",_=new Set(["{","}",U]),F=e=>/[0-9a-zA-Z_]/.test(e);function M(e,n){const[t,a]=function(e){let n=C,t="",a="",o="";const r=[],i=[];let s=0;function l(n){throw new x(n,s,e)}const c=()=>{r.push(t),t=""},u=()=>{""===a&&l(A),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],n){case C:o===U?(t+=o,n=S):"{"===o?(c(),n=D):(t+=o,n=C);break;case S:_.has(o)?(t=t.slice(0,-1)+o,n=R):(t+=o,n=C);break;case R:o===U?n=C:(t+=o,n=R);break;case D:"}"===o?(u(),n=C):T(o)?""!==a&&(u(),n=$):(F(o)||l(P),a+=o,n=D);break;case $:"}"==o?n=C:T(o)?n=$:l(P)}return I.has(n)||l(N),c(),[r,i]}(e),o=[t[0]];for(let r=1;r<t.length;r++){const i=null==n?void 0:n[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(t[r])}return o.join("")}const V=()=>(e,n)=>(n.setFinalFormatter({format:({translation:e,params:n})=>M(e,n)}),e),K="__tolgee_dev_tools",z="__tolgee_preferredLanguages",B="data-tolgee-key-only",X="data-tolgee-restricted",W="_tolgee",Y="_tolgee-highlighter";function G(){var e,n;return void 0===(null===(n=null===(e=globalThis.window)||void 0===e?void 0:e.document)||void 0===n?void 0:n.createElement)}function H(e){if(G())throw new Error(`${e}: Can't run on the server`)}function J(e,n){return{oldTextContent:e,keys:n}}const q={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function Z({highlightColor:e,highlightWidth:n}){return Object.freeze({initHighlighter(t,a){!function(t,a){a.highlight=()=>{if(!t.isConnected)return;let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(Y),Object.entries(q).forEach((([e,n])=>{o.style[e]=n})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const r=t.getBoundingClientRect();o.style.borderWidth=n+"px",o.style.top=r.top-n+"px",o.style.left=r.left-n+"px",o.style.width=r.width+"px",o.style.height=r.height+"px"}}(t,a),function(e,n){n.unhighlight=()=>{var e;null===(e=n.highlightEl)||void 0===e||e.remove(),n.highlightEl=void 0}}(0,a)}})}function Q(e,n){var t;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}}(n),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===(t=null==r?void 0:r.iterateNext)||void 0===t?void 0:t.call(r);)o.push(i);return o}function ee(e){return e.textContent}function ne(e,n){e.textContent=n}function te(e,n){if(e.contains(n))return!0;if(n instanceof Attr){const t=n.ownerElement&&Object.values(n.ownerElement.attributes).indexOf(n)>-1;if(e.contains(n.ownerElement)&&t)return!0}return!1}function ae(e,n){var t;const a=void 0===e.key||void 0===n.key||n.key===e.key,o=void 0===e.ns||void 0===n.ns||-1!==(null===(t=e.ns)||void 0===t?void 0:t.findIndex((e=>{var t;return null===(t=n.ns)||void 0===t?void 0:t.includes(e)})));return a&&o}const oe={capture:!0},re={capture:!0,passive:!0};function ie({highlightKeys:e,elementStore:n,onClick:t,options:a}){var o,r;let i,s,l=new Set;const c=(null===(o=a.targetElement)||void 0===o?void 0:o.getRootNode())||document,u=(null===(r=a.targetElement)||void 0===r?void 0:r.ownerDocument)||document;function g(){var e;const t=n.get(i);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),i=void 0)}function d(){const e=s;let t;if(e&&O()){const a=c.elementFromPoint(e.x,e.y);a&&(t=function(e){return E(e,(e=>n.get(e)))}(a))}!function(e){var t;if(i!==e){g();const a=n.get(e);a&&(a.preventClean=!0,null===(t=a.highlight)||void 0===t||t.call(a),i=e)}}(t)}function f(e){var n;O()&&(n=e.target,!Boolean(E(n,(e=>e.id===K))))&&(e.stopPropagation(),e.preventDefault())}function p(e){var n;n={x:e.clientX,y:e.clientY},s=n,d()}function v(){l=new Set,d()}function h(e){const n=e.key;void 0!==n&&l.add(n),d()}function m(e){l.delete(e.key),d()}function b(){var e;const t=n.get(i);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)}function y(e){f(e),O()&&i&&(t(e,i),g())}function E(e,n){return n(e)?e:(null==e?void 0:e.parentElement)?E(e.parentElement,n):void 0}function O(){for(const n of e)if(!l.has(n))return!1;return!0}return Object.freeze({stop(){u.removeEventListener("blur",v,oe),u.removeEventListener("keydown",h,oe),u.removeEventListener("keyup",m,oe),u.removeEventListener("mousemove",p,re),u.removeEventListener("scroll",b,re),u.removeEventListener("click",y,oe),u.removeEventListener("mouseenter",f,oe),u.removeEventListener("mouseover",f,oe),u.removeEventListener("mouseout",f,oe),u.removeEventListener("mouseleave",f,oe),u.removeEventListener("mousedown",f,oe),u.removeEventListener("mouseup",f,oe)},run(){u.addEventListener("blur",v,oe),u.addEventListener("keydown",h,oe),u.addEventListener("keyup",m,oe),u.addEventListener("mousemove",p,re),u.addEventListener("scroll",b,re),u.addEventListener("click",y,oe),u.addEventListener("mouseenter",f,oe),u.addEventListener("mouseover",f,oe),u.addEventListener("mouseout",f,oe),u.addEventListener("mouseleave",f,oe),u.addEventListener("mousedown",f,oe),u.addEventListener("mouseup",f,oe)}})}function se(e,n,t){const o=Z({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),r=ie({highlightKeys:e.highlightKeys,elementStore:n,onClick(e,a){const o=n.get(a);t({event:e,keysAndDefaults:l(o)})},options:e});function i(e){e.nodes=new Map(function*(e){for(const[n,t]of e.nodes.entries())te(s(),n)&&(yield[n,t])}(e))}function s(){return e.targetElement||document.body}function l(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,n)=>[...e,...n.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({register(t,a,r){if(function(n){return-1!==e.restrictedElements.indexOf(n.tagName.toLowerCase())||null!==n.closest(`[${X}]`)}(t))return;const i=t;let s=n.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),n.set(i,s),i.setAttribute(W,"true")),s.nodes.set(a,r),o.initHighlighter(i,s)},forEachElement:n.forEachElement,refreshAll(){n.forEachElement(((e,t)=>{t.preventClean||(i(t),0===t.nodes.size&&function(e,t){var a;t.highlightEl&&(null===(a=t.unhighlight)||void 0===a||a.call(t)),e.removeAttribute(W),n.remove(e)}(e,t))}))},findAll(e,t){const o=[];return n.forEachElement(((n,r)=>{for(const n of r.nodes.values()){if(n.keys.find((n=>ae({key:e,ns:a(t)},{key:n.key,ns:a(n.ns)})))){o.push(r);break}}})),o},run(e){e&&r.run()},stop(){r.stop(),n.forEachElement(((e,n)=>{var t;n.highlightEl&&(null===(t=n.unhighlight)||void 0===t||t.call(n))}))}})}function le(){let e,n=!1;const t=function(){const e=new Map;return Object.freeze({set(n,t){e.set(n,t)},get:n=>n&&e.get(n),remove:n=>e.delete(n),forEachElement(n){e.forEach(((e,t)=>n(t,e)))}})}();function o({mouseHighlight:e,options:a,wrapper:o,onClick:r}){if(G())return{stop(){n=!1},wrapper:o};const i=function(e){const n=Object.freeze({getSuitableParent(t){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(t);if(void 0===a)throw console.error(t),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const n=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(n))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?n.getSuitableParent(a):a}});return n}(a),s=function(e,n){const t=Object.freeze({handleAttributes(t){let a=[];for(const[o,r]of Object.entries(e.tagAttributes))for(const e of r){const r=Q(n.getAttributeXPath({tag:o,attribute:e}),t);a=[...a,...r]}return a},handleChildList(e){let n=[];return n=n.concat(t.handleAttributes(e)),n=n.concat(t.handleText(e)),n},handleText:e=>Q(n.getTextXPath(),e)});return t}(a,o),l=se(a,t,r);function c(e){for(const n of e){const e=ee(n),t=e?o.unwrap(e):null;if(t){const{text:a,keys:o}=t;ne(n,a);const r=J(e,o),s=i.getSuitableParent(n);l.register(s,n,r)}}}function u(e){Q(`./descendant-or-self::*[@${B}]`,e).forEach((e=>{const n=e.getAttributeNode(B),t=i.getSuitableParent(n);l.register(t,n,{oldTextContent:"",keys:[{key:ee(n)}],keyAttributeOnly:!0})}))}const g=new MutationObserver((e=>{if(n){for(const n of e){let e=[];switch(n.type){case"characterData":e=s.handleText(n.target);break;case"childList":u(n.target),e=s.handleChildList(n.target);break;case"attributes":u(n.target),e=s.handleAttributes(n.target)}c(e)}l.refreshAll()}})),d=a.targetElement||document.body;return n=!0,l.run(e),u(d),c(s.handleChildList(d)),g.observe(d,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){n=!1,l.stop(),g.disconnect()},elementRegistry:l,wrapper:o}}return Object.freeze({run(n){e=o(n)},stop(){null==e||e.stop()},forEachElement(n){var t,a;null===(a=null===(t=null==e?void 0:e.elementRegistry)||void 0===t?void 0:t.forEachElement)||void 0===a||a.call(t,n)},highlight(n,t){var a;const o=(null===(a=null==e?void 0:e.elementRegistry)||void 0===a?void 0:a.findAll(n,t))||[];return o.forEach((e=>{var n;return null===(n=e.highlight)||void 0===n?void 0:n.call(e)})),{unhighlight(){o.forEach((e=>{var n;return null===(n=e.unhighlight)||void 0===n?void 0:n.call(e)}))}}},findPositions(n,t){var o;const r=(null===(o=null==e?void 0:e.elementRegistry)||void 0===o?void 0:o.findAll(n,t))||[],i=[];return r.sort(((e,n)=>e.element.compareDocumentPosition(n.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),r.forEach((e=>{const o=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{ae({key:n,ns:a(t)},{key:e.key,ns:a(e.ns)})&&i.push({position:{x:o.x,y:o.y,width:o.width,height:o.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),i},unwrap:n=>e?e.wrapper.unwrap(n):{text:n,keys:[]},wrap:n=>e?e.wrapper.wrap(n):n.translation||""})}const ce=["",""],ue=RegExp(`([${ce.join("")}]{9})+`,"gu");function ge(e){const n=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),t=n.map((e=>function(e){const n=8-e.length;return"0".repeat(n)+e}(e.toString(2))+"0")).join("");return Array.from(t).map((e=>ce[Number(e)])).join("")}function de(e){const n=Array.from(e).map((e=>ce.indexOf(e))).map(String).join("").match(/(.{9})/g),t=Uint8Array.from((null==n?void 0:n.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=t,(new TextDecoder).decode(new Uint8Array(a));var a}function fe({fullKeyEncode:e}){const n=function(){const e=[];return Object.freeze({valueToNumber(n){let t=e.indexOf(n);return-1===t&&(t=e.length,e.push(n)),t},numberToValue:n=>e[n]})}();function t(e){const n={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(n)}return Object.freeze({unwrap(e){const t=[],a=function(e){var n;const t=null===(n=e.match(ue))||void 0===n?void 0:n.filter((e=>e.length>8));return(null==t?void 0:t.map(de))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[t]=function(e){const n=[];for(const t of e)n.push(t.codePointAt(0));return n}(e);return n.numberToValue(t)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:n,n:a}=o;t.push({key:e,defaultValue:n,ns:a})}}));const o=function(e){return e.replace(ue,"")}(e);return{text:o,keys:t}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=ge(t({key:a,ns:i}))}else{const e=t({key:a,ns:i,defaultValue:o}),r=n.valueToNumber(e);s=ge(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${ce[0]}${ce[0]}') or contains(., '${ce[1]}${ce[0]}')]`,getAttributeXPath:({tag:e,attribute:n})=>`descendant-or-self::${e}/@${n}[contains(., '${ce[0]}${ce[0]}') or contains(., '${ce[1]}${ce[0]}')]`})}function pe(e,n){let t=0;for(;e>-1&&"\\"===n[e-1];)t++,e--;return t%2==1}function ve({inputPrefix:e,inputSuffix:n,translate:t}){function a(e){const{key:n,params:a,defaultValue:o,ns:r}=function(e){let n=!1,t="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||n?n?(n=!1,t+=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?t+=s:(o="PARAM_NAME",r.params[a]=t,t=""):(o="PARAM_VALUE",a=t,t=""):(o="PARAM_NAME",r.defaultValue=t,t=""):(o="PARAM_NAME",r.key=t,t=""):(o="DEFAULT_VALUE",i(t),t=""):(o="NAMESPACE",r.key=t,t=""):(o="DEFAULT_VALUE",r.key=t,t=""):n=!0;return"KEY"===o&&(r.key=t),"DEFAULT_VALUE"===o&&(r.defaultValue=t),"PARAM_VALUE"===o&&(r.params[a]=t),"NAMESPACE"===o&&i(t),r}(e);return{translated:t({key:n,params:a,defaultValue:o,ns:r,noWrap:!0}),key:n,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:t,params:a,defaultValue:o,ns:i}){let s=Object.entries(a||{}).map((([e,n])=>`${r(e)}:${r(n)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(t)}${u}${l}${s}${n}`},unwrap(t){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(n)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(t));){let e=s[1];const[n,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+n.length,"\\"===e){if(!pe(d,t)){u+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=t.substring(c),l?{text:u,keys:i}:{text:t,keys:[]}},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${e}') and contains(., '${n}')]`,getAttributeXPath:({tag:t,attribute:a})=>`descendant-or-self::${t}/@${a}[contains(., '${e}') and contains(., '${n}')]`})}const he=()=>(e,n)=>("text"===e.getInitialOptions().observerType?n.setObserver((()=>{const e=le();return Object.freeze(Object.assign(Object.assign({},e),{run(n){const t=ve({inputPrefix:n.options.inputPrefix,inputSuffix:n.options.inputSuffix,translate:n.translate});e.run(Object.assign(Object.assign({},n),{wrapper:t}))},retranslate(){e.forEachElement(((n,t)=>{for(const[n,a]of t.nodes.entries()){if(a.keyAttributeOnly)return;const t=e.unwrap(a.oldTextContent);t&&ne(n,t.text)}}))},outputNotFormattable:!0}))})):n.setObserver((()=>{const e=le();return Object.freeze(Object.assign(Object.assign({},e),{run(n){const t=fe({fullKeyEncode:n.options.fullKeyEncode});e.run(Object.assign(Object.assign({},n),{wrapper:t}))},retranslate(){},outputNotFormattable:!1}))})),e),me="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function be(e){const n=me.indexOf(e);if(-1===n)throw new Error("Invalid character found: "+e);return n}function ye(e){const n=(e=e.toUpperCase()).length;let t=0,a=0,o=0;const r=new Uint8Array(5*n/8|0);for(let i=0;i<n;i++)a=a<<5|be(e[i]),t+=5,t>=8&&(r[o++]=a>>>t-8&255,t-=8);return function(e){const n=new Uint8Array(e),t=n.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<t;e+=o)e+o>t&&(o=t-e),a+=String.fromCharCode.apply(null,n.subarray(e,e+o));return a}(r.buffer)}function Ee(e){if(e)try{const[n,t]=e.split("_");if("tgpak"===n){const[e]=ye(t).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}const Oe=()=>(e,n)=>(n.setDevBackend({getRecord({apiUrl:e,apiKey:n,language:t,namespace:a,projectId:o,fetch:r}){var i;const s=null!==(i=Ee(n))&&void 0!==i?i:o;let l=void 0!==s?`${e}/v2/projects/${s}/translations/${t}`:`${e}/v2/projects/translations/${t}`;if(a&&(l+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[n]=e.split("_");return"tgpak"===n?"tgpak":"tgpat"===n?"tgpat":"legacy"}(n)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(l,{headers:{"X-API-Key":n||"","Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>e[t]));throw new Error(e.statusText)}))}}),e);function Le({message:e,recievingMessage:n,data:t,attempts:a=1}){let o=!1;const r=()=>new Promise(((a,o)=>{const r=function(e,n){const t=t=>{var a,o;e.includes(null===(a=t.data)||void 0===a?void 0:a.type)&&n(null===(o=t.data)||void 0===o?void 0:o.data)};return window.addEventListener("message",t,!1),{unsubscribe(){window.removeEventListener("message",t)}}}(n,(function(e){clearTimeout(i),s(),a(e)}));window.postMessage({type:e,data:t},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 ${n.join(" or ")} in time.`;return new Promise((()=>{}))})()}}const we="tolgee-in-context-tools.umd.min.js",ke="@tolgee/in-context-tools",je="InContextTools",Ae="https://cdn.jsdelivr.net/npm";let Pe=null;function Ne(e){var n;return Pe||(Pe=(n=`${Ae}/@tolgee/web@${e}/dist/${we}`,new Promise(((e,t)=>{const a=document.createElement("script");a.src=n,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>t(e.error))),document.body.appendChild(a)}))).then((()=>window[ke][je]))),Pe}const xe="__tolgee_apiKey",Te="__tolgee_apiUrl";function Ce(){const e=sessionStorage.getItem(xe)||void 0,n=sessionStorage.getItem(Te)||void 0;if(e&&n)return{apiKey:e,apiUrl:n}}function Se(){sessionStorage.removeItem(xe),sessionStorage.removeItem(Te)}let Re=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(Re=()=>e=>{const n=function(){let e;return{update:async function(n){null==e||e();const{cancel:t,promise:a}=Le({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:n,attempts:4});return e=t,a}}}();e.on("running",(({value:t})=>{var a;t&&(a=()=>{n.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(Se)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Ce()&&(async()=>{const e=await Ne("5.13.3-prerelease.5f76277d.0");return n=>{const t=Ce();return n.addPlugin(e({credentials:t})),n}})().then((n=>{e.addPlugin(n)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const De="__tolgee_currentLanguage";const $e=()=>(e,n)=>(n.setLanguageStorage({getLanguage:()=>(H("LanguageStorage"),localStorage.getItem(De)||void 0),setLanguage(e){H("LanguageStorage"),localStorage.setItem(De,e)}}),e);const Ie=()=>(e,n)=>(n.setLanguageDetector({getLanguage({availableLanguages:e}){H("LanguageDetector");const n=window.navigator.language,t=e.find((e=>e===n));if(t)return t;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e);function Ue(e){return e.endsWith("/")?e.slice(0,-1):e}const _e={prefix:"/i18n",getPath:({namespace:e,language:n,prefix:t})=>e?`${Ue(t)}/${e}/${n}.json`:`${Ue(t)}/${n}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};function Fe(e){const n=Object.assign(Object.assign(Object.assign({},_e),e),{headers:Object.assign(Object.assign({},_e.headers),null==e?void 0:e.headers)}),{prefix:t,getPath:a,getData:o,headers:r}=n,i=function(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}(n,["prefix","getPath","getData","headers"]);return{getRecord:({namespace:e,language:n,fetch:s})=>s(a({namespace:e,language:n,prefix:t}),Object.assign({headers:r},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return o(e)}))}}const Me=e=>(n,t)=>(t.addBackend(Fe(e)),n);function Ve(){return j().use(Re())}const Ke=()=>e=>e;export{Me as BackendFetch,Re as BrowserExtensionPlugin,K as DEVTOOLS_ID,Oe as DevBackend,Ke as DevTools,V as FormatSimple,Ie as LanguageDetector,$e as LanguageStorage,he as ObserverPlugin,z as PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY,W as TOLGEE_ATTRIBUTE_NAME,X as TOLGEE_RESTRICT_ATTRIBUTE,B as TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE,Ve as Tolgee,j as TolgeeCore,c as createFetchFunction,a as getFallback,o as getFallbackArray,Ee as getProjectIdFromApiKey,w as getTranslateProps}; | ||
//# sourceMappingURL=tolgee-web.production.esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/web"]={})}(this,(function(e){"use strict";function n(e){return Boolean(e&&"function"==typeof e.then)}function t(e,t){return n(e)?Promise.resolve(e).then(t):t(e)}function a(e){const n=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),t=n.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...n.slice(0,-2),t].join(", ")} option`}function o(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function r(e){return o(e)||[]}function i(e,n){return"object"!=typeof(t=n)||Array.isArray(t)||null===t?r(n):r(null==n?void 0:n[e]);var t}function s(e){return Array.from(new Set(e))}function l(e){return e?e.replace(/\/+$/,""):e}const c=(e,n)=>fetch(e,n),u=(e=c)=>(n,t)=>e(n,Object.assign(Object.assign({},t),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.13.2"},null==t?void 0:t.headers)}));function g(e){let n=[];return Object.freeze({listen(e){const t=n=>{e(n)};return n.push(t),{unsubscribe(){n=n.filter((e=>t!==e))}}},emit(t){e()&&n.forEach((e=>e({value:t})))}})}function d(e,n,t){const a=new Set,o=new Set;let i=[];function s(){if(0===i.length)return;const e=i;i=[],a.forEach((e=>{e({value:void 0})}));let t=new Set;e.forEach((e=>{void 0===e?t=void 0:void 0!==t&&e.forEach((e=>t.add(e)))}));!function(e){const t=new Set(n());o.forEach((n=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>t.has(e)||n.namespaces.has(e)))))&&n.fn({value:void 0})}))}(t?Array.from(t.keys()):void 0)}return Object.freeze({emit(n,t){e()&&(i.push(n),t?setTimeout(s,0):s())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const n={fn:n=>{e(n)},namespaces:new Set};o.add(n);const a={unsubscribe:()=>{o.delete(n)},subscribeNs:e=>(r(e).forEach((e=>n.namespaces.add(e))),void 0===e&&n.namespaces.add(t()),a)};return a}})}const f=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):f(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},p=e=>{const[n,...t]=e.split(":");return{language:n,namespace:t.join(":")||""}},v=({language:e,namespace:n})=>n?`${e}:${n}`:e;function h(e,n,t,a,o,i,l){const c=new Map,u=new Map;let g={},d=0;function h(n,t,a){const o=v(n);u.set(o,{data:f(t),version:a}),e.emit(n)}function m(e){let t;if(!t){const n=g[v(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t}const b=Object.freeze({addStaticData(e){e&&(g=Object.assign(Object.assign({},g),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=p(e),a=u.get(e);a&&0!==a.version||h(t,n,0)}})))},invalidate(){c.clear(),d+=1},addRecord(e,n){h(e,n,d)},exists(e,n=!1){const t=u.get(v(e));return t&&n?t.version===d:Boolean(t)},getRecord(e){var n;return null===(n=u.get(v(a(e))))||void 0===n?void 0:n.data},getTranslation(e,n){var t;return null===(t=u.get(v(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs(e,n,t){var a;for(const o of e)for(const e of n){const n=null===(a=u.get(v({language:e,namespace:o})))||void 0===a?void 0:a.data.get(t);if(null!=n)return[o]}return s(e)},getTranslationFallback(e,n,t){var a;for(const o of e)for(const e of n){const n=null===(a=u.get(v({language:e,namespace:o})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation(n,t,a){var o;const r=null===(o=u.get(v(n)))||void 0===o?void 0:o.data;null==r||r.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching(e){if(o())return!0;if(void 0===e)return c.size>0;const n=r(e);return Boolean(Array.from(c.keys()).find((e=>n.includes(p(e).namespace))))},isLoading(e,n){const t=r(n);return Boolean(o()||Array.from(c.keys()).find((n=>{const a=p(n);return(!t.length||t.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,n){const o=e.map((e=>{const o=a(e),r=v(o),i=c.get(r);if(i)return{new:!1,promise:i,keyObject:o,cacheKey:r};const s=function(e,n){var a;let o;return n&&(o=null===(a=t(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),o||(o=m(e)),o}(o,n)||Promise.resolve(void 0);return c.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,n)=>{const t=c.get(e.cacheKey)!==e.promise;if(e.new&&!t){c.delete(e.cacheKey);const t=r[n];t?b.addRecord(e.keyObject,t):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),i.notify(),l.notify(),o.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(u.entries()).map((([e,n])=>Object.assign(Object.assign({},p(e)),{data:n.data})))});return b}function m(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}const b="invalid",y={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:b,apiUrl:"https://app.tolgee.io",fetch:u(),onTranslationMissing:({key:e})=>e},E=(...e)=>{let n={};return e.forEach((e=>{n=Object.assign(Object.assign(Object.assign({},n),e),{observerOptions:Object.assign(Object.assign({},n.observerOptions),null==e?void 0:e.observerOptions)})})),n};function O(e,n){const t=E(y,null==n?void 0:n.initialOptions,e);return t.apiUrl=l(t.apiUrl),(null==e?void 0:e.fetch)&&(t.fetch=u(e.fetch)),{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}}function L(e,a,o,r,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,event:n})=>{var t;const a=e.map((({key:e,ns:n,defaultValue:t})=>({key:e,defaultValue:t,fallbackNamespaces:r(n),namespace:i({key:e,ns:n})[0],translation:s({key:e,ns:n})})));null===(t=g.ui)||void 0===t||t.handleElementClick(a,n)},f=(e,n)=>{var t;return(null===(t=g.observer)||void 0===t?void 0:t.findPositions(e,n))||[]};function p(e){const n=s({key:e.key,ns:e.ns});return P.formatTranslation(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))}function v(){return{fetch:a().fetch}}function h(e){g.observer=null==e?void 0:e()}function y(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function O(e){g.finalFormatter=e}function L(e){u.ui=e}function w(){return Boolean(u.ui)}function k(e){g.languageStorage=e}function j(e){g.languageDetector=e}function A(e){e&&g.backends.push(e)}function T(e){g.devBackend=e}const P=Object.freeze({addPlugin:function(e,n){n(e,Object.freeze({setFinalFormatter:O,addFormatter:E,setObserver:h,hasObserver:y,setUi:L,hasUi:w,setDevBackend:T,addBackend:A,setLanguageDetector:j,setLanguageStorage:k}))},run(){var e,n;const{apiKey:t,apiUrl:o,projectId:r,observerOptions:i}=a();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:t,apiUrl:o,projectId:r,highlight:P.highlight,changeTranslation:l,findPositions:f,onPermanentChange:c}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){var e;const n=o();return t(null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(v()),(e=>n&&!n.includes(e)||!e?function(){if(!g.languageDetector)return;const e=o();return g.languageDetector.getLanguage(Object.assign({availableLanguages:e},v()))}():e))},setStoredLanguage(e){var n;null===(n=g.languageStorage)||void 0===n||n.setLanguage(e,v())},getDevBackend:()=>g.devBackend,getBackendRecord:({language:e,namespace:t})=>{for(const a of g.backends){const o=a.getRecord(Object.assign({language:e,namespace:t},v()));if(n(o))return null==o?void 0:o.catch((e=>(console.error(e),{})));if(void 0!==o)return o}},getBackendDevRecord:({language:e,namespace:n})=>{var t;const{apiKey:o,apiUrl:r,projectId:i}=a();return null===(t=g.devBackend)||void 0===t?void 0:t.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},v()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,n)=>{var t,a;return(null===(a=null===(t=g.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},unwrap(e){var n;return g.observer?null===(n=g.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}},wrap(e){var n;return g.observer?null===(n=g.observer)||void 0===n?void 0:n.wrap(e):e.translation},hasDevBackend:()=>Boolean(P.getDevBackend()),formatTranslation(n){var t,{formatEnabled:o}=n,r=m(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let v="";null==s&&(v=a().onTranslationMissing(r));let h=null!=p?p:f?"":v;const y=e(),E=o||!(null===(t=g.observer)||void 0===t?void 0:t.outputNotFormattable),O=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;h=O(h);try{if(p&&y&&E)for(const e of g.formatters)h=e.format({translation:h,language:y,params:u});g.finalFormatter&&p&&y&&E&&(h=g.finalFormatter.format({translation:h,language:y,params:u}))}catch(e){console.error(e);const n=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||b,t=a().onFormatError,o=typeof t;h="string"===o?t:"function"===o?t(n,r):b,h=O(h)}var L;return h}});return P}const w=(e,n,t)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=n();a!==e&&t(e),a=e}})};const k=(e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},function(e){var{ns:n,noWrap:t,orEmpty:a,params:o,language:r}=e,i=m(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:n,noWrap:t,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(t)),a)),a};function j({options:e}){const o=function(e,n){let t=!0;function a(){return t}const o=Object.freeze({onPendingLanguageChange:g(a),onLanguageChange:g(a),onLoadingChange:g(a),onFetchingChange:g(a),onInitialLoaded:g(a),onRunningChange:g(a),onCacheChange:g(a),onUpdate:d(a,e,n),onPermanentChange:g(a),setEmitterActive(e){t=e},on:(e,n)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(n);case"language":return o.onLanguageChange.listen(n);case"loading":return o.onLoadingChange.listen(n);case"fetching":return o.onFetchingChange.listen(n);case"initialLoad":return o.onInitialLoaded.listen(n);case"running":return o.onRunningChange.listen(n);case"cache":return o.onCacheChange.listen(n);case"update":return o.onUpdate.listen(n);case"permanentChange":return o.onPermanentChange.listen(n)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(y,E),c=w(!1,(()=>m.isFetching()),o.onFetchingChange.emit),u=w(!1,(()=>C.isLoading()),o.onLoadingChange.emit),f=function(e,n,t){let a,o=O();const c=Object.freeze({init(e){o=O(e,o)},isRunning:()=>o.isRunning,setRunning(e){o.isRunning!==e&&(o.isRunning=e,t.emit(e))},isInitialLoading:()=>o.isInitialLoading,setInitialLoading(e){o.isInitialLoading=e},getLanguage:()=>o.language||o.initialOptions.language,setLanguage(n){o.language!==n&&(o.language=n,e.emit(n))},getPendingLanguage:()=>o.pendingLanguage||c.getLanguage(),setPendingLanguage(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,n.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},o.initialOptions),a),addActiveNs(e){r(e).forEach((e=>{const n=o.activeNamespaces.get(e);void 0!==n?o.activeNamespaces.set(e,n+1):o.activeNamespaces.set(e,1)}))},removeActiveNs(e){r(e).forEach((e=>{const n=o.activeNamespaces.get(e);void 0!==n&&n>1?o.activeNamespaces.set(e,n-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>s([...o.initialOptions.ns||[o.initialOptions.defaultNs],...r(o.initialOptions.fallbackNs),...o.activeNamespaces.keys()]),getFallbackLangs(e){const n=e||c.getLanguage();return n?s([n,...i(n,o.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>r(o.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?o.initialOptions.defaultNs:e,getAvailableLanguages(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>p(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:l(e.apiUrl)}):void 0}});return c}(o.onLanguageChange,o.onPendingLanguageChange,o.onRunningChange),v=L(f.getLanguage,f.getInitialOptions,f.getAvailableLanguages,j,N,R,T,(function(e){o.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=h(o.onCacheChange,v.getBackendRecord,v.getBackendDevRecord,f.withDefaultNs,f.isInitialLoading,c,u);let b;function y(){return f.getFallbackNs()}function E(e){return f.getDefaultNs(e)}function j(e){return[...r(E(e)),...y()]}function A(e){return[...r(null!=e?e:E()),...f.getRequiredNamespaces()]}function T(e,n,t){const a=f.withDefaultNs(e),o=m.getTranslation(a,n);return m.changeTranslation(a,n,t),{revert(){m.changeTranslation(a,n,o)}}}function P(e){f.init(e),m.addStaticData(f.getInitialOptions().staticData)}function x(e,n){const a=function(e,n){const t=f.getFallbackLangs(e),a=A(n),o=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n},!0)||o.push({language:e,namespace:n})}))})),o}(e,n);if(a.length)return t(C.loadRecords(a),(()=>{}))}function N({key:e,ns:n}){const t=f.getFallbackLangs(),a=j(null!=n?n:void 0);return m.getTranslationNs(a,t,e)}function R({key:e,ns:n,language:t}){const a=j(null!=n?n:void 0),o=f.getFallbackLangs(t);return m.getTranslationFallback(a,o,e)}function S(){const e=t(function(){if(f.getLanguage())return;return t(v.getInitialLanguage(),(e=>{const n=e||f.getInitialOptions().defaultLanguage;n&&f.setLanguage(n)}))}(),(()=>x()));if(n(e))return f.setInitialLoading(!0),c.notify(),u.notify(),Promise.resolve(e).then((()=>{f.setInitialLoading(!1),c.notify(),u.notify(),o.onInitialLoaded.emit()}));o.onInitialLoaded.emit()}e&&P(e),o.onUpdate.listen((()=>{f.isRunning()&&v.retranslate()}));const C=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),f),v),m),{init:P,getTranslation:R,changeTranslation:T,getTranslationNs:N,getDefaultAndFallbackNs:j,async changeLanguage(e){f.getPendingLanguage()===e&&f.getLanguage()===e||(f.setPendingLanguage(e),f.isRunning()&&await x(e),e===f.getPendingLanguage()&&(f.setLanguage(e),v.setStoredLanguage(e)))},async addActiveNs(e,n){n||f.addActiveNs(e),f.isRunning()&&await x(void 0,e)},loadRecords:e=>m.loadRecords(e,C.isDev()),loadRecord:async e=>(await C.loadRecords([e]))[0],isLoading:e=>m.isLoading(f.getLanguage(),e),isLoaded(e){const n=f.getLanguage();if(!n)return!1;const t=f.getFallbackLangs(n),a=A(e),o=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n})||o.push({language:e,namespace:n})}))})),0===o.length},t:(...e)=>{const n=k(...e),t=R(n);return v.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:()=>Boolean(f.getInitialOptions().apiKey&&f.getInitialOptions().apiUrl),run:()=>(function(){if((v.getLanguageDetector()||v.getLanguageStorage())&&!f.getAvailableLanguages())throw new Error(a("availableLanguages"));if(!f.getLanguage()&&!f.getInitialOptions().defaultLanguage)throw new Error(a(["defaultLanguage","language"]))}(),f.isRunning()||(f.setRunning(!0),v.run(),b=S()),Promise.resolve(b)),stop(){f.isRunning()&&(v.stop(),f.setRunning(!1))}}));return C}const A=()=>{const e={plugins:[],options:{}},n=Object.freeze({use:t=>(e.plugins.push(t),n),updateDefaults:t=>(e.options=E(e.options,t),n),init(n){const t=function(e){const n=j({options:e});function t(e){const t=n.isRunning();t&&n.stop(),e(),n.isDev()&&n.invalidate(),t&&n.run()}n.isDev()&&n.invalidate();const a=Object.freeze({on:n.on,onNsUpdate:n.onUpdate.listenSome,setEmitterActive:n.setEmitterActive,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,overrideCredentials(e){t((()=>n.overrideCredentials(e)))},addPlugin(e){e&&t((()=>n.addPlugin(a,e)))},updateOptions(e){e&&t((()=>n.init(e)))}});return a}(E(e.options,n));return e.plugins.forEach(t.addPlugin),t}});return n},T=0,P=1,x=2;class N extends Error{constructor(e,n,t){let a;a=e===T?"Empty parameter":e===P?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${n} in "${t}"`),this.code=e,this.index=n}}function R(e){return/\s/.test(e)}const S=0,C=1,D=2,I=3,$=4,_=new Set([D,C,S]),U="'",F=new Set(["{","}",U]),M=e=>/[0-9a-zA-Z_]/.test(e);function B(e,n){const[t,a]=function(e){let n=S,t="",a="",o="";const r=[],i=[];let s=0;function l(n){throw new N(n,s,e)}const c=()=>{r.push(t),t=""},u=()=>{""===a&&l(T),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],n){case S:o===U?(t+=o,n=C):"{"===o?(c(),n=I):(t+=o,n=S);break;case C:F.has(o)?(t=t.slice(0,-1)+o,n=D):(t+=o,n=S);break;case D:o===U?n=S:(t+=o,n=D);break;case I:"}"===o?(u(),n=S):R(o)?""!==a&&(u(),n=$):(M(o)||l(P),a+=o,n=I);break;case $:"}"==o?n=S:R(o)?n=$:l(P)}return _.has(n)||l(x),c(),[r,i]}(e),o=[t[0]];for(let r=1;r<t.length;r++){const i=null==n?void 0:n[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(t[r])}return o.join("")}const K="__tolgee_dev_tools",V="data-tolgee-key-only",z="data-tolgee-restricted",Y="_tolgee",G="_tolgee-highlighter";function W(){var e,n;return void 0===(null===(n=null===(e=globalThis.window)||void 0===e?void 0:e.document)||void 0===n?void 0:n.createElement)}function X(e){if(W())throw new Error(`${e}: Can't run on the server`)}function H(e,n){return{oldTextContent:e,keys:n}}const J={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function q({highlightColor:e,highlightWidth:n}){return Object.freeze({initHighlighter(t,a){!function(t,a){a.highlight=()=>{if(!t.isConnected)return;let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(G),Object.entries(J).forEach((([e,n])=>{o.style[e]=n})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const r=t.getBoundingClientRect();o.style.borderWidth=n+"px",o.style.top=r.top-n+"px",o.style.left=r.left-n+"px",o.style.width=r.width+"px",o.style.height=r.height+"px"}}(t,a),function(e,n){n.unhighlight=()=>{var e;null===(e=n.highlightEl)||void 0===e||e.remove(),n.highlightEl=void 0}}(0,a)}})}function Z(e,n){var t;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}}(n),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===(t=null==r?void 0:r.iterateNext)||void 0===t?void 0:t.call(r);)o.push(i);return o}function Q(e){return e.textContent}function ee(e,n){e.textContent=n}function ne(e,n){if(e.contains(n))return!0;if(n instanceof Attr){const t=n.ownerElement&&Object.values(n.ownerElement.attributes).indexOf(n)>-1;if(e.contains(n.ownerElement)&&t)return!0}return!1}function te(e,n){var t;const a=void 0===e.key||void 0===n.key||n.key===e.key,o=void 0===e.ns||void 0===n.ns||-1!==(null===(t=e.ns)||void 0===t?void 0:t.findIndex((e=>{var t;return null===(t=n.ns)||void 0===t?void 0:t.includes(e)})));return a&&o}const ae={capture:!0},oe={capture:!0,passive:!0};function re({highlightKeys:e,elementStore:n,onClick:t,options:a}){var o,r;let i,s,l=new Set;const c=(null===(o=a.targetElement)||void 0===o?void 0:o.getRootNode())||document,u=(null===(r=a.targetElement)||void 0===r?void 0:r.ownerDocument)||document;function g(){var e;const t=n.get(i);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),i=void 0)}function d(){const e=s;let t;if(e&&O()){const a=c.elementFromPoint(e.x,e.y);a&&(t=function(e){return E(e,(e=>n.get(e)))}(a))}!function(e){var t;if(i!==e){g();const a=n.get(e);a&&(a.preventClean=!0,null===(t=a.highlight)||void 0===t||t.call(a),i=e)}}(t)}function f(e){var n;O()&&(n=e.target,!Boolean(E(n,(e=>e.id===K))))&&(e.stopPropagation(),e.preventDefault())}function p(e){var n;n={x:e.clientX,y:e.clientY},s=n,d()}function v(){l=new Set,d()}function h(e){const n=e.key;void 0!==n&&l.add(n),d()}function m(e){l.delete(e.key),d()}function b(){var e;const t=n.get(i);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)}function y(e){f(e),O()&&i&&(t(e,i),g())}function E(e,n){return n(e)?e:(null==e?void 0:e.parentElement)?E(e.parentElement,n):void 0}function O(){for(const n of e)if(!l.has(n))return!1;return!0}return Object.freeze({stop(){u.removeEventListener("blur",v,ae),u.removeEventListener("keydown",h,ae),u.removeEventListener("keyup",m,ae),u.removeEventListener("mousemove",p,oe),u.removeEventListener("scroll",b,oe),u.removeEventListener("click",y,ae),u.removeEventListener("mouseenter",f,ae),u.removeEventListener("mouseover",f,ae),u.removeEventListener("mouseout",f,ae),u.removeEventListener("mouseleave",f,ae),u.removeEventListener("mousedown",f,ae),u.removeEventListener("mouseup",f,ae)},run(){u.addEventListener("blur",v,ae),u.addEventListener("keydown",h,ae),u.addEventListener("keyup",m,ae),u.addEventListener("mousemove",p,oe),u.addEventListener("scroll",b,oe),u.addEventListener("click",y,ae),u.addEventListener("mouseenter",f,ae),u.addEventListener("mouseover",f,ae),u.addEventListener("mouseout",f,ae),u.addEventListener("mouseleave",f,ae),u.addEventListener("mousedown",f,ae),u.addEventListener("mouseup",f,ae)}})}function ie(e,n,t){const a=q({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),r=re({highlightKeys:e.highlightKeys,elementStore:n,onClick(e,a){const o=n.get(a);t({event:e,keysAndDefaults:l(o)})},options:e});function i(e){e.nodes=new Map(function*(e){for(const[n,t]of e.nodes.entries())ne(s(),n)&&(yield[n,t])}(e))}function s(){return e.targetElement||document.body}function l(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,n)=>[...e,...n.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({register(t,o,r){if(function(n){return-1!==e.restrictedElements.indexOf(n.tagName.toLowerCase())||null!==n.closest(`[${z}]`)}(t))return;const i=t;let s=n.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),n.set(i,s),i.setAttribute(Y,"true")),s.nodes.set(o,r),a.initHighlighter(i,s)},forEachElement:n.forEachElement,refreshAll(){n.forEachElement(((e,t)=>{t.preventClean||(i(t),0===t.nodes.size&&function(e,t){var a;t.highlightEl&&(null===(a=t.unhighlight)||void 0===a||a.call(t)),e.removeAttribute(Y),n.remove(e)}(e,t))}))},findAll(e,t){const a=[];return n.forEachElement(((n,r)=>{for(const n of r.nodes.values()){if(n.keys.find((n=>te({key:e,ns:o(t)},{key:n.key,ns:o(n.ns)})))){a.push(r);break}}})),a},run(e){e&&r.run()},stop(){r.stop(),n.forEachElement(((e,n)=>{var t;n.highlightEl&&(null===(t=n.unhighlight)||void 0===t||t.call(n))}))}})}function se(){let e,n=!1;const t=function(){const e=new Map;return Object.freeze({set(n,t){e.set(n,t)},get:n=>n&&e.get(n),remove:n=>e.delete(n),forEachElement(n){e.forEach(((e,t)=>n(t,e)))}})}();function a({mouseHighlight:e,options:a,wrapper:o,onClick:r}){if(W())return{stop(){n=!1},wrapper:o};const i=function(e){const n=Object.freeze({getSuitableParent(t){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(t);if(void 0===a)throw console.error(t),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const n=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(n))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?n.getSuitableParent(a):a}});return n}(a),s=function(e,n){const t=Object.freeze({handleAttributes(t){let a=[];for(const[o,r]of Object.entries(e.tagAttributes))for(const e of r){const r=Z(n.getAttributeXPath({tag:o,attribute:e}),t);a=[...a,...r]}return a},handleChildList(e){let n=[];return n=n.concat(t.handleAttributes(e)),n=n.concat(t.handleText(e)),n},handleText:e=>Z(n.getTextXPath(),e)});return t}(a,o),l=ie(a,t,r);function c(e){for(const n of e){const e=Q(n),t=e?o.unwrap(e):null;if(t){const{text:a,keys:o}=t;ee(n,a);const r=H(e,o),s=i.getSuitableParent(n);l.register(s,n,r)}}}function u(e){Z(`./descendant-or-self::*[@${V}]`,e).forEach((e=>{const n=e.getAttributeNode(V),t=i.getSuitableParent(n);l.register(t,n,{oldTextContent:"",keys:[{key:Q(n)}],keyAttributeOnly:!0})}))}const g=new MutationObserver((e=>{if(n){for(const n of e){let e=[];switch(n.type){case"characterData":e=s.handleText(n.target);break;case"childList":u(n.target),e=s.handleChildList(n.target);break;case"attributes":u(n.target),e=s.handleAttributes(n.target)}c(e)}l.refreshAll()}})),d=a.targetElement||document.body;return n=!0,l.run(e),u(d),c(s.handleChildList(d)),g.observe(d,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){n=!1,l.stop(),g.disconnect()},elementRegistry:l,wrapper:o}}return Object.freeze({run(n){e=a(n)},stop(){null==e||e.stop()},forEachElement(n){var t,a;null===(a=null===(t=null==e?void 0:e.elementRegistry)||void 0===t?void 0:t.forEachElement)||void 0===a||a.call(t,n)},highlight(n,t){var a;const o=(null===(a=null==e?void 0:e.elementRegistry)||void 0===a?void 0:a.findAll(n,t))||[];return o.forEach((e=>{var n;return null===(n=e.highlight)||void 0===n?void 0:n.call(e)})),{unhighlight(){o.forEach((e=>{var n;return null===(n=e.unhighlight)||void 0===n?void 0:n.call(e)}))}}},findPositions(n,t){var a;const r=(null===(a=null==e?void 0:e.elementRegistry)||void 0===a?void 0:a.findAll(n,t))||[],i=[];return r.sort(((e,n)=>e.element.compareDocumentPosition(n.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),r.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{te({key:n,ns:o(t)},{key:e.key,ns:o(e.ns)})&&i.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),i},unwrap:n=>e?e.wrapper.unwrap(n):{text:n,keys:[]},wrap:n=>e?e.wrapper.wrap(n):n.translation||""})}const le=["",""],ce=RegExp(`([${le.join("")}]{9})+`,"gu");function ue(e){const n=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),t=n.map((e=>function(e){const n=8-e.length;return"0".repeat(n)+e}(e.toString(2))+"0")).join("");return Array.from(t).map((e=>le[Number(e)])).join("")}function ge(e){const n=Array.from(e).map((e=>le.indexOf(e))).map(String).join("").match(/(.{9})/g),t=Uint8Array.from((null==n?void 0:n.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=t,(new TextDecoder).decode(new Uint8Array(a));var a}function de({fullKeyEncode:e}){const n=function(){const e=[];return Object.freeze({valueToNumber(n){let t=e.indexOf(n);return-1===t&&(t=e.length,e.push(n)),t},numberToValue:n=>e[n]})}();function t(e){const n={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(n)}return Object.freeze({unwrap(e){const t=[],a=function(e){var n;const t=null===(n=e.match(ce))||void 0===n?void 0:n.filter((e=>e.length>8));return(null==t?void 0:t.map(ge))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[t]=function(e){const n=[];for(const t of e)n.push(t.codePointAt(0));return n}(e);return n.numberToValue(t)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:n,n:a}=o;t.push({key:e,defaultValue:n,ns:a})}}));const o=function(e){return e.replace(ce,"")}(e);return{text:o,keys:t}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=ue(t({key:a,ns:i}))}else{const e=t({key:a,ns:i,defaultValue:o}),r=n.valueToNumber(e);s=ue(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${le[0]}${le[0]}') or contains(., '${le[1]}${le[0]}')]`,getAttributeXPath:({tag:e,attribute:n})=>`descendant-or-self::${e}/@${n}[contains(., '${le[0]}${le[0]}') or contains(., '${le[1]}${le[0]}')]`})}function fe(e,n){let t=0;for(;e>-1&&"\\"===n[e-1];)t++,e--;return t%2==1}function pe({inputPrefix:e,inputSuffix:n,translate:t}){function a(e){const{key:n,params:a,defaultValue:o,ns:r}=function(e){let n=!1,t="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||n?n?(n=!1,t+=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?t+=s:(o="PARAM_NAME",r.params[a]=t,t=""):(o="PARAM_VALUE",a=t,t=""):(o="PARAM_NAME",r.defaultValue=t,t=""):(o="PARAM_NAME",r.key=t,t=""):(o="DEFAULT_VALUE",i(t),t=""):(o="NAMESPACE",r.key=t,t=""):(o="DEFAULT_VALUE",r.key=t,t=""):n=!0;return"KEY"===o&&(r.key=t),"DEFAULT_VALUE"===o&&(r.defaultValue=t),"PARAM_VALUE"===o&&(r.params[a]=t),"NAMESPACE"===o&&i(t),r}(e);return{translated:t({key:n,params:a,defaultValue:o,ns:r,noWrap:!0}),key:n,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:t,params:a,defaultValue:o,ns:i}){let s=Object.entries(a||{}).map((([e,n])=>`${r(e)}:${r(n)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(t)}${u}${l}${s}${n}`},unwrap(t){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(n)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(t));){let e=s[1];const[n,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+n.length,"\\"===e){if(!fe(d,t)){u+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=t.substring(c),l?{text:u,keys:i}:{text:t,keys:[]}},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${e}') and contains(., '${n}')]`,getAttributeXPath:({tag:t,attribute:a})=>`descendant-or-self::${t}/@${a}[contains(., '${e}') and contains(., '${n}')]`})}const ve="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function he(e){const n=ve.indexOf(e);if(-1===n)throw new Error("Invalid character found: "+e);return n}function me(e){const n=(e=e.toUpperCase()).length;let t=0,a=0,o=0;const r=new Uint8Array(5*n/8|0);for(let i=0;i<n;i++)a=a<<5|he(e[i]),t+=5,t>=8&&(r[o++]=a>>>t-8&255,t-=8);return function(e){const n=new Uint8Array(e),t=n.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<t;e+=o)e+o>t&&(o=t-e),a+=String.fromCharCode.apply(null,n.subarray(e,e+o));return a}(r.buffer)}function be(e){if(e)try{const[n,t]=e.split("_");if("tgpak"===n){const[e]=me(t).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}function ye({message:e,recievingMessage:n,data:t,attempts:a=1}){let o=!1;const r=()=>new Promise(((a,o)=>{const r=function(e,n){const t=t=>{var a,o;e.includes(null===(a=t.data)||void 0===a?void 0:a.type)&&n(null===(o=t.data)||void 0===o?void 0:o.data)};return window.addEventListener("message",t,!1),{unsubscribe(){window.removeEventListener("message",t)}}}(n,(function(e){clearTimeout(i),s(),a(e)}));window.postMessage({type:e,data:t},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 ${n.join(" or ")} in time.`;return new Promise((()=>{}))})()}}const Ee="tolgee-in-context-tools.umd.min.js",Oe="@tolgee/in-context-tools",Le="InContextTools",we="https://cdn.jsdelivr.net/npm";let ke=null;function je(e){var n;return ke||(ke=(n=`${we}/@tolgee/web@${e}/dist/${Ee}`,new Promise(((e,t)=>{const a=document.createElement("script");a.src=n,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>t(e.error))),document.body.appendChild(a)}))).then((()=>window[Oe][Le]))),ke}const Ae="__tolgee_apiKey",Te="__tolgee_apiUrl";function Pe(){const e=sessionStorage.getItem(Ae)||void 0,n=sessionStorage.getItem(Te)||void 0;if(e&&n)return{apiKey:e,apiUrl:n}}function xe(){sessionStorage.removeItem(Ae),sessionStorage.removeItem(Te)}e.BrowserExtensionPlugin=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(e.BrowserExtensionPlugin=()=>e=>{const n=function(){let e;return{update:async function(n){null==e||e();const{cancel:t,promise:a}=ye({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:n,attempts:4});return e=t,a}}}();e.on("running",(({value:t})=>{var a;t&&(a=()=>{n.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(xe)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Pe()&&(async()=>{const e=await je("5.13.2");return n=>{const t=Pe();return n.addPlugin(e({credentials:t})),n}})().then((n=>{e.addPlugin(n)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const Ne="__tolgee_currentLanguage";function Re(e){return e.endsWith("/")?e.slice(0,-1):e}const Se={prefix:"/i18n",getPath:({namespace:e,language:n,prefix:t})=>e?`${Re(t)}/${e}/${n}.json`:`${Re(t)}/${n}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};function Ce(e){const n=Object.assign(Object.assign(Object.assign({},Se),e),{headers:Object.assign(Object.assign({},Se.headers),null==e?void 0:e.headers)}),{prefix:t,getPath:a,getData:o,headers:r}=n,i=function(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}(n,["prefix","getPath","getData","headers"]);return{getRecord:({namespace:e,language:n,fetch:s})=>s(a({namespace:e,language:n,prefix:t}),Object.assign({headers:r},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return o(e)}))}}e.BackendFetch=e=>(n,t)=>(t.addBackend(Ce(e)),n),e.DEVTOOLS_ID=K,e.DevBackend=()=>(e,n)=>(n.setDevBackend({getRecord({apiUrl:e,apiKey:n,language:t,namespace:a,projectId:o,fetch:r}){var i;const s=null!==(i=be(n))&&void 0!==i?i:o;let l=void 0!==s?`${e}/v2/projects/${s}/translations/${t}`:`${e}/v2/projects/translations/${t}`;if(a&&(l+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[n]=e.split("_");return"tgpak"===n?"tgpak":"tgpat"===n?"tgpat":"legacy"}(n)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(l,{headers:{"X-API-Key":n||"","Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>e[t]));throw new Error(e.statusText)}))}}),e),e.DevTools=()=>e=>e,e.FormatSimple=()=>(e,n)=>(n.setFinalFormatter({format:({translation:e,params:n})=>B(e,n)}),e),e.LanguageDetector=()=>(e,n)=>(n.setLanguageDetector({getLanguage({availableLanguages:e}){X("LanguageDetector");const n=window.navigator.language,t=e.find((e=>e===n));if(t)return t;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e),e.LanguageStorage=()=>(e,n)=>(n.setLanguageStorage({getLanguage:()=>(X("LanguageStorage"),localStorage.getItem(Ne)||void 0),setLanguage(e){X("LanguageStorage"),localStorage.setItem(Ne,e)}}),e),e.ObserverPlugin=()=>(e,n)=>("text"===e.getInitialOptions().observerType?n.setObserver((()=>{const e=se();return Object.freeze(Object.assign(Object.assign({},e),{run(n){const t=pe({inputPrefix:n.options.inputPrefix,inputSuffix:n.options.inputSuffix,translate:n.translate});e.run(Object.assign(Object.assign({},n),{wrapper:t}))},retranslate(){e.forEachElement(((n,t)=>{for(const[n,a]of t.nodes.entries()){if(a.keyAttributeOnly)return;const t=e.unwrap(a.oldTextContent);t&&ee(n,t.text)}}))},outputNotFormattable:!0}))})):n.setObserver((()=>{const e=se();return Object.freeze(Object.assign(Object.assign({},e),{run(n){const t=de({fullKeyEncode:n.options.fullKeyEncode});e.run(Object.assign(Object.assign({},n),{wrapper:t}))},retranslate(){},outputNotFormattable:!1}))})),e),e.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",e.TOLGEE_ATTRIBUTE_NAME=Y,e.TOLGEE_RESTRICT_ATTRIBUTE=z,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=V,e.Tolgee=function(){return A().use(e.BrowserExtensionPlugin())},e.TolgeeCore=A,e.createFetchFunction=u,e.getFallback=o,e.getFallbackArray=r,e.getProjectIdFromApiKey=be,e.getTranslateProps=k,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/web"]={})}(this,(function(e){"use strict";function n(e){return Boolean(e&&"function"==typeof e.then)}function t(e,t){return n(e)?Promise.resolve(e).then(t):t(e)}function a(e){const n=(Array.isArray(e)?e:[e]).map((e=>`'${e}'`)),t=n.slice(-2).join(" or ");return`Tolgee: You need to specify ${[...n.slice(0,-2),t].join(", ")} option`}function o(e){return"string"==typeof e?[e]:Array.isArray(e)?e:void 0}function r(e){return o(e)||[]}function i(e,n){return"object"!=typeof(t=n)||Array.isArray(t)||null===t?r(n):r(null==n?void 0:n[e]);var t}function s(e){return Array.from(new Set(e))}function l(e){return e?e.replace(/\/+$/,""):e}const c=(e,n)=>fetch(e,n),u=(e=c)=>(n,t)=>e(n,Object.assign(Object.assign({},t),{headers:Object.assign({"X-Tolgee-SDK-Type":"JS","X-Tolgee-SDK-Version":"5.13.3-prerelease.5f76277d.0"},null==t?void 0:t.headers)}));function g(e){let n=[];return Object.freeze({listen(e){const t=n=>{e(n)};return n.push(t),{unsubscribe(){n=n.filter((e=>t!==e))}}},emit(t){e()&&n.forEach((e=>e({value:t})))}})}function d(e,n,t){const a=new Set,o=new Set;let i=[];function s(){if(0===i.length)return;const e=i;i=[],a.forEach((e=>{e({value:void 0})}));let t=new Set;e.forEach((e=>{void 0===e?t=void 0:void 0!==t&&e.forEach((e=>t.add(e)))}));!function(e){const t=new Set(n());o.forEach((n=>{(void 0===e||-1!==(null==e?void 0:e.findIndex((e=>t.has(e)||n.namespaces.has(e)))))&&n.fn({value:void 0})}))}(t?Array.from(t.keys()):void 0)}return Object.freeze({emit(n,t){e()&&(i.push(n),t?setTimeout(s,0):s())},listen(e){a.add(e);return{unsubscribe:()=>{a.delete(e)}}},listenSome(e){const n={fn:n=>{e(n)},namespaces:new Set};o.add(n);const a={unsubscribe:()=>{o.delete(n)},subscribeNs:e=>(r(e).forEach((e=>n.namespaces.add(e))),void 0===e&&n.namespaces.add(t()),a)};return a}})}const f=e=>{const n=new Map;return Object.entries(e).forEach((([e,t])=>{null!=t&&("object"!=typeof t?n.set(e,t):f(t).forEach(((t,a)=>{n.set(e+"."+a,t)})))})),n},p=e=>{const[n,...t]=e.split(":");return{language:n,namespace:t.join(":")||""}},v=({language:e,namespace:n})=>n?`${e}:${n}`:e;function h(e,n,t,a,o,i,l){const c=new Map,u=new Map;let g={},d=0;function h(n,t,a){const o=v(n);u.set(o,{data:f(t),version:a}),e.emit(n)}function m(e){let t;if(!t){const n=g[v(e)];"function"==typeof n&&(t=n())}return t||(t=n(e)),t}const b=Object.freeze({addStaticData(e){e&&(g=Object.assign(Object.assign({},g),e),Object.entries(e).forEach((([e,n])=>{if("function"!=typeof n){const t=p(e),a=u.get(e);a&&0!==a.version||h(t,n,0)}})))},invalidate(){c.clear(),d+=1},addRecord(e,n){h(e,n,d)},exists(e,n=!1){const t=u.get(v(e));return t&&n?t.version===d:Boolean(t)},getRecord(e){var n;return null===(n=u.get(v(a(e))))||void 0===n?void 0:n.data},getTranslation(e,n){var t;return null===(t=u.get(v(e)))||void 0===t?void 0:t.data.get(n)},getTranslationNs(e,n,t){var a;for(const o of e)for(const e of n){const n=null===(a=u.get(v({language:e,namespace:o})))||void 0===a?void 0:a.data.get(t);if(null!=n)return[o]}return s(e)},getTranslationFallback(e,n,t){var a;for(const o of e)for(const e of n){const n=null===(a=u.get(v({language:e,namespace:o})))||void 0===a?void 0:a.data.get(t);if(null!=n)return n}},changeTranslation(n,t,a){var o;const r=null===(o=u.get(v(n)))||void 0===o?void 0:o.data;null==r||r.set(t,a),e.emit(Object.assign(Object.assign({},n),{key:t}))},isFetching(e){if(o())return!0;if(void 0===e)return c.size>0;const n=r(e);return Boolean(Array.from(c.keys()).find((e=>n.includes(p(e).namespace))))},isLoading(e,n){const t=r(n);return Boolean(o()||Array.from(c.keys()).find((n=>{const a=p(n);return(!t.length||t.includes(a.namespace))&&!b.exists({namespace:a.namespace,language:e})})))},async loadRecords(e,n){const o=e.map((e=>{const o=a(e),r=v(o),i=c.get(r);if(i)return{new:!1,promise:i,keyObject:o,cacheKey:r};const s=function(e,n){var a;let o;return n&&(o=null===(a=t(e))||void 0===a?void 0:a.catch((()=>(console.warn("Tolgee: Failed to fetch data from dev backend"),m(e))))),o||(o=m(e)),o}(o,n)||Promise.resolve(void 0);return c.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,n)=>{const t=c.get(e.cacheKey)!==e.promise;if(e.new&&!t){c.delete(e.cacheKey);const t=r[n];t?b.addRecord(e.keyObject,t):b.getRecord(e.keyObject)||b.addRecord(e.keyObject,{})}})),i.notify(),l.notify(),o.map((e=>b.getRecord(e.keyObject)))},getAllRecords:()=>Array.from(u.entries()).map((([e,n])=>Object.assign(Object.assign({},p(e)),{data:n.data})))});return b}function m(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}const b="invalid",y={defaultNs:"",observerOptions:{tagAttributes:{textarea:["placeholder"],input:["value","placeholder"],img:["alt"],"*":["aria-label","title"]},restrictedElements:["script","style"],highlightKeys:["Alt"],highlightColor:"rgb(255, 0, 0)",highlightWidth:5,inputPrefix:"%-%tolgee:",inputSuffix:"%-%",passToParent:["option","optgroup"],fullKeyEncode:!1},observerType:"invisible",onFormatError:b,apiUrl:"https://app.tolgee.io",fetch:u(),onTranslationMissing:({key:e})=>e},E=(...e)=>{let n={};return e.forEach((e=>{n=Object.assign(Object.assign(Object.assign({},n),e),{observerOptions:Object.assign(Object.assign({},n.observerOptions),null==e?void 0:e.observerOptions)})})),n};function O(e,n){const t=E(y,null==n?void 0:n.initialOptions,e);return t.apiUrl=l(t.apiUrl),(null==e?void 0:e.fetch)&&(t.fetch=u(e.fetch)),{initialOptions:t,activeNamespaces:(null==n?void 0:n.activeNamespaces)||new Map,language:null==n?void 0:n.language,pendingLanguage:null==n?void 0:n.language,isInitialLoading:!1,isRunning:!1}}function L(e,a,o,r,i,s,l,c){const u={ui:void 0},g={formatters:[],finalFormatter:void 0,observer:void 0,devBackend:void 0,backends:[],ui:void 0,languageDetector:void 0,languageStorage:void 0},d=async({keysAndDefaults:e,event:n})=>{var t;const a=e.map((({key:e,ns:n,defaultValue:t})=>({key:e,defaultValue:t,fallbackNamespaces:r(n),namespace:i({key:e,ns:n})[0],translation:s({key:e,ns:n})})));null===(t=g.ui)||void 0===t||t.handleElementClick(a,n)},f=(e,n)=>{var t;return(null===(t=g.observer)||void 0===t?void 0:t.findPositions(e,n))||[]};function p(e){const n=s({key:e.key,ns:e.ns});return P.formatTranslation(Object.assign(Object.assign({},e),{translation:n,formatEnabled:!0}))}function v(){return{fetch:a().fetch}}function h(e){g.observer=null==e?void 0:e()}function y(){return Boolean(g.observer)}function E(e){e&&g.formatters.push(e)}function O(e){g.finalFormatter=e}function L(e){u.ui=e}function w(){return Boolean(u.ui)}function k(e){g.languageStorage=e}function j(e){g.languageDetector=e}function A(e){e&&g.backends.push(e)}function T(e){g.devBackend=e}const P=Object.freeze({addPlugin:function(e,n){n(e,Object.freeze({setFinalFormatter:O,addFormatter:E,setObserver:h,hasObserver:y,setUi:L,hasUi:w,setDevBackend:T,addBackend:A,setLanguageDetector:j,setLanguageStorage:k}))},run(){var e,n;const{apiKey:t,apiUrl:o,projectId:r,observerOptions:i}=a();g.ui=null===(e=u.ui)||void 0===e?void 0:e.call(u,{apiKey:t,apiUrl:o,projectId:r,highlight:P.highlight,changeTranslation:l,findPositions:f,onPermanentChange:c}),null===(n=g.observer)||void 0===n||n.run({mouseHighlight:!0,options:i,translate:p,onClick:d})},stop(){var e;g.ui=void 0,null===(e=g.observer)||void 0===e||e.stop()},getLanguageStorage:()=>g.languageStorage,getInitialLanguage(){var e;const n=o();return t(null===(e=g.languageStorage)||void 0===e?void 0:e.getLanguage(v()),(e=>n&&!n.includes(e)||!e?function(){if(!g.languageDetector)return;const e=o();return g.languageDetector.getLanguage(Object.assign({availableLanguages:e},v()))}():e))},setStoredLanguage(e){var n;null===(n=g.languageStorage)||void 0===n||n.setLanguage(e,v())},getDevBackend:()=>g.devBackend,getBackendRecord:({language:e,namespace:t})=>{for(const a of g.backends){const o=a.getRecord(Object.assign({language:e,namespace:t},v()));if(n(o))return null==o?void 0:o.catch((e=>(console.error(e),{})));if(void 0!==o)return o}},getBackendDevRecord:({language:e,namespace:n})=>{var t;const{apiKey:o,apiUrl:r,projectId:i}=a();return null===(t=g.devBackend)||void 0===t?void 0:t.getRecord(Object.assign({apiKey:o,apiUrl:r,projectId:i,language:e,namespace:n},v()))},getLanguageDetector:()=>g.languageDetector,retranslate(){var e;null===(e=g.observer)||void 0===e||e.retranslate()},highlight:(e,n)=>{var t,a;return(null===(a=null===(t=g.observer)||void 0===t?void 0:t.highlight)||void 0===a?void 0:a.call(t,e,n))||{unhighlight(){}}},unwrap(e){var n;return g.observer?null===(n=g.observer)||void 0===n?void 0:n.unwrap(e):{text:e,keys:[]}},wrap(e){var n;return g.observer?null===(n=g.observer)||void 0===n?void 0:n.wrap(e):e.translation},hasDevBackend:()=>Boolean(P.getDevBackend()),formatTranslation(n){var t,{formatEnabled:o}=n,r=m(n,["formatEnabled"]);const{key:i,translation:s,defaultValue:l,noWrap:c,params:u,ns:d,orEmpty:f}=r,p=null!=s?s:l;let v="";null==s&&(v=a().onTranslationMissing(r));let h=null!=p?p:f?"":v;const y=e(),E=o||!(null===(t=g.observer)||void 0===t?void 0:t.outputNotFormattable),O=e=>g.observer&&!c?g.observer.wrap({key:i,translation:e,defaultValue:l,params:u,ns:d}):e;h=O(h);try{if(p&&y&&E)for(const e of g.formatters)h=e.format({translation:h,language:y,params:u});g.finalFormatter&&p&&y&&E&&(h=g.finalFormatter.format({translation:h,language:y,params:u}))}catch(e){console.error(e);const n=("string"==typeof(L=e)?L:"string"==typeof(null==L?void 0:L.message)?L.message:void 0)||b,t=a().onFormatError,o=typeof t;h="string"===o?t:"function"===o?t(n,r):b,h=O(h)}var L;return h}});return P}const w=(e,n,t)=>{let a=e;return Object.freeze({init(e){a=e},notify(){const e=n();a!==e&&t(e),a=e}})};const k=(e,...n)=>{let t,a={};return"object"==typeof e?a=e:(a.key=e,"string"==typeof n[0]?(a.defaultValue=n[0],t=n[1]):"object"==typeof n[0]&&(t=n[0])),t&&(a=Object.assign(Object.assign({},function(e){var{ns:n,noWrap:t,orEmpty:a,params:o,language:r}=e,i=m(e,["ns","noWrap","orEmpty","params","language"]);const s={ns:n,noWrap:t,orEmpty:a,language:r};return Object.assign(Object.assign({},s),{params:Object.assign({},i)})}(t)),a)),a};function j({options:e}){const o=function(e,n){let t=!0;function a(){return t}const o=Object.freeze({onPendingLanguageChange:g(a),onLanguageChange:g(a),onLoadingChange:g(a),onFetchingChange:g(a),onInitialLoaded:g(a),onRunningChange:g(a),onCacheChange:g(a),onUpdate:d(a,e,n),onPermanentChange:g(a),setEmitterActive(e){t=e},on:(e,n)=>{switch(e){case"pendingLanguage":return o.onPendingLanguageChange.listen(n);case"language":return o.onLanguageChange.listen(n);case"loading":return o.onLoadingChange.listen(n);case"fetching":return o.onFetchingChange.listen(n);case"initialLoad":return o.onInitialLoaded.listen(n);case"running":return o.onRunningChange.listen(n);case"cache":return o.onCacheChange.listen(n);case"update":return o.onUpdate.listen(n);case"permanentChange":return o.onPermanentChange.listen(n)}}});return o.onInitialLoaded.listen((()=>o.onUpdate.emit())),o.onLanguageChange.listen((()=>o.onUpdate.emit())),o.onCacheChange.listen((({value:e})=>o.onUpdate.emit([e.namespace],!0))),o}(y,E),c=w(!1,(()=>m.isFetching()),o.onFetchingChange.emit),u=w(!1,(()=>C.isLoading()),o.onLoadingChange.emit),f=function(e,n,t){let a,o=O();const c=Object.freeze({init(e){o=O(e,o)},isRunning:()=>o.isRunning,setRunning(e){o.isRunning!==e&&(o.isRunning=e,t.emit(e))},isInitialLoading:()=>o.isInitialLoading,setInitialLoading(e){o.isInitialLoading=e},getLanguage:()=>o.language||o.initialOptions.language,setLanguage(n){o.language!==n&&(o.language=n,e.emit(n))},getPendingLanguage:()=>o.pendingLanguage||c.getLanguage(),setPendingLanguage(e){o.pendingLanguage!==e&&(o.pendingLanguage=e,n.emit(e))},getInitialOptions:()=>Object.assign(Object.assign({},o.initialOptions),a),addActiveNs(e){r(e).forEach((e=>{const n=o.activeNamespaces.get(e);void 0!==n?o.activeNamespaces.set(e,n+1):o.activeNamespaces.set(e,1)}))},removeActiveNs(e){r(e).forEach((e=>{const n=o.activeNamespaces.get(e);void 0!==n&&n>1?o.activeNamespaces.set(e,n-1):o.activeNamespaces.delete(e)}))},getRequiredNamespaces:()=>s([...o.initialOptions.ns||[o.initialOptions.defaultNs],...r(o.initialOptions.fallbackNs),...o.activeNamespaces.keys()]),getFallbackLangs(e){const n=e||c.getLanguage();return n?s([n,...i(n,o.initialOptions.fallbackLanguage)]):[]},getFallbackNs:()=>r(o.initialOptions.fallbackNs),getDefaultNs:e=>void 0===e?o.initialOptions.defaultNs:e,getAvailableLanguages(){if(o.initialOptions.availableLanguages)return o.initialOptions.availableLanguages;if(o.initialOptions.staticData){const e=Object.keys(o.initialOptions.staticData).map((e=>p(e).language));return Array.from(new Set(e))}},withDefaultNs:e=>({namespace:void 0===e.namespace?c.getInitialOptions().defaultNs:e.namespace,language:e.language}),overrideCredentials(e){a=e?Object.assign(Object.assign({},e),{apiUrl:l(e.apiUrl)}):void 0}});return c}(o.onLanguageChange,o.onPendingLanguageChange,o.onRunningChange),v=L(f.getLanguage,f.getInitialOptions,f.getAvailableLanguages,j,N,R,T,(function(e){o.onPermanentChange.emit({key:e.key,namespace:e.namespace})})),m=h(o.onCacheChange,v.getBackendRecord,v.getBackendDevRecord,f.withDefaultNs,f.isInitialLoading,c,u);let b;function y(){return f.getFallbackNs()}function E(e){return f.getDefaultNs(e)}function j(e){return[...r(E(e)),...y()]}function A(e){return[...r(null!=e?e:E()),...f.getRequiredNamespaces()]}function T(e,n,t){const a=f.withDefaultNs(e),o=m.getTranslation(a,n);return m.changeTranslation(a,n,t),{revert(){m.changeTranslation(a,n,o)}}}function P(e){f.init(e),m.addStaticData(f.getInitialOptions().staticData)}function x(e,n){const a=function(e,n){const t=f.getFallbackLangs(e),a=A(n),o=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n},!0)||o.push({language:e,namespace:n})}))})),o}(e,n);if(a.length)return t(C.loadRecords(a),(()=>{}))}function N({key:e,ns:n}){const t=f.getFallbackLangs(),a=j(null!=n?n:void 0);return m.getTranslationNs(a,t,e)}function R({key:e,ns:n,language:t}){const a=j(null!=n?n:void 0),o=f.getFallbackLangs(t);return m.getTranslationFallback(a,o,e)}function S(){const e=t(function(){if(f.getLanguage())return;return t(v.getInitialLanguage(),(e=>{const n=e||f.getInitialOptions().defaultLanguage;n&&f.setLanguage(n)}))}(),(()=>x()));if(n(e))return f.setInitialLoading(!0),c.notify(),u.notify(),Promise.resolve(e).then((()=>{f.setInitialLoading(!1),c.notify(),u.notify(),o.onInitialLoaded.emit()}));o.onInitialLoaded.emit()}e&&P(e),o.onUpdate.listen((()=>{f.isRunning()&&v.retranslate()}));const C=Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),f),v),m),{init:P,getTranslation:R,changeTranslation:T,getTranslationNs:N,getDefaultAndFallbackNs:j,async changeLanguage(e){f.getPendingLanguage()===e&&f.getLanguage()===e||(f.setPendingLanguage(e),f.isRunning()&&await x(e),e===f.getPendingLanguage()&&(f.setLanguage(e),v.setStoredLanguage(e)))},async addActiveNs(e,n){n||f.addActiveNs(e),f.isRunning()&&await x(void 0,e)},loadRecords:e=>m.loadRecords(e,C.isDev()),loadRecord:async e=>(await C.loadRecords([e]))[0],isLoading:e=>m.isLoading(f.getLanguage(),e),isLoaded(e){const n=f.getLanguage();if(!n)return!1;const t=f.getFallbackLangs(n),a=A(e),o=[];return t.forEach((e=>{a.forEach((n=>{m.exists({language:e,namespace:n})||o.push({language:e,namespace:n})}))})),0===o.length},t:(...e)=>{const n=k(...e),t=R(n);return v.formatTranslation(Object.assign(Object.assign({},n),{translation:t}))},isDev:()=>Boolean(f.getInitialOptions().apiKey&&f.getInitialOptions().apiUrl),run:()=>(function(){if((v.getLanguageDetector()||v.getLanguageStorage())&&!f.getAvailableLanguages())throw new Error(a("availableLanguages"));if(!f.getLanguage()&&!f.getInitialOptions().defaultLanguage)throw new Error(a(["defaultLanguage","language"]))}(),f.isRunning()||(f.setRunning(!0),v.run(),b=S()),Promise.resolve(b)),stop(){f.isRunning()&&(v.stop(),f.setRunning(!1))}}));return C}const A=()=>{const e={plugins:[],options:{}},n=Object.freeze({use:t=>(e.plugins.push(t),n),updateDefaults:t=>(e.options=E(e.options,t),n),init(n){const t=function(e){const n=j({options:e});function t(e){const t=n.isRunning();t&&n.stop(),e(),n.isDev()&&n.invalidate(),t&&n.run()}n.isDev()&&n.invalidate();const a=Object.freeze({on:n.on,onNsUpdate:n.onUpdate.listenSome,setEmitterActive:n.setEmitterActive,getLanguage:n.getLanguage,getPendingLanguage:n.getPendingLanguage,changeLanguage:n.changeLanguage,changeTranslation:n.changeTranslation,addActiveNs:n.addActiveNs,removeActiveNs:n.removeActiveNs,loadRecords:n.loadRecords,loadRecord:n.loadRecord,addStaticData:n.addStaticData,getRecord:n.getRecord,getAllRecords:n.getAllRecords,isLoaded:n.isLoaded,isInitialLoading:n.isInitialLoading,isLoading:n.isLoading,isFetching:n.isFetching,isRunning:n.isRunning,run:n.run,stop:n.stop,t:n.t,highlight:n.highlight,getInitialOptions:n.getInitialOptions,isDev:n.isDev,wrap:n.wrap,unwrap:n.unwrap,overrideCredentials(e){t((()=>n.overrideCredentials(e)))},addPlugin(e){e&&t((()=>n.addPlugin(a,e)))},updateOptions(e){e&&t((()=>n.init(e)))}});return a}(E(e.options,n));return e.plugins.forEach(t.addPlugin),t}});return n},T=0,P=1,x=2;class N extends Error{constructor(e,n,t){let a;a=e===T?"Empty parameter":e===P?"Unexpected character":"Unexpected end",super(`Tolgee parser: ${a} at ${n} in "${t}"`),this.code=e,this.index=n}}function R(e){return/\s/.test(e)}const S=0,C=1,D=2,I=3,$=4,_=new Set([D,C,S]),U="'",F=new Set(["{","}",U]),M=e=>/[0-9a-zA-Z_]/.test(e);function B(e,n){const[t,a]=function(e){let n=S,t="",a="",o="";const r=[],i=[];let s=0;function l(n){throw new N(n,s,e)}const c=()=>{r.push(t),t=""},u=()=>{""===a&&l(T),i.push(a),a=""};for(s=0;s<e.length;s++)switch(o=e[s],n){case S:o===U?(t+=o,n=C):"{"===o?(c(),n=I):(t+=o,n=S);break;case C:F.has(o)?(t=t.slice(0,-1)+o,n=D):(t+=o,n=S);break;case D:o===U?n=S:(t+=o,n=D);break;case I:"}"===o?(u(),n=S):R(o)?""!==a&&(u(),n=$):(M(o)||l(P),a+=o,n=I);break;case $:"}"==o?n=S:R(o)?n=$:l(P)}return _.has(n)||l(x),c(),[r,i]}(e),o=[t[0]];for(let r=1;r<t.length;r++){const i=null==n?void 0:n[a[r-1]];if(void 0===i)throw new Error(`Missing parameter "${a[r-1]}" in "${e}"`);o.push(String(i)),o.push(t[r])}return o.join("")}const K="__tolgee_dev_tools",V="data-tolgee-key-only",z="data-tolgee-restricted",Y="_tolgee",G="_tolgee-highlighter";function W(){var e,n;return void 0===(null===(n=null===(e=globalThis.window)||void 0===e?void 0:e.document)||void 0===n?void 0:n.createElement)}function X(e){if(W())throw new Error(`${e}: Can't run on the server`)}function H(e,n){return{oldTextContent:e,keys:n}}const J={pointerEvents:"none",position:"fixed",boxSizing:"content-box",zIndex:String(Number.MAX_SAFE_INTEGER),contain:"layout",display:"block",borderStyle:"solid",borderRadius:"4px"};function q({highlightColor:e,highlightWidth:n}){return Object.freeze({initHighlighter(t,a){!function(t,a){a.highlight=()=>{if(!t.isConnected)return;let o=a.highlightEl;o||(o=document.createElement("div"),o.classList.add(G),Object.entries(J).forEach((([e,n])=>{o.style[e]=n})),o.style.borderColor=e,a.highlightEl=o,document.body.appendChild(o));const r=t.getBoundingClientRect();o.style.borderWidth=n+"px",o.style.top=r.top-n+"px",o.style.left=r.left-n+"px",o.style.width=r.width+"px",o.style.height=r.height+"px"}}(t,a),function(e,n){n.unhighlight=()=>{var e;null===(e=n.highlightEl)||void 0===e||e.remove(),n.highlightEl=void 0}}(0,a)}})}function Z(e,n){var t;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}}(n),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===(t=null==r?void 0:r.iterateNext)||void 0===t?void 0:t.call(r);)o.push(i);return o}function Q(e){return e.textContent}function ee(e,n){e.textContent=n}function ne(e,n){if(e.contains(n))return!0;if(n instanceof Attr){const t=n.ownerElement&&Object.values(n.ownerElement.attributes).indexOf(n)>-1;if(e.contains(n.ownerElement)&&t)return!0}return!1}function te(e,n){var t;const a=void 0===e.key||void 0===n.key||n.key===e.key,o=void 0===e.ns||void 0===n.ns||-1!==(null===(t=e.ns)||void 0===t?void 0:t.findIndex((e=>{var t;return null===(t=n.ns)||void 0===t?void 0:t.includes(e)})));return a&&o}const ae={capture:!0},oe={capture:!0,passive:!0};function re({highlightKeys:e,elementStore:n,onClick:t,options:a}){var o,r;let i,s,l=new Set;const c=(null===(o=a.targetElement)||void 0===o?void 0:o.getRootNode())||document,u=(null===(r=a.targetElement)||void 0===r?void 0:r.ownerDocument)||document;function g(){var e;const t=n.get(i);t&&(t.preventClean=!1,null===(e=t.unhighlight)||void 0===e||e.call(t),i=void 0)}function d(){const e=s;let t;if(e&&O()){const a=c.elementFromPoint(e.x,e.y);a&&(t=function(e){return E(e,(e=>n.get(e)))}(a))}!function(e){var t;if(i!==e){g();const a=n.get(e);a&&(a.preventClean=!0,null===(t=a.highlight)||void 0===t||t.call(a),i=e)}}(t)}function f(e){var n;O()&&(n=e.target,!Boolean(E(n,(e=>e.id===K))))&&(e.stopPropagation(),e.preventDefault())}function p(e){var n;n={x:e.clientX,y:e.clientY},s=n,d()}function v(){l=new Set,d()}function h(e){const n=e.key;void 0!==n&&l.add(n),d()}function m(e){l.delete(e.key),d()}function b(){var e;const t=n.get(i);null===(e=null==t?void 0:t.highlight)||void 0===e||e.call(t)}function y(e){f(e),O()&&i&&(t(e,i),g())}function E(e,n){return n(e)?e:(null==e?void 0:e.parentElement)?E(e.parentElement,n):void 0}function O(){for(const n of e)if(!l.has(n))return!1;return!0}return Object.freeze({stop(){u.removeEventListener("blur",v,ae),u.removeEventListener("keydown",h,ae),u.removeEventListener("keyup",m,ae),u.removeEventListener("mousemove",p,oe),u.removeEventListener("scroll",b,oe),u.removeEventListener("click",y,ae),u.removeEventListener("mouseenter",f,ae),u.removeEventListener("mouseover",f,ae),u.removeEventListener("mouseout",f,ae),u.removeEventListener("mouseleave",f,ae),u.removeEventListener("mousedown",f,ae),u.removeEventListener("mouseup",f,ae)},run(){u.addEventListener("blur",v,ae),u.addEventListener("keydown",h,ae),u.addEventListener("keyup",m,ae),u.addEventListener("mousemove",p,oe),u.addEventListener("scroll",b,oe),u.addEventListener("click",y,ae),u.addEventListener("mouseenter",f,ae),u.addEventListener("mouseover",f,ae),u.addEventListener("mouseout",f,ae),u.addEventListener("mouseleave",f,ae),u.addEventListener("mousedown",f,ae),u.addEventListener("mouseup",f,ae)}})}function ie(e,n,t){const a=q({highlightColor:e.highlightColor,highlightWidth:e.highlightWidth}),r=re({highlightKeys:e.highlightKeys,elementStore:n,onClick(e,a){const o=n.get(a);t({event:e,keysAndDefaults:l(o)})},options:e});function i(e){e.nodes=new Map(function*(e){for(const[n,t]of e.nodes.entries())ne(s(),n)&&(yield[n,t])}(e))}function s(){return e.targetElement||document.body}function l(e){return function(e){return Array.from(e.nodes.values()).reduce(((e,n)=>[...e,...n.keys.map((e=>({key:e.key,defaultValue:e.defaultValue,ns:e.ns})))]),[])}(e)}return Object.freeze({register(t,o,r){if(function(n){return-1!==e.restrictedElements.indexOf(n.tagName.toLowerCase())||null!==n.closest(`[${z}]`)}(t))return;const i=t;let s=n.get(i);s||(s=function(e){return{element:e,nodes:new Map}}(i),n.set(i,s),i.setAttribute(Y,"true")),s.nodes.set(o,r),a.initHighlighter(i,s)},forEachElement:n.forEachElement,refreshAll(){n.forEachElement(((e,t)=>{t.preventClean||(i(t),0===t.nodes.size&&function(e,t){var a;t.highlightEl&&(null===(a=t.unhighlight)||void 0===a||a.call(t)),e.removeAttribute(Y),n.remove(e)}(e,t))}))},findAll(e,t){const a=[];return n.forEachElement(((n,r)=>{for(const n of r.nodes.values()){if(n.keys.find((n=>te({key:e,ns:o(t)},{key:n.key,ns:o(n.ns)})))){a.push(r);break}}})),a},run(e){e&&r.run()},stop(){r.stop(),n.forEachElement(((e,n)=>{var t;n.highlightEl&&(null===(t=n.unhighlight)||void 0===t||t.call(n))}))}})}function se(){let e,n=!1;const t=function(){const e=new Map;return Object.freeze({set(n,t){e.set(n,t)},get:n=>n&&e.get(n),remove:n=>e.delete(n),forEachElement(n){e.forEach(((e,t)=>n(t,e)))}})}();function a({mouseHighlight:e,options:a,wrapper:o,onClick:r}){if(W())return{stop(){n=!1},wrapper:o};const i=function(e){const n=Object.freeze({getSuitableParent(t){const a=function(e){return e.parentElement?e.parentElement:e.ownerElement&&e.ownerElement||void 0}(t);if(void 0===a)throw console.error(t),new Error("No suitable parent found for node above.");if(!e.passToParent)return a;if(Array.isArray(e.passToParent)){const n=e=>a.tagName.toLowerCase()===e.toLowerCase();if(-1===e.passToParent.findIndex(n))return a}return"function"!=typeof e.passToParent||e.passToParent(a)?n.getSuitableParent(a):a}});return n}(a),s=function(e,n){const t=Object.freeze({handleAttributes(t){let a=[];for(const[o,r]of Object.entries(e.tagAttributes))for(const e of r){const r=Z(n.getAttributeXPath({tag:o,attribute:e}),t);a=[...a,...r]}return a},handleChildList(e){let n=[];return n=n.concat(t.handleAttributes(e)),n=n.concat(t.handleText(e)),n},handleText:e=>Z(n.getTextXPath(),e)});return t}(a,o),l=ie(a,t,r);function c(e){for(const n of e){const e=Q(n),t=e?o.unwrap(e):null;if(t){const{text:a,keys:o}=t;ee(n,a);const r=H(e,o),s=i.getSuitableParent(n);l.register(s,n,r)}}}function u(e){Z(`./descendant-or-self::*[@${V}]`,e).forEach((e=>{const n=e.getAttributeNode(V),t=i.getSuitableParent(n);l.register(t,n,{oldTextContent:"",keys:[{key:Q(n)}],keyAttributeOnly:!0})}))}const g=new MutationObserver((e=>{if(n){for(const n of e){let e=[];switch(n.type){case"characterData":e=s.handleText(n.target);break;case"childList":u(n.target),e=s.handleChildList(n.target);break;case"attributes":u(n.target),e=s.handleAttributes(n.target)}c(e)}l.refreshAll()}})),d=a.targetElement||document.body;return n=!0,l.run(e),u(d),c(s.handleChildList(d)),g.observe(d,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),{stop(){n=!1,l.stop(),g.disconnect()},elementRegistry:l,wrapper:o}}return Object.freeze({run(n){e=a(n)},stop(){null==e||e.stop()},forEachElement(n){var t,a;null===(a=null===(t=null==e?void 0:e.elementRegistry)||void 0===t?void 0:t.forEachElement)||void 0===a||a.call(t,n)},highlight(n,t){var a;const o=(null===(a=null==e?void 0:e.elementRegistry)||void 0===a?void 0:a.findAll(n,t))||[];return o.forEach((e=>{var n;return null===(n=e.highlight)||void 0===n?void 0:n.call(e)})),{unhighlight(){o.forEach((e=>{var n;return null===(n=e.unhighlight)||void 0===n?void 0:n.call(e)}))}}},findPositions(n,t){var a;const r=(null===(a=null==e?void 0:e.elementRegistry)||void 0===a?void 0:a.findAll(n,t))||[],i=[];return r.sort(((e,n)=>e.element.compareDocumentPosition(n.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)),r.forEach((e=>{const a=e.element.getBoundingClientRect();e.nodes.forEach((e=>{e.keys.forEach((e=>{te({key:n,ns:o(t)},{key:e.key,ns:o(e.ns)})&&i.push({position:{x:a.x,y:a.y,width:a.width,height:a.height},keyName:e.key,keyNamespace:e.ns||""})}))}))})),i},unwrap:n=>e?e.wrapper.unwrap(n):{text:n,keys:[]},wrap:n=>e?e.wrapper.wrap(n):n.translation||""})}const le=["",""],ce=RegExp(`([${le.join("")}]{9})+`,"gu");function ue(e){const n=function(e){return Array.from((new TextEncoder).encode(e))}(e).map(Number),t=n.map((e=>function(e){const n=8-e.length;return"0".repeat(n)+e}(e.toString(2))+"0")).join("");return Array.from(t).map((e=>le[Number(e)])).join("")}function ge(e){const n=Array.from(e).map((e=>le.indexOf(e))).map(String).join("").match(/(.{9})/g),t=Uint8Array.from((null==n?void 0:n.map((e=>parseInt(e.slice(0,8),2))))||[]);return a=t,(new TextDecoder).decode(new Uint8Array(a));var a}function de({fullKeyEncode:e}){const n=function(){const e=[];return Object.freeze({valueToNumber(n){let t=e.indexOf(n);return-1===t&&(t=e.length,e.push(n)),t},numberToValue:n=>e[n]})}();function t(e){const n={k:e.key,n:e.ns||void 0,d:e.defaultValue};return JSON.stringify(n)}return Object.freeze({unwrap(e){const t=[],a=function(e){var n;const t=null===(n=e.match(ce))||void 0===n?void 0:n.filter((e=>e.length>8));return(null==t?void 0:t.map(ge))||[]}(e);a.forEach((e=>{const a=function(e){if(e.length<=4){const[t]=function(e){const n=[];for(const t of e)n.push(t.codePointAt(0));return n}(e);return n.numberToValue(t)}return e}(e),o=function(e){try{return JSON.parse(e||"{}")}catch(e){return void console.error(e)}}(a);if(o){const{k:e,d:n,n:a}=o;t.push({key:e,defaultValue:n,ns:a})}}));const o=function(e){return e.replace(ce,"")}(e);return{text:o,keys:t}},wrap({key:a,defaultValue:o,translation:r,ns:i}){let s;if(e){s=ue(t({key:a,ns:i}))}else{const e=t({key:a,ns:i,defaultValue:o}),r=n.valueToNumber(e);s=ue(String.fromCodePoint(r))}const l=r||"";return"string"==typeof l?l+s:l},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${le[0]}${le[0]}') or contains(., '${le[1]}${le[0]}')]`,getAttributeXPath:({tag:e,attribute:n})=>`descendant-or-self::${e}/@${n}[contains(., '${le[0]}${le[0]}') or contains(., '${le[1]}${le[0]}')]`})}function fe(e,n){let t=0;for(;e>-1&&"\\"===n[e-1];)t++,e--;return t%2==1}function pe({inputPrefix:e,inputSuffix:n,translate:t}){function a(e){const{key:n,params:a,defaultValue:o,ns:r}=function(e){let n=!1,t="",a="",o="KEY";const r={key:"",ns:void 0,params:{},defaultValue:void 0},i=e=>{r.ns=e};for(const s of e)"\\"!==s||n?n?(n=!1,t+=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?t+=s:(o="PARAM_NAME",r.params[a]=t,t=""):(o="PARAM_VALUE",a=t,t=""):(o="PARAM_NAME",r.defaultValue=t,t=""):(o="PARAM_NAME",r.key=t,t=""):(o="DEFAULT_VALUE",i(t),t=""):(o="NAMESPACE",r.key=t,t=""):(o="DEFAULT_VALUE",r.key=t,t=""):n=!0;return"KEY"===o&&(r.key=t),"DEFAULT_VALUE"===o&&(r.defaultValue=t),"PARAM_VALUE"===o&&(r.params[a]=t),"NAMESPACE"===o&&i(t),r}(e);return{translated:t({key:n,params:a,defaultValue:o,ns:r,noWrap:!0}),key:n,params:a,defaultValue:o,ns:r}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(e){return"string"==typeof e?e.replace(/[,:|\\]/gs,"\\$&"):"number"==typeof e||"bigint"==typeof e?e.toString():(console.warn(`Parameters of type "${typeof e}" are not supported in "text" wrapper mode.`),e)}return Object.freeze({wrap({key:t,params:a,defaultValue:o,ns:i}){let s=Object.entries(a||{}).map((([e,n])=>`${r(e)}:${r(n)}`)).join(",");s=s.length?`:${s}`:"";const l=void 0!==o?`,${r(o)}`:"",c="string"==typeof i?[i]:i,u=(null==c?void 0:c.length)?`|${c.map((e=>r(e))).join("|")}`:"";return`${e}${r(t)}${u}${l}${s}${n}`},unwrap(t){const r=new RegExp(`(\\\\?)(${o(e)}(.*?)${o(n)})`,"gs"),i=[];let s,l=!1,c=0,u="";for(;null!==(s=r.exec(t));){let e=s[1];const[n,o,r,g]=s,{index:d,input:f}=s;if(u+=f.substr(c,d-c),c=d+n.length,"\\"===e){if(!fe(d,t)){u+=r;continue}e=""}const p=a(g);i.push({key:p.key,params:p.params,defaultValue:p.defaultValue,ns:p.ns}),l=!0,u+=e+p.translated}return u+=t.substring(c),l?{text:u,keys:i}:{text:t,keys:[]}},getTextXPath:()=>`./descendant-or-self::text()[contains(., '${e}') and contains(., '${n}')]`,getAttributeXPath:({tag:t,attribute:a})=>`descendant-or-self::${t}/@${a}[contains(., '${e}') and contains(., '${n}')]`})}const ve="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function he(e){const n=ve.indexOf(e);if(-1===n)throw new Error("Invalid character found: "+e);return n}function me(e){const n=(e=e.toUpperCase()).length;let t=0,a=0,o=0;const r=new Uint8Array(5*n/8|0);for(let i=0;i<n;i++)a=a<<5|he(e[i]),t+=5,t>=8&&(r[o++]=a>>>t-8&255,t-=8);return function(e){const n=new Uint8Array(e),t=n.length;let a="",o=Math.pow(2,16)-1;for(let e=0;e<t;e+=o)e+o>t&&(o=t-e),a+=String.fromCharCode.apply(null,n.subarray(e,e+o));return a}(r.buffer)}function be(e){if(e)try{const[n,t]=e.split("_");if("tgpak"===n){const[e]=me(t).split("_");return Number(e)}}catch(e){console.warn("Tolgee: Api key can't be parsed")}}function ye({message:e,recievingMessage:n,data:t,attempts:a=1}){let o=!1;const r=()=>new Promise(((a,o)=>{const r=function(e,n){const t=t=>{var a,o;e.includes(null===(a=t.data)||void 0===a?void 0:a.type)&&n(null===(o=t.data)||void 0===o?void 0:o.data)};return window.addEventListener("message",t,!1),{unsubscribe(){window.removeEventListener("message",t)}}}(n,(function(e){clearTimeout(i),s(),a(e)}));window.postMessage({type:e,data:t},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 ${n.join(" or ")} in time.`;return new Promise((()=>{}))})()}}const Ee="tolgee-in-context-tools.umd.min.js",Oe="@tolgee/in-context-tools",Le="InContextTools",we="https://cdn.jsdelivr.net/npm";let ke=null;function je(e){var n;return ke||(ke=(n=`${we}/@tolgee/web@${e}/dist/${Ee}`,new Promise(((e,t)=>{const a=document.createElement("script");a.src=n,a.addEventListener("load",(()=>e())),a.addEventListener("error",(e=>t(e.error))),document.body.appendChild(a)}))).then((()=>window[Oe][Le]))),ke}const Ae="__tolgee_apiKey",Te="__tolgee_apiUrl";function Pe(){const e=sessionStorage.getItem(Ae)||void 0,n=sessionStorage.getItem(Te)||void 0;if(e&&n)return{apiKey:e,apiUrl:n}}function xe(){sessionStorage.removeItem(Ae),sessionStorage.removeItem(Te)}e.BrowserExtensionPlugin=()=>e=>e;(()=>{if("undefined"==typeof window)return!1;try{return"undefined"!=typeof sessionStorage&&sessionStorage}catch(e){return console.error("sessionStorage not available",e),!1}})()&&(e.BrowserExtensionPlugin=()=>e=>{const n=function(){let e;return{update:async function(n){null==e||e();const{cancel:t,promise:a}=ye({message:"TOLGEE_READY",recievingMessage:["TOLGEE_PLUGIN_READY","TOLGEE_PLUGIN_UPDATED"],data:n,attempts:4});return e=t,a}}}();e.on("running",(({value:t})=>{var a;t&&(a=()=>{n.update({uiPresent:!0,uiVersion:void 0,mode:e.isDev()?"development":"production",config:{apiUrl:e.getInitialOptions().apiUrl||"",apiKey:e.getInitialOptions().apiKey||""}}).catch(xe)},"loading"!==document.readyState?Promise.resolve().then((()=>{a()})):document.addEventListener&&document.addEventListener("DOMContentLoaded",a))}));return Pe()&&(async()=>{const e=await je("5.13.3-prerelease.5f76277d.0");return n=>{const t=Pe();return n.addPlugin(e({credentials:t})),n}})().then((n=>{e.addPlugin(n)})).catch((e=>{console.error("Tolgee: Failed to load in-context tools"),console.error(e)})),e});const Ne="__tolgee_currentLanguage";function Re(e){return e.endsWith("/")?e.slice(0,-1):e}const Se={prefix:"/i18n",getPath:({namespace:e,language:n,prefix:t})=>e?`${Re(t)}/${e}/${n}.json`:`${Re(t)}/${n}.json`,getData:function(e){return e.json()},headers:{Accept:"application/json"}};function Ce(e){const n=Object.assign(Object.assign(Object.assign({},Se),e),{headers:Object.assign(Object.assign({},Se.headers),null==e?void 0:e.headers)}),{prefix:t,getPath:a,getData:o,headers:r}=n,i=function(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}(n,["prefix","getPath","getData","headers"]);return{getRecord:({namespace:e,language:n,fetch:s})=>s(a({namespace:e,language:n,prefix:t}),Object.assign({headers:r},i)).then((e=>{if(!e.ok)throw new Error(`${e.url} ${e.status}`);return o(e)}))}}e.BackendFetch=e=>(n,t)=>(t.addBackend(Ce(e)),n),e.DEVTOOLS_ID=K,e.DevBackend=()=>(e,n)=>(n.setDevBackend({getRecord({apiUrl:e,apiKey:n,language:t,namespace:a,projectId:o,fetch:r}){var i;const s=null!==(i=be(n))&&void 0!==i?i:o;let l=void 0!==s?`${e}/v2/projects/${s}/translations/${t}`:`${e}/v2/projects/translations/${t}`;if(a&&(l+=`?ns=${a}`),"tgpat"===function(e){if(!e)return;const[n]=e.split("_");return"tgpak"===n?"tgpak":"tgpat"===n?"tgpat":"legacy"}(n)&&void 0===o)throw new Error("You need to specify 'projectId' when using PAT key");return r(l,{headers:{"X-API-Key":n||"","Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>e[t]));throw new Error(e.statusText)}))}}),e),e.DevTools=()=>e=>e,e.FormatSimple=()=>(e,n)=>(n.setFinalFormatter({format:({translation:e,params:n})=>B(e,n)}),e),e.LanguageDetector=()=>(e,n)=>(n.setLanguageDetector({getLanguage({availableLanguages:e}){X("LanguageDetector");const n=window.navigator.language,t=e.find((e=>e===n));if(t)return t;const a=e=>e.replace(/^(.+?)(-.*)?$/,"$1"),o=a(window.navigator.language);return e.find((e=>a(e)===o))||void 0}}),e),e.LanguageStorage=()=>(e,n)=>(n.setLanguageStorage({getLanguage:()=>(X("LanguageStorage"),localStorage.getItem(Ne)||void 0),setLanguage(e){X("LanguageStorage"),localStorage.setItem(Ne,e)}}),e),e.ObserverPlugin=()=>(e,n)=>("text"===e.getInitialOptions().observerType?n.setObserver((()=>{const e=se();return Object.freeze(Object.assign(Object.assign({},e),{run(n){const t=pe({inputPrefix:n.options.inputPrefix,inputSuffix:n.options.inputSuffix,translate:n.translate});e.run(Object.assign(Object.assign({},n),{wrapper:t}))},retranslate(){e.forEachElement(((n,t)=>{for(const[n,a]of t.nodes.entries()){if(a.keyAttributeOnly)return;const t=e.unwrap(a.oldTextContent);t&&ee(n,t.text)}}))},outputNotFormattable:!0}))})):n.setObserver((()=>{const e=se();return Object.freeze(Object.assign(Object.assign({},e),{run(n){const t=de({fullKeyEncode:n.options.fullKeyEncode});e.run(Object.assign(Object.assign({},n),{wrapper:t}))},retranslate(){},outputNotFormattable:!1}))})),e),e.PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY="__tolgee_preferredLanguages",e.TOLGEE_ATTRIBUTE_NAME=Y,e.TOLGEE_RESTRICT_ATTRIBUTE=z,e.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE=V,e.Tolgee=function(){return A().use(e.BrowserExtensionPlugin())},e.TolgeeCore=A,e.createFetchFunction=u,e.getFallback=o,e.getFallbackArray=r,e.getProjectIdFromApiKey=be,e.getTranslateProps=k,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=tolgee-web.production.umd.min.js.map |
{ | ||
"name": "@tolgee/web", | ||
"version": "5.13.2", | ||
"version": "5.13.3-prerelease.5f76277d.0", | ||
"description": "Tolgee for web", | ||
@@ -53,3 +53,3 @@ "declaration": true, | ||
"dependencies": { | ||
"@tolgee/core": "5.13.2" | ||
"@tolgee/core": "5.13.3-prerelease.5f76277d.0" | ||
}, | ||
@@ -108,3 +108,3 @@ "devDependencies": { | ||
"homepage": "https://github.com/tolgee/tolgee-js#readme", | ||
"gitHead": "371ae52d07b536741fa04112fec18b990bf48f33", | ||
"gitHead": "81b71e89bab87f79ac3dab17c8e2fe0b73be5754", | ||
"publishConfig": { | ||
@@ -111,0 +111,0 @@ "access": "public" |
@@ -8,3 +8,2 @@ import { DEVTOOLS_ID } from '../constants'; | ||
rootElement.id = DEVTOOLS_ID; | ||
rootElement.attachShadow({ mode: 'open' }); | ||
rootElement.style.height = '0px'; | ||
@@ -14,3 +13,7 @@ rootElement.style.overflow = 'hidden'; | ||
} | ||
if (!rootElement.shadowRoot) { | ||
rootElement.attachShadow({ mode: 'open' }); | ||
} | ||
return rootElement.shadowRoot!; | ||
} |
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 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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52556670
254642
1
+ Added@tolgee/core@5.13.3-prerelease.5f76277d.0(transitive)
- Removed@tolgee/core@5.13.2(transitive)