libre-webui 0.45.2 → 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 (155) hide show
  1. package/backend/dist/services/agentCliService.d.ts.map +1 -1
  2. package/backend/dist/services/agentCliService.js +2 -0
  3. package/backend/dist/services/agentCliService.js.map +1 -1
  4. package/backend/dist/services/dataArchiveService.d.ts.map +1 -1
  5. package/backend/dist/services/dataArchiveService.js +2 -0
  6. package/backend/dist/services/dataArchiveService.js.map +1 -1
  7. package/backend/dist/services/followUpService.d.ts.map +1 -1
  8. package/backend/dist/services/followUpService.js +11 -1
  9. package/backend/dist/services/followUpService.js.map +1 -1
  10. package/backend/dist/services/preferencesService.d.ts.map +1 -1
  11. package/backend/dist/services/preferencesService.js +1 -0
  12. package/backend/dist/services/preferencesService.js.map +1 -1
  13. package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
  14. package/backend/dist/services/workModelProviderService.js +4 -4
  15. package/backend/dist/services/workModelProviderService.js.map +1 -1
  16. package/backend/dist/types/index.d.ts +1 -0
  17. package/backend/dist/types/index.d.ts.map +1 -1
  18. package/backend/dist/types/index.js.map +1 -1
  19. package/backend/dist/utils/geminiProtocol.d.ts.map +1 -1
  20. package/backend/dist/utils/geminiProtocol.js +6 -2
  21. package/backend/dist/utils/geminiProtocol.js.map +1 -1
  22. package/backend/dist/utils/pluginChatAdapter.d.ts +23 -1
  23. package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
  24. package/backend/dist/utils/pluginChatAdapter.js +61 -9
  25. package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
  26. package/backend/dist/utils/pluginDefinitionTrust.js +5 -5
  27. package/backend/package.json +2 -4
  28. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  29. package/frontend/dist/artifact-runtime/framer-motion.js +1 -1
  30. package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
  31. package/frontend/dist/artifact-runtime/recharts.js +54 -50
  32. package/frontend/dist/assets/index-CjeHi5JU.js +76 -0
  33. package/frontend/dist/assets/index-DyhvMw2T.css +2 -0
  34. package/frontend/dist/index.html +29 -29
  35. package/frontend/dist/js/{ArtifactContainer-CFVJv-mM.js → ArtifactContainer-BaacvZ8q.js} +1 -1
  36. package/frontend/dist/js/{ArtifactDemoPage-DH0FzsNI.js → ArtifactDemoPage-D6pgt8_p.js} +1 -1
  37. package/frontend/dist/js/{ArtifactSandboxFrame-WnLSNpGj.js → ArtifactSandboxFrame-BqfRwsQa.js} +1 -1
  38. package/frontend/dist/js/{ArtifactSlideOutPanel-ASrltUrj.js → ArtifactSlideOutPanel-BUFb1QaC.js} +1 -1
  39. package/frontend/dist/js/{AutomationModal-CyKk0tlC.js → AutomationModal-a9rx93qd.js} +1 -1
  40. package/frontend/dist/js/AutomationsPage-Bhzy71Cq.js +1 -0
  41. package/frontend/dist/js/{AvatarUpload-CndjrKep.js → AvatarUpload-BHHUA-GH.js} +1 -1
  42. package/frontend/dist/js/{Button-D6d7HYoa.js → Button-DeV-GhQr.js} +1 -1
  43. package/frontend/dist/js/CalendarPage-DIlOEXA9.js +1 -0
  44. package/frontend/dist/js/ChannelsPage-BRVs-Kp-.js +1 -0
  45. package/frontend/dist/js/ChatPage-DqEa_l2u.js +14 -0
  46. package/frontend/dist/js/{ConnectModels-BNmJfvfw.js → ConnectModels-dimFaMkn.js} +1 -1
  47. package/frontend/dist/js/{EvaluationsPage-Duxm4ft2.js → EvaluationsPage-BKVxoUaS.js} +1 -1
  48. package/frontend/dist/js/{FirstTimeSetup-BZ4pQGa_.js → FirstTimeSetup-MLU3EUOv.js} +1 -1
  49. package/frontend/dist/js/{GalleryPage-BD_mUDta.js → GalleryPage-BqhTNi2p.js} +1 -1
  50. package/frontend/dist/js/HomePage-B_HbAwgO.js +1 -0
  51. package/frontend/dist/js/LanguageSwitcher-gij6QsCJ.js +1 -0
  52. package/frontend/dist/js/{Logo-DhV6D_3q.js → Logo-BBRSG7mh.js} +1 -1
  53. package/frontend/dist/js/{LogoMark-CmF1lHXT.js → LogoMark-CiSslCTm.js} +1 -1
  54. package/frontend/dist/js/{ModelManagerModals-BjLwU-MI.js → ModelManagerModals-CfcrXIm5.js} +1 -1
  55. package/frontend/dist/js/NotesPage-6qb7awMu.js +3 -0
  56. package/frontend/dist/js/{PasswordStrengthMeter-Cvrt6Q9S.js → PasswordStrengthMeter-MkydwQ8j.js} +1 -1
  57. package/frontend/dist/js/PersonasPage-KRnYk61s.js +13 -0
  58. package/frontend/dist/js/PluginUsagePage-Bm2WXYM5.js +1 -0
  59. package/frontend/dist/js/RichMessageContent-C5hmCcK6.js +3 -0
  60. package/frontend/dist/js/{RichMessageContent-BTq5fi2Q.js → RichMessageContent-fyjhRYjT.js} +1 -1
  61. package/frontend/dist/js/SettingsModal-CgtaiEwd.js +19 -0
  62. package/frontend/dist/js/{SettingsToggle-CNUeo6DO.js → SettingsToggle-XpuugbHi.js} +1 -1
  63. package/frontend/dist/js/{ShareDialog-JrPQi4_S.js → ShareDialog-lkQnQmeI.js} +1 -1
  64. package/frontend/dist/js/{StrandsPage-CG4rywyz.js → StrandsPage-sPvcnqzA.js} +1 -1
  65. package/frontend/dist/js/{SystemPage-DSHe65ZO.js → SystemPage-DwL4p4Rm.js} +1 -1
  66. package/frontend/dist/js/{UserManagementPage-BrogyZDQ.js → UserManagementPage-CzFDrqMr.js} +1 -1
  67. package/frontend/dist/js/{UserManagementPanel-B5p2mcC9.js → UserManagementPanel-Dz8Q_Nv7.js} +1 -1
  68. package/frontend/dist/js/{WhatsNewModal-CeHAg8Uz.js → WhatsNewModal-CSYCRxyb.js} +1 -1
  69. package/frontend/dist/js/WorkPage-zNqtL6D7.js +7 -0
  70. package/frontend/dist/js/{api-R43sAAC-.js → api-B8EjExUU.js} +1 -1
  71. package/frontend/dist/js/api-CCDH67RO.js +1 -0
  72. package/frontend/dist/js/{appNavigation-C59KQTgx.js → appNavigation-C0lNX2LE.js} +1 -1
  73. package/frontend/dist/js/{appStore-DDxf13l_.js → appStore-BEjqPvpR.js} +2 -2
  74. package/frontend/dist/js/appVersion-Dv97-qD1.js +1 -0
  75. package/frontend/dist/js/{ar-Cq-76la4.js → ar-BM7CvBiJ.js} +1 -1
  76. package/frontend/dist/js/authStore-BNu5iRKd.js +1 -0
  77. package/frontend/dist/js/{authStore-RsBcSMMM.js → authStore-BOFcWqii.js} +3 -3
  78. package/frontend/dist/js/{bn-sjvarZOb.js → bn-DZgfamCo.js} +1 -1
  79. package/frontend/dist/js/chatStore-C3c3r8iB.js +3 -0
  80. package/frontend/dist/js/{client-b-EoJr_G.js → client-CQZUgw7R.js} +2 -2
  81. package/frontend/dist/js/{config-cjZnwBYY.js → config-Dz__g4tp.js} +1 -1
  82. package/frontend/dist/js/{cs-HDycqDhD.js → cs-Cx7EJqsO.js} +1 -1
  83. package/frontend/dist/js/{da-BVFJgeVO.js → da-o3xyldjl.js} +1 -1
  84. package/frontend/dist/js/{de-BvHBSBK4.js → de-DtSkfuOa.js} +1 -1
  85. package/frontend/dist/js/decisionsApi-DJWWXd5m.js +1 -0
  86. package/frontend/dist/js/{decisionsApi-CCPE-Qru.js → decisionsApi-DWyjcL8B.js} +1 -1
  87. package/frontend/dist/js/{es-DbVEuhTV.js → es-CNJDAw3s.js} +1 -1
  88. package/frontend/dist/js/{evaluationsApi-Due3Xmlx.js → evaluationsApi-BE2P4V0I.js} +1 -1
  89. package/frontend/dist/js/{fr-B1KGm4dd.js → fr-BfkRYgQd.js} +1 -1
  90. package/frontend/dist/js/{hi-DxJ8DThp.js → hi-BKmbYlM1.js} +1 -1
  91. package/frontend/dist/js/{id-BeHcweMq.js → id-BeP0q360.js} +1 -1
  92. package/frontend/dist/js/{is-g5BLxkpl.js → is-FNrpAg1Q.js} +1 -1
  93. package/frontend/dist/js/{it-Dc4XkI8W.js → it-C6LfJuro.js} +1 -1
  94. package/frontend/dist/js/{ja-CDtOkRnL.js → ja-VGke24PN.js} +1 -1
  95. package/frontend/dist/js/{ko-BBKgPWyC.js → ko-JnCzlETi.js} +1 -1
  96. package/frontend/dist/js/{messageCodeStyles-DQBFoYPS.js → messageCodeStyles-QRyNUcEv.js} +2 -2
  97. package/frontend/dist/js/modelPresentation-BqdYlMRq.js +1 -0
  98. package/frontend/dist/js/{ms-rIHXR3GT.js → ms-JF56ktSS.js} +1 -1
  99. package/frontend/dist/js/{nl-CoQBZ4yX.js → nl-FzrGEt7O.js} +1 -1
  100. package/frontend/dist/js/{pl-DEEj4YnX.js → pl-C6EtLPmh.js} +1 -1
  101. package/frontend/dist/js/{pt-CRlblKN3.js → pt-Clyy_Jz3.js} +1 -1
  102. package/frontend/dist/js/router-vendor-ihzG-2y7.js +1 -0
  103. package/frontend/dist/js/{ru-CWyM0zYW.js → ru-yG8TnHJE.js} +1 -1
  104. package/frontend/dist/js/{strandsApi-dlXURr1J.js → strandsApi-EFMF0J0x.js} +1 -1
  105. package/frontend/dist/js/{sv-BZb9WtOT.js → sv-DSCl8r0m.js} +1 -1
  106. package/frontend/dist/js/{teamEventStream-LCbFl9c-.js → teamEventStream-aQGd68I4.js} +1 -1
  107. package/frontend/dist/js/{th-CyVttEeX.js → th-DiITM0tM.js} +1 -1
  108. package/frontend/dist/js/{tr-8W-DKlX6.js → tr-jQmrBMGA.js} +1 -1
  109. package/frontend/dist/js/ui-CKcr9ReZ.js +2 -0
  110. package/frontend/dist/js/{ui-vendor-CjZizWzb.js → ui-vendor-BanHlKMb.js} +1 -1
  111. package/frontend/dist/js/{uk-CCS3WiT5.js → uk-rPc3yzsm.js} +1 -1
  112. package/frontend/dist/js/{useChat-DJk_sA_g.js → useChat-DFozXoci.js} +1 -1
  113. package/frontend/dist/js/useDictation-D9lyoqUR.js +1 -0
  114. package/frontend/dist/js/useQuery-B-RslgPA.js +1 -0
  115. package/frontend/dist/js/useTranslation-Bu0AxynE.js +1 -0
  116. package/frontend/dist/js/utils-DhBboyBg.js +1 -0
  117. package/frontend/dist/js/utils-vendor-DpFrFwUi.js +1 -0
  118. package/frontend/dist/js/{vi-9LSI-JjZ.js → vi-wT4LDUXd.js} +1 -1
  119. package/frontend/dist/js/{workApi-DoqjHVys.js → workApi-C2R6IiSd.js} +1 -1
  120. package/frontend/dist/js/workApi-CNDPo0bG.js +1 -0
  121. package/frontend/dist/js/{zh-B8TvwSpQ.js → zh-CIASsxyC.js} +1 -1
  122. package/package.json +3 -4
  123. package/plugins/codex-oauth.json +2 -0
  124. package/plugins/gemini.json +1 -0
  125. package/plugins/mlx-lm.json +5 -5
  126. package/plugins/openai.json +3 -1
  127. package/plugins/openrouter.json +2 -0
  128. package/frontend/dist/assets/index-Bi4dLGow.js +0 -32
  129. package/frontend/dist/assets/index-FrFgrp5E.css +0 -2
  130. package/frontend/dist/js/AutomationsPage-DyWCHZB4.js +0 -1
  131. package/frontend/dist/js/CalendarPage-CoUeeBLZ.js +0 -1
  132. package/frontend/dist/js/ChannelsPage-BTtm0zgq.js +0 -1
  133. package/frontend/dist/js/ChatPage-CNVzf1Nh.js +0 -14
  134. package/frontend/dist/js/HomePage-CllRyMmx.js +0 -1
  135. package/frontend/dist/js/LanguageSwitcher-D4QF6lpW.js +0 -1
  136. package/frontend/dist/js/NotesPage-DFL_4FyE.js +0 -3
  137. package/frontend/dist/js/PersonasPage-C0FD_dR6.js +0 -13
  138. package/frontend/dist/js/PluginUsagePage-D5cfifCU.js +0 -1
  139. package/frontend/dist/js/RichMessageContent-BQtj6ZIo.js +0 -3
  140. package/frontend/dist/js/SettingsModal-D4K6DG99.js +0 -19
  141. package/frontend/dist/js/WorkPage-Cq_VMf9T.js +0 -7
  142. package/frontend/dist/js/api-1Ym789zb.js +0 -1
  143. package/frontend/dist/js/appVersion-6CB3OX6W.js +0 -1
  144. package/frontend/dist/js/authStore-KZxTYkaU.js +0 -1
  145. package/frontend/dist/js/chatStore-D-0TPlCx.js +0 -3
  146. package/frontend/dist/js/decisionsApi-6OUw07DU.js +0 -1
  147. package/frontend/dist/js/modelPresentation-ChKS6M4O.js +0 -1
  148. package/frontend/dist/js/router-vendor-DLHZHk4K.js +0 -1
  149. package/frontend/dist/js/ui-CtgjJ55f.js +0 -2
  150. package/frontend/dist/js/useDictation-C5NoYnvs.js +0 -1
  151. package/frontend/dist/js/useQuery-Cs76KYuP.js +0 -1
  152. package/frontend/dist/js/useTranslation-CKqEdZ8j.js +0 -1
  153. package/frontend/dist/js/utils-BXRzbHJC.js +0 -1
  154. package/frontend/dist/js/utils-vendor-B4bGLP5p.js +0 -1
  155. package/frontend/dist/js/workApi-CEjmKHnw.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t}from"./react-vendor-C1iE8mnY.js";var n=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,r=/^[\\/]{2}/;function i(e,t){return t+e.replace(/\\/g,`/`)}var a=`popstate`;function o(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function s(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return p(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:m(t)}return g(t,n,null,e)}function c(e={}){function t(e,t){let{pathname:n=`/`,search:r=``,hash:i=``}=h(e.location.hash.substring(1));return!n.startsWith(`/`)&&!n.startsWith(`.`)&&(n=`/`+n),p(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){let n=e.document.querySelector(`base`),r=``;if(n&&n.getAttribute(`href`)){let t=e.location.href,n=t.indexOf(`#`);r=n===-1?t:t.slice(0,n)}return r+`#`+(typeof t==`string`?t:m(t))}function r(e,t){u(e.pathname.charAt(0)===`/`,`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)}return g(t,n,r,e)}function l(e,t){if(e===!1||e==null)throw Error(t)}function u(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function d(){return Math.random().toString(36).substring(2,10)}function f(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function p(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?h(t):t,state:n,key:t&&t.key||r||d(),mask:i}}function m({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function h(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function g(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,c=i.history,l=`POP`,u=null,d=m();d??(d=0,c.replaceState({...c.state,idx:d},``));function m(){return(c.state||{idx:null}).idx}function h(){l=`POP`;let e=m(),t=e==null?null:e-d;d=e,u&&u({action:l,location:b.location,delta:t})}function g(e,t){l=`PUSH`;let r=o(e)?e:p(b.location,e,t);n&&n(r,e),d=m()+1;let a=f(r,d),h=b.createHref(r.mask||r);try{c.pushState(a,``,h)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(h)}s&&u&&u({action:l,location:b.location,delta:1})}function v(e,t){l=`REPLACE`;let r=o(e)?e:p(b.location,e,t);n&&n(r,e),d=m();let i=f(r,d),a=b.createHref(r.mask||r);c.replaceState(i,``,a),s&&u&&u({action:l,location:b.location,delta:0})}function y(e){return _(i,e)}let b={get action(){return l},get location(){return e(i,c)},listen(e){if(u)throw Error(`A history only accepts one active listener`);return i.addEventListener(a,h),u=e,()=>{i.removeEventListener(a,h),u=null}},createHref(e){return t(i,e)},createURL:y,encodeLocation(e){let t=y(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:g,replace:v,go(e){return c.go(e)}};return b}function _(e,t,n=!1){let i=`http://localhost`;e&&(i=e.location.origin===`null`?e.location.href:e.location.origin),l(i,`No window.location.(origin|href) available to create URL`);let a=typeof t==`string`?t:m(t);return a=a.replace(/ $/,`%20`),!n&&r.test(a)&&(a=i+a),new URL(a,i)}var v=e(t(),1),y=class{#e=new Map;constructor(e){if(e)for(let[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){this.#e.set(e,t)}},b=class extends Error{},x=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`,`unstable_validateParams`]);function S(e){return x.has(e)}var C=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`,`unstable_validateParams`]);function w(e){return C.has(e)}function T(e){return e.index===!0}function E(e){let t={};return e.Component&&Object.assign(t,{element:v.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function D(e,t=E,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(l(e.index!==!0||!e.children,`Cannot specify children on an index route`),l(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),T(e)){let n={...e,id:s};return r[s]=O(n,t(n)),n}{let n={...e,id:s,children:void 0};return r[s]=O(n,t(n)),e.children&&(n.children=D(e.children,t,o,r,i)),n}})}function O(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function ee(e,t,n=`/`){return k(e,t,n,!1)}function k(e,t,n,r,i){let a=V((typeof t==`string`?h(t):t).pathname||`/`,n);if(a==null)return null;let o=i??A(e),s=null,c=ue(a);for(let e=0;s==null&&e<o.length;++e)s=se(o[e],c,r);return s}function te(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function A(e){let t=j(e);return N(t),t}function j(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;l(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let u=U([r,c.relativePath]),d=n.concat(c);e.children&&e.children.length>0&&(l(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),j(e.children,t,d,u,o)),(e.path!=null||e.index)&&t.push({path:u,score:ae(u,e.index),routesMeta:d.map((e,t)=>{let[n,r]=le(e.relativePath,e.caseSensitive,t===d.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of M(e.path))a(e,t,!0,n)}),t}function M(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=M(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function N(e){e.sort((e,t)=>e.score===t.score?oe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var P=/^:[\w-]+$/,ne=/^:[\w-]+/,F=3.5,I=3,L=2,R=1,z=10,re=-2,ie=e=>e===`*`;function ae(e,t){let n=e.split(`/`),r=n.length;return n.some(ie)&&(r+=re),t&&(r+=L),n.filter(e=>!ie(e)).reduce((e,t)=>e+(P.test(t)?I:ne.test(t)?F:t===``?R:z),r)}function oe(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function se(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?ce(u,l,s.matcher,s.compiledParams):B(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=B({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:U([a,d.pathname]),pathnameBase:W(U([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=U([a,d.pathnameBase]))}return o}function B(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=le(e.path,e.caseSensitive,e.end);return ce(e,t,n,r)}function ce(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=ye(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=ye(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function le(e,t=!1,n=!0){u(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/((?:[^/?()[\]*^\\]|\\.)+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ue(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return u(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function V(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function de({basename:e,pathname:t}){return t===`/`?e:U([e,t])}var fe=e=>n.test(e);function pe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?h(e):e,a;return n?(n=ve(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?me(n.substring(1),`/`):me(n,t)):a=t,{pathname:a,search:be(r),hash:xe(i)}}function me(e,t){let n=ye(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function H(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function he(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ge(e){let t=he(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function _e(e,t,n,r=!1){let i;typeof e==`string`?i=h(e):(i={...e},l(!i.pathname||!i.pathname.includes(`?`),H(`?`,`pathname`,`search`,i)),l(!i.pathname||!i.pathname.includes(`#`),H(`#`,`pathname`,`hash`,i)),l(!i.search||!i.search.includes(`#`),H(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=pe(i,s),u=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(u||d)&&(c.pathname+=`/`),c}var ve=e=>e.replace(/[\\/]{2,}/g,`/`),U=e=>ve(e.join(`/`));function ye(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var W=e=>ye(e).replace(/^\/*/,`/`),be=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,xe=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Se=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Ce=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function we(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function G(e){return U(e.map(e=>e.route.path).filter(Boolean))||`/`}function Te(e,t){let n=new URL(typeof e==`string`||e instanceof URL?e:e.url),r=typeof t==`string`?h(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);let i=e.toString();n.search=i?`?${i}`:``}else n.search=``;return n.hash=r.hash||``,n}var Ee=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function De(e,t){let a=e;if(typeof a!=`string`||!n.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let o=a,s=!1;if(Ee)try{let e=new URL(window.location.href),n=r.test(a)?new URL(i(a,e.protocol)):new URL(a),o=V(n.pathname,t);n.origin===e.origin&&o!=null?a=o+n.search+n.hash:s=!0}catch{u(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:s,to:a}}var Oe=Symbol(`Uninstrumented`),ke=new WeakMap;function Ae(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){e.lazy!=null&&n.lazy.push(e.lazy),e[`lazy.loader`]!=null&&n[`lazy.loader`].push(e[`lazy.loader`]),e[`lazy.action`]!=null&&n[`lazy.action`].push(e[`lazy.action`]),e[`lazy.middleware`]!=null&&n[`lazy.middleware`].push(e[`lazy.middleware`]),e.middleware!=null&&n.middleware.push(e.middleware),e.loader!=null&&n.loader.push(e.loader),e.action!=null&&n.action.push(e.action)}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=t.lazy;r.lazy=async(...t)=>K(await q(n.lazy,void 0,()=>e(...t),Ie))}if(typeof t.lazy==`object`){let e=t.lazy;if(typeof e.middleware==`function`&&n[`lazy.middleware`].length>0){let t=e.middleware;r.lazy=Object.assign(r.lazy||{},{middleware:async(...e)=>K(await q(n[`lazy.middleware`],void 0,()=>t(...e),Ie))})}if(typeof e.loader==`function`&&n[`lazy.loader`].length>0){let t=e.loader;r.lazy=Object.assign(r.lazy||{},{loader:async(...e)=>K(await q(n[`lazy.loader`],void 0,()=>t(...e),Ie))})}if(typeof e.action==`function`&&n[`lazy.action`].length>0){let t=e.action;r.lazy=Object.assign(r.lazy||{},{action:async(...e)=>K(await q(n[`lazy.action`],void 0,()=>t(...e),Ie))})}}if(typeof t.loader==`function`&&n.loader.length>0){let e=Me(t.loader),i=async(...t)=>K(await q(n.loader,Le(t[0]),()=>e(...t),Ie));e.hydrate===!0&&(i.hydrate=!0),Ne(i,e),r.loader=i}if(typeof t.action==`function`&&n.action.length>0){let e=Me(t.action),i=async(...t)=>K(await q(n.action,Le(t[0]),()=>e(...t),Ie));Ne(i,e),r.action=i}return t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=Me(e),r=async(...e)=>K(await q(n.middleware,Le(e[0]),()=>t(...e),Ie));return Ne(r,t),r})),r}function je(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){e.navigate!=null&&n.navigate.push(e.navigate),e.fetch!=null&&n.fetch.push(e.fetch)}})),n.navigate.length>0){let t=Me(e.navigate),r=async(...r)=>{let[i,a]=r,o,s={to:typeof i==`number`||typeof i==`string`?i:i?m(i):`.`,...J(e,a??{})};return K(await q(n.navigate,s,async()=>{if(typeof i==`number`)return await t(...r);let n=Pe(e,e=>{o=e});try{return await t(...r)}finally{n()}},e=>({...Ie(e),meta:o})))};Ne(r,t),e.navigate=r}if(n.fetch.length>0){let t=Me(e.fetch),r=async(...r)=>{let[i,a,o,s]=r,c;return K(await q(n.fetch,{href:o??`.`,fetcherKey:i,...J(e,s??{})},async()=>{let n=Pe(e,e=>{c=e});try{return await t(...r)}finally{n()}},e=>({...Ie(e),meta:c})))};Ne(r,t),e.fetch=r}return e}function Me(e){return e[Oe]??e}function Ne(e,t){e[Oe]=t}function Pe(e,t){return ke.set(e,t),()=>{ke.get(e)===t&&ke.delete(e)}}function Fe(e){let t=ke.get(e);return ke.delete(e),t}function K(e){if(e.type===`error`)throw e.value;return e.value}async function q(e,t,n,r,i={result:null,innerResult:null},a=e.length-1){let o=e[a];if(o){let s,c=async()=>(s?console.error(`You cannot call instrumented handlers more than once`):s=q(e,t,n,r,i,a-1),await s,l(i.innerResult,`Expected an inner result`),i.innerResult);try{await o(c,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}s||await c(),await s}else{try{i.result={type:`success`,value:await n()}}catch(e){i.result={type:`error`,value:e}}i.innerResult=r(i.result,t)}return i.result||(i.result={type:`error`,value:Error(`No result assigned in instrumentation chain.`)},i.innerResult=r(i.result,t)),i.result}function Ie(e){return e.type===`error`&&e.value instanceof Error?{status:`error`,error:e.value}:{status:`success`,error:void 0}}function Le(e){let{request:t,context:n,params:r}=e;return{...e,request:Re(t),params:{...r},context:ze(n)}}function J(e,t){return{currentUrl:m(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function Re(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function ze(e){return{get:t=>e.get(t)}}var Be=class{#e=[];#t=[];#n;#r=0;constructor(e){this.#n=e}update(e){this.#e=e,this.#t=A(e),this.#r=this.#t.reduce((e,t)=>e+t.routesMeta.length,0)}get matchCost(){return this.#r}match(e,t=!1){return k(this.#e,e,this.#n,t,this.#t)}},Ve=new URL(`http://localhost`);function He(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Ve)}catch{return Ve}}function Y(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Ue(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function We(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Y(i,n),s=!Y(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Ue(e,i)||!Y(i,a)))throw Error(`External navigation is not allowed`)}var Ge=[`POST`,`PUT`,`PATCH`,`DELETE`],Ke=new Set(Ge),qe=[`GET`,...Ge],Je=new Set(qe),Ye=new Set([301,302,303,307,308]),Xe=new Set([307,308]),Ze={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Qe={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},$e={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},et=`remix-router-transitions`,tt=Symbol(`ResetLoaderData`);function nt(e,t){return e.unstable_routePatternMatching?(l(void 0,`You must call unstable_preloadRoutePattern() from "react-router/route-pattern" before enabling future.unstable_routePatternMatching.`),new(void 0)(t)):new Be(t)}var rt=class{#e;#t;#n;constructor(e,t){this.#e=e,this.#n=t,this.#n.update(e)}get stableRoutes(){return this.#e}get activeRoutes(){return this.#t??this.#e}get hasHMRRoutes(){return this.#t!=null}setRoutes(e){this.#e=e,this.#t||this.#n.update(e)}setHmrRoutes(e){this.#t=e,this.#n.update(e)}commitHmrRoutes(){this.#t&&(this.#e=this.#t,this.#t=void 0,this.#n.update(this.#e))}},it=new WeakMap;function at(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;l(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let i=e.hydrationRouteProperties||[],a=e.mapRouteProperties,o=a||(()=>({}));if(e.instrumentations){let t=e.instrumentations;o=e=>({...a?.(e),...Ae(t.map(e=>e.route).filter(Boolean),e)})}let s={...e.future},c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let d=nt(s,c),f={},g=new rt(D(e.routes,o,void 0,f),d),v=e.dataStrategy||St,x=null,S=new Set,C=null,w=null,T=null,E=e.hydrationData!=null,O=d.match(e.history.location),ee=!1,k=null,A,j;if(O==null&&!e.patchRoutesOnNavigation){let t=X(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Gt(g.activeRoutes);A=!0,j=!A,O=n,k={[r.id]:t}}else if(O&&!e.hydrationData&&mt(O,e.history.location.pathname).active&&(O=null),!O){A=!1,j=!A,O=[];let t=mt(null,e.history.location.pathname);t.active&&t.matches&&(ee=!0,O=t.matches)}else if(O.some(e=>e.route.lazy))A=!1,j=!A;else if(!O.some(e=>ut(e.route)))A=!0,j=!A;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=O;if(n){let e=O.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}j=!1,A=!0,r.forEach(e=>{let r=dt(e.route,t,n);j||=r.renderFallback,A&&=!r.shouldLoad})}let M,N={historyAction:e.history.action,location:e.history.location,matches:O,initialized:A,renderFallback:j,navigation:Ze,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||k,fetchers:new Map,blockers:new Map},P=`POP`,ne=0,F,I=null,L=!1,R,z=!1,re=new Map,ie=null,ae=!1,oe=!1,se=new Set,B=new Map,ce=0,le=-1,ue=new Map,de=new Set,pe=new Map,me=new Map,H=new Set,he=new Map,ge,_e=null;function ve(){if(x=e.history.listen(({action:t,location:n,delta:r})=>{if(ge){ge(),ge=void 0;return}u(he.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=et({currentLocation:N.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{ge=e});e.history.go(r*-1),Ye(i,{state:`blocked`,location:n,proceed(){Ye(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(N.blockers);e.set(i,$e),W({blockers:e})}}),I?.resolve(),I=null}else return s.unstable_customRouteDiscovery&&(ne+=r||0),G(t,n)}),n){mn(t,re);let e=()=>hn(t,re);t.addEventListener(`pagehide`,e),ie=()=>t.removeEventListener(`pagehide`,e)}return N.initialized||G(`POP`,N.location,{initialHydration:!0}),M}function U(){x&&x(),ie&&ie(),S.clear(),R&&R.abort(),N.fetchers.forEach((e,t)=>Ve(N.fetchers,t)),N.blockers.forEach((e,t)=>Je(t))}function ye(e){return S.add(e),()=>S.delete(e)}function W(e,t={}){let n=e.errors??null,r=n?it.get(n):void 0;r!==void 0&&(n=r),(e.errors!==void 0||e.initialized)&&(N.errors&&it.delete(N.errors),e.errors&&it.set(e.errors,n)),e.matches&&=e.matches.map(e=>{let t=f[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),N={...N,...e};let i=[],a=[];N.fetchers.forEach((e,t)=>{e.state===`idle`&&(H.has(t)?i.push(t):a.push(t))}),H.forEach(e=>{!N.fetchers.has(e)&&!B.has(e)&&i.push(e)}),[...S].forEach(e=>e(N,{deletedFetchers:i,newErrors:n,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),i.forEach(e=>Ve(N.fetchers,e)),a.forEach(e=>N.fetchers.delete(e))}function be(t,n,{flushSync:r}={}){let i=N.actionData!=null&&N.navigation.formMethod!=null&&Q(N.navigation.formMethod)&&N.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?N.actionData:null;let o=n.loaderData?Ht(N.loaderData,n.loaderData,n.matches||[],n.errors):N.loaderData,s=N.blockers;s.size>0&&!ae&&(s=new Map(s),s.forEach((e,t)=>s.set(t,$e)));let c=!ae&&pt(t,n.matches||N.matches),l=L===!0||N.navigation.formMethod!=null&&Q(N.navigation.formMethod)&&t.state?._isRedirect!==!0;g.commitHmrRoutes(),ae||P===`POP`||(P===`PUSH`?e.history.push(t,t.state):P===`REPLACE`&&e.history.replace(t,t.state));let u;if(P===`POP`&&!ae&&t!==N.location){let e=re.get(N.location.pathname);e&&e.has(t.pathname)?u={currentLocation:N.location,nextLocation:t}:re.has(t.pathname)&&(u={currentLocation:t,nextLocation:N.location})}else if(z){let e=re.get(N.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),re.set(N.location.pathname,e)),u={currentLocation:N.location,nextLocation:t}}W({...n,actionData:a,loaderData:o,historyAction:P,location:t,initialized:!0,renderFallback:!1,navigation:Ze,revalidation:`idle`,restoreScrollPosition:c,preventScrollReset:l,blockers:s},{viewTransitionOpts:u,flushSync:r===!0}),xe(),I?.resolve(),I=null,_e?.resolve(),_e=null}function xe(){ne=0,P=`POP`,L=!1,z=!1,ae=!1,oe=ue.size>0}async function Se(t,n){if(F&&await F,I?.resolve(),I=null,typeof t==`number`){I||=gn();let n=I.promise;return e.history.go(t),n}let i=Fe(M),{path:a,submission:o,error:s}=ct(!1,st(N.location,N.matches,c,t,n?.fromRouteId,n?.relative),n),l;if(n?.mask){let t=typeof n.mask==`string`?h(n.mask):{...N.location.mask,...n.mask};if(l={pathname:t.pathname??``,search:t.search??``,hash:t.hash??``},r.test(l.pathname))throw Error(`External navigation is not allowed`);l.pathname.startsWith(`\\`)&&(l.pathname=l.pathname.replace(/^\\+/,`/`)),We(typeof n.mask==`string`?n.mask:m(n.mask),m(l),e.history.createURL(`/`),`reject`)}let u=N.location,d=p(u,a,n&&n.state,void 0,l);d={...d,...e.history.encodeLocation(d)},We(t==null?e.history.createHref(N.location):typeof t==`string`?t:m(t),e.history.createHref(d.mask||d),e.history.createURL(`/`),`reject`);let f=n&&n.replace!=null?n.replace:void 0,g=`PUSH`,_=N.location.pathname+N.location.search;f===!0?g=`REPLACE`:f===!1||o!=null&&Q(o.formMethod)&&(o.formAction===_||d.pathname+d.search===_)&&(g=`REPLACE`);let v=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,y=(n&&n.flushSync)===!0,b=et({currentLocation:u,nextLocation:d,historyAction:g});b?Ye(b,{state:`blocked`,location:d,proceed(){Ye(b,{state:`proceeding`,proceed:void 0,reset:void 0,location:d}),Se(t,n)},reset(){let e=new Map(N.blockers);e.set(b,$e),W({blockers:e})}}):await G(g,d,{submission:o,pendingError:s,preventScrollReset:v,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:y,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate,instrumentationNavigateMetaReceiver:i})}function Ce(){if(F)return F.then(Ce);_e||=gn(),Le(),W({revalidation:`loading`});let e=_e.promise;return N.navigation.state===`submitting`?e:N.navigation.state===`idle`?(G(N.historyAction,N.location,{startUninterruptedRevalidation:!0,dataStrategyInitiator:`revalidation`}),e):(G(P||N.historyAction,N.navigation.location,{overrideNavigation:N.navigation,dataStrategyInitiator:`revalidation`,enableViewTransition:z===!0}),e)}async function G(t,n,r){F&&await F,R&&R.abort(),R=null,P=t,ae=(r&&r.startUninterruptedRevalidation)===!0,ft(N.location,N.matches),L=(r&&r.preventScrollReset)===!0,z=(r&&r.enableViewTransition)===!0;let i=r?.initialHydration&&N.matches&&N.matches.length>0&&!ee?N.matches:d.match(n),a=(r&&r.flushSync)===!0;if(i&&N.initialized&&!oe&&Jt(N.location,n)&&!(r&&r.submission&&Q(r.submission.formMethod))){be(n,{matches:i},{flushSync:a});return}let o=mt(i,n.pathname);if(o.active&&o.matches&&(i=o.matches),r?.instrumentationNavigateMetaReceiver){let t=cn(e.history,n,i);r.instrumentationNavigateMetaReceiver(t)}if(!i){let{error:e,notFoundMatches:t,route:r}=tt(n.pathname);be(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:a});return}let s=r&&r.overrideNavigation?{...r.overrideNavigation,matches:i,historyAction:t}:void 0;R=new AbortController;let c=Lt(e.history,n,R.signal,r&&r.submission),l=r?.initialHydration?`initialization`:r?.dataStrategyInitiator??`navigation`,u=e.getContext?await e.getContext():new y,f;if(r&&r.pendingError)f=[Wt(i).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&Q(r.submission.formMethod)){let d=await Ee(c,l,n,r.submission,i,t,u,o.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:a});if(d.shortCircuited)return;if(d.pendingActionResult){let[e,t]=d.pendingActionResult;if(Z(t)&&we(t.error)&&t.error.status===404){R=null,be(n,{matches:d.matches,loaderData:{},errors:{[e]:t.error}});return}}i=d.matches||i,f=d.pendingActionResult,s=un(n,i,t,r.submission),a=!1,o.active=!1,c=Lt(e.history,c.url,c.signal)}let{shortCircuited:p,matches:m,loaderData:h,errors:g,workingFetchers:_}=await De(c,l,n,i,t,u,o.active,s,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,a,f,r&&r.callSiteDefaultShouldRevalidate);p||(R=null,be(n,{matches:m||i,...Ut(f),loaderData:h,errors:g,..._?{fetchers:_}:{}}))}function Te(){let t=gn();F=t.promise;let n=ne,r=I;I=null,R?.abort(),R=null,xe(),_e?.resolve(),_e=null;let i=new Map(N.blockers);i.forEach((e,t)=>{e.state===`proceeding`&&i.set(t,$e)});let a=new Map(N.fetchers),o=Ge(a);a.forEach((e,t)=>{e.state===`loading`&&!B.has(t)&&(a.set(t,$(e.data)),o=!0)}),se.clear(),W({navigation:Ze,revalidation:`idle`,blockers:i,...o?{fetchers:a}:{}});function s(){F=void 0,r?.resolve(),t.resolve()}return n?(ge=s,e.history.go(-n)):s(),t.promise}async function Ee(t,n,r,a,l,u,d,p,m,h={}){if(s.unstable_customRouteDiscovery||Le(),W({navigation:dn(r,l,u,a)},{flushSync:h.flushSync===!0}),p){let e=await gt(l,r.pathname,t.signal);if(s.unstable_customRouteDiscovery&&t.signal.aborted||e.type===`aborted`)return{shortCircuited:!0};if(e.type===`cancelled`)return await Te(),{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Gt(g.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=Wt(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:n}=tt(r.pathname);return{matches:e,pendingActionResult:[n.id,{type:`error`,error:t}]}}}s.unstable_customRouteDiscovery&&Le();let _,v=sn(l,r);if(!v.route.action&&!v.route.lazy)_={type:`error`,error:X(405,{method:t.method,pathname:r.pathname,routeId:v.route.id})};else{let e=await q(t,r,Ot(o,f,t,r,l,v,m?[]:i,d),d,null,n,u);if(_=e[v.route.id],!_){for(let t of l)if(e[t.route.id]){_=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if($t(_)){let r;return r=h&&h.replace!=null?h.replace:It(_.response.headers.get(`Location`),new URL(t.url),c,e.history)===N.location.pathname+N.location.search,await K(t,_,!0,n,{submission:a,replace:r}),{shortCircuited:!0}}if(Z(_)){let e=Wt(l,v.route.id);return(h&&h.replace)!==!0&&(P=`PUSH`),{matches:l,pendingActionResult:[e.route.id,_,v.route.id]}}return{matches:l,pendingActionResult:[v.route.id,_]}}async function De(t,n,r,a,c,l,u,p,m,h,_,v,y,b,x){let S=p||un(r,a,c,m),C=m||h||ln(S),w=!ae&&!v;if(u){if(w){let e=Oe(b);W({navigation:S,...e===void 0?{}:{actionData:e}},{flushSync:y})}let e=await gt(a,r.pathname,t.signal);if(s.unstable_customRouteDiscovery&&t.signal.aborted||e.type===`aborted`)return{shortCircuited:!0};if(e.type===`cancelled`)return await Te(),{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Gt(g.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Wt(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)a=e.matches,v&&!t.signal.aborted&&W({matches:a});else{let{error:e,notFoundMatches:t,route:n}=tt(r.pathname);return{matches:t,loaderData:{},errors:{[n.id]:e}}}}let{dsMatches:T,revalidatingFetchers:E}=lt(t,l,o,f,e.history,N,a,C,r,v?[]:i,v===!0,oe,se,H,pe,de,d,b,x);if(le=++ce,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=new Map(N.fetchers),t=Ge(e);return be(r,{matches:a,loaderData:{},errors:b&&Z(b[1])?{[b[0]]:b[1].error}:null,...Ut(b),...t?{fetchers:e}:{}},{flushSync:y}),{shortCircuited:!0}}if(w){let e={};if(!u){e.navigation=S;let t=Oe(b);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=ke(E)),W(e,{flushSync:y})}E.forEach(e=>{Y(e.key),e.controller&&B.set(e.key,e.controller)});let D=()=>E.forEach(e=>{B.get(e.key)===e.controller&&Y(e.key)});R&&R.signal.addEventListener(`abort`,D);let{loaderResults:O,fetcherResults:ee}=await Ie(T,E,t,r,l,n,c);if(t.signal.aborted)return{shortCircuited:!0};R&&R.signal.removeEventListener(`abort`,D),E.forEach(e=>{B.get(e.key)===e.controller&&B.delete(e.key)});let k=Kt(O);if(k)return await K(t,k.result,!0,n,{replace:_}),{shortCircuited:!0};if(k=Kt(ee),k)return de.add(k.key),await K(t,k.result,!0,n,{replace:_}),{shortCircuited:!0};let te=new Map(N.fetchers),{loaderData:A,errors:j}=Vt(N,a,O,b,E,ee,te);if(v&&N.errors){let e=j??null;j={...N.errors,...j},it.set(j,e)}let M=Ge(te),P=Ke(le,te),ne=M||P||E.length>0;return{matches:a,loaderData:A,errors:j,...ne?{workingFetchers:te}:{}}}function Oe(e){if(e&&!Z(e[1]))return{[e[0]]:e[1].data};if(N.actionData)return Object.keys(N.actionData).length===0?null:N.actionData}function ke(e){let t=new Map(N.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=fn(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Me(t,n,r,i){F&&await F,Y(t);let a=(i&&i.flushSync)===!0,o=Fe(M),s=st(N.location,N.matches,c,r,n,i?.relative),l=d.match(s),u=mt(l,s);if(u.active&&u.matches&&(l=u.matches),o&&o(cn(e.history,s,l)),!l){Re(t,n,X(404,{pathname:s}),{flushSync:a});return}let{path:f,submission:p,error:m}=ct(!0,s,i);if(m){Re(t,n,m,{flushSync:a});return}let h=e.getContext?await e.getContext():new y,g=(i&&i.preventScrollReset)===!0;if(p&&Q(p.formMethod)){await Ne(t,n,f,l,h,u.active,a,g,p,i&&i.defaultShouldRevalidate);return}let _={routeId:n,path:f,isDiscovering:u.active};pe.set(t,_),await Pe(t,_,l,h,a,g,p)}async function Ne(t,n,r,a,c,u,p,m,h,g){s.unstable_customRouteDiscovery||Le(),pe.delete(t);let _=N.fetchers.get(t);J(t,pn(h,_),{flushSync:p});let v=new AbortController;s.unstable_customRouteDiscovery&&B.set(t,v);let y=Lt(e.history,r,v.signal,h);if(u){let e=await gt(a,new URL(y.url).pathname,y.signal,t);if(s.unstable_customRouteDiscovery&&y.signal.aborted||e.type===`aborted`)return;if(e.type===`cancelled`){B.delete(t),pe.delete(t),J(t,$(_?.data),{flushSync:p});return}if(e.type===`error`){Re(t,n,e.error,{flushSync:p});return}if(e.matches)a=e.matches;else{Re(t,n,X(404,{pathname:r}),{flushSync:p});return}}let b=sn(a,r);if(!b.route.action&&!b.route.lazy){Re(t,n,X(405,{method:h.formMethod,pathname:r,routeId:n}),{flushSync:p});return}s.unstable_customRouteDiscovery&&Le(),B.set(t,v);let x=ce,S=Ot(o,f,y,r,a,b,i,c),C=await q(y,r,S,c,t,`fetcher`),w=C[b.route.id];if(!w){for(let e of S)if(C[e.route.id]){w=C[e.route.id];break}}if(y.signal.aborted){B.get(t)===v&&B.delete(t);return}if(H.has(t)){if(Z(w)){J(t,$(void 0));return}$t(w)&&(oe=!0,w={type:`data`,data:void 0})}else{if($t(w)){if(le>x)oe=!0,w={type:`data`,data:void 0};else return B.delete(t),de.add(t),J(t,fn(h)),K(y,w,!1,`fetcher`,{fetcherSubmission:h,preventScrollReset:m})}if(Z(w)){Re(t,n,w.error);return}}oe=!0;let T=N.navigation.location||N.location,E=Lt(e.history,T,v.signal),D=N.navigation.state===`idle`?N.matches:d.match(N.navigation.location);l(D,`Didn't find any matches after fetcher action`);let O=++ce;ue.set(t,O);let{dsMatches:ee,revalidatingFetchers:k}=lt(E,c,o,f,e.history,N,D,h,T,i,!1,oe,se,H,pe,de,d,[b.route.id,w],g),te=fn(h,w.data),A=new Map(N.fetchers);A.set(t,te),k.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=A.get(t),r=fn(void 0,n?n.data:void 0);A.set(t,r),Y(t),e.controller&&B.set(t,e.controller)}),W({fetchers:A});let j=()=>k.forEach(e=>{B.get(e.key)===e.controller&&Y(e.key)});v.signal.addEventListener(`abort`,j);let{loaderResults:M,fetcherResults:ne}=await Ie(ee,k,E,T,c,`fetcher`);if(v.signal.aborted){ue.get(t)===O&&ue.delete(t);return}v.signal.removeEventListener(`abort`,j),ue.delete(t),B.delete(t),k.forEach(e=>{B.get(e.key)===e.controller&&B.delete(e.key)});let F=N.fetchers.has(t),I=e=>{if(!F)return e;let n=new Map(e.fetchers);return n.set(t,$(w.data)),{...e,fetchers:n}},L=Kt(M);if(L)return N=I(N),K(E,L.result,!1,`fetcher`,{preventScrollReset:m});if(L=Kt(ne),L)return de.add(L.key),N=I(N),K(E,L.result,!1,`fetcher`,{preventScrollReset:m});let z=new Map(N.fetchers);F&&z.set(t,$(w.data));let{loaderData:re,errors:ie}=Vt(N,D,M,void 0,k,ne,z);Ke(O,z),N.navigation.state===`loading`&&O>le?(l(P,`Expected pending action`),R&&R.abort(),Ge(z),be(N.navigation.location,{matches:D,loaderData:re,errors:ie,fetchers:z})):(W({errors:ie,loaderData:Ht(N.loaderData,re,D,ie),fetchers:z}),oe=ue.size>0)}async function Pe(t,n,r,a,c,l,u){let{routeId:d,path:p}=n,m=N.fetchers.get(t);J(t,fn(u,m?m.data:void 0),{flushSync:c});let h=new AbortController;s.unstable_customRouteDiscovery&&B.set(t,h);let g=Lt(e.history,p,h.signal);if(n.isDiscovering){let e=await gt(r,new URL(g.url).pathname,g.signal,t);if(s.unstable_customRouteDiscovery&&g.signal.aborted||e.type===`aborted`)return;if(e.type===`cancelled`){B.delete(t),pe.delete(t),J(t,$(m?.data),{flushSync:c});return}if(e.type===`error`){Re(t,d,e.error,{flushSync:c});return}if(e.matches)r=e.matches,n.isDiscovering=!1;else{Re(t,d,X(404,{pathname:p}),{flushSync:c});return}}let _=sn(r,p);B.set(t,h);let v=ce,y=await q(g,p,Ot(o,f,g,p,r,_,i,a),a,t,`fetcher`),b=y[_.route.id];if(!b){for(let e of r)if(y[e.route.id]){b=y[e.route.id];break}}if(B.get(t)===h&&B.delete(t),!g.signal.aborted){if(H.has(t))J(t,$(void 0));else{if($t(b)){if(le>v){J(t,$(void 0));return}de.add(t),await K(g,b,!1,`fetcher`,{preventScrollReset:l});return}Z(b)?Re(t,d,b.error):J(t,$(b.data))}}}async function K(r,i,a,o,{submission:s,fetcherSubmission:u,preventScrollReset:d,replace:f}={}){a||(I?.resolve(),I=null),i.response.headers.has(`X-Remix-Revalidate`)&&(oe=!0);let m=i.response.headers.get(`Location`);l(m,`Expected a Location header on the redirect Response`);let h=m,g=new URL(r.url);m=It(m,g,c,e.history),We(h,m,g,`allow-explicit`);let v=p(N.location,m,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(fe(m)){let n=_(t,m,!0);e=n.origin!==t.location.origin||V(n.pathname,c)==null}if(e){f?t.location.replace(m):t.location.assign(m);return}}R=null;let y=f===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:b,formAction:x,formEncType:S}=N.navigation;!s&&!u&&b&&x&&S&&(s=ln(N.navigation));let C=s||u;Xe.has(i.response.status)&&C&&Q(C.formMethod)?await G(y,v,{submission:{...C,formAction:m},preventScrollReset:d||L,enableViewTransition:a?z:void 0,dataStrategyInitiator:o}):await G(y,v,{overrideNavigation:un(v,[],y,s),fetcherSubmission:u,preventScrollReset:d||L,enableViewTransition:a?z:void 0,dataStrategyInitiator:o})}async function q(e,t,n,r,i,a,o=null){let s,l={};try{s=await kt(v,e,t,n,i,a,r,!1,o)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{l[t.route.id]={type:`error`,error:e}}),l}if(e.signal.aborted)return l;if(!Q(e.method))for(let e of n){if(s[e.route.id]?.type===`error`)break;s.hasOwnProperty(e.route.id)||N.loaderData.hasOwnProperty(e.route.id)||N.errors&&N.errors.hasOwnProperty(e.route.id)||!e.shouldCallHandler()||(s[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(s))if(Qt(r)){let i=r.result;l[t]={type:`redirect`,response:Nt(i,e,t,n,c)}}else l[t]=await Mt(r);return l}async function Ie(e,t,n,r,i,a,o=null){let s=q(n,r,e,i,null,a,o),c=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await q(e.request,e.path,e.matches,i,e.key,a,o))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:`error`,error:X(404,{pathname:e.path})}})}));return{loaderResults:await s,fetcherResults:(await c).reduce((e,t)=>Object.assign(e,t),{})}}function Le(){oe=!0,pe.forEach((e,t)=>{s.unstable_customRouteDiscovery&&e.isDiscovering||(B.has(t)&&se.add(t),Y(t))})}function J(e,t,n={}){let r=new Map(N.fetchers);r.set(e,t),W({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function Re(e,t,n,r={}){let i=Wt(N.matches,t),a=new Map(N.fetchers);Ve(a,e),W({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function ze(e){return me.set(e,(me.get(e)||0)+1),H.has(e)&&H.delete(e),N.fetchers.get(e)||Qe}function Be(e,t){Y(e,t?.reason),pe.delete(e),se.delete(e),J(e,$(null))}function Ve(e,t){let n=N.fetchers.get(t);B.has(t)&&!(n&&n.state===`loading`&&ue.has(t))&&Y(t),pe.delete(t),ue.delete(t),de.delete(t),H.delete(t),se.delete(t),e.delete(t)}function He(e){let t=(me.get(e)||0)-1;t<=0?(me.delete(e),H.add(e)):me.set(e,t),W({fetchers:new Map(N.fetchers)})}function Y(e,t){let n=B.get(e);n&&(n.abort(t),B.delete(e))}function Ue(e,t){for(let n of e){let e=t.get(n);l(e,`Expected fetcher: ${n}`);let r=$(e.data);t.set(n,r)}}function Ge(e){let t=[],n=!1;for(let r of de){let i=e.get(r);l(i,`Expected fetcher: ${r}`),i.state===`loading`&&(de.delete(r),t.push(r),n=!0)}return Ue(t,e),n}function Ke(e,t){let n=[];for(let[r,i]of ue)if(i<e){let e=t.get(r);l(e,`Expected fetcher: ${r}`),e.state===`loading`&&(Y(r),ue.delete(r),n.push(r))}return Ue(n,t),n.length>0}function qe(e,t){let n=N.blockers.get(e)||$e;return he.get(e)!==t&&he.set(e,t),n}function Je(e){N.blockers.delete(e),he.delete(e)}function Ye(e,t){let n=N.blockers.get(e)||$e;l(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(N.blockers);r.set(e,t),W({blockers:r})}function et({currentLocation:e,nextLocation:t,historyAction:n}){if(he.size===0)return;he.size>1&&u(!1,`A router only supports one blocker at a time`);let r=Array.from(he.entries()),[i,a]=r[r.length-1],o=N.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function tt(e){let t=X(404,{pathname:e}),n=g.activeRoutes,{matches:r,route:i}=Gt(n);return{notFoundMatches:r,route:i,error:t}}function at(e,t,n){if(C=e,T=t,w=n||null,!E&&N.navigation===Ze){E=!0;let e=pt(N.location,N.matches);e!=null&&W({restoreScrollPosition:e})}return()=>{C=null,T=null,w=null}}function ot(e,t){return w&&w(e,t.map(e=>te(e,N.loaderData)))||e.key}function ft(e,t){if(C&&T){let n=ot(e,t);C[n]=T()}}function pt(e,t){if(C){let n=ot(e,t),r=C[n];if(typeof r==`number`)return r}return null}function mt(t,n){if(e.patchRoutesOnNavigation){if(!t)return{active:!0,matches:d.match(n,!0)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:d.match(n,!0)}}return{active:!1,matches:null}}async function gt(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let a=t;for(;;){let t=f;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:a,fetcherKey:i,patch:(e,n)=>{r.aborted||ht(e,n,g,t,o,!1)}})}catch(e){if(s.unstable_customRouteDiscovery){if(r.aborted)return{type:`aborted`};if(e instanceof b)return{type:`cancelled`}}return{type:`error`,error:e,partialMatches:a}}if(r.aborted)return{type:`aborted`};let c=d.match(n),l=null;if(c&&(Object.keys(c[0].params).length===0||(l=d.match(n,!0),!(l&&a.length<l.length&&_t(a,l.slice(0,a.length))))))return{type:`success`,matches:c};if(l||=d.match(n,!0),!l||_t(a,l))return{type:`success`,matches:null};a=l}}function _t(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function vt(e){f={},g.setHmrRoutes(D(e,o,void 0,f))}function yt(e,t,n=!1){ht(e,t,g,f,o,n),g.hasHMRRoutes||W({})}return M={get basename(){return c},get future(){return s},get state(){return N},get routes(){return g.stableRoutes},match(e){return d.match(e)},get manifest(){return f},get window(){return t},initialize:ve,subscribe:ye,enableScrollRestoration:at,navigate:Se,fetch:Me,revalidate:Ce,createHref:t=>e.history.createHref(t),createURL:t=>e.history.createURL(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:ze,resetFetcher:Be,deleteFetcher:He,dispose:U,getBlocker:qe,deleteBlocker:Je,patchRoutes:yt,_internalFetchControllers:B,_internalSetRoutes:vt,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){W(e)}},e.instrumentations&&(M=je(M,e.instrumentations.map(e=>e.router).filter(Boolean))),M}function ot(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function st(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=_e(r||`.`,ge(o),V(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=on(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=de({basename:n,pathname:c.pathname})),m(c)}function ct(e,t,n){if(!n||!ot(n))return{path:t};if(n.formMethod&&!an(n.formMethod))return{path:t,error:X(405,{method:n.formMethod})};let r=()=>({path:t,error:X(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=qt(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!Q(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}\n`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if(n.formEncType===`application/json`){if(!Q(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}l(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=Rt(n.formData),s=n.formData;else if(n.body instanceof FormData)o=Rt(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=zt(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=zt(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(Q(c.formMethod))return{path:t,submission:c};let u=h(t);return e&&u.search&&on(u.search)&&o.append(`index`,``),u.search=`?${o}`,{path:m(u),submission:c}}function lt(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){let y=_?Z(_[1])?_[1].error:_[1].data:void 0,b=i.createURL(a.location),x=i.createURL(c),S;if(u&&a.errors){let e=Object.keys(a.errors)[0];S=o.findIndex(t=>t.route.id===e)}else if(_&&Z(_[1])){let e=_[0];S=o.findIndex(t=>t.route.id===e)-1}let C=_?_[1].statusCode:void 0,w=C&&C>=400,T={currentUrl:b,currentParams:a.matches[0]?.params||{},nextUrl:x,nextParams:o[0].params,...s,actionResult:y,actionStatus:C},E=G(o),D=o.map((i,o)=>{let{route:s}=i,f=null;if(S!=null&&o>S)f=!1;else if(s.lazy)f=!0;else if(!ut(s))f=!1;else if(u){let{shouldLoad:e}=dt(s,a.loaderData,a.errors);f=e}else ft(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return Dt(n,r,e,c,E,i,l,t,f);let p=!1;typeof v==`boolean`?p=v:w?p=!1:d||b.pathname+b.search===x.pathname+x.search?p=!0:b.search===x.search?pt(a.matches[o],i)&&(p=!0):p=!0;let m={...T,defaultShouldRevalidate:p};return Dt(n,r,e,c,E,i,l,t,mt(i,m),m,v)}),O=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s)||e.isDiscovering)return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,_=g.match(e.path);if(!_){O.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let y=sn(_,e.path),b=new AbortController,x=Lt(i,e.path,b.signal),S=null;if(f.has(s))f.delete(s),S=Ot(n,r,x,e.path,_,y,l,t);else if(m)d&&(S=Ot(n,r,x,e.path,_,y,l,t));else{let i;i=typeof v==`boolean`?v:!w&&d;let a={...T,defaultShouldRevalidate:i};mt(y,a)&&(S=Ot(n,r,x,e.path,_,y,l,t,a))}S&&O.push({key:s,routeId:e.routeId,path:e.path,matches:S,match:y,request:x,controller:b})}),{dsMatches:D,revalidatingFetchers:O}}function ut(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function dt(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!ut(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function ft(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function pt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function mt(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function ht(e,t,n,r,i,a){let o;if(e){let t=r[e];l(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>gt(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=D(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=D([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function gt(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index!==t.index||e.path!==t.path||e.caseSensitive!==t.caseSensitive?!1:(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>gt(e,t)))??!1}var _t=new WeakMap,vt=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(l(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=_t.get(i);o||(o={},_t.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=S(e),n=i[e]!==void 0;if(t)u(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)u(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c.catch(()=>{o[e]===c&&delete o[e]}),c},yt=new WeakMap;function bt(e,t,n,r,i){let a=n[e.id];if(l(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=yt.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{l(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=w(e),o=a[e]!==void 0;i?u(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?u(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return yt.set(a,n),n.catch(()=>{yt.get(a)===n&&yt.delete(a)}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=vt({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let d=s.length>0?Promise.all(s).then(()=>{}):void 0;return d?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:c}}async function xt(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function St(e){return e.matches.some(e=>e.route.middleware)?Ct(e,()=>xt(e)):xt(e)}function Ct(e,t){return wt(e,t,e=>{if(rn(e))throw e;return e},Xt,n);async function n(t,n,r){if(r)return Object.assign(r.value,{[n]:{type:`error`,result:t}});{let{matches:r}=e,i=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),a=r[i].route.id;for(let e of r.slice(0,i+1))try{await e._lazyPromises?.route}catch{a=e.route.id;break}return{[Wt(r,a).route.id]:{type:`error`,result:t}}}}}async function wt(e,t,n,r,i){let{matches:a,...o}=e;return await Tt(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function Tt(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await Tt(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function Et(e,t,n,r,i){let a=vt({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=bt(r.route,Q(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Dt(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Et(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?mt(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?mt(a,{...l,defaultShouldRevalidate:e}):mt(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!Q(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(Q(n.method)||!p)?At({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function Ot(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?Dt(e,t,n,r,G(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Et(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function kt(e,t,n,r,i,a,o,s,c=null){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let l={request:t,url:Te(t,n),pattern:G(r),params:r[0].params,context:o,matches:r,unstable_initiator:a,unstable_navigationType:a===`navigation`?c:null},u=s?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=l;return Ct(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},d=await e({...l,fetcherKey:i,runClientMiddleware:u});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return d}async function At({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=Q(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:Te(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a){if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw X(405,{method:e.method,pathname:n,routeId:r.route.id})}else return await a,{type:`data`,result:void 0}}}else if(t)c=await f(t);else{let t=new URL(e.url);throw X(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function jt(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function Mt(e){let{result:t,type:n}=e;if(tn(t)){let e;try{e=await jt(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new Ce(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?en(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:Yt(t),statusCode:we(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:we(t)?t.status:void 0}:en(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function Nt(e,t,n,r,i){let a=e.headers.get(`Location`);if(l(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!fe(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=st(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var Pt=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Ft(e){try{return Pt.includes(new URL(e).protocol)}catch{return!1}}function It(e,t,n,a){if(fe(e)){let a=e,o=r.test(a)?new URL(i(a,t.protocol)):new URL(a);if(Ft(o.toString()))throw Error(`Invalid redirect location`);let s=V(o.pathname,n)!=null;if(o.origin===t.origin&&s)return ve(o.pathname)+o.search+o.hash}try{if(Ft(a.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function Lt(e,t,n,r){let i=e.createURL(qt(t)).toString(),a={signal:n};if(r&&Q(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):a.body=t===`text/plain`?r.text:t===`application/x-www-form-urlencoded`&&r.formData?Rt(r.formData):r.formData}return new Request(i,a)}function Rt(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function zt(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Bt(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,u={},d=n&&Z(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let f=n.route.id,p=t[f];if(l(!$t(p),`Cannot handle redirect results in processLoaderData`),Z(p)){let t=p.error;if(d!==void 0&&(t=d,d=void 0),o||={},i)o[f]=t;else{let n=Wt(e,f);o[n.route.id]??(o[n.route.id]=t)}r||(a[f]=tt),c||(c=!0,s=we(p.error)?p.error.status:500),p.headers&&(u[f]=p.headers)}else a[f]=p.data,p.statusCode&&p.statusCode!==200&&!c&&(s=p.statusCode),p.headers&&(u[f]=p.headers)}),d!==void 0&&n&&(o={[n[0]]:d},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:u}}function Vt(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=Bt(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,routeId:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(l(s,`Did not find corresponding fetcher result`),Z(s)){let t=Wt(e.matches,r);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if($t(s))l(!1,`Unhandled fetcher revalidation redirect`);else{let e=$(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function Ht(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==tt).reduce((e,[t,n])=>(e[t]=n,e),{}),a=0;for(let o of n){let n=o.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&o.route.loader&&(i[n]=e[n],a++),r&&r.hasOwnProperty(n))break}return Object.keys(t).length===0&&a===Object.keys(e).length?e:i}function Ut(e){return e?Z(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Wt(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.ErrorBoundary!=null||e.route.errorElement!=null)||e[0]}function Gt(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function X(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new Ce(e||500,o,Error(s),!0)}function Kt(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if($t(r))return{key:n,result:r}}}function qt(e){return m({...typeof e==`string`?h(e):e,hash:``})}function Jt(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash||t.hash!==``}function Yt(e){return new Ce(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function Xt(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&Zt(t))}function Zt(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function Qt(e){return tn(e.result)&&Ye.has(e.result.status)}function Z(e){return e.type===`error`}function $t(e){return(e&&e.type)===`redirect`}function en(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function tn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function nn(e){return Ye.has(e)}function rn(e){return tn(e)&&nn(e.status)&&e.headers.has(`Location`)}function an(e){return Je.has(e.toUpperCase())}function Q(e){return Ke.has(e.toUpperCase())}function on(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function sn(e,t){let n=typeof t==`string`?h(t).search:t.search;if(e[e.length-1].route.index&&on(n||``))return e[e.length-1];let r=he(e);return r[r.length-1]}function cn(e,t,n){return{url:Te(e.createURL(t),t),pattern:n?G(n):``,params:n?.[0]?.params?{...n[0].params}:{}}}function ln(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(t&&n&&r){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function un(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function dn(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function fn(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function pn(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function $(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function mn(e,t){try{let n=e.sessionStorage.getItem(et);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function hn(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(et,JSON.stringify(n))}catch(e){u(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function gn(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var _n=v.createContext(null);_n.displayName=`DataRouter`;var vn=v.createContext(null);vn.displayName=`DataRouterState`;var yn=v.createContext(null);yn.displayName=`DataRouterData`;var bn=v.createContext(null);bn.displayName=`DataRouterNavigation`;var xn=v.createContext(!1);function Sn(){return v.useContext(xn)}var Cn=v.createContext({isTransitioning:!1});Cn.displayName=`ViewTransition`;var wn=v.createContext(null);wn.displayName=`Fetchers`;var Tn=v.createContext(null);Tn.displayName=`Await`;var En=v.createContext(null);En.displayName=`Navigation`;var Dn=v.createContext(null);Dn.displayName=`Location`;var On=v.createContext({outlet:null,matches:[],isDataRoute:!1});On.displayName=`Route`;var kn=v.createContext(!1);kn.displayName=`IsDataRoute`;var An=v.createContext(void 0);An.displayName=`RouteId`;var jn=v.createContext(null);jn.displayName=`RouteError`;var Mn=`REACT_ROUTER_ERROR`,Nn=`REDIRECT`,Pn=`ROUTE_ERROR_RESPONSE`;function Fn(e){if(e.startsWith(`${Mn}:${Nn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function In(e){if(e.startsWith(`${Mn}:${Pn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ce(t.status,t.statusText,t.data)}catch{}}function Ln(e,{relative:t}={}){l(Rn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=v.useContext(En),{hash:i,pathname:a,search:o}=Wn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:U([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Rn(){return v.useContext(Dn)!=null}function zn(){return l(Rn(),`useLocation() may be used only in the context of a <Router> component.`),v.useContext(Dn).location}var Bn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Vn(){return v.useContext(kn)?cr():Hn()}function Hn(){l(Rn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=v.useContext(_n),{basename:t,navigator:n}=v.useContext(En),{matches:r}=v.useContext(On),{pathname:i}=zn(),a=JSON.stringify(ge(r)),o=v.useRef(!1);return v.useLayoutEffect(()=>{o.current=!0}),v.useCallback((r,s={})=>{if(u(o.current,Bn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=_e(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:U([t,c.pathname])),We(typeof r==`string`?r:m(r),n.createHref(c),He(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}v.createContext(null);function Un(){let{matches:e}=v.useContext(On);return e[e.length-1]?.params??{}}function Wn(e,{relative:t}={}){let{matches:n}=v.useContext(On),{pathname:r}=zn(),i=JSON.stringify(ge(n));return v.useMemo(()=>_e(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Gn(e,t){return Kn(e,t)}function Kn(e,t,n){l(Rn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=v.useContext(En),{matches:i}=v.useContext(On),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=zn(),u;if(t){let e=typeof t==`string`?h(t):t;l(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),u=e}else u=c;let d=u.pathname||`/`,f=d;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p;p=n?n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):n.router.match(n.state.location):ee(e,{pathname:f});let m=$n(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:U([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:U([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&m?v.createElement(Dn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...u},navigationType:`POP`}},m):m}function qn(){let e=ar(),t=we(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var Jn=v.createElement(qn,null),Yn=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=xn;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=In(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(On.Provider,{value:this.props.routeContext},v.createElement(kn.Provider,{value:this.props.routeContext.isDataRoute},v.createElement(An.Provider,{value:this.props.routeContext.matches[this.props.routeContext.matches.length-1]?.route.id},v.createElement(jn.Provider,{value:e,children:this.props.component}))));return this.context?v.createElement(Zn,{error:e},t):t}},Xn=new WeakMap;function Zn({children:e,error:t}){let{basename:n,navigator:r}=v.useContext(En);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Fn(t.digest);if(e){let i=Xn.get(t);if(i)throw i;let a=De(e.location,n),o=a.absoluteURL||a.to;if(We(e.location,o,He(r),`allow-explicit`),Ft(o))throw Error(`Invalid redirect location`);if(Ee&&!Xn.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Xn.set(t,n),n}}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function Qn({routeContext:e,match:t,children:n}){let r=v.useContext(_n);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(On.Provider,{value:e},v.createElement(kn.Provider,{value:e.isDataRoute},v.createElement(An.Provider,{value:t.route.id},n)))}function $n(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);l(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,u=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:G(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let l,d=!1,f=null,p=null;r&&(l=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Jn,o&&(s<0&&c===0?(ur(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=l?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(Qn,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(Yn,{location:r.location,revalidation:r.revalidation,component:f,error:l,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:u}):h()},null)}function er(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function tr(e){let t=v.useContext(_n);return l(t,er(e)),t}function nr(e){let t=v.useContext(vn);return l(t,er(e)),t}function rr(e){let t=v.useContext(yn);return l(t,er(e)),t}function ir(e){let t=v.useContext(An);return l(t,`${e} can only be used on routes that contain a unique "id"`),t}function ar(){let e=v.useContext(jn),t=rr(`useRouteError`),n=ir(`useRouteError`);return e===void 0?t.errors?.[n]:e}var or=0;function sr(e){let{router:t,basename:n}=tr(`useBlocker`),r=nr(`useBlocker`),[i,a]=v.useState(``),o=v.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:V(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:V(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return v.useEffect(()=>{let e=String(++or);return a(e),()=>t.deleteBlocker(e)},[t]),v.useEffect(()=>{i!==``&&t.getBlocker(i,o)},[t,i,o]),i&&r.blockers.has(i)?r.blockers.get(i):$e}function cr(){let{router:e}=tr(`useNavigate`),t=ir(`useNavigate`),n=v.useRef(!1);return v.useLayoutEffect(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{u(n.current,Bn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var lr={};function ur(e,t,n){!t&&!lr[e]&&(lr[e]=!0,u(!1,n))}function dr(e,t){if(e===!1||e==null)throw Error(t)}function fr(e,t,n){let r=typeof e==`string`?new URL(e,n??(typeof window>`u`?`server://singlefetch/`:window.location.origin)):new URL(e);return n&&r.origin!==n&&(r=new URL(r.pathname+r.search+r.hash,n)),r.pathname.endsWith(`/`)?r.pathname=`${r.pathname}_.${t}`:r.pathname=`${r.pathname}.${t}`,r}async function pr(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function mr(e){return e!=null&&typeof e.page==`string`}function hr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function gr(e,t,n){return xr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await pr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(hr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function _r(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function vr(e,t,{includeHydrateFallback:n}={}){return yr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function yr(e){return[...new Set(e)]}function br(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function xr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!mr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(br(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}var Sr={};function Cr(e,t){!e&&!Sr[t]&&(Sr[t]=!0,console.warn(t))}var wr=v.createContext(void 0);wr.displayName=`FrameworkContext`;function Tr(){let e=v.useContext(wr);return dr(e,`You must render this element inside a <HydratedRouter> element`),e}function Er(e,t){let n=v.useContext(wr),[r,i]=v.useState(!1),[a,o]=v.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=v.useRef(null);v.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),v.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Dr(s,p),onBlur:Dr(c,m),onMouseEnter:Dr(l,p),onMouseLeave:Dr(u,m),onTouchStart:Dr(d,p)}]:[a,f,{}]:[!1,f,{}]}function Dr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Or({page:e,...t}){let n=Sn(),{nonce:r}=Tr(),{router:i}=tr(`PrefetchPageLinks`),a=v.useMemo(()=>i.match(e),[i,i.routes,e]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?v.createElement(Ar,{page:e,matches:a,...t}):v.createElement(jr,{page:e,matches:a,...t})):null}function kr(e){let{manifest:t,routeModules:n}=Tr(),[r,i]=v.useState([]);return v.useEffect(()=>{let r=!1;return gr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Ar({page:e,matches:t,...n}){let r=zn(),{unstable_apiServerOrigin:i}=Tr(),a=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=fr(e,`rsc`,i),a=!1,o=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?a=!0:o.push(e.route.id);return a&&o.length>0&&n.searchParams.set(`_routes`,o.join(`,`)),[i?n.toString():n.pathname+n.search]},[e,r,t,i]);return v.createElement(v.Fragment,null,a.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function jr({page:e,matches:t,...n}){let r=zn(),{manifest:i,routeModules:a,unstable_apiServerOrigin:o}=Tr(),{matches:s}=nr(`PrefetchPageLinks`),{loaderData:c}=rr(`PrefetchPageLinks`),l=v.useMemo(()=>_r(e,t,s,i,r,`data`),[e,t,s,i,r]),u=v.useMemo(()=>_r(e,t,s,i,r,`assets`),[e,t,s,i,r]),d=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!l.some(t=>t.route.id===e.route.id)&&e.route.id in c&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let u=fr(e,`data`,o);return s&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[o?u.toString():u.pathname+u.search]},[c,r,i,l,t,e,a,o]),f=v.useMemo(()=>vr(u,i),[u,i]),p=kr(u);return v.createElement(v.Fragment,null,d.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),f.map(e=>v.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),p.map(({key:e,link:t})=>v.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Mr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var Nr=[`HydrateFallback`,`hydrateFallbackElement`],Pr=class{status=`pending`;promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Fr(e,t){e.ready.catch(e=>{if(!(t.visibilityState===`hidden`||typeof e==`object`&&e&&`name`in e&&e.name===`AbortError`))throw e})}function Ir({router:e,flushSync:t,onError:n,useTransitions:r}){r=Sn()||r;let[i,a]=v.useState(e.state),[o,s]=(0,v.useOptimistic)(i),c=v.useRef(o),[l,u]=v.useState(),[d,f]=v.useState({isTransitioning:!1}),[p,m]=v.useState(),[h,g]=v.useState(),[_,y]=v.useState(),b=v.useRef(new Map),x=v.useRef(new WeakSet),S=v.useCallback((i,{deletedFetchers:o,newErrors:l,flushSync:d,viewTransitionOpts:_})=>{c.current=i,l&&i.errors&&it.has(i.errors)&&(x.current.has(i.errors)?l=null:x.current.add(i.errors)),l&&n&&Object.values(l).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:G(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&b.current.set(t,e.data)}),o.forEach(e=>b.current.delete(e)),Cr(d===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let S=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(Cr(_==null||S,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!_||!S)t&&d?t(()=>a(i)):r===!1?a(i):v.startTransition(()=>{r===!0&&s(e=>Lr(e,i)),a(i)});else if(t&&d){t(()=>{h&&(p?.resolve(),h.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:_.currentLocation,nextLocation:_.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});Fr(n,e.window.document),n.finished.finally(()=>{t(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})})}),t(()=>g(n))}else h?(p?.resolve(),h.skipTransition(),y({state:i,currentLocation:_.currentLocation,nextLocation:_.nextLocation})):(u(i),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}))},[e.window,t,h,p,r,s,n]);v.useLayoutEffect(()=>e.subscribe(S),[e,S]),v.useLayoutEffect(()=>{let t=e.state.errors,n=t?it.get(t):null;(c.current!==e.state||t&&n&&!x.current.has(t))&&S(e.state,{deletedFetchers:[],flushSync:!1,newErrors:n??null})},[e,S]),v.useEffect(()=>{d.isTransitioning&&!d.flushSync&&m(new Pr)},[d]),v.useEffect(()=>{if(p&&l&&e.window){let t=l,n=p.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):v.startTransition(()=>{r===!0&&s(e=>Lr(e,t)),a(t)}),await n});Fr(i,e.window.document),i.finished.finally(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})}),g(i)}},[l,p,e.window,r,s]),v.useEffect(()=>{p&&l&&o.location.key===l.location.key&&p.resolve()},[p,h,o.location,l]),v.useEffect(()=>{!d.isTransitioning&&_&&(u(_.state),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}),y(void 0))},[d.isTransitioning,_]);let C=v.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),w=e.basename||`/`,T=v.useMemo(()=>({router:e,navigator:C,static:!1,basename:w,onError:n}),[e,C,w,n]),E=v.useMemo(()=>({historyAction:o.historyAction,location:o.location,matches:o.matches,initialized:o.initialized,renderFallback:o.renderFallback,restoreScrollPosition:o.restoreScrollPosition,preventScrollReset:o.preventScrollReset,blockers:o.blockers}),[o.historyAction,o.location,o.matches,o.initialized,o.renderFallback,o.restoreScrollPosition,o.preventScrollReset,o.blockers]),D=v.useMemo(()=>({navigation:o.navigation,revalidation:o.revalidation}),[o.navigation,o.revalidation]),O=v.useMemo(()=>({loaderData:o.loaderData,actionData:o.actionData,errors:o.errors}),[o.loaderData,o.actionData,o.errors]),ee=v.useMemo(()=>({fetchers:o.fetchers,fetcherData:b.current}),[o.fetchers]);return v.createElement(v.Fragment,null,v.createElement(_n.Provider,{value:T},v.createElement(vn.Provider,{value:E},v.createElement(bn.Provider,{value:D},v.createElement(yn.Provider,{value:O},v.createElement(wn.Provider,{value:ee},v.createElement(Cn.Provider,{value:d},v.createElement(Hr,{basename:w,location:o.location,navigationType:o.historyAction,navigator:C,useTransitions:r},v.createElement(Rr,{routes:e.routes,manifest:e.manifest,state:o,isStatic:!1,onError:n})))))))),null)}function Lr(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var Rr=v.memo(zr);function zr({routes:e,manifest:t,state:n,isStatic:r,onError:i}){let a=v.useContext(_n);l(a,`You must render this element inside a <DataRouterContext.Provider> element`);let o=v.useContext(wr)?.routeDiscoveryRuntime;return v.useEffect(()=>{n.initialized&&o?.markReady()},[n.initialized,o]),Kn(e,void 0,{router:a.router,manifest:t,state:n,isStatic:r,onError:i})}function Br({to:e,replace:t,state:n,relative:r}){l(Rn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=v.useContext(En);u(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=v.useContext(On),{pathname:s}=zn(),c=Vn(),d=_e(e,ge(o),s,r===`path`);We(typeof e==`string`?e:m(e),a.createHref(d),He(a),`reject`);let f=JSON.stringify(d);return v.useEffect(()=>{c(JSON.parse(f),{replace:t,state:n,relative:r})},[c,f,r,t,n]),null}function Vr(e){l(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Hr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){l(!Rn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=h(n));let{pathname:d=`/`,search:f=``,hash:p=``,state:m=null,key:g=`default`,mask:_}=n,y=v.useMemo(()=>{let e=V(d,s);return e==null?null:{location:{pathname:e,search:f,hash:p,state:m,key:g,mask:_},navigationType:r}},[s,d,f,p,m,g,r,_]);return u(y!=null,`<Router basename="${s}"> is not able to match the URL "${d}${f}${p}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:v.createElement(En.Provider,{value:c},v.createElement(Dn.Provider,{children:t,value:y}))}function Ur({children:e,location:t}){return Gn(Wr(e),t)}v.Component;function Wr(e,t=[]){let n=[];return v.Children.forEach(e,(e,r)=>{if(!v.isValidElement(e))return;let i=[...t,r];if(e.type===v.Fragment){n.push.apply(n,Wr(e.props.children,i));return}l(e.type===Vr,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let a=e.props;l(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=Wr(a.children,i)),n.push(o)}),n}var Gr=`application/x-www-form-urlencoded`;function Kr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function qr(e){return Kr(e)&&e.tagName.toLowerCase()===`button`}function Jr(e){return Kr(e)&&e.tagName.toLowerCase()===`form`}function Yr(e){return Kr(e)&&e.tagName.toLowerCase()===`input`}function Xr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Zr(e,t){return e.button===0&&(!t||t===`_self`)&&!Xr(e)}function Qr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function $r(e,t){let n=Qr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var ei=null;function ti(){if(ei===null)try{new FormData(document.createElement(`form`),0),ei=!1}catch{ei=!0}return ei}var ni=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ri(e){return e!=null&&!ni.has(e)?(u(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Gr}"`),null):e}function ii(e,t){let n,r,i,a,o;if(Jr(e)){let o=e.getAttribute(`action`);r=o?V(o,t):null,n=e.getAttribute(`method`)||`get`,i=ri(e.getAttribute(`enctype`))||Gr,a=new FormData(e)}else if(qr(e)||Yr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?V(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=ri(e.getAttribute(`formenctype`))||ri(o.getAttribute(`enctype`))||Gr,a=new FormData(o,e),!ti()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Kr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=Gr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}var ai=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ai&&(window.__reactRouterVersion=`8`)}catch{}function oi(e,t){return at({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:s({window:t?.window}),hydrationData:t?.hydrationData||ci(),routes:e,mapRouteProperties:E,hydrationRouteProperties:Nr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function si(e,t){return at({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:c({window:t?.window}),hydrationData:t?.hydrationData||ci(),routes:e,mapRouteProperties:E,hydrationRouteProperties:Nr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function ci(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:li(e.errors)}),e}function li(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new Ce(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&Se.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var ui=v.forwardRef(function({onClick:e,discover:t=`render`,prefetch:r=`none`,relative:i,reloadDocument:a,replace:o,mask:s,state:c,target:l,to:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h){let{basename:g,navigator:_,useTransitions:y}=v.useContext(En),b=typeof u==`string`&&n.test(u),x=De(u,g);u=x.to;let S=Ln(u,{relative:i}),C=zn(),w=null;if(s){let e=_e(s,[],C.mask?C.mask.pathname:`/`,!0);g!==`/`&&(e.pathname=e.pathname===`/`?g:U([g,e.pathname])),w=_.createHref(e)}let[T,E,D]=Er(r,m),O=pi(u,{replace:o,mask:s,state:c,target:l,preventScrollReset:d,relative:i,viewTransition:f,defaultShouldRevalidate:p,useTransitions:y});function ee(t){e&&e(t),t.defaultPrevented||O(t)}let k=!(x.isExternal||a),te=v.createElement(`a`,{...m,...D,href:(k?w:void 0)||x.absoluteURL||S,onClick:k?ee:e,ref:Mr(h,E),target:l,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?v.createElement(v.Fragment,null,te,v.createElement(Or,{page:S})):te});ui.displayName=`Link`;var di=v.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Wn(a,{relative:c.relative}),d=zn(),f=v.useContext(bn),{navigator:p,basename:m}=v.useContext(En),h=f!=null&&yi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,y=f?.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=V(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(b)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return v.createElement(ui,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});di.displayName=`NavLink`;var fi=v.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:r,reloadDocument:i,replace:a,state:o,method:s=`get`,action:c,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=v.useContext(En),_=_i(),y=vi(c,{relative:u}),b=s.toLowerCase()===`get`?`get`:`post`,x=typeof c==`string`&&n.test(c);return v.createElement(`form`,{ref:h,method:b,action:y,onSubmit:i?l:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let n=e.nativeEvent.submitter,i=n?.getAttribute(`formmethod`)||s,c=()=>_(n||e.currentTarget,{fetcherKey:t,method:i,navigate:r,replace:a,state:o,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});g&&r!==!1?v.startTransition(()=>c()):c()},...m,"data-discover":!x&&e===`render`?`true`:void 0})});fi.displayName=`Form`;function pi(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Vn(),d=zn(),f=Wn(e,{relative:o});return v.useCallback(p=>{if(Zr(p,t)){p.preventDefault();let t=n===void 0?m(d)===m(f):n,h=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?v.startTransition(()=>h()):h()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function mi(e){u(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(Qr(e)),n=v.useRef(!1),r=zn(),i=v.useMemo(()=>$r(r.search,n.current?null:t.current),[r.search]),a=Vn();return[i,v.useCallback((e,t)=>{let r=Qr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var hi=0,gi=()=>`__${String(++hi)}__`;function _i(){let{router:e}=tr(`useSubmit`),{basename:t}=v.useContext(En),n=ir(`useSubmit`),r=e.fetch,i=e.navigate;return v.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=ii(e,t);a.navigate===!1?await r(a.fetcherKey||gi(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function vi(e,{relative:t}={}){let{basename:n}=v.useContext(En),r=v.useContext(On);l(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Wn(e||`.`,{relative:t})},o=zn();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:U([n,a.pathname])),m(a)}function yi(e,{relative:t}={}){let n=v.useContext(Cn);l(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=tr(`useViewTransitionState`),i=Wn(e,{relative:t});if(!n.isTransitioning)return!1;let a=V(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=V(n.nextLocation.pathname,r)||n.nextLocation.pathname;return B(i.pathname,o)!=null||B(i.pathname,a)!=null}export{Br as a,Ur as c,Vn as d,Un as f,mi as i,sr as l,we as m,oi as n,Vr as o,ar as p,si as r,Ir as s,ui as t,zn as u};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/OptimizedSyntaxHighlighter-DoJF0j0l.js","js/OptimizedSyntaxHighlighter-B8vbflQA.js","js/rolldown-runtime-XKyaHtl9.js","js/react-vendor-C1iE8mnY.js","js/syntax-highlight-CemL-n1v.js","js/markdown-core-CGWDtd6X.js","js/RichMessageContent-BTq5fi2Q.js","js/RichMessageContent-BQtj6ZIo.js","js/logger-DAQsBb8I.js","js/appStore-DDxf13l_.js","js/utils-vendor-B4bGLP5p.js","js/utils-BXRzbHJC.js","js/messageCodeStyles-DQBFoYPS.js","js/useTranslation-CKqEdZ8j.js","js/ui-vendor-CjZizWzb.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./Button-D6d7HYoa.js";import{i as n,r,t as i}from"./react-vendor-C1iE8mnY.js";import{t as a}from"./utils-BXRzbHJC.js";import{a as o,c as s,i as c,n as l,o as u,r as d,t as f}from"./messageCodeStyles-DQBFoYPS.js";import{t as p}from"./appStore-DDxf13l_.js";import{Gn as m,Rt as h,n as g}from"./ui-vendor-CjZizWzb.js";import{o as _}from"./logger-DAQsBb8I.js";import{t as v}from"./useDialogFocus-DpTun-ZV.js";import{t as y}from"./useTranslation-CKqEdZ8j.js";var b=e(n(),1),x=r(),S=i(),C=`w-full rounded-lg border border-line bg-surface-raised px-2.5 py-1.5 text-[13px] text-ink placeholder:text-ink-muted transition-[border-color,box-shadow] duration-150 focus:border-primary-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 dark:focus:border-primary-400 dark:focus:ring-primary-400/30`,w=`mb-1 block text-[11px] font-medium uppercase tracking-wide text-ink-muted rtl:normal-case rtl:tracking-normal`,T=({titleId:e,title:t,subtitle:n,onClose:r,children:i,footer:o,widthClassName:s=`max-w-lg`,testId:c})=>{let l=(0,b.useRef)(null),u=(0,b.useRef)(!1);return v(l,{onClose:r}),(0,x.createPortal)((0,S.jsx)(`div`,{className:`fixed inset-0 z-2147483647 flex items-center justify-center bg-gray-950/55 p-4 backdrop-blur-md`,onMouseDown:e=>{u.current=e.target===e.currentTarget},onClick:e=>{u.current&&e.target===e.currentTarget&&r(),u.current=!1},children:(0,S.jsx)(`div`,{ref:l,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-labelledby":e,"data-testid":c,className:a(`flex max-h-[90vh] w-full flex-col overflow-hidden rounded-3xl border border-black/[0.07] bg-white shadow-[0_24px_80px_rgba(0,0,0,0.24)] animate-scale-in dark:border-white/8 dark:bg-dark-25`,s),onClick:e=>e.stopPropagation(),children:(0,S.jsxs)(`div`,{"data-testid":`modal-scroll-region`,className:`min-h-0 overflow-y-auto p-6 scrollbar-thin`,children:[(0,S.jsx)(E,{titleId:e,title:t,subtitle:n,onClose:r}),i&&(0,S.jsx)(`div`,{className:`space-y-4`,children:i}),o&&(0,S.jsx)(`div`,{className:`mt-5 flex justify-end gap-3 border-t border-line pt-4`,children:o})]})})}),document.body)},E=({titleId:e,title:t,subtitle:n,onClose:r})=>{let{t:i}=y();return(0,S.jsxs)(`div`,{className:`mb-4 flex items-start justify-between gap-4`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h3`,{id:e,className:`text-lg font-medium tracking-[-0.02em] text-ink`,children:t}),n&&(0,S.jsx)(`p`,{className:`mt-1 text-[12px] leading-5 text-ink-muted`,children:n})]}),(0,S.jsx)(`button`,{type:`button`,onClick:r,"aria-label":i(`common.close`),className:`shrink-0 rounded-xl p-2 transition-colors text-ink-muted hover:bg-interactive-hover hover:text-ink focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-500`,children:(0,S.jsx)(g,{size:20})})]})},D=({label:e,error:t,helper:n,className:r,id:i,...o})=>{let s=(0,b.useId)(),c=i||`input-${s}`,l=`${c}-feedback`,u=[o[`aria-describedby`],(t||n)&&l].filter(Boolean).join(` `)||void 0;return(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,S.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,S.jsx)(`input`,{id:c,className:a(`block w-full rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`placeholder:text-ink-muted transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 focus-visible:outline-hidden dark:focus:border-primary-400 dark:focus:ring-primary-400/30`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,r),...o,"aria-invalid":t?!0:o[`aria-invalid`],"aria-describedby":u}),t&&(0,S.jsx)(`p`,{id:l,role:`alert`,className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,S.jsx)(`p`,{id:l,className:`text-xs leading-relaxed text-ink-muted`,children:n})]})},O=b.forwardRef(({label:e,error:t,helper:n,className:r,id:i,...o},s)=>{let c=(0,b.useId)(),l=i||`textarea-${c}`,u=`${l}-feedback`,d=[o[`aria-describedby`],(t||n)&&u].filter(Boolean).join(` `)||void 0;return(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,S.jsx)(`label`,{htmlFor:l,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,S.jsx)(`textarea`,{ref:s,id:l,className:a(`block w-full resize-none rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`placeholder:text-ink-muted transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 focus-visible:outline-hidden dark:focus:border-primary-400 dark:focus:ring-primary-400/30`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,r),...o,"aria-invalid":t?!0:o[`aria-invalid`],"aria-describedby":d}),t&&(0,S.jsx)(`p`,{id:u,role:`alert`,className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,S.jsx)(`p`,{id:u,className:`text-xs leading-relaxed text-ink-muted`,children:n})]})});O.displayName=`Textarea`;var k=({label:e,error:t,helper:n,options:r,className:i,id:o,...s})=>{let c=(0,b.useId)(),l=o||`select-${c}`,u=`${l}-feedback`,d=[s[`aria-describedby`],(t||n)&&u].filter(Boolean).join(` `)||void 0;return(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,S.jsx)(`label`,{htmlFor:l,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,S.jsx)(`select`,{id:l,className:a(`block w-full rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 focus-visible:outline-hidden dark:focus:border-primary-400 dark:focus:ring-primary-400/30`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,i),...s,"aria-invalid":t?!0:s[`aria-invalid`],"aria-describedby":d,children:r.map((e,t)=>(0,S.jsx)(`option`,{value:e.value,children:e.label},e.key??`${e.value}-${t}`))}),t&&(0,S.jsx)(`p`,{id:u,role:`alert`,className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,S.jsx)(`p`,{id:u,className:`text-xs leading-relaxed text-ink-muted`,children:n})]})},A=({className:e,...t})=>(0,S.jsx)(h,{...t,"aria-hidden":`true`,className:a(`h-3.5 w-3.5 shrink-0 animate-spin text-ink-subtle motion-reduce:animate-none`,e)}),j=b.lazy(()=>_(()=>import(`./OptimizedSyntaxHighlighter-DoJF0j0l.js`),__vite__mapDeps([0,1,2,3,4,5]))),M=8e4;function N({content:e}){return e?(0,S.jsx)(`div`,{dir:`auto`,className:`whitespace-pre-wrap wrap-break-word leading-relaxed`,children:e}):null}function P({content:e,language:t,complete:n}){let r=n?e.replace(/\r?\n$/,``):e,i=p(e=>e.theme.mode!==`light`),a=b.useRef(null),s=b.useRef(!0),u=b.useDeferredValue(r),m=r.length<=M,h=b.useCallback(e=>{a.current=e,e&&s.current&&(e.scrollTop=e.scrollHeight)},[]);b.useLayoutEffect(()=>{let e=a.current;e&&s.current&&(e.scrollTop=e.scrollHeight)},[r,u]);let g=b.useCallback(()=>{let e=a.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;s.current=t<24},[]),_=b.useMemo(()=>({children:e,...t})=>(0,S.jsx)(`pre`,{...t,ref:h,onScroll:e=>{g(),t.onScroll?.(e)},children:e}),[h,g]),v=(0,S.jsx)(`pre`,{ref:h,onScroll:g,className:d,children:(0,S.jsx)(`code`,{children:r})});return(0,S.jsx)(o,{code:r,language:t,state:n?`complete`:`streaming`,children:m?(0,S.jsx)(b.Suspense,{fallback:v,children:(0,S.jsx)(j,{language:t||`text`,isDark:i,codeTheme:`night`,backgroundColor:i?f:l,borderRadius:0,customStyle:c,className:`m-0! rounded-none! border-none!`,showLineNumbers:!0,preTag:_,children:u})}):v})}var F=b.memo(({content:e,className:t,segments:n,isStreaming:r=!0})=>{let i=b.useMemo(()=>n??u(e),[e,n]),o=i[i.length-1],s=o?.type===`code`&&!o.complete;return(0,S.jsxs)(`div`,{className:a(`text-sm leading-relaxed text-ink`,t),children:[i.map((e,t)=>e.type===`code`?(0,S.jsx)(P,{...e},`${e.type}-${t}`):(0,S.jsx)(N,{content:e.content},`${e.type}-${t}`)),r&&!s&&(0,S.jsx)(A,{"data-testid":`message-streaming-cursor`,className:`ms-1 inline-block align-text-bottom`})]})});F.displayName=`StreamingMessageContent`;var I=b.lazy(()=>_(()=>import(`./RichMessageContent-BTq5fi2Q.js`),__vite__mapDeps([6,7,2,3,5,8,9,10,11,12,13,14])));function L({content:e,className:t}){return(0,S.jsx)(`div`,{dir:`auto`,className:a(`text-sm leading-relaxed text-ink whitespace-pre-wrap wrap-break-word`,t),children:e})}var R=b.memo(({content:e,className:t,isStreaming:n=!1})=>{let r=b.useMemo(()=>n?u(e):[],[e,n]),i=r.some(e=>e.type===`code`);if(n&&i)return(0,S.jsx)(F,{content:e,className:t,segments:r});let a;return a=s(e)?(0,S.jsx)(b.Suspense,{fallback:(0,S.jsx)(F,{content:e,className:t,isStreaming:!1}),children:(0,S.jsx)(I,{content:e,className:t})}):(0,S.jsx)(L,{content:e,className:t}),(0,S.jsxs)(S.Fragment,{children:[a,n&&(0,S.jsx)(`span`,{"data-testid":`message-streaming-cursor`,"aria-hidden":`true`,className:`ms-1 inline-block h-5 w-1 animate-pulse rounded-full bg-primary-500 align-text-bottom`})]})});R.displayName=`MessageContent`;var z=({children:e,htmlFor:t,className:n=``,required:r=!1})=>(0,S.jsxs)(`label`,{htmlFor:t,className:a(`text-sm font-medium tracking-[-0.005em] text-ink-muted`,n),children:[e,r&&(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`ms-0.5 text-error-700 dark:text-error-400`,children:`*`})]}),B=({checked:e,onChange:t,disabled:n=!1,className:r=``,id:i,"aria-label":o,"aria-labelledby":s,"aria-describedby":c,"data-testid":l})=>(0,S.jsx)(`button`,{type:`button`,role:`switch`,id:i,"aria-checked":e,"aria-label":o,"aria-labelledby":s,"aria-describedby":c,"aria-disabled":n||void 0,"data-testid":l,disabled:n,onClick:()=>t(!e),className:a(`relative inline-flex h-6 w-11 shrink-0 items-center justify-center rounded-full bg-transparent`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas dark:focus-visible:ring-primary-400`,n?`cursor-not-allowed opacity-50`:`cursor-pointer`,r),children:(0,S.jsx)(`span`,{"aria-hidden":`true`,className:a(`relative inline-flex h-6 w-11 items-center rounded-full border shadow-inner`,`transition-[background-color,border-color] duration-150 ease-out motion-reduce:transition-none`,e?`border-primary-600/70 bg-primary-600`:`border-line-strong bg-surface-subtle`),children:(0,S.jsx)(`span`,{className:a(`inline-block h-4 w-4 rounded-full bg-white shadow-subtle ring-1 ring-black/5`,`transform transition-transform duration-150 ease-out motion-reduce:transition-none`,e?`translate-x-6 rtl:-translate-x-6`:`translate-x-1 rtl:-translate-x-1`)})})}),V={narrow:`max-w-4xl`,default:`max-w-6xl`,wide:`max-w-7xl`},H=({children:e,width:t=`default`,className:n,contentClassName:r,...i})=>(0,S.jsx)(`div`,{"data-testid":`page-scroll-region`,className:a(`scroll-region h-full min-h-0 scrollbar-thin`,n),...i,children:(0,S.jsx)(`div`,{className:a(`mx-auto w-full px-4 pb-16 pt-7 sm:px-6 sm:pb-20 sm:pt-10 lg:px-8`,V[t],r),children:e})}),U=({title:e,description:t,eyebrow:n,actions:r,meta:i,className:o,...s})=>(0,S.jsxs)(`header`,{className:a(`mb-8 flex flex-col gap-6 border-b border-line pb-7 text-start sm:mb-10 sm:pb-9 md:flex-row md:items-end md:justify-between`,o),...s,children:[(0,S.jsxs)(`div`,{className:`min-w-0 max-w-3xl`,children:[n&&(0,S.jsx)(`div`,{className:`mb-3 text-[11px] font-medium uppercase tracking-[0.18em] text-ink-muted rtl:tracking-normal`,children:n}),(0,S.jsx)(`h1`,{className:`text-balance text-3xl font-normal leading-[1.02] tracking-[-0.04em] text-ink sm:text-5xl sm:leading-none rtl:leading-[1.15] rtl:tracking-normal`,children:e}),t&&(0,S.jsx)(`p`,{className:`mt-4 max-w-2xl text-sm leading-6 text-ink-muted sm:text-base sm:leading-7`,children:t}),i&&(0,S.jsx)(`div`,{className:`mt-4`,children:i})]}),r&&(0,S.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 md:justify-end`,children:r})]}),W=({icon:e,label:t,destructive:n,disabled:r,testId:i,onClick:o})=>(0,S.jsx)(`button`,{type:`button`,onClick:o,disabled:r,title:t,"aria-label":t,"data-testid":i,className:a(`inline-flex h-8 w-8 items-center justify-center rounded-lg text-ink-muted transition-colors duration-150 disabled:cursor-not-allowed disabled:opacity-50`,n?`hover:bg-error-500/10 hover:text-error-600 dark:hover:text-error-400`:`hover:bg-interactive-hover hover:text-ink`),children:(0,S.jsx)(e,{className:`h-4 w-4`})}),G=({title:e,icon:t,description:n,actions:r,children:i,className:o,...s})=>(0,S.jsxs)(`div`,{className:a(`flex flex-wrap items-center justify-between gap-x-3 gap-y-2 border-b border-line px-4 py-3 text-start`,o),...s,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[t&&(0,S.jsx)(t,{className:`h-4 w-4 shrink-0 text-ink-muted`,"aria-hidden":`true`}),(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h1`,{className:`text-base font-semibold tracking-[-0.01em] text-ink rtl:tracking-normal`,children:e}),n&&(0,S.jsx)(`p`,{className:`mt-0.5 text-xs text-ink-muted`,children:n})]})]}),i]}),r&&(0,S.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:r})]}),K={sm:{root:`gap-1.5 px-3 py-6`,tile:`h-9 w-9`,icon:`h-4 w-4`,title:`text-sm`,text:`text-xs`},md:{root:`gap-2 px-4 py-16`,tile:`h-12 w-12`,icon:`h-5 w-5`,title:`text-base`,text:`text-sm`}},q=({icon:e,title:t,description:n,action:r,titleAs:i=`p`,size:o=`md`,testId:s,className:c})=>{let l=K[o];return(0,S.jsxs)(`div`,{"data-testid":s,className:a(`flex flex-col items-center text-center`,l.root,c),children:[(0,S.jsx)(`div`,{className:a(`mb-1 flex items-center justify-center rounded-xl bg-surface-subtle text-ink-muted`,l.tile),children:(0,S.jsx)(e,{className:l.icon,"aria-hidden":`true`})}),(0,S.jsx)(i,{className:a(`font-medium text-ink`,l.title),children:t}),n&&(0,S.jsx)(`p`,{className:a(`max-w-sm text-ink-muted`,l.text),children:n}),r&&(0,S.jsx)(`div`,{className:`mt-2`,children:r})]})},J={sm:{root:`gap-2 py-6`,spinner:`h-4 w-4`,text:`text-xs`},md:{root:`gap-3 py-16`,spinner:`h-6 w-6`,text:`text-sm`}},Y=({label:e,srOnly:t=!1,size:n=`md`,testId:r,className:i})=>{let{t:o}=y(),s=J[n];return(0,S.jsxs)(`div`,{role:`status`,"data-testid":r,className:a(`flex flex-col items-center justify-center text-center`,s.root,i),children:[(0,S.jsx)(`span`,{"aria-hidden":`true`,className:a(`animate-spin rounded-full border-2 border-line border-t-primary-500`,s.spinner)}),(0,S.jsx)(`span`,{className:t?`sr-only`:a(`text-ink-muted`,s.text),children:e??o(`common.loading`)})]})},X={sm:{root:`gap-2 px-3 py-6`,icon:`h-4 w-4`,text:`text-xs`},md:{root:`gap-3 px-4 py-16`,icon:`h-5 w-5`,text:`text-sm`}},Z=({message:e,icon:n=m,onRetry:r,size:i=`md`,testId:o,className:s})=>{let{t:c}=y(),l=X[i];return(0,S.jsxs)(`div`,{role:`alert`,"data-testid":o,className:a(`flex flex-col items-center justify-center text-center`,l.root,s),children:[(0,S.jsx)(n,{className:a(`text-error-600 dark:text-error-400`,l.icon),"aria-hidden":`true`}),(0,S.jsx)(`p`,{className:a(`max-w-sm text-ink`,l.text),children:e}),r&&(0,S.jsx)(t,{type:`button`,variant:`secondary`,size:`sm`,onClick:r,children:c(`common.retry`)})]})};export{C as _,W as a,B as c,F as d,A as f,T as g,D as h,G as i,z as l,O as m,Y as n,U as o,k as p,q as r,H as s,Z as t,R as u,w as v};
@@ -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-D-0TPlCx.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-CjZizWzb.js";import{t as ie}from"./Button-D6d7HYoa.js";import"./ui-CtgjJ55f.js";import{S as ae,g as oe,t as A,y as se}from"./api-R43sAAC-.js";import{t as ce}from"./authStore-RsBcSMMM.js";import{a as j,c as M,o as le,s as N,t as ue}from"./modelPresentation-ChKS6M4O.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};