@trokky/studio 2.0.3
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.
- package/dist/assets/index-CSDhJo2Z.js +742 -0
- package/dist/assets/index-CSDhJo2Z.js.map +1 -0
- package/dist/assets/index-DykyF7LU.css +1 -0
- package/dist/assets/query-CieM36kR.js +2 -0
- package/dist/assets/query-CieM36kR.js.map +1 -0
- package/dist/assets/rolldown-runtime-CbXtAM7H.js +1 -0
- package/dist/assets/router-Dpg4KYTB.js +5 -0
- package/dist/assets/router-Dpg4KYTB.js.map +1 -0
- package/dist/assets/ui-D5AGhrb0.js +2 -0
- package/dist/assets/ui-D5AGhrb0.js.map +1 -0
- package/dist/assets/vendor-igJJvL5X.js +10 -0
- package/dist/assets/vendor-igJJvL5X.js.map +1 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.html +61 -0
- package/dist/index.js +199 -0
- package/dist/server/assets.d.ts +31 -0
- package/dist/server/assets.js +169 -0
- package/dist/utils/logger.d.ts +35 -0
- package/dist/utils/logger.js +114 -0
- package/package.json +107 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{n as e,t}from"./rolldown-runtime-CbXtAM7H.js";var n=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function ee(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=M(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(ee(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function N(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function te(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},F={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=F,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:te}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,P)}catch(e){P(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),r=t(((e,t)=>{t.exports=n()})),i=t((e=>{var t=r();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(n(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.8`})),a=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=i()})),o=e(r(),1),s=`modulepreload`,c=function(e){return`/`+e},l={},u=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function u(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=c(t,n),t=u(t),t in l)return;l[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:s,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},d=e=>{throw TypeError(e)},f=(e,t,n)=>t.has(e)||d(`Cannot `+n),p=(e,t,n)=>(f(e,t,`read from private field`),n?n.call(e):t.get(e)),m=(e,t,n)=>t.has(e)?d(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),h=(e,t,n,r)=>(f(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),g=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,_=/^[\\/]{2}/;function v(e,t){return t+e.replace(/\\/g,`/`)}var y=`popstate`;function b(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function x(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return E(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:D(t)}return k(t,n,null,e)}function S(e,t){if(e===!1||e==null)throw Error(t)}function C(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function w(){return Math.random().toString(36).substring(2,10)}function T(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function E(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?O(t):t,state:n,key:t&&t.key||r||w(),mask:i}}function D({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function O(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function k(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=b(e)?e:E(h.location,e,t);n&&n(r,e),l=u()+1;let d=T(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=b(e)?e:E(h.location,e,t);n&&n(r,e),l=u();let i=T(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return A(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(y,d),c=e,()=>{i.removeEventListener(y,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function A(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),S(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:D(t);return i=i.replace(/ $/,`%20`),!n&&_.test(i)&&(i=r+i),new URL(i,r)}var j,ee=class{constructor(e){if(m(this,j,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(p(this,j).has(e))return p(this,j).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){p(this,j).set(e,t)}};j=new WeakMap;var M=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function N(e){return M.has(e)}var te=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function P(e){return te.has(e)}function F(e){return e.index===!0}function ne(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(S(e.index!==!0||!e.children,`Cannot specify children on an index route`),S(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),F(e)){let n={...e,id:s};return r[s]=re(n,t(n)),n}{let n={...e,id:s,children:void 0};return r[s]=re(n,t(n)),e.children&&(n.children=ne(e.children,t,o,r,i)),n}})}function re(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function ie(e,t,n=`/`){return I(e,t,n,!1)}function I(e,t,n,r,i){let a=U((typeof t==`string`?O(t):t).pathname||`/`,n);if(a==null)return null;let o=i??L(e),s=null,c=H(a);for(let e=0;s==null&&e<o.length;++e)s=me(o[e],c,r);return s}function ae(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function L(e){let t=oe(e);return R(t),t}function oe(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;S(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=W([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(S(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),oe(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:V(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=_e(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of se(e.path))a(e,t,!0,n)}),t}function se(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=se(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function R(e){e.sort((e,t)=>e.score===t.score?pe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ce=/^:[\w-]+$/,le=3,ue=2,z=1,de=10,fe=-2,B=e=>e===`*`;function V(e,t){let n=e.split(`/`),r=n.length;return n.some(B)&&(r+=fe),t&&(r+=ue),n.filter(e=>!B(e)).reduce((e,t)=>e+(ce.test(t)?le:t===``?z:de),r)}function pe(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function me(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?ge(u,l,s.matcher,s.compiledParams):he(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=he({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:W([a,d.pathname]),pathnameBase:Oe(W([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=W([a,d.pathnameBase]))}return o}function he(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=_e(e.path,e.caseSensitive,e.end);return ge(e,t,n,r)}function ge(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=De(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=De(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function _e(e,t=!1,n=!0){C(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function H(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return C(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function U(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function ve({basename:e,pathname:t}){return t===`/`?e:W([e,t])}var ye=e=>g.test(e);function be(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?O(e):e,a;return n?(n=Ee(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?xe(n.substring(1),`/`):xe(n,t)):a=t,{pathname:a,search:ke(r),hash:Ae(i)}}function xe(e,t){let n=De(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Se(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ce(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function we(e){let t=Ce(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Te(e,t,n,r=!1){let i;typeof e==`string`?i=O(e):(i={...e},S(!i.pathname||!i.pathname.includes(`?`),Se(`?`,`pathname`,`search`,i)),S(!i.pathname||!i.pathname.includes(`#`),Se(`#`,`pathname`,`hash`,i)),S(!i.search||!i.search.includes(`#`),Se(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=be(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Ee=e=>e.replace(/[\\/]{2,}/g,`/`),W=e=>Ee(e.join(`/`));function De(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var Oe=e=>De(e).replace(/^\/*/,`/`),ke=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Ae=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,je=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Me=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Ne(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function G(e){return W(e.map(e=>e.route.path).filter(Boolean))||`/`}var K=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Pe(e,t){let n=e;if(typeof n!=`string`||!g.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(K)try{let e=new URL(window.location.href),r=_.test(n)?new URL(v(n,e.protocol)):new URL(n),a=U(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{C(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var Fe=Symbol(`Uninstrumented`);function Ie(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){let t=Object.keys(n);for(let r of t)e[r]&&n[r].push(e[r])}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=Re(n.lazy,t.lazy,()=>void 0);e&&(r.lazy=e)}if(typeof t.lazy==`object`){let e=t.lazy;[`middleware`,`loader`,`action`].forEach(t=>{let i=e[t],a=n[`lazy.${t}`];if(typeof i==`function`&&a.length>0){let e=Re(a,i,()=>void 0);e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return[`loader`,`action`].forEach(e=>{let i=t[e];if(typeof i==`function`&&n[e].length>0){let t=i[Fe]??i,a=Re(n[e],t,(...e)=>q(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[Fe]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[Fe]??e,r=Re(n.middleware,t,(...e)=>q(e[0]));return r?(r[Fe]=t,r):e})),r}function Le(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){let t=Object.keys(e);for(let r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){let t=e.navigate[Fe]??e.navigate,r=Re(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?D(n):`.`,...Be(e,r??{})}});r&&(r[Fe]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[Fe]??e.fetch,r=Re(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...Be(e,i??{})}});r&&(r[Fe]=t,e.fetch=r)}return e}function Re(e,t,n){return e.length===0?null:async(...r)=>{let i=await ze(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function ze(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error(`You cannot call instrumented handlers more than once`):o=ze(e,t,n,r-1),a=await o,S(a,`Expected a result`),a.type===`error`&&a.value instanceof Error?{status:`error`,error:a.value}:{status:`success`,error:void 0});try{await i(s,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}o||await s(),await o}else try{a={type:`success`,value:await n()}}catch(e){a={type:`error`,value:e}}return a||{type:`error`,value:Error(`No result assigned in instrumentation chain.`)}}function q(e){let{request:t,context:n,params:r,pattern:i}=e;return{request:Ve(t),params:{...r},pattern:i,context:He(n)}}function Be(e,t){return{currentUrl:D(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function Ve(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function He(e){if(We(e)){let t={...e};return Object.freeze(t),t}return{get:t=>e.get(t)}}var Ue=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function We(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===Ue}var Ge=new URL(`http://localhost`);function Ke(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Ge)}catch{return Ge}}function qe(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Je(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function Ye(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!qe(i,n),s=!qe(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Je(e,i)||!qe(i,a)))throw Error(`External navigation is not allowed`)}var Xe=[`POST`,`PUT`,`PATCH`,`DELETE`],Ze=new Set(Xe),Qe=[`GET`,...Xe],$e=new Set(Qe),et=new Set([301,302,303,307,308]),tt=new Set([307,308]),nt={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},rt={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},it={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},at=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),ot=`remix-router-transitions`,st=Symbol(`ResetLoaderData`),ct,lt,ut,dt,ft=class{constructor(e){m(this,ct),m(this,lt),m(this,ut),m(this,dt),h(this,ct,e),h(this,lt,L(e))}get stableRoutes(){return p(this,ct)}get activeRoutes(){return p(this,ut)??p(this,ct)}get branches(){return p(this,dt)??p(this,lt)}get hasHMRRoutes(){return p(this,ut)!=null}setRoutes(e){h(this,ct,e),h(this,lt,L(e))}setHmrRoutes(e){h(this,ut,e),h(this,dt,L(e))}commitHmrRoutes(){p(this,ut)&&(h(this,ct,p(this,ut)),h(this,lt,p(this,dt)),h(this,ut,void 0),h(this,dt,void 0))}};ct=new WeakMap,lt=new WeakMap,ut=new WeakMap,dt=new WeakMap;function pt(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;S(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||at,a=i;if(e.instrumentations){let t=e.instrumentations;a=e=>({...i(e),...Ie(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new ft(ne(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||At,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=null,v=e.hydrationData!=null,y=I(s.activeRoutes,e.history.location,c,!1,s.branches),b=!1,x=null,w,T;if(y==null&&!e.patchRoutesOnNavigation){let t=J(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=en(s.activeRoutes);w=!0,T=!w,y=n,x={[r.id]:t}}else if(y&&!e.hydrationData&&$e(y,s.activeRoutes,e.history.location.pathname).active&&(y=null),!y){w=!1,T=!w,y=[];let t=$e(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(b=!0,y=t.matches)}else if(y.some(e=>e.route.lazy))w=!1,T=!w;else if(!y.some(e=>vt(e.route)))w=!0,T=!w;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=y;if(n){let e=y.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}T=!1,w=!0,r.forEach(e=>{let r=yt(e.route,t,n);T||=r.renderFallback,w&&=!r.shouldLoad})}let k,j={historyAction:e.history.action,location:e.history.location,matches:y,initialized:w,renderFallback:T,navigation:nt,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||x,fetchers:new Map,blockers:new Map},M=`POP`,N=null,te=!1,P,F=!1,re=new Map,ie=null,L=!1,oe=!1,se=new Set,R=new Map,ce=0,le=-1,ue=new Map,z=new Set,de=new Map,fe=new Map,B=new Set,V=new Map,pe,me=null;function he(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(pe){pe(),pe=void 0;return}C(V.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Ke({currentLocation:j.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{pe=e});e.history.go(r*-1),Ge(i,{state:`blocked`,location:n,proceed(){Ge(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(j.blockers);e.set(i,it),H({blockers:e})}}),N?.resolve(),N=null;return}return Se(t,n)}),n){Cn(t,re);let e=()=>wn(t,re);t.addEventListener(`pagehide`,e),ie=()=>t.removeEventListener(`pagehide`,e)}return j.initialized||Se(`POP`,j.location,{initialHydration:!0}),k}function ge(){d&&d(),ie&&ie(),f.clear(),P&&P.abort(),j.fetchers.forEach((e,t)=>Re(j.fetchers,t)),j.blockers.forEach((e,t)=>We(t))}function _e(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(j,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function H(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),j={...j,...e};let n=[],r=[];j.fetchers.forEach((e,t)=>{e.state===`idle`&&(B.has(t)?n.push(t):r.push(t))}),B.forEach(e=>{!j.fetchers.has(e)&&!R.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(j,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Re(j.fetchers,e)),r.forEach(e=>j.fetchers.delete(e))}function ve(t,n,{flushSync:r}={}){let i=j.actionData!=null&&j.navigation.formMethod!=null&&X(j.navigation.formMethod)&&j.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?j.actionData:null;let o=n.loaderData?Zt(j.loaderData,n.loaderData,n.matches||[],n.errors):j.loaderData,c=j.blockers;c.size>0&&(c=new Map(c),c.forEach((e,t)=>c.set(t,it)));let l=!L&&Qe(t,n.matches||j.matches),u=te===!0||j.navigation.formMethod!=null&&X(j.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),L||M===`POP`||(M===`PUSH`?e.history.push(t,t.state):M===`REPLACE`&&e.history.replace(t,t.state));let d;if(M===`POP`){let e=re.get(j.location.pathname);e&&e.has(t.pathname)?d={currentLocation:j.location,nextLocation:t}:re.has(t.pathname)&&(d={currentLocation:t,nextLocation:j.location})}else if(F){let e=re.get(j.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),re.set(j.location.pathname,e)),d={currentLocation:j.location,nextLocation:t}}H({...n,actionData:a,loaderData:o,historyAction:M,location:t,initialized:!0,renderFallback:!1,navigation:nt,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),M=`POP`,te=!1,F=!1,L=!1,oe=!1,N?.resolve(),N=null,me?.resolve(),me=null}async function be(t,n){if(N?.resolve(),N=null,typeof t==`number`){N||=Tn();let n=N.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=gt(!1,ht(j.location,j.matches,c,t,n?.fromRouteId,n?.relative),n),o;if(n?.mask){let t=typeof n.mask==`string`?O(n.mask):{...j.location.mask,...n.mask};if(o={pathname:t.pathname??``,search:t.search??``,hash:t.hash??``},_.test(o.pathname))throw Error(`External navigation is not allowed`);o.pathname.startsWith(`\\`)&&(o.pathname=o.pathname.replace(/^\\+/,`/`)),Ye(typeof n.mask==`string`?n.mask:D(n.mask),D(o),e.history.createURL(`/`),`reject`)}let s=j.location,l=E(s,r,n&&n.state,void 0,o);l={...l,...e.history.encodeLocation(l)},Ye(t==null?e.history.createHref(j.location):typeof t==`string`?t:D(t),e.history.createHref(l.mask||l),e.history.createURL(`/`),`reject`);let u=n&&n.replace!=null?n.replace:void 0,d=`PUSH`;u===!0?d=`REPLACE`:u===!1||i!=null&&X(i.formMethod)&&i.formAction===j.location.pathname+j.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=Ke({currentLocation:s,nextLocation:l,historyAction:d});if(m){Ge(m,{state:`blocked`,location:l,proceed(){Ge(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:l}),be(t,n)},reset(){let e=new Map(j.blockers);e.set(m,it),H({blockers:e})}});return}await Se(d,l,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate})}function xe(){me||=Tn(),Me(),H({revalidation:`loading`});let e=me.promise;return j.navigation.state===`submitting`?e:j.navigation.state===`idle`?(Se(j.historyAction,j.location,{startUninterruptedRevalidation:!0}),e):(Se(M||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation,enableViewTransition:F===!0}),e)}async function Se(t,n,r){P&&P.abort(),P=null,M=t,L=(r&&r.startUninterruptedRevalidation)===!0,Ze(j.location,j.matches),te=(r&&r.preventScrollReset)===!0,F=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&j.matches&&j.matches.length>0&&!b?j.matches:I(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&j.initialized&&!oe&&rn(j.location,n)&&!(r&&r.submission&&X(r.submission.formMethod))){ve(n,{matches:a},{flushSync:o});return}let l=$e(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),!a){let{error:e,notFoundMatches:t,route:r}=qe(n.pathname);ve(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;P=new AbortController;let d=Gt(e.history,n,P.signal,r&&r.submission),f=e.getContext?await e.getContext():new ee,p;if(r&&r.pendingError)p=[$t(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&X(r.submission.formMethod)){let i=await Ce(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(Y(t)&&Ne(t.error)&&t.error.status===404){P=null,ve(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=vn(n,a,t,r.submission),o=!1,l.active=!1,d=Gt(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await we(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(P=null,ve(n,{matches:h||a,...Qt(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function Ce(t,n,i,l,u,d,f,p,m={}){if(Me(),H({navigation:yn(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await et(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=en(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=$t(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=qe(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=gn(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:J(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await Ae(t,n,It(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(ln(h)){let n;return n=m&&m.replace!=null?m.replace:Wt(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===j.location.pathname+j.location.search,await ke(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(Y(h)){let e=$t(l,g.route.id);return(m&&m.replace)!==!0&&(M=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function we(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||vn(n,i,l,p),x=p||m||_n(b),S=!L&&!g;if(d){if(S){let e=Te(v);H({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await et(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=en(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=$t(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=qe(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:w,revalidatingFetchers:T}=_t(t,u,a,o,e.history,j,i,x,n,g?[]:r,g===!0,oe,se,B,de,z,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(le=++ce,!e.dataStrategy&&!w.some(e=>e.shouldLoad)&&!w.some(e=>e.route.middleware&&e.route.middleware.length>0)&&T.length===0){let e=new Map(j.fetchers),t=Ve(e);return ve(n,{matches:i,loaderData:{},errors:v&&Y(v[1])?{[v[0]]:v[1].error}:null,...Qt(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=Te(v);t!==void 0&&(e.actionData=t)}T.length>0&&(e.fetchers=Ee(T)),H(e,{flushSync:_})}T.forEach(e=>{q(e.key),e.controller&&R.set(e.key,e.controller)});let E=()=>T.forEach(e=>q(e.key));P&&P.signal.addEventListener(`abort`,E);let{loaderResults:D,fetcherResults:O}=await je(w,T,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};P&&P.signal.removeEventListener(`abort`,E),T.forEach(e=>R.delete(e.key));let k=tn(D);if(k)return await ke(t,k.result,!0,{replace:h}),{shortCircuited:!0};if(k=tn(O),k)return z.add(k.key),await ke(t,k.result,!0,{replace:h}),{shortCircuited:!0};let A=new Map(j.fetchers),{loaderData:ee,errors:M}=Xt(j,i,D,v,T,O,A);g&&j.errors&&(M={...j.errors,...M});let N=Ve(A),te=He(le,A),F=N||te||T.length>0;return{matches:i,loaderData:ee,errors:M,...F?{workingFetchers:A}:{}}}function Te(e){if(e&&!Y(e[1]))return{[e[0]]:e[1].data};if(j.actionData)return Object.keys(j.actionData).length===0?null:j.actionData}function Ee(e){let t=new Map(j.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=bn(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function W(t,n,r,i){q(t);let a=(i&&i.flushSync)===!0,o=s.activeRoutes,l=ht(j.location,j.matches,c,r,n,i?.relative),u=I(o,l,c,!1,s.branches),d=$e(u,o,l);if(d.active&&d.matches&&(u=d.matches),!u){K(t,n,J(404,{pathname:l}),{flushSync:a});return}let{path:f,submission:p,error:m}=gt(!0,l,i);if(m){K(t,n,m,{flushSync:a});return}let h=e.getContext?await e.getContext():new ee,g=(i&&i.preventScrollReset)===!0;if(p&&X(p.formMethod)){await De(t,n,f,u,h,d.active,a,g,p,i&&i.defaultShouldRevalidate);return}de.set(t,{routeId:n,path:f}),await Oe(t,n,f,u,h,d.active,a,g,p)}async function De(t,n,i,l,u,d,f,p,m,h){Me(),de.delete(t),G(t,xn(m,j.fetchers.get(t)),{flushSync:f});let g=new AbortController,_=Gt(e.history,i,g.signal,m);if(d){let e=await et(l,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){K(t,n,e.error,{flushSync:f});return}if(e.matches)l=e.matches;else{K(t,n,J(404,{pathname:i}),{flushSync:f});return}}let v=gn(l,i);if(!v.route.action&&!v.route.lazy){K(t,n,J(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}R.set(t,g);let y=ce,b=It(a,o,_,i,l,v,r,u),x=await Ae(_,i,b,u,t),C=x[v.route.id];if(!C){for(let e of b)if(x[e.route.id]){C=x[e.route.id];break}}if(_.signal.aborted){R.get(t)===g&&R.delete(t);return}if(B.has(t)){if(ln(C)||Y(C)){G(t,Sn(void 0));return}}else{if(ln(C)){if(R.delete(t),le>y){G(t,Sn(void 0));return}return z.add(t),G(t,bn(m)),ke(_,C,!1,{fetcherSubmission:m,preventScrollReset:p})}if(Y(C)){K(t,n,C.error);return}}let w=j.navigation.location||j.location,T=Gt(e.history,w,g.signal),E=s.activeRoutes,D=j.navigation.state===`idle`?j.matches:I(E,j.navigation.location,c,!1,s.branches);S(D,`Didn't find any matches after fetcher action`);let O=++ce;ue.set(t,O);let{dsMatches:k,revalidatingFetchers:A}=_t(T,u,a,o,e.history,j,D,m,w,r,!1,oe,se,B,de,z,E,c,e.patchRoutesOnNavigation!=null,s.branches,[v.route.id,C],h),ee=bn(m,C.data),N=new Map(j.fetchers);N.set(t,ee),A.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=N.get(t),r=bn(void 0,n?n.data:void 0);N.set(t,r),q(t),e.controller&&R.set(t,e.controller)}),H({fetchers:N});let te=()=>A.forEach(e=>q(e.key));g.signal.addEventListener(`abort`,te);let{loaderResults:F,fetcherResults:ne}=await je(k,A,T,w,u);if(g.signal.aborted)return;g.signal.removeEventListener(`abort`,te),ue.delete(t),R.delete(t),A.forEach(e=>R.delete(e.key));let re=j.fetchers.has(t),ie=e=>{if(!re)return e;let n=new Map(e.fetchers);return n.set(t,Sn(C.data)),{...e,fetchers:n}},ae=tn(F);if(ae)return j=ie(j),ke(T,ae.result,!1,{preventScrollReset:p});if(ae=tn(ne),ae)return z.add(ae.key),j=ie(j),ke(T,ae.result,!1,{preventScrollReset:p});let L=new Map(j.fetchers);re&&L.set(t,Sn(C.data));let{loaderData:fe,errors:V}=Xt(j,D,F,void 0,A,ne,L);He(O,L),j.navigation.state===`loading`&&O>le?(S(M,`Expected pending action`),P&&P.abort(),ve(j.navigation.location,{matches:D,loaderData:fe,errors:V,fetchers:L})):(H({errors:V,loaderData:Zt(j.loaderData,fe,D,V),fetchers:L}),oe=!1)}async function Oe(t,n,i,s,c,l,u,d,f){let p=j.fetchers.get(t);G(t,bn(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=Gt(e.history,i,m.signal);if(l){let e=await et(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){K(t,n,e.error,{flushSync:u});return}if(e.matches)s=e.matches;else{K(t,n,J(404,{pathname:i}),{flushSync:u});return}}let g=gn(s,i);R.set(t,m);let _=ce,v=await Ae(h,i,It(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(R.get(t)===m&&R.delete(t),!h.signal.aborted){if(B.has(t)){G(t,Sn(void 0));return}if(ln(y)){if(le>_){G(t,Sn(void 0));return}z.add(t),await ke(h,y,!1,{preventScrollReset:d});return}if(Y(y)){K(t,n,y.error);return}G(t,Sn(y.data))}}async function ke(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(N?.resolve(),N=null),i.response.headers.has(`X-Remix-Revalidate`)&&(oe=!0);let d=i.response.headers.get(`Location`);S(d,`Expected a Location header on the redirect Response`);let f=d,p=new URL(r.url);d=Wt(d,p,c,e.history),Ye(f,d,p,`allow-explicit`);let m=E(j.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(ye(d)){let n=A(t,d,!0);e=n.origin!==t.location.origin||U(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}P=null;let h=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:g,formAction:_,formEncType:v}=j.navigation;!o&&!s&&g&&_&&v&&(o=_n(j.navigation));let y=o||s;tt.has(i.response.status)&&y&&X(y.formMethod)?await Se(h,m,{submission:{...y,formAction:d},preventScrollReset:l||te,enableViewTransition:a?F:void 0}):await Se(h,m,{overrideNavigation:vn(m,[],h,o),fetcherSubmission:s,preventScrollReset:l||te,enableViewTransition:a?F:void 0})}async function Ae(e,t,n,r,i){let a,o={};try{a=await Lt(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!X(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!j.loaderData.hasOwnProperty(e.route.id)&&(!j.errors||!j.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(cn(r)){let i=r.result;o[t]={type:`redirect`,response:Vt(i,e,t,n,c)}}else o[t]=await Bt(r);return o}async function je(e,t,n,r,i){let a=Ae(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Ae(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:`error`,error:J(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Me(){oe=!0,de.forEach((e,t)=>{R.has(t)&&se.add(t),q(t)})}function G(e,t,n={}){let r=new Map(j.fetchers);r.set(e,t),H({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function K(e,t,n,r={}){let i=$t(j.matches,t),a=new Map(j.fetchers);Re(a,e),H({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function Pe(e){return fe.set(e,(fe.get(e)||0)+1),B.has(e)&&B.delete(e),j.fetchers.get(e)||rt}function Fe(e,t){q(e,t?.reason),G(e,Sn(null))}function Re(e,t){let n=j.fetchers.get(t);R.has(t)&&!(n&&n.state===`loading`&&ue.has(t))&&q(t),de.delete(t),ue.delete(t),z.delete(t),B.delete(t),se.delete(t),e.delete(t)}function ze(e){let t=(fe.get(e)||0)-1;t<=0?(fe.delete(e),B.add(e)):fe.set(e,t),H({fetchers:new Map(j.fetchers)})}function q(e,t){let n=R.get(e);n&&(n.abort(t),R.delete(e))}function Be(e,t){for(let n of e){let e=t.get(n);S(e,`Expected fetcher: ${n}`);let r=Sn(e.data);t.set(n,r)}}function Ve(e){let t=[],n=!1;for(let r of z){let i=e.get(r);S(i,`Expected fetcher: ${r}`),i.state===`loading`&&(z.delete(r),t.push(r),n=!0)}return Be(t,e),n}function He(e,t){let n=[];for(let[r,i]of ue)if(i<e){let e=t.get(r);S(e,`Expected fetcher: ${r}`),e.state===`loading`&&(q(r),ue.delete(r),n.push(r))}return Be(n,t),n.length>0}function Ue(e,t){let n=j.blockers.get(e)||it;return V.get(e)!==t&&V.set(e,t),n}function We(e){j.blockers.delete(e),V.delete(e)}function Ge(e,t){let n=j.blockers.get(e)||it;S(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(j.blockers);r.set(e,t),H({blockers:r})}function Ke({currentLocation:e,nextLocation:t,historyAction:n}){if(V.size===0)return;V.size>1&&C(!1,`A router only supports one blocker at a time`);let r=Array.from(V.entries()),[i,a]=r[r.length-1],o=j.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function qe(e){let t=J(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=en(n);return{notFoundMatches:r,route:i,error:t}}function Je(e,t,n){if(m=e,g=t,h=n||null,!v&&j.navigation===nt){v=!0;let e=Qe(j.location,j.matches);e!=null&&H({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Xe(e,t){return h&&h(e,t.map(e=>ae(e,j.loaderData)))||e.key}function Ze(e,t){if(m&&g){let n=Xe(e,t);m[n]=g()}}function Qe(e,t){if(m){let n=Xe(e,t),r=m[n];if(typeof r==`number`)return r}return null}function $e(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:I(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:I(n,r,c,!0,e)}}return{active:!1,matches:null}}async function et(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||Ct(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=I(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=I(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&ot(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=I(s.activeRoutes,n,c,!0,u),!f||ot(l,f))return{type:`success`,matches:null};l=f}}function ot(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function st(e){o={},s.setHmrRoutes(ne(e,a,void 0,o))}function ct(e,t,n=!1){Ct(e,t,s,o,a,n),s.hasHMRRoutes||H({})}return k={get basename(){return c},get future(){return u},get state(){return j},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:he,subscribe:_e,enableScrollRestoration:Je,navigate:be,fetch:W,revalidate:xe,createHref:t=>e.history.createHref(t),createURL:t=>e.history.createURL(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Pe,resetFetcher:Fe,deleteFetcher:ze,dispose:ge,getBlocker:Ue,deleteBlocker:We,patchRoutes:ct,_internalFetchControllers:R,_internalSetRoutes:st,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){H(e)}},e.instrumentations&&(k=Le(k,e.instrumentations.map(e=>e.router).filter(Boolean))),k}function mt(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function ht(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=Te(r||`.`,we(o),U(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=hn(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=ve({basename:n,pathname:c.pathname})),D(c)}function gt(e,t,n){if(!n||!mt(n))return{path:t};if(n.formMethod&&!mn(n.formMethod))return{path:t,error:J(405,{method:n.formMethod})};let r=()=>({path:t,error:J(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=nn(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!X(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
|
|
2
|
+
`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if(n.formEncType===`application/json`){if(!X(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}S(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=qt(n.formData),s=n.formData;else if(n.body instanceof FormData)o=qt(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=Jt(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=Jt(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(X(c.formMethod))return{path:t,submission:c};let l=O(t);return e&&l.search&&hn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:D(l),submission:c}}function _t(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?Y(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&Y(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=G(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!vt(s))f=!1;else if(u){let{shouldLoad:e}=yt(s,a.loaderData,a.errors);f=e}else bt(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return Ft(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?xt(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p},h=St(i,m);return Ft(n,r,e,c,k,i,l,t,h,m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=I(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=gn(b,e.path),C=new AbortController,w=Gt(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=It(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=It(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:!D&&d;let a={...O,defaultShouldRevalidate:i};St(S,a)&&(T=It(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function vt(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function yt(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!vt(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function bt(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function xt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function St(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function Ct(e,t,n,r,i,a){let o;if(e){let t=r[e];S(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>wt(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=ne(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=ne([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function wt(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index!==t.index||e.path!==t.path||e.caseSensitive!==t.caseSensitive?!1:(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>wt(e,t)))??!1}var Tt=new WeakMap,Et=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(S(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=Tt.get(i);o||(o={},Tt.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=N(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)C(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)C(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},Dt=new WeakMap;function Ot(e,t,n,r,i){let a=n[e.id];if(S(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=Dt.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{S(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=P(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?C(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?C(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return Dt.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=Et({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function kt(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function At(e){return e.matches.some(e=>e.route.middleware)?jt(e,()=>kt(e)):kt(e)}function jt(e,t){return Mt(e,t,e=>{if(pn(e))throw e;return e},on,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=$t(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function Mt(e,t,n,r,i){let{matches:a,...o}=e;return await Nt(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function Nt(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await Nt(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function Pt(e,t,n,r,i){let a=Et({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=Ot(r.route,X(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Ft(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Pt(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?St(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?St(a,{...l,defaultShouldRevalidate:e}):St(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!X(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(X(n.method)||!p)?Rt({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function It(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?Ft(e,t,n,r,G(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Pt(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function Lt(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:Kt(t,n),pattern:G(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return jt(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function Rt({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=X(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:Kt(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a){if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw J(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}}else if(t)c=await f(t);else{let t=new URL(e.url);throw J(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function zt(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function Bt(e){let{result:t,type:n}=e;if(dn(t)){let e;try{e=await zt(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new Me(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?un(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:an(t),statusCode:Ne(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:Ne(t)?t.status:void 0}:un(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function Vt(e,t,n,r,i){let a=e.headers.get(`Location`);if(S(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!ye(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=ht(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var Ht=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Ut(e){try{return Ht.includes(new URL(e).protocol)}catch{return!1}}function Wt(e,t,n,r){if(ye(e)){let r=e,i=_.test(r)?new URL(v(r,t.protocol)):new URL(r);if(Ut(i.toString()))throw Error(`Invalid redirect location`);let a=U(i.pathname,n)!=null;if(i.origin===t.origin&&a)return Ee(i.pathname)+i.search+i.hash}try{if(Ut(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function Gt(e,t,n,r){let i=e.createURL(nn(t)).toString(),a={signal:n};if(r&&X(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):a.body=t===`text/plain`?r.text:t===`application/x-www-form-urlencoded`&&r.formData?qt(r.formData):r.formData}return new Request(i,a)}function Kt(e,t){let n=new URL(e.url),r=typeof t==`string`?O(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);n.search=e.size?`?${e.toString()}`:``}else n.search=``;return n.hash=r.hash||``,n}function qt(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function Jt(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Yt(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&Y(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(S(!ln(f),`Cannot handle redirect results in processLoaderData`),Y(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=$t(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=st),c||(c=!0,s=Ne(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function Xt(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=Yt(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(S(s,`Did not find corresponding fetcher result`),Y(s)){let t=$t(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(ln(s))S(!1,`Unhandled fetcher revalidation redirect`);else{let e=Sn(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function Zt(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==st).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function Qt(e){return e?Y(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function $t(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function en(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function J(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new Me(e||500,o,Error(s),!0)}function tn(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(ln(r))return{key:n,result:r}}}function nn(e){return D({...typeof e==`string`?O(e):e,hash:``})}function rn(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash||t.hash!==``}function an(e){return new Me(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function on(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&sn(t))}function sn(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function cn(e){return dn(e.result)&&et.has(e.result.status)}function Y(e){return e.type===`error`}function ln(e){return(e&&e.type)===`redirect`}function un(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function dn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function fn(e){return et.has(e)}function pn(e){return dn(e)&&fn(e.status)&&e.headers.has(`Location`)}function mn(e){return $e.has(e.toUpperCase())}function X(e){return Ze.has(e.toUpperCase())}function hn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function gn(e,t){let n=typeof t==`string`?O(t).search:t.search;if(e[e.length-1].route.index&&hn(n||``))return e[e.length-1];let r=Ce(e);return r[r.length-1]}function _n(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(t&&n&&r){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function vn(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function yn(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function bn(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function xn(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Sn(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Cn(e,t){try{let n=e.sessionStorage.getItem(ot);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function wn(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(ot,JSON.stringify(n))}catch(e){C(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function Tn(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var En=o.createContext(null);En.displayName=`DataRouter`;var Dn=o.createContext(null);Dn.displayName=`DataRouterState`;var On=o.createContext(!1);function kn(){return o.useContext(On)}var An=o.createContext({isTransitioning:!1});An.displayName=`ViewTransition`;var jn=o.createContext(new Map);jn.displayName=`Fetchers`;var Mn=o.createContext(null);Mn.displayName=`Await`;var Z=o.createContext(null);Z.displayName=`Navigation`;var Nn=o.createContext(null);Nn.displayName=`Location`;var Q=o.createContext({outlet:null,matches:[],isDataRoute:!1});Q.displayName=`Route`;var Pn=o.createContext(null);Pn.displayName=`RouteError`;var Fn=`REACT_ROUTER_ERROR`,In=`REDIRECT`,Ln=`ROUTE_ERROR_RESPONSE`;function Rn(e){if(e.startsWith(`${Fn}:${In}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function zn(e){if(e.startsWith(`${Fn}:${Ln}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Me(t.status,t.statusText,t.data)}catch{}}function Bn(e,{relative:t}={}){S(Vn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=o.useContext(Z),{hash:i,pathname:a,search:s}=Yn(e,{relative:t}),c=a;return n!==`/`&&(c=a===`/`?n:W([n,a])),r.createHref({pathname:c,search:s,hash:i})}function Vn(){return o.useContext(Nn)!=null}function $(){return S(Vn(),`useLocation() may be used only in the context of a <Router> component.`),o.useContext(Nn).location}var Hn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Un(e){o.useContext(Z).static||o.useLayoutEffect(e)}function Wn(){let{isDataRoute:e}=o.useContext(Q);return e?pr():Gn()}function Gn(){S(Vn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=o.useContext(En),{basename:t,navigator:n}=o.useContext(Z),{matches:r}=o.useContext(Q),{pathname:i}=$(),a=JSON.stringify(we(r)),s=o.useRef(!1);return Un(()=>{s.current=!0}),o.useCallback((r,o={})=>{if(C(s.current,Hn),!s.current)return;if(typeof r==`number`){n.go(r);return}let c=Te(r,JSON.parse(a),i,o.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:W([t,c.pathname])),Ye(typeof r==`string`?r:D(r),n.createHref(c),Ke(n),`reject`),(o.replace?n.replace:n.push)(c,o.state,o)},[t,n,a,i,e])}var Kn=o.createContext(null);function qn(e){let t=o.useContext(Q).outlet;return o.useMemo(()=>t&&o.createElement(Kn.Provider,{value:e},t),[t,e])}function Jn(){let{matches:e}=o.useContext(Q);return e[e.length-1]?.params??{}}function Yn(e,{relative:t}={}){let{matches:n}=o.useContext(Q),{pathname:r}=$(),i=JSON.stringify(we(n));return o.useMemo(()=>Te(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Xn(e,t,n){S(Vn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=o.useContext(Z),{matches:i}=o.useContext(Q),a=i[i.length-1],s=a?a.params:{},c=a?a.pathname:`/`,l=a?a.pathnameBase:`/`,u=a&&a.route;{let e=u&&u.path||``;hr(c,!u||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
3
|
+
|
|
4
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let d=$(),f;if(t){let e=typeof t==`string`?O(t):t;S(l===`/`||e.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=d;let p=f.pathname||`/`,m=p;if(l!==`/`){let e=l.replace(/^\//,``).split(`/`);m=`/`+p.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let h=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):ie(e,{pathname:m});C(u||h!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),C(h==null||h[h.length-1].route.element!==void 0||h[h.length-1].route.Component!==void 0||h[h.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=rr(h&&h.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:W([l,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?l:W([l,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&g?o.createElement(Nn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},g):g}function Zn(){let e=ur(),t=Ne(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=o.createElement(o.Fragment,null,o.createElement(`p`,null,`💿 Hey developer 👋`),o.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,o.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,o.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),o.createElement(o.Fragment,null,o.createElement(`h2`,null,`Unexpected Application Error!`),o.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?o.createElement(`pre`,{style:i},n):null,s)}var Qn=o.createElement(Zn,null),$n=class 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||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=zn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:o.createElement(Q.Provider,{value:this.props.routeContext},o.createElement(Pn.Provider,{value:e,children:this.props.component}));return this.context?o.createElement(tr,{error:e},t):t}};$n.contextType=On;var er=new WeakMap;function tr({children:e,error:t}){let{basename:n,navigator:r}=o.useContext(Z);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Rn(t.digest);if(e){let i=er.get(t);if(i)throw i;let a=Pe(e.location,n),s=a.absoluteURL||a.to;if(Ye(e.location,s,Ke(r),`allow-explicit`),Ut(s))throw Error(`Invalid redirect location`);if(K&&!er.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=s;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw er.set(t,n),n}}return o.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${s}`})}}return e}function nr({routeContext:e,match:t,children:n}){let r=o.useContext(En);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),o.createElement(Q.Provider,{value:e},n)}function rr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);S(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,c=-1;if(n&&r){s=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:a}=r,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||o){n.isStatic&&(s=!0),i=c>=0?i.slice(0,c+1):[i[0]];break}}}}let l=n?.onError,u=r&&l?(e,t)=>{l(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:G(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,l)=>{let d,f=!1,p=null,m=null;r&&(d=a&&n.route.id?a[n.route.id]:void 0,p=n.route.errorElement||Qn,s&&(c<0&&l===0?(hr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===l&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(i.slice(0,l+1)),g=()=>{let t;return t=d?p:f?m:n.route.Component?o.createElement(n.route.Component,null):n.route.element?n.route.element:e,o.createElement(nr,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||l===0)?o.createElement($n,{location:r.location,revalidation:r.revalidation,component:p,error:d,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):g()},null)}function ir(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ar(e){let t=o.useContext(En);return S(t,ir(e)),t}function or(e){let t=o.useContext(Dn);return S(t,ir(e)),t}function sr(e){let t=o.useContext(Q);return S(t,ir(e)),t}function cr(e){let t=sr(e),n=t.matches[t.matches.length-1];return S(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function lr(){return cr(`useRouteId`)}function ur(){let e=o.useContext(Pn),t=or(`useRouteError`),n=cr(`useRouteError`);return e===void 0?t.errors?.[n]:e}var dr=0;function fr(e){let{router:t,basename:n}=ar(`useBlocker`),r=or(`useBlocker`),[i,a]=o.useState(``),s=o.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:U(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:U(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return o.useEffect(()=>{let e=String(++dr);return a(e),()=>t.deleteBlocker(e)},[t]),o.useEffect(()=>{i!==``&&t.getBlocker(i,s)},[t,i,s]),i&&r.blockers.has(i)?r.blockers.get(i):it}function pr(){let{router:e}=ar(`useNavigate`),t=cr(`useNavigate`),n=o.useRef(!1);return Un(()=>{n.current=!0}),o.useCallback(async(r,i={})=>{C(n.current,Hn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var mr={};function hr(e,t,n){!t&&!mr[e]&&(mr[e]=!0,C(!1,n))}var gr={};function _r(e,t){!e&&!gr[t]&&(gr[t]=!0,console.warn(t))}var vr=o.useOptimistic,yr=()=>void 0;function br(e){return vr?vr(e):[e,yr]}function xr(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&C(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:o.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&C(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:o.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&C(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:o.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Sr=[`HydrateFallback`,`hydrateFallbackElement`],Cr=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function wr({router:e,flushSync:t,onError:n,useTransitions:r}){r=kn()||r;let[i,a]=o.useState(e.state),[s,c]=br(i),[l,u]=o.useState(),[d,f]=o.useState({isTransitioning:!1}),[p,m]=o.useState(),[h,g]=o.useState(),[_,v]=o.useState(),y=o.useRef(new Map),b=o.useCallback((i,{deletedFetchers:s,newErrors:l,flushSync:d,viewTransitionOpts:_})=>{l&&n&&Object.values(l).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:G(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&y.current.set(t,e.data)}),s.forEach(e=>y.current.delete(e)),_r(d===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let b=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(_r(_==null||b,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!_||!b){t&&d?t(()=>a(i)):r===!1?a(i):o.startTransition(()=>{r===!0&&c(e=>Tr(e,i)),a(i)});return}if(t&&d){t(()=>{h&&(p?.resolve(),h.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:_.currentLocation,nextLocation:_.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})})}),t(()=>g(n));return}h?(p?.resolve(),h.skipTransition(),v({state:i,currentLocation:_.currentLocation,nextLocation:_.nextLocation})):(u(i),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}))},[e.window,t,h,p,r,c,n]);o.useLayoutEffect(()=>e.subscribe(b),[e,b]),o.useEffect(()=>{d.isTransitioning&&!d.flushSync&&m(new Cr)},[d]),o.useEffect(()=>{if(p&&l&&e.window){let t=l,n=p.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):o.startTransition(()=>{r===!0&&c(e=>Tr(e,t)),a(t)}),await n});i.finished.finally(()=>{m(void 0),g(void 0),u(void 0),f({isTransitioning:!1})}),g(i)}},[l,p,e.window,r,c]),o.useEffect(()=>{p&&l&&s.location.key===l.location.key&&p.resolve()},[p,h,s.location,l]),o.useEffect(()=>{!d.isTransitioning&&_&&(u(_.state),f({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}),v(void 0))},[d.isTransitioning,_]);let x=o.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),S=e.basename||`/`,C=o.useMemo(()=>({router:e,navigator:x,static:!1,basename:S,onError:n}),[e,x,S,n]);return o.createElement(o.Fragment,null,o.createElement(En.Provider,{value:C},o.createElement(Dn.Provider,{value:s},o.createElement(jn.Provider,{value:y.current},o.createElement(An.Provider,{value:d},o.createElement(kr,{basename:S,location:s.location,navigationType:s.historyAction,navigator:x,useTransitions:r},o.createElement(Er,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})))))),null)}function Tr(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var Er=o.memo(Dr);function Dr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Xn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Or(e){return qn(e.context)}function kr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:s}){S(!Vn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),l=o.useMemo(()=>({basename:c,navigator:i,static:a,useTransitions:s,future:{}}),[c,i,a,s]);typeof n==`string`&&(n=O(n));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`,mask:h}=n,g=o.useMemo(()=>{let e=U(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m,mask:h},navigationType:r}},[c,u,d,f,p,m,r,h]);return C(g!=null,`<Router basename="${c}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:o.createElement(Z.Provider,{value:l},o.createElement(Nn.Provider,{children:t,value:g}))}o.Component;var Ar=`get`,jr=`application/x-www-form-urlencoded`;function Mr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Nr(e){return Mr(e)&&e.tagName.toLowerCase()===`button`}function Pr(e){return Mr(e)&&e.tagName.toLowerCase()===`form`}function Fr(e){return Mr(e)&&e.tagName.toLowerCase()===`input`}function Ir(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Lr(e,t){return e.button===0&&(!t||t===`_self`)&&!Ir(e)}function Rr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function zr(e,t){let n=Rr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Br=null;function Vr(){if(Br===null)try{new FormData(document.createElement(`form`),0),Br=!1}catch{Br=!0}return Br}var Hr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ur(e){return e!=null&&!Hr.has(e)?(C(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${jr}"`),null):e}function Wr(e,t){let n,r,i,a,o;if(Pr(e)){let o=e.getAttribute(`action`);r=o?U(o,t):null,n=e.getAttribute(`method`)||Ar,i=Ur(e.getAttribute(`enctype`))||jr,a=new FormData(e)}else if(Nr(e)||Fr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?U(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Ar,i=Ur(e.getAttribute(`formenctype`))||Ur(o.getAttribute(`enctype`))||jr,a=new FormData(o,e),!Vr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Mr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Ar,r=null,i=jr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Gr(e,t){if(e===!1||e==null)throw Error(t)}function Kr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&U(i.pathname,t)===`/`?`${De(t)}/_root.${r}`:`${De(i.pathname)}.${r}`,i}async function qr(e,t){if(e.id in t)return t[e.id];try{let n=await u(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Jr(e){return e!=null&&typeof e.page==`string`}function Yr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Xr(e,t,n){return ti((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await qr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Yr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Zr(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Qr(e,t,{includeHydrateFallback:n}={}){return $r(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function $r(e){return[...new Set(e)]}function ei(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ti(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Jr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ei(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function ni(){let e=o.useContext(En);return Gr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function ri(){let e=o.useContext(Dn);return Gr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var ii=o.createContext(void 0);ii.displayName=`FrameworkContext`;function ai(){let e=o.useContext(ii);return Gr(e,`You must render this element inside a <HydratedRouter> element`),e}function oi(e,t){let n=o.useContext(ii),[r,i]=o.useState(!1),[a,s]=o.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=o.useRef(null);o.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),o.useEffect(()=>{if(r){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),s(!1)};return n?e===`intent`?[a,p,{onFocus:si(c,m),onBlur:si(l,h),onMouseEnter:si(u,m),onMouseLeave:si(d,h),onTouchStart:si(f,m)}]:[a,p,{}]:[!1,p,{}]}function si(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ci({page:e,...t}){let n=kn(),{nonce:r}=ai(),{router:i}=ni(),a=o.useMemo(()=>ie(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?o.createElement(ui,{page:e,matches:a,...t}):o.createElement(di,{page:e,matches:a,...t})):null}function li(e){let{manifest:t,routeModules:n}=ai(),[r,i]=o.useState([]);return o.useEffect(()=>{let r=!1;return Xr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function ui({page:e,matches:t,...n}){let r=$(),{future:i}=ai(),{basename:a}=ni(),s=o.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Kr(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return o.createElement(o.Fragment,null,s.map(e=>o.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function di({page:e,matches:t,...n}){let r=$(),{future:i,manifest:a,routeModules:s}=ai(),{basename:c}=ni(),{loaderData:l,matches:u}=ri(),d=o.useMemo(()=>Zr(e,t,u,a,r,`data`),[e,t,u,a,r]),f=o.useMemo(()=>Zr(e,t,u,a,r,`assets`),[e,t,u,a,r]),p=o.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,o=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?o=!0:n.add(e.route.id))}),n.size===0)return[];let u=Kr(e,c,i.v8_trailingSlashAwareDataRequests,`data`);return o&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,i.v8_trailingSlashAwareDataRequests,l,r,a,d,t,e,s]),m=o.useMemo(()=>Qr(f,a),[f,a]),h=li(f);return o.createElement(o.Fragment,null,p.map(e=>o.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>o.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>o.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function fi(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}o.Component;var pi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{pi&&(window.__reactRouterVersion=`7.18.3`)}catch{}function mi(e,t){return pt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:x({window:t?.window}),hydrationData:t?.hydrationData||hi(),routes:e,mapRouteProperties:xr,hydrationRouteProperties:Sr,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function hi(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:gi(e.errors)}),e}function gi(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new Me(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&je.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var _i=o.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:s,state:c,target:l,to:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h){let{basename:_,navigator:v,useTransitions:y}=o.useContext(Z),b=typeof u==`string`&&g.test(u),x=Pe(u,_);u=x.to;let S=Bn(u,{relative:r}),C=$(),w=null;if(s){let e=Te(s,[],C.mask?C.mask.pathname:`/`,!0);_!==`/`&&(e.pathname=e.pathname===`/`?_:W([_,e.pathname])),w=v.createHref(e)}let[T,E,D]=oi(n,m),O=Si(u,{replace:a,mask:s,state:c,target:l,preventScrollReset:d,relative:r,viewTransition:f,defaultShouldRevalidate:p,useTransitions:y});function k(t){e&&e(t),t.defaultPrevented||O(t)}let A=!(x.isExternal||i),j=o.createElement(`a`,{...m,...D,href:(A?w:void 0)||x.absoluteURL||S,onClick:A?k:e,ref:fi(h,E),target:l,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?o.createElement(o.Fragment,null,j,o.createElement(ci,{page:S})):j});_i.displayName=`Link`;var vi=o.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:s,children:c,...l},u){let d=Yn(a,{relative:l.relative}),f=$(),p=o.useContext(Dn),{navigator:m,basename:h}=o.useContext(Z),g=p!=null&&Oi(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=U(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return o.createElement(_i,{...l,"aria-current":w,className:T,ref:u,style:E,to:a,viewTransition:s},typeof c==`function`?c(C):c)});vi.displayName=`NavLink`;var yi=o.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:s=Ar,action:c,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:_}=o.useContext(Z),v=Ei(),y=Di(c,{relative:u}),b=s.toLowerCase()===`get`?`get`:`post`,x=typeof c==`string`&&g.test(c);return o.createElement(`form`,{ref:h,method:b,action:y,onSubmit:r?l:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,c=r?.getAttribute(`formmethod`)||s,m=()=>v(r||e.currentTarget,{fetcherKey:t,method:c,navigate:n,replace:i,state:a,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});_&&n!==!1?o.startTransition(()=>m()):m()},...m,"data-discover":!x&&e===`render`?`true`:void 0})});yi.displayName=`Form`;function bi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xi(e){let t=o.useContext(En);return S(t,bi(e)),t}function Si(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:s,viewTransition:c,defaultShouldRevalidate:l,useTransitions:u}={}){let d=Wn(),f=$(),p=Yn(e,{relative:s});return o.useCallback(m=>{if(Lr(m,t)){m.preventDefault();let t=n===void 0?D(f)===D(p):n,h=()=>d(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:s,viewTransition:c,defaultShouldRevalidate:l});u?o.startTransition(()=>h()):h()}},[f,d,p,n,r,i,t,e,a,s,c,l,u])}function Ci(e){C(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=o.useRef(Rr(e)),n=o.useRef(!1),r=$(),i=o.useMemo(()=>zr(r.search,n.current?null:t.current),[r.search]),a=Wn();return[i,o.useCallback((e,t)=>{let r=Rr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var wi=0,Ti=()=>`__${String(++wi)}__`;function Ei(){let{router:e}=xi(`useSubmit`),{basename:t}=o.useContext(Z),n=lr(),r=e.fetch,i=e.navigate;return o.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Wr(e,t);if(a.navigate===!1){let e=a.fetcherKey||Ti();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Di(e,{relative:t}={}){let{basename:n}=o.useContext(Z),r=o.useContext(Q);S(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Yn(e||`.`,{relative:t})},s=$();if(e==null){a.search=s.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:W([n,a.pathname])),D(a)}function Oi(e,{relative:t}={}){let n=o.useContext(An);S(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=xi(`useViewTransitionState`),i=Yn(e,{relative:t});if(!n.isTransitioning)return!1;let a=U(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=U(n.nextLocation.pathname,r)||n.nextLocation.pathname;return he(i.pathname,s)!=null||he(i.pathname,a)!=null}var ki=e(a(),1);function Ai(e){return o.createElement(wr,{flushSync:ki.flushSync,...e})}export{mi as a,Wn as c,a as d,r as f,Or as i,Jn as l,_i as n,fr as o,vi as r,$ as s,Ai as t,Ci as u};
|
|
5
|
+
//# sourceMappingURL=router-Dpg4KYTB.js.map
|