libre-webui 0.43.0 → 0.44.0

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 (152) hide show
  1. package/README.md +2 -0
  2. package/backend/dist/services/agentCliService.d.ts.map +1 -1
  3. package/backend/dist/services/agentCliService.js +1 -0
  4. package/backend/dist/services/agentCliService.js.map +1 -1
  5. package/backend/dist/services/pluginService.d.ts.map +1 -1
  6. package/backend/dist/services/pluginService.js +12 -9
  7. package/backend/dist/services/pluginService.js.map +1 -1
  8. package/backend/dist/services/workAgentHostLogins.d.ts.map +1 -1
  9. package/backend/dist/services/workAgentHostLogins.js +4 -0
  10. package/backend/dist/services/workAgentHostLogins.js.map +1 -1
  11. package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
  12. package/backend/dist/services/workModelProviderService.js +13 -1
  13. package/backend/dist/services/workModelProviderService.js.map +1 -1
  14. package/backend/dist/utils/pluginChatAdapter.d.ts +15 -1
  15. package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
  16. package/backend/dist/utils/pluginChatAdapter.js +53 -5
  17. package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
  18. package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
  19. package/backend/dist/utils/pluginDefinitionTrust.js +5 -3
  20. package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
  21. package/backend/dist/utils/pluginModelCatalog.d.ts +10 -0
  22. package/backend/dist/utils/pluginModelCatalog.d.ts.map +1 -1
  23. package/backend/dist/utils/pluginModelCatalog.js +24 -0
  24. package/backend/dist/utils/pluginModelCatalog.js.map +1 -1
  25. package/backend/package.json +2 -2
  26. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  27. package/frontend/dist/artifact-runtime/babel.js +179 -173
  28. package/frontend/dist/artifact-runtime/chart.js +1 -1
  29. package/frontend/dist/artifact-runtime/d3.js +4 -4
  30. package/frontend/dist/artifact-runtime/framer-motion.js +2 -10
  31. package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
  32. package/frontend/dist/artifact-runtime/mathjs.js +1 -1
  33. package/frontend/dist/artifact-runtime/mermaid.js +368 -368
  34. package/frontend/dist/artifact-runtime/plotly.js +59 -59
  35. package/frontend/dist/artifact-runtime/recharts.js +45 -45
  36. package/frontend/dist/artifact-runtime/tailwind.js +18 -18
  37. package/frontend/dist/artifact-runtime/three.js +419 -397
  38. package/frontend/dist/artifact-runtime/tone.js +1 -1
  39. package/frontend/dist/assets/index-BM0txgxR.css +2 -0
  40. package/frontend/dist/assets/index-CekTqSoE.js +67 -0
  41. package/frontend/dist/assets/{markdown-math-Ngnvt50Q.css → markdown-math-Bv5fr4tV.css} +1 -1
  42. package/frontend/dist/index.html +30 -30
  43. package/frontend/dist/js/{ArtifactContainer-C0R4kYVM.js → ArtifactContainer-C7EEweSP.js} +1 -1
  44. package/frontend/dist/js/{ArtifactDemoPage-BQmbCyat.js → ArtifactDemoPage-B3yjn6Dw.js} +2 -2
  45. package/frontend/dist/js/{ArtifactSandboxFrame-CkDkrHpg.js → ArtifactSandboxFrame-DGC1hgTq.js} +6 -6
  46. package/frontend/dist/js/ArtifactSlideOutPanel-xamxqotB.js +1 -0
  47. package/frontend/dist/js/{AutomationModal-Cx1e_4df.js → AutomationModal-Dj0E2mSl.js} +1 -1
  48. package/frontend/dist/js/AutomationsPage-MTqU8Ap9.js +1 -0
  49. package/frontend/dist/js/{AvatarUpload-DGRQC20B.js → AvatarUpload-CrNLFoIi.js} +1 -1
  50. package/frontend/dist/js/{Button-DwZ26Lqc.js → Button-BGE6ZJv5.js} +1 -1
  51. package/frontend/dist/js/CalendarPage-BciFDr0S.js +1 -0
  52. package/frontend/dist/js/ChannelsPage-De96Q63V.js +1 -0
  53. package/frontend/dist/js/ChatPage-CTRKLQly.js +14 -0
  54. package/frontend/dist/js/ConnectModels-BPwpeVsJ.js +1 -0
  55. package/frontend/dist/js/EvaluationsPage-CT7EAYaj.js +2 -0
  56. package/frontend/dist/js/FirstTimeSetup-BXkaFkvk.js +1 -0
  57. package/frontend/dist/js/GalleryPage-BPUY12kj.js +1 -0
  58. package/frontend/dist/js/HomePage-16KFuUir.js +1 -0
  59. package/frontend/dist/js/{LanguageSwitcher-CASJ8p5d.js → LanguageSwitcher-MlITAZf6.js} +1 -1
  60. package/frontend/dist/js/{Logo-C-qwuy58.js → Logo-GlNrhpKp.js} +1 -1
  61. package/frontend/dist/js/{LogoMark-zP-mitdI.js → LogoMark-rgOHhWo-.js} +1 -1
  62. package/frontend/dist/js/{ModelManagerModals-BYhFWv22.js → ModelManagerModals-inYMmqa4.js} +1 -1
  63. package/frontend/dist/js/NotesPage-kYFIBBCu.js +3 -0
  64. package/frontend/dist/js/{PasswordStrengthMeter-Dow8ZeTs.js → PasswordStrengthMeter-ppDWQU9P.js} +1 -1
  65. package/frontend/dist/js/PersonasPage-mzAft_NC.js +13 -0
  66. package/frontend/dist/js/PluginUsagePage-DQvsXxpI.js +1 -0
  67. package/frontend/dist/js/{RichMessageContent-DJTLGpws.js → RichMessageContent-BW9UvzYw.js} +1 -1
  68. package/frontend/dist/js/{RichMessageContent-Bwpg3rfV.js → RichMessageContent-BraVuu1Q.js} +3 -3
  69. package/frontend/dist/js/SettingsModal-B-5JP50i.js +19 -0
  70. package/frontend/dist/js/SettingsToggle-BT6cbOnw.js +1 -0
  71. package/frontend/dist/js/{ShareDialog-DYwyeyaI.js → ShareDialog-CmgHPnKg.js} +1 -1
  72. package/frontend/dist/js/StrandsPage-Dg55juWQ.js +1 -0
  73. package/frontend/dist/js/{SystemPage-B4qFsAsb.js → SystemPage-PZhbWJCh.js} +1 -1
  74. package/frontend/dist/js/{TurnstileWidget-xx9lQV0b.js → TurnstileWidget-B_dl1YjT.js} +1 -1
  75. package/frontend/dist/js/{UserManagementPage-DhMRuhqj.js → UserManagementPage-BrogyZDQ.js} +1 -1
  76. package/frontend/dist/js/UserManagementPanel-DBwIOSOw.js +1 -0
  77. package/frontend/dist/js/{WhatsNewModal-DfR7W93-.js → WhatsNewModal-DunfwUe9.js} +1 -1
  78. package/frontend/dist/js/WorkPage-DQlsa18h.js +7 -0
  79. package/frontend/dist/js/api-DG2AKSTU.js +16 -0
  80. package/frontend/dist/js/api-DdDgFM-F.js +1 -0
  81. package/frontend/dist/js/{appNavigation-BifMRN3D.js → appNavigation-DXonlffV.js} +1 -1
  82. package/frontend/dist/js/{appStore-B6pAGo3p.js → appStore-DMmgXb-0.js} +2 -2
  83. package/frontend/dist/js/appVersion-Bl_QXi35.js +1 -0
  84. package/frontend/dist/js/authStore-ByVF8A2u.js +1 -0
  85. package/frontend/dist/js/{authStore-DdIb6km_.js → authStore-C89vePrB.js} +3 -3
  86. package/frontend/dist/js/chatStore-BooPA4cg.js +3 -0
  87. package/frontend/dist/js/{client-D_F_0LqX.js → client-D05vqJPO.js} +2 -2
  88. package/frontend/dist/js/{config-CHUQTU6j.js → config-DCQ2-rvE.js} +1 -1
  89. package/frontend/dist/js/{evaluationsApi-C0FKNJua.js → evaluationsApi-oCNxDBZ4.js} +1 -1
  90. package/frontend/dist/js/logger-DAQsBb8I.js +1 -0
  91. package/frontend/dist/js/markdown-html-DRL6swKb.js +2 -0
  92. package/frontend/dist/js/{markdown-math-BzLEmswF.js → markdown-math-CCWDDhWR.js} +3 -3
  93. package/frontend/dist/js/{markdownHtml-B1Ll_Qgp.js → markdownHtml-DpKMtcCu.js} +1 -1
  94. package/frontend/dist/js/markdownMath-CKB9Q-yN.js +1 -0
  95. package/frontend/dist/js/{messageCodeStyles-DVYyK8wm.js → messageCodeStyles-tSFFCV6k.js} +1 -1
  96. package/frontend/dist/js/rfb-xHgMEWMb.js +5 -0
  97. package/frontend/dist/js/router-vendor-DLHZHk4K.js +1 -0
  98. package/frontend/dist/js/{strandsApi-CeJLezXW.js → strandsApi-Fs6zV4CA.js} +1 -1
  99. package/frontend/dist/js/{teamEventStream-DOMyufrH.js → teamEventStream-DD_ASSs5.js} +1 -1
  100. package/frontend/dist/js/ui-DATtlADq.js +2 -0
  101. package/frontend/dist/js/ui-vendor-WdvBNwsu.js +1 -0
  102. package/frontend/dist/js/useChat-RXTiCFz0.js +13 -0
  103. package/frontend/dist/js/useDictation-YyALwnw6.js +1 -0
  104. package/frontend/dist/js/useQuery-DCqz3UJt.js +1 -0
  105. package/frontend/dist/js/{useTranslation-D9EScZXH.js → useTranslation-D-_KTORQ.js} +1 -1
  106. package/frontend/dist/js/utils-DsCVr_wG.js +1 -0
  107. package/frontend/dist/js/workApi-CbFQfwRZ.js +5 -0
  108. package/frontend/dist/js/workApi-CmH9c1xh.js +1 -0
  109. package/package.json +3 -3
  110. package/plugins/baseten.json +68 -0
  111. package/plugins/codex-oauth.json +1 -0
  112. package/plugins/modal.json +82 -0
  113. package/plugins/openai.json +2 -1
  114. package/plugins/openrouter.json +1 -0
  115. package/frontend/dist/assets/index-BnbO3eTY.js +0 -83
  116. package/frontend/dist/assets/index-CYKYBgsy.css +0 -2
  117. package/frontend/dist/js/ArtifactSlideOutPanel-DZnVzC0c.js +0 -1
  118. package/frontend/dist/js/AutomationsPage-D7UtYZ_0.js +0 -1
  119. package/frontend/dist/js/CalendarPage-WmA1i7MQ.js +0 -1
  120. package/frontend/dist/js/ChannelsPage-Bq4JQPR_.js +0 -1
  121. package/frontend/dist/js/ChatPage-Cd3fxx-N.js +0 -14
  122. package/frontend/dist/js/ConnectModels-BYul-veF.js +0 -1
  123. package/frontend/dist/js/EvaluationsPage-CV_Terzn.js +0 -2
  124. package/frontend/dist/js/FirstTimeSetup-CFhGy9a8.js +0 -1
  125. package/frontend/dist/js/GalleryPage-BRKZyq1w.js +0 -1
  126. package/frontend/dist/js/HomePage-DdpnBu-Z.js +0 -1
  127. package/frontend/dist/js/NotesPage-CmvVoWcH.js +0 -3
  128. package/frontend/dist/js/PersonasPage-BYKtoKWl.js +0 -13
  129. package/frontend/dist/js/PluginUsagePage-BVTOCxoE.js +0 -1
  130. package/frontend/dist/js/SettingsModal-CGyVfxOz.js +0 -19
  131. package/frontend/dist/js/SettingsToggle-BpD6NSri.js +0 -1
  132. package/frontend/dist/js/StrandsPage-CvXeYOYR.js +0 -1
  133. package/frontend/dist/js/UserManagementPanel-BVLSvRwa.js +0 -1
  134. package/frontend/dist/js/WorkPage-DSKBQEW0.js +0 -7
  135. package/frontend/dist/js/api-C5ps_CWQ.js +0 -1
  136. package/frontend/dist/js/api-D6IF0v9_.js +0 -16
  137. package/frontend/dist/js/appVersion-9UMn7b1T.js +0 -1
  138. package/frontend/dist/js/authStore-CDo5Co2D.js +0 -1
  139. package/frontend/dist/js/chatStore-hzQyRM9H.js +0 -3
  140. package/frontend/dist/js/logger-rEW7uQ8m.js +0 -1
  141. package/frontend/dist/js/markdown-html-BdYVneHE.js +0 -2
  142. package/frontend/dist/js/markdownMath-aI8uDQmz.js +0 -1
  143. package/frontend/dist/js/rfb-IV07oQgM.js +0 -5
  144. package/frontend/dist/js/router-vendor-qltZAWoz.js +0 -1
  145. package/frontend/dist/js/ui-D4Ytvr6d.js +0 -2
  146. package/frontend/dist/js/ui-vendor-BTcw5yZ6.js +0 -1
  147. package/frontend/dist/js/useChat-BEbNywiP.js +0 -13
  148. package/frontend/dist/js/useDictation-jTaorrHm.js +0 -1
  149. package/frontend/dist/js/useQuery-2_pQiHbl.js +0 -1
  150. package/frontend/dist/js/utils-BvvV-Cka.js +0 -1
  151. package/frontend/dist/js/workApi-CGvfDTRY.js +0 -1
  152. package/frontend/dist/js/workApi-_0oxRyak.js +0 -5
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./react-vendor-C1iE8mnY.js";import{t as i}from"./useQuery-DCqz3UJt.js";import{d as a}from"./router-vendor-DLHZHk4K.js";import{t as o}from"./utils-DsCVr_wG.js";import{t as s}from"./useTranslation-D-_KTORQ.js";import{g as c,s as l,t as u}from"./chatStore-BooPA4cg.js";import{t as d}from"./logger-DAQsBb8I.js";import{$n as f,$t as p,An as m,Dn as h,G as g,Jt as _,Lt as v,M as y,Mn as b,Or as x,Q as S,S as C,Zn as w,Zt as ee,c as T,dr as E,er as te,n as D,nt as O,sr as k,t as ne,zn as re}from"./ui-vendor-WdvBNwsu.js";import{t as ie}from"./Button-BGE6ZJv5.js";import"./ui-DATtlADq.js";import{S as ae,g as oe,t as A,y as j}from"./api-DG2AKSTU.js";import{t as se}from"./authStore-C89vePrB.js";import{i as M,n as N,r as P,t as F}from"./thinking-DwlkTfPX.js";var I=e(t(),1),ce=n(),le=` · `,ue=`strands:plugin:`,de=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function fe(e){return e.agentId||e.name.split(`:`)[0]||e.name}function pe(e){return/embed/i.test(e.name)?!0:[e.details?.family,...e.details?.families??[]].filter(e=>!!e).some(e=>/bert$/i.test(e))}function L(e){return!!(e.isAgent&&e.agentId&&e.name===e.agentId)}function R(e,t){let n=e.find(L);if(n?.agentName)return n.agentName;for(let t of e){let e=t.agentName??``,n=e.indexOf(le);if(n>0)return e.slice(0,n)}return t}function me(e,t){let n=e.agentName||e.name;if(L(e))return{title:n,isDefault:!0};let r=`${t}${le}`,i=n.startsWith(r)?n.slice(r.length):n,a;if(e.name.startsWith(ue)){let e=/^(.*\S)\s+\(([^()]+)\)$/.exec(i);e&&(i=e[1],a=e[2])}return{title:i,...a?{provider:a}:{},isDefault:!1}}function he(e,t){return[...e].sort((e,n)=>{let r=L(e);return r===L(n)?de.compare(t(e),t(n)):r?-1:1})}function ge(e,t){let n=[],r=[],i=[],a=[],o=new Map,s=new Map;for(let t of e)if(t.isLegacySelection)n.push(t);else if(t.isUnavailable)r.push(t);else if(t.isPersona)i.push(t);else if(t.isAgent){let e=fe(t);s.set(e,[...s.get(e)??[],t])}else if(t.isPlugin){let e=t.pluginId||t.pluginName||``;o.set(e,[...o.get(e)??[],t])}else c(t)&&!pe(t)&&a.push(t);let l=[{key:`legacy`,kind:`legacy`,label:t.legacy,models:n},{key:`unavailable`,kind:`unavailable`,label:t.unavailable,models:r},{key:`personas`,kind:`personas`,label:t.personas,models:i},{key:`ollama`,kind:`ollama`,label:t.ollama,models:a}];for(let[e,n]of o)l.push({key:`plugin:${e}`,kind:`plugin`,label:n[0]?.pluginName||e||t.plugins,models:he(n,e=>e.name)});for(let[e,n]of s){let r=R(n,e||t.agents);l.push({key:`agent:${e}`,kind:`agent`,label:r,models:he(n,e=>me(e,r).title)})}return l.filter(e=>e.models.length>0)}function z(e){return e.toLowerCase().replace(/[\s\-_./:·()[\],]+/g,` `).trim()}function _e(e,t,n,r=``){let i=z(n).split(` `).filter(Boolean);if(i.length===0)return!0;let a=z([e.name,r,e.personaName,e.pluginName,e.agentName,t.label].filter(Boolean).join(` `)),o=a.replace(/ /g,``);return i.every(e=>a.includes(e)||o.includes(e))}function ve(e){let t=-1;for(let n of e.matchAll(/(?<![\d.])(\d{1,2})(?:[.-](\d{1,2}))?(?!\d|\.\d|b\b)/gi)){let e=Number(n[1])*100+Number(n[2]??0);e>t&&(t=e)}return t}function ye(e,t,n={}){if(e.length<=8)return{visible:e,hidden:0};let r;if(n.newestFirst){let t=e.filter(L),n=e.filter(e=>!L(e)).map((e,t)=>({model:e,index:t,rank:ve(e.name)})).sort((e,t)=>t.rank-e.rank||e.index-t.index).map(e=>e.model);r=[...t,...n].slice(0,5)}else r=e.slice(0,5);if(!r.some(t)){let n=e.find(t);n&&(r[r.length-1]=n)}let i=new Set(r),a=e.filter(e=>i.has(e));return{visible:a,hidden:e.length-a.length}}var be={ai:`AI`,api:`API`,awq:`AWQ`,bf16:`BF16`,chatgpt:`ChatGPT`,deepseek:`DeepSeek`,fp16:`FP16`,fp8:`FP8`,glm:`GLM`,gpt:`GPT`,gptq:`GPTQ`,hd:`HD`,lfm:`LFM`,llm:`LLM`,minimax:`MiniMax`,mlx:`MLX`,ml:`ML`,moe:`MoE`,openai:`OpenAI`,oss:`OSS`,qwq:`QwQ`,tts:`TTS`,vl:`VL`,xl:`XL`},xe={"deepseek-ai":`DeepSeek`,"meta-llama":`Meta`,"meta-models":`Meta`,"x-ai":`xAI`,"z-ai":`Z.ai`,"zai-org":`Z.ai`,amazon:`Amazon`,anthropic:`Anthropic`,cohere:`Cohere`,deepseek:`DeepSeek`,google:`Google`,liquid:`Liquid AI`,meta:`Meta`,microsoft:`Microsoft`,minimax:`MiniMax`,mistralai:`Mistral`,moonshotai:`Moonshot AI`,nvidia:`NVIDIA`,openai:`OpenAI`,perplexity:`Perplexity`,qwen:`Qwen`,thinkingmachines:`Thinking Machines`},B=/^(?:hf\.co|huggingface\.co)\//i,V=/^(?:[a-z0-9-]+?--)?(?:ep-)?([a-z0-9][a-z0-9-]*?)(?:-server)?\.[a-z0-9-]+\.modal\.direct$/i,H=new Set([`gguf`]);function U(e){let t=e.toLowerCase();return be[t]?be[t]:e!==t||/^o\d/.test(e)?e:/^\d+(?:\.\d+)?[bkmt]$/.test(e)||/^[a-z]\d+(?:\.\d+)?[a-z]?$/.test(e)?e.toUpperCase():/^\d/.test(e)?e:e.charAt(0).toUpperCase()+e.slice(1)}function Se(e){let t=e.split(/[-_\s]+/).filter(Boolean),n=t.length>1?t.filter(e=>!H.has(e.toLowerCase())):t,r=[];for(let e of n){let t=r[r.length-1];t&&/^\d{1,2}$/.test(e)&&/^\d{1,2}$/.test(t)&&r.length>1&&!/^\d/.test(r[r.length-2])?r[r.length-1]=`${t}.${e}`:r.push(U(e))}return r.join(` `)||e}function Ce(e){let t=e.toLowerCase();return xe[t]?xe[t]:e===t?Se(e):e}function we(e,t={}){let n=e.trim(),r=V.exec(n);if(r)return{name:Se(r[1])};let i=n.startsWith(`~`),a=(i?n.slice(1):n).replace(B,``).split(`/`).filter(Boolean);if(!(t.prettify??a.length>1)||a.length===0)return{name:n};let o=a[a.length-1],s,c=o.lastIndexOf(`:`);c>0&&(s=o.slice(c+1)||void 0,o=o.slice(0,c)),i&&/[-_]latest$/i.test(o)&&(o=o.replace(/[-_]latest$/i,``),s??=`latest`),s===`latest`&&!i&&(s=void 0);let l=a.length>1?Ce(a[a.length-2]):void 0;return{name:Se(o),...l?{vendor:l}:{},...s?{tag:s}:{}}}function Te(e){if(!Number.isFinite(e)||e<=0)return``;if(e>=1e6){let t=e%1048576==0?e/1048576:e/1e6;return`${Number(t.toFixed(1))}M`}if(e>=1e3){let t=e%1024==0?e/1024:e/1e3;return`${Math.round(t)}K`}return String(e)}function Ee(e){if(!Number.isFinite(e)||e<=0)return``;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1e3&&r<t.length-1;)n/=1e3,r+=1;return`${n>=10||r===0?Math.round(n):n.toFixed(1)} ${t[r]}`}var W=r(),De=[`bg-amber-500/15 text-amber-700 dark:text-amber-300`,`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,`bg-sky-500/15 text-sky-700 dark:text-sky-300`,`bg-violet-500/15 text-violet-700 dark:text-violet-300`,`bg-rose-500/15 text-rose-700 dark:text-rose-300`,`bg-indigo-500/15 text-indigo-700 dark:text-indigo-300`,`bg-teal-500/15 text-teal-700 dark:text-teal-300`,`bg-orange-500/15 text-orange-700 dark:text-orange-300`];function Oe(e){let t=0;for(let n of e.toLowerCase())t=t*31+n.charCodeAt(0)>>>0;return De[t%De.length]}function ke({seed:e,size:t=`sm`,className:n}){let r=(/[\p{L}\p{N}]/u.exec(e)?.[0]??`?`).toUpperCase();return(0,W.jsx)(`span`,{"aria-hidden":`true`,className:o(`inline-flex shrink-0 select-none items-center justify-center font-semibold leading-none`,t===`md`?`h-6 w-6 rounded-md text-[11px]`:`h-4 w-4 rounded-sm text-[9px]`,Oe(e),n),children:r})}function Ae(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function je({hfTask:e,hfSort:t,canInstallModels:n,loadingHf:r,hfModels:i,expandedHfModel:a,hfGgufFiles:c,loadingGguf:l,pullingModel:u,pullProgress:d,setHfTask:p,setHfSort:g,onToggleHfModel:_,onPullHfGguf:y,onCancelPull:b,onRefreshHfModels:x}){let{t:C}=s();return(0,W.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,W.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-200 dark:border-dark-300 shrink-0 space-y-2`,children:(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsxs)(`select`,{value:e,onChange:e=>p(e.target.value),onMouseDown:e=>e.stopPropagation(),className:`flex-1 px-2 py-1.5 rounded-lg border text-xs bg-gray-50 dark:bg-dark-50 border-gray-200 dark:border-dark-300 text-gray-900 dark:text-gray-100`,children:[(0,W.jsx)(`option`,{value:`text-generation`,children:C(`modelManager.huggingface.taskTextGeneration`)}),(0,W.jsx)(`option`,{value:`text-to-speech`,children:C(`modelManager.huggingface.taskTextToSpeech`)}),(0,W.jsx)(`option`,{value:`text-to-image`,children:C(`modelManager.huggingface.taskTextToImage`)}),(0,W.jsx)(`option`,{value:`automatic-speech-recognition`,children:C(`modelManager.huggingface.taskSpeechRecognition`)})]}),(0,W.jsxs)(`select`,{value:t,onChange:e=>g(e.target.value),onMouseDown:e=>e.stopPropagation(),className:`px-2 py-1.5 rounded-lg border text-xs bg-gray-50 dark:bg-dark-50 border-gray-200 dark:border-dark-300 text-gray-900 dark:text-gray-100`,children:[(0,W.jsx)(`option`,{value:`downloads`,children:C(`modelManager.huggingface.sortDownloads`)}),(0,W.jsx)(`option`,{value:`likes`,children:C(`modelManager.huggingface.sortLikes`)}),(0,W.jsx)(`option`,{value:`lastModified`,children:C(`modelManager.huggingface.sortRecent`)})]})]})}),(0,W.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 scrollbar-thin`,children:[!n&&(0,W.jsx)(`div`,{className:`mx-3 mb-1 mt-3 rounded-lg border border-amber-200 bg-amber-500/10 px-3 py-2 text-xs text-ink dark:border-amber-800 dark:bg-amber-900/20`,children:C(`modelSelector.pullRestricted`)}),r?(0,W.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,W.jsx)(v,{className:`h-6 w-6 animate-spin text-gray-400`})}):i.length===0?(0,W.jsxs)(`div`,{className:`px-4 py-8 text-center text-gray-500 dark:text-gray-400`,children:[(0,W.jsx)(ne,{className:`h-8 w-8 mx-auto mb-2 text-gray-300 dark:text-gray-600`}),(0,W.jsx)(`p`,{className:`text-sm`,children:C(`modelManager.huggingface.noModelsFound`)})]}):(0,W.jsx)(`div`,{className:`divide-y divide-gray-100 dark:divide-dark-200`,children:i.map(e=>{let t=a===e.id,r=c[e.id]||[],i=l===e.id;return(0,W.jsxs)(`div`,{className:`bg-white dark:bg-dark-100`,children:[(0,W.jsx)(`div`,{className:`px-3 py-3 cursor-pointer hover:bg-gray-50 dark:hover:bg-dark-200`,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),_(e.id)},children:(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,W.jsx)(`div`,{className:`shrink-0 rounded-lg bg-yellow-500/20 p-2 dark:bg-yellow-900/30`,children:(0,W.jsx)(ne,{className:`h-4 w-4 text-yellow-600 dark:text-yellow-400`})}),(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`h4`,{dir:`ltr`,className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:e.id}),e.gated&&(0,W.jsx)(`span`,{className:`rounded-sm bg-yellow-500/20 px-1.5 py-0.5 text-xs text-ink dark:bg-yellow-900/30`,children:`Gated`})]}),(0,W.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-0.5`,children:[`by `,e.author]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-3 mt-1.5 text-xs text-gray-400 dark:text-gray-500`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(m,{className:`h-3 w-3`}),Ae(e.downloads)]}),(0,W.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(ee,{className:`h-3 w-3`}),Ae(e.likes)]}),e.pipeline_tag&&(0,W.jsx)(`span`,{className:`px-1.5 py-0.5 rounded-sm bg-gray-100 dark:bg-dark-200`,children:e.pipeline_tag})]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,W.jsx)(`a`,{href:`https://huggingface.co/${e.id}`,target:`_blank`,rel:`noopener noreferrer`,onMouseDown:e=>e.stopPropagation(),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,W.jsx)(h,{className:`h-4 w-4 text-gray-400`})}),(0,W.jsx)(f,{className:o(`h-4 w-4 text-gray-400 transition-transform`,t&&`rotate-180`)})]})]})}),t&&(0,W.jsx)(`div`,{className:`px-3 pb-3 pt-1 border-t border-gray-100 dark:border-dark-200 bg-gray-50 dark:bg-dark-200`,children:i?(0,W.jsxs)(`div`,{className:`flex items-center justify-center py-4`,children:[(0,W.jsx)(v,{className:`h-4 w-4 animate-spin text-gray-400`}),(0,W.jsx)(`span`,{className:`ml-2 text-xs text-gray-500`,children:C(`modelManager.huggingface.checkingGguf`)})]}):r.length===0?(0,W.jsx)(`div`,{className:`py-4 text-center text-xs text-gray-500 dark:text-gray-400`,children:C(`modelManager.huggingface.noGgufAvailable`)}):(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-gray-600 dark:text-gray-300 mb-2`,children:C(`modelManager.huggingface.ggufFilesCount`,{count:r.length})}),r.map(e=>{let t=u===e.ollamaCommand;return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 p-2 rounded-lg bg-white dark:bg-dark-100 border border-gray-200 dark:border-dark-300`,children:[(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-gray-800 dark:text-gray-200 truncate`,children:e.filename}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5 text-xs text-gray-500 dark:text-gray-400`,children:[(0,W.jsx)(`span`,{children:e.sizeFormatted}),e.quantization&&(0,W.jsx)(`span`,{className:`px-1.5 py-0.5 rounded-sm bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400`,children:e.quantization})]})]}),t?(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`div`,{className:`text-xs text-gray-500 w-12 text-right`,children:d?.percent===void 0?`...`:`${d.percent}%`}),(0,W.jsx)(`button`,{onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),b()},className:`p-1.5 rounded-lg text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`,children:(0,W.jsx)(D,{className:`h-4 w-4`})})]}):n?(0,W.jsxs)(`button`,{onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),y(e.ollamaCommand,e.filename)},disabled:!!u,className:o(`px-3 py-1.5 rounded-lg text-xs font-medium`,`bg-primary-100 dark:bg-primary-900/30`,`text-primary-700 dark:text-primary-400`,`hover:bg-primary-200 dark:hover:bg-primary-900/50`,`disabled:opacity-50 disabled:cursor-not-allowed`),children:[(0,W.jsx)(m,{className:`h-3 w-3 inline mr-1`}),C(`models.pull`)]}):(0,W.jsx)(`span`,{className:`rounded-sm bg-amber-500/20 px-2 py-1 text-[11px] font-medium text-ink dark:bg-amber-900/30`,children:C(`modelSelector.adminOnlyPull`)})]},e.filename)}),u?.startsWith(`hf.co/`)&&u.includes(e.id)&&d?.percent!==void 0&&(0,W.jsx)(`div`,{className:`w-full bg-gray-200 dark:bg-dark-300 rounded-full h-1.5 overflow-hidden mt-2`,children:(0,W.jsx)(`div`,{className:`h-1.5 rounded-full bg-primary-500 transition-all duration-300`,style:{width:`${d.percent}%`}})})]})})]},e.id)})})]}),(0,W.jsxs)(`div`,{className:`px-3 py-2 border-t border-gray-200 dark:border-dark-300 flex items-center justify-between shrink-0`,children:[(0,W.jsxs)(`a`,{href:`https://huggingface.co/models`,target:`_blank`,rel:`noopener noreferrer`,onMouseDown:e=>e.stopPropagation(),className:`text-xs text-primary-600 dark:text-primary-400 hover:underline flex items-center gap-1`,children:[(0,W.jsx)(h,{className:`h-3 w-3`}),C(`modelManager.huggingface.browseAllLink`)]}),(0,W.jsx)(`button`,{onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),x()},className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,W.jsx)(S,{className:o(`h-3.5 w-3.5 text-gray-400`,r&&`animate-spin`)})})]})]})}var Me=`[data-testid="model-selector-option"], [data-testid="model-selector-show-all"]`;function Ne(e,t){if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let n=Array.from(e.currentTarget.querySelectorAll(Me)),r=n.indexOf(document.activeElement);if(r===-1)return;e.preventDefault();let i=r+(e.key===`ArrowDown`?1:-1);i<0?t():n[Math.min(i,n.length-1)]?.focus()}function Pe({groups:e,selectedModel:t,showImageGen:n,getModelValue:r,getModelIcon:i,getModelLabel:a,getModelTag:c,getModelSubLabel:l,onModelSelect:u,onShowAll:d,onOpenGallery:f,onExitTop:p}){let{t:m}=s();return(0,W.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-dark-400`,onKeyDown:e=>Ne(e,p),children:[e.length>0?e.map(e=>(0,W.jsxs)(`div`,{"data-testid":`model-selector-group`,children:[e.showHeader&&(0,W.jsxs)(`div`,{className:`sticky top-0 z-1 flex items-center gap-2 border-b border-gray-200 bg-gray-100 px-3 py-2 text-xs font-semibold text-gray-500 dark:border-dark-400 dark:bg-dark-300 dark:text-gray-400`,children:[e.icon,(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,W.jsx)(`span`,{className:`font-normal tabular-nums text-gray-400 dark:text-dark-500`,children:e.total})]}),e.models.map(n=>{let s=r(n),d=l(n,e),f=c(n,e);return(0,W.jsx)(`button`,{type:`button`,"data-testid":`model-selector-option`,"data-model-value":s,"aria-pressed":t===s,title:n.isPersona?void 0:n.name,onClick:()=>u(s),className:o(`block w-full cursor-pointer border-b border-gray-100 px-3 py-2 text-start last:border-b-0 dark:border-dark-200`,`hover:bg-gray-50 dark:hover:bg-dark-200`,`bg-white dark:bg-dark-100 transition-colors`,`focus-visible:relative focus-visible:z-10 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary-500/50`,t===s&&`bg-primary-50 dark:bg-primary-900/30`),children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i(n),(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{dir:n.isPersona?`auto`:`ltr`,className:`min-w-0 truncate text-sm font-medium text-gray-900 dark:text-gray-100`,children:a(n,e)}),f&&(0,W.jsx)(`span`,{dir:`ltr`,className:`shrink-0 rounded-sm border border-black/8 px-1 py-px font-mono text-[10px] leading-4 text-gray-500 dark:border-white/10 dark:text-dark-600`,children:f})]}),d&&(0,W.jsx)(`div`,{dir:`auto`,className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:d})]}),t===s&&(0,W.jsx)(te,{className:`h-4 w-4 text-primary-600 dark:text-primary-400 shrink-0`})]})},s)}),e.hidden>0&&(0,W.jsxs)(`button`,{type:`button`,"data-testid":`model-selector-show-all`,onClick:()=>d(e.key),className:o(`flex w-full items-center justify-between gap-2 border-b border-gray-100 bg-white px-3 py-2 text-start text-xs font-medium text-primary-600 dark:border-dark-200 dark:bg-dark-100 dark:text-primary-400`,`hover:bg-gray-50 dark:hover:bg-dark-200`,`focus-visible:relative focus-visible:z-10 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary-500/50`),children:[(0,W.jsx)(`span`,{className:`truncate`,children:m(`modelSelector.showAll`,{total:e.total})}),(0,W.jsx)(w,{className:`h-3.5 w-3.5 shrink-0 rtl:rotate-180`})]})]},e.key)):(0,W.jsxs)(`div`,{className:`px-4 py-8 text-center text-gray-500 dark:text-gray-400`,children:[(0,W.jsx)(b,{className:`h-8 w-8 mx-auto mb-2 text-gray-300 dark:text-gray-600`}),(0,W.jsx)(`p`,{className:`text-sm`,children:m(`models.noModelsFound`)})]}),n&&(0,W.jsxs)(`div`,{className:`border-t border-gray-200 dark:border-dark-300`,children:[(0,W.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-dark-300`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(O,{className:`h-4 w-4 text-blue-600 dark:text-blue-400`}),m(`modelSelector.actions`)]})}),(0,W.jsx)(`div`,{onMouseDown:e=>{e.preventDefault(),f()},className:`px-3 py-3 cursor-pointer hover:bg-blue-50 dark:hover:bg-blue-900/20 bg-white dark:bg-dark-100`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(_,{className:`h-4 w-4 text-blue-600 dark:text-blue-400`}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:m(`gallery.generate`)}),(0,W.jsx)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:m(`gallery.generateDescription`)})]})]})})]})]})}function Fe({sources:e,active:t,onChange:n}){let{t:r}=s(),i=(0,I.useRef)([]),a=e.reduce((e,t)=>e+t.count,0),c=[{key:`all`,label:r(`common.all`),count:a},...e],l=(e,t)=>{let r=getComputedStyle(e.currentTarget).direction===`rtl`,a=r?`ArrowLeft`:`ArrowRight`,o=r?`ArrowRight`:`ArrowLeft`,s=null;e.key===a?s=(t+1)%c.length:e.key===o?s=(t-1+c.length)%c.length:e.key===`Home`?s=0:e.key===`End`&&(s=c.length-1),s!==null&&(e.preventDefault(),n(c[s].key),i.current[s]?.focus())};return(0,W.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`modelSelector.sources`),"data-testid":`model-selector-sources`,className:`flex gap-1.5 overflow-x-auto px-4 pb-3 sm:px-5 scrollbar-none [&::-webkit-scrollbar]:hidden`,children:c.map((e,r)=>{let a=e.key===t;return(0,W.jsxs)(`button`,{ref:e=>{i.current[r]=e},type:`button`,role:`radio`,"aria-checked":a,tabIndex:a?0:-1,"data-source-key":e.key,onClick:()=>n(e.key),onKeyDown:e=>l(e,r),className:o(`flex shrink-0 items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-500/50`,a?`border-transparent bg-gray-900 text-white dark:bg-dark-900 dark:text-dark-25`:`border-black/8 text-gray-600 hover:bg-gray-100 dark:border-white/9 dark:text-dark-600 dark:hover:bg-dark-200`,e.count===0&&!a&&`opacity-50`),children:[(0,W.jsx)(`span`,{className:`whitespace-nowrap`,children:e.label}),(0,W.jsx)(`span`,{className:o(`tabular-nums`,a?`text-white/70 dark:text-dark-25/70`:`text-gray-400 dark:text-dark-500`),children:e.count})]},e.key)})})}function Ie({libraryCategories:e,libraryCategory:t,canInstallModels:n,loadingLibrary:r,filteredLibraryModels:i,pullingModel:a,pullProgress:c,setLibraryCategory:l,isModelInstalled:u,onModelSelect:d,onPullModel:f,onCancelPull:p,onRefreshLibrary:g}){let{t:_}=s();return(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,W.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-200 dark:border-dark-300 shrink-0`,children:(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,W.jsx)(`button`,{onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:o(`px-2.5 py-1 rounded-full text-xs font-medium transition-colors`,t===e?`bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400`:`bg-gray-100 dark:bg-dark-200 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-dark-300`),children:e.charAt(0).toUpperCase()+e.slice(1)},e))})}),(0,W.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 scrollbar-thin`,children:[!n&&(0,W.jsx)(`div`,{className:`mx-3 mb-1 mt-3 rounded-lg border border-amber-200 bg-amber-500/10 px-3 py-2 text-xs text-ink dark:border-amber-800 dark:bg-amber-900/20`,children:_(`modelSelector.pullRestricted`)}),r?(0,W.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,W.jsx)(v,{className:`h-6 w-6 animate-spin text-gray-400`})}):i.length===0?(0,W.jsxs)(`div`,{className:`px-4 py-8 text-center text-gray-500 dark:text-gray-400`,children:[(0,W.jsx)(re,{className:`h-8 w-8 mx-auto mb-2 text-gray-300 dark:text-gray-600`}),(0,W.jsx)(`p`,{className:`text-sm`,children:_(`models.noModelsFound`)})]}):(0,W.jsx)(`div`,{className:`divide-y divide-gray-100 dark:divide-dark-200`,children:i.map(e=>{let t=u(e.name),r=a===e.name;return(0,W.jsxs)(`div`,{className:o(`px-3 py-3 bg-white dark:bg-dark-100`,t&&`bg-green-50/50 dark:bg-green-900/10`),children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,W.jsx)(`div`,{className:`p-2 rounded-lg bg-blue-100 dark:bg-blue-900/30 shrink-0`,children:(0,W.jsx)(re,{className:`h-4 w-4 text-blue-600 dark:text-blue-400`})}),(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`h4`,{dir:`ltr`,className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:e.name}),t&&(0,W.jsx)(`span`,{className:`px-1.5 py-0.5 rounded-sm text-xs bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`,children:_(`modelSelector.installed`)}),(e.category===`cloud`||e.tags?.includes(`cloud`))&&(0,W.jsxs)(`span`,{className:`px-1.5 py-0.5 rounded-sm text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 flex items-center gap-1`,children:[(0,W.jsx)(re,{className:`h-3 w-3`}),`Cloud`]})]}),(0,W.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 line-clamp-1 mt-0.5`,children:e.description}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[e.sizes.slice(0,3).map(e=>(0,W.jsx)(`span`,{className:`px-1.5 py-0.5 rounded-sm text-xs bg-gray-100 dark:bg-dark-200 text-gray-600 dark:text-gray-400`,children:e},e)),e.pulls&&(0,W.jsxs)(`span`,{className:`text-xs text-gray-400 dark:text-gray-500 flex items-center gap-1`,children:[(0,W.jsx)(m,{className:`h-3 w-3`}),e.pulls]})]})]}),(0,W.jsx)(`div`,{className:`shrink-0`,children:r?(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`div`,{className:`text-xs text-gray-500 w-12 text-right`,children:c?.percent===void 0?`...`:`${c.percent}%`}),(0,W.jsx)(`button`,{onClick:p,className:`p-1.5 rounded-lg text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`,children:(0,W.jsx)(D,{className:`h-4 w-4`})})]}):t?(0,W.jsx)(`button`,{onClick:()=>d(e.name),className:`px-3 py-1.5 rounded-lg text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-900/50`,children:_(`modelSelector.use`)}):n?(0,W.jsxs)(`button`,{onClick:()=>f(e.name),className:`px-3 py-1.5 rounded-lg text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-900/50`,children:[(0,W.jsx)(m,{className:`h-3 w-3 inline mr-1`}),_(`modelSelector.pull`)]}):(0,W.jsx)(`span`,{className:`rounded-sm bg-amber-500/20 px-2 py-1 text-[11px] font-medium text-ink dark:bg-amber-900/30`,children:_(`modelSelector.adminOnlyPull`)})})]}),r&&c?.percent!==void 0&&(0,W.jsx)(`div`,{className:`mt-2 w-full bg-gray-200 dark:bg-dark-300 rounded-full h-1.5 overflow-hidden`,children:(0,W.jsx)(`div`,{className:`h-1.5 rounded-full bg-primary-500 transition-all duration-300`,style:{width:`${c.percent}%`}})})]},e.name)})})]}),(0,W.jsxs)(`div`,{className:`px-3 py-2 border-t border-gray-200 dark:border-dark-300 flex items-center justify-between shrink-0`,children:[(0,W.jsxs)(`a`,{href:`https://ollama.com/library`,target:`_blank`,rel:`noopener noreferrer`,onMouseDown:e=>e.stopPropagation(),className:`text-xs text-primary-600 dark:text-primary-400 hover:underline flex items-center gap-1`,children:[(0,W.jsx)(h,{className:`h-3 w-3`}),_(`modelManager.huggingface.browseAllLink`)]}),(0,W.jsx)(`button`,{onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),g()},className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,W.jsx)(S,{className:o(`h-3.5 w-3.5 text-gray-400`,r&&`animate-spin`)})})]})]})}var Le=d(`components:model-selector`),Re=({models:e,selectedModel:t,onModelChange:n,currentPersona:r,className:d,disabled:m=!1,compact:h=!1,showImageGen:_=!1,onModelsRefresh:v,getModelValue:b,getModelId:S,getModelLabel:w,getModelTitle:ee,triggerRef:te,triggerTestId:O,selectTestId:ie,ariaLabel:A})=>{let{t:M}=s(),[N,P]=(0,I.useState)(!1),[F,le]=(0,I.useState)(``),[ue,de]=(0,I.useState)(`installed`),[fe,pe]=(0,I.useState)(`all`),L=(0,I.useRef)(null),R=(0,I.useRef)(null),he=(0,I.useRef)(null),z=(0,I.useRef)(null),ve=a(),{user:be,systemInfo:xe}=se(),B=be?.role===`admin`||xe?.requiresAuth===!1,V=xe?.ollamaEnabled!==!1,H=V?ue:`installed`,[U,Se]=(0,I.useState)(`all`),[Ce,De]=(0,I.useState)(``),[Oe,Ae]=(0,I.useState)(`text-generation`),[Me,Ne]=(0,I.useState)(`downloads`),[Re,ze]=(0,I.useState)(``),[G,Be]=(0,I.useState)(null),[Ve,He]=(0,I.useState)({}),[Ue,We]=(0,I.useState)(null),[K,q]=(0,I.useState)(null),[Ge,J]=(0,I.useState)(null),[Ke,Y]=(0,I.useState)(null),qe=[`all`,`general`,`coding`,`reasoning`,`vision`,`embedding`,`cloud`],Je=(0,I.useMemo)(()=>ge(e,{legacy:M(`modelSelector.providerNotRecorded`,`Provider not recorded`),unavailable:M(`modelSelector.unavailableSelections`,`Unavailable selections`),personas:M(`modelSelector.personas`),ollama:`Ollama`,plugins:M(`modelSelector.pluginModels`),agents:M(`modelSelector.agentModels`,`Agents`)}),[e,M]),Ye=e=>{let t=`h-4 w-4 shrink-0 text-gray-500 dark:text-dark-600`;switch(e.kind){case`legacy`:return(0,W.jsx)(k,{className:t});case`unavailable`:return(0,W.jsx)(D,{className:t});case`personas`:return(0,W.jsx)(T,{className:t});case`agent`:return(0,W.jsx)(C,{className:t});default:return(0,W.jsx)(ke,{seed:e.label})}},X=e=>b?.(e)??e.name,Xe=e=>we(S?.(e)??e.name,e.isPlugin?{prettify:!0}:{}),Ze=e=>{let t=Xe(e);return t.tag?`${t.name} ${t.tag}`:t.name},Qe=u(e=>e.modelMetadata),$e=u(e=>e.personas),Z=e.find(e=>X(e)===t),et=e=>{if(!e.name.startsWith(`persona:`))return;let t=e.name.slice(8),n=t;try{n=decodeURIComponent(t)}catch{}let r=$e[t]??$e[n];if(r?.name)return r.name;if(e.personaName&&e.personaName!==t)return e.personaName},tt=e=>{if(!e.name.startsWith(`persona:`))return;let t=e.name.slice(8),n=t;try{n=decodeURIComponent(t)}catch{}return $e[t]??$e[n]};(0,I.useImperativeHandle)(te,()=>he.current);let Q=(0,I.useCallback)((e=!0)=>{P(!1),le(``),e&&window.requestAnimationFrame(()=>he.current?.focus())},[]),{data:nt=[],isLoading:rt,refetch:it}=i({queryKey:[`ollama-library-selector`,Ce,U===`cloud`?`cloud`:`all`],queryFn:async()=>{let e=await j.getLibraryModels({search:Ce||void 0,sort:`popular`,category:U===`cloud`?`cloud`:void 0});return e.success&&e.data?e.data:[]},enabled:N&&H===`ollama`}),{data:at=[],isLoading:ot,refetch:st}=i({queryKey:[`hf-models-selector`,Oe,Re,Me],queryFn:async()=>{let e=await ae.getModels({task:Oe,search:Re||void 0,sort:Me,limit:30});return e.success&&e.data?e.data:[]},enabled:N&&H===`huggingface`}),ct=nt.filter(e=>{let t=!F||e.name.toLowerCase().includes(F.toLowerCase())||e.description.toLowerCase().includes(F.toLowerCase()),n=U===`all`||e.category===U;return t&&n}),lt=(0,I.useCallback)(async e=>{let[t,n]=e.split(`/`);if(t&&n){We(e);try{let r=await ae.getGgufFiles(t,n);r.success&&r.data&&He(t=>({...t,[e]:r.data}))}catch(e){Le.error(`Failed to load GGUF files:`,e)}finally{We(null)}}},[]),ut=(0,I.useCallback)(e=>{G===e?Be(null):(Be(e),Ve[e]||lt(e))},[G,Ve,lt]),dt=(0,I.useCallback)((e,t)=>{if(!B)x.error(M(`modelSelector.pullRestricted`));else if(!K){q(e),J({status:`starting`});try{let n=j.pullModelStream(e,e=>{J(e)},()=>{J(null),q(null),Y(null),x.success(M(`modelDownload.success`,{name:t})),v?.()},e=>{J(null),q(null),Y(null),x.error(M(`modelDownload.failed`,{error:e}))});Y(()=>n)}catch{J(null),q(null),x.error(M(`modelDownload.startFailed`))}}},[B,v,K,M]);(0,I.useEffect)(()=>{let e=setTimeout(()=>{H===`huggingface`?ze(F):H===`ollama`&&De(F)},300);return()=>clearTimeout(e)},[F,H]),(0,I.useEffect)(()=>{if(!N)return;let e=e=>{if(e.key===`Escape`)e.preventDefault(),Q();else if(e.key===`Tab`&&R.current){let t=Array.from(R.current.querySelectorAll(`button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>e.offsetParent!==null),n=t[0],r=t[t.length-1];if(!n||!r)return;e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[Q,N]),(0,I.useEffect)(()=>{N&&z.current&&z.current.focus()},[N]);let ft=async t=>{let r=e.find(e=>X(e)===t)??e.find(e=>!e.isPlugin&&!e.isPersona&&e.name===t),i=r?X(r):t,a=r?.name??t;if(Q(),!V)n({target:{value:i}});else{try{let e=await j.listRunningModels();if(e.success&&e.data){let t=e.data;t.length>0&&(r?.isPlugin!==!0&&t.some(e=>e.name===a||a.startsWith(`persona:`))||await j.unloadAllModels())}}catch(e){Le.warn(`Failed to unload models before switch:`,e)}n({target:{value:i}})}},pt=async e=>{if(!B)x.error(M(`modelSelector.pullRestricted`));else if(!K){q(e),J({status:`starting`});try{let t=j.pullModelStream(e,e=>{J(e)},()=>{J(null),q(null),Y(null),x.success(M(`modelDownload.success`,{name:e})),v?.()},e=>{J(null),q(null),Y(null),x.error(M(`modelDownload.failed`,{error:e}))});Y(()=>t)}catch{J(null),q(null),x.error(M(`modelDownload.startFailed`))}}},mt=()=>{Ke&&(Ke(),Y(null),q(null),J(null),x.success(M(`modelDownload.cancelled`)))},ht=t=>e.some(e=>c(e)&&(e.name===t||e.name.startsWith(t+`:`))),gt=(e,t=`sm`)=>{let n=t===`md`?`h-6 w-6 rounded-md`:`h-4 w-4 rounded-sm`,r=Qe[l(e)]?.avatar;if(r&&!e.isPersona)return(0,W.jsx)(`img`,{src:r,alt:``,className:o(n,`shrink-0 rounded-full object-cover`)});if(e.isPersona||e.isLegacySelection){let t=tt(e);if(t)return(0,W.jsx)(`img`,{src:oe(t,64),alt:``,className:o(n,`shrink-0 object-cover`)})}if(e.isLegacySelection||e.isPersona||e.isAgent){let r=e.isLegacySelection?k:e.isPersona?T:C,i=(0,W.jsx)(r,{className:`h-4 w-4 shrink-0 text-gray-500 dark:text-dark-600`});return t===`md`?(0,W.jsx)(`span`,{className:o(n,`flex shrink-0 items-center justify-center bg-gray-100 dark:bg-dark-200`),children:i}):i}let i=Xe(e),a=e.isPlugin?i.vendor||e.pluginName||e.pluginId||i.name:i.vendor||i.name;return(0,W.jsx)(ke,{seed:a,size:t})},$=e=>{let t=Qe[l(e)]?.label;if(t&&!e.isPersona)return t;if(w)return w(e);if(e.isLegacySelection)return`${et(e)??e.name} (${M(`modelSelector.legacyProvider`,`provider not recorded`)})`;if(e.isPersona)return et(e)||e.personaName||e.name;if(e.isAgent)return e.isUnavailable?`${e.agentName||e.name} (${M(`modelSelector.unavailable`,`unavailable`)})`:e.agentName||e.name;let n=Ze(e);return e.isUnavailable?`${n} (${M(`modelSelector.unavailable`,`unavailable`)})`:n},_t=e=>e.isLegacySelection?e.isUnavailable?M(`modelSelector.providerUnavailable`,`provider unavailable`):M(`modelSelector.reselectProvider`,`reselect a provider to pin this model`):e.isPersona?M(`modelSelector.via`,{provider:e.model}):e.isAgent&&e.isUnavailable?e.unavailableReason??M(`modelSelector.unavailable`,`unavailable`):e.isPlugin?e.isUnavailable?`${M(`modelSelector.via`,{provider:e.pluginName||e.pluginId})} · ${M(`modelSelector.providerUnavailable`,`provider unavailable`)}`:M(`modelSelector.via`,{provider:e.pluginName}):e.isUnavailable?M(`modelSelector.providerUnavailable`,`provider unavailable`):null,vt=e=>e.kind===`plugin`||e.kind===`ollama`,yt=e=>{let t=Xe(e);if(e.isPlugin||t.vendor||t.tag)return t;let n=t.name.lastIndexOf(`:`);if(n<=0)return t;let r=t.name.slice(n+1);return{name:t.name.slice(0,n),...r&&r!==`latest`?{tag:r}:{}}},bt=e=>!!Qe[l(e)]?.label,xt=(e,t)=>w||bt(e)?$(e):vt(t)?yt(e).name:t.kind===`agent`?me(e,t.label).title:$(e),St=(e,t)=>!vt(t)||w||bt(e)?null:yt(e).tag??null,Ct=(e,t)=>{if(t.kind===`agent`){let n=me(e,t.label);return n.isDefault?M(`modelSelector.defaultModel`):n.provider?M(`modelSelector.via`,{provider:n.provider}):null}if(!vt(t))return _t(e);let n=yt(e),r=e.details??{},i=/(^|[-:])cloud$/i.test(e.name),a=[n.vendor,e.isPlugin?void 0:r.parameter_size,e.isPlugin||r.quantization_level===n.tag?void 0:r.quantization_level,e.contextLength?M(`modelSelector.contextSize`,{size:Te(e.contextLength),defaultValue:`{{size}} context`}):void 0,e.isPlugin||i?void 0:Ee(e.size)].filter(e=>!!e);return a.length>0?a.join(` · `):null},wt=e=>X(e)===t,Tt=Je.map(e=>({source:e,matches:e.models.filter(t=>_e(t,e,F,$(t)))})),Et=Je.length>1,Dt=Et&&Je.some(e=>e.key===fe)?fe:`all`,Ot=Dt===`all`,kt=Tt.filter(({source:e})=>Ot||e.key===Dt).map(({source:e,matches:t})=>{let n=Ot&&Et?ye(t,wt,{newestFirst:e.kind===`plugin`||e.kind===`agent`}):{visible:t,hidden:0};return{key:e.key,kind:e.kind,label:e.label,icon:Ye(e),models:n.visible,total:t.length,hidden:n.hidden,showHeader:Ot}}).filter(e=>e.models.length>0),At=Tt.map(({source:e,matches:t})=>({key:e.key,label:e.label,count:t.length}));return(0,W.jsxs)(`div`,{className:o(`relative min-w-0`,d),ref:L,children:[(0,W.jsxs)(`button`,{ref:he,"data-testid":O,type:`button`,onClick:()=>!m&&P(!N),disabled:m,"aria-haspopup":`dialog`,"aria-expanded":N,"aria-label":A&&Z?`${A}: ${$(Z)}`:A,className:o(h?`flex h-9 w-full min-w-0 items-center justify-between gap-2 px-2.5 text-start`:`w-full flex items-center justify-between gap-2 px-3 py-2.5 text-start`,`rounded-xl border border-line bg-surface-subtle text-sm text-ink hover:bg-hover-solid`,`transition-colors duration-150 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 focus:border-primary-500`,m?`opacity-50 cursor-not-allowed`:`cursor-pointer`),title:h?Z?ee?.(Z)??$(Z):M(`modelSelector.selectModel`):void 0,children:[(()=>{if(!Z)return h?(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,W.jsx)(E,{className:`h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate text-xs font-medium text-ink-subtle`,children:M(`modelSelector.selectModel`)})]}):M(`modelSelector.selectModel`);if(h){let e=$(Z);return(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`shrink-0`,children:gt(Z)}),(0,W.jsx)(`span`,{dir:Z.isPersona?`auto`:`ltr`,className:`truncate text-xs font-medium text-ink`,children:e})]})}let e=$(Z),t=_t(Z);return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[gt(Z),(0,W.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,W.jsx)(`span`,{dir:Z.isPersona?`auto`:`ltr`,className:`text-sm font-medium truncate`,children:e}),t&&(0,W.jsx)(`span`,{dir:`auto`,className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:t})]}),Z.isPersona&&r&&(0,W.jsxs)(`div`,{className:`flex items-center gap-1 ms-auto`,children:[(0,W.jsx)(k,{className:`h-3 w-3 text-gray-500 dark:text-dark-600`}),r.embedding_model&&(0,W.jsx)(y,{className:`h-3 w-3 text-gray-400 dark:text-dark-500`})]})]})})(),(0,W.jsx)(f,{className:o(h?`h-3 w-3`:`h-4 w-4`,`shrink-0 text-ink-subtle transition-transform duration-150 motion-reduce:transition-none`,N&&`rotate-180`)})]}),N&&(0,ce.createPortal)((0,W.jsxs)(`div`,{className:`fixed inset-0 z-999999 flex items-center justify-center p-3 sm:p-6`,children:[(0,W.jsx)(`div`,{className:`absolute inset-0 bg-gray-950/55 backdrop-blur-md`,onClick:()=>Q()}),(0,W.jsxs)(`div`,{ref:R,role:`dialog`,"aria-modal":`true`,"aria-label":M(`modelSelector.selectModel`),className:o(`relative flex w-full max-w-xl flex-col overflow-hidden bg-white/98 dark:bg-dark-25/98`,`h-[min(620px,88vh)] rounded-3xl border border-black/8 dark:border-white/9`,`shadow-[0_30px_100px_rgba(0,0,0,0.28)] backdrop-blur-xl animate-scale-in`),onClick:e=>e.stopPropagation(),children:[(0,W.jsxs)(`div`,{className:`shrink-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-4 pb-2 pt-4 sm:px-5 sm:pt-5`,children:[(0,W.jsx)(`h2`,{className:`text-lg font-medium tracking-tight text-gray-950 dark:text-dark-950 rtl:tracking-normal`,children:M(`modelSelector.selectModel`)}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>Q(),className:`flex h-9 w-9 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-950 dark:text-dark-500 dark:hover:bg-dark-200 dark:hover:text-dark-950`,title:M(`common.close`),"aria-label":M(`common.close`),children:(0,W.jsx)(D,{className:`h-4 w-4`})})]}),(0,W.jsx)(`div`,{className:`px-4 pb-3 sm:px-5`,children:(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(g,{className:`absolute inset-s-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,W.jsx)(`input`,{ref:z,type:`text`,placeholder:M(H===`installed`?V?`modelSelector.searchInstalled`:`modelSelector.searchModels`:H===`ollama`?`modelSelector.searchOllama`:`modelSelector.searchHuggingFace`),value:F,onChange:e=>le(e.target.value),onKeyDown:e=>{if(H!==`installed`)return;let t=R.current?.querySelector(`[data-testid="model-selector-option"]`);e.key===`ArrowDown`&&t?(e.preventDefault(),t.focus()):e.key===`Enter`&&F.trim()&&t&&(e.preventDefault(),t.click())},className:o(`w-full rounded-xl border border-black/[0.07] bg-gray-100/70 py-2.5 ps-10 pe-4 text-sm dark:border-white/[0.07] dark:bg-dark-200/70`,`focus:outline-hidden focus:border-primary-500 focus:ring-2 focus:ring-primary-500/30`,`text-gray-900 dark:text-dark-900 placeholder:text-gray-400 dark:placeholder:text-dark-500`)})]})}),V&&(0,W.jsxs)(`div`,{className:`mx-4 mb-3 flex rounded-xl bg-gray-100/70 p-1 dark:bg-dark-200/70 sm:mx-5`,children:[(0,W.jsxs)(`button`,{onClick:()=>{de(`installed`)},className:o(`flex-1 rounded-lg px-2 py-2 text-xs font-medium transition-colors sm:px-4`,H===`installed`?`bg-white text-gray-950 shadow-xs dark:bg-dark-300 dark:text-dark-950`:`text-gray-500 hover:text-gray-800 dark:text-dark-500 dark:hover:text-dark-800`),"aria-pressed":H===`installed`,children:[(0,W.jsx)(p,{className:`h-4 w-4 inline me-1.5`}),M(`modelSelector.installed`)]}),(0,W.jsxs)(`button`,{onClick:()=>{de(`ollama`)},className:o(`flex-1 rounded-lg px-2 py-2 text-xs font-medium transition-colors sm:px-4`,H===`ollama`?`bg-white text-gray-950 shadow-xs dark:bg-dark-300 dark:text-dark-950`:`text-gray-500 hover:text-gray-800 dark:text-dark-500 dark:hover:text-dark-800`),"aria-pressed":H===`ollama`,children:[(0,W.jsx)(re,{className:`h-4 w-4 inline me-1.5`}),`Ollama`]}),(0,W.jsxs)(`button`,{onClick:()=>{de(`huggingface`)},className:o(`flex-1 rounded-lg px-2 py-2 text-xs font-medium transition-colors sm:px-4`,H===`huggingface`?`bg-white text-gray-950 shadow-xs dark:bg-dark-300 dark:text-dark-950`:`text-gray-500 hover:text-gray-800 dark:text-dark-500 dark:hover:text-dark-800`),"aria-pressed":H===`huggingface`,children:[(0,W.jsx)(ne,{className:`h-4 w-4 inline me-1.5`}),`HuggingFace`]})]}),H===`installed`&&Et&&(0,W.jsx)(Fe,{sources:At,active:Dt,onChange:pe})]}),H===`installed`&&(0,W.jsx)(Pe,{groups:kt,selectedModel:t,showImageGen:_&&Ot,getModelValue:X,getModelIcon:e=>gt(e,`md`),getModelLabel:xt,getModelTag:St,getModelSubLabel:Ct,onExitTop:()=>z.current?.focus(),onModelSelect:ft,onShowAll:e=>{pe(e),z.current?.focus()},onOpenGallery:()=>{Q(!1),ve(`/gallery`)}},Dt),H===`ollama`&&(0,W.jsx)(Ie,{libraryCategories:qe,libraryCategory:U,canInstallModels:B,loadingLibrary:rt,filteredLibraryModels:ct,pullingModel:K,pullProgress:Ge,setLibraryCategory:Se,isModelInstalled:ht,onModelSelect:ft,onPullModel:pt,onCancelPull:mt,onRefreshLibrary:()=>{it()}}),H===`huggingface`&&(0,W.jsx)(je,{hfTask:Oe,hfSort:Me,canInstallModels:B,loadingHf:ot,hfModels:at,expandedHfModel:G,hfGgufFiles:Ve,loadingGguf:Ue,pullingModel:K,pullProgress:Ge,setHfTask:Ae,setHfSort:Ne,onToggleHfModel:ut,onPullHfGguf:dt,onCancelPull:mt,onRefreshHfModels:()=>{st()}})]})]}),document.body),(0,W.jsx)(`select`,{"data-testid":ie,"aria-label":A,"aria-hidden":`true`,dir:`ltr`,value:t,onChange:n,className:`hidden`,tabIndex:-1,children:e.map(e=>(0,W.jsx)(`option`,{value:X(e),children:$(e)},`${e.isLegacySelection?`legacy`:e.isPersona?`persona`:e.isPlugin?`plugin`:`ollama`}:${e.pluginId||``}:${X(e)}`))})]})},ze=({value:e,inheritedValue:t,onChange:n})=>{let{t:r}=s(),[i,a]=(0,I.useState)(!1),c=(0,I.useRef)(null),l=e??t,u=N(l),d=P(l),f=P(e),p=t==null?void 0:P(t),m=(0,I.useRef)(null),h=u?r(`chat.input.thinkingOn`,{level:r(`settings.generation.thinkingLevels.${d}`)}):r(`chat.input.thinkingOff`),g=()=>c.current?.querySelector(`button`)?.focus();return(0,I.useEffect)(()=>{if(!i)return;let e=m.current?.querySelectorAll(`[role="menuitemradio"]`);(Array.from(e??[]).find(e=>e.getAttribute(`aria-checked`)===`true`)??e?.[0])?.focus()},[i]),(0,I.useEffect)(()=>{if(!i)return;let e=e=>{c.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&(a(!1),g())};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[i]),(0,W.jsxs)(`div`,{ref:c,className:`relative shrink-0`,children:[(0,W.jsxs)(ie,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>a(e=>!e),className:o(`h-9 rounded-full p-0 flex items-center justify-center gap-1 touch-manipulation transition-colors duration-150`,u?`w-auto px-2.5`:`w-9`,`text-ink-muted hover:bg-interactive-hover hover:text-ink`,u&&`bg-primary-50 text-primary-600 dark:bg-primary-900/25 dark:text-primary-400`),title:h,"aria-label":h,"aria-haspopup":`menu`,"aria-expanded":i,"aria-pressed":u,children:[(0,W.jsx)(k,{className:`h-4 w-4`}),u&&(0,W.jsx)(`span`,{className:`text-[11px] font-medium`,children:r(`settings.generation.thinkingLevels.${d}`)})]}),i&&(0,W.jsxs)(`div`,{ref:m,role:`menu`,"aria-label":r(`chat.controls.thinking`),onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[role="menuitemradio"]`));if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length].focus()},className:`absolute bottom-full inset-e-0 z-30 mb-2 w-48 rounded-2xl border border-black/8 bg-surface/95 p-1.5 shadow-[0_16px_48px_rgba(15,23,42,0.16)] backdrop-blur-xl animate-scale-in dark:border-white/9 dark:bg-dark-100/95`,children:[(0,W.jsx)(`p`,{className:`mb-1 px-2 pt-1 text-[11px] font-medium text-ink-muted`,children:r(`chat.controls.thinking`)}),F.map(e=>{let t=e===f;return(0,W.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":t,tabIndex:-1,onClick:()=>{n(M(e)),a(!1),g()},className:o(`flex w-full items-center justify-between gap-2 rounded-xl px-2.5 py-2 text-start text-[13px] text-gray-700 hover:bg-gray-100 dark:text-dark-800 dark:hover:bg-dark-200`,t&&`text-primary-600 dark:text-primary-400`),children:[(0,W.jsx)(`span`,{className:`truncate`,children:e==="default"&&p!==void 0?r(`settings.generation.thinkingLevels.defaultWith`,{level:r(`settings.generation.thinkingLevels.${p}`)}):r(`settings.generation.thinkingLevels.${e}`)}),t&&(0,W.jsx)(te,{className:`h-3.5 w-3.5 shrink-0`})]},e)})]})]})},G=d(`hooks:dictation`),Be=()=>{if(typeof window>`u`)return;let e=window;return e.SpeechRecognition||e.webkitSpeechRecognition},Ve=[{mimeType:`audio/webm;codecs=opus`,format:`webm`}],He=300,Ue=.25,We=e=>`${encodeURIComponent(e.plugin)}:${encodeURIComponent(e.model)}`;function K(e){if(typeof MediaRecorder>`u`)return;let t=new Set((e.config?.formats||[]).map(e=>e.toLowerCase()));return Ve.find(e=>(t.size===0||t.has(e.format))&&(typeof MediaRecorder.isTypeSupported!=`function`||MediaRecorder.isTypeSupported(e.mimeType)))?.mimeType}function q({onStart:e,onText:t,ownerKey:n}){let{t:r,i18n:i}=s(),[a,o]=(0,I.useState)(`idle`),[c,l]=(0,I.useState)([]),u=(0,I.useRef)(null),d=(0,I.useRef)(null),f=(0,I.useRef)(null),p=(0,I.useRef)(null),m=(0,I.useRef)(null),h=(0,I.useRef)(0),g=(0,I.useRef)(`idle`),_=(0,I.useRef)(void 0),v=(0,I.useRef)(e),y=(0,I.useRef)(t);(0,I.useEffect)(()=>{v.current=e,y.current=t},[e,t]),(0,I.useEffect)(()=>{let e=!1;return A.getModels().then(t=>{!e&&t.success&&t.data&&l(t.data)}).catch(()=>{e||l([])}),()=>{e=!0}},[]);let b=(0,I.useMemo)(()=>typeof window<`u`&&window.isSecureContext&&typeof navigator<`u`&&!!navigator.mediaDevices&&!!Be(),[]),S=typeof window<`u`&&window.isSecureContext&&typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia,C=(0,I.useMemo)(()=>[...b?[{key:`browser`,kind:`browser`}]:[],...S?c.filter(e=>!!K(e)).map(e=>({key:We(e),kind:`provider`,model:e})):[]],[b,S,c]),[w,ee]=(0,I.useState)(``),T=(0,I.useMemo)(()=>C.find(e=>e.key===w)??C[0],[w,C]),E=T?.kind===`provider`?T.model:void 0,te=C.length>0,D=(0,I.useCallback)(()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]),O=(0,I.useCallback)(e=>{g.current=e,o(e)},[]),k=(0,I.useCallback)(()=>{h.current+=1,D(),u.current?.stop(),u.current=null,p.current?.abort(),p.current=null;let e=d.current;d.current=null,e&&(e.ondataavailable=null,e.onerror=null,e.onstop=null,e.state===`recording`&&e.stop()),f.current?.getTracks().forEach(e=>e.stop()),f.current=null,O(`idle`)},[D,O]);return(0,I.useEffect)(()=>(_.current=n,k),[k,n]),{supported:te,phase:a,toggle:(0,I.useCallback)(async()=>{let e=g.current;if(e===`starting`||e===`transcribing`){k();return}if(e===`recording`){d.current?.state===`recording`?(O(`transcribing`),d.current.stop()):k();return}if(E){let e=h.current+1;h.current=e;let t=_.current;v.current(),O(`starting`);try{let n=await navigator.mediaDevices.getUserMedia({audio:!0});if(h.current!==e||_.current!==t){n.getTracks().forEach(e=>e.stop());return}f.current=n;let a=K(E),o=a?new MediaRecorder(n,{mimeType:a}):new MediaRecorder(n),s=[];o.ondataavailable=e=>{e.data.size>0&&s.push(e.data)},o.onerror=()=>{n.getTracks().forEach(e=>e.stop()),D(),h.current===e&&(d.current=null,f.current=null,O(`idle`),x.error(r(`voiceMode.transcriptionFailed`)))},o.onstop=()=>{if(n.getTracks().forEach(e=>e.stop()),D(),h.current!==e||_.current!==t)return;if(d.current=null,f.current=null,s.length===0){O(`idle`);return}let a=new Blob(s,{type:o.mimeType||s[0].type||`audio/webm`}),c=new AbortController;p.current=c,O(`transcribing`),A.transcribe(a,E,{language:i.language,signal:c.signal,fallbackMessage:r(`voiceMode.transcriptionFailed`)}).then(n=>{h.current!==e||_.current!==t||c.signal.aborted||y.current(n.text.trim())}).catch(e=>{c.signal.aborted||(G.error(`Provider transcription failed:`,e),x.error(e instanceof Error?e.message:r(`voiceMode.transcriptionFailed`)))}).finally(()=>{p.current===c&&h.current===e&&(p.current=null,O(`idle`))})},d.current=o,o.start(250);let c=E.config?.max_duration_seconds,l=typeof c==`number`&&c>0?Math.min(c,He):He;m.current=window.setTimeout(()=>{h.current===e&&o.state===`recording`&&o.stop()},Math.max(.1,l-Ue)*1e3),O(`recording`);return}catch(t){if(h.current!==e)return;G.error(`Failed to start provider dictation:`,t),D(),f.current?.getTracks().forEach(e=>e.stop()),f.current=null,d.current=null,O(`idle`),x.error(r(`voiceMode.transcriptionFailed`));return}}let t=Be();if(!t)return;let n=h.current+1;h.current=n;let a=_.current,o=new t;o.lang=i.language,o.continuous=!0,o.interimResults=!0,v.current(),o.onresult=e=>{if(h.current!==n||_.current!==a||u.current!==o)return;let t=``;for(let n=0;n<e.results.length;n++)t+=e.results[n][0]?.transcript??``;y.current(t.trim())},o.onend=()=>{h.current===n&&(u.current=null,O(`idle`))},o.onerror=()=>{h.current===n&&(u.current=null,O(`idle`))},u.current=o,O(`recording`);try{o.start()}catch(e){G.error(`Failed to start dictation:`,e),u.current=null,O(`idle`)}},[k,D,i.language,E,O,r]),cancel:k,sources:C,activeSourceKey:T?.key??``,setSourceKey:ee,providerModel:E}}export{ze as n,Re as r,q as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-vendor-C1iE8mnY.js";var r=e(t(),1),i=n(),a=r.createContext(void 0),o=e=>{let t=r.useContext(a);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},s=({client:e,children:t})=>(r.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,i.jsx)(a.Provider,{value:e,children:t})),c={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},l=new class{#e=c;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function u(e){setTimeout(e,0)}var d=typeof window>`u`||`Deno`in globalThis;function f(){}function p(e,t){return typeof e==`function`?e(t):e}function m(e){return typeof e==`number`&&e>=0&&e!==1/0}function h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function g(e,t){return typeof e==`function`?e(t):e}function _(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==y(o,t.options))return!1}else if(!x(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function v(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(b(t.options.mutationKey)!==b(a))return!1}else if(!x(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function y(e,t){return(t?.queryKeyHashFn||b)(e)}function b(e){return JSON.stringify(e,(e,t)=>E(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function x(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!x(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!x(e[r],t[r]))return!1;return!0}return!1}var S=Object.prototype.hasOwnProperty;function C(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=T(e)&&T(t);if(!r&&!(E(e)&&E(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:S.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=C(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function w(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n of Object.keys(e))if(!S.call(t,n)||e[n]!==t[n])return!1;return!0}function T(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function E(e){if(!D(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!D(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function D(e){return Object.prototype.toString.call(e)===`[object Object]`}function ee(e){return new Promise(t=>{l.setTimeout(t,e)})}function O(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:C(e,t)}function te(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(-n):r}function ne(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,n):r}var k=Symbol();function A(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===k?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function j(e,t){return typeof e==`function`?e(...t):!!e}var M=Symbol();function re(e,t,n,r){let i=!1,a;return Object.defineProperties(e,{[M]:{value:r},signal:{enumerable:!0,get:()=>(a??=t(),i||(i=!0,a.aborted?n():a.addEventListener(`abort`,n,{once:!0})),a)}}),e}var ie=()=>d,N=()=>ie(),P=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},F=new class extends P{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ae=u;function oe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ae,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var I=oe(),L=new class extends P{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function se(e){return Math.min(1e3*2**e,3e4)}function R(e){return(e??`online`)!==`online`||L.isOnline()}var z=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function B(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(f);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new z(t);g(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},p=()=>F.isFocused()&&(e.networkMode===`always`||L.isOnline())&&e.canRun(),m=()=>R(e.networkMode)&&e.canRun(),h=e=>{c()||(r?.(),i=`resolved`,a(e))},g=e=>{c()||(r?.(),i=`rejected`,o(e))},_=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),v=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(h).catch(r=>{if(c())return;let i=e.retry??(N()?0:3),a=e.retryDelay??se,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?g(r):(n++,e.onFail?.(n,r),ee(o).then(()=>c()||p()?void 0:_(p)).then(()=>{t?g(r):v()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:m,start:()=>(m()?v():_(m).then(v),s)}}var V=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#e=l.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(N()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(l.clearTimeout(this.#e),this.#e=void 0)}};function ce(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=t,u=e=>{re(e,()=>t.signal,()=>n=!0,l[M])},d=A(t.options,t.fetchOptions),f=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return u(e),e})(),o=await d(a),{maxPages:s}=t.options,c=i?ne:te;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?U:H,n={pages:a,pageParams:o};s=await f(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]===void 0?r.initialPageParam:o[0]:H(r,s);if(c>0&&e==null)break;s=await f(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function H(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function U(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function le(e,t){return t?H(e,t)!=null:!1}function ue(e,t){return!t||!e.getPreviousPageParam?!1:U(e,t)!=null}var de=class extends V{#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e){super(),this.#c=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=K(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=K(this.options);e.data!==void 0&&(this.setState(G(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=O(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(f).catch(f):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>g(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===k||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data!==void 0&&this.getObserversCount()>0&&this.observers.some(e=>g(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!h(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#c||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a&&this.#o)return this.#a.continueRetry(),this.#o}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperties(e,{[M]:{value:n.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,n.signal)}})},i=()=>{let e=A(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#c=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ce(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=B({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof z&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),s=(async()=>{try{let e=await o.promise;if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof z){if(e.silent){if(this.#a!==o&&this.#o)return this.#o;throw e}if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0,this.#o=void 0),this.scheduleGc()}})();return this.#o=s,o.start(),s}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...W(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...G(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),I.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function W(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:R(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function G(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function K(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var q=class extends P{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),J(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Y(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Y(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof g(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!w(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&X(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return w(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch(t).then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(f)),t}#h(e){return!N()&&g(this.options.enabled,this.#t)!==!1&&m(e)}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=h(this.#r.dataUpdatedAt,e)+1;this.#u=l.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return g(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=l.setInterval(()=>{(this.options.refetchIntervalInBackground||F.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(l.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(l.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&J(e,t),o=i&&X(e,n,t,r);(a||o)&&(l={...l,...W(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=O(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=O(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let _=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&_,x=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:Z(e,t),refetch:this.refetch,isEnabled:g(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),w(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(let t of n??this.#p)if(this.#r[t]!==e[t])return!0;return!1})();I.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function fe(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||g(t.retryOnMount,e)!==!1)}function J(e,t){return fe(e,t)||e.state.data!==void 0&&Y(e,t,t.refetchOnMount)}function Y(e,t,n){if(g(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=g(n,e);return r===`always`||r!==!1&&Z(e,t)}return!1}function X(e,t,n,r){return(e!==t||g(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Z(e,n)}function Z(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}var Q=r.createContext(!1),pe=()=>r.useContext(Q);Q.Provider;function me(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var he=r.createContext(me()),ge=()=>r.useContext(he),_e=(e,t,n)=>{let r=n?.state.status===`error`&&typeof e.throwOnError==`function`?j(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},ve=e=>{r.useEffect(()=>{e.clearReset()},[e])},ye=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||j(n,[e.error,r])),be=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},xe=(e,t)=>e?.suspense&&t.isPending,Se=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function $(e,t,n){let i=pe(),a=ge(),s=o(n),c=s.defaultQueryOptions(e),l=s.getQueryCache().get(c.queryHash),u=e.subscribed!==!1;c._optimisticResults=i?`isRestoring`:u?`optimistic`:void 0,be(c),_e(c,a,l),ve(a);let[d]=r.useState(()=>new t(s,c)),p=d.getOptimisticResult(c);r.useEffect(()=>{d.setOptions(c)},[c,d]);let m=!i&&u;if(r.useSyncExternalStore(r.useCallback(e=>{let t=m?d.subscribe(I.batchCalls(e)):f;return d.updateResult(),t},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),xe(c,p))throw Se(c,d,a);if(ye({result:p,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw p.error;return c.notifyOnChangeProps?p:d.trackResult(p)}function Ce(e,t){return $(e,q,t)}export{o as C,s as S,_,le as a,g as b,B as c,F as d,P as f,v as g,y as h,de as i,L as l,b as m,$ as n,ue as o,p,q as r,V as s,Ce as t,I as u,f as v,k as x,x as y};
@@ -1 +1 @@
1
- import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{i as n}from"./react-vendor-C1iE8mnY.js";import{f as r,h as i,u as a}from"./utils-BvvV-Cka.js";var o=e(n()),s=(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);m(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},c={},l=(e,t,n,r)=>{m(n)&&c[n]||(m(n)&&(c[n]=new Date),s(e,t,n,r))},u=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},d=(e,t,n)=>{e.loadNamespaces(t,u(e,n))},f=(e,t,n,r)=>{if(m(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return d(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,u(e,r))},p=(e,t,n={})=>!t.languages||!t.languages.length?(l(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}}),m=e=>typeof e==`string`,h=e=>typeof e==`object`&&!!e,g=(0,o.createContext)(),_=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},v=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})),y=t(((e,t)=>{t.exports=v()}))(),b={t:(e,t)=>{if(m(t))return t;if(h(t)&&m(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},x=()=>()=>{},S=(e,t={})=>{let{i18n:n}=t,{i18n:s,defaultNS:c}=(0,o.useContext)(g)||{},u=n||s||a();u&&!u.reportNamespaces&&(u.reportNamespaces=new _),u||l(u,`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 h=(0,o.useMemo)(()=>({...r(),...u?.options?.react,...t}),[u,t]),{useSuspense:v,keyPrefix:S,bindI18n:C,bindI18nStore:w}=h,T=e||c||u?.options?.defaultNS,E=m(T)?[T]:T||[`translation`],D=(0,o.useMemo)(()=>E,E);u?.reportNamespaces?.addUsedNamespaces?.(D);let O=(0,o.useRef)(0),k=(0,o.useCallback)(e=>{if(!u)return x;let t=()=>{O.current+=1,e()};return C&&u.on(C,t),w&&u.store.on(w,t),()=>{C&&C.split(` `).forEach(e=>u.off(e,t)),w&&w.split(` `).forEach(e=>u.store.off(e,t))}},[u,C,w]),A=(0,o.useRef)(),j=(0,o.useCallback)(()=>{if(!u)return b;let e=!!(u.isInitialized||u.initializedStoreOnce)&&D.every(e=>p(e,u,h)),n=t.lng||u.language,r=O.current,a=typeof S==`function`?i(S,{...u.options,ns:D}):S,o=A.current;if(o&&o.i18n===u&&o.ready===e&&o.lng===n&&o.namespaces===D&&o.keyPrefix===a&&o.revision===r)return o;let s={t:u.getFixedT(n,h.nsMode===`fallback`?D:D[0],S,{scopeNs:D}),i18n:u,ready:e,lng:n,namespaces:D,keyPrefix:a,revision:r};return A.current=s,s},[u,D,S,h,t.lng]),[M,N]=(0,o.useState)(0),{t:P,ready:F}=(0,y.useSyncExternalStore)(k,j,j),I;u&&v&&!F&&(I=new Promise(e=>{let n=()=>e();t.lng?f(u,t.lng,D,n):d(u,D,n)}),{t:P,ready:F}=j()),(0,o.useEffect)(()=>{if(u&&!F&&!v){let e=()=>N(e=>e+1);t.lng?f(u,t.lng,D,e):d(u,D,e)}},[u,t.lng,D,F,v,M]);let L=u||{},R=(0,o.useRef)(null),z=(0,o.useRef)(),B=e=>`${e.language}|${e.resolvedLanguage}|${e.languages?.join(`,`)}`,V=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},H=(0,o.useMemo)(()=>{let e=L,t=e&&B(e),n=e;e&&(R.current&&R.current.__original===e&&z.current===t?n=R.current:(n=V(e),R.current=n,z.current=t));let r=!F&&!v?(...e)=>(l(u,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),P(...e)):P,i=[r,n,F];return i.t=r,i.i18n=n,i.ready=F,i},[P,L,F,L.resolvedLanguage,L.language,L.languages]);if(u&&v&&!F){let e=!1;try{e=!1}catch{}throw e&&l(u,`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`),I}return H};export{S as t};
1
+ import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{i as n}from"./react-vendor-C1iE8mnY.js";import{f as r,h as i,u as a}from"./utils-DsCVr_wG.js";var o=e(n()),s=(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);m(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},c={},l=(e,t,n,r)=>{m(n)&&c[n]||(m(n)&&(c[n]=new Date),s(e,t,n,r))},u=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},d=(e,t,n)=>{e.loadNamespaces(t,u(e,n))},f=(e,t,n,r)=>{if(m(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return d(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,u(e,r))},p=(e,t,n={})=>!t.languages||!t.languages.length?(l(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}}),m=e=>typeof e==`string`,h=e=>typeof e==`object`&&!!e,g=(0,o.createContext)(),_=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},v=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})),y=t(((e,t)=>{t.exports=v()}))(),b={t:(e,t)=>{if(m(t))return t;if(h(t)&&m(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},x=()=>()=>{},S=(e,t={})=>{let{i18n:n}=t,{i18n:s,defaultNS:c}=(0,o.useContext)(g)||{},u=n||s||a();u&&!u.reportNamespaces&&(u.reportNamespaces=new _),u||l(u,`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 h=(0,o.useMemo)(()=>({...r(),...u?.options?.react,...t}),[u,t]),{useSuspense:v,keyPrefix:S,bindI18n:C,bindI18nStore:w}=h,T=e||c||u?.options?.defaultNS,E=m(T)?[T]:T||[`translation`],D=JSON.stringify(E),O=(0,o.useMemo)(()=>E,[D]);u?.reportNamespaces?.addUsedNamespaces?.(O);let k=(0,o.useRef)(0),A=(0,o.useCallback)(e=>{if(!u)return x;let t=()=>{k.current+=1,e()};return C&&u.on(C,t),w&&u.store.on(w,t),()=>{C&&C.split(` `).forEach(e=>u.off(e,t)),w&&w.split(` `).forEach(e=>u.store.off(e,t))}},[u,C,w]),j=(0,o.useRef)(),M=(0,o.useCallback)(()=>{if(!u)return b;let e=!!(u.isInitialized||u.initializedStoreOnce)&&O.every(e=>p(e,u,h)),n=t.lng||u.language,r=k.current,a=typeof S==`function`?i(S,{...u.options,ns:O}):S,o=j.current;if(o&&o.i18n===u&&o.ready===e&&o.lng===n&&o.namespaces===O&&o.keyPrefix===a&&o.revision===r)return o;let s={t:u.getFixedT(n,h.nsMode===`fallback`?O:O[0],S,{scopeNs:O}),i18n:u,ready:e,lng:n,namespaces:O,keyPrefix:a,revision:r};return j.current=s,s},[u,O,S,h,t.lng]),[N,P]=(0,o.useState)(0),{t:F,ready:I}=(0,y.useSyncExternalStore)(A,M,M),L;u&&v&&!I&&(L=new Promise(e=>{let n=()=>e();t.lng?f(u,t.lng,O,n):d(u,O,n)}),{t:F,ready:I}=M()),(0,o.useEffect)(()=>{if(u&&!I&&!v){let e=()=>P(e=>e+1);t.lng?f(u,t.lng,O,e):d(u,O,e)}},[u,t.lng,O,I,v,N]);let R=u||{},z=(0,o.useRef)(null),B=(0,o.useRef)(),V=e=>`${e.language}|${e.resolvedLanguage}|${e.languages?.join(`,`)}`,H=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},U=(0,o.useMemo)(()=>{let e=R,t=e&&V(e),n=e;e&&(z.current&&z.current.__original===e&&B.current===t?n=z.current:(n=H(e),z.current=n,B.current=t));let r=!I&&!v?(...e)=>(l(u,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),F(...e)):F,i=[r,n,I];return i.t=r,i.i18n=n,i.ready=I,i},[F,R,I,R.resolvedLanguage,R.language,R.languages]);if(u&&v&&!I){let e=!1;try{e=!1}catch{}throw e&&l(u,`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`),L}return U};export{S as t};
@@ -0,0 +1 @@
1
+ import{i as e,r as t}from"./utils-vendor-CsC5rH1J.js";var n=e=>typeof e==`string`,r=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},i=e=>e==null?``:String(e),a=e=>n(e)&&/^[A-Za-z0-9_@.-]{1,128}$/.test(e)&&!e.includes(`..`)&&![`__proto__`,`constructor`,`prototype`].includes(e),o=e=>e?.callbackApi??e?.constructor?.callbackApi,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||n(e),d=(e,t,r)=>{let i=n(t)?t.split(`.`):t,a=0;for(;a<i.length-1;){if(u(e))return{};let t=l(i[a]);!e[t]&&r&&(e[t]=new r),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return u(e)?{}:{obj:e,k:l(i[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,r)=>{for(let i in t)i!==`__proto__`&&i!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,i)?n(e[i])||e[i]instanceof String||n(t[i])||t[i]instanceof String?r&&(e[i]=t[i]):g(e[i],t[i],r):e[i]=t[i]);return e},_=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),v={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},y=e=>n(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],typeof t!=`function`&&a!==`__proto__`||Object.prototype.hasOwnProperty.call(i,a)||(t=void 0),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,this.seen=new Set}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)}once(e,t,...n){return!this.debug||this.seen.has(e)||this.seen.size>=1e3?null:(this.seen.add(e),this[t](...n))}forward(e,t,r,i){return i&&!this.debug?null:(e=e.map(e=>n(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),n(e[0])&&(e[0]=`${r}${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){(typeof e==`string`?e.split(` `):[e]).forEach(e=>{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.logger=D.create(`resourceStore`),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)}deprecateDottedLng(e){this.logger.once(e,`deprecate`,`${e}: a dotted language ('en.translation.key') that carries the namespace and key is removed in v27; pass language, namespace and key as separate arguments`)}getResource(e,t,r,i={}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=i.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:i.ignoreJSONStructure,s;e.includes(`.`)?(this.deprecateDottedLng(`getResource`),s=e.split(`.`)):(s=[e,t],r&&(Array.isArray(r)?s.push(...r):n(r)&&a?s.push(...r.split(a)):s.push(r)));let c=m(this.data,s);return c==null&&!t&&!r&&e.includes(`.`)&&(e=s[0],t=s[1],r=s.slice(2).join(`.`)),c!=null||!o||!n(r)?c:w(this.data?.[e]?.[t],r,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(`.`)&&(this.deprecateDottedLng(`addResource`),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,r,i={silent:!1}){for(let i in r)(n(r[i])||Array.isArray(r[i]))&&this.addResource(e,t,i,r[i],{silent:!0});i.silent||this.emit(`added`,e,t,r)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(this.deprecateDottedLng(`addResourceBundle`),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=>!n(e)&&typeof e!=`boolean`&&typeof e!=`number`,F=class e extends O{constructor(e,t={}){super(),s([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`,`ownPostProcessors`],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 r=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;r===void 0&&(r=`:`);let i=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,a=t.ns||this.options.defaultNS||[],o=r&&e.includes(r),s=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!C(e,r,i);if(o&&!s){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:n(a)?[a]:a};let o=e.split(r);(r!==i||r===i&&this.options.ns.includes(o[0]))&&(a=o.shift()),e=o.join(i)}return{key:e,namespaces:n(a)?[a]:a}}translate(t,r,i){let a=typeof r==`object`?{...r}:r;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&&!n(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)&&!(n(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!`),this.logger.once(`returnedObject`,`deprecate`,`accessing an object without returnObjects returns a sentence about it today; from v27 t() returns the key, as for a missing key (returnedObjectHandler can keep today's text)`));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&&n(y)&&Array.isArray(h))h=h.join(y),h&&=this.extendTranslation(h,t,a,m,i);else{let e=!1,n=!1;!this.isValidLookup(h)&&S&&(e=!0,h=E),this.isValidLookup(h)||(n=!0,h=c);let r=(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 i=S&&n!==h?n:r;this.options.missingKeyHandler?this.options.missingKeyHandler(e,u,t,i,o,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,u,t,i,o,a,void 0,this.utils?.hasLoadedNamespace),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,i),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,r,i,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});let o=n(e)&&(r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables),s;if(o){let t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let c=r.replace&&!n(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),e=this.interpolator.interpolate(e,c,r.lng||this.language||i.usedLng,r),o){let t=e.match(this.interpolator.nestingRegexp),n=t&&t.length;s<n&&(r.nest=!1)}!r.lng&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>a?.[0]===e[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),r)),r.interpolation&&this.interpolator.reset()}let o=r.postProcess||this.options.postProcess,s=n(o)?[o]:o;return e!=null&&s?.length&&r.applyPostProcessor!==!1&&(s.forEach(e=>{this.logger.debug&&j.processors[e]&&this.ownPostProcessors&&!this.ownPostProcessors.has(e)&&this.logger.once(e,`deprecate`,`postProcess: '${e}' was registered with use() on another i18next instance; from v27 post-processors are per instance, so call use() with it on this instance too`)}),e=j.handle(s,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,t={}){let r,i,a,o,s;return n(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(r))return;let c=this.extractFromKey(e,t),l=c.key;i=l;let u=c.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let d=t.count!==void 0&&!n(t.count),f=d&&!t.ordinal&&t.count===0,p=t.context!==void 0&&(n(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(r)||(s=e,!this.checkedLoadedFor[`${m[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(this.checkedLoadedFor[`${m[0]}-${e}`]=!0,this.logger.warn(`key "${i}" 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(n=>{if(this.isValidLookup(r))return;o=n;let i=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,n,e,t);else{let e;d&&(e=this.pluralResolver.getSuffix(n,t.count,t));let r=`${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+r)),p){let n=`${l}${this.options.contextSeparator||`_`}${t.context}`;i.push(n),d&&(t.ordinal&&e.startsWith(a)&&i.push(n+e.replace(a,this.options.pluralSeparator)),i.push(n+e),f&&i.push(n+r))}}let s;for(;s=i.pop();)this.isValidLookup(r)||(a=s,r=this.getResource(n,e,s,t))}))})}),{res:r,usedKey:i,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`],r=e.replace&&!n(e.replace),i=r?e.replace:e;if(r&&e.count!==void 0&&(i={...i,count:e.count}),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(let e of t)delete i[e]}return i}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(n(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)}let t=this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e;return this.logger.debug&&n(e)&&this.deprecateBareCode(e,t),t}deprecateBareCode(e,t){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{return}let r=n.toLowerCase()===e.toLowerCase()?n:e.toLowerCase();this.options.lowerCaseLng&&(r=r.toLowerCase()),r!==t&&this.logger.once(e,`deprecate`,`language code '${e}' is used as '${t}'; i18next v27 gives it the canonical casing '${r}', use '${r}' in lng, fallbackLng, supportedLngs and the resources`)}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))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),n(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let r=e[t];return r||=e[this.getScriptPartFromCode(t)],r||=e[this.formatLanguageCode(t)],r||=e[this.getLanguagePartFromCode(t)],r||=e.default,r||[]}toResolveHierarchy(e,t){let r=this.options.fallbackLng,i=Array.isArray(r)?r.join(`|`):r;i!==this._cachedFallbackLng&&(this.resolveHierarchyCache={},this._cachedFallbackLng=i);let a=t===void 0||t===!1||n(t),o=t===void 0&&typeof this.options.fallbackLng==`function`,s=n(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 n(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))):n(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,r,i=`.`,a=!0)=>{let o=h(e,t,r);return o==null&&a&&n(r)&&(o=w(e,r,i),o===void 0&&(o=w(t,r,i))),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;if(a||s||f||m){let e=Object.entries({prefixEscaped:a,suffixEscaped:s,nestingPrefixEscaped:f,nestingSuffixEscaped:m}).filter(([,e])=>e).map(([e])=>e);this.logger.once(e.join(),`deprecate`,`interpolation.${e.join(`, interpolation.`)}: the regex-escaped delimiter options are removed in v27; pass the literal delimiters as prefix, suffix, nestingPrefix and nestingSuffix`)}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,r,a){let o,s,c,l=e,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=e=>{if(!e.includes(this.formatSeparator)){let n=z(t,u,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(n,void 0,r,{...a,...t,interpolationkey:e}):n}let n=e.split(this.formatSeparator),i=n.shift().trim(),o=n.join(this.formatSeparator).trim();return this.format(z(t,u,i,this.options.keySeparator,this.options.ignoreJSONStructure),o,r,{...a,...t,interpolationkey:i})};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 f=a?.missingInterpolationHandler||this.options.missingInterpolationHandler,p=a?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:a.interpolation.skipOnVariables,m=[{regex:this.regexpUnescape,safeValue:e=>e},{regex:this.regexp,safeValue:e=>this.escapeValue?(this.escape===y&&this.options?.interpolation?.escapeValue!==!1&&n(e)&&e.includes(`/`)&&this.logger.once(`/`,`deprecate`,`escapeValue renders '/' in a value as '&#x2F;' today; from v27 the default escape leaves '/' as it is`),this.escape(e)):e}],h=[],g=0;return m.forEach(t=>{for(c=0;o=t.regex.exec(e);){let r=o.index-g,u=h.find(([e,t])=>r>=e&&r<t);if(u){t.regex.lastIndex=u[1]+g;continue}let m=o[1].trim();if(s=d(m),s===void 0){if(typeof f==`function`){let t=f(e,o,a);s=n(t)?t:``}else if(a&&Object.prototype.hasOwnProperty.call(a,m))s=``;else if(p){this.logger.debug&&this.logger.once(`${l}\u0000${o[0]}`,`warn`,`missed to pass in variable ${m} for interpolating ${l}`),s=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),s=``}else!n(s)&&!this.useRawValueToEscape&&(s=i(s));let _=i(t.safeValue(s));if(e=e.slice(0,o.index)+_+e.slice(o.index+o[0].length),p?(t.regex===this.regexpUnescape?h.push([o.index,o.index+_.length]):g+=_.length-o[0].length,t.regex.lastIndex+=_.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,t,r={}){let a,o,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(;a=l.exec(e);){let f=[];s={...r},s=s.replace&&!n(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let p=/{.*}/s.test(a[1])?a[1].lastIndexOf(`}`)+1:a[1].indexOf(this.formatSeparator);if(p!==-1&&(f=a[1].slice(p).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),a[1]=a[1].slice(0,p)),o=t(c.call(this,a[1].trim(),s),s),o&&a[0]===e&&!n(o))return o;n(o)||(o=i(o)),o||=(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),``),f.length&&(o=f.reduce((e,t)=>this.format(e,t,r.lng,{...r,interpolationkey:a[1].trim()}),o.trim())),u+=e.slice(d,a.index)+i(o),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;try{o=r+JSON.stringify(a)}catch{return e(T(r),i)(n)}let 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),this.callbackApi=o(this.backend),this.backend&&this.callbackApi===void 0&&(this.backend.read||this.backend.create)&&this.logger.deprecate(`backend: set callbackApi to declare the calling convention (true: read(language, namespace, callback) and create(languages, namespace, key, fallbackValue, callback, options); false: both return a promise or a value); guessing it from the number of parameters is deprecated`)}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:!n.reload&&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(this.callbackApi===!1||this.callbackApi===void 0&&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,r={},i){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),i&&i();n(e)&&(e=this.languageUtils.toResolveHierarchy(e)),n(t)&&(t=[t]);let a=this.queueLoad(e,t,r,i);if(!a.toLoad.length)return a.pending.length||i(),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)}noticeDevFallback(e){e===`dev`&&this.devIsDefaultFallback&&this.logger.once(`dev`,`warn`,`language 'dev' is requested because fallbackLng is not set (its default is ['dev']); i18next v27 defaults to fallbackLng: false and loads and saves missing keys in the requested language instead. Set fallbackLng to your source language, or to 'dev' to keep this behavior`)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.noticeDevFallback(r),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=()=>{},s=this.newestCloneHasLoadedNamespace||this.services?.utils?.hasLoadedNamespace){if(s&&!s(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){e?.forEach?.(e=>this.noticeDevFallback(e));let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(this.callbackApi===!1||this.callbackApi===void 0&&c.length<6)try{let i;i=this.callbackApi===!1||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]),n(e[1])&&(t.defaultValue=e[1]),n(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=>(n(e.ns)&&(e.ns=[e.ns]),n(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),n(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),W=()=>{},G,se=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},K=class e extends O{constructor(e={},t){if(super(),this.options=U(e),this.services={ownPostProcessors:new Set},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&&(n(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let i=e.fallbackLng===void 0&&this.options.fallbackLng===void 0,a=H();this.options={...a,...this.options,...U(e)},this.options.interpolation={...a.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=a.overloadTranslationOptionHandler);let s=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){G&&G!==this&&G.modules.logger!==this.modules.logger&&D.deprecate(`init: this init() replaces the logger another i18next instance set with use(), as the logger is shared in v26; from v27 each instance keeps its own logger`),G=this.modules.logger?this:void 0,this.modules.logger?D.init(s(this.modules.logger),this.options):D.init(null,this.options),this.pendingWarnings?.forEach(e=>this.logger.warn(e)),this.pendingWarnings=void 0;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=s(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),reloadResources:this.reloadResources.bind(this)},n.backendConnector=new oe(s(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.devIsDefaultFallback=i,n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=s(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options),n.languageDetector.async&&o(n.languageDetector)===void 0&&this.logger.deprecate(`languageDetector: set callbackApi to declare how the async detect() answers (true: detect(callback); false: detect() returns a promise); guessing it from the number of parameters is deprecated`)),this.modules.i18nFormat&&(n.i18nFormat=s(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 c=r(),l=()=>{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),c.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?l():setTimeout(l,0),c}loadResources(e,t=W){let r=t,i=n(e)?e:this.language;if(typeof e==`function`&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return r();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};i?t(i):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),r(e)})}else r(null)}reloadResources(e,t,n){let i=r();if(typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),!e){let t=Object.keys(this.services.backendConnector.state).map(e=>e.split(`|`)[0]);e=[...new Set([...this.languages||[],...t])].filter(e=>e!==`cimode`)}return t||=this.options.ns,n||=W,this.services.backendConnector.reload(e,t,e=>{i.resolve(),n(e)}),i}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()`);let t=t=>{if(this.modules[t]&&this.modules[t]!==e){let e=`use: this ${t} replaces the ${t} passed to an earlier use() call; only one ${t} is used per instance`;this.isInitializing||this.isInitialized?this.logger.warn(e):(this.pendingWarnings=this.pendingWarnings||[]).push(e)}this.modules[t]=e};return e.type===`backend`&&t(`backend`),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&t(`languageDetector`),e.type===`i18nFormat`&&t(`i18nFormat`),e.type===`postProcessor`&&(j.addPostProcessor(e),this.services.ownPostProcessors?.add(e.name)),e.type===`formatter`&&t(`formatter`),e.type===`3rdParty`&&this.modules.external.push(e),this}hydrate(e,t){return this.options.isClone?this:this.services.resourceStore?(e&&!this.initializedStoreOnce&&(this.services.resourceStore.data=e,Object.values(e).forEach(e=>{Object.keys(e).forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)})}),this.initializedStoreOnce=!0,this.isInitialized=!0),t&&!this.initializedLanguageOnce&&(this.changeLanguage(t),this.initializedLanguageOnce=!0),this):(this.logger.warn(`hydrate: call init() first, the instance has no resource store yet`),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 i=r();this.emit(`languageChanging`,e);let s=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},c=(n,r)=>{r?this.isLanguageChangingTo===e&&(s(r),this.translator.changeLanguage(r),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,r),this.logger.log(`languageChanged`,r)):this.isLanguageChangingTo=void 0,i.resolve((...e)=>this.t(...e)),t&&t(n,(...e)=>this.t(...e))},l=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let r=n(t)?t:t&&t[0],i=this.store.hasLanguageSomeTranslations(r)?r:this.services.languageUtils.getBestMatchFromCodes(n(t)?[t]:t);i&&this.logger.debug&&!a(i)&&![].concat(this.options.supportedLngs||[],this.services.languageUtils.getFallbackCodes(this.options.fallbackLng,i),this.options.preload||[]).includes(i)&&!Object.prototype.hasOwnProperty.call(this.store.data,i)&&this.logger.once(`lng:${i}`,`deprecate`,`changeLanguage: the language code '${i.slice(0,64)}' comes from lng, changeLanguage() or the language detector and is not configured; from v27 such a code is refused unless it has only letters, digits, '-', '_', '@' and '.' (no '..'), at most 128 characters. Set supportedLngs, or check the code before passing it on`),i&&(this.language||s(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,e=>{c(e,i)})};if(!e&&this.services.languageDetector&&!this.services.languageDetector.async)l(this.services.languageDetector.detect());else if(!e&&this.services.languageDetector&&this.services.languageDetector.async){let e=o(this.services.languageDetector);e===!1||e===void 0&&this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l)}else l(e);return i}getFixedT(e,t,r,i){let a=i?.scopeNs,o=(e,t,...n)=>{let i;i=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(n)),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||r||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 n(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=r,o}t(...e){return this.translator?this.translator.translate(...e):(this.logger.warn(`t: called before init(); returning an empty string`),``)}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 i=r();return this.options.ns?(n(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{i.resolve(),t&&t(e)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){let i=r();n(e)&&(e=[e]);let a=this.options.preload||[],o=e.filter(e=>!a.includes(e)&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=a.concat(o),this.loadResources(e=>{i.resolve(),t&&t(e)}),i):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`ltr`;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&&(t={...t},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={...a.services.utils,hasLoadedNamespace:a.hasLoadedNamespace.bind(a),reloadResources:a.reloadResources.bind(a)},r){let e=t=>{let n=Array.isArray(t)?[...t]:{...t};return Object.keys(n).forEach(t=>{n[t]&&typeof n[t]==`object`&&(n[t]=e(n[t]))}),n};a.store=new A(e(this.store.data),i),a.services.resourceStore=a.store}if(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.newestCloneHasLoadedNamespace=a.hasLoadedNamespace.bind(a),a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();K.createInstance,K.dir,K.init,K.loadResources,K.reloadResources,K.use,K.changeLanguage,K.getFixedT,K.t,K.exists,K.setDefaultNamespace,K.hasLoadedNamespace,K.loadNamespaces,K.loadLanguages;var ce=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,le={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":`\xA0`,"&#160;":`\xA0`,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},ue=e=>le[e],q={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:e=>e.replace(ce,ue),transDefaultProps:void 0},de=(e={})=>{q={...q,...e}},fe=()=>q,J,pe=e=>{J=e},me=()=>J;function he(...n){return t(e(n))}function ge(){return typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)}var Y=new Map,X=new Map,Z=e=>{let t=Y.get(e);return t||(t=new Intl.RelativeTimeFormat(e,{numeric:`auto`,style:`narrow`}),Y.set(e,t)),t},Q=e=>{let t=X.get(e);return t||(t=new Intl.DateTimeFormat(e),X.set(e,t)),t};function _e(e,t=`en`){let n=new Date(e),r=Math.max(0,new Date().getTime()-n.getTime()),i=Math.floor(r/6e4),a=Math.floor(r/36e5),o=Math.floor(r/864e5);if(t.toLowerCase().split(`-`)[0]===`en`)return i<1?`Just now`:i<60?`${i}m ago`:a<24?`${a}h ago`:o<7?`${o}d ago`:Q(t).format(n);let s=Z(t);return i<1?s.format(0,`second`):i<60?s.format(-i,`minute`):a<24?s.format(-a,`hour`):o<7?s.format(-o,`day`):Q(t).format(n)}function ve(e,t=`en`,n=Date.now()){let r=Math.round((e-n)/1e3),i=Math.abs(r),a=Z(t);return i<60?a.format(r,`second`):i<3600?a.format(Math.round(r/60),`minute`):i<86400?a.format(Math.round(r/3600),`hour`):a.format(Math.round(r/86400),`day`)}function ye(e){let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(1)} ${t[r]}`}function $(e=12){let t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);let n=``;for(let e of t)n+=`0123456789abcdefghijklmnopqrstuvwxyz`[e%36];return n}function be(){return $(11)+Date.now().toString(36)}function xe(e,t){return e.length<=t?e:e.substring(0,t)+`...`}function Se(e){for(let t of[/^\[Thinking:\s*([\s\S]*?)\]\s*/i,/^<thinking>([\s\S]*?)<\/thinking>\s*/i,/^<think>([\s\S]*?)<\/think>\s*/i]){let n=e.match(t);if(n)return{thinking:n[1].trim(),content:e.slice(n[0].length).trim(),thinkingComplete:!0}}for(let[t,n]of[[/^\[Thinking:\s*/i,`]`],[/^<thinking>\s*/i,`</thinking>`],[/^<think>\s*/i,`</think>`]]){let r=e.match(t);if(r&&!e.toLowerCase().includes(n))return{thinking:e.slice(r[0].length).trim()||null,content:``,thinkingComplete:!1}}return{thinking:null,content:e,thinkingComplete:!0}}export{be as a,$ as c,pe as d,fe as f,N as h,_e as i,xe as l,K as m,ye as n,ge as o,de as p,ve as r,Se as s,he as t,me as u};
@@ -0,0 +1,5 @@
1
+ import{t as e}from"./client-D05vqJPO.js";import{t}from"./config-DCQ2-rvE.js";var n=new Set([`snapshot`,`run_state`,`reasoning_delta`,`assistant_delta`,`tool_call`,`tool_result`,`approval`,`usage`,`skill_loaded`,`error`,`done`]),r=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:void 0,i=e=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t=Number(e);if(Number.isFinite(t))return t;let n=Date.parse(e);if(Number.isFinite(n))return n}return Date.now()},a=(e,t,a,o,s)=>{let c=r(e);if(!c)return;let l=Number(c.id??t),u=String(c.type??a??``),d=String(c.taskId??o),f=String(c.runId??s);if(!Number.isSafeInteger(l)||l<0||!n.has(u)||d!==o||f!==s)return;let p=c.data;return{id:l,type:u,taskId:d,runId:f,timestamp:i(c.timestamp),data:r(p)||(p===void 0?{}:{content:p})}},o=(e,t,n)=>{let r,i,o=[];for(let t of e.split(`
2
+ `)){if(!t||t.startsWith(`:`))continue;let e=t.indexOf(`:`),n=e===-1?t:t.slice(0,e),a=e===-1?``:t.slice(e+1),s=a.startsWith(` `)?a.slice(1):a;n===`id`&&(r=s),n===`event`&&(i=s),n===`data`&&o.push(s)}if(o.length===0)return;let s=o.join(`
3
+ `);if(s===`[DONE]`)return a({id:r,type:`done`,taskId:t,runId:n,timestamp:Date.now(),data:{}},r,i,t,n);try{return a(JSON.parse(s),r,i,t,n)}catch{return}},s=class{taskId;runId;onEvent;buffer=``;constructor(e,t,n){this.taskId=e,this.runId=t,this.onEvent=n}push(e){e&&(this.buffer+=e,this.drain())}finish(e=``){if(this.buffer+=e,this.drain(),!this.buffer.trim()){this.buffer=``;return}let t=o(this.buffer.replace(/\r\n?/g,`
4
+ `),this.taskId,this.runId);this.buffer=``,t&&this.onEvent(t)}drain(){let e=/\r?\n\r?\n/.exec(this.buffer);for(;e?.index!==void 0;){let t=this.buffer.slice(0,e.index).replace(/\r\n?/g,`
5
+ `);this.buffer=this.buffer.slice(e.index+e[0].length);let n=o(t,this.taskId,this.runId);n&&this.onEvent(n),e=/\r?\n\r?\n/.exec(this.buffer)}}},c=async e=>{try{let t=await e.json(),n=typeof t.error==`string`?t.error:typeof t.message==`string`?t.message:void 0;if(n)return Error(n)}catch{}return Error(`Work event stream failed with status ${e.status}.`)},l=async({taskId:e,runId:n,after:r,signal:i,onEvent:a})=>{let o=localStorage.getItem(`auth-token`),l=new URL(`${t}/work/tasks/${encodeURIComponent(e)}/runs/${encodeURIComponent(n)}/events`,window.location.origin);l.searchParams.set(`after`,String(Math.max(0,Math.trunc(r))));let u=await fetch(l,{method:`GET`,headers:{Accept:`text/event-stream`,...o?{Authorization:`Bearer ${o}`}:{}},cache:`no-store`,credentials:`same-origin`,signal:i});if(!u.ok)throw await c(u);if(!u.body)throw Error(`Work event stream has no response body.`);let d=u.body.getReader(),f=new TextDecoder,p=new s(e,n,a);try{for(;!i.aborted;){let{done:e,value:t}=await d.read();if(e)break;p.push(f.decode(t,{stream:!0}))}p.finish(f.decode())}finally{d.releaseLock()}},u=e=>`/work/tasks/${encodeURIComponent(e)}`,d={access:()=>e.get(`/work/access`).then(e=>e.data),setAccess:t=>e.put(`/work/access`,{mode:t}).then(e=>e.data),agents:()=>e.get(`/work/agents`).then(e=>e.data),agentAccess:()=>e.get(`/work/agents/access`).then(e=>e.data),setAgentAccess:t=>e.put(`/work/agents/access`,{mode:t}).then(e=>e.data),adminOverview:()=>e.get(`/work/admin/overview`).then(e=>e.data),adminRecovery:()=>e.get(`/work/admin/recovery`).then(e=>e.data),retryAdminRecovery:()=>e.post(`/work/admin/recovery/retry`).then(e=>e.data),listPolicies:()=>e.get(`/work/policies`).then(e=>e.data),sendRunMessage:(t,n)=>e.post(`/work/tasks/${encodeURIComponent(t)}/messages`,{message:n}).then(e=>e.data),getComputerSetup:()=>e.get(`/work/computer/setup`).then(e=>e.data),startComputerSetup:()=>e.post(`/work/computer/setup`).then(e=>e.data),createPolicy:t=>e.post(`/work/policies`,t).then(e=>e.data),updatePolicy:(t,n)=>e.put(`/work/policies/${encodeURIComponent(t)}`,n).then(e=>e.data),deletePolicy:t=>e.delete(`/work/policies/${encodeURIComponent(t)}`).then(e=>e.data),capabilities:()=>e.get(`/work/capabilities`).then(e=>e.data),listRuns:(t,n)=>e.get(`${u(t)}/runs${n?`?limit=${encodeURIComponent(n)}`:``}`).then(e=>e.data),getRun:(t,n)=>e.get(`${u(t)}/runs/${encodeURIComponent(n)}`).then(e=>e.data),markTaskSeen:t=>e.post(`/work/tasks/${encodeURIComponent(t)}/seen`).then(e=>e.data),getApprovals:t=>e.get(`${u(t)}/approvals`).then(e=>e.data),setApprovalsEnabled:(t,n)=>e.put(`${u(t)}/approvals`,{enabled:n}).then(e=>e.data),decideApproval:(t,n,r,i=`once`)=>e.post(`${u(t)}/approvals/${encodeURIComponent(n)}`,{approve:r,scope:i}).then(e=>e.data),deleteApprovalRule:(t,n)=>e.delete(`${u(t)}/approval-rules/${encodeURIComponent(n)}`).then(e=>e.data),listTasks:()=>e.get(`/work/tasks`).then(e=>e.data),createTask:t=>e.post(`/work/tasks`,t).then(e=>e.data),getTask:t=>e.get(u(t)).then(e=>e.data),getMessages:(t,n,r=200)=>e.get(`${u(t)}/messages`,{params:{before:n,limit:r}}).then(e=>e.data),updateTask:(t,n)=>e.patch(u(t),n).then(e=>e.data),deleteTask:t=>e.delete(u(t)).then(e=>e.data),startRun:(t,n)=>e.post(`${u(t)}/runs`,n).then(e=>e.data),cancelRun:t=>e.post(`${u(t)}/cancel`).then(e=>e.data),streamRunEvents:e=>l(e),listFiles:(t,n=``)=>e.get(`${u(t)}/files`,{params:{path:n}}).then(e=>{let t=e.data;return t.data&&!Array.isArray(t.data)?{...t,data:t.data.entries}:t}),getFile:(t,n)=>e.get(`${u(t)}/file`,{params:{path:n}}).then(e=>e.data),saveFile:(t,n,r,i)=>e.put(`${u(t)}/file`,{content:r,expectedUpdatedAt:i},{params:{path:n}}).then(e=>e.data),getGitStatus:t=>e.get(`${u(t)}/git`).then(e=>e.data),getGitDiff:(t,n)=>e.get(`${u(t)}/git/diff`,{params:n?{path:n}:void 0}).then(e=>e.data),initializeGit:t=>e.post(`${u(t)}/git/init`).then(e=>e.data),stageGitPaths:(t,n)=>e.post(`${u(t)}/git/stage`,{paths:n}).then(e=>e.data),commitGit:(t,n)=>e.post(`${u(t)}/git/commit`,{message:n}).then(e=>e.data),createGitBranch:(t,n)=>e.post(`${u(t)}/git/branches`,{name:n}).then(e=>e.data),switchGitBranch:(t,n)=>e.post(`${u(t)}/git/switch`,{name:n}).then(e=>e.data),startPreview:(t,n,r={})=>e.post(`${u(t)}/preview/start`,{...n?{command:n}:{},...r.reopen?{reopen:!0}:{}}).then(e=>e.data),stopPreview:t=>e.post(`${u(t)}/preview/stop`).then(e=>e.data)};export{d as t};
@@ -0,0 +1 @@
1
+ export{t as workApi}from"./workApi-CbFQfwRZ.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libre-webui",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "description": "A local-first workspace for chat, private knowledge, artifacts, and isolated model-driven work.",
5
5
  "bin": {
6
6
  "libre-webui": "bin/cli.js"
@@ -32,7 +32,7 @@
32
32
  "recovery:backup": "node backend/dist/cli/recoveryBackup.js",
33
33
  "migrate:postgres": "node backend/dist/cli/migrateSqliteToPostgres.js",
34
34
  "worker": "node backend/dist/worker.js",
35
- "test:package": "node --test scripts/test-deprecated-dependencies.mjs && node --test scripts/test-typescript-toolchain.mjs && node --test scripts/test-helm-versioning.mjs && node --test scripts/test-helm-work.mjs && node --test scripts/test-tts-example-security.mjs && npm run test:unit --workspace=frontend && npm run build && node --test scripts/test-persistence-boundary.mjs scripts/test-persistence-contract.mjs scripts/test-schema-migrations.mjs scripts/test-postgres-persistence.mjs scripts/test-document-indexing-postgres.mjs && node --test scripts/test-platform-coordination.mjs scripts/test-platform-storage.mjs scripts/test-memory-reliability.mjs && npm run test:team-storage && node --test scripts/test-durable-jobs.mjs scripts/test-account-retirement.mjs scripts/test-integrated-backup.mjs scripts/test-team-backup.mjs && node --test scripts/test-health-probes.mjs scripts/test-recovery-inventory.mjs scripts/test-recovery-drills.mjs && node --test scripts/test-structured-logging.mjs scripts/test-opentelemetry.mjs && node --test scripts/test-webpage-fetch-security.mjs && node --test scripts/test-provider-fetch.mjs && node --test scripts/test-cors.mjs && node --test scripts/test-websocket-close-codes.mjs && node --test scripts/test-web-search.mjs && node --test scripts/test-content-resource-limits.mjs && node --test scripts/test-calendar.mjs && node --test scripts/test-calendar-team.mjs && node --test scripts/test-notes.mjs && node --test scripts/test-automation-schedule.mjs && node --test scripts/test-automations.mjs && node --test scripts/test-prompts.mjs scripts/test-skills.mjs && node --test scripts/test-resource-sharing.mjs && node --test scripts/test-channels.mjs && node --test scripts/test-notifications.mjs && node --test scripts/test-web-push.mjs && node --test scripts/test-smtp-client.mjs scripts/test-email-markdown.mjs scripts/test-email-notifications.mjs && node --test scripts/test-tool-gateway.mjs scripts/test-tool-approvals.mjs && node --test scripts/test-tool-oauth.mjs && node --test scripts/test-chat-tool-loop.mjs scripts/test-assistant-profiles.mjs && node --test scripts/test-registration-policy.mjs && node --test scripts/test-user-approval.mjs && node --test scripts/test-default-theme.mjs && node --test scripts/test-background-preferences.mjs && node --test scripts/test-default-model.mjs scripts/test-cli-args.mjs && node --test scripts/test-static-assets.mjs && node --test scripts/test-turnstile-auth.mjs && node --test scripts/test-oauth-security.mjs && node --test scripts/test-auth-sessions.mjs && node --test scripts/test-mfa.mjs && node --test scripts/test-api-tokens.mjs && node --test scripts/test-openai-compat.mjs && node --test scripts/test-authorization.mjs && node --test scripts/test-security-audit.mjs && node --test scripts/test-oidc-provider.mjs && node --test scripts/test-password-security.mjs && node --test scripts/test-live-deployment-security.mjs && node --test scripts/test-websocket-tickets.mjs && node --test scripts/test-capability-contracts.mjs scripts/test-global-capability-contracts.mjs && node --test scripts/test-ollama-model-defaults.mjs && node --test scripts/test-ollama-library.mjs && node --test scripts/test-huggingface-hub-routes.mjs && node --test scripts/test-chat-context.mjs && node --test scripts/test-thinking-level.mjs && node --test scripts/test-model-catalog.mjs && node --test scripts/test-title-generation.mjs scripts/test-follow-ups.mjs scripts/test-thinking-summary.mjs && node --test scripts/test-context-compaction.mjs && node --test scripts/test-chat-cancellation.mjs && node --test scripts/test-prompt-queue.mjs && node --test scripts/test-multi-model-compare.mjs && node --test scripts/test-chat-fork.mjs && node --test scripts/test-workspace-search.mjs && node --test scripts/test-rag-retrieval.mjs && node --test scripts/test-document-extractors.mjs && node --test scripts/test-media-extraction.mjs && node --test scripts/test-hybrid-retrieval.mjs && node --test scripts/test-chat-rest-responses.mjs && node --test scripts/test-deepseek-plugin.mjs scripts/test-meta-plugin.mjs scripts/test-bedrock-plugin.mjs && node --test scripts/test-plugin-endpoint-routing.mjs && node --test scripts/test-plugin-capability-routing.mjs && node --test scripts/test-plugin-usage-analytics.mjs && node --test scripts/test-cost-governance.mjs && node --test scripts/test-evaluations.mjs && node --test scripts/test-system-diagnostics.mjs && node --test scripts/test-openrouter-attribution.mjs && node --test scripts/test-openrouter-media-routing.mjs && node --test scripts/test-chat-provider-selection.mjs && node --test scripts/test-agent-cli-chat.mjs scripts/test-agent-cli-access.mjs && node --test scripts/test-strands-engine.mjs && node --test scripts/test-codex-oauth.mjs && node --test scripts/test-provider-api-modes.mjs && node --test scripts/test-plugin-variable-overrides.mjs && node --test scripts/test-plugin-model-refresh.mjs && node --test scripts/test-plugin-model-context.mjs && node --test scripts/test-stt-routing.mjs && node --test scripts/test-tts-routing.mjs && node --test scripts/test-voice-profiles-security.mjs && node --test scripts/test-image-generation-routing.mjs && node --test scripts/test-image-editing.mjs && node --test scripts/test-data-archive.mjs && node --test scripts/test-work-host-workspace.mjs && node --test scripts/test-work-runtime.mjs && node --test scripts/test-work-recovery.mjs && node --test scripts/test-work-runs.mjs && node --test scripts/test-work-access.mjs && node --test scripts/test-work-admin.mjs && node --test scripts/test-work-idle.mjs && node --test scripts/test-work-policies.mjs && node --test scripts/test-work-approvals.mjs && node --test scripts/test-work-delegation.mjs && node --test scripts/test-work-mcp.mjs && node --test scripts/test-work-kubernetes.mjs && node --test scripts/test-work-preview-proxy.mjs && node --test scripts/test-artifact-sandbox.mjs && node --test scripts/test-work-terminal.mjs && node --test scripts/test-work-provider.mjs && node --test scripts/test-work-agent-guidance.mjs && node --test scripts/test-work-agent-loop.mjs && node --test scripts/test-work-computer-live.mjs && node --test scripts/test-work-events.mjs && node --test scripts/test-work-egress.mjs && node --test scripts/test-work-agents.mjs && node --test scripts/test-package-layout.mjs && npm run test:package-install && node --test scripts/test-release-notes.mjs && node --test scripts/test-release-status.mjs && node --test scripts/test-docker-layout.mjs && node --test scripts/test-pr-quality-gates.mjs scripts/test-security-workflow.mjs && node --test scripts/test-homebrew-publishing.mjs && node --test scripts/test-forgejo-release-mirror.mjs",
35
+ "test:package": "node --test scripts/test-deprecated-dependencies.mjs && node --test scripts/test-typescript-toolchain.mjs && node --test scripts/test-helm-versioning.mjs && node --test scripts/test-helm-work.mjs && node --test scripts/test-tts-example-security.mjs && npm run test:unit --workspace=frontend && npm run build && node --test scripts/test-persistence-boundary.mjs scripts/test-persistence-contract.mjs scripts/test-schema-migrations.mjs scripts/test-postgres-persistence.mjs scripts/test-document-indexing-postgres.mjs && node --test scripts/test-platform-coordination.mjs scripts/test-platform-storage.mjs scripts/test-memory-reliability.mjs && npm run test:team-storage && node --test scripts/test-durable-jobs.mjs scripts/test-account-retirement.mjs scripts/test-integrated-backup.mjs scripts/test-team-backup.mjs && node --test scripts/test-health-probes.mjs scripts/test-recovery-inventory.mjs scripts/test-recovery-drills.mjs && node --test scripts/test-structured-logging.mjs scripts/test-opentelemetry.mjs && node --test scripts/test-webpage-fetch-security.mjs && node --test scripts/test-provider-fetch.mjs && node --test scripts/test-cors.mjs && node --test scripts/test-websocket-close-codes.mjs && node --test scripts/test-web-search.mjs && node --test scripts/test-content-resource-limits.mjs && node --test scripts/test-calendar.mjs && node --test scripts/test-calendar-team.mjs && node --test scripts/test-notes.mjs && node --test scripts/test-automation-schedule.mjs && node --test scripts/test-automations.mjs && node --test scripts/test-prompts.mjs scripts/test-skills.mjs && node --test scripts/test-resource-sharing.mjs && node --test scripts/test-channels.mjs && node --test scripts/test-notifications.mjs && node --test scripts/test-web-push.mjs && node --test scripts/test-smtp-client.mjs scripts/test-email-markdown.mjs scripts/test-email-notifications.mjs && node --test scripts/test-tool-gateway.mjs scripts/test-tool-approvals.mjs && node --test scripts/test-tool-oauth.mjs && node --test scripts/test-chat-tool-loop.mjs scripts/test-assistant-profiles.mjs && node --test scripts/test-registration-policy.mjs && node --test scripts/test-user-approval.mjs && node --test scripts/test-default-theme.mjs && node --test scripts/test-background-preferences.mjs && node --test scripts/test-default-model.mjs scripts/test-cli-args.mjs && node --test scripts/test-static-assets.mjs && node --test scripts/test-turnstile-auth.mjs && node --test scripts/test-oauth-security.mjs && node --test scripts/test-auth-sessions.mjs && node --test scripts/test-mfa.mjs && node --test scripts/test-api-tokens.mjs && node --test scripts/test-openai-compat.mjs && node --test scripts/test-authorization.mjs && node --test scripts/test-security-audit.mjs && node --test scripts/test-oidc-provider.mjs && node --test scripts/test-password-security.mjs && node --test scripts/test-live-deployment-security.mjs && node --test scripts/test-websocket-tickets.mjs && node --test scripts/test-capability-contracts.mjs scripts/test-global-capability-contracts.mjs && node --test scripts/test-ollama-model-defaults.mjs && node --test scripts/test-ollama-library.mjs && node --test scripts/test-huggingface-hub-routes.mjs && node --test scripts/test-chat-context.mjs && node --test scripts/test-thinking-level.mjs && node --test scripts/test-model-catalog.mjs && node --test scripts/test-title-generation.mjs scripts/test-follow-ups.mjs scripts/test-thinking-summary.mjs && node --test scripts/test-context-compaction.mjs && node --test scripts/test-chat-cancellation.mjs && node --test scripts/test-prompt-queue.mjs && node --test scripts/test-multi-model-compare.mjs && node --test scripts/test-chat-fork.mjs && node --test scripts/test-workspace-search.mjs && node --test scripts/test-rag-retrieval.mjs && node --test scripts/test-document-extractors.mjs && node --test scripts/test-media-extraction.mjs && node --test scripts/test-hybrid-retrieval.mjs && node --test scripts/test-chat-rest-responses.mjs && node --test scripts/test-deepseek-plugin.mjs scripts/test-meta-plugin.mjs scripts/test-modal-plugin.mjs scripts/test-baseten-plugin.mjs scripts/test-bedrock-plugin.mjs && node --test scripts/test-plugin-endpoint-routing.mjs && node --test scripts/test-plugin-capability-routing.mjs && node --test scripts/test-plugin-usage-analytics.mjs && node --test scripts/test-cost-governance.mjs && node --test scripts/test-evaluations.mjs && node --test scripts/test-system-diagnostics.mjs && node --test scripts/test-openrouter-attribution.mjs && node --test scripts/test-openrouter-media-routing.mjs && node --test scripts/test-chat-provider-selection.mjs && node --test scripts/test-agent-cli-chat.mjs scripts/test-agent-cli-access.mjs && node --test scripts/test-strands-engine.mjs && node --test scripts/test-codex-oauth.mjs && node --test scripts/test-provider-api-modes.mjs && node --test scripts/test-plugin-variable-overrides.mjs && node --test scripts/test-plugin-model-refresh.mjs && node --test scripts/test-plugin-model-context.mjs && node --test scripts/test-stt-routing.mjs && node --test scripts/test-tts-routing.mjs && node --test scripts/test-voice-profiles-security.mjs && node --test scripts/test-image-generation-routing.mjs && node --test scripts/test-image-editing.mjs && node --test scripts/test-data-archive.mjs && node --test scripts/test-work-host-workspace.mjs && node --test scripts/test-work-runtime.mjs && node --test scripts/test-work-recovery.mjs && node --test scripts/test-work-runs.mjs && node --test scripts/test-work-access.mjs && node --test scripts/test-work-admin.mjs && node --test scripts/test-work-idle.mjs && node --test scripts/test-work-policies.mjs && node --test scripts/test-work-approvals.mjs && node --test scripts/test-work-delegation.mjs && node --test scripts/test-work-mcp.mjs && node --test scripts/test-work-kubernetes.mjs && node --test scripts/test-work-preview-proxy.mjs && node --test scripts/test-artifact-sandbox.mjs && node --test scripts/test-work-terminal.mjs && node --test scripts/test-work-provider.mjs && node --test scripts/test-work-agent-guidance.mjs && node --test scripts/test-work-agent-loop.mjs && node --test scripts/test-work-computer-live.mjs && node --test scripts/test-work-events.mjs && node --test scripts/test-work-egress.mjs && node --test scripts/test-work-agents.mjs && node --test scripts/test-package-layout.mjs && npm run test:package-install && node --test scripts/test-release-notes.mjs && node --test scripts/test-release-status.mjs && node --test scripts/test-docker-layout.mjs && node --test scripts/test-pr-quality-gates.mjs scripts/test-security-workflow.mjs && node --test scripts/test-homebrew-publishing.mjs && node --test scripts/test-forgejo-release-mirror.mjs",
36
36
  "bench:work-computer": "node scripts/bench-work-computer.mjs",
37
37
  "test:team-storage": "node scripts/test-platform-storage-team-adapters.mjs && node scripts/test-sqlite-team-storage-migration.mjs",
38
38
  "test:team-platform": "node --test scripts/test-team-platform.mjs",
@@ -97,7 +97,7 @@
97
97
  "mermaid": {
98
98
  "katex": "^0.19.0"
99
99
  },
100
- "minimatch": ">=10.2.1",
100
+ "minimatch": "^11.0.8",
101
101
  "brace-expansion": "^5.0.9",
102
102
  "ip-address": "10.7.5",
103
103
  "js-yaml": "^4.3.2",
@@ -0,0 +1,68 @@
1
+ {
2
+ "id": "baseten",
3
+ "name": "Baseten",
4
+ "type": "completion",
5
+ "endpoint": "https://inference.baseten.co/v1/chat/completions",
6
+ "auth": {
7
+ "header": "Authorization",
8
+ "prefix": "Bearer ",
9
+ "key_env": "BASETEN_API_KEY"
10
+ },
11
+ "model_map": [
12
+ "zai-org/GLM-5.3",
13
+ "zai-org/GLM-5.3-Fast",
14
+ "zai-org/GLM-5.3-Flash",
15
+ "moonshotai/Kimi-K3",
16
+ "deepseek-ai/DeepSeek-V4-Pro-0813",
17
+ "deepseek-ai/DeepSeek-V4.1-Flash-1017",
18
+ "deepseek-ai/DeepSeek-V4.1-Flash",
19
+ "meta-models/muse-spark-open",
20
+ "nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B",
21
+ "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B",
22
+ "openai/gpt-oss-120b",
23
+ "reflection/Beam-1.0"
24
+ ],
25
+ "variables": [
26
+ {
27
+ "name": "endpoint",
28
+ "type": "string",
29
+ "label": "API Endpoint",
30
+ "description": "Override the default API endpoint URL, for example with a dedicated deployment's OpenAI-compatible URL followed by /chat/completions.",
31
+ "default": "https://inference.baseten.co/v1/chat/completions"
32
+ },
33
+ {
34
+ "name": "temperature",
35
+ "type": "number",
36
+ "label": "Temperature",
37
+ "description": "Controls randomness. Lower values are more focused, higher values more creative.",
38
+ "default": 0.7,
39
+ "min": 0,
40
+ "max": 2
41
+ },
42
+ {
43
+ "name": "max_tokens",
44
+ "type": "number",
45
+ "label": "Max Tokens",
46
+ "description": "Maximum number of tokens to generate, reasoning included.",
47
+ "default": 16384,
48
+ "min": 1,
49
+ "max": 384000
50
+ },
51
+ {
52
+ "name": "top_p",
53
+ "type": "number",
54
+ "label": "Top P",
55
+ "description": "Nucleus sampling. Lower values make output more focused.",
56
+ "default": 1,
57
+ "min": 0,
58
+ "max": 1
59
+ },
60
+ {
61
+ "name": "stream",
62
+ "type": "boolean",
63
+ "label": "Stream Response",
64
+ "description": "Stream the response token by token.",
65
+ "default": true
66
+ }
67
+ ]
68
+ }
@@ -12,6 +12,7 @@
12
12
  "model_map": [
13
13
  "gpt-6-astra",
14
14
  "gpt-6.1-sol",
15
+ "gpt-6.1-terra",
15
16
  "gpt-6-sol",
16
17
  "gpt-6-luna",
17
18
  "gpt-5.6-sol",
@@ -0,0 +1,82 @@
1
+ {
2
+ "id": "modal",
3
+ "name": "Modal",
4
+ "type": "completion",
5
+ "endpoint": "https://inference.us-west.modal.direct/v1/chat/completions",
6
+ "auth": {
7
+ "header": "Authorization",
8
+ "prefix": "Bearer ",
9
+ "key_env": "MODAL_PROXY_TOKEN"
10
+ },
11
+ "model_map": [
12
+ "moonshotai/Kimi-K3",
13
+ "zai-org/GLM-5.3",
14
+ "zai-org/GLM-5.3-Flash",
15
+ "nvidia/GLM-5.3-Flash-NVFP4",
16
+ "deepseek-ai/DeepSeek-V4.1-Flash",
17
+ "Qwen/Qwen3.8-2.4T-A95B",
18
+ "meta-models/Muse-Spark-Open-816B-A42B",
19
+ "thinkingmachines/Inkling-NVFP4"
20
+ ],
21
+ "variables": [
22
+ {
23
+ "name": "endpoint",
24
+ "type": "string",
25
+ "label": "API Endpoint",
26
+ "description": "Override the default API endpoint URL, for example with a Dedicated Endpoint's URL followed by /v1/chat/completions.",
27
+ "default": "https://inference.us-west.modal.direct/v1/chat/completions"
28
+ },
29
+ {
30
+ "name": "temperature",
31
+ "type": "number",
32
+ "label": "Temperature",
33
+ "description": "Controls randomness. Lower values are more focused, higher values more creative.",
34
+ "default": 0.7,
35
+ "min": 0,
36
+ "max": 2
37
+ },
38
+ {
39
+ "name": "max_tokens",
40
+ "type": "number",
41
+ "label": "Max Tokens",
42
+ "description": "Maximum number of tokens to generate, reasoning included.",
43
+ "default": 16384,
44
+ "min": 1,
45
+ "max": 384000
46
+ },
47
+ {
48
+ "name": "top_p",
49
+ "type": "number",
50
+ "label": "Top P",
51
+ "description": "Nucleus sampling. Lower values make output more focused.",
52
+ "default": 1,
53
+ "min": 0,
54
+ "max": 1
55
+ },
56
+ {
57
+ "name": "frequency_penalty",
58
+ "type": "number",
59
+ "label": "Frequency Penalty",
60
+ "description": "Reduces repetition of frequent tokens.",
61
+ "default": 0,
62
+ "min": -2,
63
+ "max": 2
64
+ },
65
+ {
66
+ "name": "presence_penalty",
67
+ "type": "number",
68
+ "label": "Presence Penalty",
69
+ "description": "Encourages the model to talk about new topics.",
70
+ "default": 0,
71
+ "min": -2,
72
+ "max": 2
73
+ },
74
+ {
75
+ "name": "stream",
76
+ "type": "boolean",
77
+ "label": "Stream Response",
78
+ "description": "Stream the response token by token.",
79
+ "default": true
80
+ }
81
+ ]
82
+ }
@@ -14,7 +14,8 @@
14
14
  "gpt-5.4",
15
15
  "gpt-5.4-mini",
16
16
  "gpt-5.4-nano",
17
- "gpt-5.5"
17
+ "gpt-5.5",
18
+ "gpt-6.1-terra"
18
19
  ],
19
20
  "capabilities": {
20
21
  "stt": {
@@ -228,6 +228,7 @@
228
228
  "openai/gpt-5.4-pro",
229
229
  "openai/gpt-5.5",
230
230
  "openai/gpt-5.5-pro",
231
+ "openai/gpt-6.1-terra",
231
232
  "openai/gpt-audio",
232
233
  "openai/gpt-audio-mini",
233
234
  "openai/gpt-chat-latest",