libre-webui 0.45.1 → 0.46.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 (197) hide show
  1. package/backend/dist/routes/work.js +1 -1
  2. package/backend/dist/routes/work.js.map +1 -1
  3. package/backend/dist/services/agentCliService.d.ts.map +1 -1
  4. package/backend/dist/services/agentCliService.js +2 -0
  5. package/backend/dist/services/agentCliService.js.map +1 -1
  6. package/backend/dist/services/dataArchiveService.d.ts.map +1 -1
  7. package/backend/dist/services/dataArchiveService.js +2 -0
  8. package/backend/dist/services/dataArchiveService.js.map +1 -1
  9. package/backend/dist/services/followUpService.d.ts.map +1 -1
  10. package/backend/dist/services/followUpService.js +11 -1
  11. package/backend/dist/services/followUpService.js.map +1 -1
  12. package/backend/dist/services/ollamaService.d.ts.map +1 -1
  13. package/backend/dist/services/ollamaService.js +2 -1
  14. package/backend/dist/services/ollamaService.js.map +1 -1
  15. package/backend/dist/services/pluginService.d.ts.map +1 -1
  16. package/backend/dist/services/pluginService.js +24 -10
  17. package/backend/dist/services/pluginService.js.map +1 -1
  18. package/backend/dist/services/preferencesService.d.ts.map +1 -1
  19. package/backend/dist/services/preferencesService.js +1 -0
  20. package/backend/dist/services/preferencesService.js.map +1 -1
  21. package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
  22. package/backend/dist/services/workModelProviderService.js +16 -134
  23. package/backend/dist/services/workModelProviderService.js.map +1 -1
  24. package/backend/dist/types/index.d.ts +4 -3
  25. package/backend/dist/types/index.d.ts.map +1 -1
  26. package/backend/dist/types/index.js.map +1 -1
  27. package/backend/dist/utils/geminiProtocol.d.ts +103 -0
  28. package/backend/dist/utils/geminiProtocol.d.ts.map +1 -0
  29. package/backend/dist/utils/geminiProtocol.js +586 -0
  30. package/backend/dist/utils/geminiProtocol.js.map +1 -0
  31. package/backend/dist/utils/openAIResponsesAdapter.d.ts +1 -1
  32. package/backend/dist/utils/openAIResponsesAdapter.d.ts.map +1 -1
  33. package/backend/dist/utils/pluginChatAdapter.d.ts +36 -12
  34. package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
  35. package/backend/dist/utils/pluginChatAdapter.js +121 -134
  36. package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
  37. package/backend/dist/utils/pluginDefinitionTrust.js +5 -5
  38. package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
  39. package/backend/dist/utils/pluginValidation.js +7 -0
  40. package/backend/dist/utils/pluginValidation.js.map +1 -1
  41. package/backend/dist/utils/thinkingOptions.d.ts +12 -1
  42. package/backend/dist/utils/thinkingOptions.d.ts.map +1 -1
  43. package/backend/dist/utils/thinkingOptions.js +10 -1
  44. package/backend/dist/utils/thinkingOptions.js.map +1 -1
  45. package/backend/package.json +2 -4
  46. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  47. package/frontend/dist/artifact-runtime/framer-motion.js +1 -1
  48. package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
  49. package/frontend/dist/artifact-runtime/recharts.js +54 -50
  50. package/frontend/dist/assets/index-CjeHi5JU.js +76 -0
  51. package/frontend/dist/assets/index-DyhvMw2T.css +2 -0
  52. package/frontend/dist/index.html +29 -29
  53. package/frontend/dist/js/{ArtifactContainer-BiGwAZkv.js → ArtifactContainer-BaacvZ8q.js} +1 -1
  54. package/frontend/dist/js/{ArtifactDemoPage-Dk6bf2fr.js → ArtifactDemoPage-D6pgt8_p.js} +1 -1
  55. package/frontend/dist/js/{ArtifactSandboxFrame-BMQXP8E8.js → ArtifactSandboxFrame-BqfRwsQa.js} +1 -1
  56. package/frontend/dist/js/{ArtifactSlideOutPanel-CNLSDJAJ.js → ArtifactSlideOutPanel-BUFb1QaC.js} +1 -1
  57. package/frontend/dist/js/{AutomationModal-VMrwN5y4.js → AutomationModal-a9rx93qd.js} +1 -1
  58. package/frontend/dist/js/AutomationsPage-Bhzy71Cq.js +1 -0
  59. package/frontend/dist/js/{AvatarUpload-DpeJzlyv.js → AvatarUpload-BHHUA-GH.js} +1 -1
  60. package/frontend/dist/js/{Button-D6d7HYoa.js → Button-DeV-GhQr.js} +1 -1
  61. package/frontend/dist/js/CalendarPage-DIlOEXA9.js +1 -0
  62. package/frontend/dist/js/ChannelsPage-BRVs-Kp-.js +1 -0
  63. package/frontend/dist/js/ChatPage-DqEa_l2u.js +14 -0
  64. package/frontend/dist/js/{ConnectModels-7E_zzkFc.js → ConnectModels-dimFaMkn.js} +1 -1
  65. package/frontend/dist/js/{EvaluationsPage-_jLiPYYc.js → EvaluationsPage-BKVxoUaS.js} +1 -1
  66. package/frontend/dist/js/{FirstTimeSetup-BzSil7F7.js → FirstTimeSetup-MLU3EUOv.js} +1 -1
  67. package/frontend/dist/js/{GalleryPage-CKpQMmd7.js → GalleryPage-BqhTNi2p.js} +1 -1
  68. package/frontend/dist/js/HomePage-B_HbAwgO.js +1 -0
  69. package/frontend/dist/js/LanguageSwitcher-gij6QsCJ.js +1 -0
  70. package/frontend/dist/js/{Logo-DhV6D_3q.js → Logo-BBRSG7mh.js} +1 -1
  71. package/frontend/dist/js/{LogoMark-CmF1lHXT.js → LogoMark-CiSslCTm.js} +1 -1
  72. package/frontend/dist/js/{ModelManagerModals-eAwih0CC.js → ModelManagerModals-CfcrXIm5.js} +1 -1
  73. package/frontend/dist/js/NotesPage-6qb7awMu.js +3 -0
  74. package/frontend/dist/js/{PasswordStrengthMeter-BwgYbk3r.js → PasswordStrengthMeter-MkydwQ8j.js} +1 -1
  75. package/frontend/dist/js/PersonasPage-KRnYk61s.js +13 -0
  76. package/frontend/dist/js/PluginUsagePage-Bm2WXYM5.js +1 -0
  77. package/frontend/dist/js/RichMessageContent-C5hmCcK6.js +3 -0
  78. package/frontend/dist/js/{RichMessageContent-BY1I7d9d.js → RichMessageContent-fyjhRYjT.js} +1 -1
  79. package/frontend/dist/js/SettingsModal-CgtaiEwd.js +19 -0
  80. package/frontend/dist/js/{SettingsToggle-CNUeo6DO.js → SettingsToggle-XpuugbHi.js} +1 -1
  81. package/frontend/dist/js/{ShareDialog-DgVAGGOp.js → ShareDialog-lkQnQmeI.js} +1 -1
  82. package/frontend/dist/js/{StrandsPage-9UVviZ58.js → StrandsPage-sPvcnqzA.js} +1 -1
  83. package/frontend/dist/js/{SystemPage-ChJ8O0MR.js → SystemPage-DwL4p4Rm.js} +1 -1
  84. package/frontend/dist/js/{UserManagementPage-BrogyZDQ.js → UserManagementPage-CzFDrqMr.js} +1 -1
  85. package/frontend/dist/js/{UserManagementPanel-CYuTltw4.js → UserManagementPanel-Dz8Q_Nv7.js} +1 -1
  86. package/frontend/dist/js/{WhatsNewModal-DyK_LXtM.js → WhatsNewModal-CSYCRxyb.js} +1 -1
  87. package/frontend/dist/js/WorkPage-zNqtL6D7.js +7 -0
  88. package/frontend/dist/js/{api-BPTwf2O4.js → api-B8EjExUU.js} +1 -1
  89. package/frontend/dist/js/api-CCDH67RO.js +1 -0
  90. package/frontend/dist/js/{appNavigation-DYXehtYu.js → appNavigation-C0lNX2LE.js} +1 -1
  91. package/frontend/dist/js/{appStore-C_SBNGJT.js → appStore-BEjqPvpR.js} +2 -2
  92. package/frontend/dist/js/appVersion-Dv97-qD1.js +1 -0
  93. package/frontend/dist/js/ar-BM7CvBiJ.js +2 -0
  94. package/frontend/dist/js/authStore-BNu5iRKd.js +1 -0
  95. package/frontend/dist/js/{authStore-Tu09JYbR.js → authStore-BOFcWqii.js} +3 -3
  96. package/frontend/dist/js/bn-DZgfamCo.js +2 -0
  97. package/frontend/dist/js/chatStore-C3c3r8iB.js +3 -0
  98. package/frontend/dist/js/{client-Czyqg89i.js → client-CQZUgw7R.js} +2 -2
  99. package/frontend/dist/js/{config-DWmMmE_t.js → config-Dz__g4tp.js} +1 -1
  100. package/frontend/dist/js/cs-Cx7EJqsO.js +2 -0
  101. package/frontend/dist/js/da-o3xyldjl.js +2 -0
  102. package/frontend/dist/js/de-DtSkfuOa.js +2 -0
  103. package/frontend/dist/js/decisionsApi-DJWWXd5m.js +1 -0
  104. package/frontend/dist/js/{decisionsApi-CftWDIPz.js → decisionsApi-DWyjcL8B.js} +1 -1
  105. package/frontend/dist/js/es-CNJDAw3s.js +2 -0
  106. package/frontend/dist/js/{evaluationsApi-C5DC-61t.js → evaluationsApi-BE2P4V0I.js} +1 -1
  107. package/frontend/dist/js/fr-BfkRYgQd.js +2 -0
  108. package/frontend/dist/js/hi-BKmbYlM1.js +2 -0
  109. package/frontend/dist/js/id-BeP0q360.js +2 -0
  110. package/frontend/dist/js/is-FNrpAg1Q.js +2 -0
  111. package/frontend/dist/js/it-C6LfJuro.js +2 -0
  112. package/frontend/dist/js/ja-VGke24PN.js +2 -0
  113. package/frontend/dist/js/ko-JnCzlETi.js +2 -0
  114. package/frontend/dist/js/{messageCodeStyles-DbG-nHEj.js → messageCodeStyles-QRyNUcEv.js} +2 -2
  115. package/frontend/dist/js/modelPresentation-BqdYlMRq.js +1 -0
  116. package/frontend/dist/js/ms-JF56ktSS.js +2 -0
  117. package/frontend/dist/js/nl-FzrGEt7O.js +2 -0
  118. package/frontend/dist/js/pl-C6EtLPmh.js +2 -0
  119. package/frontend/dist/js/pt-Clyy_Jz3.js +2 -0
  120. package/frontend/dist/js/router-vendor-ihzG-2y7.js +1 -0
  121. package/frontend/dist/js/ru-yG8TnHJE.js +2 -0
  122. package/frontend/dist/js/{strandsApi-c_sLVTzl.js → strandsApi-EFMF0J0x.js} +1 -1
  123. package/frontend/dist/js/sv-DSCl8r0m.js +2 -0
  124. package/frontend/dist/js/{teamEventStream-Bnna_p2v.js → teamEventStream-aQGd68I4.js} +1 -1
  125. package/frontend/dist/js/th-DiITM0tM.js +2 -0
  126. package/frontend/dist/js/tr-jQmrBMGA.js +2 -0
  127. package/frontend/dist/js/ui-CKcr9ReZ.js +2 -0
  128. package/frontend/dist/js/{ui-vendor-C7v9zeJX.js → ui-vendor-BanHlKMb.js} +1 -1
  129. package/frontend/dist/js/uk-rPc3yzsm.js +2 -0
  130. package/frontend/dist/js/{useChat-DGCDsOOs.js → useChat-DFozXoci.js} +1 -1
  131. package/frontend/dist/js/useDictation-D9lyoqUR.js +1 -0
  132. package/frontend/dist/js/useQuery-B-RslgPA.js +1 -0
  133. package/frontend/dist/js/useTranslation-Bu0AxynE.js +1 -0
  134. package/frontend/dist/js/utils-DhBboyBg.js +1 -0
  135. package/frontend/dist/js/utils-vendor-DpFrFwUi.js +1 -0
  136. package/frontend/dist/js/vi-wT4LDUXd.js +2 -0
  137. package/frontend/dist/js/{workApi-BTdJF6o5.js → workApi-C2R6IiSd.js} +1 -1
  138. package/frontend/dist/js/workApi-CNDPo0bG.js +1 -0
  139. package/frontend/dist/js/zh-CIASsxyC.js +2 -0
  140. package/package.json +5 -6
  141. package/plugins/codex-oauth.json +2 -0
  142. package/plugins/gemini.json +7 -1
  143. package/plugins/mlx-lm.json +5 -5
  144. package/plugins/openai.json +3 -1
  145. package/plugins/openrouter.json +2 -0
  146. package/frontend/dist/assets/index-FrFgrp5E.css +0 -2
  147. package/frontend/dist/assets/index-MveXWX7i.js +0 -15
  148. package/frontend/dist/js/AutomationsPage-wb5royf_.js +0 -1
  149. package/frontend/dist/js/CalendarPage-DeMdx8BD.js +0 -1
  150. package/frontend/dist/js/ChannelsPage-DJj_kG1m.js +0 -1
  151. package/frontend/dist/js/ChatPage-tJ5_eAbV.js +0 -14
  152. package/frontend/dist/js/HomePage-Dr8mrmo7.js +0 -1
  153. package/frontend/dist/js/LanguageSwitcher-BPwDwNez.js +0 -1
  154. package/frontend/dist/js/NotesPage-DDagHzg0.js +0 -3
  155. package/frontend/dist/js/PersonasPage-uFr0Yzes.js +0 -13
  156. package/frontend/dist/js/PluginUsagePage-BfIQuqIV.js +0 -1
  157. package/frontend/dist/js/RichMessageContent-otmciPPz.js +0 -3
  158. package/frontend/dist/js/SettingsModal-D2x0muLa.js +0 -19
  159. package/frontend/dist/js/WorkPage-CdfTyNv_.js +0 -7
  160. package/frontend/dist/js/api-Lutao9vm.js +0 -1
  161. package/frontend/dist/js/appVersion-C5-Afzj1.js +0 -1
  162. package/frontend/dist/js/ar-CMnK2iUi.js +0 -2
  163. package/frontend/dist/js/authStore-6cAmoXEk.js +0 -1
  164. package/frontend/dist/js/bn-B_6kDlG3.js +0 -2
  165. package/frontend/dist/js/chatStore-wi8VDo6B.js +0 -3
  166. package/frontend/dist/js/cs-DN4IeMBM.js +0 -2
  167. package/frontend/dist/js/da-Cx-BiRSz.js +0 -2
  168. package/frontend/dist/js/de-Cwlx8oC5.js +0 -2
  169. package/frontend/dist/js/decisionsApi-Dneh1e4n.js +0 -1
  170. package/frontend/dist/js/es-DGOk1LTg.js +0 -2
  171. package/frontend/dist/js/fr-DsjFEubC.js +0 -2
  172. package/frontend/dist/js/hi-YoyZTSWi.js +0 -2
  173. package/frontend/dist/js/id-D7ObCsR9.js +0 -2
  174. package/frontend/dist/js/is-DRfnKDHX.js +0 -2
  175. package/frontend/dist/js/it-Cb4C73dp.js +0 -2
  176. package/frontend/dist/js/ja-DsDfWEWn.js +0 -2
  177. package/frontend/dist/js/ko-J9IK9O8f.js +0 -2
  178. package/frontend/dist/js/modelPresentation-4QU9r-Pl.js +0 -1
  179. package/frontend/dist/js/ms-DVZBQWu-.js +0 -2
  180. package/frontend/dist/js/nl-CotrV0Lb.js +0 -2
  181. package/frontend/dist/js/pl-DlsgTT5q.js +0 -2
  182. package/frontend/dist/js/pt-B8F-CAdb.js +0 -2
  183. package/frontend/dist/js/router-vendor-DLHZHk4K.js +0 -1
  184. package/frontend/dist/js/ru-B7H_WJLM.js +0 -2
  185. package/frontend/dist/js/sv-iYQWY_4T.js +0 -2
  186. package/frontend/dist/js/th-BIlkYCg9.js +0 -2
  187. package/frontend/dist/js/tr-Cb0GxFvG.js +0 -2
  188. package/frontend/dist/js/ui-Byzdw4-Y.js +0 -2
  189. package/frontend/dist/js/uk-BH7Ojiob.js +0 -2
  190. package/frontend/dist/js/useDictation-BGys860H.js +0 -1
  191. package/frontend/dist/js/useQuery-Cs76KYuP.js +0 -1
  192. package/frontend/dist/js/useTranslation-CKqEdZ8j.js +0 -1
  193. package/frontend/dist/js/utils-BXRzbHJC.js +0 -1
  194. package/frontend/dist/js/utils-vendor-B4bGLP5p.js +0 -1
  195. package/frontend/dist/js/vi-BKN3n9CC.js +0 -2
  196. package/frontend/dist/js/workApi-DvXvzA8C.js +0 -1
  197. package/frontend/dist/js/zh-CbiVZpr_.js +0 -2
