libre-webui 0.14.2 → 0.15.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 (157) hide show
  1. package/README.md +92 -24
  2. package/backend/dist/db.d.ts.map +1 -1
  3. package/backend/dist/db.js +84 -0
  4. package/backend/dist/db.js.map +1 -1
  5. package/backend/dist/index.d.ts.map +1 -1
  6. package/backend/dist/index.js +99 -35
  7. package/backend/dist/index.js.map +1 -1
  8. package/backend/dist/middleware/auth.d.ts.map +1 -1
  9. package/backend/dist/middleware/auth.js +27 -2
  10. package/backend/dist/middleware/auth.js.map +1 -1
  11. package/backend/dist/routes/plugins.d.ts.map +1 -1
  12. package/backend/dist/routes/plugins.js +1 -1
  13. package/backend/dist/routes/plugins.js.map +1 -1
  14. package/backend/dist/routes/users.d.ts.map +1 -1
  15. package/backend/dist/routes/users.js +40 -6
  16. package/backend/dist/routes/users.js.map +1 -1
  17. package/backend/dist/routes/work.d.ts +3 -0
  18. package/backend/dist/routes/work.d.ts.map +1 -0
  19. package/backend/dist/routes/work.js +604 -0
  20. package/backend/dist/routes/work.js.map +1 -0
  21. package/backend/dist/services/ollamaService.d.ts +7 -2
  22. package/backend/dist/services/ollamaService.d.ts.map +1 -1
  23. package/backend/dist/services/ollamaService.js +8 -8
  24. package/backend/dist/services/ollamaService.js.map +1 -1
  25. package/backend/dist/services/pluginService.d.ts.map +1 -1
  26. package/backend/dist/services/pluginService.js +8 -9
  27. package/backend/dist/services/pluginService.js.map +1 -1
  28. package/backend/dist/services/preferencesService.d.ts.map +1 -1
  29. package/backend/dist/services/preferencesService.js +1 -0
  30. package/backend/dist/services/preferencesService.js.map +1 -1
  31. package/backend/dist/services/workAgentGuidance.d.ts +23 -0
  32. package/backend/dist/services/workAgentGuidance.d.ts.map +1 -0
  33. package/backend/dist/services/workAgentGuidance.js +129 -0
  34. package/backend/dist/services/workAgentGuidance.js.map +1 -0
  35. package/backend/dist/services/workAgentService.d.ts +33 -0
  36. package/backend/dist/services/workAgentService.d.ts.map +1 -0
  37. package/backend/dist/services/workAgentService.js +880 -0
  38. package/backend/dist/services/workAgentService.js.map +1 -0
  39. package/backend/dist/services/workEventService.d.ts +40 -0
  40. package/backend/dist/services/workEventService.d.ts.map +1 -0
  41. package/backend/dist/services/workEventService.js +324 -0
  42. package/backend/dist/services/workEventService.js.map +1 -0
  43. package/backend/dist/services/workModelProviderService.d.ts +49 -0
  44. package/backend/dist/services/workModelProviderService.d.ts.map +1 -0
  45. package/backend/dist/services/workModelProviderService.js +916 -0
  46. package/backend/dist/services/workModelProviderService.js.map +1 -0
  47. package/backend/dist/services/workRuntimeService.d.ts +143 -0
  48. package/backend/dist/services/workRuntimeService.d.ts.map +1 -0
  49. package/backend/dist/services/workRuntimeService.js +1860 -0
  50. package/backend/dist/services/workRuntimeService.js.map +1 -0
  51. package/backend/dist/services/workTaskService.d.ts +96 -0
  52. package/backend/dist/services/workTaskService.d.ts.map +1 -0
  53. package/backend/dist/services/workTaskService.js +718 -0
  54. package/backend/dist/services/workTaskService.js.map +1 -0
  55. package/backend/dist/types/index.d.ts +3 -0
  56. package/backend/dist/types/index.d.ts.map +1 -1
  57. package/backend/dist/types/index.js.map +1 -1
  58. package/backend/dist/types/work.d.ts +209 -0
  59. package/backend/dist/types/work.d.ts.map +1 -0
  60. package/backend/dist/types/work.js +18 -0
  61. package/backend/dist/types/work.js.map +1 -0
  62. package/backend/dist/utils/pluginChatAdapter.d.ts +9 -0
  63. package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
  64. package/backend/dist/utils/pluginChatAdapter.js +32 -6
  65. package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
  66. package/backend/dist/utils/pluginStreamAdapter.d.ts +12 -0
  67. package/backend/dist/utils/pluginStreamAdapter.d.ts.map +1 -1
  68. package/backend/dist/utils/pluginStreamAdapter.js +168 -19
  69. package/backend/dist/utils/pluginStreamAdapter.js.map +1 -1
  70. package/backend/dist/utils/pluginStreaming.d.ts +10 -0
  71. package/backend/dist/utils/pluginStreaming.d.ts.map +1 -1
  72. package/backend/dist/utils/pluginStreaming.js.map +1 -1
  73. package/backend/package.json +1 -1
  74. package/electron/main.js +39 -16
  75. package/frontend/dist/assets/index-Bv-twCuY.css +1 -0
  76. package/frontend/dist/assets/index-uCHBH_PM.js +5 -0
  77. package/frontend/dist/index.html +12 -11
  78. package/frontend/dist/js/{ArtifactContainer-RPQq1DRo.js → ArtifactContainer-CXfmVx8T.js} +1 -1
  79. package/frontend/dist/js/{ArtifactDemoPage-Dd0Rbl3N.js → ArtifactDemoPage-B1_AuMd2.js} +1 -1
  80. package/frontend/dist/js/ArtifactSlideOutPanel-C0eTguNL.js +1 -0
  81. package/frontend/dist/js/{Button-BZBnLKRn.js → Button-DBk-AREB.js} +1 -1
  82. package/frontend/dist/js/ChatPage-1bK0gDBy.js +16 -0
  83. package/frontend/dist/js/FirstTimeSetup-DOoZUaRs.js +1 -0
  84. package/frontend/dist/js/{GalleryPage-BTA5LAmZ.js → GalleryPage-6WwyH3kt.js} +1 -1
  85. package/frontend/dist/js/LibreClawPage-ChHVfPLb.js +1 -0
  86. package/frontend/dist/js/{ModelManagerModals-D1_k_AKo.js → ModelManagerModals-DneqFQJC.js} +1 -1
  87. package/frontend/dist/js/ModelsPage-Dw6wdiMt.js +2 -0
  88. package/frontend/dist/js/{OptimizedSyntaxHighlighter-BR97Z7hi.js → OptimizedSyntaxHighlighter-Ci9sRc78.js} +1 -1
  89. package/frontend/dist/js/PersonasPage-BxdI2e1-.js +13 -0
  90. package/frontend/dist/js/RichMessageContent-WQLdJ5jq.js +3 -0
  91. package/frontend/dist/js/SettingsModal-C-cK6TNb.js +1 -0
  92. package/frontend/dist/js/UserManagementPage-DqjNXPkf.js +1 -0
  93. package/frontend/dist/js/WorkPage-MGR3odo6.js +2 -0
  94. package/frontend/dist/js/api-DD5qhhLf.js +19 -0
  95. package/frontend/dist/js/{ar-UnnZB1Qy.js → ar-CCVY0-7X.js} +2 -2
  96. package/frontend/dist/js/babel-BnLuavNv.js +16 -0
  97. package/frontend/dist/js/{bn-uZXaDyeV.js → bn-CoU5CSph.js} +2 -2
  98. package/frontend/dist/js/{cs-CCXlnUEB.js → cs-CR6pjIbG.js} +2 -2
  99. package/frontend/dist/js/{da--BpVVGPp.js → da-CkyYITRz.js} +2 -2
  100. package/frontend/dist/js/{de-DZd9lsBc.js → de-DwNANzB-.js} +2 -2
  101. package/frontend/dist/js/{es-Bm968oUX.js → es-TxygiaVQ.js} +2 -2
  102. package/frontend/dist/js/estree-DPzMpjFm.js +44 -0
  103. package/frontend/dist/js/{fr-RlC0rD8I.js → fr-DvEqVpZr.js} +2 -2
  104. package/frontend/dist/js/{hi-C6kwkL7d.js → hi-CyrWkyh7.js} +2 -2
  105. package/frontend/dist/js/html-R50jmBYq.js +25 -0
  106. package/frontend/dist/js/{id-CDfqnnXS.js → id-PJjIGHGM.js} +2 -2
  107. package/frontend/dist/js/{is-Dnd_7Jqv.js → is-ChXcN1tI.js} +2 -2
  108. package/frontend/dist/js/{it-BM0j6_Sz.js → it-DsgM8-MJ.js} +2 -2
  109. package/frontend/dist/js/{ja-xGblKDDf.js → ja-ivtt80N2.js} +2 -2
  110. package/frontend/dist/js/{ko-CQ2d_Oj0.js → ko-B8l_Ice1.js} +2 -2
  111. package/frontend/dist/js/logger-DbNs3-DK.js +1 -0
  112. package/frontend/dist/js/markdown-C08x2H-K.js +70 -0
  113. package/frontend/dist/js/{markdown-core-fkbHPd-g.js → markdown-core-GI9BPwrB.js} +1 -1
  114. package/frontend/dist/js/{markdown-math-Ci4QOsf-.js → markdown-math-E4O1gcxj.js} +1 -1
  115. package/frontend/dist/js/{ms-CFpRuv_a.js → ms-DoUBI6Qi.js} +2 -2
  116. package/frontend/dist/js/{nl-D6oTztmP.js → nl-DsX5Hj8m.js} +2 -2
  117. package/frontend/dist/js/{pl-ByuvABul.js → pl-Db_NKL4x.js} +2 -2
  118. package/frontend/dist/js/postcss-DSDkwgFE.js +62 -0
  119. package/frontend/dist/js/{pt-CNFV21T7.js → pt-CpzBhb5J.js} +2 -2
  120. package/frontend/dist/js/react-vendor-DyG_ODzn.js +9 -0
  121. package/frontend/dist/js/router-vendor-BjDI9mRe.js +1 -0
  122. package/frontend/dist/js/{ru-CRsSOntz.js → ru-DCXvJyXJ.js} +2 -2
  123. package/frontend/dist/js/standalone-DpMZUvjd.js +29 -0
  124. package/frontend/dist/js/{sv-BRkwjyS5.js → sv-DcVoybc7.js} +2 -2
  125. package/frontend/dist/js/{syntax-highlight-B8OiKBhG.js → syntax-highlight-pM1xnNpY.js} +1 -1
  126. package/frontend/dist/js/{th-DigqsQEB.js → th-D0G7HyQn.js} +2 -2
  127. package/frontend/dist/js/{tr-B5aMUMJE.js → tr-CMDOh4Aq.js} +2 -2
  128. package/frontend/dist/js/typescript-B6y_hxBm.js +22 -0
  129. package/frontend/dist/js/ui-vendor-DUqvZsfs.js +177 -0
  130. package/frontend/dist/js/{uk-BUYi3llT.js → uk-D2MMa6LP.js} +2 -2
  131. package/frontend/dist/js/useBaseQuery-Duml3DYp.js +1 -0
  132. package/frontend/dist/js/useQuery-C0lZwNoc.js +1 -0
  133. package/frontend/dist/js/{useTranslation-CP6Cg-EI.js → useTranslation-Cs6iTP4m.js} +1 -1
  134. package/frontend/dist/js/{utils-D0l9J3P-.js → utils-pTFqSV8c.js} +1 -1
  135. package/frontend/dist/js/{utils-vendor-BX3ZwoIK.js → utils-vendor-Cbaj0BC5.js} +1 -1
  136. package/frontend/dist/js/{vi-hQIcXi3m.js → vi-B8uHT8yh.js} +2 -2
  137. package/frontend/dist/js/yaml-mLy9chOK.js +154 -0
  138. package/frontend/dist/js/{zh-CUDZ3JDv.js → zh-CNqa_15K.js} +2 -2
  139. package/package.json +14 -7
  140. package/plugins/kimi-code.json +6 -37
  141. package/frontend/dist/assets/index-BPvF-fpc.css +0 -1
  142. package/frontend/dist/assets/index-CDvTfv-t.js +0 -5
  143. package/frontend/dist/js/ArtifactSlideOutPanel-oA5Iy8Nc.js +0 -1
  144. package/frontend/dist/js/ChatPage-DdLe5r1n.js +0 -16
  145. package/frontend/dist/js/FirstTimeSetup-DL_WZABT.js +0 -1
  146. package/frontend/dist/js/LibreClawPage-CuQ8tJUW.js +0 -1
  147. package/frontend/dist/js/ModelsPage-BVfl9FU_.js +0 -2
  148. package/frontend/dist/js/PersonasPage-wP36Pd7I.js +0 -13
  149. package/frontend/dist/js/RichMessageContent-CdgQHk6Q.js +0 -3
  150. package/frontend/dist/js/SettingsModal-CLdxDdQV.js +0 -1
  151. package/frontend/dist/js/UserManagementPage-BwnBtNj1.js +0 -1
  152. package/frontend/dist/js/api-BRz6cQiD.js +0 -15
  153. package/frontend/dist/js/logger-BmpKNkls.js +0 -1
  154. package/frontend/dist/js/react-vendor-Co1u1rWb.js +0 -8
  155. package/frontend/dist/js/ui-vendor-njo77ljx.js +0 -177
  156. package/frontend/dist/js/useBaseQuery-C8AWX-Cq.js +0 -1
  157. package/frontend/dist/js/useQuery-CbYbdhch.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{f as t}from"./markdown-core-GI9BPwrB.js";var n=e(t(),1);function r(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function i(e,t,n){r(e,t),t.set(e,n)}function a(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function o(e,t){return e.get(a(e,t))}function s(e,t,n){return e.set(a(e,t),n),n}var c=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,l=/^[\\/]{2}/;function u(e,t){return t+e.replace(/\\/g,`/`)}var d=`popstate`;function f(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function p(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return y(``,{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:b(t)}return S(t,n,null,e)}function m(e={}){function t(e,t){let{pathname:n=`/`,search:r=``,hash:i=``}=x(e.location.hash.substring(1));return!n.startsWith(`/`)&&!n.startsWith(`.`)&&(n=`/`+n),y(``,{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:b(t))}function r(e,t){g(e.pathname.charAt(0)===`/`,`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)}return S(t,n,r,e)}function h(e,t){if(e===!1||e==null)throw Error(t)}function g(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function _(){return Math.random().toString(36).substring(2,10)}function v(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 y(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?x(t):t,state:n,key:t&&t.key||r||_(),mask:i}}function b({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 x(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 S(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function p(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:_.location,delta:t})}function m(e,t){s=`PUSH`;let r=f(e)?e:y(_.location,e,t);n&&n(r,e),l=u()+1;let d=v(r,l),p=_.createHref(r.mask||r);try{o.pushState(d,``,p)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(p)}a&&c&&c({action:s,location:_.location,delta:1})}function h(e,t){s=`REPLACE`;let r=f(e)?e:y(_.location,e,t);n&&n(r,e),l=u();let i=v(r,l),d=_.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:_.location,delta:0})}function g(e){return C(i,e)}let _={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(d,p),c=e,()=>{i.removeEventListener(d,p),c=null}},createHref(e){return t(i,e)},createURL:g,encodeLocation(e){let t=g(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:m,replace:h,go(e){return o.go(e)}};return _}function C(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),h(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:b(t);return i=i.replace(/ $/,`%20`),!n&&l.test(i)&&(i=r+i),new URL(i,r)}function w(e){"@babel/helpers - typeof";return w=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},w(e)}function T(e,t){if(w(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(w(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function E(e){var t=T(e,`string`);return w(t)==`symbol`?t:t+``}function D(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var O,k=(O=new WeakMap,class{constructor(e){if(i(this,O,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(o(O,this).has(e))return o(O,this).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){o(O,this).set(e,t)}}),A=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function j(e){return A.has(e)}var M=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function ee(e){return M.has(e)}function N(e){return e.index===!0}function P(e){let t={};return e.Component&&Object.assign(t,{element:n.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:n.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:n.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function te(e,t=P,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(h(e.index!==!0||!e.children,`Cannot specify children on an index route`),h(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),N(e)){let n={...e,id:s};return r[s]=ne(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=ne(n,t(n)),e.children&&(n.children=te(e.children,t,o,r,i)),n}})}function ne(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function re(e,t,n=`/`){return ie(e,t,n,!1)}function ie(e,t,n,r,i){let a=V((typeof t==`string`?x(t):t).pathname||`/`,n);if(a==null)return null;let o=i??F(e),s=null,c=ye(a);for(let e=0;s==null&&e<o.length;++e)s=ge(o[e],c,r);return s}function ae(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 F(e){let t=oe(e);return I(t),t}function oe(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;h(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 l=H([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(h(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),oe(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:me(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=ve(e.relativePath,e.caseSensitive,t===u.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 se(e.path))a(e,t,!0,n)}),t}function se(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=se(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 I(e){e.sort((e,t)=>e.score===t.score?he(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ce=/^:[\w-]+$/,le=/^:[\w-]+/,ue=3.5,de=3,fe=2,L=1,R=10,z=-2,pe=e=>e===`*`;function me(e,t){let n=e.split(`/`),r=n.length;return n.some(pe)&&(r+=z),t&&(r+=fe),n.filter(e=>!pe(e)).reduce((e,t)=>e+(ce.test(t)?de:le.test(t)?ue:t===``?L:R),r)}function he(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 ge(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?B(u,l,s.matcher,s.compiledParams):_e(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=_e({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:H([a,d.pathname]),pathnameBase:Ae(H([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=H([a,d.pathnameBase]))}return o}function _e(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ve(e.path,e.caseSensitive,e.end);return B(e,t,n,r)}function B(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function ve(e,t=!1,n=!0){g(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(/\/([\w-]+)\?(?=\/|$|\()/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 ye(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return g(!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 be({basename:e,pathname:t}){return t===`/`?e:H([e,t])}var xe=e=>c.test(e);function Se(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?x(e):e,a;return n?(n=Oe(n),a=n.startsWith(`/`)?Ce(n.substring(1),`/`):Ce(n,t)):a=t,{pathname:a,search:je(r),hash:Me(i)}}function Ce(e,t){let n=ke(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function we(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 Te(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Ee(e){let t=Te(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function De(e,t,n,r=!1){let i;typeof e==`string`?i=x(e):(i={...e},h(!i.pathname||!i.pathname.includes(`?`),we(`?`,`pathname`,`search`,i)),h(!i.pathname||!i.pathname.includes(`#`),we(`#`,`pathname`,`hash`,i)),h(!i.search||!i.search.includes(`#`),we(`#`,`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=Se(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Oe=e=>e.replace(/[\\/]{2,}/g,`/`),H=e=>Oe(e.join(`/`)),ke=e=>e.replace(/\/+$/,``),Ae=e=>ke(e).replace(/^\/*/,`/`),je=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Me=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ne=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],U=class{constructor(e,t,n,r=!1){D(this,`status`,void 0),D(this,`statusText`,void 0),D(this,`data`,void 0),D(this,`error`,void 0),D(this,`internal`,void 0),this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Pe(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Fe(e){return H(e.map(e=>e.route.path).filter(Boolean))||`/`}function Ie(e,t){let n=new URL(typeof e==`string`||e instanceof URL?e:e.url),r=typeof t==`string`?x(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 Le=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Re(e,t){let n=e;if(typeof n!=`string`||!c.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Le)try{let e=new URL(window.location.href),r=l.test(n)?new URL(u(n,e.protocol)):new URL(n),a=V(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{g(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var W=Symbol(`Uninstrumented`),ze=new WeakMap;function Be(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)=>G(await K(n.lazy,void 0,()=>e(...t),q))}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)=>G(await K(n[`lazy.middleware`],void 0,()=>t(...e),q))})}if(typeof e.loader==`function`&&n[`lazy.loader`].length>0){let t=e.loader;r.lazy=Object.assign(r.lazy||{},{loader:async(...e)=>G(await K(n[`lazy.loader`],void 0,()=>t(...e),q))})}if(typeof e.action==`function`&&n[`lazy.action`].length>0){let t=e.action;r.lazy=Object.assign(r.lazy||{},{action:async(...e)=>G(await K(n[`lazy.action`],void 0,()=>t(...e),q))})}}if(typeof t.loader==`function`&&n.loader.length>0){let e=He(t.loader),i=async(...t)=>G(await K(n.loader,Ke(t[0]),()=>e(...t),q));e.hydrate===!0&&(i.hydrate=!0),Ue(i,e),r.loader=i}if(typeof t.action==`function`&&n.action.length>0){let e=He(t.action),i=async(...t)=>G(await K(n.action,Ke(t[0]),()=>e(...t),q));Ue(i,e),r.action=i}return t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=He(e),r=async(...e)=>G(await K(n.middleware,Ke(e[0]),()=>t(...e),q));return Ue(r,t),r})),r}function Ve(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=He(e.navigate),r=async(...r)=>{let[i,a]=r,o,s={to:typeof i==`number`||typeof i==`string`?i:i?b(i):`.`,...qe(e,a??{})};return G(await K(n.navigate,s,async()=>{if(typeof i==`number`)return await t(...r);let n=We(e,e=>{o=e});try{return await t(...r)}finally{n()}},e=>({...q(e),meta:o})))};Ue(r,t),e.navigate=r}if(n.fetch.length>0){let t=He(e.fetch),r=async(...r)=>{let[i,a,o,s]=r,c;return G(await K(n.fetch,{href:o??`.`,fetcherKey:i,...qe(e,s??{})},async()=>{let n=We(e,e=>{c=e});try{return await t(...r)}finally{n()}},e=>({...q(e),meta:c})))};Ue(r,t),e.fetch=r}return e}function He(e){return e[W]??e}function Ue(e,t){e[W]=t}function We(e,t){return ze.set(e,t),()=>{ze.get(e)===t&&ze.delete(e)}}function Ge(e){let t=ze.get(e);return ze.delete(e),t}function G(e){if(e.type===`error`)throw e.value;return e.value}async function K(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=K(e,t,n,r,i,a-1),await s,h(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:(i.result={type:`error`,value:Error(`No result assigned in instrumentation chain.`)},i.innerResult=r(i.result,t),i.result)}function q(e){return e.type===`error`&&e.value instanceof Error?{status:`error`,error:e.value}:{status:`success`,error:void 0}}function Ke(e){let{request:t,context:n,params:r}=e;return{...e,request:Je(t),params:{...r},context:Ye(n)}}function qe(e,t){return{currentUrl:b(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 Je(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Ye(e){return{get:t=>e.get(t)}}var Xe,Ze,J,Qe,$e=[`POST`,`PUT`,`PATCH`,`DELETE`],et=new Set($e),tt=[`GET`,...$e],nt=new Set(tt),rt=new Set([301,302,303,307,308]),it=new Set([307,308]),at={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},ot={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},st={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},ct=`remix-router-transitions`,lt=Symbol(`ResetLoaderData`),ut=(Xe=new WeakMap,Ze=new WeakMap,J=new WeakMap,Qe=new WeakMap,class{constructor(e){i(this,Xe,void 0),i(this,Ze,void 0),i(this,J,void 0),i(this,Qe,void 0),s(Xe,this,e),s(Ze,this,F(e))}get stableRoutes(){return o(Xe,this)}get activeRoutes(){return o(J,this)??o(Xe,this)}get branches(){return o(Qe,this)??o(Ze,this)}get hasHMRRoutes(){return o(J,this)!=null}setRoutes(e){s(Xe,this,e),s(Ze,this,F(e))}setHmrRoutes(e){s(J,this,e),s(Qe,this,F(e))}commitHmrRoutes(){o(J,this)&&(s(Xe,this,o(J,this)),s(Ze,this,o(Qe,this)),s(J,this,void 0),s(Qe,this,void 0))}});function dt(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;h(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties,a=i||(()=>({}));if(e.instrumentations){let t=e.instrumentations;a=e=>({...i?.(e),...Be(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new ut(te(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||Ot,u={...e.future},d=null,f=new Set,p=null,m=null,_=null,v=null,b=e.hydrationData!=null,S=ie(s.activeRoutes,e.history.location,c,!1,s.branches),w=!1,T=null,E,D;if(S==null&&!e.patchRoutesOnNavigation){let t=Y(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Zt(s.activeRoutes);E=!0,D=!E,S=n,T={[r.id]:t}}else if(S&&!e.hydrationData&&Ze(S,s.activeRoutes,e.history.location.pathname).active&&(S=null),!S){E=!1,D=!E,S=[];let t=Ze(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(w=!0,S=t.matches)}else if(S.some(e=>e.route.lazy))E=!1,D=!E;else if(!S.some(e=>gt(e.route)))E=!0,D=!E;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=S;if(n){let e=S.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}D=!1,E=!0,r.forEach(e=>{let r=_t(e.route,t,n);D=D||r.renderFallback,E=E&&!r.shouldLoad})}let O,A={historyAction:e.history.action,location:e.history.location,matches:S,initialized:E,renderFallback:D,navigation:at,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||T,fetchers:new Map,blockers:new Map},j=`POP`,M=null,ee=!1,N,P=!1,ne=new Map,re=null,F=!1,oe=!1,se=new Set,I=new Map,ce=0,le=-1,ue=new Map,de=new Set,fe=new Map,L=new Map,R=new Set,z=new Map,pe,me=null;function he(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(pe){pe(),pe=void 0;return}g(z.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=q({currentLocation:A.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{pe=e});e.history.go(r*-1),K(i,{state:`blocked`,location:n,proceed(){K(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(A.blockers);e.set(i,st),B({blockers:e})}}),M?.resolve(),M=null;return}return Se(t,n)}),n){xn(t,ne);let e=()=>Sn(t,ne);t.addEventListener(`pagehide`,e),re=()=>t.removeEventListener(`pagehide`,e)}return A.initialized||Se(`POP`,A.location,{initialHydration:!0}),O}function ge(){d&&d(),re&&re(),f.clear(),N&&N.abort(),A.fetchers.forEach((e,t)=>Le(A.fetchers,t)),A.blockers.forEach((e,t)=>G(t))}function _e(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(A,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function B(e,t={}){e.matches&&(e.matches=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e})),A={...A,...e};let n=[],r=[];A.fetchers.forEach((e,t)=>{e.state===`idle`&&(R.has(t)?n.push(t):r.push(t))}),R.forEach(e=>{!A.fetchers.has(e)&&!I.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(A,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Le(A.fetchers,e)),r.forEach(e=>A.fetchers.delete(e))}function ve(t,n,{flushSync:r}={}){let i=A.actionData!=null&&A.navigation.formMethod!=null&&Z(A.navigation.formMethod)&&A.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?A.actionData:null;let o=n.loaderData?Jt(A.loaderData,n.loaderData,n.matches||[],n.errors):A.loaderData,c=A.blockers;c.size>0&&!F&&(c=new Map(c),c.forEach((e,t)=>c.set(t,st)));let l=F?!1:Xe(t,n.matches||A.matches),u=ee===!0||A.navigation.formMethod!=null&&Z(A.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),F||j===`POP`||(j===`PUSH`?e.history.push(t,t.state):j===`REPLACE`&&e.history.replace(t,t.state));let d;if(j===`POP`){let e=ne.get(A.location.pathname);e&&e.has(t.pathname)?d={currentLocation:A.location,nextLocation:t}:ne.has(t.pathname)&&(d={currentLocation:t,nextLocation:A.location})}else if(P){let e=ne.get(A.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),ne.set(A.location.pathname,e)),d={currentLocation:A.location,nextLocation:t}}B({...n,actionData:a,loaderData:o,historyAction:j,location:t,initialized:!0,renderFallback:!1,navigation:at,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),j=`POP`,ee=!1,P=!1,F=!1,oe=!1,M?.resolve(),M=null,me?.resolve(),me=null}async function ye(t,n){if(M?.resolve(),M=null,typeof t==`number`){M||(M=Cn());let n=M.promise;return e.history.go(t),n}let r=Ge(O),{path:i,submission:a,error:o}=mt(!1,pt(A.location,A.matches,c,t,n?.fromRouteId,n?.relative),n),s;n?.mask&&(s={pathname:``,search:``,hash:``,...typeof n.mask==`string`?x(n.mask):{...A.location.mask,...n.mask}});let l=A.location,u=y(l,i,n&&n.state,void 0,s);u={...u,...e.history.encodeLocation(u)};let d=n&&n.replace!=null?n.replace:void 0,f=`PUSH`;d===!0?f=`REPLACE`:d===!1||a!=null&&Z(a.formMethod)&&a.formAction===A.location.pathname+A.location.search&&(f=`REPLACE`);let p=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,m=(n&&n.flushSync)===!0,h=q({currentLocation:l,nextLocation:u,historyAction:f});if(h){K(h,{state:`blocked`,location:u,proceed(){K(h,{state:`proceeding`,proceed:void 0,reset:void 0,location:u}),ye(t,n)},reset(){let e=new Map(A.blockers);e.set(h,st),B({blockers:e})}});return}await Se(f,u,{submission:a,pendingError:o,preventScrollReset:p,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:m,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate,instrumentationNavigateMetaReceiver:r})}function be(){me||(me=Cn()),Me(),B({revalidation:`loading`});let e=me.promise;return A.navigation.state===`submitting`?e:A.navigation.state===`idle`?(Se(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),e):(Se(j||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:P===!0}),e)}async function Se(t,n,r){N&&N.abort(),N=null,j=t,F=(r&&r.startUninterruptedRevalidation)===!0,Ye(A.location,A.matches),ee=(r&&r.preventScrollReset)===!0,P=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&A.matches&&A.matches.length>0&&!w?A.matches:ie(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&A.initialized&&!oe&&en(A.location,n)&&!(r&&r.submission&&Z(r.submission.formMethod))){ve(n,{matches:a},{flushSync:o});return}let l=Ze(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),r?.instrumentationNavigateMetaReceiver){let t=mn(e.history,n,a);r.instrumentationNavigateMetaReceiver(t)}if(!a){let{error:e,notFoundMatches:t,route:r}=Ke(n.pathname);ve(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;N=new AbortController;let d=Ut(e.history,n,N.signal,r&&r.submission),f=e.getContext?await e.getContext():new k,p;if(r&&r.pendingError)p=[Xt(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&Z(r.submission.formMethod)){let i=await Ce(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(X(t)&&Pe(t.error)&&t.error.status===404){N=null,ve(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=gn(n,a,t,r.submission),o=!1,l.active=!1,d=Ut(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await we(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(N=null,ve(n,{matches:h||a,...Yt(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function Ce(t,n,i,l,u,d,f,p,m={}){if(Me(),B({navigation:_n(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await J(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Zt(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=Xt(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}else if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Ke(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=pn(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:Y(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await Ae(t,n,Pt(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(on(h)){let n;return n=m&&m.replace!=null?m.replace:Ht(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===A.location.pathname+A.location.search,await ke(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(X(h)){let e=Xt(l,g.route.id);return(m&&m.replace)!==!0&&(j=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function we(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||gn(n,i,l,p),x=p||m||hn(b),S=!F&&!g;if(d){if(S){let e=Te(v);B({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await J(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Zt(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Xt(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Ke(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:w,revalidatingFetchers:T}=ht(t,u,a,o,e.history,A,i,x,n,g?[]:r,g===!0,oe,se,R,fe,de,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(le=++ce,!e.dataStrategy&&!w.some(e=>e.shouldLoad)&&!w.some(e=>e.route.middleware&&e.route.middleware.length>0)&&T.length===0){let e=new Map(A.fetchers),t=He(e);return ve(n,{matches:i,loaderData:{},errors:v&&X(v[1])?{[v[0]]:v[1].error}:null,...Yt(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=Te(v);t!==void 0&&(e.actionData=t)}T.length>0&&(e.fetchers=Ee(T)),B(e,{flushSync:_})}T.forEach(e=>{W(e.key),e.controller&&I.set(e.key,e.controller)});let E=()=>T.forEach(e=>W(e.key));N&&N.signal.addEventListener(`abort`,E);let{loaderResults:D,fetcherResults:O}=await je(w,T,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};N&&N.signal.removeEventListener(`abort`,E),T.forEach(e=>I.delete(e.key));let k=Qt(D);if(k)return await ke(t,k.result,!0,{replace:h}),{shortCircuited:!0};if(k=Qt(O),k)return de.add(k.key),await ke(t,k.result,!0,{replace:h}),{shortCircuited:!0};let j=new Map(A.fetchers),{loaderData:M,errors:ee}=qt(A,i,D,v,T,O,j);g&&A.errors&&(ee={...A.errors,...ee});let P=He(j),te=Ue(le,j),ne=P||te||T.length>0;return{matches:i,loaderData:M,errors:ee,...ne?{workingFetchers:j}:{}}}function Te(e){if(e&&!X(e[1]))return{[e[0]]:e[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function Ee(e){let t=new Map(A.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=vn(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function De(t,n,r,i){W(t);let a=(i&&i.flushSync)===!0,o=Ge(O),l=s.activeRoutes,u=pt(A.location,A.matches,c,r,n,i?.relative),d=ie(l,u,c,!1,s.branches),f=Ze(d,l,u);if(f.active&&f.matches&&(d=f.matches),o&&o(mn(e.history,u,d)),!d){U(t,n,Y(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=mt(!0,u,i);if(h){U(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new k,_=(i&&i.preventScrollReset)===!0;if(m&&Z(m.formMethod)){await Oe(t,n,p,d,g,f.active,a,_,m,i&&i.defaultShouldRevalidate);return}fe.set(t,{routeId:n,path:p}),await H(t,n,p,d,g,f.active,a,_,m)}async function Oe(t,n,i,l,u,d,f,p,m,g){Me(),fe.delete(t),Ne(t,yn(m,A.fetchers.get(t)),{flushSync:f});let _=new AbortController,v=Ut(e.history,i,_.signal,m);if(d){let e=await J(l,new URL(v.url).pathname,v.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){U(t,n,e.error,{flushSync:f});return}else if(e.matches)l=e.matches;else{U(t,n,Y(404,{pathname:i}),{flushSync:f});return}}let y=pn(l,i);if(!y.route.action&&!y.route.lazy){U(t,n,Y(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}I.set(t,_);let b=ce,x=Pt(a,o,v,i,l,y,r,u),S=await Ae(v,i,x,u,t),C=S[y.route.id];if(!C){for(let e of x)if(S[e.route.id]){C=S[e.route.id];break}}if(v.signal.aborted){I.get(t)===_&&I.delete(t);return}if(R.has(t)){if(on(C)||X(C)){Ne(t,bn(void 0));return}}else{if(on(C))if(I.delete(t),le>b){Ne(t,bn(void 0));return}else return de.add(t),Ne(t,vn(m)),ke(v,C,!1,{fetcherSubmission:m,preventScrollReset:p});if(X(C)){U(t,n,C.error);return}}let w=A.navigation.location||A.location,T=Ut(e.history,w,_.signal),E=s.activeRoutes,D=A.navigation.state===`idle`?A.matches:ie(E,A.navigation.location,c,!1,s.branches);h(D,`Didn't find any matches after fetcher action`);let O=++ce;ue.set(t,O);let{dsMatches:k,revalidatingFetchers:M}=ht(T,u,a,o,e.history,A,D,m,w,r,!1,oe,se,R,fe,de,E,c,e.patchRoutesOnNavigation!=null,s.branches,[y.route.id,C],g),ee=vn(m,C.data),P=new Map(A.fetchers);P.set(t,ee),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=P.get(t),r=vn(void 0,n?n.data:void 0);P.set(t,r),W(t),e.controller&&I.set(t,e.controller)}),B({fetchers:P});let te=()=>M.forEach(e=>W(e.key));_.signal.addEventListener(`abort`,te);let{loaderResults:ne,fetcherResults:re}=await je(k,M,T,w,u);if(_.signal.aborted)return;_.signal.removeEventListener(`abort`,te),ue.delete(t),I.delete(t),M.forEach(e=>I.delete(e.key));let ae=A.fetchers.has(t),F=e=>{if(!ae)return e;let n=new Map(e.fetchers);return n.set(t,bn(C.data)),{...e,fetchers:n}},L=Qt(ne);if(L)return A=F(A),ke(T,L.result,!1,{preventScrollReset:p});if(L=Qt(re),L)return de.add(L.key),A=F(A),ke(T,L.result,!1,{preventScrollReset:p});let z=new Map(A.fetchers);ae&&z.set(t,bn(C.data));let{loaderData:pe,errors:me}=qt(A,D,ne,void 0,M,re,z);Ue(O,z),A.navigation.state===`loading`&&O>le?(h(j,`Expected pending action`),N&&N.abort(),ve(A.navigation.location,{matches:D,loaderData:pe,errors:me,fetchers:z})):(B({errors:me,loaderData:Jt(A.loaderData,pe,D,me),fetchers:z}),oe=!1)}async function H(t,n,i,s,c,l,u,d,f){let p=A.fetchers.get(t);Ne(t,vn(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=Ut(e.history,i,m.signal);if(l){let e=await J(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){U(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{U(t,n,Y(404,{pathname:i}),{flushSync:u});return}}let g=pn(s,i);I.set(t,m);let _=ce,v=await Ae(h,i,Pt(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(I.get(t)===m&&I.delete(t),!h.signal.aborted){if(R.has(t)){Ne(t,bn(void 0));return}if(on(y))if(le>_){Ne(t,bn(void 0));return}else{de.add(t),await ke(h,y,!1,{preventScrollReset:d});return}if(X(y)){U(t,n,y.error);return}Ne(t,bn(y.data))}}async function ke(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(M?.resolve(),M=null),i.response.headers.has(`X-Remix-Revalidate`)&&(oe=!0);let d=i.response.headers.get(`Location`);h(d,`Expected a Location header on the redirect Response`),d=Ht(d,new URL(r.url),c,e.history);let f=y(A.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(xe(d)){let n=C(t,d,!0);e=n.origin!==t.location.origin||V(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}N=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:g,formEncType:_}=A.navigation;!o&&!s&&m&&g&&_&&(o=hn(A.navigation));let v=o||s;it.has(i.response.status)&&v&&Z(v.formMethod)?await Se(p,f,{submission:{...v,formAction:d},preventScrollReset:l||ee,enableViewTransition:a?P:void 0}):await Se(p,f,{overrideNavigation:gn(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||ee,enableViewTransition:a?P:void 0})}async function Ae(e,t,n,r,i){let a,o={};try{a=await Ft(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!Z(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!A.loaderData.hasOwnProperty(e.route.id)&&(!A.errors||!A.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(an(r)){let i=r.result;o[t]={type:`redirect`,response:zt(i,e,t,n,c)}}else o[t]=await Rt(r);return o}async function je(e,t,n,r,i){let a=Ae(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Ae(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:Y(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Me(){oe=!0,fe.forEach((e,t)=>{I.has(t)&&se.add(t),W(t)})}function Ne(e,t,n={}){let r=new Map(A.fetchers);r.set(e,t),B({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function U(e,t,n,r={}){let i=Xt(A.matches,t),a=new Map(A.fetchers);Le(a,e),B({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function Fe(e){return L.set(e,(L.get(e)||0)+1),R.has(e)&&R.delete(e),A.fetchers.get(e)||ot}function Ie(e,t){W(e,t?.reason),Ne(e,bn(null))}function Le(e,t){let n=A.fetchers.get(t);I.has(t)&&!(n&&n.state===`loading`&&ue.has(t))&&W(t),fe.delete(t),ue.delete(t),de.delete(t),R.delete(t),se.delete(t),e.delete(t)}function Re(e){let t=(L.get(e)||0)-1;t<=0?(L.delete(e),R.add(e)):L.set(e,t),B({fetchers:new Map(A.fetchers)})}function W(e,t){let n=I.get(e);n&&(n.abort(t),I.delete(e))}function ze(e,t){for(let n of e){let e=t.get(n);h(e,`Expected fetcher: ${n}`);let r=bn(e.data);t.set(n,r)}}function He(e){let t=[],n=!1;for(let r of de){let i=e.get(r);h(i,`Expected fetcher: ${r}`),i.state===`loading`&&(de.delete(r),t.push(r),n=!0)}return ze(t,e),n}function Ue(e,t){let n=[];for(let[r,i]of ue)if(i<e){let e=t.get(r);h(e,`Expected fetcher: ${r}`),e.state===`loading`&&(W(r),ue.delete(r),n.push(r))}return ze(n,t),n.length>0}function We(e,t){let n=A.blockers.get(e)||st;return z.get(e)!==t&&z.set(e,t),n}function G(e){A.blockers.delete(e),z.delete(e)}function K(e,t){let n=A.blockers.get(e)||st;h(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(A.blockers);r.set(e,t),B({blockers:r})}function q({currentLocation:e,nextLocation:t,historyAction:n}){if(z.size===0)return;z.size>1&&g(!1,`A router only supports one blocker at a time`);let r=Array.from(z.entries()),[i,a]=r[r.length-1],o=A.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Ke(e){let t=Y(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=Zt(n);return{notFoundMatches:r,route:i,error:t}}function qe(e,t,n){if(m=e,v=t,_=n||null,!b&&A.navigation===at){b=!0;let e=Xe(A.location,A.matches);e!=null&&B({restoreScrollPosition:e})}return()=>{m=null,v=null,_=null}}function Je(e,t){return _&&_(e,t.map(e=>ae(e,A.loaderData)))||e.key}function Ye(e,t){if(m&&v){let n=Je(e,t);m[n]=v()}}function Xe(e,t){if(m){let n=Je(e,t),r=m[n];if(typeof r==`number`)return r}return null}function Ze(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:ie(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:ie(n,r,c,!0,e)}}return{active:!1,matches:null}}async function J(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||xt(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=ie(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=ie(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&Qe(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||(f=ie(s.activeRoutes,n,c,!0,u)),!f||Qe(l,f))return{type:`success`,matches:null};l=f}}function Qe(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function $e(e){o={},s.setHmrRoutes(te(e,a,void 0,o))}function et(e,t,n=!1){xt(e,t,s,o,a,n),s.hasHMRRoutes||B({})}return O={get basename(){return c},get future(){return u},get state(){return A},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:he,subscribe:_e,enableScrollRestoration:qe,navigate:ye,fetch:De,revalidate:be,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Fe,resetFetcher:Ie,deleteFetcher:Re,dispose:ge,getBlocker:We,deleteBlocker:G,patchRoutes:et,_internalFetchControllers:I,_internalSetRoutes:$e,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){B(e)}},e.instrumentations&&(O=Ve(O,e.instrumentations.map(e=>e.router).filter(Boolean))),O}function ft(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function pt(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=De(r||`.`,Ee(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=fn(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=be({basename:n,pathname:c.pathname})),b(c)}function mt(e,t,n){if(!n||!ft(n))return{path:t};if(n.formMethod&&!dn(n.formMethod))return{path:t,error:Y(405,{method:n.formMethod})};let r=()=>({path:t,error:Y(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=$t(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!Z(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}}}else if(n.formEncType===`application/json`){if(!Z(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()}}}h(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=Wt(n.formData),s=n.formData;else if(n.body instanceof FormData)o=Wt(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=Gt(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=Gt(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(Z(c.formMethod))return{path:t,submission:c};let l=x(t);return e&&l.search&&fn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:b(l),submission:c}}function ht(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?X(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&X(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=Fe(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!gt(s))f=!1;else if(u){let{shouldLoad:e}=_t(s,a.loaderData,a.errors);f=e}else vt(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return Nt(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?yt(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p};return Nt(n,r,e,c,k,i,l,t,bt(i,m),m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=ie(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=pn(b,e.path),C=new AbortController,w=Ut(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=Pt(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=Pt(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:D?!1:d;let a={...O,defaultShouldRevalidate:i};bt(S,a)&&(T=Pt(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function gt(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function _t(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!gt(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 vt(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function yt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function bt(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function xt(e,t,n,r,i,a){let o;if(e){let t=r[e];h(t,`No route found to patch children into: routeId = ${e}`),t.children||(t.children=[]),o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>St(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=te(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]=te([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 St(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?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>St(e,t)))??!1:!1}var Ct=new WeakMap,wt=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(h(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=Ct.get(i);o||(o={},Ct.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=j(e),n=i[e]!==void 0;if(t)g(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)g(!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},Tt=new WeakMap;function Et(e,t,n,r,i){let a=n[e.id];if(h(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=Tt.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{h(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=ee(e),o=a[e]!==void 0;i?g(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?g(!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 Tt.set(a,n),n.catch(()=>{}),{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=wt({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function Dt(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 Ot(e){return e.matches.some(e=>e.route.middleware)?kt(e,()=>Dt(e)):Dt(e)}function kt(e,t){return At(e,t,e=>{if(un(e))throw e;return e},nn,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{[Xt(r,a).route.id]:{type:`error`,result:t}}}}}async function At(e,t,n,r,i){let{matches:a,...o}=e;return await jt(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function jt(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 jt(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 Mt(e,t,n,r,i){let a=wt({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=Et(r.route,Z(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Nt(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Mt(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?bt(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?bt(a,{...l,defaultShouldRevalidate:e}):bt(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!Z(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(Z(n.method)||!p)?It({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 Pt(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?Nt(e,t,n,r,Fe(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Mt(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function Ft(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:Ie(t,n),pattern:Fe(r),params:r[0].params,context:a,matches:r},c=o?()=>{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=s;return kt(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function It({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=Z(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:Ie(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 Y(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}else if(t)c=await f(t);else{let t=new URL(e.url);throw Y(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function Lt(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 Rt(e){let{result:t,type:n}=e;if(cn(t)){let e;try{e=await Lt(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new U(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?sn(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:tn(t),statusCode:Pe(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:Pe(t)?t.status:void 0}:sn(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 zt(e,t,n,r,i){let a=e.headers.get(`Location`);if(h(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!xe(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=pt(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var Bt=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Vt(e){try{return Bt.includes(new URL(e).protocol)}catch{return!1}}function Ht(e,t,n,r){if(xe(e)){let r=e,i=l.test(r)?new URL(u(r,t.protocol)):new URL(r);if(Vt(i.toString()))throw Error(`Invalid redirect location`);let a=V(i.pathname,n)!=null;if(i.origin===t.origin&&a)return Oe(i.pathname)+i.search+i.hash}try{if(Vt(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function Ut(e,t,n,r){let i=e.createURL($t(t)).toString(),a={signal:n};if(r&&Z(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)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=Wt(r.formData):a.body=r.formData}return new Request(i,a)}function Wt(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function Gt(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Kt(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&X(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(h(!on(f),`Cannot handle redirect results in processLoaderData`),X(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o=o||{},i)o[d]=t;else{let n=Xt(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=lt),c||(c=!0,s=Pe(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function qt(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=Kt(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(h(s,`Did not find corresponding fetcher result`),X(s)){let t=Xt(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(on(s))h(!1,`Unhandled fetcher revalidation redirect`);else{let e=bn(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function Jt(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==lt).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function Yt(e){return e?X(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Xt(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 Zt(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 Y(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 U(e||500,o,Error(s),!0)}function Qt(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(on(r))return{key:n,result:r}}}function $t(e){return b({...typeof e==`string`?x(e):e,hash:``})}function en(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function tn(e){return new U(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function nn(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&rn(t))}function rn(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function an(e){return cn(e.result)&&rt.has(e.result.status)}function X(e){return e.type===`error`}function on(e){return(e&&e.type)===`redirect`}function sn(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function cn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function ln(e){return rt.has(e)}function un(e){return cn(e)&&ln(e.status)&&e.headers.has(`Location`)}function dn(e){return nt.has(e.toUpperCase())}function Z(e){return et.has(e.toUpperCase())}function fn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function pn(e,t){let n=typeof t==`string`?x(t).search:t.search;if(e[e.length-1].route.index&&fn(n||``))return e[e.length-1];let r=Te(e);return r[r.length-1]}function mn(e,t,n){return{url:Ie(e.createURL(t),t),pattern:n?Fe(n):``,params:n?.[0]?.params?{...n[0].params}:{}}}function hn(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 gn(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 _n(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 vn(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 yn(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 bn(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 xn(e,t){try{let n=e.sessionStorage.getItem(ct);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 Sn(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(ct,JSON.stringify(n))}catch(e){g(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function Cn(){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 wn=n.createContext(null);wn.displayName=`DataRouter`;var Tn=n.createContext(null);Tn.displayName=`DataRouterState`;var En=n.createContext(!1);function Dn(){return n.useContext(En)}var On=n.createContext({isTransitioning:!1});On.displayName=`ViewTransition`;var kn=n.createContext(new Map);kn.displayName=`Fetchers`;var An=n.createContext(null);An.displayName=`Await`;var Q=n.createContext(null);Q.displayName=`Navigation`;var jn=n.createContext(null);jn.displayName=`Location`;var Mn=n.createContext({outlet:null,matches:[],isDataRoute:!1});Mn.displayName=`Route`;var Nn=n.createContext(null);Nn.displayName=`RouteError`;var Pn=`REACT_ROUTER_ERROR`,Fn=`REDIRECT`,In=`ROUTE_ERROR_RESPONSE`;function Ln(e){if(e.startsWith(`${Pn}:${Fn}:{`))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 Rn(e){if(e.startsWith(`${Pn}:${In}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new U(t.status,t.statusText,t.data)}catch{}}var zn;function Bn(e,{relative:t}={}){h(Vn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:r,navigator:i}=n.useContext(Q),{hash:a,pathname:o,search:s}=Kn(e,{relative:t}),c=o;return r!==`/`&&(c=o===`/`?r:H([r,o])),i.createHref({pathname:c,search:s,hash:a})}function Vn(){return n.useContext(jn)!=null}function $(){return h(Vn(),`useLocation() may be used only in the context of a <Router> component.`),n.useContext(jn).location}var Hn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Un(){let{isDataRoute:e}=n.useContext(Mn);return e?pr():Wn()}function Wn(){h(Vn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=n.useContext(wn),{basename:t,navigator:r}=n.useContext(Q),{matches:i}=n.useContext(Mn),{pathname:a}=$(),o=JSON.stringify(Ee(i)),s=n.useRef(!1);return n.useLayoutEffect(()=>{s.current=!0}),n.useCallback((n,i={})=>{if(g(s.current,Hn),!s.current)return;if(typeof n==`number`){r.go(n);return}let c=De(n,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:H([t,c.pathname])),(i.replace?r.replace:r.push)(c,i.state,i)},[t,r,o,a,e])}n.createContext(null);function Gn(){let{matches:e}=n.useContext(Mn);return e[e.length-1]?.params??{}}function Kn(e,{relative:t}={}){let{matches:r}=n.useContext(Mn),{pathname:i}=$(),a=JSON.stringify(Ee(r));return n.useMemo(()=>De(e,JSON.parse(a),i,t===`path`),[e,a,i,t])}function qn(e,t){return Jn(e,t)}function Jn(e,t,r){h(Vn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:i}=n.useContext(Q),{matches:a}=n.useContext(Mn),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:`/`;o&&o.route;let l=$(),u;if(t){let e=typeof t==`string`?x(t):t;h(c===`/`||e.pathname?.startsWith(c),`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 "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),u=e}else u=l;let d=u.pathname||`/`,f=d;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p=r&&r.state.matches.length?r.state.matches.map(e=>Object.assign(e,{route:r.manifest[e.route.id]||e.route})):re(e,{pathname:f}),m=tr(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:H([c,i.encodeLocation?i.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:H([c,i.encodeLocation?i.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),a,r);return t&&m?n.createElement(jn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...u},navigationType:`POP`}},m):m}function Yn(){let e=ur(),t=Pe(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null;return n.createElement(n.Fragment,null,n.createElement(`h2`,null,`Unexpected Application Error!`),n.createElement(`h3`,{style:{fontStyle:`italic`}},t),r?n.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},r):null,null)}var Xn=n.createElement(Yn,null),Zn=(zn=class extends n.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}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=Rn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:n.createElement(Mn.Provider,{value:this.props.routeContext},n.createElement(Nn.Provider,{value:e,children:this.props.component}));return this.context?n.createElement($n,{error:e},t):t}},D(zn,`contextType`,En),zn),Qn=new WeakMap;function $n({children:e,error:t}){let{basename:r}=n.useContext(Q);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ln(t.digest);if(e){let i=Qn.get(t);if(i)throw i;let a=Re(e.location,r),o=a.absoluteURL||a.to;if(Vt(o))throw Error(`Invalid redirect location`);if(Le&&!Qn.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 Qn.set(t,n),n}return n.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function er({routeContext:e,match:t,children:r}){let i=n.useContext(wn);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),n.createElement(Mn.Provider,{value:e},r)}function tr(e,t=[],r){let i=r?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let a=e,o=i?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);h(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(r&&i){s=i.renderFallback;for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:n}=i,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!n||n[t.route.id]===void 0);if(t.route.lazy||o){r.isStatic&&(s=!0),a=c>=0?a.slice(0,c+1):[a[0]];break}}}}let l=r?.onError,u=i&&l?(e,t)=>{l(e,{location:i.location,params:i.matches?.[0]?.params??{},pattern:Fe(i.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,l)=>{let d,f=!1,p=null,m=null;i&&(d=o&&r.route.id?o[r.route.id]:void 0,p=r.route.errorElement||Xn,s&&(c<0&&l===0?(hr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===l&&(f=!0,m=r.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,l+1)),g=()=>{let t;return t=d?p:f?m:r.route.Component?n.createElement(r.route.Component,null):r.route.element?r.route.element:e,n.createElement(er,{match:r,routeContext:{outlet:e,matches:h,isDataRoute:i!=null},children:t})};return i&&(r.route.ErrorBoundary||r.route.errorElement||l===0)?n.createElement(Zn,{location:i.location,revalidation:i.revalidation,component:p,error:d,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):g()},null)}function nr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rr(e){let t=n.useContext(wn);return h(t,nr(e)),t}function ir(e){let t=n.useContext(Tn);return h(t,nr(e)),t}function ar(e){let t=n.useContext(Mn);return h(t,nr(e)),t}function or(e){let t=ar(e),n=t.matches[t.matches.length-1];return h(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function sr(){return or(`useRouteId`)}function cr(){let e=ir(`useNavigation`);return n.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function lr(){let{matches:e,loaderData:t}=ir(`useMatches`);return n.useMemo(()=>e.map(e=>ae(e,t)),[e,t])}function ur(){let e=n.useContext(Nn),t=ir(`useRouteError`),r=or(`useRouteError`);return e===void 0?t.errors?.[r]:e}var dr=0;function fr(e){let{router:t,basename:r}=rr(`useBlocker`),i=ir(`useBlocker`),[a,o]=n.useState(``),s=n.useCallback(t=>{if(typeof e!=`function`)return!!e;if(r===`/`)return e(t);let{currentLocation:n,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...n,pathname:V(n.pathname,r)||n.pathname},nextLocation:{...i,pathname:V(i.pathname,r)||i.pathname},historyAction:a})},[r,e]);return n.useEffect(()=>{let e=String(++dr);return o(e),()=>t.deleteBlocker(e)},[t]),n.useEffect(()=>{a!==``&&t.getBlocker(a,s)},[t,a,s]),a&&i.blockers.has(a)?i.blockers.get(a):st}function pr(){let{router:e}=rr(`useNavigate`),t=or(`useNavigate`),r=n.useRef(!1);return n.useLayoutEffect(()=>{r.current=!0}),n.useCallback(async(n,i={})=>{g(r.current,Hn),r.current&&(typeof n==`number`?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...i}))},[e,t])}var mr={};function hr(e,t,n){!t&&!mr[e]&&(mr[e]=!0,g(!1,n))}var gr={};function _r(e,t){!e&&!gr[t]&&(gr[t]=!0,console.warn(t))}var vr=[`HydrateFallback`,`hydrateFallbackElement`],yr=class{constructor(){D(this,`status`,`pending`),D(this,`promise`,void 0),D(this,`resolve`,void 0),D(this,`reject`,void 0),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 br({router:e,flushSync:t,onError:r,useTransitions:i}){i=Dn()||i;let[a,o]=n.useState(e.state),[s,c]=(0,n.useOptimistic)(a),[l,u]=n.useState(),[d,f]=n.useState({isTransitioning:!1}),[p,m]=n.useState(),[h,g]=n.useState(),[_,v]=n.useState(),y=n.useRef(new Map),b=n.useCallback((a,{deletedFetchers:s,newErrors:l,flushSync:d,viewTransitionOpts:_})=>{l&&r&&Object.values(l).forEach(e=>r(e,{location:a.location,params:a.matches[0]?.params??{},pattern:Fe(a.matches)})),a.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),s.forEach(e=>y.current.delete(e)),_r(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 b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(_r(_==null||b,"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."),!_||!b){t&&d?t(()=>o(a)):i===!1?o(a):n.startTransition(()=>{i===!0&&c(e=>xr(e,a)),o(a)});return}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(()=>o(a))});n.finished.finally(()=>{t(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})})}),t(()=>g(n));return}h?(p?.resolve(),h.skipTransition(),v({state:a,currentLocation:_.currentLocation,nextLocation:_.nextLocation})):(u(a),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}))},[e.window,t,h,p,i,c,r]);n.useLayoutEffect(()=>e.subscribe(b),[e,b]),n.useEffect(()=>{d.isTransitioning&&!d.flushSync&&m(new yr)},[d]),n.useEffect(()=>{if(p&&l&&e.window){let t=l,r=p.promise,a=e.window.document.startViewTransition(async()=>{i===!1?o(t):n.startTransition(()=>{i===!0&&c(e=>xr(e,t)),o(t)}),await r});a.finished.finally(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})}),g(a)}},[l,p,e.window,i,c]),n.useEffect(()=>{p&&l&&s.location.key===l.location.key&&p.resolve()},[p,h,s.location,l]),n.useEffect(()=>{!d.isTransitioning&&_&&(u(_.state),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}),v(void 0))},[d.isTransitioning,_]);let x=n.useMemo(()=>({createHref:e.createHref,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]),S=e.basename||`/`,C=n.useMemo(()=>({router:e,navigator:x,static:!1,basename:S,onError:r}),[e,x,S,r]);return n.createElement(n.Fragment,null,n.createElement(wn.Provider,{value:C},n.createElement(Tn.Provider,{value:s},n.createElement(kn.Provider,{value:y.current},n.createElement(On.Provider,{value:d},n.createElement(Er,{basename:S,location:s.location,navigationType:s.historyAction,navigator:x,useTransitions:i},n.createElement(Sr,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:r})))))),null)}function xr(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 Sr=n.memo(Cr);function Cr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Jn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function wr({to:e,replace:t,state:r,relative:i}){h(Vn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:a}=n.useContext(Q);g(!a,`<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}=n.useContext(Mn),{pathname:s}=$(),c=Un(),l=De(e,Ee(o),s,i===`path`),u=JSON.stringify(l);return n.useEffect(()=>{c(JSON.parse(u),{replace:t,state:r,relative:i})},[c,u,i,t,r]),null}function Tr(e){h(!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 Er({basename:e=`/`,children:t=null,location:r,navigationType:i=`POP`,navigator:a,static:o=!1,useTransitions:s}){h(!Vn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),l=n.useMemo(()=>({basename:c,navigator:a,static:o,useTransitions:s,future:{}}),[c,a,o,s]);typeof r==`string`&&(r=x(r));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`,mask:_}=r,v=n.useMemo(()=>{let e=V(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m,mask:_},navigationType:i}},[c,u,d,f,p,m,i,_]);return g(v!=null,`<Router basename="${c}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:n.createElement(Q.Provider,{value:l},n.createElement(jn.Provider,{children:t,value:v}))}function Dr({children:e,location:t}){return qn(Or(e),t)}n.Component;function Or(e,t=[]){let r=[];return n.Children.forEach(e,(e,i)=>{if(!n.isValidElement(e))return;let a=[...t,i];if(e.type===n.Fragment){r.push.apply(r,Or(e.props.children,a));return}h(e.type===Tr,`[${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 o=e.props;h(!o.index||!o.children,`An index route cannot have child routes.`);let s={id:o.id||a.join(`-`),caseSensitive:o.caseSensitive,element:o.element,Component:o.Component,index:o.index,path:o.path,middleware:o.middleware,loader:o.loader,action:o.action,hydrateFallbackElement:o.hydrateFallbackElement,HydrateFallback:o.HydrateFallback,errorElement:o.errorElement,ErrorBoundary:o.ErrorBoundary,shouldRevalidate:o.shouldRevalidate,handle:o.handle,lazy:o.lazy};o.children&&(s.children=Or(o.children,a)),r.push(s)}),r}var kr=`application/x-www-form-urlencoded`;function Ar(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function jr(e){return Ar(e)&&e.tagName.toLowerCase()===`button`}function Mr(e){return Ar(e)&&e.tagName.toLowerCase()===`form`}function Nr(e){return Ar(e)&&e.tagName.toLowerCase()===`input`}function Pr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Fr(e,t){return e.button===0&&(!t||t===`_self`)&&!Pr(e)}var Ir=null;function Lr(){if(Ir===null)try{new FormData(document.createElement(`form`),0),Ir=!1}catch{Ir=!0}return Ir}var Rr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function zr(e){return e!=null&&!Rr.has(e)?(g(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${kr}"`),null):e}function Br(e,t){let n,r,i,a,o;if(Mr(e)){let o=e.getAttribute(`action`);r=o?V(o,t):null,n=e.getAttribute(`method`)||`get`,i=zr(e.getAttribute(`enctype`))||kr,a=new FormData(e)}else if(jr(e)||Nr(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=zr(e.getAttribute(`formenctype`))||zr(o.getAttribute(`enctype`))||kr,a=new FormData(o,e),!Lr()){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(Ar(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=kr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}var Vr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Hr=/[&><\u2028\u2029]/g;function Ur(e){return e.replace(Hr,e=>Vr[e])}function Wr(e,t){if(e===!1||e==null)throw Error(t)}var Gr=`modulepreload`,Kr=function(e){return`/`+e},qr={},Jr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=Kr(t,n),t=s(t),t in qr)return;qr[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Gr,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};async function Yr(e,t){if(e.id in t)return t[e.id];try{let n=await Jr(()=>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 Xr(e){return e!=null&&typeof e.page==`string`}function Zr(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 Qr(e,t,n){return ri((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Yr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Zr).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:!0,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 ei(e,t,{includeHydrateFallback:n}={}){return ti(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 ti(e){return[...new Set(e)]}function ni(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ri(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Xr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ni(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function ii(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname.endsWith(`/`)?n.pathname=`${n.pathname}_.${t}`:n.pathname=`${n.pathname}.${t}`,n}function ai(){let e=n.useContext(wn);return Wr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function oi(){let e=n.useContext(Tn);return Wr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var si=n.createContext(void 0);si.displayName=`FrameworkContext`;function ci(){let e=n.useContext(si);return Wr(e,`You must render this element inside a <HydratedRouter> element`),e}function li(e,t){let r=n.useContext(si),[i,a]=n.useState(!1),[o,s]=n.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=n.useRef(null);n.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),n.useEffect(()=>{if(i){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[i]);let m=()=>{a(!0)},h=()=>{a(!1),s(!1)};return r?e===`intent`?[o,p,{onFocus:ui(c,m),onBlur:ui(l,h),onMouseEnter:ui(u,m),onMouseLeave:ui(d,h),onTouchStart:ui(f,m)}]:[o,p,{}]:[!1,p,{}]}function ui(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function di({page:e,...t}){let r=Dn(),{nonce:i}=ci(),{router:a}=ai(),o=n.useMemo(()=>re(a.routes,e,a.basename),[a.routes,e,a.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),r?n.createElement(pi,{page:e,matches:o,...t}):n.createElement(mi,{page:e,matches:o,...t})):null}function fi(e){let{manifest:t,routeModules:r}=ci(),[i,a]=n.useState([]);return n.useEffect(()=>{let n=!1;return Qr(e,t,r).then(e=>{n||a(e)}),()=>{n=!0}},[e,t,r]),i}function pi({page:e,matches:t,...r}){let i=$(),a=n.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=ii(e,`rsc`),r=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?r=!0:a.push(e.route.id);return r&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,i,t]);return n.createElement(n.Fragment,null,a.map(e=>n.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...r})))}function mi({page:e,matches:t,...r}){let i=$(),{manifest:a,routeModules:o}=ci(),{loaderData:s,matches:c}=oi(),l=n.useMemo(()=>$r(e,t,c,a,i,`data`),[e,t,c,a,i]),u=n.useMemo(()=>$r(e,t,c,a,i,`assets`),[e,t,c,a,i]),d=n.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=new Set,r=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!l.some(t=>t.route.id===e.route.id)&&e.route.id in s&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?r=!0:n.add(e.route.id))}),n.size===0)return[];let c=ii(e,`data`);return r&&n.size>0&&c.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[c.pathname+c.search]},[s,i,a,l,t,e,o]),f=n.useMemo(()=>ei(u,a),[u,a]),p=fi(u);return n.createElement(n.Fragment,null,d.map(e=>n.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...r})),f.map(e=>n.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...r})),p.map(({key:e,link:t})=>n.createElement(`link`,{key:e,nonce:r.nonce,...t,crossOrigin:t.crossOrigin??r.crossOrigin})))}function hi(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var gi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{gi&&(window.__reactRouterVersion=`8.3.0`)}catch{}function _i(e,t){return dt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:p({window:t?.window}),hydrationData:t?.hydrationData||yi(),routes:e,mapRouteProperties:P,hydrationRouteProperties:vr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function vi(e,t){return dt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:m({window:t?.window}),hydrationData:t?.hydrationData||yi(),routes:e,mapRouteProperties:P,hydrationRouteProperties:vr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function yi(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:bi(e.errors)}),e}function bi(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 U(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&Ne.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}function xi({basename:e,children:t,history:r,useTransitions:i}){let[a,o]=n.useState({action:r.action,location:r.location}),s=n.useCallback(e=>{i===!1?o(e):n.startTransition(()=>o(e))},[i]);return n.useLayoutEffect(()=>r.listen(s),[r,s]),n.createElement(Er,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:r,useTransitions:i})}xi.displayName=`unstable_HistoryRouter`;var Si=n.forwardRef(function({onClick:e,discover:t=`render`,prefetch:r=`none`,relative:i,reloadDocument:a,replace:o,mask:s,state:l,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:_,navigator:v,useTransitions:y}=n.useContext(Q),b=typeof d==`string`&&c.test(d),x=Re(d,_);d=x.to;let S=Bn(d,{relative:i}),C=$(),w=null;if(s){let e=De(s,[],C.mask?C.mask.pathname:`/`,!0);_!==`/`&&(e.pathname=e.pathname===`/`?_:H([_,e.pathname])),w=v.createHref(e)}let[T,E,D]=li(r,h),O=ki(d,{replace:o,mask:s,state:l,target:u,preventScrollReset:f,relative:i,viewTransition:p,defaultShouldRevalidate:m,useTransitions:y});function k(t){e&&e(t),t.defaultPrevented||O(t)}let A=!(x.isExternal||a),j=n.createElement(`a`,{...h,...D,href:(A?w:void 0)||x.absoluteURL||S,onClick:A?k:e,ref:hi(g,E),target:u,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?n.createElement(n.Fragment,null,j,n.createElement(di,{page:S})):j});Si.displayName=`Link`;var Ci=n.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:r=``,end:i=!1,style:a,to:o,viewTransition:s,children:c,...l},u){let d=Kn(o,{relative:l.relative}),f=$(),p=n.useContext(Tn),{navigator:m,basename:h}=n.useContext(Q),g=p!=null&&zi(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=V(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!i&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!i&&y.startsWith(_)&&y.charAt(b)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof r==`function`?r(C):[r,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof a==`function`?a(C):a;return n.createElement(Si,{...l,"aria-current":w,className:T,ref:u,style:E,to:o,viewTransition:s},typeof c==`function`?c(C):c)});Ci.displayName=`NavLink`;var wi=n.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:r,reloadDocument:i,replace:a,state:o,method:s=`get`,action:l,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g)=>{let{useTransitions:_}=n.useContext(Q),v=Mi(),y=Ni(l,{relative:d}),b=s.toLowerCase()===`get`?`get`:`post`,x=typeof l==`string`&&c.test(l);return n.createElement(`form`,{ref:g,method:b,action:y,onSubmit:i?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let i=e.nativeEvent.submitter,c=i?.getAttribute(`formmethod`)||s,l=()=>v(i||e.currentTarget,{fetcherKey:t,method:c,navigate:r,replace:a,state:o,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m});_&&r!==!1?n.startTransition(()=>l()):l()},...h,"data-discover":!x&&e===`render`?`true`:void 0})});wi.displayName=`Form`;function Ti({getKey:e,storageKey:t,...r}){let i=n.useContext(si),{basename:a}=n.useContext(Q),o=$(),s=lr();Li({getKey:e,storageKey:t});let c=n.useMemo(()=>{if(!i||!e)return null;let t=Ii(o,s,a,e);return t===o.key?null:t},[]);if(!i||i.isSpaMode)return null;let l=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return r.nonce==null&&i?.nonce&&(r.nonce=i.nonce),n.createElement(`script`,{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${Ur(JSON.stringify(t||Pi))}, ${Ur(JSON.stringify(c))})`}})}Ti.displayName=`ScrollRestoration`;function Ei(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Di(e){let t=n.useContext(wn);return h(t,Ei(e)),t}function Oi(e){let t=n.useContext(Tn);return h(t,Ei(e)),t}function ki(e,{target:t,replace:r,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l,useTransitions:u}={}){let d=Un(),f=$(),p=Kn(e,{relative:s});return n.useCallback(m=>{if(Fr(m,t)){m.preventDefault();let t=r===void 0?b(f)===b(p):r,h=()=>d(e,{replace:t,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l});u?n.startTransition(()=>h()):h()}},[f,d,p,r,i,a,t,e,o,s,c,l,u])}var Ai=0,ji=()=>`__${String(++Ai)}__`;function Mi(){let{router:e}=Di(`useSubmit`),{basename:t}=n.useContext(Q),r=sr(),i=e.fetch,a=e.navigate;return n.useCallback(async(e,n={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Br(e,t);n.navigate===!1?await i(n.fetcherKey||ji(),r,n.action||o,{defaultShouldRevalidate:n.defaultShouldRevalidate,preventScrollReset:n.preventScrollReset,formData:l,body:u,formMethod:n.method||s,formEncType:n.encType||c,flushSync:n.flushSync}):await a(n.action||o,{defaultShouldRevalidate:n.defaultShouldRevalidate,preventScrollReset:n.preventScrollReset,formData:l,body:u,formMethod:n.method||s,formEncType:n.encType||c,replace:n.replace,state:n.state,fromRouteId:r,flushSync:n.flushSync,viewTransition:n.viewTransition})},[i,a,t,r])}function Ni(e,{relative:t}={}){let{basename:r}=n.useContext(Q),i=n.useContext(Mn);h(i,`useFormAction must be used inside a RouteContext`);let[a]=i.matches.slice(-1),o={...Kn(e||`.`,{relative:t})},s=$();if(e==null){o.search=s.search;let e=new URLSearchParams(o.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();o.search=n?`?${n}`:``}}return(!e||e===`.`)&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,`?index&`):`?index`),r!==`/`&&(o.pathname=o.pathname===`/`?r:H([r,o.pathname])),b(o)}var Pi=`react-router-scroll-positions`,Fi={};function Ii(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:V(e.pathname,n)||e.pathname},t)),i??(i=e.key),i}function Li({getKey:e,storageKey:t}={}){let{router:r}=Di(`useScrollRestoration`),{restoreScrollPosition:i,preventScrollReset:a}=Oi(`useScrollRestoration`),{basename:o}=n.useContext(Q),s=$(),c=lr(),l=cr();n.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Ri(n.useCallback(()=>{if(l.state===`idle`){let t=Ii(s,c,o,e);Fi[t]=window.scrollY}try{sessionStorage.setItem(t||Pi,JSON.stringify(Fi))}catch(e){g(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,o,s,c,t])),typeof document<`u`&&(n.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Pi);e&&(Fi=JSON.parse(e))}catch{}},[t]),n.useLayoutEffect(()=>{let t=r?.enableScrollRestoration(Fi,()=>window.scrollY,e?(t,n)=>Ii(t,n,o,e):void 0);return()=>t&&t()},[r,o,e]),n.useLayoutEffect(()=>{if(i!==!1){if(typeof i==`number`){window.scrollTo(0,i);return}try{if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{g(!1,`"${s.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}a!==!0&&window.scrollTo(0,0)}},[s,i,a]))}function Ri(e,t){let{capture:r}=t||{};n.useEffect(()=>{let t=r==null?void 0:{capture:r};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,r])}function zi(e,{relative:t}={}){let r=n.useContext(On);h(r!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=Di(`useViewTransitionState`),a=Kn(e,{relative:t});if(!r.isTransitioning)return!1;let o=V(r.currentLocation.pathname,i)||r.currentLocation.pathname,s=V(r.nextLocation.pathname,i)||r.nextLocation.pathname;return _e(a.pathname,s)!=null||_e(a.pathname,o)!=null}export{i as _,wr as a,Dr as c,Un as d,Gn as f,a as g,o as h,Jr as i,fr as l,s as m,_i as n,Tr as o,D as p,vi as r,br as s,Si as t,$ as u,r as v};