@kenyaemr/esm-bed-management-app 1.0.1-pre.4 → 1.0.1-pre.41

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 (108) hide show
  1. package/dist/26.js +1 -1
  2. package/dist/26.js.map +1 -1
  3. package/dist/294.js +1 -1
  4. package/dist/294.js.map +1 -1
  5. package/dist/360.js +1 -0
  6. package/dist/360.js.map +1 -0
  7. package/dist/452.js +1 -0
  8. package/dist/{884.js.map → 452.js.map} +1 -1
  9. package/dist/482.js +2 -0
  10. package/dist/482.js.LICENSE.txt +19 -0
  11. package/dist/482.js.map +1 -0
  12. package/dist/532.js +1 -0
  13. package/dist/532.js.map +1 -0
  14. package/dist/558.js +1 -1
  15. package/dist/558.js.map +1 -1
  16. package/dist/574.js +1 -1
  17. package/dist/663.js +2 -0
  18. package/dist/663.js.LICENSE.txt +44 -0
  19. package/dist/663.js.map +1 -0
  20. package/dist/666.js +1 -0
  21. package/dist/666.js.map +1 -0
  22. package/dist/708.js +2 -0
  23. package/dist/{330.js.LICENSE.txt → 708.js.LICENSE.txt} +0 -20
  24. package/dist/708.js.map +1 -0
  25. package/dist/763.js +2 -0
  26. package/dist/763.js.map +1 -0
  27. package/dist/774.js +1 -0
  28. package/dist/774.js.map +1 -0
  29. package/dist/815.js +1 -0
  30. package/dist/815.js.map +1 -0
  31. package/dist/847.js +1 -0
  32. package/dist/847.js.map +1 -0
  33. package/dist/898.js +1 -0
  34. package/dist/898.js.map +1 -0
  35. package/dist/931.js +1 -0
  36. package/dist/931.js.map +1 -0
  37. package/dist/935.js +1 -0
  38. package/dist/935.js.map +1 -0
  39. package/dist/esm-kenyaemr-bed-management-app.js +1 -1
  40. package/dist/esm-kenyaemr-bed-management-app.js.buildmanifest.json +207 -135
  41. package/dist/esm-kenyaemr-bed-management-app.js.map +1 -1
  42. package/dist/main.js +1 -1
  43. package/dist/main.js.map +1 -1
  44. package/dist/routes.json +1 -1
  45. package/package.json +4 -1
  46. package/src/bed-administration/bed-administration-table.scss +3 -0
  47. package/src/bed-administration/bed-administration-types.ts +8 -0
  48. package/src/bed-admission/active-patients/active-patients-table.component.tsx +13 -20
  49. package/src/bed-admission/active-patients/active-visits.resource.ts +1 -3
  50. package/src/bed-admission/active-patients/eligible-admissions.resource.ts +43 -0
  51. package/src/bed-admission/admitted-patients/active-admissions.resource.ts +5 -1
  52. package/src/bed-admission/admitted-patients/admitted-patients-table.component.tsx +3 -3
  53. package/src/bed-admission/bed-admission-tabs.component.tsx +0 -1
  54. package/src/bed-admission/bed-admission.resource.ts +1 -1
  55. package/src/bed-admission/bed-layout/bed-layout-list.component.tsx +2 -2
  56. package/src/bed-admission/bed-tag/bed-tag-administration-table.component.tsx +240 -0
  57. package/src/bed-admission/bed-tag/bed-tags-admin-form.component.tsx +146 -0
  58. package/src/bed-admission/bed-tag/delete-bed-tag.component.tsx +69 -0
  59. package/src/bed-admission/bed-tag/delete-bedForm.component.tsx +108 -0
  60. package/src/bed-admission/bed-tag/edit-tag-form.component.tsx +80 -0
  61. package/src/bed-admission/bed-tag/new-tag-form.component.tsx +83 -0
  62. package/src/bed-admission/bed-type/bed-type-admin-form.component.tsx +203 -0
  63. package/src/bed-admission/bed-type/bed-type-administration-table.component.tsx +246 -0
  64. package/src/bed-admission/bed-type/delete-bed-type.component.tsx +69 -0
  65. package/src/bed-admission/bed-type/deleteBedtypeForm.component.tsx +108 -0
  66. package/src/bed-admission/bed-type/edit-bed-type.component.tsx +80 -0
  67. package/src/bed-admission/bed-type/new-bed-type-form.component.tsx +87 -0
  68. package/src/bed-admission/types.ts +1 -3
  69. package/src/bed-admission/ward/new-ward-form.component.tsx +81 -0
  70. package/src/bed-admission/ward/ward-admin-form.component.tsx +193 -0
  71. package/src/bed-admission/ward/ward-administration-table.component.tsx +173 -0
  72. package/src/config-schema.ts +7 -1
  73. package/src/index.ts +21 -0
  74. package/src/root.component.tsx +6 -0
  75. package/src/routes.json +16 -1
  76. package/src/summary/summary.resource.ts +257 -1
  77. package/src/types.ts +23 -0
  78. package/src/workspace/allocate-bed-workspace.component.tsx +51 -18
  79. package/src/workspace/allocate-bed.scss +7 -0
  80. package/tsconfig.json +2 -1
  81. package/dist/187.js +0 -1
  82. package/dist/187.js.map +0 -1
  83. package/dist/207.js +0 -1
  84. package/dist/207.js.map +0 -1
  85. package/dist/283.js +0 -1
  86. package/dist/283.js.map +0 -1
  87. package/dist/330.js +0 -2
  88. package/dist/330.js.map +0 -1
  89. package/dist/352.js +0 -1
  90. package/dist/352.js.map +0 -1
  91. package/dist/404.js +0 -1
  92. package/dist/404.js.map +0 -1
  93. package/dist/455.js +0 -2
  94. package/dist/455.js.map +0 -1
  95. package/dist/629.js +0 -1
  96. package/dist/629.js.map +0 -1
  97. package/dist/707.js +0 -1
  98. package/dist/707.js.map +0 -1
  99. package/dist/800.js +0 -2
  100. package/dist/800.js.LICENSE.txt +0 -3
  101. package/dist/800.js.map +0 -1
  102. package/dist/884.js +0 -1
  103. package/dist/933.js +0 -1
  104. package/dist/933.js.map +0 -1
  105. package/dist/959.js +0 -1
  106. package/dist/959.js.map +0 -1
  107. /package/.yarn/versions/{6816f0d4.yml → ee024b77.yml} +0 -0
  108. /package/dist/{455.js.LICENSE.txt → 763.js.LICENSE.txt} +0 -0
