@openbuddy/cli 1.0.41 → 1.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +21 -17
  2. package/package.json +9 -9
  3. package/web/dist/assets/AssistantsView-Ct3BBpYf.js +1 -0
  4. package/web/dist/assets/AutomationView-CO-jVhee.js +3 -0
  5. package/web/dist/assets/ChannelConfigView-Ct1W584x.js +8 -0
  6. package/web/dist/assets/ChartsView-CAc37Sam.js +1 -0
  7. package/web/dist/assets/ConnectorsView-DP4bbh58.js +1 -0
  8. package/web/dist/assets/FileTreeView-DwsYfssO.js +1 -0
  9. package/web/dist/assets/HookConfigView-uFsqieii.js +2 -0
  10. package/web/dist/assets/InputArea-BY8quOiH.js +14 -0
  11. package/web/dist/assets/MemoryView-Bgd_lcTf.js +1 -0
  12. package/web/dist/assets/{MessageBubble-CV16DZMG.js → MessageBubble-CVGXupVH.js} +20 -20
  13. package/web/dist/assets/ModelsView-B271UV9L.js +1 -0
  14. package/web/dist/assets/PluginsView-Dz4fqQR1.js +2 -0
  15. package/web/dist/assets/ProjectsView-DF-YCV8y.js +1 -0
  16. package/web/dist/assets/SessionGrid-BIREstN2.js +4 -0
  17. package/web/dist/assets/SettingsModal-ZJeoZcCd.js +4 -0
  18. package/web/dist/assets/SkillsView-CH2ghYL2.js +1 -0
  19. package/web/dist/assets/TemplatesTab-BGe7_67s.js +1 -0
  20. package/web/dist/assets/ThreadsView-XditIHZ4.js +2 -0
  21. package/web/dist/assets/ToolsView-BBzsFdVZ.js +1 -0
  22. package/web/dist/assets/{agentIconSet-Btsb_SC4.js → agentIconSet-B5GUQwel.js} +1 -1
  23. package/web/dist/assets/{api-CCt9DRQm.js → api-plEYhRn0.js} +1 -1
  24. package/web/dist/assets/common-Bbatsa0-.js +192 -0
  25. package/web/dist/assets/{icons-BvYhTENi.js → icons-CYDRRPKW.js} +1 -1
  26. package/web/dist/assets/index-CTbLW314.js +133 -0
  27. package/web/dist/assets/index-DdzVrZye.css +1 -0
  28. package/web/dist/assets/{markdown-DAQZeY5V.js → markdown-N5__3T-w.js} +1 -1
  29. package/web/dist/assets/{panels-DYiQiVWh.js → panels-CIPgN61N.js} +1 -1
  30. package/web/dist/assets/{react-vendor-BlngCquv.js → react-vendor-CB4cLN-6.js} +1 -1
  31. package/web/dist/assets/settingsStore-Xqln0d91.js +1 -0
  32. package/web/dist/assets/{state-_ZfNVAsd.js → state-CSZ50keL.js} +1 -1
  33. package/web/dist/assets/sttLanguages-CSNMgUTz.js +2 -0
  34. package/web/dist/assets/ttsSettings-BwXYpDnk.js +2 -0
  35. package/web/dist/assets/useConfirm-Da8iQ_DZ.js +1 -0
  36. package/web/dist/assets/{useTranslation-BGmCDuQI.js → useTranslation-B-mfApCn.js} +1 -1
  37. package/web/dist/assets/{websocket-C9e3h7VU.js → websocket-BnDwh01e.js} +1 -1
  38. package/web/dist/assets/whatsNewStore-LpdLRLGl.js +1 -0
  39. package/web/dist/index.html +18 -18
  40. package/web/dist/vendor/MANIFEST.json +24 -0
  41. package/web/dist/vendor/d3.min.js +2 -0
  42. package/web/dist/vendor/echarts.min.js +45 -0
  43. package/web/dist/assets/AssistantsView-dhdYVIy0.js +0 -1
  44. package/web/dist/assets/AutomationView-D1dU5ZV7.js +0 -1
  45. package/web/dist/assets/ChannelConfigView-CEPVZntU.js +0 -8
  46. package/web/dist/assets/ChartsView-DdN-beHW.js +0 -1
  47. package/web/dist/assets/ConnectorsView-CseCss9C.js +0 -1
  48. package/web/dist/assets/FileTreeView-Dnc3-gRF.js +0 -1
  49. package/web/dist/assets/HookConfigView-DA2h4HdJ.js +0 -1
  50. package/web/dist/assets/InputArea-DAgOOjOc.js +0 -14
  51. package/web/dist/assets/MemoryView-D6OUBi4-.js +0 -1
  52. package/web/dist/assets/ModelsView-BuqD9vWl.js +0 -1
  53. package/web/dist/assets/PluginsView-CIziDHFJ.js +0 -2
  54. package/web/dist/assets/ProjectsView-c6faWy32.js +0 -1
  55. package/web/dist/assets/SessionGrid-BZJHcklh.js +0 -4
  56. package/web/dist/assets/SettingsModal-BqdGEGW-.js +0 -4
  57. package/web/dist/assets/SkillsView-CB6CKkmb.js +0 -1
  58. package/web/dist/assets/TemplatesTab-B8efVwVZ.js +0 -1
  59. package/web/dist/assets/ThreadsView-CDoM0aNb.js +0 -2
  60. package/web/dist/assets/ToolsView-BG-xsWsO.js +0 -1
  61. package/web/dist/assets/cn-rx4uumOJ.js +0 -1
  62. package/web/dist/assets/common-BHXgEvgk.js +0 -192
  63. package/web/dist/assets/index-BNI6CNsY.css +0 -1
  64. package/web/dist/assets/index-BX-d2OBW.js +0 -130
  65. package/web/dist/assets/settingsStore-RLUAWgIk.js +0 -1
  66. package/web/dist/assets/sttLanguages-aqoVC79g.js +0 -2
  67. package/web/dist/assets/ttsSettings-DHo3OsOq.js +0 -15
  68. package/web/dist/assets/whatsNewStore-Bf_7lW8o.js +0 -1
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{Kr as t,Ut as n,n as r}from"./icons-CYDRRPKW.js";import{t as i}from"./useTranslation-B-mfApCn.js";import{n as a}from"./state-CSZ50keL.js";import{I as o}from"./markdown-N5__3T-w.js";var s=4e3,c=new Map;function l(e,t){let n=c.get(e);n&&clearTimeout(n),!(t<=0)&&c.set(e,setTimeout(()=>{c.delete(e),u.setState(t=>({toasts:t.toasts.filter(t=>t.id!==e)}))},t))}var u=a(e=>({toasts:[],addToast:(t,n,r)=>{let i=r??s;e(e=>{let r=e.toasts.find(e=>e.type===t&&e.message===n);if(r)return l(r.id,i),{toasts:e.toasts.map(e=>e.id===r.id?{...e,count:e.count+1,createdAt:Date.now()}:e)};let a=`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;l(a,i);let o={id:a,type:t,message:n,duration:i,createdAt:Date.now(),count:1};return{toasts:[...e.toasts,o].slice(-10)}})},dismissToast:t=>{let n=c.get(t);n&&(clearTimeout(n),c.delete(t)),e(e=>({toasts:e.toasts.filter(e=>e.id!==t)}))},clearAll:()=>{for(let e of c.values())clearTimeout(e);c.clear(),e({toasts:[]})}})),d={info:(e,t)=>u.getState().addToast(`info`,e,t),success:(e,t)=>u.getState().addToast(`success`,e,t),warning:(e,t)=>u.getState().addToast(`warning`,e,t),error:(e,t)=>u.getState().addToast(`error`,e,t??6e3)},f=e(t(),1);function p(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=p(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function m(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=p(e))&&(r&&(r+=` `),r+=t);return r}function h(...e){return m(e)}var g=20;function _(){if(typeof window>`u`||typeof getComputedStyle!=`function`)return 220;let e=getComputedStyle(document.documentElement).getPropertyValue(`--dur-base`).trim(),t=Number.parseFloat(e);return!Number.isFinite(t)||t<=0?220:(e.endsWith(`ms`)?t:t*1e3)+g}function v(e){let[t,n]=(0,f.useState)(e),[r,i]=(0,f.useState)(!1),a=(0,f.useRef)(e);return a.current!==e&&(a.current=e,e?(n(!0),i(!1)):t&&i(!0)),(0,f.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>{i(!1),n(!1)},_());return()=>window.clearTimeout(e)},[r]),{visible:t,phase:r?`exit`:`enter`}}var y=o(),b={primary:`btn-primary`,accent:`btn-accent`,secondary:`btn-secondary`,ghost:`btn-ghost`,danger:`btn-danger`},x={sm:`btn-sm`,lg:`btn-lg`},S={sm:13,md:15,lg:17};function C({variant:e=`secondary`,size:t=`md`,shape:r=`default`,loading:i=!1,leftIcon:a,rightIcon:o,type:s=`button`,disabled:c,className:l,children:u,ref:d,...f}){return(0,y.jsxs)(`button`,{ref:d,type:s,disabled:c||i,"aria-busy":i||void 0,className:h(`btn`,b[e],t!==`md`&&x[t],r===`pill`&&`btn-pill`,l),...f,children:[i?(0,y.jsx)(n,{size:S[t],className:`shrink-0 animate-spin`,"aria-hidden":`true`}):a,u,!i&&o]})}var w=0,T=``;function E(){w===0&&(T=document.body.style.overflow),w+=1,document.body.style.overflow=`hidden`}function D(){w=Math.max(0,w-1),w===0&&(document.body.style.overflow=T)}var O=[];function k({isOpen:e,onClose:t,lockScroll:n=!0}){let r=(0,f.useRef)(t);(0,f.useEffect)(()=>{r.current=t}),(0,f.useEffect)(()=>{if(!e)return;let t=Symbol(`overlay`);O.push(t);let i=e=>{e.key===`Escape`&&O[O.length-1]===t&&(e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),r.current()))};return document.addEventListener(`keydown`,i,!0),n&&E(),()=>{document.removeEventListener(`keydown`,i,!0);let e=O.indexOf(t);e>=0&&O.splice(e,1),n&&D()}},[e,n])}var A=`a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])`;function j(e){let t=(0,f.useRef)(null);return(0,f.useEffect)(()=>{if(!e)return;let n=t.current;if(!n)return;let r=document.activeElement,i=()=>Array.from(n.querySelectorAll(A)),a=n.querySelector(`[data-modal-body]`);(n.querySelector(`[data-autofocus]`)??(a?a.querySelector(A):null)??i()[0]??n).focus();let o=e=>{if(e.key!==`Tab`)return;let t=i();if(t.length===0){e.preventDefault(),n.focus();return}let r=t[0],a=t[t.length-1],o=document.activeElement,s=o!==null&&n.contains(o);e.shiftKey?s&&o!==r||(e.preventDefault(),a.focus()):s&&o!==a||(e.preventDefault(),r.focus())};return document.addEventListener(`keydown`,o),()=>{document.removeEventListener(`keydown`,o),r&&typeof r.focus==`function`&&r.focus()}},[e]),t}function M({isOpen:e,onClose:t,title:n,children:i,size:a=`md`,className:o,bodyClassName:s=`p-6`}){k({isOpen:e,onClose:t});let{visible:c,phase:l}=v(e),u=(0,f.useId)(),d=j(c);return c?(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center overflow-hidden p-4`,children:[(0,y.jsx)(`div`,{className:`absolute inset-0 ui-scrim ui-overlay-backdrop`,"data-phase":l,onClick:t}),(0,y.jsxs)(`div`,{ref:d,role:`dialog`,"aria-modal":`true`,"aria-labelledby":n?u:void 0,"data-phase":l,tabIndex:-1,className:h(`relative w-full mx-4 bg-dark-overlay ui-surface-overlay border border-dark-border rounded-xl shadow-pop ui-overlay-panel`,`max-h-[calc(100vh-2rem)] flex flex-col overflow-hidden`,{sm:`max-w-sm`,md:`max-w-md`,lg:`max-w-lg`,xl:`max-w-xl`,"2xl":`max-w-3xl`,"3xl":`max-w-5xl`}[a],o),children:[n&&(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between px-6 py-4 border-b border-dark-border`,children:[(0,y.jsx)(`h2`,{id:u,className:`text-lg font-semibold text-dark-text`,children:n}),(0,y.jsx)(`button`,{onClick:t,"aria-label":`Close`,className:`p-1 rounded-lg text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors`,children:(0,y.jsx)(r,{className:`w-5 h-5`,"aria-hidden":`true`})})]}),(0,y.jsx)(`div`,{"data-modal-body":!0,className:h(`min-h-0 overflow-y-auto custom-scrollbar`,s),children:i})]})]}):null}function N({isOpen:e,onClose:t,onConfirm:n,title:r,message:a,confirmText:o,cancelText:s,variant:c=`default`}){let{t:l}=i();return(0,y.jsxs)(M,{isOpen:e,onClose:t,title:r??l(`common.confirm`),size:`sm`,children:[(0,y.jsx)(`p`,{className:`text-dark-muted mb-6`,children:a}),(0,y.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,y.jsx)(C,{onClick:t,children:s??l(`common.cancel`)}),(0,y.jsx)(C,{variant:c===`danger`?`danger`:`accent`,onClick:()=>{n(),t()},children:o??l(`common.confirm`)})]})]})}function P(){let[e,t]=(0,f.useState)(null),n=(0,f.useRef)(null),r=(0,f.useCallback)(e=>{let r=n.current;n.current=null,t(null),r?.(e)},[]),i=(0,f.useCallback)(e=>{let r=n.current;return n.current=null,r?.(!1),new Promise(r=>{n.current=r,t(e)})},[]);return[e?(0,y.jsx)(N,{isOpen:!0,onClose:()=>r(!1),onConfirm:()=>r(!0),title:e.title,message:e.message,confirmText:e.confirmText,cancelText:e.cancelText,variant:e.variant}):null,i]}export{C as a,d as c,k as i,u as l,N as n,v as o,M as r,h as s,P as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{Ur as n}from"./icons-BvYhTENi.js";var r=e(n()),i=e=>typeof e==`string`,a=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},o=e=>e==null?``:String(e),s=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},c=/###/g,l=e=>e&&e.includes(`###`)?e.replace(c,`.`):e,u=e=>!e||i(e),d=(e,t,n)=>{let r=i(t)?t.split(`.`):t,a=0;for(;a<r.length-1;){if(u(e))return{};let t=l(r[a]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return u(e)?{}:{obj:e,k:l(r[a])}},f=(e,t,n)=>{let{obj:r,k:i}=d(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=d(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=d(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},p=(e,t,n,r)=>{let{obj:i,k:a}=d(e,t,Object);i[a]=i[a]||[],i[a].push(n)},m=(e,t)=>{let{obj:n,k:r}=d(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},h=(e,t,n)=>{let r=m(e,n);return r===void 0?m(t,n):r},g=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?i(e[r])||e[r]instanceof String||i(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):g(e[r],t[r],n):e[r]=t[r]);return e},_=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),v={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},y=e=>i(e)?e.replace(/[&<>"'\/]/g,e=>v[e]):e,b=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},x=[` `,`,`,`?`,`!`,`;`],S=new b(20),C=(e,t,n)=>{t||=``,n||=``;let r=x.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=S.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},w=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},T=e=>e?.replace(/_/g,`-`),E={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},D=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||E,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>i(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),i(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},O=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},k=new WeakSet,A=class extends O{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let a=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,o=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,s;e.includes(`.`)?s=e.split(`.`):(s=[e,t],n&&(Array.isArray(n)?s.push(...n):i(n)&&a?s.push(...n.split(a)):s.push(n)));let c=m(this.data,s);return!c&&!t&&!n&&e.includes(`.`)&&(e=s[0],t=s[1],n=s.slice(2).join(`.`)),c||!o||!i(n)?c:w(this.data?.[e]?.[t],n,a)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),f(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(i(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=m(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?g(s,n,i):s={...s,...n},f(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>{let n=t[e];return k.has(n)?!0:!n||Object.keys(n).length===0?!1:(typeof n==`object`&&k.add(n),!0)})}toJSON(){return this.data}},j={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},M=Symbol(`i18next/PATH_KEY`);function ee(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===M?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function N(e,t){let{[M]:n}=e(ee()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var P=e=>!i(e)&&typeof e!=`boolean`&&typeof e!=`number`,F=class e extends O{constructor(e,t={}){super(),s([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=D.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=P(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,a=t.ns||this.options.defaultNS||[],o=n&&e.includes(n),s=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!C(e,n,r);if(o&&!s){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:i(a)?[a]:a};let o=e.split(n);(n!==r||n===r&&this.options.ns.includes(o[0]))&&(a=o.shift()),e=o.join(r)}return{key:e,namespaces:i(a)?[a]:a}}translate(t,n,r){let a=typeof n==`object`?{...n}:n;if(typeof a!=`object`&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a==`object`&&(a={...a}),a||={},t==null)return``;typeof t==`function`&&(t=N(t,{...this.options,...a})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?N(e,{...this.options,...a}):String(e));let o=a.returnDetails===void 0?this.options.returnDetails:a.returnDetails,s=a.keySeparator===void 0?this.options.keySeparator:a.keySeparator,{key:c,namespaces:l}=this.extractFromKey(t[t.length-1],a),u=l[l.length-1],d=a.nsSeparator===void 0?this.options.nsSeparator:a.nsSeparator;d===void 0&&(d=`:`);let f=a.lng||this.language,p=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()===`cimode`)return p?o?{res:`${u}${d}${c}`,usedKey:c,exactUsedKey:c,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:`${u}${d}${c}`:o?{res:c,usedKey:c,exactUsedKey:c,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:c;let m=this.resolve(t,a),h=m?.res,g=m?.usedKey||c,_=m?.exactUsedKey||c,v=[`[object Number]`,`[object Function]`,`[object RegExp]`],y=a.joinArrays===void 0?this.options.joinArrays:a.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,x=a.count!==void 0&&!i(a.count),S=e.hasDefaultValue(a),C=x?this.pluralResolver.getSuffix(f,a.count,a):``,w=a.ordinal&&x?this.pluralResolver.getSuffix(f,a.count,{ordinal:!1}):``,T=x&&!a.ordinal&&a.count===0,E=T&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${C}`]||a[`defaultValue${w}`]||a.defaultValue,D=h;b&&!h&&S&&(D=E);let O=P(D),k=Object.prototype.toString.apply(D);if(b&&D&&O&&!v.includes(k)&&!(i(y)&&Array.isArray(D))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,D,{...a,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return o?(m.res=e,m.usedParams=this.getUsedParamsDetails(a),m):e}if(s){let e=Array.isArray(D),t=e?[]:{},n=e?_:g;for(let e in D)if(Object.prototype.hasOwnProperty.call(D,e)){let r=`${n}${s}${e}`;t[e]=S&&!h?this.translate(r,{...a,defaultValue:P(E)?E[e]:void 0,joinArrays:!1,ns:l}):this.translate(r,{...a,joinArrays:!1,ns:l}),t[e]===r&&(t[e]=D[e])}h=t}}else if(b&&i(y)&&Array.isArray(h))h=h.join(y),h&&=this.extendTranslation(h,t,a,r);else{let e=!1,n=!1;!this.isValidLookup(h)&&S&&(e=!0,h=E),this.isValidLookup(h)||(n=!0,h=c);let i=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:h,o=S&&E!==h&&this.options.updateMissing;if(n||e||o){if(this.logger.log(o?`updateKey`:`missingKey`,f,u,x&&!o?`${c}${this.pluralResolver.getSuffix(f,a.count,a)}`:c,o?E:h),s){let e=this.resolve(c,{...a,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(a.lng||this.language):e.push(a.lng||this.language);let n=(e,t,n)=>{let r=S&&n!==h?n:i;this.options.missingKeyHandler?this.options.missingKeyHandler(e,u,t,r,o,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,u,t,r,o,a),this.emit(`missingKey`,e,u,t,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,a);T&&a[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],c+t,a[`defaultValue${t}`]||E)})}):n(e,c,E))}h=this.extendTranslation(h,t,a,m,r),n&&h===c&&this.options.appendNamespaceToMissingKey&&(h=`${u}${d}${c}`),(n||e)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${d}${c}`:c,e?h:void 0,a))}return o?(m.res=h,m.usedParams=this.getUsedParamsDetails(a),m):h}extendTranslation(e,t,n,r,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let o=i(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),s;if(o){let t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let c=n.replace&&!i(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),e=this.interpolator.interpolate(e,c,n.lng||this.language||r.usedLng,n),o){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;s<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>a?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,s=i(o)?[o]:o;return e!=null&&s?.length&&n.applyPostProcessor!==!1&&(e=j.handle(s,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,a,o,s;return i(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?N(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let c=this.extractFromKey(e,t),l=c.key;r=l;let u=c.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let d=t.count!==void 0&&!i(t.count),f=d&&!t.ordinal&&t.count===0,p=t.context!==void 0&&(i(t.context)||typeof t.context==`number`)&&t.context!==``,m=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);u.forEach(e=>{this.isValidLookup(n)||(s=e,!this.checkedLoadedFor[`${m[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(this.checkedLoadedFor[`${m[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${m.join(`, `)}" won't get resolved as namespace "${s}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),m.forEach(r=>{if(this.isValidLookup(n))return;o=r;let i=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,r,e,t);else{let e;d&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,a=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(t.ordinal&&e.startsWith(a)&&i.push(l+e.replace(a,this.options.pluralSeparator)),i.push(l+e),f&&i.push(l+n)),p){let r=`${l}${this.options.contextSeparator||`_`}${t.context}`;i.push(r),d&&(t.ordinal&&e.startsWith(a)&&i.push(r+e.replace(a,this.options.pluralSeparator)),i.push(r+e),f&&i.push(r+n))}}let s;for(;s=i.pop();)this.isValidLookup(n)||(a=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:a,usedLng:o,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!i(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r={...r,count:e.count}),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},I=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=D.create(`languageUtils`),this.resolveHierarchyCache={}}clearCache(){this.resolveHierarchyCache={}}getScriptPartFromCode(e){if(e=T(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=T(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(i(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),i(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.options.fallbackLng,r=Array.isArray(n)?n.join(`|`):n;r!==this._cachedFallbackLng&&(this.resolveHierarchyCache={},this._cachedFallbackLng=r);let a=t===void 0||t===!1||i(t),o=t===void 0&&typeof this.options.fallbackLng==`function`,s=i(e)&&a&&!o,c=null;if(s){let n;n=t===void 0?`undefined`:t===!1?`boolean:false`:`string:${t}`,c=`${e.length}:${e}|${n}`}if(c!==null){let e=this.resolveHierarchyCache[c];if(e!==void 0)return e.slice()}let l=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),u=[],d=e=>{e&&(this.isSupportedCode(e)?u.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return i(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&d(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&d(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&d(this.getLanguagePartFromCode(e))):i(e)&&d(this.formatLanguageCode(e)),l.forEach(e=>{let t=this.formatLanguageCode(e);u.includes(t)||d(t)}),c===null?u:(this.resolveHierarchyCache[c]=u,u.slice())}},L={zero:0,one:1,two:2,few:3,many:4,other:5},R={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},te=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=D.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=T(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),R;if(!e.match(/-|_/))return R;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>L[e]-L[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},z=(e,t,n,r=`.`,a=!0)=>{let o=h(e,t,n);return!o&&a&&i(n)&&(o=w(e,n,r),o===void 0&&(o=w(t,n,r))),o},B=class{constructor(e={}){this.logger=D.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:v}=e.interpolation;this.escape=t===void 0?y:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?_(i):a||`{{`,this.suffix=o?_(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?_(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?_(l):``,this.nestingPrefix=d?_(d):f||_(`$t(`),this.nestingSuffix=p?_(p):m||_(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=v!==void 0&&v,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']|"[^"]*"|'[^']*'|\\((?:[^()"']|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let a,s,c,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=e=>{if(!e.includes(this.formatSeparator)){let i=z(t,l,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(z(t,l,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let d=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e):e}].forEach(t=>{for(c=0;a=t.regex.exec(e);){let n=a[1].trim();if(s=u(n),s===void 0){if(typeof d==`function`){let t=d(e,a,r);s=i(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))s=``;else if(f){s=a[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),s=``}else!i(s)&&!this.useRawValueToEscape&&(s=o(s));let l=o(t.safeValue(s));if(e=e.slice(0,a.index)+l+e.slice(a.index+a[0].length),f?(t.regex.lastIndex+=l.length,t.regex.lastIndex-=a[0].length):t.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,a,s,c=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${_(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,s);let a=i.match(/'/g),o=i.match(/"/g);((a?.length??0)%2==0&&!o||(o?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{s=JSON.parse(i),t&&(s={...t,...s})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return s.defaultValue&&s.defaultValue.includes(this.prefix)&&delete s.defaultValue,e},l=new RegExp(this.nestingRegexp),u=``,d=0;for(;r=l.exec(e);){let f=[];s={...n},s=s.replace&&!i(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let p=/{.*}/s.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(p!==-1&&(f=r[1].slice(p).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,p)),a=t(c.call(this,r[1].trim(),s),s),a&&r[0]===e&&!i(a))return a;i(a)||(a=o(a)),a||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),f.length&&(a=f.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),a.trim())),u+=e.slice(d,r.index)+o(a),d=l.lastIndex,this.regexp.lastIndex=0}return d?u+e.slice(d):e}},ne=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||=i.trim():t===`relativetime`&&!i.includes(`:`)?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},V=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(T(r),i),t[o]=s),s(n)}},re=e=>(t,n,r)=>e(T(n),r)(t),ie=class{constructor(e={}){this.logger=D.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?V:re;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=V(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator),a=[];for(let e=0;e<i.length;e++){let t=i[e];for(;t.indexOf(`(`)>-1&&!t.includes(`)`)&&e+1<i.length;)t=`${t}${this.formatSeparator}${i[++e]}`;a.push(t)}return a.reduce((e,t)=>{let{formatName:i,formatOptions:a}=ne(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e},e)}},ae=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},oe=class extends O{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=D.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{p(n.loaded,[i],a),ae(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}o&&s&&r<this.maxRetries?setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i):a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2)try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}else return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();i(e)&&(e=this.languageUtils.toResolveHierarchy(e)),i(t)&&(t=[t]);let a=this.queueLoad(e,t,n,r);if(!a.toLoad.length)return a.pending.length||r(),null;a.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t))this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);else if(n!=null&&n!==``){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}},H=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),i(e[1])&&(t.defaultValue=e[1]),i(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),U=e=>(i(e.ns)&&(e.ns=[e.ns]),i(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),i(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),W=()=>{},se=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},G=class e extends O{constructor(e={},t){if(super(),this.options=U(e),this.services={},this.logger=D,this.modules={external:[]},se(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(i(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=H();this.options={...n,...this.options,...U(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?D.init(r(this.modules.logger),this.options):D.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:ie;let t=new I(this.options);this.store=new A(this.options.resources,this.options);let n=this.services;n.logger=D,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new te(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new B(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new oe(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new F(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=W,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let o=a(),s=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),o.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?s():setTimeout(s,0),o}loadResources(e,t=W){let n=t,r=i(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=a();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=W,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&j.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&![`cimode`,`dev`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=a();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},o=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},s=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=i(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(i(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{o(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e),n}getFixedT(e,t,n,r){let a=r?.scopeNs,o=(e,t,...r)=>{let i;i=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),i.lng=i.lng||o.lng,i.lngs=i.lngs||o.lngs;let s=i.ns!==void 0&&i.ns!==null;i.ns=i.ns||o.ns,i.keyPrefix!==``&&(i.keyPrefix=i.keyPrefix||n||o.keyPrefix);let c={...this.options,...i};Array.isArray(a)&&!s&&(c.ns=a),typeof i.keyPrefix==`function`&&(i.keyPrefix=N(i.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return i.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=N(e,c)),`${i.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=N(e,c)),u=i.keyPrefix?`${i.keyPrefix}${l}${e}`:e),this.t(u,i)};return i(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=n,o}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}if(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages)return!0;let{languageUtils:o}=this.services,s=t.lng?o.isSupportedCode(n)&&o.toResolveHierarchy(n,!1)[0]:n;return!(s&&!a(s,e)||r&&!a(i,e))}loadNamespaces(e,t){let n=a();return this.options.ns?(i(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=a();i(e)&&(e=[e]);let r=this.options.preload||[],o=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new I(H());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=W){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,preload:!1,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new A(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...H().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new B(n)}return a.translator=new F(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();G.createInstance,G.dir,G.init,G.loadResources,G.reloadResources,G.use,G.changeLanguage,G.getFixedT,G.t,G.exists,G.setDefaultNamespace,G.hasLoadedNamespace,G.loadNamespaces,G.loadLanguages;var ce=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);Z(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},K={},q=(e,t,n,r)=>{Z(n)&&K[n]||(Z(n)&&(K[n]=new Date),ce(e,t,n,r))},J=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},Y=(e,t,n)=>{e.loadNamespaces(t,J(e,n))},X=(e,t,n,r)=>{if(Z(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Y(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,J(e,r))},le=(e,t,n={})=>!t.languages||!t.languages.length?(q(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),Z=e=>typeof e==`string`,ue=e=>typeof e==`object`&&!!e,de=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,fe={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":`\xA0`,"&#160;":`\xA0`,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},pe=e=>fe[e],Q={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:e=>e.replace(de,pe),transDefaultProps:void 0},me=(e={})=>{Q={...Q,...e}},he=()=>Q,$,ge=e=>{$=e},_e=()=>$,ve=(0,r.createContext)(),ye=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},be=t((e=>{var t=n();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),xe=t(((e,t)=>{t.exports=be()}))(),Se={t:(e,t)=>{if(Z(t))return t;if(ue(t)&&Z(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},Ce=()=>()=>{},we=(e,t={})=>{let{i18n:n}=t,{i18n:i,defaultNS:a}=(0,r.useContext)(ve)||{},o=n||i||_e();o&&!o.reportNamespaces&&(o.reportNamespaces=new ye),o||q(o,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`);let s=(0,r.useMemo)(()=>({...he(),...o?.options?.react,...t}),[o,t]),{useSuspense:c,keyPrefix:l,bindI18n:u,bindI18nStore:d}=s,f=e||a||o?.options?.defaultNS,p=Z(f)?[f]:f||[`translation`],m=(0,r.useMemo)(()=>p,p);o?.reportNamespaces?.addUsedNamespaces?.(m);let h=(0,r.useRef)(0),g=(0,r.useCallback)(e=>{if(!o)return Ce;let t=()=>{h.current+=1,e()};return u&&o.on(u,t),d&&o.store.on(d,t),()=>{u&&u.split(` `).forEach(e=>o.off(e,t)),d&&d.split(` `).forEach(e=>o.store.off(e,t))}},[o,u,d]),_=(0,r.useRef)(),v=(0,r.useCallback)(()=>{if(!o)return Se;let e=!!(o.isInitialized||o.initializedStoreOnce)&&m.every(e=>le(e,o,s)),n=t.lng||o.language,r=h.current,i=typeof l==`function`?N(l,{...o.options,ns:m}):l,a=_.current;if(a&&a.i18n===o&&a.ready===e&&a.lng===n&&a.namespaces===m&&a.keyPrefix===i&&a.revision===r)return a;let c={t:o.getFixedT(n,s.nsMode===`fallback`?m:m[0],l,{scopeNs:m}),i18n:o,ready:e,lng:n,namespaces:m,keyPrefix:i,revision:r};return _.current=c,c},[o,m,l,s,t.lng]),[y,b]=(0,r.useState)(0),{t:x,ready:S}=(0,xe.useSyncExternalStore)(g,v,v),C;o&&c&&!S&&(C=new Promise(e=>{let n=()=>e();t.lng?X(o,t.lng,m,n):Y(o,m,n)}),{t:x,ready:S}=v()),(0,r.useEffect)(()=>{if(o&&!S&&!c){let e=()=>b(e=>e+1);t.lng?X(o,t.lng,m,e):Y(o,m,e)}},[o,t.lng,m,S,c,y]);let w=o||{},T=(0,r.useRef)(null),E=(0,r.useRef)(),D=e=>`${e.language}|${e.resolvedLanguage}|${e.languages?.join(`,`)}`,O=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},k=(0,r.useMemo)(()=>{let e=w,t=e&&D(e),n=e;e&&(T.current&&T.current.__original===e&&E.current===t?n=T.current:(n=O(e),T.current=n,E.current=t));let r=!S&&!c?(...e)=>(q(o,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),x(...e)):x,i=[r,n,S];return i.t=r,i.i18n=n,i.ready=S,i},[x,w,S,w.resolvedLanguage,w.language,w.languages]);if(o&&c&&!S){let e=!1;try{e=!1}catch{}throw e&&q(o,`SUSPENDED_WHILE_LOADING`,`useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.i18next.com/latest/usetranslation-hook`),C}return k};export{G as i,ge as n,me as r,we as t};
1
+ import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{Kr as n}from"./icons-CYDRRPKW.js";var r=e(n()),i=e=>typeof e==`string`,a=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},o=e=>e==null?``:String(e),s=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},c=/###/g,l=e=>e&&e.includes(`###`)?e.replace(c,`.`):e,u=e=>!e||i(e),d=(e,t,n)=>{let r=i(t)?t.split(`.`):t,a=0;for(;a<r.length-1;){if(u(e))return{};let t=l(r[a]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return u(e)?{}:{obj:e,k:l(r[a])}},f=(e,t,n)=>{let{obj:r,k:i}=d(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=d(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=d(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},p=(e,t,n,r)=>{let{obj:i,k:a}=d(e,t,Object);i[a]=i[a]||[],i[a].push(n)},m=(e,t)=>{let{obj:n,k:r}=d(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},h=(e,t,n)=>{let r=m(e,n);return r===void 0?m(t,n):r},g=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?i(e[r])||e[r]instanceof String||i(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):g(e[r],t[r],n):e[r]=t[r]);return e},_=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),v={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},y=e=>i(e)?e.replace(/[&<>"'\/]/g,e=>v[e]):e,b=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},x=[` `,`,`,`?`,`!`,`;`],S=new b(20),C=(e,t,n)=>{t||=``,n||=``;let r=x.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=S.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},w=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},T=e=>e?.replace(/_/g,`-`),E={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},D=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||E,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>i(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),i(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},O=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},k=new WeakSet,A=class extends O{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let a=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,o=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,s;e.includes(`.`)?s=e.split(`.`):(s=[e,t],n&&(Array.isArray(n)?s.push(...n):i(n)&&a?s.push(...n.split(a)):s.push(n)));let c=m(this.data,s);return!c&&!t&&!n&&e.includes(`.`)&&(e=s[0],t=s[1],n=s.slice(2).join(`.`)),c||!o||!i(n)?c:w(this.data?.[e]?.[t],n,a)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),f(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(i(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=m(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?g(s,n,i):s={...s,...n},f(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>{let n=t[e];return k.has(n)?!0:!n||Object.keys(n).length===0?!1:(typeof n==`object`&&k.add(n),!0)})}toJSON(){return this.data}},j={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},M=Symbol(`i18next/PATH_KEY`);function ee(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===M?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function N(e,t){let{[M]:n}=e(ee()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var P=e=>!i(e)&&typeof e!=`boolean`&&typeof e!=`number`,F=class e extends O{constructor(e,t={}){super(),s([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=D.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=P(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,a=t.ns||this.options.defaultNS||[],o=n&&e.includes(n),s=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!C(e,n,r);if(o&&!s){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:i(a)?[a]:a};let o=e.split(n);(n!==r||n===r&&this.options.ns.includes(o[0]))&&(a=o.shift()),e=o.join(r)}return{key:e,namespaces:i(a)?[a]:a}}translate(t,n,r){let a=typeof n==`object`?{...n}:n;if(typeof a!=`object`&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a==`object`&&(a={...a}),a||={},t==null)return``;typeof t==`function`&&(t=N(t,{...this.options,...a})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?N(e,{...this.options,...a}):String(e));let o=a.returnDetails===void 0?this.options.returnDetails:a.returnDetails,s=a.keySeparator===void 0?this.options.keySeparator:a.keySeparator,{key:c,namespaces:l}=this.extractFromKey(t[t.length-1],a),u=l[l.length-1],d=a.nsSeparator===void 0?this.options.nsSeparator:a.nsSeparator;d===void 0&&(d=`:`);let f=a.lng||this.language,p=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()===`cimode`)return p?o?{res:`${u}${d}${c}`,usedKey:c,exactUsedKey:c,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:`${u}${d}${c}`:o?{res:c,usedKey:c,exactUsedKey:c,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:c;let m=this.resolve(t,a),h=m?.res,g=m?.usedKey||c,_=m?.exactUsedKey||c,v=[`[object Number]`,`[object Function]`,`[object RegExp]`],y=a.joinArrays===void 0?this.options.joinArrays:a.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,x=a.count!==void 0&&!i(a.count),S=e.hasDefaultValue(a),C=x?this.pluralResolver.getSuffix(f,a.count,a):``,w=a.ordinal&&x?this.pluralResolver.getSuffix(f,a.count,{ordinal:!1}):``,T=x&&!a.ordinal&&a.count===0,E=T&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${C}`]||a[`defaultValue${w}`]||a.defaultValue,D=h;b&&!h&&S&&(D=E);let O=P(D),k=Object.prototype.toString.apply(D);if(b&&D&&O&&!v.includes(k)&&!(i(y)&&Array.isArray(D))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,D,{...a,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return o?(m.res=e,m.usedParams=this.getUsedParamsDetails(a),m):e}if(s){let e=Array.isArray(D),t=e?[]:{},n=e?_:g;for(let e in D)if(Object.prototype.hasOwnProperty.call(D,e)){let r=`${n}${s}${e}`;t[e]=S&&!h?this.translate(r,{...a,defaultValue:P(E)?E[e]:void 0,joinArrays:!1,ns:l}):this.translate(r,{...a,joinArrays:!1,ns:l}),t[e]===r&&(t[e]=D[e])}h=t}}else if(b&&i(y)&&Array.isArray(h))h=h.join(y),h&&=this.extendTranslation(h,t,a,r);else{let e=!1,n=!1;!this.isValidLookup(h)&&S&&(e=!0,h=E),this.isValidLookup(h)||(n=!0,h=c);let i=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:h,o=S&&E!==h&&this.options.updateMissing;if(n||e||o){if(this.logger.log(o?`updateKey`:`missingKey`,f,u,x&&!o?`${c}${this.pluralResolver.getSuffix(f,a.count,a)}`:c,o?E:h),s){let e=this.resolve(c,{...a,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(a.lng||this.language):e.push(a.lng||this.language);let n=(e,t,n)=>{let r=S&&n!==h?n:i;this.options.missingKeyHandler?this.options.missingKeyHandler(e,u,t,r,o,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,u,t,r,o,a),this.emit(`missingKey`,e,u,t,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,a);T&&a[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],c+t,a[`defaultValue${t}`]||E)})}):n(e,c,E))}h=this.extendTranslation(h,t,a,m,r),n&&h===c&&this.options.appendNamespaceToMissingKey&&(h=`${u}${d}${c}`),(n||e)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${d}${c}`:c,e?h:void 0,a))}return o?(m.res=h,m.usedParams=this.getUsedParamsDetails(a),m):h}extendTranslation(e,t,n,r,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let o=i(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),s;if(o){let t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let c=n.replace&&!i(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),e=this.interpolator.interpolate(e,c,n.lng||this.language||r.usedLng,n),o){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;s<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>a?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,s=i(o)?[o]:o;return e!=null&&s?.length&&n.applyPostProcessor!==!1&&(e=j.handle(s,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,a,o,s;return i(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?N(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let c=this.extractFromKey(e,t),l=c.key;r=l;let u=c.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let d=t.count!==void 0&&!i(t.count),f=d&&!t.ordinal&&t.count===0,p=t.context!==void 0&&(i(t.context)||typeof t.context==`number`)&&t.context!==``,m=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);u.forEach(e=>{this.isValidLookup(n)||(s=e,!this.checkedLoadedFor[`${m[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(this.checkedLoadedFor[`${m[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${m.join(`, `)}" won't get resolved as namespace "${s}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),m.forEach(r=>{if(this.isValidLookup(n))return;o=r;let i=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,r,e,t);else{let e;d&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,a=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(t.ordinal&&e.startsWith(a)&&i.push(l+e.replace(a,this.options.pluralSeparator)),i.push(l+e),f&&i.push(l+n)),p){let r=`${l}${this.options.contextSeparator||`_`}${t.context}`;i.push(r),d&&(t.ordinal&&e.startsWith(a)&&i.push(r+e.replace(a,this.options.pluralSeparator)),i.push(r+e),f&&i.push(r+n))}}let s;for(;s=i.pop();)this.isValidLookup(n)||(a=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:a,usedLng:o,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!i(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r={...r,count:e.count}),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},I=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=D.create(`languageUtils`),this.resolveHierarchyCache={}}clearCache(){this.resolveHierarchyCache={}}getScriptPartFromCode(e){if(e=T(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=T(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(i(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),i(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.options.fallbackLng,r=Array.isArray(n)?n.join(`|`):n;r!==this._cachedFallbackLng&&(this.resolveHierarchyCache={},this._cachedFallbackLng=r);let a=t===void 0||t===!1||i(t),o=t===void 0&&typeof this.options.fallbackLng==`function`,s=i(e)&&a&&!o,c=null;if(s){let n;n=t===void 0?`undefined`:t===!1?`boolean:false`:`string:${t}`,c=`${e.length}:${e}|${n}`}if(c!==null){let e=this.resolveHierarchyCache[c];if(e!==void 0)return e.slice()}let l=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),u=[],d=e=>{e&&(this.isSupportedCode(e)?u.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return i(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&d(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&d(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&d(this.getLanguagePartFromCode(e))):i(e)&&d(this.formatLanguageCode(e)),l.forEach(e=>{let t=this.formatLanguageCode(e);u.includes(t)||d(t)}),c===null?u:(this.resolveHierarchyCache[c]=u,u.slice())}},L={zero:0,one:1,two:2,few:3,many:4,other:5},R={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},te=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=D.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=T(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),R;if(!e.match(/-|_/))return R;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>L[e]-L[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},z=(e,t,n,r=`.`,a=!0)=>{let o=h(e,t,n);return!o&&a&&i(n)&&(o=w(e,n,r),o===void 0&&(o=w(t,n,r))),o},B=class{constructor(e={}){this.logger=D.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:v}=e.interpolation;this.escape=t===void 0?y:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?_(i):a||`{{`,this.suffix=o?_(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?_(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?_(l):``,this.nestingPrefix=d?_(d):f||_(`$t(`),this.nestingSuffix=p?_(p):m||_(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=v!==void 0&&v,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']|"[^"]*"|'[^']*'|\\((?:[^()"']|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let a,s,c,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=e=>{if(!e.includes(this.formatSeparator)){let i=z(t,l,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(z(t,l,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let d=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e):e}].forEach(t=>{for(c=0;a=t.regex.exec(e);){let n=a[1].trim();if(s=u(n),s===void 0){if(typeof d==`function`){let t=d(e,a,r);s=i(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))s=``;else if(f){s=a[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),s=``}else!i(s)&&!this.useRawValueToEscape&&(s=o(s));let l=o(t.safeValue(s));if(e=e.slice(0,a.index)+l+e.slice(a.index+a[0].length),f?(t.regex.lastIndex+=l.length,t.regex.lastIndex-=a[0].length):t.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,a,s,c=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${_(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,s);let a=i.match(/'/g),o=i.match(/"/g);((a?.length??0)%2==0&&!o||(o?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{s=JSON.parse(i),t&&(s={...t,...s})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return s.defaultValue&&s.defaultValue.includes(this.prefix)&&delete s.defaultValue,e},l=new RegExp(this.nestingRegexp),u=``,d=0;for(;r=l.exec(e);){let f=[];s={...n},s=s.replace&&!i(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let p=/{.*}/s.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(p!==-1&&(f=r[1].slice(p).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,p)),a=t(c.call(this,r[1].trim(),s),s),a&&r[0]===e&&!i(a))return a;i(a)||(a=o(a)),a||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),f.length&&(a=f.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),a.trim())),u+=e.slice(d,r.index)+o(a),d=l.lastIndex,this.regexp.lastIndex=0}return d?u+e.slice(d):e}},ne=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||=i.trim():t===`relativetime`&&!i.includes(`:`)?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},V=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(T(r),i),t[o]=s),s(n)}},re=e=>(t,n,r)=>e(T(n),r)(t),ie=class{constructor(e={}){this.logger=D.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?V:re;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=V(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator),a=[];for(let e=0;e<i.length;e++){let t=i[e];for(;t.indexOf(`(`)>-1&&!t.includes(`)`)&&e+1<i.length;)t=`${t}${this.formatSeparator}${i[++e]}`;a.push(t)}return a.reduce((e,t)=>{let{formatName:i,formatOptions:a}=ne(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e},e)}},ae=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},oe=class extends O{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=D.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{p(n.loaded,[i],a),ae(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}o&&s&&r<this.maxRetries?setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i):a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2)try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}else return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();i(e)&&(e=this.languageUtils.toResolveHierarchy(e)),i(t)&&(t=[t]);let a=this.queueLoad(e,t,n,r);if(!a.toLoad.length)return a.pending.length||r(),null;a.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t))this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);else if(n!=null&&n!==``){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}},H=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),i(e[1])&&(t.defaultValue=e[1]),i(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),U=e=>(i(e.ns)&&(e.ns=[e.ns]),i(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),i(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),W=()=>{},se=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},G=class e extends O{constructor(e={},t){if(super(),this.options=U(e),this.services={},this.logger=D,this.modules={external:[]},se(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(i(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=H();this.options={...n,...this.options,...U(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?D.init(r(this.modules.logger),this.options):D.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:ie;let t=new I(this.options);this.store=new A(this.options.resources,this.options);let n=this.services;n.logger=D,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new te(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new B(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new oe(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new F(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=W,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let o=a(),s=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),o.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?s():setTimeout(s,0),o}loadResources(e,t=W){let n=t,r=i(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=a();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=W,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&j.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&![`cimode`,`dev`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=a();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},o=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},s=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=i(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(i(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{o(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e),n}getFixedT(e,t,n,r){let a=r?.scopeNs,o=(e,t,...r)=>{let i;i=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),i.lng=i.lng||o.lng,i.lngs=i.lngs||o.lngs;let s=i.ns!==void 0&&i.ns!==null;i.ns=i.ns||o.ns,i.keyPrefix!==``&&(i.keyPrefix=i.keyPrefix||n||o.keyPrefix);let c={...this.options,...i};Array.isArray(a)&&!s&&(c.ns=a),typeof i.keyPrefix==`function`&&(i.keyPrefix=N(i.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return i.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=N(e,c)),`${i.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=N(e,c)),u=i.keyPrefix?`${i.keyPrefix}${l}${e}`:e),this.t(u,i)};return i(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=n,o}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}if(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages)return!0;let{languageUtils:o}=this.services,s=t.lng?o.isSupportedCode(n)&&o.toResolveHierarchy(n,!1)[0]:n;return!(s&&!a(s,e)||r&&!a(i,e))}loadNamespaces(e,t){let n=a();return this.options.ns?(i(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=a();i(e)&&(e=[e]);let r=this.options.preload||[],o=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new I(H());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=W){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,preload:!1,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new A(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...H().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new B(n)}return a.translator=new F(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();G.createInstance,G.dir,G.init,G.loadResources,G.reloadResources,G.use,G.changeLanguage,G.getFixedT,G.t,G.exists,G.setDefaultNamespace,G.hasLoadedNamespace,G.loadNamespaces,G.loadLanguages;var ce=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);Z(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},K={},q=(e,t,n,r)=>{Z(n)&&K[n]||(Z(n)&&(K[n]=new Date),ce(e,t,n,r))},J=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},Y=(e,t,n)=>{e.loadNamespaces(t,J(e,n))},X=(e,t,n,r)=>{if(Z(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Y(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,J(e,r))},le=(e,t,n={})=>!t.languages||!t.languages.length?(q(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),Z=e=>typeof e==`string`,ue=e=>typeof e==`object`&&!!e,de=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,fe={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":`\xA0`,"&#160;":`\xA0`,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},pe=e=>fe[e],Q={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:e=>e.replace(de,pe),transDefaultProps:void 0},me=(e={})=>{Q={...Q,...e}},he=()=>Q,$,ge=e=>{$=e},_e=()=>$,ve=(0,r.createContext)(),ye=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},be=t((e=>{var t=n();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),xe=t(((e,t)=>{t.exports=be()}))(),Se={t:(e,t)=>{if(Z(t))return t;if(ue(t)&&Z(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},Ce=()=>()=>{},we=(e,t={})=>{let{i18n:n}=t,{i18n:i,defaultNS:a}=(0,r.useContext)(ve)||{},o=n||i||_e();o&&!o.reportNamespaces&&(o.reportNamespaces=new ye),o||q(o,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`);let s=(0,r.useMemo)(()=>({...he(),...o?.options?.react,...t}),[o,t]),{useSuspense:c,keyPrefix:l,bindI18n:u,bindI18nStore:d}=s,f=e||a||o?.options?.defaultNS,p=Z(f)?[f]:f||[`translation`],m=(0,r.useMemo)(()=>p,p);o?.reportNamespaces?.addUsedNamespaces?.(m);let h=(0,r.useRef)(0),g=(0,r.useCallback)(e=>{if(!o)return Ce;let t=()=>{h.current+=1,e()};return u&&o.on(u,t),d&&o.store.on(d,t),()=>{u&&u.split(` `).forEach(e=>o.off(e,t)),d&&d.split(` `).forEach(e=>o.store.off(e,t))}},[o,u,d]),_=(0,r.useRef)(),v=(0,r.useCallback)(()=>{if(!o)return Se;let e=!!(o.isInitialized||o.initializedStoreOnce)&&m.every(e=>le(e,o,s)),n=t.lng||o.language,r=h.current,i=typeof l==`function`?N(l,{...o.options,ns:m}):l,a=_.current;if(a&&a.i18n===o&&a.ready===e&&a.lng===n&&a.namespaces===m&&a.keyPrefix===i&&a.revision===r)return a;let c={t:o.getFixedT(n,s.nsMode===`fallback`?m:m[0],l,{scopeNs:m}),i18n:o,ready:e,lng:n,namespaces:m,keyPrefix:i,revision:r};return _.current=c,c},[o,m,l,s,t.lng]),[y,b]=(0,r.useState)(0),{t:x,ready:S}=(0,xe.useSyncExternalStore)(g,v,v),C;o&&c&&!S&&(C=new Promise(e=>{let n=()=>e();t.lng?X(o,t.lng,m,n):Y(o,m,n)}),{t:x,ready:S}=v()),(0,r.useEffect)(()=>{if(o&&!S&&!c){let e=()=>b(e=>e+1);t.lng?X(o,t.lng,m,e):Y(o,m,e)}},[o,t.lng,m,S,c,y]);let w=o||{},T=(0,r.useRef)(null),E=(0,r.useRef)(),D=e=>`${e.language}|${e.resolvedLanguage}|${e.languages?.join(`,`)}`,O=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},k=(0,r.useMemo)(()=>{let e=w,t=e&&D(e),n=e;e&&(T.current&&T.current.__original===e&&E.current===t?n=T.current:(n=O(e),T.current=n,E.current=t));let r=!S&&!c?(...e)=>(q(o,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),x(...e)):x,i=[r,n,S];return i.t=r,i.i18n=n,i.ready=S,i},[x,w,S,w.resolvedLanguage,w.language,w.languages]);if(o&&c&&!S){let e=!1;try{e=!1}catch{}throw e&&q(o,`SUSPENDED_WHILE_LOADING`,`useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.i18next.com/latest/usetranslation-hook`),C}return k};export{G as i,ge as n,me as r,we as t};
@@ -1 +1 @@
1
- import{n as e}from"./state-_ZfNVAsd.js";import"./src-49LUQhkG.js";var t=e()(e=>({serverVersion:null,protocolVersion:null,capabilities:[],setHelloAck:t=>e({serverVersion:t.serverVersion||null,protocolVersion:t.protocolVersion||null,capabilities:t.capabilities})}));function n(){return`err-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}var r=e(e=>({errors:[],push:(t,r,i,a,o)=>{let s=``;return e(e=>{let c=e.errors.find(e=>!e.dismissed&&!e.action&&e.level===t&&e.title===r);if(c)return s=c.id,{errors:e.errors.map(e=>e.id===c.id?{...e,count:e.count+1,timestamp:Date.now()}:e)};let l=n();s=l;let u={id:l,level:t,title:r,detail:i,action:a,timestamp:Date.now(),dismissed:!1,durationMs:o,count:1};return{errors:[...e.errors.slice(-49),u]}}),s},dismiss:t=>e(e=>({errors:e.errors.map(e=>e.id===t?{...e,dismissed:!0}:e)})),clearAll:()=>e({errors:[]})})),i={info:(e,t,n)=>r.getState().push(`info`,e,t,void 0,n),warn:(e,t,n)=>r.getState().push(`warning`,e,t,void 0,n),error:(e,t,n)=>r.getState().push(`error`,e,t,void 0,n),critical:(e,t,n)=>r.getState().push(`critical`,e,t,void 0,n)},a=20,o=15e3,s=[500,1e3,2e3,5e3,1e4,o],c=3,l=`dscode_pending_frames`,u=new Set([`question_answer`,`hook_allow`,`hook_deny`,`form_answer`]);function d(){try{let e=localStorage.getItem(l);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];let n=Date.now()-6e5;return t.filter(e=>!!e&&typeof e.type==`string`&&u.has(e.type)&&typeof e.queuedAt==`number`&&e.queuedAt>=n)}catch{return[]}}function f(e){try{localStorage.setItem(l,JSON.stringify(e.slice(-20)))}catch{}}var p=()=>{let e=window.location.protocol===`https:`?`wss:`:`ws:`,t=window.location.hostname,n=window.location.port,r=n?String(Number(n)+1):``;return`${e}//${r?`${t}:${r}`:t}/ws`},m=p(),h=`dscode_client_id`;function g(){try{let e=localStorage.getItem(h);if(e)return e;let t=`web-${typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,10)}`;return localStorage.setItem(h,t),t}catch{return`web-${Math.random().toString(36).slice(2,10)}`}}var _=new class e{ws=null;url;clientId=g();messageHandlers=new Set;openHandlers=new Set;closeHandlers=new Set;errorHandlers=new Set;reconnectAttempts=0;reconnectHandlers=new Set;reconnectSuccessHandlers=new Set;reconnectGiveUpHandlers=new Set;isManualClose=!1;authenticated=!1;bfCached=!1;sessionId=null;visibleSessions=new Set;pendingFrames=d();heartbeatInterval=null;reconnectTimer=null;awaitingPong=0;HEARTBEAT_INTERVAL=15e3;MAX_MISSED_PONGS=3;static FOREGROUND_PROBE_TIMEOUT_MS=3e3;constructor(e){this.url=e||m,typeof window<`u`&&(window.addEventListener(`pagehide`,e=>{e.persisted&&this.enterBfCache()}),window.addEventListener(`pageshow`,e=>{e.persisted&&this.exitBfCache()}),window.addEventListener(`online`,()=>this.retryImmediately(`网络恢复`)),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&this.probeOnForeground()}))}setSessionId(e){this.sessionId=e}setVisibleSessions(e){let t=new Set;for(let n of e)n&&t.add(n);if(t.size===this.visibleSessions.size){let e=!0;for(let n of t)if(!this.visibleSessions.has(n)){e=!1;break}if(e)return}this.visibleSessions=t,this.sendSubscribeSessions()}sendSubscribeSessions(){if(this.visibleSessions.size!==0&&this.ws?.readyState===WebSocket.OPEN)try{this.ws.send(JSON.stringify({type:`subscribe_sessions`,data:JSON.stringify({sessionIds:[...this.visibleSessions]})}))}catch{}}getSessionId(){return this.sessionId}getPendingFrameCount(){return this.pendingFrames.length}getPendingFrameIds(){return this.pendingFrames.map(e=>e.id||e.type).filter(Boolean)}clearPendingQueue(){this.pendingFrames=[],f([])}enqueueReliableFrame(e){let t=(()=>{try{return e.data?JSON.parse(e.data):{}}catch{return{}}})(),n={type:e.type,sessionId:e.sessionId,data:e.data,id:typeof t.questionId==`string`?t.questionId:typeof t.approvalId==`string`?t.approvalId:typeof t.formId==`string`?t.formId:void 0,queuedAt:Date.now()},r=n.id?this.pendingFrames.filter(e=>e.id!==n.id||e.type!==n.type):this.pendingFrames;this.pendingFrames=[...r,n].slice(-20),f(this.pendingFrames),console.warn(`[WS] reliable frame queued (awaiting ack) ${e.type}${n.id?` (${n.id})`:``}`)}ackReliableFrame(e){if(!e)return;let t=this.pendingFrames.filter(t=>t.id!==e);t.length!==this.pendingFrames.length&&(this.pendingFrames=t,f(t))}flushPendingFrames(){if(this.ws?.readyState!==WebSocket.OPEN)return;let e=d(),t=[...this.pendingFrames];for(let n of e){let e=t.findIndex(e=>e.id===n.id&&e.type===n.type);e>=0?t[e]=n:t.push(n)}if(t.length!==0){this.pendingFrames=t.slice(-20),f(this.pendingFrames);for(let e of this.pendingFrames){if(this.ws?.readyState!==WebSocket.OPEN)break;try{this.ws.send(JSON.stringify({type:e.type,sessionId:e.sessionId,data:e.data}))}catch(t){console.warn(`[WS] Failed to replay pending frame`,e.type,String(t));break}}}}getReconnectState(){return{attempts:this.reconnectAttempts,maxAttempts:a,reconnecting:this.reconnectAttempts>0&&this.ws?.readyState!==WebSocket.OPEN}}onReconnectAttempt(e){return this.reconnectHandlers.add(e),()=>this.reconnectHandlers.delete(e)}onReconnectSuccess(e){return this.reconnectSuccessHandlers.add(e),()=>this.reconnectSuccessHandlers.delete(e)}onReconnectGiveUp(e){return this.reconnectGiveUpHandlers.add(e),()=>this.reconnectGiveUpHandlers.delete(e)}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;this.isManualClose=!1;let e=new URLSearchParams;this.sessionId&&e.set(`sessionId`,this.sessionId),e.set(`clientId`,this.clientId);let t=e.toString()?`${this.url}?${e.toString()}`:this.url;this.ws=new WebSocket(t),this.ws.binaryType=`arraybuffer`,this.ws.onopen=()=>{let e=this.reconnectAttempts>0;if(this.reconnectAttempts=0,this.awaitingPong=0,e&&this.reconnectSuccessHandlers.forEach(e=>e()),this.ws?.readyState===WebSocket.OPEN)try{this.ws.send(JSON.stringify({type:`hello`,clientType:`web`,protocolVersion:1,capabilities:[]}))}catch{}this.startHeartbeat(),this.ws?.readyState===WebSocket.OPEN&&(this.awaitingPong=1,this.ws.send(JSON.stringify({type:`ping`}))),this.flushPendingFrames(),this.sendSubscribeSessions(),this.openHandlers.forEach(e=>e())},this.ws.onclose=()=>{this.stopHeartbeat(),this.closeHandlers.forEach(e=>e()),!this.isManualClose&&!this.bfCached&&this.scheduleReconnect()},this.ws.onerror=e=>{this.reportConnectionTrouble(e.message||`Connection failed`),this.errorHandlers.forEach(e=>e())},this.ws.onmessage=e=>{this._onMessage(e)}}async _onMessage(e){try{let n;if(n=e.data instanceof Blob?await e.data.text():e.data instanceof ArrayBuffer?new TextDecoder().decode(e.data):typeof e.data==`string`?e.data:String(e.data),n=n.trim(),!n)return;let r=JSON.parse(n);if((r.type===`pong`||r.type===`ping`)&&(this.awaitingPong=0,r.type===`pong`))return;if(r.type===`hello_ack`){try{let e=typeof r.data==`string`?JSON.parse(r.data):r.data;e&&typeof e==`object`&&t.getState().setHelloAck({serverVersion:typeof e.serverVersion==`string`?e.serverVersion:``,protocolVersion:typeof e.protocolVersion==`number`?e.protocolVersion:0,capabilities:Array.isArray(e.capabilities)?e.capabilities.filter(e=>typeof e==`string`):[]})}catch{}return}if(r.seq!==void 0&&r.seq>=0&&this.send({type:`message_ack`,data:JSON.stringify({seq:r.seq})}),r.type===`question_answer_ack`||r.type===`hook_response_ack`)try{let e=(typeof r.data==`string`?JSON.parse(r.data):r.data)||{};this.ackReliableFrame(typeof e.questionId==`string`?e.questionId:typeof e.approvalId==`string`?e.approvalId:void 0)}catch{}this.messageHandlers.forEach(e=>e(r))}catch(t){let n=e.data?.constructor?.name||typeof e.data,r;if(r=e.data instanceof Blob?`[Blob ${e.data.size} bytes]`:e.data instanceof ArrayBuffer?`[ArrayBuffer ${e.data.byteLength} bytes]`:String(e.data).slice(0,500),typeof e.data==`string`&&e.data.trim()){let t=e.data.trim();try{this.messageHandlers.forEach(e=>e({type:`log`,data:JSON.stringify({level:`info`,message:t})}));return}catch{}}i.error(`Failed to parse WebSocket message`,`type=${n} data=${r} error=${t}`)}}startHeartbeat(){this.stopHeartbeat(),this.awaitingPong=0,this.heartbeatInterval=setInterval(()=>{this.bfCached||(this.awaitingPong>=this.MAX_MISSED_PONGS?this.forceReconnect(`Heartbeat timeout (${this.awaitingPong} missed pongs)`):this.ws?.readyState===WebSocket.OPEN&&(this.awaitingPong+=1,this.send({type:`ping`})))},this.HEARTBEAT_INTERVAL)}stopHeartbeat(){this.heartbeatInterval&&=(clearInterval(this.heartbeatInterval),null),this.awaitingPong=0}enterBfCache(){this.bfCached=!0,this.stopHeartbeat(),this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null)}exitBfCache(){this.bfCached=!1,this.reconnectAttempts=0,this.ws?.readyState!==WebSocket.OPEN&&this.ws?.readyState!==WebSocket.CONNECTING&&this.connect()}scheduleReconnect(){if(this.reconnectAttempts++,this.reconnectAttempts>a){console.error(`[WS] Max reconnect attempts (${a}) reached — giving up.`),i.error(`WebSocket`,`Connection lost — max reconnect attempts (${a}) reached. Refresh the page to try again.`),this.reconnectGiveUpHandlers.forEach(e=>e());return}let e=s[Math.min(this.reconnectAttempts-1,s.length-1)]??o,t=Math.max(100,Math.round(e*(.8+Math.random()*.4)));this.reconnectHandlers.forEach(e=>e(this.reconnectAttempts,a)),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}reportConnectionTrouble(e){let t=Math.min(this.reconnectAttempts+1,a);this.reconnectAttempts<c?console.debug(`[WS] connection error (attempt ${t}/${a}): ${e}`):i.warn(`WebSocket 连接不稳定`,`正在重连(第 ${t}/${a} 次):${e}`)}retryImmediately(e){if(this.bfCached)return;let t=this.ws?.readyState;t!==WebSocket.OPEN&&t!==WebSocket.CONNECTING&&(this.reconnectAttempts!==0||this.reconnectTimer!==null)&&(console.debug(`[WS] ${e} → 立即重连(重置退避)`),this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.reconnectAttempts=0,this.connect())}forceReconnect(e){console.warn(`[WS] ${e}, reconnecting...`),this.stopHeartbeat(),this.isManualClose=!0,this.ws?.close(),this.ws=null,this.scheduleReconnect()}probeOnForeground(){if(this.bfCached)return;let t=this.ws?.readyState;if(t===WebSocket.CONNECTING)return;if(t!==WebSocket.OPEN){this.retryImmediately(`标签页恢复可见`);return}if(this.awaitingPong<=0)return;this.awaitingPong+=1,this.send({type:`ping`});let n=this.awaitingPong;setTimeout(()=>{this.bfCached||this.ws?.readyState===WebSocket.OPEN&&this.awaitingPong>=n&&this.forceReconnect(`前台探活无应答(半开连接)`)},e.FOREGROUND_PROBE_TIMEOUT_MS)}disconnect(){this.isManualClose=!0,this.reconnectAttempts=0,this.stopHeartbeat(),this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.ws?.close(),this.ws=null}send(e){if(e.type&&u.has(e.type)){if(this.enqueueReliableFrame(e),this.ws?.readyState===WebSocket.OPEN)try{this.ws.send(JSON.stringify(e))}catch{}return!0}if(this.ws?.readyState===WebSocket.OPEN){let t=JSON.stringify(e);return this.ws.send(t),!0}return console.warn(`[WS] NOT CONNECTED — dropping:`,e.type,e.sessionId,`readyState=`,this.ws?.readyState),!1}onMessage(e){return this.messageHandlers.add(e),()=>this.messageHandlers.delete(e)}onOpen(e){return this.openHandlers.add(e),()=>this.openHandlers.delete(e)}onClose(e){return this.closeHandlers.add(e),()=>this.closeHandlers.delete(e)}onError(e){return this.errorHandlers.add(e),()=>this.errorHandlers.delete(e)}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}setToken(e){try{sessionStorage.setItem(`auth_token`,e)}catch{}}get isAuthenticated(){return this.authenticated}setAuthenticated(e){this.authenticated=e}};export{r as i,_ as n,i as r,p as t};
1
+ import{n as e}from"./state-CSZ50keL.js";import"./src-49LUQhkG.js";var t=e()(e=>({serverVersion:null,protocolVersion:null,capabilities:[],setHelloAck:t=>e({serverVersion:t.serverVersion||null,protocolVersion:t.protocolVersion||null,capabilities:t.capabilities})}));function n(){return`err-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}var r=e(e=>({errors:[],push:(t,r,i,a,o)=>{let s=``;return e(e=>{let c=e.errors.find(e=>!e.dismissed&&!e.action&&e.level===t&&e.title===r);if(c)return s=c.id,{errors:e.errors.map(e=>e.id===c.id?{...e,count:e.count+1,timestamp:Date.now()}:e)};let l=n();s=l;let u={id:l,level:t,title:r,detail:i,action:a,timestamp:Date.now(),dismissed:!1,durationMs:o,count:1};return{errors:[...e.errors.slice(-49),u]}}),s},dismiss:t=>e(e=>({errors:e.errors.map(e=>e.id===t?{...e,dismissed:!0}:e)})),clearAll:()=>e({errors:[]})})),i={info:(e,t,n)=>r.getState().push(`info`,e,t,void 0,n),warn:(e,t,n)=>r.getState().push(`warning`,e,t,void 0,n),error:(e,t,n)=>r.getState().push(`error`,e,t,void 0,n),critical:(e,t,n)=>r.getState().push(`critical`,e,t,void 0,n)},a=20,o=15e3,s=[500,1e3,2e3,5e3,1e4,o],c=3,l=`dscode_pending_frames`,u=new Set([`question_answer`,`hook_allow`,`hook_deny`,`form_answer`]);function d(){try{let e=localStorage.getItem(l);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];let n=Date.now()-6e5;return t.filter(e=>!!e&&typeof e.type==`string`&&u.has(e.type)&&typeof e.queuedAt==`number`&&e.queuedAt>=n)}catch{return[]}}function f(e){try{localStorage.setItem(l,JSON.stringify(e.slice(-20)))}catch{}}var p=()=>{let e=window.location.protocol===`https:`?`wss:`:`ws:`,t=window.location.hostname,n=window.location.port,r=n?String(Number(n)+1):``;return`${e}//${r?`${t}:${r}`:t}/ws`},m=p(),h=`dscode_client_id`;function g(){try{let e=localStorage.getItem(h);if(e)return e;let t=`web-${typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,10)}`;return localStorage.setItem(h,t),t}catch{return`web-${Math.random().toString(36).slice(2,10)}`}}var _=new class e{ws=null;url;clientId=g();messageHandlers=new Set;openHandlers=new Set;closeHandlers=new Set;errorHandlers=new Set;reconnectAttempts=0;reconnectHandlers=new Set;reconnectSuccessHandlers=new Set;reconnectGiveUpHandlers=new Set;isManualClose=!1;authenticated=!1;bfCached=!1;sessionId=null;visibleSessions=new Set;pendingFrames=d();heartbeatInterval=null;reconnectTimer=null;awaitingPong=0;HEARTBEAT_INTERVAL=15e3;MAX_MISSED_PONGS=3;static FOREGROUND_PROBE_TIMEOUT_MS=3e3;constructor(e){this.url=e||m,typeof window<`u`&&(window.addEventListener(`pagehide`,e=>{e.persisted&&this.enterBfCache()}),window.addEventListener(`pageshow`,e=>{e.persisted&&this.exitBfCache()}),window.addEventListener(`online`,()=>this.retryImmediately(`网络恢复`)),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&this.probeOnForeground()}))}setSessionId(e){this.sessionId=e}setVisibleSessions(e){let t=new Set;for(let n of e)n&&t.add(n);if(t.size===this.visibleSessions.size){let e=!0;for(let n of t)if(!this.visibleSessions.has(n)){e=!1;break}if(e)return}this.visibleSessions=t,this.sendSubscribeSessions()}sendSubscribeSessions(){if(this.visibleSessions.size!==0&&this.ws?.readyState===WebSocket.OPEN)try{this.ws.send(JSON.stringify({type:`subscribe_sessions`,data:JSON.stringify({sessionIds:[...this.visibleSessions]})}))}catch{}}getSessionId(){return this.sessionId}getPendingFrameCount(){return this.pendingFrames.length}getPendingFrameIds(){return this.pendingFrames.map(e=>e.id||e.type).filter(Boolean)}clearPendingQueue(){this.pendingFrames=[],f([])}enqueueReliableFrame(e){let t=(()=>{try{return e.data?JSON.parse(e.data):{}}catch{return{}}})(),n={type:e.type,sessionId:e.sessionId,data:e.data,id:typeof t.questionId==`string`?t.questionId:typeof t.approvalId==`string`?t.approvalId:typeof t.formId==`string`?t.formId:void 0,queuedAt:Date.now()},r=n.id?this.pendingFrames.filter(e=>e.id!==n.id||e.type!==n.type):this.pendingFrames;this.pendingFrames=[...r,n].slice(-20),f(this.pendingFrames),console.warn(`[WS] reliable frame queued (awaiting ack) ${e.type}${n.id?` (${n.id})`:``}`)}ackReliableFrame(e){if(!e)return;let t=this.pendingFrames.filter(t=>t.id!==e);t.length!==this.pendingFrames.length&&(this.pendingFrames=t,f(t))}flushPendingFrames(){if(this.ws?.readyState!==WebSocket.OPEN)return;let e=d(),t=[...this.pendingFrames];for(let n of e){let e=t.findIndex(e=>e.id===n.id&&e.type===n.type);e>=0?t[e]=n:t.push(n)}if(t.length!==0){this.pendingFrames=t.slice(-20),f(this.pendingFrames);for(let e of this.pendingFrames){if(this.ws?.readyState!==WebSocket.OPEN)break;try{this.ws.send(JSON.stringify({type:e.type,sessionId:e.sessionId,data:e.data}))}catch(t){console.warn(`[WS] Failed to replay pending frame`,e.type,String(t));break}}}}getReconnectState(){return{attempts:this.reconnectAttempts,maxAttempts:a,reconnecting:this.reconnectAttempts>0&&this.ws?.readyState!==WebSocket.OPEN}}onReconnectAttempt(e){return this.reconnectHandlers.add(e),()=>this.reconnectHandlers.delete(e)}onReconnectSuccess(e){return this.reconnectSuccessHandlers.add(e),()=>this.reconnectSuccessHandlers.delete(e)}onReconnectGiveUp(e){return this.reconnectGiveUpHandlers.add(e),()=>this.reconnectGiveUpHandlers.delete(e)}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;this.isManualClose=!1;let e=new URLSearchParams;this.sessionId&&e.set(`sessionId`,this.sessionId),e.set(`clientId`,this.clientId);let t=e.toString()?`${this.url}?${e.toString()}`:this.url;this.ws=new WebSocket(t),this.ws.binaryType=`arraybuffer`,this.ws.onopen=()=>{let e=this.reconnectAttempts>0;if(this.reconnectAttempts=0,this.awaitingPong=0,e&&this.reconnectSuccessHandlers.forEach(e=>e()),this.ws?.readyState===WebSocket.OPEN)try{this.ws.send(JSON.stringify({type:`hello`,clientType:`web`,protocolVersion:1,capabilities:[]}))}catch{}this.startHeartbeat(),this.ws?.readyState===WebSocket.OPEN&&(this.awaitingPong=1,this.ws.send(JSON.stringify({type:`ping`}))),this.flushPendingFrames(),this.sendSubscribeSessions(),this.openHandlers.forEach(e=>e())},this.ws.onclose=()=>{this.stopHeartbeat(),this.closeHandlers.forEach(e=>e()),!this.isManualClose&&!this.bfCached&&this.scheduleReconnect()},this.ws.onerror=e=>{this.reportConnectionTrouble(e.message||`Connection failed`),this.errorHandlers.forEach(e=>e())},this.ws.onmessage=e=>{this._onMessage(e)}}async _onMessage(e){try{let n;if(n=e.data instanceof Blob?await e.data.text():e.data instanceof ArrayBuffer?new TextDecoder().decode(e.data):typeof e.data==`string`?e.data:String(e.data),n=n.trim(),!n)return;let r=JSON.parse(n);if((r.type===`pong`||r.type===`ping`)&&(this.awaitingPong=0,r.type===`pong`))return;if(r.type===`hello_ack`){try{let e=typeof r.data==`string`?JSON.parse(r.data):r.data;e&&typeof e==`object`&&t.getState().setHelloAck({serverVersion:typeof e.serverVersion==`string`?e.serverVersion:``,protocolVersion:typeof e.protocolVersion==`number`?e.protocolVersion:0,capabilities:Array.isArray(e.capabilities)?e.capabilities.filter(e=>typeof e==`string`):[]})}catch{}return}if(r.seq!==void 0&&r.seq>=0&&this.send({type:`message_ack`,data:JSON.stringify({seq:r.seq})}),r.type===`question_answer_ack`||r.type===`hook_response_ack`)try{let e=(typeof r.data==`string`?JSON.parse(r.data):r.data)||{};this.ackReliableFrame(typeof e.questionId==`string`?e.questionId:typeof e.approvalId==`string`?e.approvalId:void 0)}catch{}this.messageHandlers.forEach(e=>e(r))}catch(t){let n=e.data?.constructor?.name||typeof e.data,r;if(r=e.data instanceof Blob?`[Blob ${e.data.size} bytes]`:e.data instanceof ArrayBuffer?`[ArrayBuffer ${e.data.byteLength} bytes]`:String(e.data).slice(0,500),typeof e.data==`string`&&e.data.trim()){let t=e.data.trim();try{this.messageHandlers.forEach(e=>e({type:`log`,data:JSON.stringify({level:`info`,message:t})}));return}catch{}}i.error(`Failed to parse WebSocket message`,`type=${n} data=${r} error=${t}`)}}startHeartbeat(){this.stopHeartbeat(),this.awaitingPong=0,this.heartbeatInterval=setInterval(()=>{this.bfCached||(this.awaitingPong>=this.MAX_MISSED_PONGS?this.forceReconnect(`Heartbeat timeout (${this.awaitingPong} missed pongs)`):this.ws?.readyState===WebSocket.OPEN&&(this.awaitingPong+=1,this.send({type:`ping`})))},this.HEARTBEAT_INTERVAL)}stopHeartbeat(){this.heartbeatInterval&&=(clearInterval(this.heartbeatInterval),null),this.awaitingPong=0}enterBfCache(){this.bfCached=!0,this.stopHeartbeat(),this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null)}exitBfCache(){this.bfCached=!1,this.reconnectAttempts=0,this.ws?.readyState!==WebSocket.OPEN&&this.ws?.readyState!==WebSocket.CONNECTING&&this.connect()}scheduleReconnect(){if(this.reconnectAttempts++,this.reconnectAttempts>a){console.error(`[WS] Max reconnect attempts (${a}) reached — giving up.`),i.error(`WebSocket`,`Connection lost — max reconnect attempts (${a}) reached. Refresh the page to try again.`),this.reconnectGiveUpHandlers.forEach(e=>e());return}let e=s[Math.min(this.reconnectAttempts-1,s.length-1)]??o,t=Math.max(100,Math.round(e*(.8+Math.random()*.4)));this.reconnectHandlers.forEach(e=>e(this.reconnectAttempts,a)),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}reportConnectionTrouble(e){let t=Math.min(this.reconnectAttempts+1,a);this.reconnectAttempts<c?console.debug(`[WS] connection error (attempt ${t}/${a}): ${e}`):i.warn(`WebSocket 连接不稳定`,`正在重连(第 ${t}/${a} 次):${e}`)}retryImmediately(e){if(this.bfCached)return;let t=this.ws?.readyState;t!==WebSocket.OPEN&&t!==WebSocket.CONNECTING&&(this.reconnectAttempts!==0||this.reconnectTimer!==null)&&(console.debug(`[WS] ${e} → 立即重连(重置退避)`),this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.reconnectAttempts=0,this.connect())}forceReconnect(e){console.warn(`[WS] ${e}, reconnecting...`),this.stopHeartbeat(),this.isManualClose=!0,this.ws?.close(),this.ws=null,this.scheduleReconnect()}probeOnForeground(){if(this.bfCached)return;let t=this.ws?.readyState;if(t===WebSocket.CONNECTING)return;if(t!==WebSocket.OPEN){this.retryImmediately(`标签页恢复可见`);return}if(this.awaitingPong<=0)return;this.awaitingPong+=1,this.send({type:`ping`});let n=this.awaitingPong;setTimeout(()=>{this.bfCached||this.ws?.readyState===WebSocket.OPEN&&this.awaitingPong>=n&&this.forceReconnect(`前台探活无应答(半开连接)`)},e.FOREGROUND_PROBE_TIMEOUT_MS)}disconnect(){this.isManualClose=!0,this.reconnectAttempts=0,this.stopHeartbeat(),this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.ws?.close(),this.ws=null}send(e){if(e.type&&u.has(e.type)){if(this.enqueueReliableFrame(e),this.ws?.readyState===WebSocket.OPEN)try{this.ws.send(JSON.stringify(e))}catch{}return!0}if(this.ws?.readyState===WebSocket.OPEN){let t=JSON.stringify(e);return this.ws.send(t),!0}return console.warn(`[WS] NOT CONNECTED — dropping:`,e.type,e.sessionId,`readyState=`,this.ws?.readyState),!1}onMessage(e){return this.messageHandlers.add(e),()=>this.messageHandlers.delete(e)}onOpen(e){return this.openHandlers.add(e),()=>this.openHandlers.delete(e)}onClose(e){return this.closeHandlers.add(e),()=>this.closeHandlers.delete(e)}onError(e){return this.errorHandlers.add(e),()=>this.errorHandlers.delete(e)}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}setToken(e){try{sessionStorage.setItem(`auth_token`,e)}catch{}}get isAuthenticated(){return this.authenticated}setAuthenticated(e){this.authenticated=e}};export{r as i,_ as n,i as r,p as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./state-CSZ50keL.js";var t=e(e=>({isOpen:!1,entries:null,openWhatsNew:t=>e({isOpen:!0,entries:t??null}),closeWhatsNew:()=>e({isOpen:!1})}));export{t};
@@ -58,31 +58,31 @@
58
58
  } catch (e) {}
59
59
  })();
60
60
  </script>
61
- <script type="module" crossorigin src="/assets/index-BX-d2OBW.js"></script>
61
+ <script type="module" crossorigin src="/assets/index-CTbLW314.js"></script>
62
62
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-COiEfhsA.js">
63
- <link rel="modulepreload" crossorigin href="/assets/icons-BvYhTENi.js">
64
- <link rel="modulepreload" crossorigin href="/assets/react-vendor-BlngCquv.js">
65
- <link rel="modulepreload" crossorigin href="/assets/useTranslation-BGmCDuQI.js">
66
- <link rel="modulepreload" crossorigin href="/assets/state-_ZfNVAsd.js">
67
- <link rel="modulepreload" crossorigin href="/assets/cn-rx4uumOJ.js">
63
+ <link rel="modulepreload" crossorigin href="/assets/icons-CYDRRPKW.js">
64
+ <link rel="modulepreload" crossorigin href="/assets/react-vendor-CB4cLN-6.js">
65
+ <link rel="modulepreload" crossorigin href="/assets/useTranslation-B-mfApCn.js">
66
+ <link rel="modulepreload" crossorigin href="/assets/state-CSZ50keL.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/markdown-N5__3T-w.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/useConfirm-Da8iQ_DZ.js">
68
69
  <link rel="modulepreload" crossorigin href="/assets/types-JssxRFJn.js">
69
70
  <link rel="modulepreload" crossorigin href="/assets/src-49LUQhkG.js">
70
71
  <link rel="modulepreload" crossorigin href="/assets/workspaceSemantics-RaIRer76.js">
71
- <link rel="modulepreload" crossorigin href="/assets/api-CCt9DRQm.js">
72
- <link rel="modulepreload" crossorigin href="/assets/markdown-DAQZeY5V.js">
73
- <link rel="modulepreload" crossorigin href="/assets/agentIconSet-Btsb_SC4.js">
74
- <link rel="modulepreload" crossorigin href="/assets/settingsStore-RLUAWgIk.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/api-plEYhRn0.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/agentIconSet-B5GUQwel.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/settingsStore-Xqln0d91.js">
75
75
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-BLdHbfdN.js">
76
- <link rel="modulepreload" crossorigin href="/assets/ttsSettings-DHo3OsOq.js">
77
- <link rel="modulepreload" crossorigin href="/assets/websocket-C9e3h7VU.js">
78
- <link rel="modulepreload" crossorigin href="/assets/common-BHXgEvgk.js">
79
- <link rel="modulepreload" crossorigin href="/assets/MessageBubble-CV16DZMG.js">
80
- <link rel="modulepreload" crossorigin href="/assets/ThreadsView-CDoM0aNb.js">
81
- <link rel="modulepreload" crossorigin href="/assets/whatsNewStore-Bf_7lW8o.js">
82
- <link rel="modulepreload" crossorigin href="/assets/panels-DYiQiVWh.js">
76
+ <link rel="modulepreload" crossorigin href="/assets/ttsSettings-BwXYpDnk.js">
77
+ <link rel="modulepreload" crossorigin href="/assets/websocket-BnDwh01e.js">
78
+ <link rel="modulepreload" crossorigin href="/assets/common-Bbatsa0-.js">
79
+ <link rel="modulepreload" crossorigin href="/assets/MessageBubble-CVGXupVH.js">
80
+ <link rel="modulepreload" crossorigin href="/assets/ThreadsView-XditIHZ4.js">
81
+ <link rel="modulepreload" crossorigin href="/assets/whatsNewStore-LpdLRLGl.js">
82
+ <link rel="modulepreload" crossorigin href="/assets/panels-CIPgN61N.js">
83
83
  <link rel="modulepreload" crossorigin href="/assets/channelMeta-BGQXQxgj.js">
84
84
  <link rel="stylesheet" crossorigin href="/assets/MessageBubble-CCTRbIMZ.css">
85
- <link rel="stylesheet" crossorigin href="/assets/index-BNI6CNsY.css">
85
+ <link rel="stylesheet" crossorigin href="/assets/index-DdzVrZye.css">
86
86
  </head>
87
87
  <body>
88
88
  <div id="root"></div>
@@ -0,0 +1,24 @@
1
+ {
2
+ "note": "Browser libraries self-hosted for ```component fences. Served at /vendor/<file> by the server's static handler (any file under the web dist dir). Never load these from a CDN: a remote <script src> hands the CDN the reader's IP on every render. Refresh with `bun run vendor:libs`; verify with `bun run check:hosts`.",
3
+ "version": 1,
4
+ "files": [
5
+ {
6
+ "file": "echarts.min.js",
7
+ "package": "echarts",
8
+ "version": "5.5.1",
9
+ "bytes": 1030855,
10
+ "sha256": "e84270bd0cd5bdf60fefc26d00c2a391cb2e81f4d26a7a9ee16185a54773a3cf",
11
+ "source": "https://registry.npmmirror.com/echarts/5.5.1/files/dist/echarts.min.js",
12
+ "license": "Apache-2.0"
13
+ },
14
+ {
15
+ "file": "d3.min.js",
16
+ "package": "d3",
17
+ "version": "7.9.0",
18
+ "bytes": 279706,
19
+ "sha256": "f2094bbf6141b359722c4fe454eb6c4b0f0e42cc10cc7af921fc158fceb86539",
20
+ "source": "https://registry.npmmirror.com/d3/7.9.0/files/dist/d3.min.js",
21
+ "license": "ISC"
22
+ }
23
+ ]
24
+ }