UNPKG

goban

Version:

[![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/online-go/goban)

2 lines 441 kB
/*! For license information please see examples.min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.goban=t(require("React"),require("ReactDOM")):e.goban=t(e.React,e.ReactDOM)}(self,((e,t)=>(()=>{"use strict";var i={228:e=>{var t=Object.prototype.hasOwnProperty,i="~";function s(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,s,o,n){if("function"!=typeof s)throw new TypeError("The listener must be a function");var a=new r(s,o||e,n),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function n(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function a(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,s,r=[];if(0===this._eventsCount)return r;for(s in e=this._events)t.call(e,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,s=this._events[t];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,o=s.length,n=new Array(o);r<o;r++)n[r]=s[r].fn;return n},a.prototype.listenerCount=function(e){var t=i?i+e:e,s=this._events[t];return s?s.fn?1:s.length:0},a.prototype.emit=function(e,t,s,r,o,n){var a=i?i+e:e;if(!this._events[a])return!1;var l,h,c=this._events[a],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,s),!0;case 4:return c.fn.call(c.context,t,s,r),!0;case 5:return c.fn.call(c.context,t,s,r,o),!0;case 6:return c.fn.call(c.context,t,s,r,o,n),!0}for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var u,_=c.length;for(h=0;h<_;h++)switch(c[h].once&&this.removeListener(e,c[h].fn,void 0,!0),d){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,t);break;case 3:c[h].fn.call(c[h].context,t,s);break;case 4:c[h].fn.call(c[h].context,t,s,r);break;default:if(!l)for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,s,r){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return n(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||r&&!a.once||s&&a.context!==s||n(this,o);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==t||r&&!a[l].once||s&&a[l].context!==s)&&h.push(a[l]);h.length?this._events[o]=1===h.length?h[0]:h:n(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&n(this,t)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a},5338:(e,t,i)=>{var s=i(1845);t.createRoot=s.createRoot,t.hydrateRoot=s.hydrateRoot},2648:(e,t,i)=>{i.r(t),i.d(t,{AbortedDeferredError:()=>V,Await:()=>ti,BrowserRouter:()=>Oi,Form:()=>$i,HashRouter:()=>qi,Link:()=>Gi,MemoryRouter:()=>Vt,NavLink:()=>Ii,Navigate:()=>Yt,NavigationType:()=>s,Outlet:()=>Xt,Route:()=>Zt,Router:()=>Qt,RouterProvider:()=>Fi,Routes:()=>ei,ScrollRestoration:()=>Wi,UNSAFE_DataRouterContext:()=>rt,UNSAFE_DataRouterStateContext:()=>ot,UNSAFE_ErrorResponseImpl:()=>te,UNSAFE_FetchersContext:()=>Pi,UNSAFE_LocationContext:()=>lt,UNSAFE_NavigationContext:()=>at,UNSAFE_RouteContext:()=>ht,UNSAFE_ViewTransitionContext:()=>Ei,UNSAFE_useRouteId:()=>Nt,UNSAFE_useScrollRestoration:()=>os,createBrowserRouter:()=>Si,createHashRouter:()=>xi,createMemoryRouter:()=>hi,createPath:()=>p,createRoutesFromChildren:()=>ni,createRoutesFromElements:()=>ni,createSearchParams:()=>pi,defer:()=>Z,generatePath:()=>N,isRouteErrorResponse:()=>ie,json:()=>J,matchPath:()=>O,matchRoutes:()=>w,parsePath:()=>g,redirect:()=>Q,redirectDocument:()=>ee,renderMatches:()=>ai,resolvePath:()=>j,unstable_HistoryRouter:()=>Bi,unstable_usePrompt:()=>as,unstable_useViewTransitionState:()=>ls,useActionData:()=>Gt,useAsyncError:()=>Wt,useAsyncValue:()=>$t,useBeforeUnload:()=>ns,useBlocker:()=>Ht,useFetcher:()=>ts,useFetchers:()=>is,useFormAction:()=>es,useHref:()=>dt,useInRouterContext:()=>ut,useLinkClickHandler:()=>Vi,useLoaderData:()=>jt,useLocation:()=>_t,useMatch:()=>pt,useMatches:()=>Bt,useNavigate:()=>ft,useNavigation:()=>Ot,useNavigationType:()=>mt,useOutlet:()=>bt,useOutletContext:()=>yt,useParams:()=>wt,useResolvedPath:()=>kt,useRevalidator:()=>qt,useRouteError:()=>It,useRouteLoaderData:()=>Dt,useRoutes:()=>St,useSearchParams:()=>Yi,useSubmit:()=>Qi});var s,r=i(4883),o=i(1845);function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},n.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(s||(s={}));const a="popstate";function l(e){void 0===e&&(e={});let t,{initialEntries:i=["/"],initialIndex:r,v5Compat:o=!1}=e;t=i.map(((e,t)=>d(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let n=h(null==r?t.length-1:r),a=s.Pop,l=null;function h(e){return Math.min(Math.max(e,0),t.length-1)}function c(){return t[n]}function d(e,i,s){void 0===i&&(i=null);let r=m(t?c().pathname:"/",e,i,s);return u("/"===r.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),r}function _(e){return"string"==typeof e?e:p(e)}return{get index(){return n},get action(){return a},get location(){return c()},createHref:_,createURL:e=>new URL(_(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?g(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,i){a=s.Push;let r=d(e,i);n+=1,t.splice(n,t.length,r),o&&l&&l({action:a,location:r,delta:1})},replace(e,i){a=s.Replace;let r=d(e,i);t[n]=r,o&&l&&l({action:a,location:r,delta:0})},go(e){a=s.Pop;let i=h(n+e),r=t[i];n=i,l&&l({action:a,location:r,delta:e})},listen:e=>(l=e,()=>{l=null})}}function h(e){return void 0===e&&(e={}),f((function(e,t){let{pathname:i,search:s,hash:r}=e.location;return m("",{pathname:i,search:s,hash:r},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 c(e){return void 0===e&&(e={}),f((function(e,t){let{pathname:i="/",search:s="",hash:r=""}=g(e.location.hash.substr(1));return i.startsWith("/")||i.startsWith(".")||(i="/"+i),m("",{pathname:i,search:s,hash:r},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let i=e.document.querySelector("base"),s="";if(i&&i.getAttribute("href")){let t=e.location.href,i=t.indexOf("#");s=-1===i?t:t.slice(0,i)}return s+"#"+("string"==typeof t?t:p(t))}),(function(e,t){u("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)}function d(e,t){if(!1===e||null==e)throw new Error(t)}function u(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function _(e,t){return{usr:e.state,key:e.key,idx:t}}function m(e,t,i,s){return void 0===i&&(i=null),n({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?g(t):t,{state:i,key:t&&t.key||s||Math.random().toString(36).substr(2,8)})}function p(e){let{pathname:t="/",search:i="",hash:s=""}=e;return i&&"?"!==i&&(t+="?"===i.charAt(0)?i:"?"+i),s&&"#"!==s&&(t+="#"===s.charAt(0)?s:"#"+s),t}function g(e){let t={};if(e){let i=e.indexOf("#");i>=0&&(t.hash=e.substr(i),e=e.substr(0,i));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function f(e,t,i,r){void 0===r&&(r={});let{window:o=document.defaultView,v5Compat:l=!1}=r,h=o.history,c=s.Pop,u=null,g=f();function f(){return(h.state||{idx:null}).idx}function v(){c=s.Pop;let e=f(),t=null==e?null:e-g;g=e,u&&u({action:c,location:b.location,delta:t})}function y(e){let t="null"!==o.location.origin?o.location.origin:o.location.href,i="string"==typeof e?e:p(e);return i=i.replace(/ $/,"%20"),d(t,"No window.location.(origin|href) available to create URL for href: "+i),new URL(i,t)}null==g&&(g=0,h.replaceState(n({},h.state,{idx:g}),""));let b={get action(){return c},get location(){return e(o,h)},listen(e){if(u)throw new Error("A history only accepts one active listener");return o.addEventListener(a,v),u=e,()=>{o.removeEventListener(a,v),u=null}},createHref:e=>t(o,e),createURL:y,encodeLocation(e){let t=y(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){c=s.Push;let r=m(b.location,e,t);i&&i(r,e),g=f()+1;let n=_(r,g),a=b.createHref(r);try{h.pushState(n,"",a)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;o.location.assign(a)}l&&u&&u({action:c,location:b.location,delta:1})},replace:function(e,t){c=s.Replace;let r=m(b.location,e,t);i&&i(r,e),g=f();let o=_(r,g),n=b.createHref(r);h.replaceState(o,"",n),l&&u&&u({action:c,location:b.location,delta:0})},go:e=>h.go(e)};return b}var v;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(v||(v={}));const y=new Set(["lazy","caseSensitive","path","id","index","children"]);function b(e,t,i,s){return void 0===i&&(i=[]),void 0===s&&(s={}),e.map(((e,r)=>{let o=[...i,String(r)],a="string"==typeof e.id?e.id:o.join("-");if(d(!0!==e.index||!e.children,"Cannot specify children on an index route"),d(!s[a],'Found a route id collision on id "'+a+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let i=n({},e,t(e),{id:a});return s[a]=i,i}{let i=n({},e,t(e),{id:a,children:void 0});return s[a]=i,e.children&&(i.children=b(e.children,t,o,s)),i}}))}function w(e,t,i){return void 0===i&&(i="/"),k(e,t,i,!1)}function k(e,t,i,s){let r=B(("string"==typeof t?g(t):t).pathname||"/",i);if(null==r)return null;let o=x(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let i=e.length===t.length&&e.slice(0,-1).every(((e,i)=>e===t[i]));return i?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let n=null;for(let e=0;null==n&&e<o.length;++e){let t=q(r);n=F(o[e],t,s)}return n}function S(e,t){let{route:i,pathname:s,params:r}=e;return{id:i.id,pathname:s,params:r,data:t[i.id],handle:i.handle}}function x(e,t,i,s){void 0===t&&(t=[]),void 0===i&&(i=[]),void 0===s&&(s="");let r=(e,r,o)=>{let n={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:r,route:e};n.relativePath.startsWith("/")&&(d(n.relativePath.startsWith(s),'Absolute route path "'+n.relativePath+'" nested under path "'+s+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),n.relativePath=n.relativePath.slice(s.length));let a=W([s,n.relativePath]),l=i.concat(n);e.children&&e.children.length>0&&(d(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+a+'".'),x(e.children,t,l,a)),(null!=e.path||e.index)&&t.push({path:a,score:L(a,e.index),routesMeta:l})};return e.forEach(((e,t)=>{var i;if(""!==e.path&&null!=(i=e.path)&&i.includes("?"))for(let i of M(e.path))r(e,t,i);else r(e,t)})),t}function M(e){let t=e.split("/");if(0===t.length)return[];let[i,...s]=t,r=i.endsWith("?"),o=i.replace(/\?$/,"");if(0===s.length)return r?[o,""]:[o];let n=M(s.join("/")),a=[];return a.push(...n.map((e=>""===e?o:[o,e].join("/")))),r&&a.push(...n),a.map((t=>e.startsWith("/")&&""===t?"/":t))}const C=/^:[\w-]+$/,E=3,P=2,T=1,A=10,z=-2,R=e=>"*"===e;function L(e,t){let i=e.split("/"),s=i.length;return i.some(R)&&(s+=z),t&&(s+=P),i.filter((e=>!R(e))).reduce(((e,t)=>e+(C.test(t)?E:""===t?T:A)),s)}function F(e,t,i){void 0===i&&(i=!1);let{routesMeta:s}=e,r={},o="/",n=[];for(let e=0;e<s.length;++e){let a=s[e],l=e===s.length-1,h="/"===o?t:t.slice(o.length)||"/",c=O({path:a.relativePath,caseSensitive:a.caseSensitive,end:l},h),d=a.route;if(!c&&l&&i&&!s[s.length-1].route.index&&(c=O({path:a.relativePath,caseSensitive:a.caseSensitive,end:!1},h)),!c)return null;Object.assign(r,c.params),n.push({params:r,pathname:W([o,c.pathname]),pathnameBase:U(W([o,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(o=W([o,c.pathnameBase]))}return n}function N(e,t){void 0===t&&(t={});let i=e;i.endsWith("*")&&"*"!==i&&!i.endsWith("/*")&&(u(!1,'Route path "'+i+'" will be treated as if it were "'+i.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+i.replace(/\*$/,"/*")+'".'),i=i.replace(/\*$/,"/*"));const s=i.startsWith("/")?"/":"",r=e=>null==e?"":"string"==typeof e?e:String(e);return s+i.split(/\/+/).map(((e,i,s)=>{if(i===s.length-1&&"*"===e){return r(t["*"])}const o=e.match(/^:([\w-]+)(\??)$/);if(o){const[,e,i]=o;let s=t[e];return d("?"===i||null!=s,'Missing ":'+e+'" param'),r(s)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")}function O(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[i,s]=function(e,t,i){void 0===t&&(t=!1);void 0===i&&(i=!0);u("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let s=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,i)=>(s.push({paramName:t,isOptional:null!=i}),i?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(s.push({paramName:"*"}),r+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?r+="\\/*$":""!==e&&"/"!==e&&(r+="(?:(?=\\/|$))");let o=new RegExp(r,t?void 0:"i");return[o,s]}(e.path,e.caseSensitive,e.end),r=t.match(i);if(!r)return null;let o=r[0],n=o.replace(/(.)\/+$/,"$1"),a=r.slice(1);return{params:s.reduce(((e,t,i)=>{let{paramName:s,isOptional:r}=t;if("*"===s){let e=a[i]||"";n=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const l=a[i];return e[s]=r&&!l?void 0:(l||"").replace(/%2F/g,"/"),e}),{}),pathname:o,pathnameBase:n,pattern:e}}function q(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return u(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function B(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let i=t.endsWith("/")?t.length-1:t.length,s=e.charAt(i);return s&&"/"!==s?null:e.slice(i)||"/"}function j(e,t){void 0===t&&(t="/");let{pathname:i,search:s="",hash:r=""}="string"==typeof e?g(e):e,o=i?i.startsWith("/")?i:function(e,t){let i=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?i.length>1&&i.pop():"."!==e&&i.push(e)})),i.length>1?i.join("/"):"/"}(i,t):t;return{pathname:o,search:H(s),hash:K(r)}}function D(e,t,i,s){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the `to."+i+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function G(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function I(e,t){let i=G(e);return t?i.map(((t,i)=>i===e.length-1?t.pathname:t.pathnameBase)):i.map((e=>e.pathnameBase))}function $(e,t,i,s){let r;void 0===s&&(s=!1),"string"==typeof e?r=g(e):(r=n({},e),d(!r.pathname||!r.pathname.includes("?"),D("?","pathname","search",r)),d(!r.pathname||!r.pathname.includes("#"),D("#","pathname","hash",r)),d(!r.search||!r.search.includes("#"),D("#","search","hash",r)));let o,a=""===e||""===r.pathname,l=a?"/":r.pathname;if(null==l)o=i;else{let e=t.length-1;if(!s&&l.startsWith("..")){let t=l.split("/");for(;".."===t[0];)t.shift(),e-=1;r.pathname=t.join("/")}o=e>=0?t[e]:"/"}let h=j(r,o),c=l&&"/"!==l&&l.endsWith("/"),u=(a||"."===l)&&i.endsWith("/");return h.pathname.endsWith("/")||!c&&!u||(h.pathname+="/"),h}const W=e=>e.join("/").replace(/\/\/+/g,"/"),U=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),H=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",K=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"",J=function(e,t){void 0===t&&(t={});let i="number"==typeof t?{status:t}:t,s=new Headers(i.headers);return s.has("Content-Type")||s.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),n({},i,{headers:s}))};class V extends Error{}class Y{constructor(e,t){let i;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],d(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise(((e,t)=>i=t)),this.controller=new AbortController;let s=()=>i(new V("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",s),this.controller.signal.addEventListener("abort",s),this.data=Object.entries(e).reduce(((e,t)=>{let[i,s]=t;return Object.assign(e,{[i]:this.trackPromise(i,s)})}),{}),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 i=Promise.race([t,this.abortPromise]).then((t=>this.onSettle(i,e,void 0,t)),(t=>this.onSettle(i,e,t)));return i.catch((()=>{})),Object.defineProperty(i,"_tracked",{get:()=>!0}),i}onSettle(e,t,i,s){if(this.controller.signal.aborted&&i instanceof V)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>i}),Promise.reject(i);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===i&&void 0===s){let i=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:()=>i}),this.emit(!1,t),Promise.reject(i)}return void 0===s?(Object.defineProperty(e,"_error",{get:()=>i}),this.emit(!1,t),Promise.reject(i)):(Object.defineProperty(e,"_data",{get:()=>s}),this.emit(!1,t),s)}emit(e,t){this.subscribers.forEach((i=>i(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 i=()=>this.cancel();e.addEventListener("abort",i),t=await new Promise((t=>{this.subscribe((s=>{e.removeEventListener("abort",i),(s||this.done)&&t(s)}))}))}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return d(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[i,s]=t;return Object.assign(e,{[i]:X(s)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function X(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const Z=function(e,t){return void 0===t&&(t={}),new Y(e,"number"==typeof t?{status:t}:t)},Q=function(e,t){void 0===t&&(t=302);let i=t;"number"==typeof i?i={status:i}:void 0===i.status&&(i.status=302);let s=new Headers(i.headers);return s.set("Location",e),new Response(null,n({},i,{headers:s}))},ee=(e,t)=>{let i=Q(e,t);return i.headers.set("X-Remix-Reload-Document","true"),i};class te{constructor(e,t,i,s){void 0===s&&(s=!1),this.status=e,this.statusText=t||"",this.internal=s,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}}function ie(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const se=["post","put","patch","delete"],re=new Set(se),oe=["get",...se],ne=new Set(oe),ae=new Set([301,302,303,307,308]),le=new Set([307,308]),he={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ce={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},de={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},ue=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_e=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),me="remix-router-transitions";function pe(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,i=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement,r=!i;let o;if(d(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)o=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;o=e=>({hasErrorBoundary:t(e)})}else o=_e;let a,l,h,c={},_=b(e.routes,o,void 0,c),p=e.basename||"/",g=e.unstable_dataStrategy||Me,f=e.unstable_patchRoutesOnMiss,y=n({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,unstable_skipActionErrorRevalidation:!1},e.future),x=null,M=new Set,C=null,E=null,P=null,T=null!=e.hydrationData,A=w(_,e.history.location,p),z=null;if(null==A&&!f){let t=je(404,{pathname:e.history.location.pathname}),{matches:i,route:s}=Be(_);A=i,z={[s.id]:t}}if(A)if(A.some((e=>e.route.lazy)))l=!1;else if(A.some((e=>e.route.loader)))if(y.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,i=e.hydrationData?e.hydrationData.errors:null,s=e=>!e.route.loader||("function"!=typeof e.route.loader||!0!==e.route.loader.hydrate)&&(t&&void 0!==t[e.route.id]||i&&void 0!==i[e.route.id]);if(i){let e=A.findIndex((e=>void 0!==i[e.route.id]));l=A.slice(0,e+1).every(s)}else l=A.every(s)}else l=null!=e.hydrationData;else l=!0;else l=!1,A=[];let R,L={historyAction:e.history.action,location:e.history.location,matches:A,initialized:l,navigation:he,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||z,fetchers:new Map,blockers:new Map},F=s.Pop,N=!1,O=!1,q=new Map,j=null,D=!1,G=!1,I=[],$=[],W=new Map,U=0,H=-1,K=new Map,J=new Set,V=new Map,Y=new Map,X=new Set,Z=new Map,Q=new Map,ee=new Map,te=!1;function se(e,t){void 0===t&&(t={}),L=n({},L,e);let i=[],s=[];y.v7_fetcherPersist&&L.fetchers.forEach(((e,t)=>{"idle"===e.state&&(X.has(t)?s.push(t):i.push(t))})),[...M].forEach((e=>e(L,{deletedFetchers:s,unstable_viewTransitionOpts:t.viewTransitionOpts,unstable_flushSync:!0===t.flushSync}))),y.v7_fetcherPersist&&(i.forEach((e=>L.fetchers.delete(e))),s.forEach((e=>Re(e))))}function re(t,i,r){var o,l;let h,{flushSync:c}=void 0===r?{}:r,d=null!=L.actionData&&null!=L.navigation.formMethod&&Je(L.navigation.formMethod)&&"loading"===L.navigation.state&&!0!==(null==(o=t.state)?void 0:o._isRedirect);h=i.actionData?Object.keys(i.actionData).length>0?i.actionData:null:d?L.actionData:null;let u=i.loaderData?Ne(L.loaderData,i.loaderData,i.matches||[],i.errors):L.loaderData,m=L.blockers;m.size>0&&(m=new Map(m),m.forEach(((e,t)=>m.set(t,de))));let p,g=!0===N||null!=L.navigation.formMethod&&Je(L.navigation.formMethod)&&!0!==(null==(l=t.state)?void 0:l._isRedirect);if(a&&(_=a,a=void 0),D||F===s.Pop||(F===s.Push?e.history.push(t,t.state):F===s.Replace&&e.history.replace(t,t.state)),F===s.Pop){let e=q.get(L.location.pathname);e&&e.has(t.pathname)?p={currentLocation:L.location,nextLocation:t}:q.has(t.pathname)&&(p={currentLocation:t,nextLocation:L.location})}else if(O){let e=q.get(L.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),q.set(L.location.pathname,e)),p={currentLocation:L.location,nextLocation:t}}se(n({},i,{actionData:h,loaderData:u,historyAction:F,location:t,initialized:!0,navigation:he,revalidation:"idle",restoreScrollPosition:ht(t,i.matches||L.matches),preventScrollReset:g,blockers:m}),{viewTransitionOpts:p,flushSync:!0===c}),F=s.Pop,N=!1,O=!1,D=!1,G=!1,I=[],$=[]}async function oe(t,i,r){R&&R.abort(),R=null,F=t,D=!0===(r&&r.startUninterruptedRevalidation),function(e,t){if(C&&P){let i=lt(e,t);C[i]=P()}}(L.location,L.matches),N=!0===(r&&r.preventScrollReset),O=!0===(r&&r.enableViewTransition);let o=a||_,l=r&&r.overrideNavigation,h=w(o,i,p),c=!0===(r&&r.flushSync),d=ct(h,o,i.pathname);if(d.active&&d.matches&&(h=d.matches),!h){let{error:e,notFoundMatches:t,route:s}=ot(i.pathname);return void re(i,{matches:t,loaderData:{},errors:{[s.id]:e}},{flushSync:c})}if(L.initialized&&!G&&function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1}(L.location,i)&&!(r&&r.submission&&Je(r.submission.formMethod)))return void re(i,{matches:h},{flushSync:c});R=new AbortController;let u,m=Ae(e.history,i,R.signal,r&&r.submission);if(r&&r.pendingError)u=[qe(h).route.id,{type:v.error,error:r.pendingError}];else if(r&&r.submission&&Je(r.submission.formMethod)){let t=await async function(e,t,i,r,o,n){void 0===n&&(n={});be();let a,l=function(e,t){let i={state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text};return i}(t,i);if(se({navigation:l},{flushSync:!0===n.flushSync}),o){let i=await dt(r,t.pathname,e.signal);if("aborted"===i.type)return{shortCircuited:!0};if("error"===i.type){let{error:e,notFoundMatches:s,route:r}=nt(t.pathname,i);return{matches:s,pendingActionResult:[r.id,{type:v.error,error:e}]}}if(!i.matches){let{notFoundMatches:e,error:i,route:s}=ot(t.pathname);return{matches:e,pendingActionResult:[s.id,{type:v.error,error:i}]}}r=i.matches}let h=Ze(r,t);if(h.route.action||h.route.lazy){if(a=(await pe("action",e,[h],r))[0],e.signal.aborted)return{shortCircuited:!0}}else a={type:v.error,error:je(405,{method:e.method,pathname:t.pathname,routeId:h.route.id})};if(Ue(a)){let t;if(n&&null!=n.replace)t=n.replace;else{t=Te(a.response.headers.get("Location"),new URL(e.url),p)===L.location.pathname+L.location.search}return await ae(e,a,{submission:i,replace:t}),{shortCircuited:!0}}if($e(a))throw je(400,{type:"defer-action"});if(We(a)){let e=qe(r,h.route.id);return!0!==(n&&n.replace)&&(F=s.Push),{matches:r,pendingActionResult:[e.route.id,a]}}return{matches:r,pendingActionResult:[h.route.id,a]}}(m,i,r.submission,h,d.active,{replace:r.replace,flushSync:c});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,s]=t.pendingActionResult;if(We(s)&&ie(s.error)&&404===s.error.status)return R=null,void re(i,{matches:t.matches,loaderData:{},errors:{[e]:s.error}})}h=t.matches||h,u=t.pendingActionResult,l=et(i,r.submission),c=!1,d.active=!1,m=Ae(e.history,m.url,m.signal)}let{shortCircuited:g,matches:f,loaderData:b,errors:k}=await async function(t,i,s,r,o,l,h,c,d,u,m){let g=o||et(i,l),f=l||h||Qe(g),v=!(D||y.v7_partialHydration&&d);if(r){if(v){let e=ne(m);se(n({navigation:g},void 0!==e?{actionData:e}:{}),{flushSync:u})}let e=await dt(s,i.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){let{error:t,notFoundMatches:s,route:r}=nt(i.pathname,e);return{matches:s,loaderData:{},errors:{[r.id]:t}}}if(!e.matches){let{error:e,notFoundMatches:t,route:s}=ot(i.pathname);return{matches:t,loaderData:{},errors:{[s.id]:e}}}s=e.matches}let b=a||_,[w,k]=ye(e.history,L,s,f,i,y.v7_partialHydration&&!0===d,y.unstable_skipActionErrorRevalidation,G,I,$,X,V,J,b,p,m);if(at((e=>!(s&&s.some((t=>t.route.id===e)))||w&&w.some((t=>t.route.id===e)))),H=++U,0===w.length&&0===k.length){let e=He();return re(i,n({matches:s,loaderData:{},errors:m&&We(m[1])?{[m[0]]:m[1].error}:null},Oe(m),e?{fetchers:new Map(L.fetchers)}:{}),{flushSync:u}),{shortCircuited:!0}}if(v){let e={};if(!r){e.navigation=g;let t=ne(m);void 0!==t&&(e.actionData=t)}k.length>0&&(e.fetchers=function(e){return e.forEach((e=>{let t=L.fetchers.get(e.key),i=tt(void 0,t?t.data:void 0);L.fetchers.set(e.key,i)})),new Map(L.fetchers)}(k)),se(e,{flushSync:u})}k.forEach((e=>{W.has(e.key)&&Le(e.key),e.controller&&W.set(e.key,e.controller)}));let S=()=>k.forEach((e=>Le(e.key)));R&&R.signal.addEventListener("abort",S);let{loaderResults:x,fetcherResults:M}=await ve(L.matches,s,w,k,t);if(t.signal.aborted)return{shortCircuited:!0};R&&R.signal.removeEventListener("abort",S);k.forEach((e=>W.delete(e.key)));let C=De([...x,...M]);if(C){if(C.idx>=w.length){let e=k[C.idx-w.length].key;J.add(e)}return await ae(t,C.result,{replace:c}),{shortCircuited:!0}}let{loaderData:E,errors:P}=Fe(L,s,w,x,m,k,M,Z);Z.forEach(((e,t)=>{e.subscribe((i=>{(i||e.done)&&Z.delete(t)}))})),y.v7_partialHydration&&d&&L.errors&&Object.entries(L.errors).filter((e=>{let[t]=e;return!w.some((e=>e.route.id===t))})).forEach((e=>{let[t,i]=e;P=Object.assign(P||{},{[t]:i})}));let T=He(),A=Ke(H),z=T||A||k.length>0;return n({matches:s,loaderData:E,errors:P},z?{fetchers:new Map(L.fetchers)}:{})}(m,i,h,d.active,l,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&!0===r.initialHydration,c,u);g||(R=null,re(i,n({matches:f||h},Oe(u),{loaderData:b,errors:k})))}function ne(e){return e&&!We(e[1])?{[e[0]]:e[1].data}:L.actionData?0===Object.keys(L.actionData).length?null:L.actionData:void 0}async function ae(r,o,a){let{submission:l,fetcherSubmission:h,replace:c}=void 0===a?{}:a;o.response.headers.has("X-Remix-Revalidate")&&(G=!0);let u=o.response.headers.get("Location");d(u,"Expected a Location header on the redirect Response"),u=Te(u,new URL(r.url),p);let _=m(L.location,u,{_isRedirect:!0});if(i){let i=!1;if(o.response.headers.has("X-Remix-Reload-Document"))i=!0;else if(ue.test(u)){const s=e.history.createURL(u);i=s.origin!==t.location.origin||null==B(s.pathname,p)}if(i)return void(c?t.location.replace(u):t.location.assign(u))}R=null;let g=!0===c?s.Replace:s.Push,{formMethod:f,formAction:v,formEncType:y}=L.navigation;!l&&!h&&f&&v&&y&&(l=Qe(L.navigation));let b=l||h;if(le.has(o.response.status)&&b&&Je(b.formMethod))await oe(g,_,{submission:n({},b,{formAction:u}),preventScrollReset:N});else{let e=et(_,l);await oe(g,_,{overrideNavigation:e,fetcherSubmission:h,preventScrollReset:N})}}async function pe(e,t,i,s){try{let r=await Ce(g,e,t,i,s,c,o);return await Promise.all(r.map(((e,r)=>{if(Ie(e)){let o=e.result;return{type:v.redirect,response:Pe(o,t,i[r].route.id,s,p,y.v7_relativeSplatPath)}}return Ee(e)})))}catch(e){return i.map((()=>({type:v.error,error:e})))}}async function ve(t,i,s,r,o){let[n,...a]=await Promise.all([s.length?pe("loader",o,s,i):[],...r.map((t=>{if(t.matches&&t.match&&t.controller){return pe("loader",Ae(e.history,t.path,t.controller.signal),[t.match],t.matches).then((e=>e[0]))}return Promise.resolve({type:v.error,error:je(404,{pathname:t.path})})}))]);return await Promise.all([Ve(t,s,n,n.map((()=>o.signal)),!1,L.loaderData),Ve(t,r.map((e=>e.match)),a,r.map((e=>e.controller?e.controller.signal:null)),!0)]),{loaderResults:n,fetcherResults:a}}function be(){G=!0,I.push(...at()),V.forEach(((e,t)=>{W.has(t)&&($.push(t),Le(t))}))}function we(e,t,i){void 0===i&&(i={}),L.fetchers.set(e,t),se({fetchers:new Map(L.fetchers)},{flushSync:!0===(i&&i.flushSync)})}function xe(e,t,i,s){void 0===s&&(s={});let r=qe(L.matches,t);Re(e),se({errors:{[r.route.id]:i},fetchers:new Map(L.fetchers)},{flushSync:!0===(s&&s.flushSync)})}function ze(e){return y.v7_fetcherPersist&&(Y.set(e,(Y.get(e)||0)+1),X.has(e)&&X.delete(e)),L.fetchers.get(e)||ce}function Re(e){let t=L.fetchers.get(e);!W.has(e)||t&&"loading"===t.state&&K.has(e)||Le(e),V.delete(e),K.delete(e),J.delete(e),X.delete(e),L.fetchers.delete(e)}function Le(e){let t=W.get(e);d(t,"Expected fetch controller: "+e),t.abort(),W.delete(e)}function Ge(e){for(let t of e){let e=it(ze(t).data);L.fetchers.set(t,e)}}function He(){let e=[],t=!1;for(let i of J){let s=L.fetchers.get(i);d(s,"Expected fetcher: "+i),"loading"===s.state&&(J.delete(i),e.push(i),t=!0)}return Ge(e),t}function Ke(e){let t=[];for(let[i,s]of K)if(s<e){let e=L.fetchers.get(i);d(e,"Expected fetcher: "+i),"loading"===e.state&&(Le(i),K.delete(i),t.push(i))}return Ge(t),t.length>0}function Xe(e){L.blockers.delete(e),Q.delete(e)}function st(e,t){let i=L.blockers.get(e)||de;d("unblocked"===i.state&&"blocked"===t.state||"blocked"===i.state&&"blocked"===t.state||"blocked"===i.state&&"proceeding"===t.state||"blocked"===i.state&&"unblocked"===t.state||"proceeding"===i.state&&"unblocked"===t.state,"Invalid blocker state transition: "+i.state+" -> "+t.state);let s=new Map(L.blockers);s.set(e,t),se({blockers:s})}function rt(e){let{currentLocation:t,nextLocation:i,historyAction:s}=e;if(0===Q.size)return;Q.size>1&&u(!1,"A router only supports one blocker at a time");let r=Array.from(Q.entries()),[o,n]=r[r.length-1],a=L.blockers.get(o);return a&&"proceeding"===a.state?void 0:n({currentLocation:t,nextLocation:i,historyAction:s})?o:void 0}function ot(e){let t=je(404,{pathname:e}),i=a||_,{matches:s,route:r}=Be(i);return at(),{notFoundMatches:s,route:r,error:t}}function nt(e,t){let i=t.partialMatches,s=i[i.length-1].route;return{notFoundMatches:i,route:s,error:je(400,{type:"route-discovery",routeId:s.id,pathname:e,message:null!=t.error&&"message"in t.error?t.error:String(t.error)})}}function at(e){let t=[];return Z.forEach(((i,s)=>{e&&!e(s)||(i.cancel(),t.push(s),Z.delete(s))})),t}function lt(e,t){if(E){return E(e,t.map((e=>S(e,L.loaderData))))||e.key}return e.key}function ht(e,t){if(C){let i=lt(e,t),s=C[i];if("number"==typeof s)return s}return null}function ct(e,t,i){if(f){if(!e){return{active:!0,matches:k(t,i,p,!0)||[]}}if("*"===e[e.length-1].route.path){return{active:!0,matches:k(t,i,p,!0)}}}return{active:!1,matches:null}}async function dt(e,t,i){let s=e,r=s.length>0?s[s.length-1].route:null;for(;;){try{await ke(f,t,s,_||a,c,o,ee,i)}catch(e){return{type:"error",error:e,partialMatches:s}}if(i.aborted)return{type:"aborted"};let e=a||_,n=w(e,t,p),l=!1;if(n){let e=n[n.length-1].route;if(e.index)return{type:"success",matches:n};if(e.path&&e.path.length>0){if("*"!==e.path)return{type:"success",matches:n};l=!0}}let h=k(e,t,p,!0);if(!h||s.map((e=>e.route.id)).join("-")===h.map((e=>e.route.id)).join("-"))return{type:"success",matches:l?n:null};if(s=h,r=s[s.length-1].route,"*"===r.path)return{type:"success",matches:s}}}return h={get basename(){return p},get future(){return y},get state(){return L},get routes(){return _},get window(){return t},initialize:function(){if(x=e.history.listen((t=>{let{action:i,location:s,delta:r}=t;if(te)return void(te=!1);u(0===Q.size||null!=r,"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 o=rt({currentLocation:L.location,nextLocation:s,historyAction:i});return o&&null!=r?(te=!0,e.history.go(-1*r),void st(o,{state:"blocked",location:s,proceed(){st(o,{state:"proceeding",proceed:void 0,reset:void 0,location:s}),e.history.go(r)},reset(){let e=new Map(L.blockers);e.set(o,de),se({blockers:e})}})):oe(i,s)})),i){!function(e,t){try{let i=e.sessionStorage.getItem(me);if(i){let e=JSON.parse(i);for(let[i,s]of Object.entries(e||{}))s&&Array.isArray(s)&&t.set(i,new Set(s||[]))}}catch(e){}}(t,q);let e=()=>function(e,t){if(t.size>0){let i={};for(let[e,s]of t)i[e]=[...s];try{e.sessionStorage.setItem(me,JSON.stringify(i))}catch(e){u(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}}(t,q);t.addEventListener("pagehide",e),j=()=>t.removeEventListener("pagehide",e)}return L.initialized||oe(s.Pop,L.location,{initialHydration:!0}),h},subscribe:function(e){return M.add(e),()=>M.delete(e)},enableScrollRestoration:function(e,t,i){if(C=e,P=t,E=i||null,!T&&L.navigation===he){T=!0;let e=ht(L.location,L.matches);null!=e&&se({restoreScrollPosition:e})}return()=>{C=null,P=null,E=null}},navigate:async function t(i,r){if("number"==typeof i)return void e.history.go(i);let o=ge(L.location,L.matches,p,y.v7_prependBasename,i,y.v7_relativeSplatPath,null==r?void 0:r.fromRouteId,null==r?void 0:r.relative),{path:a,submission:l,error:h}=fe(y.v7_normalizeFormMethod,!1,o,r),c=L.location,d=m(L.location,a,r&&r.state);d=n({},d,e.history.encodeLocation(d));let u=r&&null!=r.replace?r.replace:void 0,_=s.Push;!0===u?_=s.Replace:!1===u||null!=l&&Je(l.formMethod)&&l.formAction===L.location.pathname+L.location.search&&(_=s.Replace);let g=r&&"preventScrollReset"in r?!0===r.preventScrollReset:void 0,f=!0===(r&&r.unstable_flushSync),v=rt({currentLocation:c,nextLocation:d,historyAction:_});if(!v)return await oe(_,d,{submission:l,pendingError:h,preventScrollReset:g,replace:r&&r.replace,enableViewTransition:r&&r.unstable_viewTransition,flushSync:f});st(v,{state:"blocked",location:d,proceed(){st(v,{state:"proceeding",proceed:void 0,reset:void 0,location:d}),t(i,r)},reset(){let e=new Map(L.blockers);e.set(v,de),se({blockers:e})}})},fetch:function(t,i,s,o){if(r)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.");W.has(t)&&Le(t);let n=!0===(o&&o.unstable_flushSync),l=a||_,h=ge(L.location,L.matches,p,y.v7_prependBasename,s,y.v7_relativeSplatPath,i,null==o?void 0:o.relative),c=w(l,h,p),u=ct(c,l,h);if(u.active&&u.matches&&(c=u.matches),!c)return void xe(t,i,je(404,{pathname:h}),{flushSync:n});let{path:m,submission:g,error:f}=fe(y.v7_normalizeFormMethod,!0,h,o);if(f)return void xe(t,i,f,{flushSync:n});let v=Ze(c,m);N=!0===(o&&o.preventScrollReset),g&&Je(g.formMethod)?async function(t,i,s,r,o,n,l,h){function c(e){if(!e.route.action&&!e.route.lazy){let e=je(405,{method:h.formMethod,pathname:s,routeId:i});return xe(t,i,e,{flushSync:l}),!0}return!1}if(be(),V.delete(t),!n&&c(r))return;let u=L.fetchers.get(t);we(t,function(e,t){let i={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};return i}(h,u),{flushSync:l});let m=new AbortController,g=Ae(e.history,s,m.signal,h);if(n){let e=await dt(o,s,g.signal);if("aborted"===e.type)return;if("error"===e.type){let{error:r}=nt(s,e);return void xe(t,i,r,{flushSync:l})}if(!e.matches)return void xe(t,i,je(404,{pathname:s}),{flushSync:l});if(c(r=Ze(o=e.matches,s)))return}W.set(t,m);let f=U,v=await pe("action",g,[r],o),b=v[0];if(g.signal.aborted)return void(W.get(t)===m&&W.delete(t));if(y.v7_fetcherPersist&&X.has(t)){if(Ue(b)||We(b))return void we(t,it(void 0))}else{if(Ue(b))return W.delete(t),H>f?void we(t,it(void 0)):(J.add(t),we(t,tt(h)),ae(g,b,{fetcherSubmission:h}));if(We(b))return void xe(t,i,b.error)}if($e(b))throw je(400,{type:"defer-action"});let k=L.navigation.location||L.location,S=Ae(e.history,k,m.signal),x=a||_,M="idle"!==L.navigation.state?w(x,L.navigation.location,p):L.matches;d(M,"Didn't find any matches after fetcher action");let C=++U;K.set(t,C);let E=tt(h,b.data);L.fetchers.set(t,E);let[P,T]=ye(e.history,L,M,h,k,!1,y.unstable_skipActionErrorRevalidation,G,I,$,X,V,J,x,p,[r.route.id,b]);T.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,i=L.fetchers.get(t),s=tt(void 0,i?i.data:void 0);L.fetchers.set(t,s),W.has(t)&&Le(t),e.controller&&W.set(t,e.controller)})),se({fetchers:new Map(L.fetchers)});let A=()=>T.forEach((e=>Le(e.key)));m.signal.addEventListener("abort",A);let{loaderResults:z,fetcherResults:N}=await ve(L.matches,M,P,T,S);if(m.signal.aborted)return;m.signal.removeEventListener("abort",A),K.delete(t),W.delete(t),T.forEach((e=>W.delete(e.key)));let O=De([...z,...N]);if(O){if(O.idx>=P.length){let e=T[O.idx-P.length].key;J.add(e)}return ae(S,O.result)}let{loaderData:q,errors:B}=Fe(L,L.matches,P,z,void 0,T,N,Z);if(L.fetchers.has(t)){let e=it(b.data);L.fetchers.set(t,e)}Ke(C),"loading"===L.navigation.state&&C>H?(d(F,"Expected pending action"),R&&R.abort(),re(L.navigation.location,{matches:M,loaderData:q,errors:B,fetchers:new Map(L.fetchers)})):(se({errors:B,loaderData:Ne(L.loaderData,q,M,B),fetchers:new Map(L.fetchers)}),G=!1)}(t,i,m,v,c,u.active,n,g):(V.set(t,{routeId:i,path:m}),async function(t,i,s,r,o,n,a,l){let h=L.fetchers.get(t);we(t,tt(l,h?h.data:void 0),{flushSync:a});let c=new AbortController,u=Ae(e.history,s,c.signal);if(n){let e=await dt(o,s,u.signal);if("aborted"===e.type)return;if("error"===e.type){let{error:r}=nt(s,e);return void xe(t,i,r,{flushSync:a})}if(!e.matches)return void xe(t,i,je(404,{pathname:s}),{flushSync:a});r=Ze(o=e.matches,s)}W.set(t,c);let _=U,m=await pe("loader",u,[r],o),p=m[0];$e(p)&&(p=await Ye(p,u.signal,!0)||p);W.get(t)===c&&W.delete(t);if(u.signal.aborted)return;if(X.has(t))return void we(t,it(void 0));if(Ue(p))return H>_?void we(t,it(void 0)):(J.add(t),void await ae(u,p));if(We(p))return void xe(t,i,p.error);d(!$e(p),"Unhandled fetcher deferred data"),we(t,it(p.data))}(t,i,m,v,c,u.active,n,g))},revalidate:function(){be(),se({revalidation:"loading"}),"submitting"!==L.navigation.state&&("idle"!==L.navigation.state?oe(F||L.historyAction,L.navigation.location,{overrideNavigation:L.navigation}):oe(L.historyAction,L.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:ze,deleteFetcher:function(e){if(y.v7_fetcherPersist){let t=(Y.get(e)||0)-1;t<=0?(Y.delete(e),X.add(e)):Y.set(e,t)}else Re(e);se({fetchers:new Map(L.fetchers)})},dispose:function(){x&&x(),j&&j(),M.clear(),R&&R.abort(),L.fetchers.forEach(((e,t)=>Re(t))),L.blockers.forEach(((e,t)=>Xe(t)))},getBlocker:function(e,t){let i=L.blockers.get(e)||de;return Q.get(e)!==t&&Q.set(e,t),i},deleteBlocker:Xe,patchRoutes:(e,t)=>Se(e,t,_||a,c,o),_internalFetchControllers:W,_internalActiveDeferreds:Z,_internalSetRoutes:function(e){c={},a=b(e,o,void 0,c)}},h}Symbol("deferred");function ge(e,t,i,s,r,o,n,a){let l,h;if(n){l=[];for(let e of t)if(l.push(e),e.route.id===n){h=e;break}}else l=t,h=t[t.length-1];let c=$(r||".",I(l,o),B(e.pathname,i)||e.pathname,"path"===a);return null==r&&(c.search=e.search,c.hash=e.hash),null!=r&&""!==r&&"."!==r||!h||!h.route.index||Xe(c.search)||(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),s&&"/"!==i&&(c.pathname="/"===c.pathname?i:W([i,c.pathname])),p(c)}function fe(e,t,i,s){if(!s||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(s))return{path:i};if(s.formMethod&&!Ke(s.formMethod))return{path:i,error:je(405,{method:s.formMethod})};let r,o,n=()=>({path:i,error:je(400,{type:"invalid-body"})}),a=s.formMethod||"get",l=e?a.toUpperCase():a.toLowerCase(),h=Ge(i);if(void 0!==s.body){if("text/plain"===s.formEncType){if(!Je(l))return n();let e="string"==typeof s.body?s.body:s.body instanceof FormData||s.body instanceof URLSearchParams?Array.from(s.body.entries()).reduce(((e,t)=>{let[i,s]=t;return""+e+i+"="+s+"\n"}),""):String(s.body);return{path:i,submission:{formMethod:l,formAction:h,formEncType:s.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===s.formEncType){if(!Je(l))return n();try{let e="string"==typeof s.body?JSON.parse(s.body):s.body;return{path:i,submission:{formMethod:l,formAction:h,formEncType:s.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return n()}}}if(d("function"==typeof FormData,"FormData is not available in this environment"),s.formData)r=ze(s.formData),o=s.formData;else if(s.body instanceof FormData)r=ze(s.body),o=s.body;else if(s.body instanceof URLSearchParams)r=s.body,o=Re(r);else if(null==s.body)r=new URLSearchParams,o=new FormData;else try{r=new URLSearchParams(s.body),o=Re(r)}catch(e){return n()}let c={formMethod:l,formAction:h,formEncType:s&&s.formEncType||"application/x-www-form-urlencoded",formData:o,json:void 0,text:void 0};if(Je(c.formMethod))return{path:i,submission:c};let u=g(i);return t&&u.search&&Xe(u.search)&&r.append("index",""),u.search="?"+r,{path:p(u),submission:c}}function ve(e,t){let i=e;if(t){let s=e.findIndex((e=>e.route.id===t));s>=0&&(i=e.slice(0,s))}return i}function ye(e,t,i,s,r,o,a,l,h,c,d,u,_,m,p,g){let f=g?We(g[1])?g[1].error:g[1].data:void 0,v=e.createURL(t.location),y=e.createURL(r),b=g&&We(g[1])?g[0]:void 0,k=b?ve(i,b):i,S=g?g[1].statusCode:void 0,x=a&&S&&S>=400,M=k.filter(((e,i)=>{let{route:r}=e;if(r.lazy)return!0;if(null==r.loader)return!1;if(o)return!("function"==typeof r.loader&&!r.loader.hydrate)||void 0===t.loaderData[r.id]&&(!t.errors||void 0===t.errors[r.id]);if(function(e,t,i){let s=!t||i.route.id!==t.route.id,r=void 0===e[i.route.id];return s||r}(t.loaderData,t.matches[i],e)||h.some((t=>t===e.route.id)))return!0;let a=t.matches[i],c=e;return we(e,n({currentUrl:v,currentParams:a.params,nextUrl:y,nextParams:c.params},s,{actionResult:f,unstable_actionStatus:S,defaultShouldRevalidate:!x&&(l||v.pathname+v.search===y.pathname+y.search||v.search!==y.search||be(a,c))}))})),C=[];return u.forEach(((e,r)=>{if(o||!i.some((t=>t.route.id===e.routeId))||d.has(r))return;let a=w(m,e.path,p);if(!a)return void C.push({key:r,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let h=t.fetchers.get(r),u=Ze(a,e.path),g=!1;g=!_.has(r)&&(!!c.includes(r)||(h&&"idle"!==h.state&&void 0===h.data?l:we(u,n({currentUrl:v,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:i[i.length-1].params},s,{actionResult:f,unstable_actionStatus:S,defaultShouldRevalidate:!x&&l})))),g&&C.push({key:r,routeId:e.routeId,path:e.path,matches:a,match:u,controller:new AbortController})})),[M,C]}function be(e,t){let i=e.route.path;return e.pathname!==t.pathname||null!=i&&i.endsWith("*")&&e.params["*"]!==t.params["*"]}function we(e,t){if(e.route.shouldRevalidate){let i=e.route.shouldRevalidate(t);if("boolean"==typeof i)return i}return t.defaultShouldRevalidate}async function ke(e,t,i,s,r,o,n,a){let l=[t,...i.map((e=>e.route.id))].join("-");try{let c=n.get(l);c||(c=e({path:t,matches:i,patch:(e,t)=>{a.aborted||Se(e,t,s,r,o)}}),n.set(l,c)),c&&("object"==typeof(h=c)&&null!=h&&"then"in h)&&await c}finally{n.delete(l)}var h}function Se(e,t,i,s,r){if(e){var o;let i=s[e];d(i,"No route found to patch children into: routeId = "+e);let n=b(t,r,[e,"patch",String((null==(o=i.children)?void 0:o.length)||"0")],s);i.children?i.children.push(...n):i.children=n}else{let e=b(t,r,["patch",String(i.length||"0")],s);i.push(...e)}}async function xe(e,t,i){if(!e.lazy)return;let s=await e.lazy();if(!e.lazy)return;let r=i[e.id];d(r,"No route found in manifest");let o={};for(let e in s){let t=void 0!==r[e]&&"hasErrorBoundary"!==e;u(!t,'Route "'+r.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||y.has(e)||(o[e]=s[e])}Object.assign(r,o),Object.assign(r,n({},t(r),{lazy:void 0}))}function Me(e){return Promise.all(e.matches.map((e=>e.resolve())))}async function Ce(e,t,i,s,r,o,a,l){let h=s.reduce(((e,t)=>e.add(t.route.id)),new Set),c=new Set,u=await e({matches:r.map((e=>{let s=h.has(e.route.id);return n({},e,{shouldLoad:s,resolve:r=>(c.add(e.route.id),s?async function(e,t,i,s,r,o,n){let a,l,h=s=>{let r,a=new Promise(((e,t)=>r=t));l=()=>r(),t.signal.addEventListener("abort",l);let h,c=r=>"function"!=typeof s?Promise.reject(new Error('You cannot call the handler for a route which defines a boolean "'+e+'" [routeId: '+i.route.id+"]")):s({request:t,params:i.params,context:n},...void 0!==r?[r]:[]);return h=o?o((e=>c(e))):(async()=>{try{return{type:"data",result:await c()}}catch(e){return{type:"error",result:e}}})(),Promise.race([h,a])};try{let o=i.route[e];if(i.route.lazy)if(o){let e,[t]=await Promise.all([h(o).catch((t=>{e=t})),xe(i.route,r,s)]);if(void 0!==e)throw e;a=t}else{if(await xe(i.route,r,s),o=i.route[e],!o){if("action"===e){let e=new URL(t.url),s=e.pathname+e.search;throw je(405,{method:t.method,pathname:s,routeId:i.route.id})}return{type:v.data,result:void 0}}a=await h(o)}else{if(!o){let e=new URL(t.url);throw je(404,{pathname:e.pathname+e.search})}a=await h(o)}d(void 0!==a.result,"You defined "+("action"===e?"an action":"a loader")+' for route "'+i.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){return{type:v.error,result:e}}finally{l&&t.signal.removeEventListener("abort",l)}return a}(t,i,e,o,a,r,l):Promise.resolve({type:v.data,result:void 0}))})})),request:i,params:r[0].params,context:l});return r.forEach((e=>d(c.has(e.route.id),'`match.resolve()` was not called for route id "'+e.route.id+'". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.'))),u.filter(((e,t)=>h.has(r[t].route.id)))}async function Ee(e){let{result:t,type:i,status:s}=e;if(He(t)){let e;try{let i=t.headers.get("Content-Type");e=i&&/\bapplication\/json\b/.test(i)?null==t.body?null:await t.json():await t.text()}catch(e){return{type:v.error,error:e}}return i===v.error?{type:v.error,error:new te(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:v.data,data:e,statusCode:t.status,headers:t.headers}}return i===v.error?{type:v.error,error:t,statusCode:ie(t)?t.status:s}: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}(t)?{type:v.deferred,deferredData:t,statusCode:null==(r=t.init)?void 0:r.status,headers:(null==(o=t.init)?void 0:o.headers)&&new Headers(t.init.headers)}:{type:v.data,data:t,statusCode:s};var r,o}function Pe(e,t,i,s,r,o){let n=e.headers.get("Location");if(d(n,"Redirects returned/thrown from loaders/actions must have a Location header"),!ue.test(n)){let a=s.slice(0,s.findIndex((e=>e.route.id===i))+1);n=ge(new URL(t.url),a,r,!0,n,o),e.headers.set("Location",n)}return e}function Te(e,t,i)