package/dist/26.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 26.js.LICENSE.txt */
2
- "use strict";(globalThis.webpackChunk_kenyaemr_esm_bed_management_app=globalThis.webpackChunk_kenyaemr_esm_bed_management_app||[]).push([[26],{8026:(e,t,r)=>{r.r(t),r.d(t,{AbortedDeferredError:()=>K,Await:()=>Nt,BrowserRouter:()=>hr,Form:()=>br,HashRouter:()=>fr,Link:()=>yr,MemoryRouter:()=>jt,NavLink:()=>gr,Navigate:()=>_t,NavigationType:()=>n,Outlet:()=>Tt,Route:()=>Ot,Router:()=>Ft,RouterProvider:()=>Ut,Routes:()=>Bt,ScrollRestoration:()=>Er,UNSAFE_DataRouterContext:()=>ze,UNSAFE_DataRouterStateContext:()=>We,UNSAFE_LocationContext:()=>Ke,UNSAFE_NavigationContext:()=>$e,UNSAFE_RouteContext:()=>qe,UNSAFE_useRouteId:()=>gt,UNSAFE_useScrollRestoration:()=>Fr,createBrowserRouter:()=>lr,createHashRouter:()=>sr,createMemoryRouter:()=>Jt,createPath:()=>p,createRoutesFromChildren:()=>$t,createRoutesFromElements:()=>$t,createSearchParams:()=>Zt,defer:()=>Y,generatePath:()=>M,isRouteErrorResponse:()=>Q,json:()=>$,matchPath:()=>j,matchRoutes:()=>w,parsePath:()=>m,redirect:()=>V,redirectDocument:()=>X,renderMatches:()=>Kt,resolvePath:()=>O,unstable_HistoryRouter:()=>pr,unstable_useBlocker:()=>Lt,unstable_usePrompt:()=>Nr,useActionData:()=>St,useAsyncError:()=>kt,useAsyncValue:()=>Ct,useBeforeUnload:()=>Br,useFetcher:()=>jr,useFetchers:()=>_r,useFormAction:()=>Ur,useHref:()=>Ye,useInRouterContext:()=>Ve,useLinkClickHandler:()=>Cr,useLoaderData:()=>Rt,useLocation:()=>Xe,useMatch:()=>Qe,useMatches:()=>Et,useNavigate:()=>et,useNavigation:()=>bt,useNavigationType:()=>Ge,useOutlet:()=>nt,useOutletContext:()=>rt,useParams:()=>ot,useResolvedPath:()=>at,useRevalidator:()=>wt,useRouteError:()=>Dt,useRouteLoaderData:()=>xt,useRoutes:()=>it,useSearchParams:()=>kr,useSubmit:()=>Lr});var n,o=r(1672);function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(n||(n={}));const i="popstate";function l(e){void 0===e&&(e={});let t,{initialEntries:r=["/"],initialIndex:o,v5Compat:a=!1}=e;t=r.map(((e,t)=>h(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let i=u(null==o?t.length-1:o),l=n.Pop,s=null;function u(e){return Math.min(Math.max(e,0),t.length-1)}function c(){return t[i]}function h(e,r,n){void 0===r&&(r=null);let o=f(t?c().pathname:"/",e,r,n);return d("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}function v(e){return"string"==typeof e?e:p(e)}return{get index(){return i},get action(){return l},get location(){return c()},createHref:v,createURL:e=>new URL(v(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?m(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,r){l=n.Push;let o=h(e,r);i+=1,t.splice(i,t.length,o),a&&s&&s({action:l,location:o,delta:1})},replace(e,r){l=n.Replace;let o=h(e,r);t[i]=o,a&&s&&s({action:l,location:o,delta:0})},go(e){l=n.Pop;let r=u(i+e),o=t[r];i=r,s&&s({action:l,location:o,delta:e})},listen:e=>(s=e,()=>{s=null})}}function s(e){return void 0===e&&(e={}),v((function(e,t){let{pathname:r,search:n,hash:o}=e.location;return f("",{pathname:r,search:n,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:p(t)}),null,e)}function u(e){return void 0===e&&(e={}),v((function(e,t){let{pathname:r="/",search:n="",hash:o=""}=m(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),f("",{pathname:r,search:n,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),n="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");n=-1===r?t:t.slice(0,r)}return n+"#"+("string"==typeof t?t:p(t))}),(function(e,t){d("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)}function c(e,t){if(!1===e||null==e)throw new Error(t)}function d(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function h(e,t){return{usr:e.state,key:e.key,idx:t}}function f(e,t,r,n){return void 0===r&&(r=null),a({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?m(t):t,{state:r,key:t&&t.key||n||Math.random().toString(36).substr(2,8)})}function p(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),n&&"#"!==n&&(t+="#"===n.charAt(0)?n:"#"+n),t}function m(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function v(e,t,r,o){void 0===o&&(o={});let{window:l=document.defaultView,v5Compat:s=!1}=o,u=l.history,d=n.Pop,m=null,v=y();function y(){return(u.state||{idx:null}).idx}function g(){d=n.Pop;let e=y(),t=null==e?null:e-v;v=e,m&&m({action:d,location:w.location,delta:t})}function b(e){let t="null"!==l.location.origin?l.location.origin:l.location.href,r="string"==typeof e?e:p(e);return c(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==v&&(v=0,u.replaceState(a({},u.state,{idx:v}),""));let w={get action(){return d},get location(){return e(l,u)},listen(e){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(i,g),m=e,()=>{l.removeEventListener(i,g),m=null}},createHref:e=>t(l,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){d=n.Push;let o=f(w.location,e,t);r&&r(o,e),v=y()+1;let a=h(o,v),i=w.createHref(o);try{u.pushState(a,"",i)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;l.location.assign(i)}s&&m&&m({action:d,location:w.location,delta:1})},replace:function(e,t){d=n.Replace;let o=f(w.location,e,t);r&&r(o,e),v=y();let a=h(o,v),i=w.createHref(o);u.replaceState(a,"",i),s&&m&&m({action:d,location:w.location,delta:0})},go:e=>u.go(e)};return w}var y;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(y||(y={}));const g=new Set(["lazy","caseSensitive","path","id","index","children"]);function b(e,t,r,n){return void 0===r&&(r=[]),void 0===n&&(n={}),e.map(((e,o)=>{let i=[...r,o],l="string"==typeof e.id?e.id:i.join("-");if(c(!0!==e.index||!e.children,"Cannot specify children on an index route"),c(!n[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let r=a({},e,t(e),{id:l});return n[l]=r,r}{let r=a({},e,t(e),{id:l,children:void 0});return n[l]=r,e.children&&(r.children=b(e.children,t,i,n)),r}}))}function w(e,t,r){void 0===r&&(r="/");let n=T(("string"==typeof t?m(t):t).pathname||"/",r);if(null==n)return null;let o=E(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let a=null;for(let e=0;null==a&&e<o.length;++e)a=U(o[e],_(n));return a}function E(e,t,r,n){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===n&&(n="");let o=(e,o,a)=>{let i={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};i.relativePath.startsWith("/")&&(c(i.relativePath.startsWith(n),'Absolute route path "'+i.relativePath+'" nested under path "'+n+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),i.relativePath=i.relativePath.slice(n.length));let l=I([n,i.relativePath]),s=r.concat(i);e.children&&e.children.length>0&&(c(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),E(e.children,t,s,l)),(null!=e.path||e.index)&&t.push({path:l,score:A(l,e.index),routesMeta:s})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of R(e.path))o(e,t,r);else o(e,t)})),t}function R(e){let t=e.split("/");if(0===t.length)return[];let[r,...n]=t,o=r.endsWith("?"),a=r.replace(/\?$/,"");if(0===n.length)return o?[a,""]:[a];let i=R(n.join("/")),l=[];return l.push(...i.map((e=>""===e?a:[a,e].join("/")))),o&&l.push(...i),l.map((t=>e.startsWith("/")&&""===t?"/":t))}const x=/^:\w+$/,S=3,D=2,C=1,k=10,P=-2,L=e=>"*"===e;function A(e,t){let r=e.split("/"),n=r.length;return r.some(L)&&(n+=P),t&&(n+=D),r.filter((e=>!L(e))).reduce(((e,t)=>e+(x.test(t)?S:""===t?C:k)),n)}function U(e,t){let{routesMeta:r}=e,n={},o="/",a=[];for(let e=0;e<r.length;++e){let i=r[e],l=e===r.length-1,s="/"===o?t:t.slice(o.length)||"/",u=j({path:i.relativePath,caseSensitive:i.caseSensitive,end:l},s);if(!u)return null;Object.assign(n,u.params);let c=i.route;a.push({params:n,pathname:I([o,u.pathname]),pathnameBase:z(I([o,u.pathnameBase])),route:c}),"/"!==u.pathnameBase&&(o=I([o,u.pathnameBase]))}return a}function M(e,t){void 0===t&&(t={});let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(d(!1,'Route path "'+r+'" will be treated as if it were "'+r.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+r.replace(/\*$/,"/*")+'".'),r=r.replace(/\*$/,"/*"));const n=r.startsWith("/")?"/":"",o=e=>null==e?"":"string"==typeof e?e:String(e);return n+r.split(/\/+/).map(((e,r,n)=>{if(r===n.length-1&&"*"===e)return o(t["*"]);const a=e.match(/^:(\w+)(\??)$/);if(a){const[,e,r]=a;let n=t[e];return c("?"===r||null!=n,'Missing ":'+e+'" param'),o(n)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")}function j(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!0),d("*"===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 n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,((e,t)=>(n.push(t),"/([^\\/]+)")));return e.endsWith("*")?(n.push("*"),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:n.reduce(((e,t,r)=>{if("*"===t){let e=l[r]||"";i=a.slice(0,a.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(r){return d(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+r+")."),e}}(l[r]||"",t),e}),{}),pathname:a,pathnameBase:i,pattern:e}}function _(e){try{return decodeURI(e)}catch(t){return d(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function T(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&"/"!==n?null:e.slice(r)||"/"}function O(e,t){void 0===t&&(t="/");let{pathname:r,search:n="",hash:o=""}="string"==typeof e?m(e):e,a=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:a,search:W(n),hash:H(o)}}function F(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function B(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function N(e,t,r,n){let o;void 0===n&&(n=!1),"string"==typeof e?o=m(e):(o=a({},e),c(!o.pathname||!o.pathname.includes("?"),F("?","pathname","search",o)),c(!o.pathname||!o.pathname.includes("#"),F("#","pathname","hash",o)),c(!o.search||!o.search.includes("#"),F("#","search","hash",o)));let i,l=""===e||""===o.pathname,s=l?"/":o.pathname;if(n||null==s)i=r;else{let e=t.length-1;if(s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}i=e>=0?t[e]:"/"}let u=O(o,i),d=s&&"/"!==s&&s.endsWith("/"),h=(l||"."===s)&&r.endsWith("/");return u.pathname.endsWith("/")||!d&&!h||(u.pathname+="/"),u}const I=e=>e.join("/").replace(/\/\/+/g,"/"),z=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),W=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",H=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"",$=function(e,t){void 0===t&&(t={});let r="number"==typeof t?{status:t}:t,n=new Headers(r.headers);return n.has("Content-Type")||n.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),a({},r,{headers:n}))};class K extends Error{}class q{constructor(e,t){let r;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],c(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise(((e,t)=>r=t)),this.controller=new AbortController;let n=()=>r(new K("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",n),this.controller.signal.addEventListener("abort",n),this.data=Object.entries(e).reduce(((e,t)=>{let[r,n]=t;return Object.assign(e,{[r]:this.trackPromise(r,n)})}),{}),this.done&&this.unlistenAbortSignal(),this.init=t}trackPromise(e,t){if(!(t instanceof Promise))return t;this.deferredKeys.push(e),this.pendingKeysSet.add(e);let r=Promise.race([t,this.abortPromise]).then((t=>this.onSettle(r,e,void 0,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,n){if(this.controller.signal.aborted&&r instanceof K)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===r&&void 0===n){let r=new Error('Deferred data for key "'+t+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)}return void 0===n?(Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>n}),this.emit(!1,t),n)}emit(e,t){this.subscribers.forEach((r=>r(e,t)))}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach(((e,t)=>this.pendingKeysSet.delete(t))),this.emit(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise((t=>{this.subscribe((n=>{e.removeEventListener("abort",r),(n||this.done)&&t(n)}))}))}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return c(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,n]=t;return Object.assign(e,{[r]:J(n)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function J(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const Y=function(e,t){return void 0===t&&(t={}),new q(e,"number"==typeof t?{status:t}:t)},V=function(e,t){void 0===t&&(t=302);let r=t;"number"==typeof r?r={status:r}:void 0===r.status&&(r.status=302);let n=new Headers(r.headers);return n.set("Location",e),new Response(null,a({},r,{headers:n}))},X=(e,t)=>{let r=V(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r};class G{constructor(e,t,r,n){void 0===n&&(n=!1),this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function Q(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const Z=["post","put","patch","delete"],ee=new Set(Z),te=["get",...Z],re=new Set(te),ne=new Set([301,302,303,307,308]),oe=new Set([307,308]),ae={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ie={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},le={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},se=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ue=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)});function ce(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,r=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement,o=!r;let i;if(c(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;i=e=>({hasErrorBoundary:t(e)})}else i=ue;let l,s={},u=b(e.routes,i,void 0,s),h=e.basename||"/",p=a({v7_normalizeFormMethod:!1,v7_prependBasename:!1},e.future),m=null,v=new Set,g=null,E=null,R=null,x=null!=e.hydrationData,S=w(u,e.history.location,h),D=null;if(null==S){let t=De(404,{pathname:e.history.location.pathname}),{matches:r,route:n}=Se(u);S=r,D={[n.id]:t}}let C,k,P=!(S.some((e=>e.route.lazy))||S.some((e=>e.route.loader))&&null==e.hydrationData),L={historyAction:e.history.action,location:e.history.location,matches:S,initialized:P,navigation:ae,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||D,fetchers:new Map,blockers:new Map},A=n.Pop,U=!1,M=!1,j=!1,_=[],O=[],F=new Map,B=0,N=-1,I=new Map,z=new Set,W=new Map,H=new Map,$=new Map,K=!1;function q(e){L=a({},L,e),v.forEach((e=>e(L)))}function J(t,r){var o,i;let s,c=null!=L.actionData&&null!=L.navigation.formMethod&&Ue(L.navigation.formMethod)&&"loading"===L.navigation.state&&!0!==(null==(o=t.state)?void 0:o._isRedirect);s=r.actionData?Object.keys(r.actionData).length>0?r.actionData:null:c?L.actionData:null;let d=r.loaderData?Re(L.loaderData,r.loaderData,r.matches||[],r.errors):L.loaderData,h=L.blockers;h.size>0&&(h=new Map(h),h.forEach(((e,t)=>h.set(t,le))));let f=!0===U||null!=L.navigation.formMethod&&Ue(L.navigation.formMethod)&&!0!==(null==(i=t.state)?void 0:i._isRedirect);l&&(u=l,l=void 0),M||A===n.Pop||(A===n.Push?e.history.push(t,t.state):A===n.Replace&&e.history.replace(t,t.state)),q(a({},r,{actionData:s,loaderData:d,historyAction:A,location:t,initialized:!0,navigation:ae,revalidation:"idle",restoreScrollPosition:ke(t,r.matches||L.matches),preventScrollReset:f,blockers:h})),A=n.Pop,U=!1,M=!1,j=!1,_=[],O=[]}async function Y(t,r,o){k&&k.abort(),k=null,A=t,M=!0===(o&&o.startUninterruptedRevalidation),function(e,t){if(g&&R){let r=we(e,t);g[r]=R()}}(L.location,L.matches),U=!0===(o&&o.preventScrollReset);let c=l||u,d=o&&o.overrideNavigation,f=w(c,r,h);if(!f){let e=De(404,{pathname:r.pathname}),{matches:t,route:n}=Se(c);return be(),void J(r,{matches:t,loaderData:{},errors:{[n.id]:e}})}if(L.initialized&&!j&&(p=L.location,m=r,p.pathname===m.pathname&&p.search===m.search&&(""===p.hash?""!==m.hash:p.hash===m.hash||""!==m.hash))&&!(o&&o.submission&&Ue(o.submission.formMethod)))return void J(r,{matches:f});var p,m;k=new AbortController;let v,b,E=ge(e.history,r,k.signal,o&&o.submission);if(o&&o.pendingError)b={[xe(f).route.id]:o.pendingError};else if(o&&o.submission&&Ue(o.submission.formMethod)){let e=await async function(e,t,r,o,a){void 0===a&&(a={}),Q();let l,u=function(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}(t,r);q({navigation:u});let c=Te(o,t);if(c.route.action||c.route.lazy){if(l=await ye("action",e,c,o,s,i,h),e.signal.aborted)return{shortCircuited:!0}}else l={type:y.error,error:De(405,{method:e.method,pathname:t.pathname,routeId:c.route.id})};if(Ae(l)){let e;return e=a&&null!=a.replace?a.replace:l.location===L.location.pathname+L.location.search,await X(L,l,{submission:r,replace:e}),{shortCircuited:!0}}if(Le(l)){let e=xe(o,c.route.id);return!0!==(a&&a.replace)&&(A=n.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:l.error}}}if(Pe(l))throw De(400,{type:"defer-action"});return{pendingActionData:{[c.route.id]:l.data}}}(E,r,o.submission,f,{replace:o.replace});if(e.shortCircuited)return;v=e.pendingActionData,b=e.pendingActionError,d=Fe(r,o.submission),E=new Request(E.url,{signal:E.signal})}let{shortCircuited:x,loaderData:S,errors:D}=await async function(t,r,n,o,i,s,c,d,f){let p=o||Fe(r,i),m=i||s||Oe(p),v=l||u,[y,g]=fe(e.history,L,n,m,r,j,_,O,W,z,v,h,d,f);if(be((e=>!(n&&n.some((t=>t.route.id===e)))||y&&y.some((t=>t.route.id===e)))),N=++B,0===y.length&&0===g.length){let e=ne();return J(r,a({matches:n,loaderData:{},errors:f||null},d?{actionData:d}:{},e?{fetchers:new Map(L.fetchers)}:{})),{shortCircuited:!0}}if(!M){g.forEach((e=>{let t=L.fetchers.get(e.key),r=Be(void 0,t?t.data:void 0);L.fetchers.set(e.key,r)}));let e=d||L.actionData;q(a({navigation:p},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},g.length>0?{fetchers:new Map(L.fetchers)}:{}))}g.forEach((e=>{F.has(e.key)&&te(e.key),e.controller&&F.set(e.key,e.controller)}));let b=()=>g.forEach((e=>te(e.key)));k&&k.signal.addEventListener("abort",b);let{results:w,loaderResults:E,fetcherResults:R}=await G(L.matches,n,y,g,t);if(t.signal.aborted)return{shortCircuited:!0};k&&k.signal.removeEventListener("abort",b),g.forEach((e=>F.delete(e.key)));let x=Ce(w);if(x){if(x.idx>=y.length){let e=g[x.idx-y.length].key;z.add(e)}return await X(L,x.result,{replace:c}),{shortCircuited:!0}}let{loaderData:S,errors:D}=Ee(L,n,y,E,f,g,R,H);H.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&H.delete(t)}))}));let C=ne(),P=ce(N);return a({loaderData:S,errors:D},C||P||g.length>0?{fetchers:new Map(L.fetchers)}:{})}(E,r,f,d,o&&o.submission,o&&o.fetcherSubmission,o&&o.replace,v,b);x||(k=null,J(r,a({matches:f},v?{actionData:v}:{},{loaderData:S,errors:D})))}function V(e){return L.fetchers.get(e)||ie}async function X(o,i,l){let{submission:s,replace:u,isFetchActionRedirect:d}=void 0===l?{}:l;i.revalidate&&(j=!0);let p=f(o.location,i.location,a({_isRedirect:!0},d?{_isFetchActionRedirect:!0}:{}));if(c(p,"Expected a location on the redirect navigation"),r){let r=!1;if(i.reloadDocument)r=!0;else if(se.test(i.location)){const n=e.history.createURL(i.location);r=n.origin!==t.location.origin||null==T(n.pathname,h)}if(r)return void(u?t.location.replace(i.location):t.location.assign(i.location))}k=null;let m=!0===u?n.Replace:n.Push,v=s||Oe(o.navigation);if(oe.has(i.status)&&v&&Ue(v.formMethod))await Y(m,p,{submission:a({},v,{formAction:i.location}),preventScrollReset:U});else if(d)await Y(m,p,{overrideNavigation:Fe(p),fetcherSubmission:v,preventScrollReset:U});else{let e=Fe(p,v);await Y(m,p,{overrideNavigation:e,preventScrollReset:U})}}async function G(t,r,n,o,a){let l=await Promise.all([...n.map((e=>ye("loader",a,e,r,s,i,h))),...o.map((t=>t.matches&&t.match&&t.controller?ye("loader",ge(e.history,t.path,t.controller.signal),t.match,t.matches,s,i,h):{type:y.error,error:De(404,{pathname:t.path})}))]),u=l.slice(0,n.length),c=l.slice(n.length);return await Promise.all([Me(t,n,u,u.map((()=>a.signal)),!1,L.loaderData),Me(t,o.map((e=>e.match)),c,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:l,loaderResults:u,fetcherResults:c}}function Q(){j=!0,_.push(...be()),W.forEach(((e,t)=>{F.has(t)&&(O.push(t),te(t))}))}function Z(e,t,r){let n=xe(L.matches,t);ee(e),q({errors:{[n.route.id]:r},fetchers:new Map(L.fetchers)})}function ee(e){let t=L.fetchers.get(e);!F.has(e)||t&&"loading"===t.state&&I.has(e)||te(e),W.delete(e),I.delete(e),z.delete(e),L.fetchers.delete(e)}function te(e){let t=F.get(e);c(t,"Expected fetch controller: "+e),t.abort(),F.delete(e)}function re(e){for(let t of e){let e=Ne(V(t).data);L.fetchers.set(t,e)}}function ne(){let e=[],t=!1;for(let r of z){let n=L.fetchers.get(r);c(n,"Expected fetcher: "+r),"loading"===n.state&&(z.delete(r),e.push(r),t=!0)}return re(e),t}function ce(e){let t=[];for(let[r,n]of I)if(n<e){let e=L.fetchers.get(r);c(e,"Expected fetcher: "+r),"loading"===e.state&&(te(r),I.delete(r),t.push(r))}return re(t),t.length>0}function pe(e){L.blockers.delete(e),$.delete(e)}function me(e,t){let r=L.blockers.get(e)||le;c("unblocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"proceeding"===t.state||"blocked"===r.state&&"unblocked"===t.state||"proceeding"===r.state&&"unblocked"===t.state,"Invalid blocker state transition: "+r.state+" -> "+t.state);let n=new Map(L.blockers);n.set(e,t),q({blockers:n})}function ve(e){let{currentLocation:t,nextLocation:r,historyAction:n}=e;if(0===$.size)return;$.size>1&&d(!1,"A router only supports one blocker at a time");let o=Array.from($.entries()),[a,i]=o[o.length-1],l=L.blockers.get(a);return l&&"proceeding"===l.state?void 0:i({currentLocation:t,nextLocation:r,historyAction:n})?a:void 0}function be(e){let t=[];return H.forEach(((r,n)=>{e&&!e(n)||(r.cancel(),t.push(n),H.delete(n))})),t}function we(e,t){return E&&E(e,t.map((e=>function(e,t){let{route:r,pathname:n,params:o}=e;return{id:r.id,pathname:n,params:o,data:t[r.id],handle:r.handle}}(e,L.loaderData))))||e.key}function ke(e,t){if(g){let r=we(e,t),n=g[r];if("number"==typeof n)return n}return null}return C={get basename(){return h},get state(){return L},get routes(){return u},initialize:function(){return m=e.history.listen((t=>{let{action:r,location:n,delta:o}=t;if(K)return void(K=!1);d(0===$.size||null!=o,"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 a=ve({currentLocation:L.location,nextLocation:n,historyAction:r});return a&&null!=o?(K=!0,e.history.go(-1*o),void me(a,{state:"blocked",location:n,proceed(){me(a,{state:"proceeding",proceed:void 0,reset:void 0,location:n}),e.history.go(o)},reset(){let e=new Map(L.blockers);e.set(a,le),q({blockers:e})}})):Y(r,n)})),L.initialized||Y(n.Pop,L.location),C},subscribe:function(e){return v.add(e),()=>v.delete(e)},enableScrollRestoration:function(e,t,r){if(g=e,R=t,E=r||null,!x&&L.navigation===ae){x=!0;let e=ke(L.location,L.matches);null!=e&&q({restoreScrollPosition:e})}return()=>{g=null,R=null,E=null}},navigate:async function t(r,o){if("number"==typeof r)return void e.history.go(r);let i=de(L.location,L.matches,h,p.v7_prependBasename,r,null==o?void 0:o.fromRouteId,null==o?void 0:o.relative),{path:l,submission:s,error:u}=he(p.v7_normalizeFormMethod,!1,i,o),c=L.location,d=f(L.location,l,o&&o.state);d=a({},d,e.history.encodeLocation(d));let m=o&&null!=o.replace?o.replace:void 0,v=n.Push;!0===m?v=n.Replace:!1===m||null!=s&&Ue(s.formMethod)&&s.formAction===L.location.pathname+L.location.search&&(v=n.Replace);let y=o&&"preventScrollReset"in o?!0===o.preventScrollReset:void 0,g=ve({currentLocation:c,nextLocation:d,historyAction:v});if(!g)return await Y(v,d,{submission:s,pendingError:u,preventScrollReset:y,replace:o&&o.replace});me(g,{state:"blocked",location:d,proceed(){me(g,{state:"proceeding",proceed:void 0,reset:void 0,location:d}),t(r,o)},reset(){let e=new Map(L.blockers);e.set(g,le),q({blockers:e})}})},fetch:function(t,r,n,d){if(o)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");F.has(t)&&te(t);let f=l||u,m=de(L.location,L.matches,h,p.v7_prependBasename,n,r,null==d?void 0:d.relative),v=w(f,m,h);if(!v)return void Z(t,r,De(404,{pathname:m}));let{path:y,submission:g,error:b}=he(p.v7_normalizeFormMethod,!0,m,d);if(b)return void Z(t,r,b);let E=Te(v,y);U=!0===(d&&d.preventScrollReset),g&&Ue(g.formMethod)?async function(t,r,n,o,d,f){if(Q(),W.delete(t),!o.route.action&&!o.route.lazy){let e=De(405,{method:f.formMethod,pathname:n,routeId:r});return void Z(t,r,e)}let p=function(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," _hasFetcherDoneAnything ":!0}}(f,L.fetchers.get(t));L.fetchers.set(t,p),q({fetchers:new Map(L.fetchers)});let m=new AbortController,v=ge(e.history,n,m.signal,f);F.set(t,m);let y=B,g=await ye("action",v,o,d,s,i,h);if(v.signal.aborted)return void(F.get(t)===m&&F.delete(t));if(Ae(g)){if(F.delete(t),N>y){let e=Ne(void 0);return L.fetchers.set(t,e),void q({fetchers:new Map(L.fetchers)})}{z.add(t);let e=Be(f);return L.fetchers.set(t,e),q({fetchers:new Map(L.fetchers)}),X(L,g,{submission:f,isFetchActionRedirect:!0})}}if(Le(g))return void Z(t,r,g.error);if(Pe(g))throw De(400,{type:"defer-action"});let b=L.navigation.location||L.location,E=ge(e.history,b,m.signal),R=l||u,x="idle"!==L.navigation.state?w(R,L.navigation.location,h):L.matches;c(x,"Didn't find any matches after fetcher action");let S=++B;I.set(t,S);let D=Be(f,g.data);L.fetchers.set(t,D);let[C,P]=fe(e.history,L,x,f,b,j,_,O,W,z,R,h,{[o.route.id]:g.data},void 0);P.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=L.fetchers.get(t),n=Be(void 0,r?r.data:void 0);L.fetchers.set(t,n),F.has(t)&&te(t),e.controller&&F.set(t,e.controller)})),q({fetchers:new Map(L.fetchers)});let U=()=>P.forEach((e=>te(e.key)));m.signal.addEventListener("abort",U);let{results:M,loaderResults:T,fetcherResults:$}=await G(L.matches,x,C,P,E);if(m.signal.aborted)return;m.signal.removeEventListener("abort",U),I.delete(t),F.delete(t),P.forEach((e=>F.delete(e.key)));let K=Ce(M);if(K){if(K.idx>=C.length){let e=P[K.idx-C.length].key;z.add(e)}return X(L,K.result)}let{loaderData:Y,errors:V}=Ee(L,L.matches,C,T,void 0,P,$,H);if(L.fetchers.has(t)){let e=Ne(g.data);L.fetchers.set(t,e)}let ee=ce(S);"loading"===L.navigation.state&&S>N?(c(A,"Expected pending action"),k&&k.abort(),J(L.navigation.location,{matches:x,loaderData:Y,errors:V,fetchers:new Map(L.fetchers)})):(q(a({errors:V,loaderData:Re(L.loaderData,Y,x,V)},ee||P.length>0?{fetchers:new Map(L.fetchers)}:{})),j=!1)}(t,r,y,E,v,g):(W.set(t,{routeId:r,path:y}),async function(t,r,n,o,a,l){let u=L.fetchers.get(t),d=Be(l,u?u.data:void 0);L.fetchers.set(t,d),q({fetchers:new Map(L.fetchers)});let f=new AbortController,p=ge(e.history,n,f.signal);F.set(t,f);let m=B,v=await ye("loader",p,o,a,s,i,h);if(Pe(v)&&(v=await je(v,p.signal,!0)||v),F.get(t)===f&&F.delete(t),p.signal.aborted)return;if(Ae(v)){if(N>m){let e=Ne(void 0);return L.fetchers.set(t,e),void q({fetchers:new Map(L.fetchers)})}return z.add(t),void await X(L,v)}if(Le(v)){let e=xe(L.matches,r);return L.fetchers.delete(t),void q({fetchers:new Map(L.fetchers),errors:{[e.route.id]:v.error}})}c(!Pe(v),"Unhandled fetcher deferred data");let y=Ne(v.data);L.fetchers.set(t,y),q({fetchers:new Map(L.fetchers)})}(t,r,y,E,v,g))},revalidate:function(){Q(),q({revalidation:"loading"}),"submitting"!==L.navigation.state&&("idle"!==L.navigation.state?Y(A||L.historyAction,L.navigation.location,{overrideNavigation:L.navigation}):Y(L.historyAction,L.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:V,deleteFetcher:ee,dispose:function(){m&&m(),v.clear(),k&&k.abort(),L.fetchers.forEach(((e,t)=>ee(t))),L.blockers.forEach(((e,t)=>pe(t)))},getBlocker:function(e,t){let r=L.blockers.get(e)||le;return $.get(e)!==t&&$.set(e,t),r},deleteBlocker:pe,_internalFetchControllers:F,_internalActiveDeferreds:H,_internalSetRoutes:function(e){s={},l=b(e,i,void 0,s)}},C}function de(e,t,r,n,o,a,i){let l,s;if(null!=a&&"path"!==i){l=[];for(let e of t)if(l.push(e),e.route.id===a){s=e;break}}else l=t,s=t[t.length-1];let u=N(o||".",B(l).map((e=>e.pathnameBase)),T(e.pathname,r)||e.pathname,"path"===i);return null==o&&(u.search=e.search,u.hash=e.hash),null!=o&&""!==o&&"."!==o||!s||!s.route.index||_e(u.search)||(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),n&&"/"!==r&&(u.pathname="/"===u.pathname?r:I([r,u.pathname])),p(u)}function he(e,t,r,n){if(!n||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(n))return{path:r};if(n.formMethod&&(o=n.formMethod,!re.has(o.toLowerCase())))return{path:r,error:De(405,{method:n.formMethod})};var o;let a,i,l=()=>({path:r,error:De(400,{type:"invalid-body"})}),s=n.formMethod||"get",u=e?s.toUpperCase():s.toLowerCase(),d=ke(r);if(void 0!==n.body){if("text/plain"===n.formEncType){if(!Ue(u))return l();let e="string"==typeof n.body?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce(((e,t)=>{let[r,n]=t;return""+e+r+"="+n+"\n"}),""):String(n.body);return{path:r,submission:{formMethod:u,formAction:d,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===n.formEncType){if(!Ue(u))return l();try{let e="string"==typeof n.body?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:u,formAction:d,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return l()}}}if(c("function"==typeof FormData,"FormData is not available in this environment"),n.formData)a=be(n.formData),i=n.formData;else if(n.body instanceof FormData)a=be(n.body),i=n.body;else if(n.body instanceof URLSearchParams)a=n.body,i=we(a);else if(null==n.body)a=new URLSearchParams,i=new FormData;else try{a=new URLSearchParams(n.body),i=we(a)}catch(e){return l()}let h={formMethod:u,formAction:d,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(Ue(h.formMethod))return{path:r,submission:h};let f=m(r);return t&&f.search&&_e(f.search)&&a.append("index",""),f.search="?"+a,{path:p(f),submission:h}}function fe(e,t,r,n,o,i,l,s,u,c,d,h,f,p){let m=p?Object.values(p)[0]:f?Object.values(f)[0]:void 0,v=e.createURL(t.location),y=e.createURL(o),g=p?Object.keys(p)[0]:void 0,b=function(e,t){let r=e;if(t){let n=e.findIndex((e=>e.route.id===t));n>=0&&(r=e.slice(0,n))}return r}(r,g).filter(((e,r)=>{if(e.route.lazy)return!0;if(null==e.route.loader)return!1;if(function(e,t,r){let n=!t||r.route.id!==t.route.id,o=void 0===e[r.route.id];return n||o}(t.loaderData,t.matches[r],e)||l.some((t=>t===e.route.id)))return!0;let o=t.matches[r],s=e;return me(e,a({currentUrl:v,currentParams:o.params,nextUrl:y,nextParams:s.params},n,{actionResult:m,defaultShouldRevalidate:i||v.pathname+v.search===y.pathname+y.search||v.search!==y.search||pe(o,s)}))})),E=[];return u.forEach(((e,o)=>{if(!r.some((t=>t.route.id===e.routeId)))return;let l=w(d,e.path,h);if(!l)return void E.push({key:o,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let u=t.fetchers.get(o),f=Te(l,e.path),p=!1;p=!c.has(o)&&(!!s.includes(o)||(u&&"idle"!==u.state&&void 0===u.data?i:me(f,a({currentUrl:v,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:r[r.length-1].params},n,{actionResult:m,defaultShouldRevalidate:i})))),p&&E.push({key:o,routeId:e.routeId,path:e.path,matches:l,match:f,controller:new AbortController})})),[b,E]}function pe(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function me(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function ve(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let o=r[e.id];c(o,"No route found in manifest");let i={};for(let e in n){let t=void 0!==o[e]&&"hasErrorBoundary"!==e;d(!t,'Route "'+o.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.'),t||g.has(e)||(i[e]=n[e])}Object.assign(o,i),Object.assign(o,a({},t(o),{lazy:void 0}))}async function ye(e,t,r,n,o,a,i,l){let s,u,d;void 0===l&&(l={});let h=e=>{let n,o=new Promise(((e,t)=>n=t));return d=()=>n(),t.signal.addEventListener("abort",d),Promise.race([e({request:t,params:r.params,context:l.requestContext}),o])};try{let n=r.route[e];if(r.route.lazy)if(n)u=(await Promise.all([h(n),ve(r.route,a,o)]))[0];else{if(await ve(r.route,a,o),n=r.route[e],!n){if("action"===e){let e=new URL(t.url),n=e.pathname+e.search;throw De(405,{method:t.method,pathname:n,routeId:r.route.id})}return{type:y.data,data:void 0}}u=await h(n)}else{if(!n){let e=new URL(t.url);throw De(404,{pathname:e.pathname+e.search})}u=await h(n)}c(void 0!==u,"You defined "+("action"===e?"an action":"a loader")+' for route "'+r.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){s=y.error,u=e}finally{d&&t.signal.removeEventListener("abort",d)}if(null!=(f=u)&&"number"==typeof f.status&&"string"==typeof f.statusText&&"object"==typeof f.headers&&void 0!==f.body){let e,o=u.status;if(ne.has(o)){let e=u.headers.get("Location");if(c(e,"Redirects returned/thrown from loaders/actions must have a Location header"),se.test(e)){if(!l.isStaticRequest){let r=new URL(t.url),n=e.startsWith("//")?new URL(r.protocol+e):new URL(e),o=null!=T(n.pathname,i);n.origin===r.origin&&o&&(e=n.pathname+n.search+n.hash)}}else e=de(new URL(t.url),n.slice(0,n.indexOf(r)+1),i,!0,e);if(l.isStaticRequest)throw u.headers.set("Location",e),u;return{type:y.redirect,status:o,location:e,revalidate:null!==u.headers.get("X-Remix-Revalidate"),reloadDocument:null!==u.headers.get("X-Remix-Reload-Document")}}if(l.isRouteRequest)throw{type:s===y.error?y.error:y.data,response:u};let a=u.headers.get("Content-Type");return e=a&&/\bapplication\/json\b/.test(a)?await u.json():await u.text(),s===y.error?{type:s,error:new G(o,u.statusText,e),headers:u.headers}:{type:y.data,data:e,statusCode:u.status,headers:u.headers}}var f,p,m;return s===y.error?{type:s,error:u}:function(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}(u)?{type:y.deferred,deferredData:u,statusCode:null==(p=u.init)?void 0:p.status,headers:(null==(m=u.init)?void 0:m.headers)&&new Headers(u.init.headers)}:{type:y.data,data:u}}function ge(e,t,r,n){let o=e.createURL(ke(t)).toString(),a={signal:r};if(n&&Ue(n.formMethod)){let{formMethod:e,formEncType:t}=n;a.method=e.toUpperCase(),"application/json"===t?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(n.json)):"text/plain"===t?a.body=n.text:"application/x-www-form-urlencoded"===t&&n.formData?a.body=be(n.formData):a.body=n.formData}return new Request(o,a)}function be(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,"string"==typeof n?n:n.name);return t}function we(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function Ee(e,t,r,n,o,i,l,s){let{loaderData:u,errors:d}=function(e,t,r,n,o){let a,i={},l=null,s=!1,u={};return r.forEach(((r,d)=>{let h=t[d].route.id;if(c(!Ae(r),"Cannot handle redirect results in processLoaderData"),Le(r)){let t=xe(e,h),o=r.error;n&&(o=Object.values(n)[0],n=void 0),l=l||{},null==l[t.route.id]&&(l[t.route.id]=o),i[h]=void 0,s||(s=!0,a=Q(r.error)?r.error.status:500),r.headers&&(u[h]=r.headers)}else Pe(r)?(o.set(h,r.deferredData),i[h]=r.deferredData.data):i[h]=r.data,null==r.statusCode||200===r.statusCode||s||(a=r.statusCode),r.headers&&(u[h]=r.headers)})),n&&(l=n,i[Object.keys(n)[0]]=void 0),{loaderData:i,errors:l,statusCode:a||200,loaderHeaders:u}}(t,r,n,o,s);for(let t=0;t<i.length;t++){let{key:r,match:n,controller:o}=i[t];c(void 0!==l&&void 0!==l[t],"Did not find corresponding fetcher result");let s=l[t];if(!o||!o.signal.aborted)if(Le(s)){let t=xe(e.matches,null==n?void 0:n.route.id);d&&d[t.route.id]||(d=a({},d,{[t.route.id]:s.error})),e.fetchers.delete(r)}else if(Ae(s))c(!1,"Unhandled fetcher revalidation redirect");else if(Pe(s))c(!1,"Unhandled fetcher deferred data");else{let t=Ne(s.data);e.fetchers.set(r,t)}}return{loaderData:u,errors:d}}function Re(e,t,r,n){let o=a({},t);for(let a of r){let r=a.route.id;if(t.hasOwnProperty(r)?void 0!==t[r]&&(o[r]=t[r]):void 0!==e[r]&&a.route.loader&&(o[r]=e[r]),n&&n.hasOwnProperty(r))break}return o}function xe(e,t){return(t?e.slice(0,e.findIndex((e=>e.route.id===t))+1):[...e]).reverse().find((e=>!0===e.route.hasErrorBoundary))||e[0]}function Se(e){let t=e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function De(e,t){let{pathname:r,routeId:n,method:o,type:a}=void 0===t?{}:t,i="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(i="Bad Request",o&&r&&n?l="You made a "+o+' request to "'+r+'" but did not provide a `loader` for route "'+n+'", so there is no way to handle the request.':"defer-action"===a?l="defer() is not supported in actions":"invalid-body"===a&&(l="Unable to encode submission body")):403===e?(i="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):404===e?(i="Not Found",l='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",o&&r&&n?l="You made a "+o.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+n+'", so there is no way to handle the request.':o&&(l='Invalid request method "'+o.toUpperCase()+'"')),new G(e||500,i,new Error(l),!0)}function Ce(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(Ae(r))return{result:r,idx:t}}}function ke(e){return p(a({},"string"==typeof e?m(e):e,{hash:""}))}function Pe(e){return e.type===y.deferred}function Le(e){return e.type===y.error}function Ae(e){return(e&&e.type)===y.redirect}function Ue(e){return ee.has(e.toLowerCase())}async function Me(e,t,r,n,o,a){for(let i=0;i<r.length;i++){let l=r[i],s=t[i];if(!s)continue;let u=e.find((e=>e.route.id===s.route.id)),d=null!=u&&!pe(u,s)&&void 0!==(a&&a[s.route.id]);if(Pe(l)&&(o||d)){let e=n[i];c(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await je(l,e,o).then((e=>{e&&(r[i]=e||r[i])}))}}}async function je(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:y.data,data:e.deferredData.unwrappedData}}catch(e){return{type:y.error,error:e}}return{type:y.data,data:e.deferredData.data}}}function _e(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Te(e,t){let r="string"==typeof t?m(t).search:t.search;if(e[e.length-1].route.index&&_e(r||""))return e[e.length-1];let n=B(e);return n[n.length-1]}function Oe(e){let{formMethod:t,formAction:r,formEncType:n,text:o,formData:a,json:i}=e;if(t&&r&&n)return null!=o?{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:o}:null!=a?{formMethod:t,formAction:r,formEncType:n,formData:a,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}:void 0}function Fe(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Be(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," _hasFetcherDoneAnything ":!0}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t," _hasFetcherDoneAnything ":!0}}function Ne(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e," _hasFetcherDoneAnything ":!0}}function Ie(){return Ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ie.apply(this,arguments)}Symbol("deferred");const ze=o.createContext(null),We=o.createContext(null),He=o.createContext(null),$e=o.createContext(null),Ke=o.createContext(null),qe=o.createContext({outlet:null,matches:[],isDataRoute:!1}),Je=o.createContext(null);function Ye(e,t){let{relative:r}=void 0===t?{}:t;Ve()||c(!1);let{basename:n,navigator:a}=o.useContext($e),{hash:i,pathname:l,search:s}=at(e,{relative:r}),u=l;return"/"!==n&&(u="/"===l?n:I([n,l])),a.createHref({pathname:u,search:s,hash:i})}function Ve(){return null!=o.useContext(Ke)}function Xe(){return Ve()||c(!1),o.useContext(Ke).location}function Ge(){return o.useContext(Ke).navigationType}function Qe(e){Ve()||c(!1);let{pathname:t}=Xe();return o.useMemo((()=>j(e,t)),[t,e])}function Ze(e){o.useContext($e).static||o.useLayoutEffect(e)}function et(){let{isDataRoute:e}=o.useContext(qe);return e?function(){let{router:e}=mt(ft.UseNavigateStable),t=yt(pt.UseNavigateStable),r=o.useRef(!1);return Ze((()=>{r.current=!0})),o.useCallback((function(n,o){void 0===o&&(o={}),r.current&&("number"==typeof n?e.navigate(n):e.navigate(n,Ie({fromRouteId:t},o)))}),[e,t])}():function(){Ve()||c(!1);let e=o.useContext(ze),{basename:t,navigator:r}=o.useContext($e),{matches:n}=o.useContext(qe),{pathname:a}=Xe(),i=JSON.stringify(B(n).map((e=>e.pathnameBase))),l=o.useRef(!1);return Ze((()=>{l.current=!0})),o.useCallback((function(n,o){if(void 0===o&&(o={}),!l.current)return;if("number"==typeof n)return void r.go(n);let s=N(n,JSON.parse(i),a,"path"===o.relative);null==e&&"/"!==t&&(s.pathname="/"===s.pathname?t:I([t,s.pathname])),(o.replace?r.replace:r.push)(s,o.state,o)}),[t,r,i,a,e])}()}const tt=o.createContext(null);function rt(){return o.useContext(tt)}function nt(e){let t=o.useContext(qe).outlet;return t?o.createElement(tt.Provider,{value:e},t):t}function ot(){let{matches:e}=o.useContext(qe),t=e[e.length-1];return t?t.params:{}}function at(e,t){let{relative:r}=void 0===t?{}:t,{matches:n}=o.useContext(qe),{pathname:a}=Xe(),i=JSON.stringify(B(n).map((e=>e.pathnameBase)));return o.useMemo((()=>N(e,JSON.parse(i),a,"path"===r)),[e,i,a,r])}function it(e,t){return lt(e,t)}function lt(e,t,r){Ve()||c(!1);let{navigator:a}=o.useContext($e),{matches:i}=o.useContext(qe),l=i[i.length-1],s=l?l.params:{},u=(l&&l.pathname,l?l.pathnameBase:"/");l&&l.route;let d,h=Xe();if(t){var f;let e="string"==typeof t?m(t):t;"/"===u||(null==(f=e.pathname)?void 0:f.startsWith(u))||c(!1),d=e}else d=h;let p=d.pathname||"/",v=w(e,{pathname:"/"===u?p:p.slice(u.length)||"/"}),y=ht(v&&v.map((e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:I([u,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?u:I([u,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),i,r);return t&&y?o.createElement(Ke.Provider,{value:{location:Ie({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:n.Pop}},y):y}function st(){let e=Dt(),t=Q(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return o.createElement(o.Fragment,null,o.createElement("h2",null,"Unexpected Application Error!"),o.createElement("h3",{style:{fontStyle:"italic"}},t),r?o.createElement("pre",{style:n},r):null,null)}const ut=o.createElement(st,null);class ct extends o.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||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error||t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error?o.createElement(qe.Provider,{value:this.props.routeContext},o.createElement(Je.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function dt(e){let{routeContext:t,match:r,children:n}=e,a=o.useContext(ze);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),o.createElement(qe.Provider,{value:t},n)}function ht(e,t,r){var n;if(void 0===t&&(t=[]),void 0===r&&(r=null),null==e){var a;if(null==(a=r)||!a.errors)return null;e=r.matches}let i=e,l=null==(n=r)?void 0:n.errors;if(null!=l){let e=i.findIndex((e=>e.route.id&&(null==l?void 0:l[e.route.id])));e>=0||c(!1),i=i.slice(0,Math.min(i.length,e+1))}return i.reduceRight(((e,n,a)=>{let s=n.route.id?null==l?void 0:l[n.route.id]:null,u=null;r&&(u=n.route.errorElement||ut);let c=t.concat(i.slice(0,a+1)),d=()=>{let t;return t=s?u:n.route.Component?o.createElement(n.route.Component,null):n.route.element?n.route.element:e,o.createElement(dt,{match:n,routeContext:{outlet:e,matches:c,isDataRoute:null!=r},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||0===a)?o.createElement(ct,{location:r.location,revalidation:r.revalidation,component:u,error:s,children:d(),routeContext:{outlet:null,matches:c,isDataRoute:!0}}):d()}),null)}var ft=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ft||{}),pt=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(pt||{});function mt(e){let t=o.useContext(ze);return t||c(!1),t}function vt(e){let t=o.useContext(We);return t||c(!1),t}function yt(e){let t=function(e){let t=o.useContext(qe);return t||c(!1),t}(),r=t.matches[t.matches.length-1];return r.route.id||c(!1),r.route.id}function gt(){return yt(pt.UseRouteId)}function bt(){return vt(pt.UseNavigation).navigation}function wt(){let e=mt(ft.UseRevalidator),t=vt(pt.UseRevalidator);return o.useMemo((()=>({revalidate:e.router.revalidate,state:t.revalidation})),[e.router.revalidate,t.revalidation])}function Et(){let{matches:e,loaderData:t}=vt(pt.UseMatches);return o.useMemo((()=>e.map((e=>{let{pathname:r,params:n}=e;return{id:e.route.id,pathname:r,params:n,data:t[e.route.id],handle:e.route.handle}}))),[e,t])}function Rt(){let e=vt(pt.UseLoaderData),t=yt(pt.UseLoaderData);if(!e.errors||null==e.errors[t])return e.loaderData[t];console.error("You cannot `useLoaderData` in an errorElement (routeId: "+t+")")}function xt(e){return vt(pt.UseRouteLoaderData).loaderData[e]}function St(){let e=vt(pt.UseActionData);return o.useContext(qe)||c(!1),Object.values((null==e?void 0:e.actionData)||{})[0]}function Dt(){var e;let t=o.useContext(Je),r=vt(pt.UseRouteError),n=yt(pt.UseRouteError);return t||(null==(e=r.errors)?void 0:e[n])}function Ct(){let e=o.useContext(He);return null==e?void 0:e._data}function kt(){let e=o.useContext(He);return null==e?void 0:e._error}let Pt=0;function Lt(e){let{router:t,basename:r}=mt(ft.UseBlocker),n=vt(pt.UseBlocker),[a,i]=o.useState(""),l=o.useCallback((t=>{if("function"!=typeof e)return!!e;if("/"===r)return e(t);let{currentLocation:n,nextLocation:o,historyAction:a}=t;return e({currentLocation:Ie({},n,{pathname:T(n.pathname,r)||n.pathname}),nextLocation:Ie({},o,{pathname:T(o.pathname,r)||o.pathname}),historyAction:a})}),[r,e]);return o.useEffect((()=>{let e=String(++Pt);return i(e),()=>t.deleteBlocker(e)}),[t]),o.useEffect((()=>{""!==a&&t.getBlocker(a,l)}),[t,a,l]),a&&n.blockers.has(a)?n.blockers.get(a):le}const At=o.startTransition;function Ut(e){let{fallbackElement:t,router:r,future:n}=e,[a,i]=o.useState(r.state),{v7_startTransition:l}=n||{},s=o.useCallback((e=>{l&&At?At((()=>i(e))):i(e)}),[i,l]);o.useLayoutEffect((()=>r.subscribe(s)),[r,s]);let u=o.useMemo((()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:e=>r.navigate(e),push:(e,t,n)=>r.navigate(e,{state:t,preventScrollReset:null==n?void 0:n.preventScrollReset}),replace:(e,t,n)=>r.navigate(e,{replace:!0,state:t,preventScrollReset:null==n?void 0:n.preventScrollReset})})),[r]),c=r.basename||"/",d=o.useMemo((()=>({router:r,navigator:u,static:!1,basename:c})),[r,u,c]);return o.createElement(o.Fragment,null,o.createElement(ze.Provider,{value:d},o.createElement(We.Provider,{value:a},o.createElement(Ft,{basename:c,location:a.location,navigationType:a.historyAction,navigator:u},a.initialized?o.createElement(Mt,{routes:r.routes,state:a}):t))),null)}function Mt(e){let{routes:t,state:r}=e;return lt(t,void 0,r)}function jt(e){let{basename:t,children:r,initialEntries:n,initialIndex:a,future:i}=e,s=o.useRef();null==s.current&&(s.current=l({initialEntries:n,initialIndex:a,v5Compat:!0}));let u=s.current,[c,d]=o.useState({action:u.action,location:u.location}),{v7_startTransition:h}=i||{},f=o.useCallback((e=>{h&&At?At((()=>d(e))):d(e)}),[d,h]);return o.useLayoutEffect((()=>u.listen(f)),[u,f]),o.createElement(Ft,{basename:t,children:r,location:c.location,navigationType:c.action,navigator:u})}function _t(e){let{to:t,replace:r,state:n,relative:a}=e;Ve()||c(!1);let{matches:i}=o.useContext(qe),{pathname:l}=Xe(),s=et(),u=N(t,B(i).map((e=>e.pathnameBase)),l,"path"===a),d=JSON.stringify(u);return o.useEffect((()=>s(JSON.parse(d),{replace:r,state:n,relative:a})),[s,d,a,r,n]),null}function Tt(e){return nt(e.context)}function Ot(e){c(!1)}function Ft(e){let{basename:t="/",children:r=null,location:a,navigationType:i=n.Pop,navigator:l,static:s=!1}=e;Ve()&&c(!1);let u=t.replace(/^\/*/,"/"),d=o.useMemo((()=>({basename:u,navigator:l,static:s})),[u,l,s]);"string"==typeof a&&(a=m(a));let{pathname:h="/",search:f="",hash:p="",state:v=null,key:y="default"}=a,g=o.useMemo((()=>{let e=T(h,u);return null==e?null:{location:{pathname:e,search:f,hash:p,state:v,key:y},navigationType:i}}),[u,h,f,p,v,y,i]);return null==g?null:o.createElement($e.Provider,{value:d},o.createElement(Ke.Provider,{children:r,value:g}))}function Bt(e){let{children:t,location:r}=e;return it($t(t),r)}function Nt(e){let{children:t,errorElement:r,resolve:n}=e;return o.createElement(Wt,{resolve:n,errorElement:r},o.createElement(Ht,null,t))}var It=function(e){return e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error",e}(It||{});const zt=new Promise((()=>{}));class Wt extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("<Await> caught the following error during render",e,t)}render(){let{children:e,errorElement:t,resolve:r}=this.props,n=null,a=It.pending;if(r instanceof Promise)if(this.state.error){a=It.error;let e=this.state.error;n=Promise.reject().catch((()=>{})),Object.defineProperty(n,"_tracked",{get:()=>!0}),Object.defineProperty(n,"_error",{get:()=>e})}else r._tracked?(n=r,a=void 0!==n._error?It.error:void 0!==n._data?It.success:It.pending):(a=It.pending,Object.defineProperty(r,"_tracked",{get:()=>!0}),n=r.then((e=>Object.defineProperty(r,"_data",{get:()=>e})),(e=>Object.defineProperty(r,"_error",{get:()=>e}))));else a=It.success,n=Promise.resolve(),Object.defineProperty(n,"_tracked",{get:()=>!0}),Object.defineProperty(n,"_data",{get:()=>r});if(a===It.error&&n._error instanceof K)throw zt;if(a===It.error&&!t)throw n._error;if(a===It.error)return o.createElement(He.Provider,{value:n,children:t});if(a===It.success)return o.createElement(He.Provider,{value:n,children:e});throw n}}function Ht(e){let{children:t}=e,r=Ct(),n="function"==typeof t?t(r):t;return o.createElement(o.Fragment,null,n)}function $t(e,t){void 0===t&&(t=[]);let r=[];return o.Children.forEach(e,((e,n)=>{if(!o.isValidElement(e))return;let a=[...t,n];if(e.type===o.Fragment)return void r.push.apply(r,$t(e.props.children,a));e.type!==Ot&&c(!1),e.props.index&&e.props.children&&c(!1);let i={id:e.props.id||a.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(i.children=$t(e.props.children,a)),r.push(i)})),r}function Kt(e){return ht(e)}function qt(e){let t={hasErrorBoundary:null!=e.ErrorBoundary||null!=e.errorElement};return e.Component&&Object.assign(t,{element:o.createElement(e.Component),Component:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:o.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function Jt(e,t){return ce({basename:null==t?void 0:t.basename,future:Ie({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:l({initialEntries:null==t?void 0:t.initialEntries,initialIndex:null==t?void 0:t.initialIndex}),hydrationData:null==t?void 0:t.hydrationData,routes:e,mapRouteProperties:qt}).initialize()}function Yt(){return Yt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yt.apply(this,arguments)}function Vt(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}const Xt="get",Gt="application/x-www-form-urlencoded";function Qt(e){return null!=e&&"string"==typeof e.tagName}function Zt(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}let er=null;const tr=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function rr(e){return null==e||tr.has(e)?e:null}function nr(e,t){let r,n,o,a,i;if(Qt(l=e)&&"form"===l.tagName.toLowerCase()){let i=e.getAttribute("action");n=i?T(i,t):null,r=e.getAttribute("method")||Xt,o=rr(e.getAttribute("enctype"))||Gt,a=new FormData(e)}else if(function(e){return Qt(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return Qt(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||i.getAttribute("action");if(n=l?T(l,t):null,r=e.getAttribute("formmethod")||i.getAttribute("method")||Xt,o=rr(e.getAttribute("formenctype"))||rr(i.getAttribute("enctype"))||Gt,a=new FormData(i,e),!function(){if(null===er)try{new FormData(document.createElement("form"),0),er=!1}catch(e){er=!0}return er}()){let{name:t,type:r,value:n}=e;if("image"===r){let e=t?t+".":"";a.append(e+"x","0"),a.append(e+"y","0")}else t&&a.append(t,n)}}else{if(Qt(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Xt,n=null,o=Gt,i=e}var l;return a&&"text/plain"===o&&(i=a,a=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:a,body:i}}const or=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],ar=["aria-current","caseSensitive","className","end","style","to","children"],ir=["reloadDocument","replace","state","method","action","onSubmit","submit","relative","preventScrollReset"];function lr(e,t){return ce({basename:null==t?void 0:t.basename,future:Yt({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:s({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||ur(),routes:e,mapRouteProperties:qt}).initialize()}function sr(e,t){return ce({basename:null==t?void 0:t.basename,future:Yt({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:u({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||ur(),routes:e,mapRouteProperties:qt}).initialize()}function ur(){var e;let t=null==(e=window)?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Yt({},t,{errors:cr(t.errors)})),t}function cr(e){if(!e)return null;let t=Object.entries(e),r={};for(let[e,n]of t)if(n&&"RouteErrorResponse"===n.__type)r[e]=new G(n.status,n.statusText,n.data,!0===n.internal);else if(n&&"Error"===n.__type){if(n.__subType){let t=window[n.__subType];if("function"==typeof t)try{let o=new t(n.message);o.stack="",r[e]=o}catch(e){}}if(null==r[e]){let t=new Error(n.message);t.stack="",r[e]=t}}else r[e]=n;return r}const dr=o.startTransition;function hr(e){let{basename:t,children:r,future:n,window:a}=e,i=o.useRef();null==i.current&&(i.current=s({window:a,v5Compat:!0}));let l=i.current,[u,c]=o.useState({action:l.action,location:l.location}),{v7_startTransition:d}=n||{},h=o.useCallback((e=>{d&&dr?dr((()=>c(e))):c(e)}),[c,d]);return o.useLayoutEffect((()=>l.listen(h)),[l,h]),o.createElement(Ft,{basename:t,children:r,location:u.location,navigationType:u.action,navigator:l})}function fr(e){let{basename:t,children:r,future:n,window:a}=e,i=o.useRef();null==i.current&&(i.current=u({window:a,v5Compat:!0}));let l=i.current,[s,c]=o.useState({action:l.action,location:l.location}),{v7_startTransition:d}=n||{},h=o.useCallback((e=>{d&&dr?dr((()=>c(e))):c(e)}),[c,d]);return o.useLayoutEffect((()=>l.listen(h)),[l,h]),o.createElement(Ft,{basename:t,children:r,location:s.location,navigationType:s.action,navigator:l})}function pr(e){let{basename:t,children:r,future:n,history:a}=e,[i,l]=o.useState({action:a.action,location:a.location}),{v7_startTransition:s}=n||{},u=o.useCallback((e=>{s&&dr?dr((()=>l(e))):l(e)}),[l,s]);return o.useLayoutEffect((()=>a.listen(u)),[a,u]),o.createElement(Ft,{basename:t,children:r,location:i.location,navigationType:i.action,navigator:a})}const mr="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,vr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yr=o.forwardRef((function(e,t){let r,{onClick:n,relative:a,reloadDocument:i,replace:l,state:s,target:u,to:c,preventScrollReset:d}=e,h=Vt(e,or),{basename:f}=o.useContext($e),p=!1;if("string"==typeof c&&vr.test(c)&&(r=c,mr))try{let e=new URL(window.location.href),t=c.startsWith("//")?new URL(e.protocol+c):new URL(c),r=T(t.pathname,f);t.origin===e.origin&&null!=r?c=r+t.search+t.hash:p=!0}catch(e){}let m=Ye(c,{relative:a}),v=Cr(c,{replace:l,state:s,target:u,preventScrollReset:d,relative:a});return o.createElement("a",Yt({},h,{href:r||m,onClick:p||i?n:function(e){n&&n(e),e.defaultPrevented||v(e)},ref:t,target:u}))})),gr=o.forwardRef((function(e,t){let{"aria-current":r="page",caseSensitive:n=!1,className:a="",end:i=!1,style:l,to:s,children:u}=e,c=Vt(e,ar),d=at(s,{relative:c.relative}),h=Xe(),f=o.useContext(We),{navigator:p}=o.useContext($e),m=p.encodeLocation?p.encodeLocation(d).pathname:d.pathname,v=h.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;n||(v=v.toLowerCase(),y=y?y.toLowerCase():null,m=m.toLowerCase());let g,b=v===m||!i&&v.startsWith(m)&&"/"===v.charAt(m.length),w=null!=y&&(y===m||!i&&y.startsWith(m)&&"/"===y.charAt(m.length)),E=b?r:void 0;g="function"==typeof a?a({isActive:b,isPending:w}):[a,b?"active":null,w?"pending":null].filter(Boolean).join(" ");let R="function"==typeof l?l({isActive:b,isPending:w}):l;return o.createElement(yr,Yt({},c,{"aria-current":E,className:g,ref:t,style:R,to:s}),"function"==typeof u?u({isActive:b,isPending:w}):u)})),br=o.forwardRef(((e,t)=>{let r=Lr();return o.createElement(wr,Yt({},e,{submit:r,ref:t}))})),wr=o.forwardRef(((e,t)=>{let{reloadDocument:r,replace:n,state:a,method:i=Xt,action:l,onSubmit:s,submit:u,relative:c,preventScrollReset:d}=e,h=Vt(e,ir),f="get"===i.toLowerCase()?"get":"post",p=Ur(l,{relative:c});return o.createElement("form",Yt({ref:t,method:f,action:p,onSubmit:r?s:e=>{if(s&&s(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,r=(null==t?void 0:t.getAttribute("formmethod"))||i;u(t||e.currentTarget,{method:r,replace:n,state:a,relative:c,preventScrollReset:d})}},h))}));function Er(e){let{getKey:t,storageKey:r}=e;return Fr({getKey:t,storageKey:r}),null}var Rr,xr;function Sr(e){let t=o.useContext(ze);return t||c(!1),t}function Dr(e){let t=o.useContext(We);return t||c(!1),t}function Cr(e,t){let{target:r,replace:n,state:a,preventScrollReset:i,relative:l}=void 0===t?{}:t,s=et(),u=Xe(),c=at(e,{relative:l});return o.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,r)){t.preventDefault();let r=void 0!==n?n:p(u)===p(c);s(e,{replace:r,state:a,preventScrollReset:i,relative:l})}}),[u,s,c,n,a,r,e,i,l])}function kr(e){let t=o.useRef(Zt(e)),r=o.useRef(!1),n=Xe(),a=o.useMemo((()=>function(e,t){let r=Zt(e);return t&&t.forEach(((e,n)=>{r.has(n)||t.getAll(n).forEach((e=>{r.append(n,e)}))})),r}(n.search,r.current?null:t.current)),[n.search]),i=et(),l=o.useCallback(((e,t)=>{const n=Zt("function"==typeof e?e(a):e);r.current=!0,i("?"+n,t)}),[i,a]);return[a,l]}function Pr(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}function Lr(){let{router:e}=Sr(Rr.UseSubmit),{basename:t}=o.useContext($e),r=gt();return o.useCallback((function(n,o){void 0===o&&(o={}),Pr();let{action:a,method:i,encType:l,formData:s,body:u}=nr(n,t);e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:s,body:u,formMethod:o.method||i,formEncType:o.encType||l,replace:o.replace,state:o.state,fromRouteId:r})}),[e,t,r])}function Ar(e,t){let{router:r}=Sr(Rr.UseSubmitFetcher),{basename:n}=o.useContext($e);return o.useCallback((function(o,a){void 0===a&&(a={}),Pr();let{action:i,method:l,encType:s,formData:u,body:d}=nr(o,n);null==t&&c(!1),r.fetch(e,t,a.action||i,{preventScrollReset:a.preventScrollReset,formData:u,body:d,formMethod:a.method||l,formEncType:a.encType||s})}),[r,n,e,t])}function Ur(e,t){let{relative:r}=void 0===t?{}:t,{basename:n}=o.useContext($e),a=o.useContext(qe);a||c(!1);let[i]=a.matches.slice(-1),l=Yt({},at(e||".",{relative:r})),s=Xe();if(null==e&&(l.search=s.search,i.route.index)){let e=new URLSearchParams(l.search);e.delete("index"),l.search=e.toString()?"?"+e.toString():""}return e&&"."!==e||!i.route.index||(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),"/"!==n&&(l.pathname="/"===l.pathname?n:I([n,l.pathname])),p(l)}(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher"})(Rr||(Rr={})),function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(xr||(xr={}));let Mr=0;function jr(){var e;let{router:t}=Sr(Rr.UseFetcher),r=o.useContext(qe);r||c(!1);let n=null==(e=r.matches[r.matches.length-1])?void 0:e.route.id;null==n&&c(!1);let[a]=o.useState((()=>String(++Mr))),[i]=o.useState((()=>(n||c(!1),function(e,t){return o.forwardRef(((r,n)=>{let a=Ar(e,t);return o.createElement(wr,Yt({},r,{ref:n,submit:a}))}))}(a,n)))),[l]=o.useState((()=>e=>{t||c(!1),n||c(!1),t.fetch(a,n,e)})),s=Ar(a,n),u=t.getFetcher(a),d=o.useMemo((()=>Yt({Form:i,submit:s,load:l},u)),[u,i,s,l]);return o.useEffect((()=>()=>{t?t.deleteFetcher(a):console.warn("No router available to clean up from useFetcher()")}),[t,a]),d}function _r(){return[...Dr(xr.UseFetchers).fetchers.values()]}const Tr="react-router-scroll-positions";let Or={};function Fr(e){let{getKey:t,storageKey:r}=void 0===e?{}:e,{router:n}=Sr(Rr.UseScrollRestoration),{restoreScrollPosition:a,preventScrollReset:i}=Dr(xr.UseScrollRestoration),{basename:l}=o.useContext($e),s=Xe(),u=Et(),c=bt();o.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(e,t){let{capture:r}={};o.useEffect((()=>{let t=null!=r?{capture:r}:void 0;return window.addEventListener("pagehide",e,t),()=>{window.removeEventListener("pagehide",e,t)}}),[e,r])}(o.useCallback((()=>{if("idle"===c.state){let e=(t?t(s,u):null)||s.key;Or[e]=window.scrollY}sessionStorage.setItem(r||Tr,JSON.stringify(Or)),window.history.scrollRestoration="auto"}),[r,t,c.state,s,u])),"undefined"!=typeof document&&(o.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(r||Tr);e&&(Or=JSON.parse(e))}catch(e){}}),[r]),o.useLayoutEffect((()=>{let e=t&&"/"!==l?(e,r)=>t(Yt({},e,{pathname:T(e.pathname,l)||e.pathname}),r):t,r=null==n?void 0:n.enableScrollRestoration(Or,(()=>window.scrollY),e);return()=>r&&r()}),[n,l,t]),o.useLayoutEffect((()=>{if(!1!==a)if("number"!=typeof a){if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==i&&window.scrollTo(0,0)}else window.scrollTo(0,a)}),[s,a,i]))}function Br(e,t){let{capture:r}=t||{};o.useEffect((()=>{let t=null!=r?{capture:r}:void 0;return window.addEventListener("beforeunload",e,t),()=>{window.removeEventListener("beforeunload",e,t)}}),[e,r])}function Nr(e){let{when:t,message:r}=e,n=Lt(t);o.useEffect((()=>{"blocked"===n.state&&(window.confirm(r)?setTimeout(n.proceed,0):n.reset())}),[n,r]),o.useEffect((()=>{"blocked"!==n.state||t||n.reset()}),[n,t])}}}]);
2
+ "use strict";(globalThis.webpackChunk_kenyaemr_esm_bed_management_app=globalThis.webpackChunk_kenyaemr_esm_bed_management_app||[]).push([[26],{8026:(e,t,r)=>{r.r(t),r.d(t,{AbortedDeferredError:()=>K,Await:()=>Nt,BrowserRouter:()=>hr,Form:()=>br,HashRouter:()=>fr,Link:()=>yr,MemoryRouter:()=>jt,NavLink:()=>gr,Navigate:()=>_t,NavigationType:()=>n,Outlet:()=>Tt,Route:()=>Ot,Router:()=>Ft,RouterProvider:()=>Ut,Routes:()=>Bt,ScrollRestoration:()=>Er,UNSAFE_DataRouterContext:()=>ze,UNSAFE_DataRouterStateContext:()=>We,UNSAFE_LocationContext:()=>Ke,UNSAFE_NavigationContext:()=>$e,UNSAFE_RouteContext:()=>qe,UNSAFE_useRouteId:()=>gt,UNSAFE_useScrollRestoration:()=>Fr,createBrowserRouter:()=>lr,createHashRouter:()=>sr,createMemoryRouter:()=>Jt,createPath:()=>p,createRoutesFromChildren:()=>$t,createRoutesFromElements:()=>$t,createSearchParams:()=>Zt,defer:()=>Y,generatePath:()=>M,isRouteErrorResponse:()=>Q,json:()=>$,matchPath:()=>j,matchRoutes:()=>w,parsePath:()=>m,redirect:()=>V,redirectDocument:()=>X,renderMatches:()=>Kt,resolvePath:()=>O,unstable_HistoryRouter:()=>pr,unstable_useBlocker:()=>Lt,unstable_usePrompt:()=>Nr,useActionData:()=>St,useAsyncError:()=>kt,useAsyncValue:()=>Ct,useBeforeUnload:()=>Br,useFetcher:()=>jr,useFetchers:()=>_r,useFormAction:()=>Ur,useHref:()=>Ye,useInRouterContext:()=>Ve,useLinkClickHandler:()=>Cr,useLoaderData:()=>Rt,useLocation:()=>Xe,useMatch:()=>Qe,useMatches:()=>Et,useNavigate:()=>et,useNavigation:()=>bt,useNavigationType:()=>Ge,useOutlet:()=>nt,useOutletContext:()=>rt,useParams:()=>ot,useResolvedPath:()=>at,useRevalidator:()=>wt,useRouteError:()=>Dt,useRouteLoaderData:()=>xt,useRoutes:()=>it,useSearchParams:()=>kr,useSubmit:()=>Lr});var n,o=r(81672);function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(n||(n={}));const i="popstate";function l(e){void 0===e&&(e={});let t,{initialEntries:r=["/"],initialIndex:o,v5Compat:a=!1}=e;t=r.map(((e,t)=>h(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let i=u(null==o?t.length-1:o),l=n.Pop,s=null;function u(e){return Math.min(Math.max(e,0),t.length-1)}function c(){return t[i]}function h(e,r,n){void 0===r&&(r=null);let o=f(t?c().pathname:"/",e,r,n);return d("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}function v(e){return"string"==typeof e?e:p(e)}return{get index(){return i},get action(){return l},get location(){return c()},createHref:v,createURL:e=>new URL(v(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?m(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,r){l=n.Push;let o=h(e,r);i+=1,t.splice(i,t.length,o),a&&s&&s({action:l,location:o,delta:1})},replace(e,r){l=n.Replace;let o=h(e,r);t[i]=o,a&&s&&s({action:l,location:o,delta:0})},go(e){l=n.Pop;let r=u(i+e),o=t[r];i=r,s&&s({action:l,location:o,delta:e})},listen:e=>(s=e,()=>{s=null})}}function s(e){return void 0===e&&(e={}),v((function(e,t){let{pathname:r,search:n,hash:o}=e.location;return f("",{pathname:r,search:n,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:p(t)}),null,e)}function u(e){return void 0===e&&(e={}),v((function(e,t){let{pathname:r="/",search:n="",hash:o=""}=m(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),f("",{pathname:r,search:n,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),n="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");n=-1===r?t:t.slice(0,r)}return n+"#"+("string"==typeof t?t:p(t))}),(function(e,t){d("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)}function c(e,t){if(!1===e||null==e)throw new Error(t)}function d(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function h(e,t){return{usr:e.state,key:e.key,idx:t}}function f(e,t,r,n){return void 0===r&&(r=null),a({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?m(t):t,{state:r,key:t&&t.key||n||Math.random().toString(36).substr(2,8)})}function p(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),n&&"#"!==n&&(t+="#"===n.charAt(0)?n:"#"+n),t}function m(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function v(e,t,r,o){void 0===o&&(o={});let{window:l=document.defaultView,v5Compat:s=!1}=o,u=l.history,d=n.Pop,m=null,v=y();function y(){return(u.state||{idx:null}).idx}function g(){d=n.Pop;let e=y(),t=null==e?null:e-v;v=e,m&&m({action:d,location:w.location,delta:t})}function b(e){let t="null"!==l.location.origin?l.location.origin:l.location.href,r="string"==typeof e?e:p(e);return c(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==v&&(v=0,u.replaceState(a({},u.state,{idx:v}),""));let w={get action(){return d},get location(){return e(l,u)},listen(e){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(i,g),m=e,()=>{l.removeEventListener(i,g),m=null}},createHref:e=>t(l,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){d=n.Push;let o=f(w.location,e,t);r&&r(o,e),v=y()+1;let a=h(o,v),i=w.createHref(o);try{u.pushState(a,"",i)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;l.location.assign(i)}s&&m&&m({action:d,location:w.location,delta:1})},replace:function(e,t){d=n.Replace;let o=f(w.location,e,t);r&&r(o,e),v=y();let a=h(o,v),i=w.createHref(o);u.replaceState(a,"",i),s&&m&&m({action:d,location:w.location,delta:0})},go:e=>u.go(e)};return w}var y;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(y||(y={}));const g=new Set(["lazy","caseSensitive","path","id","index","children"]);function b(e,t,r,n){return void 0===r&&(r=[]),void 0===n&&(n={}),e.map(((e,o)=>{let i=[...r,o],l="string"==typeof e.id?e.id:i.join("-");if(c(!0!==e.index||!e.children,"Cannot specify children on an index route"),c(!n[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let r=a({},e,t(e),{id:l});return n[l]=r,r}{let r=a({},e,t(e),{id:l,children:void 0});return n[l]=r,e.children&&(r.children=b(e.children,t,i,n)),r}}))}function w(e,t,r){void 0===r&&(r="/");let n=T(("string"==typeof t?m(t):t).pathname||"/",r);if(null==n)return null;let o=E(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let a=null;for(let e=0;null==a&&e<o.length;++e)a=U(o[e],_(n));return a}function E(e,t,r,n){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===n&&(n="");let o=(e,o,a)=>{let i={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};i.relativePath.startsWith("/")&&(c(i.relativePath.startsWith(n),'Absolute route path "'+i.relativePath+'" nested under path "'+n+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),i.relativePath=i.relativePath.slice(n.length));let l=I([n,i.relativePath]),s=r.concat(i);e.children&&e.children.length>0&&(c(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),E(e.children,t,s,l)),(null!=e.path||e.index)&&t.push({path:l,score:A(l,e.index),routesMeta:s})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of R(e.path))o(e,t,r);else o(e,t)})),t}function R(e){let t=e.split("/");if(0===t.length)return[];let[r,...n]=t,o=r.endsWith("?"),a=r.replace(/\?$/,"");if(0===n.length)return o?[a,""]:[a];let i=R(n.join("/")),l=[];return l.push(...i.map((e=>""===e?a:[a,e].join("/")))),o&&l.push(...i),l.map((t=>e.startsWith("/")&&""===t?"/":t))}const x=/^:\w+$/,S=3,D=2,C=1,k=10,P=-2,L=e=>"*"===e;function A(e,t){let r=e.split("/"),n=r.length;return r.some(L)&&(n+=P),t&&(n+=D),r.filter((e=>!L(e))).reduce(((e,t)=>e+(x.test(t)?S:""===t?C:k)),n)}function U(e,t){let{routesMeta:r}=e,n={},o="/",a=[];for(let e=0;e<r.length;++e){let i=r[e],l=e===r.length-1,s="/"===o?t:t.slice(o.length)||"/",u=j({path:i.relativePath,caseSensitive:i.caseSensitive,end:l},s);if(!u)return null;Object.assign(n,u.params);let c=i.route;a.push({params:n,pathname:I([o,u.pathname]),pathnameBase:z(I([o,u.pathnameBase])),route:c}),"/"!==u.pathnameBase&&(o=I([o,u.pathnameBase]))}return a}function M(e,t){void 0===t&&(t={});let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(d(!1,'Route path "'+r+'" will be treated as if it were "'+r.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+r.replace(/\*$/,"/*")+'".'),r=r.replace(/\*$/,"/*"));const n=r.startsWith("/")?"/":"",o=e=>null==e?"":"string"==typeof e?e:String(e);return n+r.split(/\/+/).map(((e,r,n)=>{if(r===n.length-1&&"*"===e)return o(t["*"]);const a=e.match(/^:(\w+)(\??)$/);if(a){const[,e,r]=a;let n=t[e];return c("?"===r||null!=n,'Missing ":'+e+'" param'),o(n)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")}function j(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!0),d("*"===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 n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,((e,t)=>(n.push(t),"/([^\\/]+)")));return e.endsWith("*")?(n.push("*"),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:n.reduce(((e,t,r)=>{if("*"===t){let e=l[r]||"";i=a.slice(0,a.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(r){return d(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+r+")."),e}}(l[r]||"",t),e}),{}),pathname:a,pathnameBase:i,pattern:e}}function _(e){try{return decodeURI(e)}catch(t){return d(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function T(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&"/"!==n?null:e.slice(r)||"/"}function O(e,t){void 0===t&&(t="/");let{pathname:r,search:n="",hash:o=""}="string"==typeof e?m(e):e,a=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:a,search:W(n),hash:H(o)}}function F(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function B(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function N(e,t,r,n){let o;void 0===n&&(n=!1),"string"==typeof e?o=m(e):(o=a({},e),c(!o.pathname||!o.pathname.includes("?"),F("?","pathname","search",o)),c(!o.pathname||!o.pathname.includes("#"),F("#","pathname","hash",o)),c(!o.search||!o.search.includes("#"),F("#","search","hash",o)));let i,l=""===e||""===o.pathname,s=l?"/":o.pathname;if(n||null==s)i=r;else{let e=t.length-1;if(s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}i=e>=0?t[e]:"/"}let u=O(o,i),d=s&&"/"!==s&&s.endsWith("/"),h=(l||"."===s)&&r.endsWith("/");return u.pathname.endsWith("/")||!d&&!h||(u.pathname+="/"),u}const I=e=>e.join("/").replace(/\/\/+/g,"/"),z=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),W=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",H=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"",$=function(e,t){void 0===t&&(t={});let r="number"==typeof t?{status:t}:t,n=new Headers(r.headers);return n.has("Content-Type")||n.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),a({},r,{headers:n}))};class K extends Error{}class q{constructor(e,t){let r;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],c(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise(((e,t)=>r=t)),this.controller=new AbortController;let n=()=>r(new K("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",n),this.controller.signal.addEventListener("abort",n),this.data=Object.entries(e).reduce(((e,t)=>{let[r,n]=t;return Object.assign(e,{[r]:this.trackPromise(r,n)})}),{}),this.done&&this.unlistenAbortSignal(),this.init=t}trackPromise(e,t){if(!(t instanceof Promise))return t;this.deferredKeys.push(e),this.pendingKeysSet.add(e);let r=Promise.race([t,this.abortPromise]).then((t=>this.onSettle(r,e,void 0,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,n){if(this.controller.signal.aborted&&r instanceof K)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===r&&void 0===n){let r=new Error('Deferred data for key "'+t+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)}return void 0===n?(Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>n}),this.emit(!1,t),n)}emit(e,t){this.subscribers.forEach((r=>r(e,t)))}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach(((e,t)=>this.pendingKeysSet.delete(t))),this.emit(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise((t=>{this.subscribe((n=>{e.removeEventListener("abort",r),(n||this.done)&&t(n)}))}))}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return c(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,n]=t;return Object.assign(e,{[r]:J(n)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function J(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const Y=function(e,t){return void 0===t&&(t={}),new q(e,"number"==typeof t?{status:t}:t)},V=function(e,t){void 0===t&&(t=302);let r=t;"number"==typeof r?r={status:r}:void 0===r.status&&(r.status=302);let n=new Headers(r.headers);return n.set("Location",e),new Response(null,a({},r,{headers:n}))},X=(e,t)=>{let r=V(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r};class G{constructor(e,t,r,n){void 0===n&&(n=!1),this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function Q(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const Z=["post","put","patch","delete"],ee=new Set(Z),te=["get",...Z],re=new Set(te),ne=new Set([301,302,303,307,308]),oe=new Set([307,308]),ae={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ie={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},le={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},se=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ue=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)});function ce(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,r=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement,o=!r;let i;if(c(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;i=e=>({hasErrorBoundary:t(e)})}else i=ue;let l,s={},u=b(e.routes,i,void 0,s),h=e.basename||"/",p=a({v7_normalizeFormMethod:!1,v7_prependBasename:!1},e.future),m=null,v=new Set,g=null,E=null,R=null,x=null!=e.hydrationData,S=w(u,e.history.location,h),D=null;if(null==S){let t=De(404,{pathname:e.history.location.pathname}),{matches:r,route:n}=Se(u);S=r,D={[n.id]:t}}let C,k,P=!(S.some((e=>e.route.lazy))||S.some((e=>e.route.loader))&&null==e.hydrationData),L={historyAction:e.history.action,location:e.history.location,matches:S,initialized:P,navigation:ae,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||D,fetchers:new Map,blockers:new Map},A=n.Pop,U=!1,M=!1,j=!1,_=[],O=[],F=new Map,B=0,N=-1,I=new Map,z=new Set,W=new Map,H=new Map,$=new Map,K=!1;function q(e){L=a({},L,e),v.forEach((e=>e(L)))}function J(t,r){var o,i;let s,c=null!=L.actionData&&null!=L.navigation.formMethod&&Ue(L.navigation.formMethod)&&"loading"===L.navigation.state&&!0!==(null==(o=t.state)?void 0:o._isRedirect);s=r.actionData?Object.keys(r.actionData).length>0?r.actionData:null:c?L.actionData:null;let d=r.loaderData?Re(L.loaderData,r.loaderData,r.matches||[],r.errors):L.loaderData,h=L.blockers;h.size>0&&(h=new Map(h),h.forEach(((e,t)=>h.set(t,le))));let f=!0===U||null!=L.navigation.formMethod&&Ue(L.navigation.formMethod)&&!0!==(null==(i=t.state)?void 0:i._isRedirect);l&&(u=l,l=void 0),M||A===n.Pop||(A===n.Push?e.history.push(t,t.state):A===n.Replace&&e.history.replace(t,t.state)),q(a({},r,{actionData:s,loaderData:d,historyAction:A,location:t,initialized:!0,navigation:ae,revalidation:"idle",restoreScrollPosition:ke(t,r.matches||L.matches),preventScrollReset:f,blockers:h})),A=n.Pop,U=!1,M=!1,j=!1,_=[],O=[]}async function Y(t,r,o){k&&k.abort(),k=null,A=t,M=!0===(o&&o.startUninterruptedRevalidation),function(e,t){if(g&&R){let r=we(e,t);g[r]=R()}}(L.location,L.matches),U=!0===(o&&o.preventScrollReset);let c=l||u,d=o&&o.overrideNavigation,f=w(c,r,h);if(!f){let e=De(404,{pathname:r.pathname}),{matches:t,route:n}=Se(c);return be(),void J(r,{matches:t,loaderData:{},errors:{[n.id]:e}})}if(L.initialized&&!j&&(p=L.location,m=r,p.pathname===m.pathname&&p.search===m.search&&(""===p.hash?""!==m.hash:p.hash===m.hash||""!==m.hash))&&!(o&&o.submission&&Ue(o.submission.formMethod)))return void J(r,{matches:f});var p,m;k=new AbortController;let v,b,E=ge(e.history,r,k.signal,o&&o.submission);if(o&&o.pendingError)b={[xe(f).route.id]:o.pendingError};else if(o&&o.submission&&Ue(o.submission.formMethod)){let e=await async function(e,t,r,o,a){void 0===a&&(a={}),Q();let l,u=function(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}(t,r);q({navigation:u});let c=Te(o,t);if(c.route.action||c.route.lazy){if(l=await ye("action",e,c,o,s,i,h),e.signal.aborted)return{shortCircuited:!0}}else l={type:y.error,error:De(405,{method:e.method,pathname:t.pathname,routeId:c.route.id})};if(Ae(l)){let e;return e=a&&null!=a.replace?a.replace:l.location===L.location.pathname+L.location.search,await X(L,l,{submission:r,replace:e}),{shortCircuited:!0}}if(Le(l)){let e=xe(o,c.route.id);return!0!==(a&&a.replace)&&(A=n.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:l.error}}}if(Pe(l))throw De(400,{type:"defer-action"});return{pendingActionData:{[c.route.id]:l.data}}}(E,r,o.submission,f,{replace:o.replace});if(e.shortCircuited)return;v=e.pendingActionData,b=e.pendingActionError,d=Fe(r,o.submission),E=new Request(E.url,{signal:E.signal})}let{shortCircuited:x,loaderData:S,errors:D}=await async function(t,r,n,o,i,s,c,d,f){let p=o||Fe(r,i),m=i||s||Oe(p),v=l||u,[y,g]=fe(e.history,L,n,m,r,j,_,O,W,z,v,h,d,f);if(be((e=>!(n&&n.some((t=>t.route.id===e)))||y&&y.some((t=>t.route.id===e)))),N=++B,0===y.length&&0===g.length){let e=ne();return J(r,a({matches:n,loaderData:{},errors:f||null},d?{actionData:d}:{},e?{fetchers:new Map(L.fetchers)}:{})),{shortCircuited:!0}}if(!M){g.forEach((e=>{let t=L.fetchers.get(e.key),r=Be(void 0,t?t.data:void 0);L.fetchers.set(e.key,r)}));let e=d||L.actionData;q(a({navigation:p},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},g.length>0?{fetchers:new Map(L.fetchers)}:{}))}g.forEach((e=>{F.has(e.key)&&te(e.key),e.controller&&F.set(e.key,e.controller)}));let b=()=>g.forEach((e=>te(e.key)));k&&k.signal.addEventListener("abort",b);let{results:w,loaderResults:E,fetcherResults:R}=await G(L.matches,n,y,g,t);if(t.signal.aborted)return{shortCircuited:!0};k&&k.signal.removeEventListener("abort",b),g.forEach((e=>F.delete(e.key)));let x=Ce(w);if(x){if(x.idx>=y.length){let e=g[x.idx-y.length].key;z.add(e)}return await X(L,x.result,{replace:c}),{shortCircuited:!0}}let{loaderData:S,errors:D}=Ee(L,n,y,E,f,g,R,H);H.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&H.delete(t)}))}));let C=ne(),P=ce(N);return a({loaderData:S,errors:D},C||P||g.length>0?{fetchers:new Map(L.fetchers)}:{})}(E,r,f,d,o&&o.submission,o&&o.fetcherSubmission,o&&o.replace,v,b);x||(k=null,J(r,a({matches:f},v?{actionData:v}:{},{loaderData:S,errors:D})))}function V(e){return L.fetchers.get(e)||ie}async function X(o,i,l){let{submission:s,replace:u,isFetchActionRedirect:d}=void 0===l?{}:l;i.revalidate&&(j=!0);let p=f(o.location,i.location,a({_isRedirect:!0},d?{_isFetchActionRedirect:!0}:{}));if(c(p,"Expected a location on the redirect navigation"),r){let r=!1;if(i.reloadDocument)r=!0;else if(se.test(i.location)){const n=e.history.createURL(i.location);r=n.origin!==t.location.origin||null==T(n.pathname,h)}if(r)return void(u?t.location.replace(i.location):t.location.assign(i.location))}k=null;let m=!0===u?n.Replace:n.Push,v=s||Oe(o.navigation);if(oe.has(i.status)&&v&&Ue(v.formMethod))await Y(m,p,{submission:a({},v,{formAction:i.location}),preventScrollReset:U});else if(d)await Y(m,p,{overrideNavigation:Fe(p),fetcherSubmission:v,preventScrollReset:U});else{let e=Fe(p,v);await Y(m,p,{overrideNavigation:e,preventScrollReset:U})}}async function G(t,r,n,o,a){let l=await Promise.all([...n.map((e=>ye("loader",a,e,r,s,i,h))),...o.map((t=>t.matches&&t.match&&t.controller?ye("loader",ge(e.history,t.path,t.controller.signal),t.match,t.matches,s,i,h):{type:y.error,error:De(404,{pathname:t.path})}))]),u=l.slice(0,n.length),c=l.slice(n.length);return await Promise.all([Me(t,n,u,u.map((()=>a.signal)),!1,L.loaderData),Me(t,o.map((e=>e.match)),c,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:l,loaderResults:u,fetcherResults:c}}function Q(){j=!0,_.push(...be()),W.forEach(((e,t)=>{F.has(t)&&(O.push(t),te(t))}))}function Z(e,t,r){let n=xe(L.matches,t);ee(e),q({errors:{[n.route.id]:r},fetchers:new Map(L.fetchers)})}function ee(e){let t=L.fetchers.get(e);!F.has(e)||t&&"loading"===t.state&&I.has(e)||te(e),W.delete(e),I.delete(e),z.delete(e),L.fetchers.delete(e)}function te(e){let t=F.get(e);c(t,"Expected fetch controller: "+e),t.abort(),F.delete(e)}function re(e){for(let t of e){let e=Ne(V(t).data);L.fetchers.set(t,e)}}function ne(){let e=[],t=!1;for(let r of z){let n=L.fetchers.get(r);c(n,"Expected fetcher: "+r),"loading"===n.state&&(z.delete(r),e.push(r),t=!0)}return re(e),t}function ce(e){let t=[];for(let[r,n]of I)if(n<e){let e=L.fetchers.get(r);c(e,"Expected fetcher: "+r),"loading"===e.state&&(te(r),I.delete(r),t.push(r))}return re(t),t.length>0}function pe(e){L.blockers.delete(e),$.delete(e)}function me(e,t){let r=L.blockers.get(e)||le;c("unblocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"proceeding"===t.state||"blocked"===r.state&&"unblocked"===t.state||"proceeding"===r.state&&"unblocked"===t.state,"Invalid blocker state transition: "+r.state+" -> "+t.state);let n=new Map(L.blockers);n.set(e,t),q({blockers:n})}function ve(e){let{currentLocation:t,nextLocation:r,historyAction:n}=e;if(0===$.size)return;$.size>1&&d(!1,"A router only supports one blocker at a time");let o=Array.from($.entries()),[a,i]=o[o.length-1],l=L.blockers.get(a);return l&&"proceeding"===l.state?void 0:i({currentLocation:t,nextLocation:r,historyAction:n})?a:void 0}function be(e){let t=[];return H.forEach(((r,n)=>{e&&!e(n)||(r.cancel(),t.push(n),H.delete(n))})),t}function we(e,t){return E&&E(e,t.map((e=>function(e,t){let{route:r,pathname:n,params:o}=e;return{id:r.id,pathname:n,params:o,data:t[r.id],handle:r.handle}}(e,L.loaderData))))||e.key}function ke(e,t){if(g){let r=we(e,t),n=g[r];if("number"==typeof n)return n}return null}return C={get basename(){return h},get state(){return L},get routes(){return u},initialize:function(){return m=e.history.listen((t=>{let{action:r,location:n,delta:o}=t;if(K)return void(K=!1);d(0===$.size||null!=o,"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 a=ve({currentLocation:L.location,nextLocation:n,historyAction:r});return a&&null!=o?(K=!0,e.history.go(-1*o),void me(a,{state:"blocked",location:n,proceed(){me(a,{state:"proceeding",proceed:void 0,reset:void 0,location:n}),e.history.go(o)},reset(){let e=new Map(L.blockers);e.set(a,le),q({blockers:e})}})):Y(r,n)})),L.initialized||Y(n.Pop,L.location),C},subscribe:function(e){return v.add(e),()=>v.delete(e)},enableScrollRestoration:function(e,t,r){if(g=e,R=t,E=r||null,!x&&L.navigation===ae){x=!0;let e=ke(L.location,L.matches);null!=e&&q({restoreScrollPosition:e})}return()=>{g=null,R=null,E=null}},navigate:async function t(r,o){if("number"==typeof r)return void e.history.go(r);let i=de(L.location,L.matches,h,p.v7_prependBasename,r,null==o?void 0:o.fromRouteId,null==o?void 0:o.relative),{path:l,submission:s,error:u}=he(p.v7_normalizeFormMethod,!1,i,o),c=L.location,d=f(L.location,l,o&&o.state);d=a({},d,e.history.encodeLocation(d));let m=o&&null!=o.replace?o.replace:void 0,v=n.Push;!0===m?v=n.Replace:!1===m||null!=s&&Ue(s.formMethod)&&s.formAction===L.location.pathname+L.location.search&&(v=n.Replace);let y=o&&"preventScrollReset"in o?!0===o.preventScrollReset:void 0,g=ve({currentLocation:c,nextLocation:d,historyAction:v});if(!g)return await Y(v,d,{submission:s,pendingError:u,preventScrollReset:y,replace:o&&o.replace});me(g,{state:"blocked",location:d,proceed(){me(g,{state:"proceeding",proceed:void 0,reset:void 0,location:d}),t(r,o)},reset(){let e=new Map(L.blockers);e.set(g,le),q({blockers:e})}})},fetch:function(t,r,n,d){if(o)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");F.has(t)&&te(t);let f=l||u,m=de(L.location,L.matches,h,p.v7_prependBasename,n,r,null==d?void 0:d.relative),v=w(f,m,h);if(!v)return void Z(t,r,De(404,{pathname:m}));let{path:y,submission:g,error:b}=he(p.v7_normalizeFormMethod,!0,m,d);if(b)return void Z(t,r,b);let E=Te(v,y);U=!0===(d&&d.preventScrollReset),g&&Ue(g.formMethod)?async function(t,r,n,o,d,f){if(Q(),W.delete(t),!o.route.action&&!o.route.lazy){let e=De(405,{method:f.formMethod,pathname:n,routeId:r});return void Z(t,r,e)}let p=function(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," _hasFetcherDoneAnything ":!0}}(f,L.fetchers.get(t));L.fetchers.set(t,p),q({fetchers:new Map(L.fetchers)});let m=new AbortController,v=ge(e.history,n,m.signal,f);F.set(t,m);let y=B,g=await ye("action",v,o,d,s,i,h);if(v.signal.aborted)return void(F.get(t)===m&&F.delete(t));if(Ae(g)){if(F.delete(t),N>y){let e=Ne(void 0);return L.fetchers.set(t,e),void q({fetchers:new Map(L.fetchers)})}{z.add(t);let e=Be(f);return L.fetchers.set(t,e),q({fetchers:new Map(L.fetchers)}),X(L,g,{submission:f,isFetchActionRedirect:!0})}}if(Le(g))return void Z(t,r,g.error);if(Pe(g))throw De(400,{type:"defer-action"});let b=L.navigation.location||L.location,E=ge(e.history,b,m.signal),R=l||u,x="idle"!==L.navigation.state?w(R,L.navigation.location,h):L.matches;c(x,"Didn't find any matches after fetcher action");let S=++B;I.set(t,S);let D=Be(f,g.data);L.fetchers.set(t,D);let[C,P]=fe(e.history,L,x,f,b,j,_,O,W,z,R,h,{[o.route.id]:g.data},void 0);P.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=L.fetchers.get(t),n=Be(void 0,r?r.data:void 0);L.fetchers.set(t,n),F.has(t)&&te(t),e.controller&&F.set(t,e.controller)})),q({fetchers:new Map(L.fetchers)});let U=()=>P.forEach((e=>te(e.key)));m.signal.addEventListener("abort",U);let{results:M,loaderResults:T,fetcherResults:$}=await G(L.matches,x,C,P,E);if(m.signal.aborted)return;m.signal.removeEventListener("abort",U),I.delete(t),F.delete(t),P.forEach((e=>F.delete(e.key)));let K=Ce(M);if(K){if(K.idx>=C.length){let e=P[K.idx-C.length].key;z.add(e)}return X(L,K.result)}let{loaderData:Y,errors:V}=Ee(L,L.matches,C,T,void 0,P,$,H);if(L.fetchers.has(t)){let e=Ne(g.data);L.fetchers.set(t,e)}let ee=ce(S);"loading"===L.navigation.state&&S>N?(c(A,"Expected pending action"),k&&k.abort(),J(L.navigation.location,{matches:x,loaderData:Y,errors:V,fetchers:new Map(L.fetchers)})):(q(a({errors:V,loaderData:Re(L.loaderData,Y,x,V)},ee||P.length>0?{fetchers:new Map(L.fetchers)}:{})),j=!1)}(t,r,y,E,v,g):(W.set(t,{routeId:r,path:y}),async function(t,r,n,o,a,l){let u=L.fetchers.get(t),d=Be(l,u?u.data:void 0);L.fetchers.set(t,d),q({fetchers:new Map(L.fetchers)});let f=new AbortController,p=ge(e.history,n,f.signal);F.set(t,f);let m=B,v=await ye("loader",p,o,a,s,i,h);if(Pe(v)&&(v=await je(v,p.signal,!0)||v),F.get(t)===f&&F.delete(t),p.signal.aborted)return;if(Ae(v)){if(N>m){let e=Ne(void 0);return L.fetchers.set(t,e),void q({fetchers:new Map(L.fetchers)})}return z.add(t),void await X(L,v)}if(Le(v)){let e=xe(L.matches,r);return L.fetchers.delete(t),void q({fetchers:new Map(L.fetchers),errors:{[e.route.id]:v.error}})}c(!Pe(v),"Unhandled fetcher deferred data");let y=Ne(v.data);L.fetchers.set(t,y),q({fetchers:new Map(L.fetchers)})}(t,r,y,E,v,g))},revalidate:function(){Q(),q({revalidation:"loading"}),"submitting"!==L.navigation.state&&("idle"!==L.navigation.state?Y(A||L.historyAction,L.navigation.location,{overrideNavigation:L.navigation}):Y(L.historyAction,L.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:V,deleteFetcher:ee,dispose:function(){m&&m(),v.clear(),k&&k.abort(),L.fetchers.forEach(((e,t)=>ee(t))),L.blockers.forEach(((e,t)=>pe(t)))},getBlocker:function(e,t){let r=L.blockers.get(e)||le;return $.get(e)!==t&&$.set(e,t),r},deleteBlocker:pe,_internalFetchControllers:F,_internalActiveDeferreds:H,_internalSetRoutes:function(e){s={},l=b(e,i,void 0,s)}},C}function de(e,t,r,n,o,a,i){let l,s;if(null!=a&&"path"!==i){l=[];for(let e of t)if(l.push(e),e.route.id===a){s=e;break}}else l=t,s=t[t.length-1];let u=N(o||".",B(l).map((e=>e.pathnameBase)),T(e.pathname,r)||e.pathname,"path"===i);return null==o&&(u.search=e.search,u.hash=e.hash),null!=o&&""!==o&&"."!==o||!s||!s.route.index||_e(u.search)||(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),n&&"/"!==r&&(u.pathname="/"===u.pathname?r:I([r,u.pathname])),p(u)}function he(e,t,r,n){if(!n||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(n))return{path:r};if(n.formMethod&&(o=n.formMethod,!re.has(o.toLowerCase())))return{path:r,error:De(405,{method:n.formMethod})};var o;let a,i,l=()=>({path:r,error:De(400,{type:"invalid-body"})}),s=n.formMethod||"get",u=e?s.toUpperCase():s.toLowerCase(),d=ke(r);if(void 0!==n.body){if("text/plain"===n.formEncType){if(!Ue(u))return l();let e="string"==typeof n.body?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce(((e,t)=>{let[r,n]=t;return""+e+r+"="+n+"\n"}),""):String(n.body);return{path:r,submission:{formMethod:u,formAction:d,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===n.formEncType){if(!Ue(u))return l();try{let e="string"==typeof n.body?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:u,formAction:d,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return l()}}}if(c("function"==typeof FormData,"FormData is not available in this environment"),n.formData)a=be(n.formData),i=n.formData;else if(n.body instanceof FormData)a=be(n.body),i=n.body;else if(n.body instanceof URLSearchParams)a=n.body,i=we(a);else if(null==n.body)a=new URLSearchParams,i=new FormData;else try{a=new URLSearchParams(n.body),i=we(a)}catch(e){return l()}let h={formMethod:u,formAction:d,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(Ue(h.formMethod))return{path:r,submission:h};let f=m(r);return t&&f.search&&_e(f.search)&&a.append("index",""),f.search="?"+a,{path:p(f),submission:h}}function fe(e,t,r,n,o,i,l,s,u,c,d,h,f,p){let m=p?Object.values(p)[0]:f?Object.values(f)[0]:void 0,v=e.createURL(t.location),y=e.createURL(o),g=p?Object.keys(p)[0]:void 0,b=function(e,t){let r=e;if(t){let n=e.findIndex((e=>e.route.id===t));n>=0&&(r=e.slice(0,n))}return r}(r,g).filter(((e,r)=>{if(e.route.lazy)return!0;if(null==e.route.loader)return!1;if(function(e,t,r){let n=!t||r.route.id!==t.route.id,o=void 0===e[r.route.id];return n||o}(t.loaderData,t.matches[r],e)||l.some((t=>t===e.route.id)))return!0;let o=t.matches[r],s=e;return me(e,a({currentUrl:v,currentParams:o.params,nextUrl:y,nextParams:s.params},n,{actionResult:m,defaultShouldRevalidate:i||v.pathname+v.search===y.pathname+y.search||v.search!==y.search||pe(o,s)}))})),E=[];return u.forEach(((e,o)=>{if(!r.some((t=>t.route.id===e.routeId)))return;let l=w(d,e.path,h);if(!l)return void E.push({key:o,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let u=t.fetchers.get(o),f=Te(l,e.path),p=!1;p=!c.has(o)&&(!!s.includes(o)||(u&&"idle"!==u.state&&void 0===u.data?i:me(f,a({currentUrl:v,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:r[r.length-1].params},n,{actionResult:m,defaultShouldRevalidate:i})))),p&&E.push({key:o,routeId:e.routeId,path:e.path,matches:l,match:f,controller:new AbortController})})),[b,E]}function pe(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function me(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function ve(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let o=r[e.id];c(o,"No route found in manifest");let i={};for(let e in n){let t=void 0!==o[e]&&"hasErrorBoundary"!==e;d(!t,'Route "'+o.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.'),t||g.has(e)||(i[e]=n[e])}Object.assign(o,i),Object.assign(o,a({},t(o),{lazy:void 0}))}async function ye(e,t,r,n,o,a,i,l){let s,u,d;void 0===l&&(l={});let h=e=>{let n,o=new Promise(((e,t)=>n=t));return d=()=>n(),t.signal.addEventListener("abort",d),Promise.race([e({request:t,params:r.params,context:l.requestContext}),o])};try{let n=r.route[e];if(r.route.lazy)if(n)u=(await Promise.all([h(n),ve(r.route,a,o)]))[0];else{if(await ve(r.route,a,o),n=r.route[e],!n){if("action"===e){let e=new URL(t.url),n=e.pathname+e.search;throw De(405,{method:t.method,pathname:n,routeId:r.route.id})}return{type:y.data,data:void 0}}u=await h(n)}else{if(!n){let e=new URL(t.url);throw De(404,{pathname:e.pathname+e.search})}u=await h(n)}c(void 0!==u,"You defined "+("action"===e?"an action":"a loader")+' for route "'+r.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){s=y.error,u=e}finally{d&&t.signal.removeEventListener("abort",d)}if(null!=(f=u)&&"number"==typeof f.status&&"string"==typeof f.statusText&&"object"==typeof f.headers&&void 0!==f.body){let e,o=u.status;if(ne.has(o)){let e=u.headers.get("Location");if(c(e,"Redirects returned/thrown from loaders/actions must have a Location header"),se.test(e)){if(!l.isStaticRequest){let r=new URL(t.url),n=e.startsWith("//")?new URL(r.protocol+e):new URL(e),o=null!=T(n.pathname,i);n.origin===r.origin&&o&&(e=n.pathname+n.search+n.hash)}}else e=de(new URL(t.url),n.slice(0,n.indexOf(r)+1),i,!0,e);if(l.isStaticRequest)throw u.headers.set("Location",e),u;return{type:y.redirect,status:o,location:e,revalidate:null!==u.headers.get("X-Remix-Revalidate"),reloadDocument:null!==u.headers.get("X-Remix-Reload-Document")}}if(l.isRouteRequest)throw{type:s===y.error?y.error:y.data,response:u};let a=u.headers.get("Content-Type");return e=a&&/\bapplication\/json\b/.test(a)?await u.json():await u.text(),s===y.error?{type:s,error:new G(o,u.statusText,e),headers:u.headers}:{type:y.data,data:e,statusCode:u.status,headers:u.headers}}var f,p,m;return s===y.error?{type:s,error:u}:function(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}(u)?{type:y.deferred,deferredData:u,statusCode:null==(p=u.init)?void 0:p.status,headers:(null==(m=u.init)?void 0:m.headers)&&new Headers(u.init.headers)}:{type:y.data,data:u}}function ge(e,t,r,n){let o=e.createURL(ke(t)).toString(),a={signal:r};if(n&&Ue(n.formMethod)){let{formMethod:e,formEncType:t}=n;a.method=e.toUpperCase(),"application/json"===t?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(n.json)):"text/plain"===t?a.body=n.text:"application/x-www-form-urlencoded"===t&&n.formData?a.body=be(n.formData):a.body=n.formData}return new Request(o,a)}function be(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,"string"==typeof n?n:n.name);return t}function we(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function Ee(e,t,r,n,o,i,l,s){let{loaderData:u,errors:d}=function(e,t,r,n,o){let a,i={},l=null,s=!1,u={};return r.forEach(((r,d)=>{let h=t[d].route.id;if(c(!Ae(r),"Cannot handle redirect results in processLoaderData"),Le(r)){let t=xe(e,h),o=r.error;n&&(o=Object.values(n)[0],n=void 0),l=l||{},null==l[t.route.id]&&(l[t.route.id]=o),i[h]=void 0,s||(s=!0,a=Q(r.error)?r.error.status:500),r.headers&&(u[h]=r.headers)}else Pe(r)?(o.set(h,r.deferredData),i[h]=r.deferredData.data):i[h]=r.data,null==r.statusCode||200===r.statusCode||s||(a=r.statusCode),r.headers&&(u[h]=r.headers)})),n&&(l=n,i[Object.keys(n)[0]]=void 0),{loaderData:i,errors:l,statusCode:a||200,loaderHeaders:u}}(t,r,n,o,s);for(let t=0;t<i.length;t++){let{key:r,match:n,controller:o}=i[t];c(void 0!==l&&void 0!==l[t],"Did not find corresponding fetcher result");let s=l[t];if(!o||!o.signal.aborted)if(Le(s)){let t=xe(e.matches,null==n?void 0:n.route.id);d&&d[t.route.id]||(d=a({},d,{[t.route.id]:s.error})),e.fetchers.delete(r)}else if(Ae(s))c(!1,"Unhandled fetcher revalidation redirect");else if(Pe(s))c(!1,"Unhandled fetcher deferred data");else{let t=Ne(s.data);e.fetchers.set(r,t)}}return{loaderData:u,errors:d}}function Re(e,t,r,n){let o=a({},t);for(let a of r){let r=a.route.id;if(t.hasOwnProperty(r)?void 0!==t[r]&&(o[r]=t[r]):void 0!==e[r]&&a.route.loader&&(o[r]=e[r]),n&&n.hasOwnProperty(r))break}return o}function xe(e,t){return(t?e.slice(0,e.findIndex((e=>e.route.id===t))+1):[...e]).reverse().find((e=>!0===e.route.hasErrorBoundary))||e[0]}function Se(e){let t=e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function De(e,t){let{pathname:r,routeId:n,method:o,type:a}=void 0===t?{}:t,i="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(i="Bad Request",o&&r&&n?l="You made a "+o+' request to "'+r+'" but did not provide a `loader` for route "'+n+'", so there is no way to handle the request.':"defer-action"===a?l="defer() is not supported in actions":"invalid-body"===a&&(l="Unable to encode submission body")):403===e?(i="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):404===e?(i="Not Found",l='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",o&&r&&n?l="You made a "+o.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+n+'", so there is no way to handle the request.':o&&(l='Invalid request method "'+o.toUpperCase()+'"')),new G(e||500,i,new Error(l),!0)}function Ce(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(Ae(r))return{result:r,idx:t}}}function ke(e){return p(a({},"string"==typeof e?m(e):e,{hash:""}))}function Pe(e){return e.type===y.deferred}function Le(e){return e.type===y.error}function Ae(e){return(e&&e.type)===y.redirect}function Ue(e){return ee.has(e.toLowerCase())}async function Me(e,t,r,n,o,a){for(let i=0;i<r.length;i++){let l=r[i],s=t[i];if(!s)continue;let u=e.find((e=>e.route.id===s.route.id)),d=null!=u&&!pe(u,s)&&void 0!==(a&&a[s.route.id]);if(Pe(l)&&(o||d)){let e=n[i];c(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await je(l,e,o).then((e=>{e&&(r[i]=e||r[i])}))}}}async function je(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:y.data,data:e.deferredData.unwrappedData}}catch(e){return{type:y.error,error:e}}return{type:y.data,data:e.deferredData.data}}}function _e(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Te(e,t){let r="string"==typeof t?m(t).search:t.search;if(e[e.length-1].route.index&&_e(r||""))return e[e.length-1];let n=B(e);return n[n.length-1]}function Oe(e){let{formMethod:t,formAction:r,formEncType:n,text:o,formData:a,json:i}=e;if(t&&r&&n)return null!=o?{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:o}:null!=a?{formMethod:t,formAction:r,formEncType:n,formData:a,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}:void 0}function Fe(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Be(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," _hasFetcherDoneAnything ":!0}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t," _hasFetcherDoneAnything ":!0}}function Ne(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e," _hasFetcherDoneAnything ":!0}}function Ie(){return Ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ie.apply(this,arguments)}Symbol("deferred");const ze=o.createContext(null),We=o.createContext(null),He=o.createContext(null),$e=o.createContext(null),Ke=o.createContext(null),qe=o.createContext({outlet:null,matches:[],isDataRoute:!1}),Je=o.createContext(null);function Ye(e,t){let{relative:r}=void 0===t?{}:t;Ve()||c(!1);let{basename:n,navigator:a}=o.useContext($e),{hash:i,pathname:l,search:s}=at(e,{relative:r}),u=l;return"/"!==n&&(u="/"===l?n:I([n,l])),a.createHref({pathname:u,search:s,hash:i})}function Ve(){return null!=o.useContext(Ke)}function Xe(){return Ve()||c(!1),o.useContext(Ke).location}function Ge(){return o.useContext(Ke).navigationType}function Qe(e){Ve()||c(!1);let{pathname:t}=Xe();return o.useMemo((()=>j(e,t)),[t,e])}function Ze(e){o.useContext($e).static||o.useLayoutEffect(e)}function et(){let{isDataRoute:e}=o.useContext(qe);return e?function(){let{router:e}=mt(ft.UseNavigateStable),t=yt(pt.UseNavigateStable),r=o.useRef(!1);return Ze((()=>{r.current=!0})),o.useCallback((function(n,o){void 0===o&&(o={}),r.current&&("number"==typeof n?e.navigate(n):e.navigate(n,Ie({fromRouteId:t},o)))}),[e,t])}():function(){Ve()||c(!1);let e=o.useContext(ze),{basename:t,navigator:r}=o.useContext($e),{matches:n}=o.useContext(qe),{pathname:a}=Xe(),i=JSON.stringify(B(n).map((e=>e.pathnameBase))),l=o.useRef(!1);return Ze((()=>{l.current=!0})),o.useCallback((function(n,o){if(void 0===o&&(o={}),!l.current)return;if("number"==typeof n)return void r.go(n);let s=N(n,JSON.parse(i),a,"path"===o.relative);null==e&&"/"!==t&&(s.pathname="/"===s.pathname?t:I([t,s.pathname])),(o.replace?r.replace:r.push)(s,o.state,o)}),[t,r,i,a,e])}()}const tt=o.createContext(null);function rt(){return o.useContext(tt)}function nt(e){let t=o.useContext(qe).outlet;return t?o.createElement(tt.Provider,{value:e},t):t}function ot(){let{matches:e}=o.useContext(qe),t=e[e.length-1];return t?t.params:{}}function at(e,t){let{relative:r}=void 0===t?{}:t,{matches:n}=o.useContext(qe),{pathname:a}=Xe(),i=JSON.stringify(B(n).map((e=>e.pathnameBase)));return o.useMemo((()=>N(e,JSON.parse(i),a,"path"===r)),[e,i,a,r])}function it(e,t){return lt(e,t)}function lt(e,t,r){Ve()||c(!1);let{navigator:a}=o.useContext($e),{matches:i}=o.useContext(qe),l=i[i.length-1],s=l?l.params:{},u=(l&&l.pathname,l?l.pathnameBase:"/");l&&l.route;let d,h=Xe();if(t){var f;let e="string"==typeof t?m(t):t;"/"===u||(null==(f=e.pathname)?void 0:f.startsWith(u))||c(!1),d=e}else d=h;let p=d.pathname||"/",v=w(e,{pathname:"/"===u?p:p.slice(u.length)||"/"}),y=ht(v&&v.map((e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:I([u,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?u:I([u,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),i,r);return t&&y?o.createElement(Ke.Provider,{value:{location:Ie({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:n.Pop}},y):y}function st(){let e=Dt(),t=Q(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return o.createElement(o.Fragment,null,o.createElement("h2",null,"Unexpected Application Error!"),o.createElement("h3",{style:{fontStyle:"italic"}},t),r?o.createElement("pre",{style:n},r):null,null)}const ut=o.createElement(st,null);class ct extends o.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||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error||t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error?o.createElement(qe.Provider,{value:this.props.routeContext},o.createElement(Je.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function dt(e){let{routeContext:t,match:r,children:n}=e,a=o.useContext(ze);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),o.createElement(qe.Provider,{value:t},n)}function ht(e,t,r){var n;if(void 0===t&&(t=[]),void 0===r&&(r=null),null==e){var a;if(null==(a=r)||!a.errors)return null;e=r.matches}let i=e,l=null==(n=r)?void 0:n.errors;if(null!=l){let e=i.findIndex((e=>e.route.id&&(null==l?void 0:l[e.route.id])));e>=0||c(!1),i=i.slice(0,Math.min(i.length,e+1))}return i.reduceRight(((e,n,a)=>{let s=n.route.id?null==l?void 0:l[n.route.id]:null,u=null;r&&(u=n.route.errorElement||ut);let c=t.concat(i.slice(0,a+1)),d=()=>{let t;return t=s?u:n.route.Component?o.createElement(n.route.Component,null):n.route.element?n.route.element:e,o.createElement(dt,{match:n,routeContext:{outlet:e,matches:c,isDataRoute:null!=r},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||0===a)?o.createElement(ct,{location:r.location,revalidation:r.revalidation,component:u,error:s,children:d(),routeContext:{outlet:null,matches:c,isDataRoute:!0}}):d()}),null)}var ft=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ft||{}),pt=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(pt||{});function mt(e){let t=o.useContext(ze);return t||c(!1),t}function vt(e){let t=o.useContext(We);return t||c(!1),t}function yt(e){let t=function(e){let t=o.useContext(qe);return t||c(!1),t}(),r=t.matches[t.matches.length-1];return r.route.id||c(!1),r.route.id}function gt(){return yt(pt.UseRouteId)}function bt(){return vt(pt.UseNavigation).navigation}function wt(){let e=mt(ft.UseRevalidator),t=vt(pt.UseRevalidator);return o.useMemo((()=>({revalidate:e.router.revalidate,state:t.revalidation})),[e.router.revalidate,t.revalidation])}function Et(){let{matches:e,loaderData:t}=vt(pt.UseMatches);return o.useMemo((()=>e.map((e=>{let{pathname:r,params:n}=e;return{id:e.route.id,pathname:r,params:n,data:t[e.route.id],handle:e.route.handle}}))),[e,t])}function Rt(){let e=vt(pt.UseLoaderData),t=yt(pt.UseLoaderData);if(!e.errors||null==e.errors[t])return e.loaderData[t];console.error("You cannot `useLoaderData` in an errorElement (routeId: "+t+")")}function xt(e){return vt(pt.UseRouteLoaderData).loaderData[e]}function St(){let e=vt(pt.UseActionData);return o.useContext(qe)||c(!1),Object.values((null==e?void 0:e.actionData)||{})[0]}function Dt(){var e;let t=o.useContext(Je),r=vt(pt.UseRouteError),n=yt(pt.UseRouteError);return t||(null==(e=r.errors)?void 0:e[n])}function Ct(){let e=o.useContext(He);return null==e?void 0:e._data}function kt(){let e=o.useContext(He);return null==e?void 0:e._error}let Pt=0;function Lt(e){let{router:t,basename:r}=mt(ft.UseBlocker),n=vt(pt.UseBlocker),[a,i]=o.useState(""),l=o.useCallback((t=>{if("function"!=typeof e)return!!e;if("/"===r)return e(t);let{currentLocation:n,nextLocation:o,historyAction:a}=t;return e({currentLocation:Ie({},n,{pathname:T(n.pathname,r)||n.pathname}),nextLocation:Ie({},o,{pathname:T(o.pathname,r)||o.pathname}),historyAction:a})}),[r,e]);return o.useEffect((()=>{let e=String(++Pt);return i(e),()=>t.deleteBlocker(e)}),[t]),o.useEffect((()=>{""!==a&&t.getBlocker(a,l)}),[t,a,l]),a&&n.blockers.has(a)?n.blockers.get(a):le}const At=o.startTransition;function Ut(e){let{fallbackElement:t,router:r,future:n}=e,[a,i]=o.useState(r.state),{v7_startTransition:l}=n||{},s=o.useCallback((e=>{l&&At?At((()=>i(e))):i(e)}),[i,l]);o.useLayoutEffect((()=>r.subscribe(s)),[r,s]);let u=o.useMemo((()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:e=>r.navigate(e),push:(e,t,n)=>r.navigate(e,{state:t,preventScrollReset:null==n?void 0:n.preventScrollReset}),replace:(e,t,n)=>r.navigate(e,{replace:!0,state:t,preventScrollReset:null==n?void 0:n.preventScrollReset})})),[r]),c=r.basename||"/",d=o.useMemo((()=>({router:r,navigator:u,static:!1,basename:c})),[r,u,c]);return o.createElement(o.Fragment,null,o.createElement(ze.Provider,{value:d},o.createElement(We.Provider,{value:a},o.createElement(Ft,{basename:c,location:a.location,navigationType:a.historyAction,navigator:u},a.initialized?o.createElement(Mt,{routes:r.routes,state:a}):t))),null)}function Mt(e){let{routes:t,state:r}=e;return lt(t,void 0,r)}function jt(e){let{basename:t,children:r,initialEntries:n,initialIndex:a,future:i}=e,s=o.useRef();null==s.current&&(s.current=l({initialEntries:n,initialIndex:a,v5Compat:!0}));let u=s.current,[c,d]=o.useState({action:u.action,location:u.location}),{v7_startTransition:h}=i||{},f=o.useCallback((e=>{h&&At?At((()=>d(e))):d(e)}),[d,h]);return o.useLayoutEffect((()=>u.listen(f)),[u,f]),o.createElement(Ft,{basename:t,children:r,location:c.location,navigationType:c.action,navigator:u})}function _t(e){let{to:t,replace:r,state:n,relative:a}=e;Ve()||c(!1);let{matches:i}=o.useContext(qe),{pathname:l}=Xe(),s=et(),u=N(t,B(i).map((e=>e.pathnameBase)),l,"path"===a),d=JSON.stringify(u);return o.useEffect((()=>s(JSON.parse(d),{replace:r,state:n,relative:a})),[s,d,a,r,n]),null}function Tt(e){return nt(e.context)}function Ot(e){c(!1)}function Ft(e){let{basename:t="/",children:r=null,location:a,navigationType:i=n.Pop,navigator:l,static:s=!1}=e;Ve()&&c(!1);let u=t.replace(/^\/*/,"/"),d=o.useMemo((()=>({basename:u,navigator:l,static:s})),[u,l,s]);"string"==typeof a&&(a=m(a));let{pathname:h="/",search:f="",hash:p="",state:v=null,key:y="default"}=a,g=o.useMemo((()=>{let e=T(h,u);return null==e?null:{location:{pathname:e,search:f,hash:p,state:v,key:y},navigationType:i}}),[u,h,f,p,v,y,i]);return null==g?null:o.createElement($e.Provider,{value:d},o.createElement(Ke.Provider,{children:r,value:g}))}function Bt(e){let{children:t,location:r}=e;return it($t(t),r)}function Nt(e){let{children:t,errorElement:r,resolve:n}=e;return o.createElement(Wt,{resolve:n,errorElement:r},o.createElement(Ht,null,t))}var It=function(e){return e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error",e}(It||{});const zt=new Promise((()=>{}));class Wt extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("<Await> caught the following error during render",e,t)}render(){let{children:e,errorElement:t,resolve:r}=this.props,n=null,a=It.pending;if(r instanceof Promise)if(this.state.error){a=It.error;let e=this.state.error;n=Promise.reject().catch((()=>{})),Object.defineProperty(n,"_tracked",{get:()=>!0}),Object.defineProperty(n,"_error",{get:()=>e})}else r._tracked?(n=r,a=void 0!==n._error?It.error:void 0!==n._data?It.success:It.pending):(a=It.pending,Object.defineProperty(r,"_tracked",{get:()=>!0}),n=r.then((e=>Object.defineProperty(r,"_data",{get:()=>e})),(e=>Object.defineProperty(r,"_error",{get:()=>e}))));else a=It.success,n=Promise.resolve(),Object.defineProperty(n,"_tracked",{get:()=>!0}),Object.defineProperty(n,"_data",{get:()=>r});if(a===It.error&&n._error instanceof K)throw zt;if(a===It.error&&!t)throw n._error;if(a===It.error)return o.createElement(He.Provider,{value:n,children:t});if(a===It.success)return o.createElement(He.Provider,{value:n,children:e});throw n}}function Ht(e){let{children:t}=e,r=Ct(),n="function"==typeof t?t(r):t;return o.createElement(o.Fragment,null,n)}function $t(e,t){void 0===t&&(t=[]);let r=[];return o.Children.forEach(e,((e,n)=>{if(!o.isValidElement(e))return;let a=[...t,n];if(e.type===o.Fragment)return void r.push.apply(r,$t(e.props.children,a));e.type!==Ot&&c(!1),e.props.index&&e.props.children&&c(!1);let i={id:e.props.id||a.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(i.children=$t(e.props.children,a)),r.push(i)})),r}function Kt(e){return ht(e)}function qt(e){let t={hasErrorBoundary:null!=e.ErrorBoundary||null!=e.errorElement};return e.Component&&Object.assign(t,{element:o.createElement(e.Component),Component:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:o.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function Jt(e,t){return ce({basename:null==t?void 0:t.basename,future:Ie({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:l({initialEntries:null==t?void 0:t.initialEntries,initialIndex:null==t?void 0:t.initialIndex}),hydrationData:null==t?void 0:t.hydrationData,routes:e,mapRouteProperties:qt}).initialize()}function Yt(){return Yt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yt.apply(this,arguments)}function Vt(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}const Xt="get",Gt="application/x-www-form-urlencoded";function Qt(e){return null!=e&&"string"==typeof e.tagName}function Zt(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}let er=null;const tr=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function rr(e){return null==e||tr.has(e)?e:null}function nr(e,t){let r,n,o,a,i;if(Qt(l=e)&&"form"===l.tagName.toLowerCase()){let i=e.getAttribute("action");n=i?T(i,t):null,r=e.getAttribute("method")||Xt,o=rr(e.getAttribute("enctype"))||Gt,a=new FormData(e)}else if(function(e){return Qt(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return Qt(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||i.getAttribute("action");if(n=l?T(l,t):null,r=e.getAttribute("formmethod")||i.getAttribute("method")||Xt,o=rr(e.getAttribute("formenctype"))||rr(i.getAttribute("enctype"))||Gt,a=new FormData(i,e),!function(){if(null===er)try{new FormData(document.createElement("form"),0),er=!1}catch(e){er=!0}return er}()){let{name:t,type:r,value:n}=e;if("image"===r){let e=t?t+".":"";a.append(e+"x","0"),a.append(e+"y","0")}else t&&a.append(t,n)}}else{if(Qt(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Xt,n=null,o=Gt,i=e}var l;return a&&"text/plain"===o&&(i=a,a=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:a,body:i}}const or=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],ar=["aria-current","caseSensitive","className","end","style","to","children"],ir=["reloadDocument","replace","state","method","action","onSubmit","submit","relative","preventScrollReset"];function lr(e,t){return ce({basename:null==t?void 0:t.basename,future:Yt({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:s({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||ur(),routes:e,mapRouteProperties:qt}).initialize()}function sr(e,t){return ce({basename:null==t?void 0:t.basename,future:Yt({},null==t?void 0:t.future,{v7_prependBasename:!0}),history:u({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||ur(),routes:e,mapRouteProperties:qt}).initialize()}function ur(){var e;let t=null==(e=window)?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Yt({},t,{errors:cr(t.errors)})),t}function cr(e){if(!e)return null;let t=Object.entries(e),r={};for(let[e,n]of t)if(n&&"RouteErrorResponse"===n.__type)r[e]=new G(n.status,n.statusText,n.data,!0===n.internal);else if(n&&"Error"===n.__type){if(n.__subType){let t=window[n.__subType];if("function"==typeof t)try{let o=new t(n.message);o.stack="",r[e]=o}catch(e){}}if(null==r[e]){let t=new Error(n.message);t.stack="",r[e]=t}}else r[e]=n;return r}const dr=o.startTransition;function hr(e){let{basename:t,children:r,future:n,window:a}=e,i=o.useRef();null==i.current&&(i.current=s({window:a,v5Compat:!0}));let l=i.current,[u,c]=o.useState({action:l.action,location:l.location}),{v7_startTransition:d}=n||{},h=o.useCallback((e=>{d&&dr?dr((()=>c(e))):c(e)}),[c,d]);return o.useLayoutEffect((()=>l.listen(h)),[l,h]),o.createElement(Ft,{basename:t,children:r,location:u.location,navigationType:u.action,navigator:l})}function fr(e){let{basename:t,children:r,future:n,window:a}=e,i=o.useRef();null==i.current&&(i.current=u({window:a,v5Compat:!0}));let l=i.current,[s,c]=o.useState({action:l.action,location:l.location}),{v7_startTransition:d}=n||{},h=o.useCallback((e=>{d&&dr?dr((()=>c(e))):c(e)}),[c,d]);return o.useLayoutEffect((()=>l.listen(h)),[l,h]),o.createElement(Ft,{basename:t,children:r,location:s.location,navigationType:s.action,navigator:l})}function pr(e){let{basename:t,children:r,future:n,history:a}=e,[i,l]=o.useState({action:a.action,location:a.location}),{v7_startTransition:s}=n||{},u=o.useCallback((e=>{s&&dr?dr((()=>l(e))):l(e)}),[l,s]);return o.useLayoutEffect((()=>a.listen(u)),[a,u]),o.createElement(Ft,{basename:t,children:r,location:i.location,navigationType:i.action,navigator:a})}const mr="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,vr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yr=o.forwardRef((function(e,t){let r,{onClick:n,relative:a,reloadDocument:i,replace:l,state:s,target:u,to:c,preventScrollReset:d}=e,h=Vt(e,or),{basename:f}=o.useContext($e),p=!1;if("string"==typeof c&&vr.test(c)&&(r=c,mr))try{let e=new URL(window.location.href),t=c.startsWith("//")?new URL(e.protocol+c):new URL(c),r=T(t.pathname,f);t.origin===e.origin&&null!=r?c=r+t.search+t.hash:p=!0}catch(e){}let m=Ye(c,{relative:a}),v=Cr(c,{replace:l,state:s,target:u,preventScrollReset:d,relative:a});return o.createElement("a",Yt({},h,{href:r||m,onClick:p||i?n:function(e){n&&n(e),e.defaultPrevented||v(e)},ref:t,target:u}))})),gr=o.forwardRef((function(e,t){let{"aria-current":r="page",caseSensitive:n=!1,className:a="",end:i=!1,style:l,to:s,children:u}=e,c=Vt(e,ar),d=at(s,{relative:c.relative}),h=Xe(),f=o.useContext(We),{navigator:p}=o.useContext($e),m=p.encodeLocation?p.encodeLocation(d).pathname:d.pathname,v=h.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;n||(v=v.toLowerCase(),y=y?y.toLowerCase():null,m=m.toLowerCase());let g,b=v===m||!i&&v.startsWith(m)&&"/"===v.charAt(m.length),w=null!=y&&(y===m||!i&&y.startsWith(m)&&"/"===y.charAt(m.length)),E=b?r:void 0;g="function"==typeof a?a({isActive:b,isPending:w}):[a,b?"active":null,w?"pending":null].filter(Boolean).join(" ");let R="function"==typeof l?l({isActive:b,isPending:w}):l;return o.createElement(yr,Yt({},c,{"aria-current":E,className:g,ref:t,style:R,to:s}),"function"==typeof u?u({isActive:b,isPending:w}):u)})),br=o.forwardRef(((e,t)=>{let r=Lr();return o.createElement(wr,Yt({},e,{submit:r,ref:t}))})),wr=o.forwardRef(((e,t)=>{let{reloadDocument:r,replace:n,state:a,method:i=Xt,action:l,onSubmit:s,submit:u,relative:c,preventScrollReset:d}=e,h=Vt(e,ir),f="get"===i.toLowerCase()?"get":"post",p=Ur(l,{relative:c});return o.createElement("form",Yt({ref:t,method:f,action:p,onSubmit:r?s:e=>{if(s&&s(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,r=(null==t?void 0:t.getAttribute("formmethod"))||i;u(t||e.currentTarget,{method:r,replace:n,state:a,relative:c,preventScrollReset:d})}},h))}));function Er(e){let{getKey:t,storageKey:r}=e;return Fr({getKey:t,storageKey:r}),null}var Rr,xr;function Sr(e){let t=o.useContext(ze);return t||c(!1),t}function Dr(e){let t=o.useContext(We);return t||c(!1),t}function Cr(e,t){let{target:r,replace:n,state:a,preventScrollReset:i,relative:l}=void 0===t?{}:t,s=et(),u=Xe(),c=at(e,{relative:l});return o.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,r)){t.preventDefault();let r=void 0!==n?n:p(u)===p(c);s(e,{replace:r,state:a,preventScrollReset:i,relative:l})}}),[u,s,c,n,a,r,e,i,l])}function kr(e){let t=o.useRef(Zt(e)),r=o.useRef(!1),n=Xe(),a=o.useMemo((()=>function(e,t){let r=Zt(e);return t&&t.forEach(((e,n)=>{r.has(n)||t.getAll(n).forEach((e=>{r.append(n,e)}))})),r}(n.search,r.current?null:t.current)),[n.search]),i=et(),l=o.useCallback(((e,t)=>{const n=Zt("function"==typeof e?e(a):e);r.current=!0,i("?"+n,t)}),[i,a]);return[a,l]}function Pr(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}function Lr(){let{router:e}=Sr(Rr.UseSubmit),{basename:t}=o.useContext($e),r=gt();return o.useCallback((function(n,o){void 0===o&&(o={}),Pr();let{action:a,method:i,encType:l,formData:s,body:u}=nr(n,t);e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:s,body:u,formMethod:o.method||i,formEncType:o.encType||l,replace:o.replace,state:o.state,fromRouteId:r})}),[e,t,r])}function Ar(e,t){let{router:r}=Sr(Rr.UseSubmitFetcher),{basename:n}=o.useContext($e);return o.useCallback((function(o,a){void 0===a&&(a={}),Pr();let{action:i,method:l,encType:s,formData:u,body:d}=nr(o,n);null==t&&c(!1),r.fetch(e,t,a.action||i,{preventScrollReset:a.preventScrollReset,formData:u,body:d,formMethod:a.method||l,formEncType:a.encType||s})}),[r,n,e,t])}function Ur(e,t){let{relative:r}=void 0===t?{}:t,{basename:n}=o.useContext($e),a=o.useContext(qe);a||c(!1);let[i]=a.matches.slice(-1),l=Yt({},at(e||".",{relative:r})),s=Xe();if(null==e&&(l.search=s.search,i.route.index)){let e=new URLSearchParams(l.search);e.delete("index"),l.search=e.toString()?"?"+e.toString():""}return e&&"."!==e||!i.route.index||(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),"/"!==n&&(l.pathname="/"===l.pathname?n:I([n,l.pathname])),p(l)}(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher"})(Rr||(Rr={})),function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(xr||(xr={}));let Mr=0;function jr(){var e;let{router:t}=Sr(Rr.UseFetcher),r=o.useContext(qe);r||c(!1);let n=null==(e=r.matches[r.matches.length-1])?void 0:e.route.id;null==n&&c(!1);let[a]=o.useState((()=>String(++Mr))),[i]=o.useState((()=>(n||c(!1),function(e,t){return o.forwardRef(((r,n)=>{let a=Ar(e,t);return o.createElement(wr,Yt({},r,{ref:n,submit:a}))}))}(a,n)))),[l]=o.useState((()=>e=>{t||c(!1),n||c(!1),t.fetch(a,n,e)})),s=Ar(a,n),u=t.getFetcher(a),d=o.useMemo((()=>Yt({Form:i,submit:s,load:l},u)),[u,i,s,l]);return o.useEffect((()=>()=>{t?t.deleteFetcher(a):console.warn("No router available to clean up from useFetcher()")}),[t,a]),d}function _r(){return[...Dr(xr.UseFetchers).fetchers.values()]}const Tr="react-router-scroll-positions";let Or={};function Fr(e){let{getKey:t,storageKey:r}=void 0===e?{}:e,{router:n}=Sr(Rr.UseScrollRestoration),{restoreScrollPosition:a,preventScrollReset:i}=Dr(xr.UseScrollRestoration),{basename:l}=o.useContext($e),s=Xe(),u=Et(),c=bt();o.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(e,t){let{capture:r}={};o.useEffect((()=>{let t=null!=r?{capture:r}:void 0;return window.addEventListener("pagehide",e,t),()=>{window.removeEventListener("pagehide",e,t)}}),[e,r])}(o.useCallback((()=>{if("idle"===c.state){let e=(t?t(s,u):null)||s.key;Or[e]=window.scrollY}sessionStorage.setItem(r||Tr,JSON.stringify(Or)),window.history.scrollRestoration="auto"}),[r,t,c.state,s,u])),"undefined"!=typeof document&&(o.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(r||Tr);e&&(Or=JSON.parse(e))}catch(e){}}),[r]),o.useLayoutEffect((()=>{let e=t&&"/"!==l?(e,r)=>t(Yt({},e,{pathname:T(e.pathname,l)||e.pathname}),r):t,r=null==n?void 0:n.enableScrollRestoration(Or,(()=>window.scrollY),e);return()=>r&&r()}),[n,l,t]),o.useLayoutEffect((()=>{if(!1!==a)if("number"!=typeof a){if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==i&&window.scrollTo(0,0)}else window.scrollTo(0,a)}),[s,a,i]))}function Br(e,t){let{capture:r}=t||{};o.useEffect((()=>{let t=null!=r?{capture:r}:void 0;return window.addEventListener("beforeunload",e,t),()=>{window.removeEventListener("beforeunload",e,t)}}),[e,r])}function Nr(e){let{when:t,message:r}=e,n=Lt(t);o.useEffect((()=>{"blocked"===n.state&&(window.confirm(r)?setTimeout(n.proceed,0):n.reset())}),[n,r]),o.useEffect((()=>{"blocked"!==n.state||t||n.reset()}),[n,t])}}}]);