@@ -1 +0,0 @@
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-Cs76KYuP.js";import{d as a}from"./router-vendor-DLHZHk4K.js";import{t as o}from"./utils-BXRzbHJC.js";import{t as s}from"./useTranslation-CKqEdZ8j.js";import{g as c,s as l,t as u}from"./chatStore-wi8VDo6B.js";import{t as d}from"./logger-DAQsBb8I.js";import{$n as f,$t as p,An as m,Dn as h,Jt as g,K 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,sr as O,t as k,tt as ne,zn as re}from"./ui-vendor-C7v9zeJX.js";import{t as ie}from"./Button-D6d7HYoa.js";import"./ui-Byzdw4-Y.js";import{S as ae,g as oe,t as A,y as se}from"./api-BPTwf2O4.js";import{t as ce}from"./authStore-Tu09JYbR.js";import{a as j,c as M,o as le,s as N,t as ue}from"./modelPresentation-4QU9r-Pl.js";var P=e(t(),1),de=n(),fe=` · `,pe=`strands:plugin:`,me=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function he(e){return e.agentId||e.name.split(`:`)[0]||e.name}function ge(e){return/embed/i.test(e.name)?!0:[e.details?.family,...e.details?.families??[]].filter(e=>!!e).some(e=>/bert$/i.test(e))}function F(e){return!!(e.isAgent&&e.agentId&&e.name===e.agentId)}function _e(e,t){let n=e.find(F);if(n?.agentName)return n.agentName;for(let t of e){let e=t.agentName??``,n=e.indexOf(fe);if(n>0)return e.slice(0,n)}return t}function ve(e,t){let n=e.agentName||e.name;if(F(e))return{title:n,isDefault:!0};let r=`${t}${fe}`,i=n.startsWith(r)?n.slice(r.length):n,a;if(e.name.startsWith(pe)){let e=/^(.*\S)\s+\(([^()]+)\)$/.exec(i);e&&(i=e[1],a=e[2])}return{title:i,...a?{provider:a}:{},isDefault:!1}}function I(e,t){return[...e].sort((e,n)=>{let r=F(e);return r===F(n)?me.compare(t(e),t(n)):r?-1:1})}function ye(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=he(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)&&!ge(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:I(n,e=>e.name)});for(let[e,n]of s){let r=_e(n,e||t.agents);l.push({key:`agent:${e}`,kind:`agent`,label:r,models:I(n,e=>ve(e,r).title)})}return l.filter(e=>e.models.length>0)}function be(e){return e.toLowerCase().replace(/[\s\-_./:·()[\],]+/g,` `).trim()}function xe(e,t,n,r=``){let i=be(n).split(` `).filter(Boolean);if(i.length===0)return!0;let a=be([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 Se(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 Ce(e,t,n={}){if(e.length<=8)return{visible:e,hidden:0};let r;if(n.newestFirst){let t=e.filter(F),n=e.filter(e=>!F(e)).map((e,t)=>({model:e,index:t,rank:Se(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 we={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`},L={"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`},R=/^(?:hf\.co|huggingface\.co)\//i,z=/^(?:[a-z0-9-]+?--)?(?:ep-)?([a-z0-9][a-z0-9-]*?)(?:-server)?\.[a-z0-9-]+\.modal\.direct$/i,B=new Set([`gguf`]);function Te(e){let t=e.toLowerCase();return we[t]?we[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 V(e){let t=e.split(/[-_\s]+/).filter(Boolean),n=t.length>1?t.filter(e=>!B.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(Te(e))}return r.join(` `)||e}function Ee(e){let t=e.toLowerCase();return L[t]?L[t]:e===t?V(e):e}function De(e,t={}){let n=e.trim(),r=z.exec(n);if(r)return{name:V(r[1])};let i=n.startsWith(`~`),a=(i?n.slice(1):n).replace(R,``).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?Ee(a[a.length-2]):void 0;return{name:V(o),...l?{vendor:l}:{},...s?{tag:s}:{}}}function Oe(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 ke(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 H=r(),U=[`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 Ae(e){let t=0;for(let n of e.toLowerCase())t=t*31+n.charCodeAt(0)>>>0;return U[t%U.length]}function je({seed:e,size:t=`sm`,className:n}){let r=(/[\p{L}\p{N}]/u.exec(e)?.[0]??`?`).toUpperCase();return(0,H.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]`,Ae(e),n),children:r})}function W(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Me({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,H.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-200 dark:border-dark-300 shrink-0 space-y-2`,children:(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.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,H.jsx)(`option`,{value:`text-generation`,children:C(`modelManager.huggingface.taskTextGeneration`)}),(0,H.jsx)(`option`,{value:`text-to-speech`,children:C(`modelManager.huggingface.taskTextToSpeech`)}),(0,H.jsx)(`option`,{value:`text-to-image`,children:C(`modelManager.huggingface.taskTextToImage`)}),(0,H.jsx)(`option`,{value:`automatic-speech-recognition`,children:C(`modelManager.huggingface.taskSpeechRecognition`)})]}),(0,H.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,H.jsx)(`option`,{value:`downloads`,children:C(`modelManager.huggingface.sortDownloads`)}),(0,H.jsx)(`option`,{value:`likes`,children:C(`modelManager.huggingface.sortLikes`)}),(0,H.jsx)(`option`,{value:`lastModified`,children:C(`modelManager.huggingface.sortRecent`)})]})]})}),(0,H.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 scrollbar-thin`,children:[!n&&(0,H.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,H.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,H.jsx)(v,{className:`h-6 w-6 animate-spin text-gray-400`})}):i.length===0?(0,H.jsxs)(`div`,{className:`px-4 py-8 text-center text-gray-500 dark:text-gray-400`,children:[(0,H.jsx)(k,{className:`h-8 w-8 mx-auto mb-2 text-gray-300 dark:text-gray-600`}),(0,H.jsx)(`p`,{className:`text-sm`,children:C(`modelManager.huggingface.noModelsFound`)})]}):(0,H.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,H.jsxs)(`div`,{className:`bg-white dark:bg-dark-100`,children:[(0,H.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,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`div`,{className:`shrink-0 rounded-lg bg-yellow-500/20 p-2 dark:bg-yellow-900/30`,children:(0,H.jsx)(k,{className:`h-4 w-4 text-yellow-600 dark:text-yellow-400`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h4`,{dir:`ltr`,className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:e.id}),e.gated&&(0,H.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,H.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-0.5`,children:[`by `,e.author]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 mt-1.5 text-xs text-gray-400 dark:text-gray-500`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(m,{className:`h-3 w-3`}),W(e.downloads)]}),(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(ee,{className:`h-3 w-3`}),W(e.likes)]}),e.pipeline_tag&&(0,H.jsx)(`span`,{className:`px-1.5 py-0.5 rounded-sm bg-gray-100 dark:bg-dark-200`,children:e.pipeline_tag})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,H.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,H.jsx)(h,{className:`h-4 w-4 text-gray-400`})}),(0,H.jsx)(f,{className:o(`h-4 w-4 text-gray-400 transition-transform`,t&&`rotate-180`)})]})]})}),t&&(0,H.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,H.jsxs)(`div`,{className:`flex items-center justify-center py-4`,children:[(0,H.jsx)(v,{className:`h-4 w-4 animate-spin text-gray-400`}),(0,H.jsx)(`span`,{className:`ml-2 text-xs text-gray-500`,children:C(`modelManager.huggingface.checkingGguf`)})]}):r.length===0?(0,H.jsx)(`div`,{className:`py-4 text-center text-xs text-gray-500 dark:text-gray-400`,children:C(`modelManager.huggingface.noGgufAvailable`)}):(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.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,H.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,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-gray-800 dark:text-gray-200 truncate`,children:e.filename}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5 text-xs text-gray-500 dark:text-gray-400`,children:[(0,H.jsx)(`span`,{children:e.sizeFormatted}),e.quantization&&(0,H.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,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`text-xs text-gray-500 w-12 text-right`,children:d?.percent===void 0?`...`:`${d.percent}%`}),(0,H.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,H.jsx)(D,{className:`h-4 w-4`})})]}):n?(0,H.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,H.jsx)(m,{className:`h-3 w-3 inline mr-1`}),C(`models.pull`)]}):(0,H.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,H.jsx)(`div`,{className:`w-full bg-gray-200 dark:bg-dark-300 rounded-full h-1.5 overflow-hidden mt-2`,children:(0,H.jsx)(`div`,{className:`h-1.5 rounded-full bg-primary-500 transition-all duration-300`,style:{width:`${d.percent}%`}})})]})})]},e.id)})})]}),(0,H.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,H.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,H.jsx)(h,{className:`h-3 w-3`}),C(`modelManager.huggingface.browseAllLink`)]}),(0,H.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,H.jsx)(S,{className:o(`h-3.5 w-3.5 text-gray-400`,r&&`animate-spin`)})})]})]})}var Ne=`[data-testid="model-selector-option"], [data-testid="model-selector-show-all"]`;function Pe(e,t){if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let n=Array.from(e.currentTarget.querySelectorAll(Ne)),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 Fe({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,H.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-dark-400`,onKeyDown:e=>Pe(e,p),children:[e.length>0?e.map(e=>(0,H.jsxs)(`div`,{"data-testid":`model-selector-group`,children:[e.showHeader&&(0,H.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,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,H.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,H.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,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i(n),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,H.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,H.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}),n.isDecision&&(0,H.jsx)(`span`,{"data-testid":`model-selector-decision-badge`,className:`shrink-0 rounded-sm bg-primary-50 px-1 py-px text-[10px] leading-4 text-primary-700 dark:bg-primary-900/30 dark:text-primary-300`,children:m(`modelSelector.decisionBadge`)})]}),d&&(0,H.jsx)(`div`,{dir:`auto`,className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:d})]}),t===s&&(0,H.jsx)(te,{className:`h-4 w-4 text-primary-600 dark:text-primary-400 shrink-0`})]})},s)}),e.hidden>0&&(0,H.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,H.jsx)(`span`,{className:`truncate`,children:m(`modelSelector.showAll`,{total:e.total})}),(0,H.jsx)(w,{className:`h-3.5 w-3.5 shrink-0 rtl:rotate-180`})]})]},e.key)):(0,H.jsxs)(`div`,{className:`px-4 py-8 text-center text-gray-500 dark:text-gray-400`,children:[(0,H.jsx)(b,{className:`h-8 w-8 mx-auto mb-2 text-gray-300 dark:text-gray-600`}),(0,H.jsx)(`p`,{className:`text-sm`,children:m(`models.noModelsFound`)})]}),n&&(0,H.jsxs)(`div`,{className:`border-t border-gray-200 dark:border-dark-300`,children:[(0,H.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,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(ne,{className:`h-4 w-4 text-blue-600 dark:text-blue-400`}),m(`modelSelector.actions`)]})}),(0,H.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,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(g,{className:`h-4 w-4 text-blue-600 dark:text-blue-400`}),(0,H.jsxs)(`div`,{className:`flex-1`,children:[(0,H.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:m(`gallery.generate`)}),(0,H.jsx)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:m(`gallery.generateDescription`)})]})]})})]})]})}function Ie({sources:e,active:t,onChange:n}){let{t:r}=s(),i=(0,P.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,H.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,H.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,H.jsx)(`span`,{className:`whitespace-nowrap`,children:e.label}),(0,H.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 Le({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,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-200 dark:border-dark-300 shrink-0`,children:(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,H.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:ue(e,_)},e))})}),(0,H.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 scrollbar-thin`,children:[!n&&(0,H.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,H.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,H.jsx)(v,{className:`h-6 w-6 animate-spin text-gray-400`})}):i.length===0?(0,H.jsxs)(`div`,{className:`px-4 py-8 text-center text-gray-500 dark:text-gray-400`,children:[(0,H.jsx)(re,{className:`h-8 w-8 mx-auto mb-2 text-gray-300 dark:text-gray-600`}),(0,H.jsx)(`p`,{className:`text-sm`,children:_(`models.noModelsFound`)})]}):(0,H.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,H.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,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`div`,{className:`p-2 rounded-lg bg-blue-100 dark:bg-blue-900/30 shrink-0`,children:(0,H.jsx)(re,{className:`h-4 w-4 text-blue-600 dark:text-blue-400`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h4`,{dir:`ltr`,className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:e.name}),t&&(0,H.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,H.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,H.jsx)(re,{className:`h-3 w-3`}),`Cloud`]})]}),(0,H.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 line-clamp-1 mt-0.5`,children:e.description}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[e.sizes.slice(0,3).map(e=>(0,H.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,H.jsxs)(`span`,{className:`text-xs text-gray-400 dark:text-gray-500 flex items-center gap-1`,children:[(0,H.jsx)(m,{className:`h-3 w-3`}),e.pulls]})]})]}),(0,H.jsx)(`div`,{className:`shrink-0`,children:r?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`text-xs text-gray-500 w-12 text-right`,children:c?.percent===void 0?`...`:`${c.percent}%`}),(0,H.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,H.jsx)(D,{className:`h-4 w-4`})})]}):t?(0,H.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,H.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,H.jsx)(m,{className:`h-3 w-3 inline mr-1`}),_(`modelSelector.pull`)]}):(0,H.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,H.jsx)(`div`,{className:`mt-2 w-full bg-gray-200 dark:bg-dark-300 rounded-full h-1.5 overflow-hidden`,children:(0,H.jsx)(`div`,{className:`h-1.5 rounded-full bg-primary-500 transition-all duration-300`,style:{width:`${c.percent}%`}})})]},e.name)})})]}),(0,H.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,H.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,H.jsx)(h,{className:`h-3 w-3`}),_(`modelManager.huggingface.browseAllLink`)]}),(0,H.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,H.jsx)(S,{className:o(`h-3.5 w-3.5 text-gray-400`,r&&`animate-spin`)})})]})]})}var Re=d(`components:model-selector`),ze=({models:e,selectedModel:t,onModelChange:n,currentPersona:r,className:d,disabled:m=!1,compact:h=!1,showImageGen:g=!1,onModelsRefresh:v,getModelValue:b,getModelId:S,getModelLabel:w,getModelTitle:ee,triggerRef:te,triggerTestId:ne,selectTestId:ie,ariaLabel:A})=>{let{t:j}=s(),[M,le]=(0,P.useState)(!1),[N,ue]=(0,P.useState)(``),[fe,pe]=(0,P.useState)(`installed`),[me,he]=(0,P.useState)(`all`),ge=(0,P.useRef)(null),F=(0,P.useRef)(null),_e=(0,P.useRef)(null),I=(0,P.useRef)(null),be=a(),{user:Se,systemInfo:we}=ce(),L=Se?.role===`admin`||we?.requiresAuth===!1,R=we?.ollamaEnabled!==!1,z=R?fe:`installed`,[B,Te]=(0,P.useState)(`all`),[V,Ee]=(0,P.useState)(``),[U,Ae]=(0,P.useState)(`text-generation`),[W,Ne]=(0,P.useState)(`downloads`),[Pe,ze]=(0,P.useState)(``),[Be,G]=(0,P.useState)(null),[Ve,He]=(0,P.useState)({}),[Ue,We]=(0,P.useState)(null),[K,q]=(0,P.useState)(null),[Ge,J]=(0,P.useState)(null),[Ke,Y]=(0,P.useState)(null),qe=[`all`,`general`,`coding`,`reasoning`,`vision`,`embedding`,`decision`,`cloud`],Je=(0,P.useMemo)(()=>ye(e,{legacy:j(`modelSelector.providerNotRecorded`,`Provider not recorded`),unavailable:j(`modelSelector.unavailableSelections`,`Unavailable selections`),personas:j(`modelSelector.personas`),ollama:`Ollama`,plugins:j(`modelSelector.pluginModels`),agents:j(`modelSelector.agentModels`,`Agents`)}),[e,j]),Ye=e=>{let t=`h-4 w-4 shrink-0 text-gray-500 dark:text-dark-600`;switch(e.kind){case`legacy`:return(0,H.jsx)(O,{className:t});case`unavailable`:return(0,H.jsx)(D,{className:t});case`personas`:return(0,H.jsx)(T,{className:t});case`agent`:return(0,H.jsx)(C,{className:t});default:return(0,H.jsx)(je,{seed:e.label})}},X=e=>b?.(e)??e.name,Xe=e=>De(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,P.useImperativeHandle)(te,()=>_e.current);let Q=(0,P.useCallback)((e=!0)=>{le(!1),ue(``),e&&window.requestAnimationFrame(()=>_e.current?.focus())},[]),nt=B===`cloud`||B===`decision`?B:`all`,{data:rt=[],isLoading:it,refetch:at}=i({queryKey:[`ollama-library-selector`,V,nt],queryFn:async()=>{let e=await se.getLibraryModels({search:V||void 0,sort:`popular`,category:nt===`all`?void 0:nt});return e.success&&e.data?e.data:[]},enabled:M&&z===`ollama`}),{data:ot=[],isLoading:st,refetch:ct}=i({queryKey:[`hf-models-selector`,U,Pe,W],queryFn:async()=>{let e=await ae.getModels({task:U,search:Pe||void 0,sort:W,limit:30});return e.success&&e.data?e.data:[]},enabled:M&&z===`huggingface`}),lt=rt.filter(e=>{let t=!N||e.name.toLowerCase().includes(N.toLowerCase())||e.description.toLowerCase().includes(N.toLowerCase()),n=B===`all`||e.category===B;return t&&n}),ut=(0,P.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){Re.error(`Failed to load GGUF files:`,e)}finally{We(null)}}},[]),dt=(0,P.useCallback)(e=>{Be===e?G(null):(G(e),Ve[e]||ut(e))},[Be,Ve,ut]),ft=(0,P.useCallback)((e,t)=>{if(!L)x.error(j(`modelSelector.pullRestricted`));else if(!K){q(e),J({status:`starting`});try{let n=se.pullModelStream(e,e=>{J(e)},()=>{J(null),q(null),Y(null),x.success(j(`modelDownload.success`,{name:t})),v?.()},e=>{J(null),q(null),Y(null),x.error(j(`modelDownload.failed`,{error:e}))});Y(()=>n)}catch{J(null),q(null),x.error(j(`modelDownload.startFailed`))}}},[L,v,K,j]);(0,P.useEffect)(()=>{let e=setTimeout(()=>{z===`huggingface`?ze(N):z===`ollama`&&Ee(N)},300);return()=>clearTimeout(e)},[N,z]),(0,P.useEffect)(()=>{if(!M)return;let e=e=>{if(e.key===`Escape`)e.preventDefault(),Q();else if(e.key===`Tab`&&F.current){let t=Array.from(F.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,M]),(0,P.useEffect)(()=>{M&&I.current&&I.current.focus()},[M]);let pt=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(),!R)n({target:{value:i}});else{try{let e=await se.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 se.unloadAllModels())}}catch(e){Re.warn(`Failed to unload models before switch:`,e)}n({target:{value:i}})}},mt=async e=>{if(!L)x.error(j(`modelSelector.pullRestricted`));else if(!K){q(e),J({status:`starting`});try{let t=se.pullModelStream(e,e=>{J(e)},()=>{J(null),q(null),Y(null),x.success(j(`modelDownload.success`,{name:e})),v?.()},e=>{J(null),q(null),Y(null),x.error(j(`modelDownload.failed`,{error:e}))});Y(()=>t)}catch{J(null),q(null),x.error(j(`modelDownload.startFailed`))}}},ht=()=>{Ke&&(Ke(),Y(null),q(null),J(null),x.success(j(`modelDownload.cancelled`)))},gt=t=>e.some(e=>c(e)&&(e.name===t||e.name.startsWith(t+`:`))),_t=(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,H.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,H.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?O:e.isPersona?T:C,i=(0,H.jsx)(r,{className:`h-4 w-4 shrink-0 text-gray-500 dark:text-dark-600`});return t===`md`?(0,H.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,H.jsx)(je,{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} (${j(`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} (${j(`modelSelector.unavailable`,`unavailable`)})`:e.agentName||e.name;let n=Ze(e);return e.isUnavailable?`${n} (${j(`modelSelector.unavailable`,`unavailable`)})`:n},vt=e=>e.isLegacySelection?e.isUnavailable?j(`modelSelector.providerUnavailable`,`provider unavailable`):j(`modelSelector.reselectProvider`,`reselect a provider to pin this model`):e.isPersona?j(`modelSelector.via`,{provider:e.model}):e.isAgent&&e.isUnavailable?e.unavailableReason??j(`modelSelector.unavailable`,`unavailable`):e.isPlugin?e.isUnavailable?`${j(`modelSelector.via`,{provider:e.pluginName||e.pluginId})} · ${j(`modelSelector.providerUnavailable`,`provider unavailable`)}`:j(`modelSelector.via`,{provider:e.pluginName}):e.isUnavailable?j(`modelSelector.providerUnavailable`,`provider unavailable`):null,yt=e=>e.kind===`plugin`||e.kind===`ollama`,bt=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}:{}}},xt=e=>!!Qe[l(e)]?.label,St=(e,t)=>w||xt(e)?$(e):yt(t)?bt(e).name:t.kind===`agent`?ve(e,t.label).title:$(e),Ct=(e,t)=>!yt(t)||w||xt(e)?null:bt(e).tag??null,wt=(e,t)=>{if(t.kind===`agent`){let n=ve(e,t.label);return n.isDefault?j(`modelSelector.defaultModel`):n.provider?j(`modelSelector.via`,{provider:n.provider}):null}if(!yt(t))return vt(e);let n=bt(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?j(`modelSelector.contextSize`,{size:Oe(e.contextLength),defaultValue:`{{size}} context`}):void 0,e.isPlugin||i?void 0:ke(e.size)].filter(e=>!!e);return a.length>0?a.join(` · `):null},Tt=e=>X(e)===t,Et=Je.map(e=>({source:e,matches:e.models.filter(t=>xe(t,e,N,$(t)))})),Dt=Je.length>1,Ot=Dt&&Je.some(e=>e.key===me)?me:`all`,kt=Ot===`all`,At=Et.filter(({source:e})=>kt||e.key===Ot).map(({source:e,matches:t})=>{let n=kt&&Dt?Ce(t,Tt,{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:kt}}).filter(e=>e.models.length>0),jt=Et.map(({source:e,matches:t})=>({key:e.key,label:e.label,count:t.length}));return(0,H.jsxs)(`div`,{className:o(`relative min-w-0`,d),ref:ge,children:[(0,H.jsxs)(`button`,{ref:_e,"data-testid":ne,type:`button`,onClick:()=>!m&&le(!M),disabled:m,"aria-haspopup":`dialog`,"aria-expanded":M,"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):j(`modelSelector.selectModel`):void 0,children:[(()=>{if(!Z)return h?(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,H.jsx)(E,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate text-xs font-medium text-ink-subtle`,children:j(`modelSelector.selectModel`)})]}):j(`modelSelector.selectModel`);if(h){let e=$(Z);return(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`shrink-0`,children:_t(Z)}),(0,H.jsx)(`span`,{dir:Z.isPersona?`auto`:`ltr`,className:`truncate text-xs font-medium text-ink`,children:e})]})}let e=$(Z),t=vt(Z);return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[_t(Z),(0,H.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,H.jsx)(`span`,{dir:Z.isPersona?`auto`:`ltr`,className:`text-sm font-medium truncate`,children:e}),t&&(0,H.jsx)(`span`,{dir:`auto`,className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:t})]}),Z.isPersona&&r&&(0,H.jsxs)(`div`,{className:`flex items-center gap-1 ms-auto`,children:[(0,H.jsx)(O,{className:`h-3 w-3 text-gray-500 dark:text-dark-600`}),r.embedding_model&&(0,H.jsx)(y,{className:`h-3 w-3 text-gray-400 dark:text-dark-500`})]})]})})(),(0,H.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`,M&&`rotate-180`)})]}),M&&(0,de.createPortal)((0,H.jsxs)(`div`,{className:`fixed inset-0 z-999999 flex items-center justify-center p-3 sm:p-6`,children:[(0,H.jsx)(`div`,{className:`absolute inset-0 bg-gray-950/55 backdrop-blur-md`,onClick:()=>Q()}),(0,H.jsxs)(`div`,{ref:F,role:`dialog`,"aria-modal":`true`,"aria-label":j(`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,H.jsxs)(`div`,{className:`shrink-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between px-4 pb-2 pt-4 sm:px-5 sm:pt-5`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-medium tracking-tight text-gray-950 dark:text-dark-950 rtl:tracking-normal`,children:j(`modelSelector.selectModel`)}),(0,H.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:j(`common.close`),"aria-label":j(`common.close`),children:(0,H.jsx)(D,{className:`h-4 w-4`})})]}),(0,H.jsx)(`div`,{className:`px-4 pb-3 sm:px-5`,children:(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(_,{className:`absolute inset-s-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,H.jsx)(`input`,{ref:I,type:`text`,placeholder:j(z===`installed`?R?`modelSelector.searchInstalled`:`modelSelector.searchModels`:z===`ollama`?`modelSelector.searchOllama`:`modelSelector.searchHuggingFace`),value:N,onChange:e=>ue(e.target.value),onKeyDown:e=>{if(z!==`installed`)return;let t=F.current?.querySelector(`[data-testid="model-selector-option"]`);e.key===`ArrowDown`&&t?(e.preventDefault(),t.focus()):e.key===`Enter`&&N.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`)})]})}),R&&(0,H.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,H.jsxs)(`button`,{onClick:()=>{pe(`installed`)},className:o(`flex-1 rounded-lg px-2 py-2 text-xs font-medium transition-colors sm:px-4`,z===`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":z===`installed`,children:[(0,H.jsx)(p,{className:`h-4 w-4 inline me-1.5`}),j(`modelSelector.installed`)]}),(0,H.jsxs)(`button`,{onClick:()=>{pe(`ollama`)},className:o(`flex-1 rounded-lg px-2 py-2 text-xs font-medium transition-colors sm:px-4`,z===`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":z===`ollama`,children:[(0,H.jsx)(re,{className:`h-4 w-4 inline me-1.5`}),`Ollama`]}),(0,H.jsxs)(`button`,{onClick:()=>{pe(`huggingface`)},className:o(`flex-1 rounded-lg px-2 py-2 text-xs font-medium transition-colors sm:px-4`,z===`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":z===`huggingface`,children:[(0,H.jsx)(k,{className:`h-4 w-4 inline me-1.5`}),`HuggingFace`]})]}),z===`installed`&&Dt&&(0,H.jsx)(Ie,{sources:jt,active:Ot,onChange:he})]}),z===`installed`&&(0,H.jsx)(Fe,{groups:At,selectedModel:t,showImageGen:g&&kt,getModelValue:X,getModelIcon:e=>_t(e,`md`),getModelLabel:St,getModelTag:Ct,getModelSubLabel:wt,onExitTop:()=>I.current?.focus(),onModelSelect:pt,onShowAll:e=>{he(e),I.current?.focus()},onOpenGallery:()=>{Q(!1),be(`/gallery`)}},Ot),z===`ollama`&&(0,H.jsx)(Le,{libraryCategories:qe,libraryCategory:B,canInstallModels:L,loadingLibrary:it,filteredLibraryModels:lt,pullingModel:K,pullProgress:Ge,setLibraryCategory:Te,isModelInstalled:gt,onModelSelect:pt,onPullModel:mt,onCancelPull:ht,onRefreshLibrary:()=>{at()}}),z===`huggingface`&&(0,H.jsx)(Me,{hfTask:U,hfSort:W,canInstallModels:L,loadingHf:st,hfModels:ot,expandedHfModel:Be,hfGgufFiles:Ve,loadingGguf:Ue,pullingModel:K,pullProgress:Ge,setHfTask:Ae,setHfSort:Ne,onToggleHfModel:dt,onPullHfGguf:ft,onCancelPull:ht,onRefreshHfModels:()=>{ct()}})]})]}),document.body),(0,H.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,H.jsx)(`option`,{value:X(e),children:$(e)},`${e.isLegacySelection?`legacy`:e.isPersona?`persona`:e.isPlugin?`plugin`:`ollama`}:${e.pluginId||``}:${X(e)}`))})]})},Be=({value:e,inheritedValue:t,onChange:n})=>{let{t:r}=s(),[i,a]=(0,P.useState)(!1),c=(0,P.useRef)(null),l=e??t,u=le(l),d=N(l),f=N(e),p=t==null?void 0:N(t),m=(0,P.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,P.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,P.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,H.jsxs)(`div`,{ref:c,className:`relative shrink-0`,children:[(0,H.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,H.jsx)(O,{className:`h-4 w-4`}),u&&(0,H.jsx)(`span`,{className:`text-[11px] font-medium`,children:r(`settings.generation.thinkingLevels.${d}`)})]}),i&&(0,H.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,H.jsx)(`p`,{className:`mb-1 px-2 pt-1 text-[11px] font-medium text-ink-muted`,children:r(`chat.controls.thinking`)}),j.map(e=>{let t=e===f;return(0,H.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,H.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,H.jsx)(te,{className:`h-3.5 w-3.5 shrink-0`})]},e)})]})]})},G=d(`hooks:dictation`),Ve=()=>{if(typeof window>`u`)return;let e=window;return e.SpeechRecognition||e.webkitSpeechRecognition},He=[{mimeType:`audio/webm;codecs=opus`,format:`webm`}],Ue=300,We=.25,K=e=>`${encodeURIComponent(e.plugin)}:${encodeURIComponent(e.model)}`;function q(e){if(typeof MediaRecorder>`u`)return;let t=new Set((e.config?.formats||[]).map(e=>e.toLowerCase()));return He.find(e=>(t.size===0||t.has(e.format))&&(typeof MediaRecorder.isTypeSupported!=`function`||MediaRecorder.isTypeSupported(e.mimeType)))?.mimeType}function Ge({onStart:e,onText:t,ownerKey:n}){let{t:r,i18n:i}=s(),[a,o]=(0,P.useState)(`idle`),[c,l]=(0,P.useState)([]),u=(0,P.useRef)(null),d=(0,P.useRef)(null),f=(0,P.useRef)(null),p=(0,P.useRef)(null),m=(0,P.useRef)(null),h=(0,P.useRef)(0),g=(0,P.useRef)(`idle`),_=(0,P.useRef)(void 0),v=(0,P.useRef)(e),y=(0,P.useRef)(t);(0,P.useEffect)(()=>{v.current=e,y.current=t},[e,t]),(0,P.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,P.useMemo)(()=>typeof window<`u`&&window.isSecureContext&&typeof navigator<`u`&&!!navigator.mediaDevices&&!!Ve(),[]),S=typeof window<`u`&&window.isSecureContext&&typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia,C=(0,P.useMemo)(()=>[...b?[{key:`browser`,kind:`browser`}]:[],...S?c.filter(e=>!!q(e)).map(e=>({key:K(e),kind:`provider`,model:e})):[]],[b,S,c]),[w,ee]=(0,P.useState)(``),T=(0,P.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,P.useCallback)(()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]),O=(0,P.useCallback)(e=>{g.current=e,o(e)},[]),k=(0,P.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,P.useEffect)(()=>(_.current=n,k),[k,n]),{supported:te,phase:a,toggle:(0,P.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=q(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,Ue):Ue;m.current=window.setTimeout(()=>{h.current===e&&o.state===`recording`&&o.stop()},Math.max(.1,l-We)*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=Ve();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{Be as n,ze as r,Ge as t};
@@ -1 +0,0 @@
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=i?.error===f?i.errorUpdatedAt: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 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t}from"./react-vendor-C1iE8mnY.js";import{p as n,u as r}from"./utils-BXRzbHJC.js";var i=e(t()),a=(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)},o=new WeakMap,s=new Set,c=(e,t,n,r)=>{if(m(n)){let t=s,r=e?.services?.logger||e;if(h(r)&&(t=o.get(r),t||o.set(r,t=new Set)),t.has(n))return;t.add(n)}a(e,t,n,r)},l=()=>{try{return!1}catch{return!1}},u=(e,t)=>()=>{e.isInitialized?t():e.once(`initialized`,()=>t())},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?(c(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=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,_={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":`\xA0`,"&#160;":`\xA0`,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},v=e=>_[e],y={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:e=>e.replace(g,v),transDefaultProps:void 0},b=()=>y,x=(0,i.createContext)(),S=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},C=(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},w=e=>`${e.language}|${e.resolvedLanguage}|${e.languages?.join(`,`)}`,T=e=>new Proxy(e,{get:(e,t)=>t===`__original`?e:Reflect.get(e,t)}),E={t:C,ready:!1},D=()=>()=>{},O=(e,{bindI18n:t,bindI18nStore:n},r)=>(t&&e.on(t,r),n&&e.store.on(n,r),()=>{t&&e.off(t,r),n&&e.store.off(n,r)}),k=(e,t={})=>{let{i18n:a}=t,{i18n:o,defaultNS:s}=(0,i.useContext)(x)||{},u=a||o||r();u&&!u.reportNamespaces&&(u.reportNamespaces=new S),u||c(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,i.useMemo)(()=>({...b(),...u?.options?.react,...t}),[u,t]),{useSuspense:g,keyPrefix:_,bindI18n:v,bindI18nStore:y}=h,C=e||s||u?.options?.defaultNS,k=m(C)?[C]:C||[`translation`],A=JSON.stringify(k),j=(0,i.useMemo)(()=>k,[A]);u?.reportNamespaces?.addUsedNamespaces?.(j);let M=(0,i.useRef)(0),N=(0,i.useCallback)(e=>u?O(u,{bindI18n:v,bindI18nStore:y},()=>{M.current+=1,e()}):D,[u,v,y]),P=(0,i.useRef)(),F=(0,i.useCallback)(()=>{if(!u)return E;let e=!!(u.isInitialized||u.initializedStoreOnce)&&j.every(e=>p(e,u,h)),r=t.lng||u.language,i=M.current,a=typeof _==`function`?n(_,{...u.options,ns:j}):_,o=P.current;if(o&&o.i18n===u&&o.ready===e&&o.lng===r&&o.namespaces===j&&o.keyPrefix===a&&o.revision===i)return o;let s={t:u.getFixedT(r,h.nsMode===`fallback`?j:j[0],_,{scopeNs:j}),i18n:u,ready:e,lng:r,namespaces:j,keyPrefix:a,revision:i};return P.current=s,s},[u,j,_,h,t.lng]),[I,L]=(0,i.useState)(0),{t:R,ready:z}=(0,i.useSyncExternalStore)(N,F,F),B;u&&g&&!z&&(B=new Promise(e=>{let n=()=>e();t.lng?f(u,t.lng,j,n):d(u,j,n)}),{t:R,ready:z}=F()),(0,i.useEffect)(()=>{if(u&&!z&&!g){let e=()=>L(e=>e+1);t.lng?f(u,t.lng,j,e):d(u,j,e)}},[u,t.lng,j,z,g,I]);let V=u||{},H=(0,i.useRef)(null),U=(0,i.useMemo)(()=>{let e=V,t=w(e);(H.current?.original!==e||H.current.lang!==t)&&(H.current={original:e,lang:t,wrapper:T(e)});let n=H.current.wrapper,r=!z&&!g?(...e)=>(c(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.`),R(...e)):R,i=[r,n,z];return i.t=r,i.i18n=n,i.ready=z,i},[R,V,z,V.resolvedLanguage,V.language,V.languages]);if(u&&g&&!z)throw l()&&c(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`),B;return U};export{k as t};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./utils-vendor-B4bGLP5p.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;`},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]||!n)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=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=new D,k=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)})}},A=new WeakSet,j=(e,...t)=>{if(t.some(e=>!n(e)))throw TypeError(`${e}: pass language, namespace${e===`addResource`?` and key`:``} as separate strings; the dotted form ('en.translation.key') was removed in i18next v27`)},M=class extends k{constructor(e,t={ns:[`translation`],defaultNS:`translation`},n=O){super(),this.data=e||{},this.options=t,this.logger=n.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)}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,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||!o||!n(r)?c:w(this.data?.[e]?.[t],r,a)}addResource(e,t,n,r,i={silent:!1}){j(`addResource`,e,t,n);let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),this.addNamespaces(t),f(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){j(`addResources`,e,t),Object.keys(n||{}).forEach(r=>{r!==`__proto__`&&r!==`constructor`&&this.addResource(e,t,r,n[r],{silent:!0})}),r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){j(`addResourceBundle`,e,t);let o=[e,t];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 A.has(n)?!0:!n||Object.keys(n).length===0?!1:(typeof n==`object`&&A.add(n),!0)})}toJSON(){return this.data}},N=Symbol(`i18next/PATH_KEY`);function ee(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===N?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function P(e,t){let{[N]: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 F=e=>!n(e)&&typeof e!=`boolean`&&typeof e!=`number`,I=class e extends k{constructor(e,t={}){super(),s([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`,`postProcessors`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=(e.logger||O).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=F(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=P(t,{...this.options,...a})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?P(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=this.options.pluralSeparator,D=T&&a[`defaultValue${E}zero`]||a[`defaultValue${C}`]||a[`defaultValue${w}`]||(a.defaultValue??(x?a[`defaultValue${a.ordinal?`${E}ordinal${E}`:E}other`]:void 0)),O=h;b&&!h&&S&&(O=D);let k=F(O),A=Object.prototype.toString.apply(O),j=b&&O&&k&&!v.includes(A)&&!(n(y)&&Array.isArray(O)),M=j&&!a.returnObjects&&!this.options.returnObjects;if(M&&this.options.returnedObjectHandler){let e=this.options.returnedObjectHandler(g,O,{...a,ns:l});return o?(m.res=e,m.usedParams=this.getUsedParamsDetails(a),m):e}if(M&&this.logger.warn(`accessing an object - but returnObjects options is not enabled!`),j&&!M){if(s){let e=Array.isArray(O),t=e?[]:{},n=e?_:g;for(let e in O)if(Object.prototype.hasOwnProperty.call(O,e)){let r=`${n}${s}${e}`;t[e]=S&&!h?this.translate(r,{...a,defaultValue:F(D)?D[e]:void 0,joinArrays:!1,ns:l}):this.translate(r,{...a,joinArrays:!1,ns:l}),t[e]===r&&(t[e]=O[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;M&&(h=void 0),!this.isValidLookup(h)&&S&&!(M&&F(D))&&(e=!0,h=D),!this.isValidLookup(h)&&!(e&&h===``)&&(n=!0,h=c);let r=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:h,o=S&&D!==h&&this.options.updateMissing;if(!M&&(n||e||o)){if(this.logger.log(o?`updateKey`:`missingKey`,f,u,x&&!o?`${c}${this.pluralResolver.getSuffix(f,a.count,a)}`:c,o?D: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}`]||D)})}):n(e,c,D))}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.includes(this.interpolator.nestingPrefixText)?e.match(this.interpolator.nestingRegexp):null;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.includes(this.interpolator.nestingPrefixText)?e.match(this.interpolator.nestingRegexp):null,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;if(e!=null&&s?.length&&r.applyPostProcessor!==!1){let n=this.options?.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r;s.forEach(r=>{let i=this.postProcessors?.[r];i?e=i.process(e,t,n,this)??e:this.logger.once(`postProcess:${r}`,`warn`,`postProcess: '${r}' is not registered on this i18next instance; call use() with it on this instance`)})}return 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`?P(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))}if(d){let n=`${t.ordinal?a:this.options.pluralSeparator}other`;e!==n&&(p&&i.unshift(`${l}${this.options.contextSeparator||`_`}${t.context}${n}`),i.unshift(l+n))}}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}},L=class{constructor(e,t=O){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=t.create(`languageUtils`),this.resolveHierarchyCache={},this.formattedCodes=new Map}clearCache(){this.resolveHierarchyCache={},this.formattedCodes.clear()}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))return e;let t=this.formattedCodes.get(e);return t===void 0&&(t=this.formatUncached(e),this.formattedCodes.size>=1e3&&this.formattedCodes.clear(),this.formattedCodes.set(e,t)),t}formatUncached(e){let t=e.includes(`-`);if(t||this.options.cleanCode!==!1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}if(n&&(t||n.toLowerCase()===e.toLowerCase()))return this.options.lowerCaseLng?n.toLowerCase():n;if(n)return e.toLowerCase()}return this.options.lowerCaseLng||this.options.cleanCode&&!t?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!(!e.includes(`-`)||r.includes(`-`)||e.slice(0,e.indexOf(`-`))!==r))}),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())}},R={zero:0,one:1,two:2,few:3,many:4,other:5},z={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},te=class{constructor(e,t={},n=O){this.languageUtils=e,this.options=t,this.logger=n.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!`),z;if(!e.match(/-|_/))return z;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)=>R[e]-R[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))}},B=(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},V=class{constructor(e={},t=O){this.logger=t.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,suffix:a,formatSeparator:o,unescapeSuffix:s,unescapePrefix:c,nestingPrefix:l,nestingSuffix:u,nestingOptionsSeparator:d,maxReplaces:f,alwaysFormat:p}=e.interpolation;this.escape=t===void 0?y:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?_(i):`{{`,this.suffix=a?_(a):`}}`,this.formatSeparator=o||`,`,this.unescapePrefix=s?``:c?_(c):`-`,this.unescapeSuffix=this.unescapePrefix?``:s?_(s):``,this.prefixText=i||`{{`,this.nestingPrefixText=l||`$t(`,this.nestingPrefix=_(l||`$t(`),this.nestingSuffix=_(u||`)`),this.nestingOptionsSeparator=d||`,`,this.maxReplaces=f||1e3,this.alwaysFormat=p!==void 0&&p,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=B(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(B(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;if(n(e)&&!e.includes(this.prefixText))return e;let m=[{regex:this.regexpUnescape,safeValue:e=>e},{regex:this.regexp,safeValue:e=>this.escapeValue?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};if(n(e)&&!e.includes(this.nestingPrefixText))return e;let 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}},re=1e3,H=e=>{let t=new Map;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.get(o);return s||(s=e(T(r),i),t.size>=re&&t.delete(t.keys().next().value),t.set(o,s)),s(n)}},ie=e=>(t,n,r)=>e(T(n),r)(t),ae=class{constructor(e={}){this.logger=O.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){e?.logger?.create&&(this.logger=e.logger.create(`formatter`)),this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?H:ie;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()]=H(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)}},oe=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},se=class extends k{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=(n.logger||O).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),oe(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)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{},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){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)}}},U=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:!1,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:!1,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}),W=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),G=()=>{},ce=e=>{let t=U(),n={...t,...e};return n.interpolation={...t.interpolation,...e.interpolation},typeof n.overloadTranslationOptionHandler!=`function`&&(n.overloadTranslationOptionHandler=t.overloadTranslationOptionHandler),n},K=e=>{let t=[].concat(e.supportedLngs||[],e.preload||[]);t.push(...Object.keys(e.resources||{}));let r=e.fallbackLng;return n(r)||Array.isArray(r)?t.push(...[].concat(r)):r&&typeof r==`object`&&Object.keys(r).forEach(e=>{e!=="default"&&t.push(e),t.push(...[].concat(r[e]))}),t},q=(e,t)=>!n(t)||a(t)||e.configuredLngs?.has(t)?!1:(e.logger.once(`lng:${t}`,`warn`,`refused the language code '${t.slice(0,64)}' from lng, changeLanguage(), the language detector or loadLanguages(): it is not configured and has other characters than letters, digits, '-', '_', '@' and '.' (or '..', or more than 128). List it in supportedLngs to use it`),!0),le=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},J=class e extends k{constructor(e={},t){if(super(),this.userOptions=W(e),this.options=ce(this.userOptions),this.services={postProcessors:Object.create(null)},this.logger=new D(null,this.options),this.modules={external:[]},le(this),t&&!this.isInitialized&&!e.isClone){if(!this.userOptions.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])),W(e);let i={...this.userOptions,...e};this.options=ce({...this.options,...e}),i.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=i.keySeparator),i.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=i.nsSeparator),this.options.isClone||(this.configuredLngs=new Set([...this.configuredLngs||[],...K(i)]));let a=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.logger.init(a(this.modules.logger),this.options);let{logger:e}=this;this.pendingWarnings?.forEach(e=>this.logger.warn(e)),this.pendingWarnings=void 0;let t;t=this.modules.formatter?this.modules.formatter:ae;let n=new L(this.options,e);this.store=new M(this.options.resources,this.options,e);let r=this.services;r.logger=e,r.resourceStore=this.store,r.languageUtils=n,r.pluralResolver=new te(n,{prepend:this.options.pluralSeparator},e),t&&(r.formatter=a(t),r.formatter.init&&r.formatter.init(r,this.options),this.options.interpolation.format=r.formatter.format.bind(r.formatter)),r.interpolator=new V(this.options,e),r.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this),reloadResources:this.reloadResources.bind(this)},r.backendConnector=new se(a(this.modules.backend),r.resourceStore,r,this.options),r.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(r.languageDetector=a(this.modules.languageDetector),r.languageDetector.init&&r.languageDetector.init(r,this.options.detection,this.options),r.languageDetector.async&&o(r.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&&(r.i18nFormat=a(this.modules.i18nFormat),r.i18nFormat.init&&r.i18nFormat.init(this)),this.translator=new I(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||=G,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 s=r(),c=()=>{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),s.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?c():setTimeout(c,0),s}loadResources(e,t=G){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||=G,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`&&(this.services.postProcessors[e.name]=e),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 a=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},s=(n,r)=>{r?this.isLanguageChangingTo===e&&(a(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))},c=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let{supportedLngs:r}=this.options;if(t&&!r){let e=[].concat(t).filter(e=>!q(this,e));e.length<[].concat(t).length&&(t=e)}let i=n(t)?t:t&&t[0],o=this.store.hasLanguageSomeTranslations(i)?i:this.services.languageUtils.getBestMatchFromCodes(n(t)?[t]:t);r&&q(this,o)&&(o=this.services.languageUtils.getBestMatchFromCodes([])),o&&(this.language||a(o),this.translator.language||this.translator.changeLanguage(o),this.services.languageDetector?.cacheUserLanguage?.(o)),this.loadResources(o,e=>{s(e,o)})};if(!e&&this.services.languageDetector&&!this.services.languageDetector.async)c(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(c):this.services.languageDetector.detect(c)}else c(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=P(i.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return i.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=P(e,c)),`${i.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=P(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||!this.services.backendConnector?(t&&t(),Promise.resolve()):(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)}loadLanguages(e,t){let i=r();n(e)&&(e=[e]);let a=this.options.preload||[],o=e.filter(e=>!a.includes(e)&&!q(this,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 L(U());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=G){let r=t.forkResourceStore;r&&(t={...t},delete t.forkResourceStore);let i={...this.options,preload:!1,...t,isClone:!0},a=new e(i);if(a.logger=t.debug!==void 0||t.prefix!==void 0?this.logger.clone(t):this.logger,[`store`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.postProcessors=Object.create(this.services.postProcessors),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 M(e(this.store.data),i,this.logger),a.services.resourceStore=a.store}if(t.interpolation){let e={...U().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new V(n,this.logger)}return a.configuredLngs=new Set([...this.configuredLngs||[],...K(t)]),a.translator=new I(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();J.createInstance,J.dir,J.init,J.loadResources,J.reloadResources,J.use,J.changeLanguage,J.getFixedT,J.t,J.exists,J.setDefaultNamespace,J.hasLoadedNamespace,J.loadNamespaces,J.loadLanguages;var Y,ue=e=>{Y=e},de=()=>Y;function fe(...n){return t(e(n))}function pe(){return typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)}var X=new Map,Z=new Map,Q=e=>{let t=X.get(e);return t||(t=new Intl.RelativeTimeFormat(e,{numeric:`auto`,style:`narrow`}),X.set(e,t)),t},$=e=>{let t=Z.get(e);return t||(t=new Intl.DateTimeFormat(e),Z.set(e,t)),t};function me(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`:$(t).format(n);let s=Q(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`):$(t).format(n)}function he(e,t=`en`,n=Date.now()){let r=Math.round((e-n)/1e3),i=Math.abs(r),a=Q(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 ge(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(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 ve(){return _e(11)+Date.now().toString(36)}function ye(e,t){return e.length<=t?e:e.substring(0,t)+`...`}function be(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{ve as a,_e as c,ue as d,J as f,me as i,ye as l,ge as n,pe as o,P as p,he as r,be as s,fe as t,de as u};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t}from"./react-vendor-C1iE8mnY.js";function n(e){var t,r,i=``;if(typeof e==`string`||typeof e==`number`)i+=e;else if(typeof e==`object`){if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=n(e[t]))&&(i&&(i+=` `),i+=r)}else for(r in e)e[r]&&(i&&(i+=` `),i+=r)}return i}function r(){for(var e,t,r=0,i=``,a=arguments.length;r<a;r++)(e=arguments[r])&&(t=n(e))&&(i&&(i+=` `),i+=t);return i}var i=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},a=(e,t)=>({classGroupId:e,validator:t}),o=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),s=`-`,c=[],l=`arbitrary..`,u=e=>{let t=p(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return f(e);let n=e.split(s);return d(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],a=n[e];return t?a?i(a,t):t:a||c}return n[e]||c}}},d=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=d(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(s):e.slice(t).join(s),c=a.length;for(let e=0;e<c;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},f=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?l+r:void 0})(),p=e=>{let{theme:t,classGroups:n}=e;return m(n,t)},m=(e,t)=>{let n=o();for(let r in e){let i=e[r];h(i,n,r,t)}return n},h=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];g(i,t,n,r)}},g=(e,t,n,r)=>{typeof e==`string`?_(e,t,n):typeof e==`function`?ee(e,t,n,r):v(e,t,n,r)},_=(e,t,n)=>{let r=e===``?t:y(t,e);r.classGroupId=n},ee=(e,t,n,r)=>{b(e)?h(e(r),t,n,r):(t.validators===null&&(t.validators=[]),t.validators.push(a(n,e)))},v=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];h(o,y(t,a),n,r)}},y=(e,t)=>{let n=e,r=t.split(s),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=o(),n.nextPart.set(t,i)),n=i}return n},b=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,x=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},S=`!`,C=`:`,w=[],te=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),ne=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===C){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(S)?(c=s.slice(0,-1),l=!0):s.startsWith(S)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return te(t,l,c,u)};if(t){let e=t+C,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):te(w,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},T=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},re=e=>({cache:x(e.cacheSize),parseClassName:ne(e),sortModifiers:T(e),postfixLookupClassGroupIds:E(e),...u(e)}),E=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},D=/\s+/,O=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(D),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h||(g=r(p),!g)){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),ee=f?_+S:_,v=ee+g;if(s.indexOf(v)>-1)continue;s.push(v);let y=i(g,h);for(let e=0;e<y.length;++e){let t=y[e];s.push(ee+t)}l=t+(l.length>0?` `+l:l)}return l},k=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=A(n))&&(i&&(i+=` `),i+=r);return i},A=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=A(e[r]))&&(n&&(n+=` `),n+=t);return n},j=(e,...t)=>{let n,r,i,a,o=o=>(n=re(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=O(e,n);return i(e,a),a};return a=o,(...e)=>a(k(...e))},M=[],N=e=>{let t=t=>t[e]||M;return t.isThemeGetter=!0,t.themeKey=e,t},P=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,F=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ie=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,I=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,L=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,R=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,z=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ae=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,B=e=>ie.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),H=e=>!!e&&Number.isInteger(Number(e)),oe=e=>e.endsWith(`%`)&&V(e.slice(0,-1)),U=e=>I.test(e),se=()=>!0,W=e=>L.test(e)&&!R.test(e),G=()=>!1,K=e=>z.test(e),q=e=>ae.test(e),ce=e=>!J(e)&&!X(e),le=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),ue=e=>Q(e,Te,G),J=e=>P.test(e),Y=e=>Q(e,Ee,W),de=e=>Q(e,De,V),fe=e=>Q(e,ke,se),pe=e=>Q(e,Oe,G),me=e=>Q(e,Ce,G),he=e=>Q(e,we,q),ge=e=>Q(e,Ae,K),X=e=>F.test(e),Z=e=>$(e,Ee),_e=e=>$(e,Oe),ve=e=>$(e,Ce),ye=e=>$(e,Te),be=e=>$(e,we),xe=e=>$(e,Ae,!0),Se=e=>$(e,ke,!0),Q=(e,t,n)=>{let r=P.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},$=(e,t,n=!1)=>{let r=F.exec(e);return r?r[1]?t(r[1]):n:!1},Ce=e=>e===`position`||e===`percentage`,we=e=>e===`image`||e===`url`,Te=e=>e===`length`||e===`size`||e===`bg-size`,Ee=e=>e===`length`,De=e=>e===`number`,Oe=e=>e===`family-name`,ke=e=>e===`number`||e===`weight`,Ae=e=>e===`shadow`,je=j(()=>{let e=N(`color`),t=N(`font`),n=N(`text`),r=N(`font-weight`),i=N(`tracking`),a=N(`leading`),o=N(`breakpoint`),s=N(`container`),c=N(`spacing`),l=N(`radius`),u=N(`shadow`),d=N(`inset-shadow`),f=N(`text-shadow`),p=N(`drop-shadow`),m=N(`blur`),h=N(`perspective`),g=N(`aspect`),_=N(`ease`),ee=N(`animate`),v=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],y=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],b=()=>[...y(),X,J],x=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],S=()=>[`auto`,`contain`,`none`],C=()=>[X,J,c],w=()=>[B,`full`,`auto`,...C()],te=()=>[H,`none`,`subgrid`,X,J],ne=()=>[`auto`,{span:[`full`,H,X,J]},H,X,J],T=()=>[H,`auto`,X,J],re=()=>[`auto`,`min`,`max`,`fr`,X,J],E=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],D=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],O=()=>[`auto`,...C()],k=()=>[B,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...C()],A=()=>[s,B,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...C()],j=()=>[B,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...C()],M=()=>[e,X,J],P=()=>[...y(),ve,me,{position:[X,J]}],F=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ie=()=>[`auto`,`cover`,`contain`,ye,ue,{size:[X,J]}],I=()=>[oe,Z,Y],L=()=>[``,`none`,`full`,l,X,J],R=()=>[``,V,Z,Y],z=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],W=()=>[V,oe,ve,me],G=()=>[``,`none`,m,X,J],K=()=>[`none`,V,X,J],q=()=>[`none`,V,X,J],Q=()=>[V,X,J],$=()=>[B,`full`,...C()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[U],breakpoint:[U],color:[se],container:[U],"drop-shadow":[U],ease:[`in`,`out`,`in-out`],font:[ce],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[U],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[U],shadow:[U],spacing:[`px`,V],text:[U],"text-shadow":[U],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,B,J,X,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,X,J]}],"container-named":[le],columns:[{columns:[V,`auto`,J,X,s]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:b()}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{"inset-s":w(),start:w()}],end:[{"inset-e":w(),end:w()}],"inset-bs":[{"inset-bs":w()}],"inset-be":[{"inset-be":w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[H,`auto`,X,J]}],basis:[{basis:[B,`full`,`auto`,s,...C()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[V,B,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,V,X,J]}],shrink:[{shrink:[``,V,X,J]}],order:[{order:[H,`first`,`last`,`none`,X,J]}],"grid-cols":[{"grid-cols":te()}],"col-start-end":[{col:ne()}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":te()}],"row-start-end":[{row:ne()}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...E(),`normal`]}],"justify-items":[{"justify-items":[...D(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...D()]}],"align-content":[{content:[`normal`,...E()]}],"align-items":[{items:[...D(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...D(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...D(),`baseline`]}],"place-self":[{"place-self":[`auto`,...D()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":C()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":C()}],"space-y-reverse":[`space-y-reverse`],size:[{size:k()}],"inline-size":[{inline:[`auto`,...A()]}],"min-inline-size":[{"min-inline":[`auto`,...A()]}],"max-inline-size":[{"max-inline":[`none`,...A()]}],"block-size":[{block:[`auto`,...j()]}],"min-block-size":[{"min-block":[`auto`,...j()]}],"max-block-size":[{"max-block":[`none`,...j()]}],w:[{w:[s,`screen`,...k()]}],"min-w":[{"min-w":[s,`screen`,`none`,...k()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...k()]}],h:[{h:[`screen`,`lh`,...k()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...k()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...k()]}],"font-size":[{text:[`base`,n,Z,Y]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Se,fe]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,oe,J]}],"font-family":[{font:[_e,pe,t]}],"font-features":[{"font-features":[J]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,X,J]}],"line-clamp":[{"line-clamp":[V,`none`,X,de]}],leading:[{leading:[`none`,a,...C()]}],"list-image":[{"list-image":[`none`,X,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,X,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...z(),`wavy`]}],"text-decoration-thickness":[{decoration:[V,`from-font`,`auto`,X,Y]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[V,`auto`,X,J]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:C()}],"tab-size":[{tab:[H,X,J]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,X,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,X,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},H,X,J],radial:[``,X,J],conic:[``,H,X,J]},be,he]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":R()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...z(),`hidden`,`none`]}],"divide-style":[{divide:[...z(),`hidden`,`none`]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...z(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[V,X,J]}],"outline-w":[{outline:[``,V,Z,Y]}],"outline-color":[{outline:M()}],shadow:[{shadow:[``,`inner`,`none`,u,xe,ge]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":[`none`,d,xe,ge]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[V,Y]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":[`none`,f,xe,ge]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[V,X,J]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[X,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":y()}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,X,J]}],filter:[{filter:[``,`none`,X,J]}],blur:[{blur:G()}],brightness:[{brightness:[V,X,J]}],contrast:[{contrast:[V,X,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,xe,ge]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:[``,V,X,J]}],"hue-rotate":[{"hue-rotate":[V,X,J]}],invert:[{invert:[``,V,X,J]}],saturate:[{saturate:[V,X,J]}],sepia:[{sepia:[``,V,X,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,X,J]}],"backdrop-blur":[{"backdrop-blur":G()}],"backdrop-brightness":[{"backdrop-brightness":[V,X,J]}],"backdrop-contrast":[{"backdrop-contrast":[V,X,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,V,X,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,X,J]}],"backdrop-invert":[{"backdrop-invert":[``,V,X,J]}],"backdrop-opacity":[{"backdrop-opacity":[V,X,J]}],"backdrop-saturate":[{"backdrop-saturate":[V,X,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,V,X,J]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,X,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[V,`initial`,X,J]}],ease:[{ease:[`linear`,`initial`,_,X,J]}],delay:[{delay:[V,X,J]}],animate:[{animate:[`none`,ee,X,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,X,J]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:q()}],"scale-x":[{"scale-x":q()}],"scale-y":[{"scale-y":q()}],"scale-z":[{"scale-z":q()}],"scale-3d":[`scale-3d`],skew:[{skew:Q()}],"skew-x":[{"skew-x":Q()}],"skew-y":[{"skew-y":Q()}],transform:[{transform:[X,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:$()}],"translate-x":[{"translate-x":$()}],"translate-y":[{"translate-y":$()}],"translate-z":[{"translate-z":$()}],"translate-none":[`translate-none`],zoom:[{zoom:[H,X,J]}],accent:[{accent:M()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,X,J]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,X,J]}],fill:[{fill:[`none`,...M()]}],"stroke-w":[{stroke:[V,Z,Y,de]}],stroke:[{stroke:[`none`,...M()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}}),Me=e(t(),1),Ne=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Pe=(e=>e?Ne(e):Ne),Fe=e=>e;function Ie(e,t=Fe){let n=Me.useSyncExternalStore(e.subscribe,Me.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return Me.useDebugValue(n),n}var Le=e=>{let t=Pe(e),n=e=>Ie(t,e);return Object.assign(n,t),n},Re=(e=>e?Le(e):Le);function ze(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return Be(i)?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var Be=e=>typeof e?.then==`function`,Ve=e=>({then(t){return t?He(t)(e):this}}),He=e=>t=>{try{let n=e(t);return Be(n)?n:Ve(n)}catch(e){return{then(t,n){return n?He(n)(e):this}}}},Ue=(e,t)=>(n,r,i)=>{let a={storage:ze(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(...e)=>(f(...e),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return He(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return Be(t)?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).then(()=>void 0,n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>{try{return Promise.resolve(h())}catch(e){return Promise.reject(e)}},hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p};export{r as i,Re as n,je as r,Ue as t};