@eliseubatista99/react-scaffold-core 0.2.4 → 0.2.5
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/index.cjs.js +1 -1
- package/dist/index.es.js +11 -7
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -123,7 +123,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
123
123
|
* @license MIT
|
|
124
124
|
*/var Rr="popstate";function ga(e={}){function t(i,a){let{pathname:s,search:d,hash:l}=i.location;return Nt("",{pathname:s,search:d,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(i,a){return typeof a=="string"?a:Xe(a)}return ba(t,r,null,e)}function ae(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ve(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ya(){return Math.random().toString(36).substring(2,10)}function Tr(e,t){return{usr:e.state,key:e.key,idx:t}}function Nt(e,t,r=null,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?De(t):t,state:r,key:t&&t.key||i||ya()}}function Xe({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function De(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function ba(e,t,r,i={}){let{window:a=document.defaultView,v5Compat:s=!1}=i,d=a.history,l="POP",u=null,c=v();c==null&&(c=0,d.replaceState({...d.state,idx:c},""));function v(){return(d.state||{idx:null}).idx}function w(){l="POP";let I=v(),k=I==null?null:I-c;c=I,u&&u({action:l,location:p.location,delta:k})}function x(I,k){l="PUSH";let F=Nt(p.location,I,k);c=v()+1;let Y=Tr(F,c),V=p.createHref(F);try{d.pushState(Y,"",V)}catch(g){if(g instanceof DOMException&&g.name==="DataCloneError")throw g;a.location.assign(V)}s&&u&&u({action:l,location:p.location,delta:1})}function L(I,k){l="REPLACE";let F=Nt(p.location,I,k);c=v();let Y=Tr(F,c),V=p.createHref(F);d.replaceState(Y,"",V),s&&u&&u({action:l,location:p.location,delta:0})}function C(I){return wa(I)}let p={get action(){return l},get location(){return e(a,d)},listen(I){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Rr,w),u=I,()=>{a.removeEventListener(Rr,w),u=null}},createHref(I){return t(a,I)},createURL:C,encodeLocation(I){let k=C(I);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:x,replace:L,go(I){return d.go(I)}};return p}function wa(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),ae(r,"No window.location.(origin|href) available to create URL");let i=typeof e=="string"?e:Xe(e);return i=i.replace(/ $/,"%20"),!t&&i.startsWith("//")&&(i=r+i),new URL(i,r)}function tn(e,t,r="/"){return Sa(e,t,r,!1)}function Sa(e,t,r,i){let a=typeof t=="string"?De(t):t,s=xe(a.pathname||"/",r);if(s==null)return null;let d=rn(e);xa(d);let l=null;for(let u=0;l==null&&u<d.length;++u){let c=Da(s);l=ja(d[u],c,i)}return l}function rn(e,t=[],r=[],i=""){let a=(s,d,l)=>{let u={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:d,route:s};u.relativePath.startsWith("/")&&(ae(u.relativePath.startsWith(i),`Absolute route path "${u.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(i.length));let c=Se([i,u.relativePath]),v=r.concat(u);s.children&&s.children.length>0&&(ae(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${c}".`),rn(s.children,t,v,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:Ta(c,s.index),routesMeta:v})};return e.forEach((s,d)=>{if(s.path===""||!s.path?.includes("?"))a(s,d);else for(let l of nn(s.path))a(s,d,l)}),t}function nn(e){let t=e.split("/");if(t.length===0)return[];let[r,...i]=t,a=r.endsWith("?"),s=r.replace(/\?$/,"");if(i.length===0)return a?[s,""]:[s];let d=nn(i.join("/")),l=[];return l.push(...d.map(u=>u===""?s:[s,u].join("/"))),a&&l.push(...d),l.map(u=>e.startsWith("/")&&u===""?"/":u)}function xa(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:_a(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var Oa=/^:[\w-]+$/,ka=3,Ca=2,Pa=1,Ea=10,Ra=-2,_r=e=>e==="*";function Ta(e,t){let r=e.split("/"),i=r.length;return r.some(_r)&&(i+=Ra),t&&(i+=Ca),r.filter(a=>!_r(a)).reduce((a,s)=>a+(Oa.test(s)?ka:s===""?Pa:Ea),i)}function _a(e,t){return e.length===t.length&&e.slice(0,-1).every((i,a)=>i===t[a])?e[e.length-1]-t[t.length-1]:0}function ja(e,t,r=!1){let{routesMeta:i}=e,a={},s="/",d=[];for(let l=0;l<i.length;++l){let u=i[l],c=l===i.length-1,v=s==="/"?t:t.slice(s.length)||"/",w=gt({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},v),x=u.route;if(!w&&c&&r&&!i[i.length-1].route.index&&(w=gt({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},v)),!w)return null;Object.assign(a,w.params),d.push({params:a,pathname:Se([s,w.pathname]),pathnameBase:Aa(Se([s,w.pathnameBase])),route:x}),w.pathnameBase!=="/"&&(s=Se([s,w.pathnameBase]))}return d}function gt(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=La(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let s=a[0],d=s.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:i.reduce((c,{paramName:v,isOptional:w},x)=>{if(v==="*"){let C=l[x]||"";d=s.slice(0,s.length-C.length).replace(/(.)\/+$/,"$1")}const L=l[x];return w&&!L?c[v]=void 0:c[v]=(L||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:d,pattern:e}}function La(e,t=!1,r=!0){ve(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 i=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,l,u)=>(i.push({paramName:l,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(i.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),i]}function Da(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ve(!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 xe(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}function Ma(e,t="/"){let{pathname:r,search:i="",hash:a=""}=typeof e=="string"?De(e):e;return{pathname:r?r.startsWith("/")?r:$a(r,t):t,search:Ha(i),hash:za(a)}}function $a(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Mt(e,t,r,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ia(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function an(e){let t=Ia(e);return t.map((r,i)=>i===t.length-1?r.pathname:r.pathnameBase)}function on(e,t,r,i=!1){let a;typeof e=="string"?a=De(e):(a={...e},ae(!a.pathname||!a.pathname.includes("?"),Mt("?","pathname","search",a)),ae(!a.pathname||!a.pathname.includes("#"),Mt("#","pathname","hash",a)),ae(!a.search||!a.search.includes("#"),Mt("#","search","hash",a)));let s=e===""||a.pathname==="",d=s?"/":a.pathname,l;if(d==null)l=r;else{let w=t.length-1;if(!i&&d.startsWith("..")){let x=d.split("/");for(;x[0]==="..";)x.shift(),w-=1;a.pathname=x.join("/")}l=w>=0?t[w]:"/"}let u=Ma(a,l),c=d&&d!=="/"&&d.endsWith("/"),v=(s||d===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(c||v)&&(u.pathname+="/"),u}var Se=e=>e.join("/").replace(/\/\/+/g,"/"),Aa=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ha=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,za=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Na(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var sn=["POST","PUT","PATCH","DELETE"];new Set(sn);var Fa=["GET",...sn];new Set(Fa);var Me=M.createContext(null);Me.displayName="DataRouter";var Ot=M.createContext(null);Ot.displayName="DataRouterState";var ln=M.createContext({isTransitioning:!1});ln.displayName="ViewTransition";var Wa=M.createContext(new Map);Wa.displayName="Fetchers";var Ua=M.createContext(null);Ua.displayName="Await";var we=M.createContext(null);we.displayName="Navigation";var Je=M.createContext(null);Je.displayName="Location";var Oe=M.createContext({outlet:null,matches:[],isDataRoute:!1});Oe.displayName="Route";var qt=M.createContext(null);qt.displayName="RouteError";function Ya(e,{relative:t}={}){ae(Ze(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=M.useContext(we),{hash:a,pathname:s,search:d}=Qe(e,{relative:t}),l=s;return r!=="/"&&(l=s==="/"?r:Se([r,s])),i.createHref({pathname:l,search:d,hash:a})}function Ze(){return M.useContext(Je)!=null}function ke(){return ae(Ze(),"useLocation() may be used only in the context of a <Router> component."),M.useContext(Je).location}var un="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function cn(e){M.useContext(we).static||M.useLayoutEffect(e)}function Xt(){let{isDataRoute:e}=M.useContext(Oe);return e?no():Ba()}function Ba(){ae(Ze(),"useNavigate() may be used only in the context of a <Router> component.");let e=M.useContext(Me),{basename:t,navigator:r}=M.useContext(we),{matches:i}=M.useContext(Oe),{pathname:a}=ke(),s=JSON.stringify(an(i)),d=M.useRef(!1);return cn(()=>{d.current=!0}),M.useCallback((u,c={})=>{if(ve(d.current,un),!d.current)return;if(typeof u=="number"){r.go(u);return}let v=on(u,JSON.parse(s),a,c.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:Se([t,v.pathname])),(c.replace?r.replace:r.push)(v,c.state,c)},[t,r,s,a,e])}M.createContext(null);function Qe(e,{relative:t}={}){let{matches:r}=M.useContext(Oe),{pathname:i}=ke(),a=JSON.stringify(an(r));return M.useMemo(()=>on(e,JSON.parse(a),i,t==="path"),[e,a,i,t])}function Va(e,t){return fn(e,t)}function fn(e,t,r,i){ae(Ze(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=M.useContext(we),{matches:s}=M.useContext(Oe),d=s[s.length-1],l=d?d.params:{},u=d?d.pathname:"/",c=d?d.pathnameBase:"/",v=d&&d.route;{let k=v&&v.path||"";dn(u,!v||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) 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.
|
|
125
125
|
|
|
126
|
-
Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let w=ke(),x;if(t){let k=typeof t=="string"?De(t):t;ae(c==="/"||k.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${k.pathname}" was given in the \`location\` prop.`),x=k}else x=w;let L=x.pathname||"/",C=L;if(c!=="/"){let k=c.replace(/^\//,"").split("/");C="/"+L.replace(/^\//,"").split("/").slice(k.length).join("/")}let p=tn(e,{pathname:C});ve(v||p!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),ve(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.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 I=Ja(p&&p.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Se([c,a.encodeLocation?a.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?c:Se([c,a.encodeLocation?a.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),s,r,i);return t&&I?M.createElement(Je.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...x},navigationType:"POP"}},I):I}function qa(){let e=ro(),t=Na(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:i},s={padding:"2px 4px",backgroundColor:i},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=M.createElement(M.Fragment,null,M.createElement("p",null,"💿 Hey developer 👋"),M.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",M.createElement("code",{style:s},"ErrorBoundary")," or"," ",M.createElement("code",{style:s},"errorElement")," prop on your route.")),M.createElement(M.Fragment,null,M.createElement("h2",null,"Unexpected Application Error!"),M.createElement("h3",{style:{fontStyle:"italic"}},t),r?M.createElement("pre",{style:a},r):null,d)}var Xa=M.createElement(qa,null),Ga=class extends M.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?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?M.createElement(Oe.Provider,{value:this.props.routeContext},M.createElement(qt.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Ka({routeContext:e,match:t,children:r}){let i=M.useContext(Me);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),M.createElement(Oe.Provider,{value:e},r)}function Ja(e,t=[],r=null,i=null){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 a=e,s=r?.errors;if(s!=null){let u=a.findIndex(c=>c.route.id&&s?.[c.route.id]!==void 0);ae(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let d=!1,l=-1;if(r)for(let u=0;u<a.length;u++){let c=a[u];if((c.route.HydrateFallback||c.route.hydrateFallbackElement)&&(l=u),c.route.id){let{loaderData:v,errors:w}=r,x=c.route.loader&&!v.hasOwnProperty(c.route.id)&&(!w||w[c.route.id]===void 0);if(c.route.lazy||x){d=!0,l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}return a.reduceRight((u,c,v)=>{let w,x=!1,L=null,C=null;r&&(w=s&&c.route.id?s[c.route.id]:void 0,L=c.route.errorElement||Xa,d&&(l<0&&v===0?(dn("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,C=null):l===v&&(x=!0,C=c.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,v+1)),I=()=>{let k;return w?k=L:x?k=C:c.route.Component?k=M.createElement(c.route.Component,null):c.route.element?k=c.route.element:k=u,M.createElement(Ka,{match:c,routeContext:{outlet:u,matches:p,isDataRoute:r!=null},children:k})};return r&&(c.route.ErrorBoundary||c.route.errorElement||v===0)?M.createElement(Ga,{location:r.location,revalidation:r.revalidation,component:L,error:w,children:I(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):I()},null)}function Gt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Za(e){let t=M.useContext(Me);return ae(t,Gt(e)),t}function Qa(e){let t=M.useContext(Ot);return ae(t,Gt(e)),t}function eo(e){let t=M.useContext(Oe);return ae(t,Gt(e)),t}function Kt(e){let t=eo(e),r=t.matches[t.matches.length-1];return ae(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function to(){return Kt("useRouteId")}function ro(){let e=M.useContext(qt),t=Qa("useRouteError"),r=Kt("useRouteError");return e!==void 0?e:t.errors?.[r]}function no(){let{router:e}=Za("useNavigate"),t=Kt("useNavigate"),r=M.useRef(!1);return cn(()=>{r.current=!0}),M.useCallback(async(a,s={})=>{ve(r.current,un),r.current&&(typeof a=="number"?e.navigate(a):await e.navigate(a,{fromRouteId:t,...s}))},[e,t])}var jr={};function dn(e,t,r){!t&&!jr[e]&&(jr[e]=!0,ve(!1,r))}M.memo(io);function io({routes:e,future:t,state:r}){return fn(e,void 0,r,t)}function hn(e){ae(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function ao({basename:e="/",children:t=null,location:r,navigationType:i="POP",navigator:a,static:s=!1}){ae(!Ze(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),l=M.useMemo(()=>({basename:d,navigator:a,static:s,future:{}}),[d,a,s]);typeof r=="string"&&(r=De(r));let{pathname:u="/",search:c="",hash:v="",state:w=null,key:x="default"}=r,L=M.useMemo(()=>{let C=xe(u,d);return C==null?null:{location:{pathname:C,search:c,hash:v,state:w,key:x},navigationType:i}},[d,u,c,v,w,x,i]);return ve(L!=null,`<Router basename="${d}"> is not able to match the URL "${u}${c}${v}" because it does not start with the basename, so the <Router> won't render anything.`),L==null?null:M.createElement(we.Provider,{value:l},M.createElement(Je.Provider,{children:t,value:L}))}function oo({children:e,location:t}){return Va(Ft(e),t)}function Ft(e,t=[]){let r=[];return M.Children.forEach(e,(i,a)=>{if(!M.isValidElement(i))return;let s=[...t,a];if(i.type===M.Fragment){r.push.apply(r,Ft(i.props.children,s));return}ae(i.type===hn,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ae(!i.props.index||!i.props.children,"An index route cannot have child routes.");let d={id:i.props.id||s.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(d.children=Ft(i.props.children,s)),r.push(d)}),r}var ut="get",ct="application/x-www-form-urlencoded";function kt(e){return e!=null&&typeof e.tagName=="string"}function so(e){return kt(e)&&e.tagName.toLowerCase()==="button"}function lo(e){return kt(e)&&e.tagName.toLowerCase()==="form"}function uo(e){return kt(e)&&e.tagName.toLowerCase()==="input"}function co(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fo(e,t){return e.button===0&&(!t||t==="_self")&&!co(e)}function Wt(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let i=e[r];return t.concat(Array.isArray(i)?i.map(a=>[r,a]):[[r,i]])},[]))}function ho(e,t){let r=Wt(e);return t&&t.forEach((i,a)=>{r.has(a)||t.getAll(a).forEach(s=>{r.append(a,s)})}),r}var at=null;function po(){if(at===null)try{new FormData(document.createElement("form"),0),at=!1}catch{at=!0}return at}var mo=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function $t(e){return e!=null&&!mo.has(e)?(ve(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ct}"`),null):e}function vo(e,t){let r,i,a,s,d;if(lo(e)){let l=e.getAttribute("action");i=l?xe(l,t):null,r=e.getAttribute("method")||ut,a=$t(e.getAttribute("enctype"))||ct,s=new FormData(e)}else if(so(e)||uo(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||l.getAttribute("action");if(i=u?xe(u,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||ut,a=$t(e.getAttribute("formenctype"))||$t(l.getAttribute("enctype"))||ct,s=new FormData(l,e),!po()){let{name:c,type:v,value:w}=e;if(v==="image"){let x=c?`${c}.`:"";s.append(`${x}x`,"0"),s.append(`${x}y`,"0")}else c&&s.append(c,w)}}else{if(kt(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ut,i=null,a=ct,d=e}return s&&a==="text/plain"&&(d=s,s=void 0),{action:i,method:r.toLowerCase(),encType:a,formData:s,body:d}}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function go(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function yo(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 bo(e,t,r){let i=await Promise.all(e.map(async a=>{let s=t.routes[a.route.id];if(s){let d=await go(s,r);return d.links?d.links():[]}return[]}));return Oo(i.flat(1).filter(yo).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Lr(e,t,r,i,a,s){let d=(u,c)=>r[c]?u.route.id!==r[c].route.id:!0,l=(u,c)=>r[c].pathname!==u.pathname||r[c].route.path?.endsWith("*")&&r[c].params["*"]!==u.params["*"];return s==="assets"?t.filter((u,c)=>d(u,c)||l(u,c)):s==="data"?t.filter((u,c)=>{let v=i.routes[u.route.id];if(!v||!v.hasLoader)return!1;if(d(u,c)||l(u,c))return!0;if(u.route.shouldRevalidate){let w=u.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function wo(e,t,{includeHydrateFallback:r}={}){return So(e.map(i=>{let a=t.routes[i.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),r&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function So(e){return[...new Set(e)]}function xo(e){let t={},r=Object.keys(e).sort();for(let i of r)t[i]=e[i];return t}function Oo(e,t){let r=new Set;return new Set(t),e.reduce((i,a)=>{let s=JSON.stringify(xo(a));return r.has(s)||(r.add(s),i.push({key:s,link:a})),i},[])}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ko=new Set([100,101,204,205]);function Co(e,t){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname="_root.data":t&&xe(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.data`:r.pathname=`${r.pathname.replace(/\/$/,"")}.data`,r}function pn(){let e=M.useContext(Me);return Jt(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Po(){let e=M.useContext(Ot);return Jt(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Zt=M.createContext(void 0);Zt.displayName="FrameworkContext";function mn(){let e=M.useContext(Zt);return Jt(e,"You must render this element inside a <HydratedRouter> element"),e}function Eo(e,t){let r=M.useContext(Zt),[i,a]=M.useState(!1),[s,d]=M.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:v,onTouchStart:w}=t,x=M.useRef(null);M.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let p=k=>{k.forEach(F=>{d(F.isIntersecting)})},I=new IntersectionObserver(p,{threshold:.5});return x.current&&I.observe(x.current),()=>{I.disconnect()}}},[e]),M.useEffect(()=>{if(i){let p=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(p)}}},[i]);let L=()=>{a(!0)},C=()=>{a(!1),d(!1)};return r?e!=="intent"?[s,x,{}]:[s,x,{onFocus:Ye(l,L),onBlur:Ye(u,C),onMouseEnter:Ye(c,L),onMouseLeave:Ye(v,C),onTouchStart:Ye(w,L)}]:[!1,x,{}]}function Ye(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Ro({page:e,...t}){let{router:r}=pn(),i=M.useMemo(()=>tn(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?M.createElement(_o,{page:e,matches:i,...t}):null}function To(e){let{manifest:t,routeModules:r}=mn(),[i,a]=M.useState([]);return M.useEffect(()=>{let s=!1;return bo(e,t,r).then(d=>{s||a(d)}),()=>{s=!0}},[e,t,r]),i}function _o({page:e,matches:t,...r}){let i=ke(),{manifest:a,routeModules:s}=mn(),{basename:d}=pn(),{loaderData:l,matches:u}=Po(),c=M.useMemo(()=>Lr(e,t,u,a,i,"data"),[e,t,u,a,i]),v=M.useMemo(()=>Lr(e,t,u,a,i,"assets"),[e,t,u,a,i]),w=M.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let C=new Set,p=!1;if(t.forEach(k=>{let F=a.routes[k.route.id];!F||!F.hasLoader||(!c.some(Y=>Y.route.id===k.route.id)&&k.route.id in l&&s[k.route.id]?.shouldRevalidate||F.hasClientLoader?p=!0:C.add(k.route.id))}),C.size===0)return[];let I=Co(e,d);return p&&C.size>0&&I.searchParams.set("_routes",t.filter(k=>C.has(k.route.id)).map(k=>k.route.id).join(",")),[I.pathname+I.search]},[d,l,i,a,c,t,e,s]),x=M.useMemo(()=>wo(v,a),[v,a]),L=To(v);return M.createElement(M.Fragment,null,w.map(C=>M.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),x.map(C=>M.createElement("link",{key:C,rel:"modulepreload",href:C,...r})),L.map(({key:C,link:p})=>M.createElement("link",{key:C,...p})))}function jo(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var vn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{vn&&(window.__reactRouterVersion="7.6.3")}catch{}function Lo({basename:e,children:t,window:r}){let i=M.useRef();i.current==null&&(i.current=ga({window:r,v5Compat:!0}));let a=i.current,[s,d]=M.useState({action:a.action,location:a.location}),l=M.useCallback(u=>{M.startTransition(()=>d(u))},[d]);return M.useLayoutEffect(()=>a.listen(l),[a,l]),M.createElement(ao,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a})}var gn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yn=M.forwardRef(function({onClick:t,discover:r="render",prefetch:i="none",relative:a,reloadDocument:s,replace:d,state:l,target:u,to:c,preventScrollReset:v,viewTransition:w,...x},L){let{basename:C}=M.useContext(we),p=typeof c=="string"&&gn.test(c),I,k=!1;if(typeof c=="string"&&p&&(I=c,vn))try{let y=new URL(window.location.href),h=c.startsWith("//")?new URL(y.protocol+c):new URL(c),P=xe(h.pathname,C);h.origin===y.origin&&P!=null?c=P+h.search+h.hash:k=!0}catch{ve(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let F=Ya(c,{relative:a}),[Y,V,g]=Eo(i,x),b=Io(c,{replace:d,state:l,target:u,preventScrollReset:v,relative:a,viewTransition:w});function S(y){t&&t(y),y.defaultPrevented||b(y)}let R=M.createElement("a",{...x,...g,href:I||F,onClick:k||s?t:S,ref:jo(L,V),target:u,"data-discover":!p&&r==="render"?"true":void 0});return Y&&!p?M.createElement(M.Fragment,null,R,M.createElement(Ro,{page:F})):R});yn.displayName="Link";var Do=M.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:i="",end:a=!1,style:s,to:d,viewTransition:l,children:u,...c},v){let w=Qe(d,{relative:c.relative}),x=ke(),L=M.useContext(Ot),{navigator:C,basename:p}=M.useContext(we),I=L!=null&&Wo(w)&&l===!0,k=C.encodeLocation?C.encodeLocation(w).pathname:w.pathname,F=x.pathname,Y=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(F=F.toLowerCase(),Y=Y?Y.toLowerCase():null,k=k.toLowerCase()),Y&&p&&(Y=xe(Y,p)||Y);const V=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let g=F===k||!a&&F.startsWith(k)&&F.charAt(V)==="/",b=Y!=null&&(Y===k||!a&&Y.startsWith(k)&&Y.charAt(k.length)==="/"),S={isActive:g,isPending:b,isTransitioning:I},R=g?t:void 0,y;typeof i=="function"?y=i(S):y=[i,g?"active":null,b?"pending":null,I?"transitioning":null].filter(Boolean).join(" ");let h=typeof s=="function"?s(S):s;return M.createElement(yn,{...c,"aria-current":R,className:y,ref:v,style:h,to:d,viewTransition:l},typeof u=="function"?u(S):u)});Do.displayName="NavLink";var Mo=M.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:a,state:s,method:d=ut,action:l,onSubmit:u,relative:c,preventScrollReset:v,viewTransition:w,...x},L)=>{let C=No(),p=Fo(l,{relative:c}),I=d.toLowerCase()==="get"?"get":"post",k=typeof l=="string"&&gn.test(l),F=Y=>{if(u&&u(Y),Y.defaultPrevented)return;Y.preventDefault();let V=Y.nativeEvent.submitter,g=V?.getAttribute("formmethod")||d;C(V||Y.currentTarget,{fetcherKey:t,method:g,navigate:r,replace:a,state:s,relative:c,preventScrollReset:v,viewTransition:w})};return M.createElement("form",{ref:L,method:I,action:p,onSubmit:i?u:F,...x,"data-discover":!k&&e==="render"?"true":void 0})});Mo.displayName="Form";function $o(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bn(e){let t=M.useContext(Me);return ae(t,$o(e)),t}function Io(e,{target:t,replace:r,state:i,preventScrollReset:a,relative:s,viewTransition:d}={}){let l=Xt(),u=ke(),c=Qe(e,{relative:s});return M.useCallback(v=>{if(fo(v,t)){v.preventDefault();let w=r!==void 0?r:Xe(u)===Xe(c);l(e,{replace:w,state:i,preventScrollReset:a,relative:s,viewTransition:d})}},[u,l,c,r,i,t,e,a,s,d])}function Ao(e){ve(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=M.useRef(Wt(e)),r=M.useRef(!1),i=ke(),a=M.useMemo(()=>ho(i.search,r.current?null:t.current),[i.search]),s=Xt(),d=M.useCallback((l,u)=>{const c=Wt(typeof l=="function"?l(a):l);r.current=!0,s("?"+c,u)},[s,a]);return[a,d]}var Ho=0,zo=()=>`__${String(++Ho)}__`;function No(){let{router:e}=bn("useSubmit"),{basename:t}=M.useContext(we),r=to();return M.useCallback(async(i,a={})=>{let{action:s,method:d,encType:l,formData:u,body:c}=vo(i,t);if(a.navigate===!1){let v=a.fetcherKey||zo();await e.fetch(v,r,a.action||s,{preventScrollReset:a.preventScrollReset,formData:u,body:c,formMethod:a.method||d,formEncType:a.encType||l,flushSync:a.flushSync})}else await e.navigate(a.action||s,{preventScrollReset:a.preventScrollReset,formData:u,body:c,formMethod:a.method||d,formEncType:a.encType||l,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,r])}function Fo(e,{relative:t}={}){let{basename:r}=M.useContext(we),i=M.useContext(Oe);ae(i,"useFormAction must be used inside a RouteContext");let[a]=i.matches.slice(-1),s={...Qe(e||".",{relative:t})},d=ke();if(e==null){s.search=d.search;let l=new URLSearchParams(s.search),u=l.getAll("index");if(u.some(v=>v==="")){l.delete("index"),u.filter(w=>w).forEach(w=>l.append("index",w));let v=l.toString();s.search=v?`?${v}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(s.pathname=s.pathname==="/"?r:Se([r,s.pathname])),Xe(s)}function Wo(e,t={}){let r=M.useContext(ln);ae(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=bn("useViewTransitionState"),a=Qe(e,{relative:t.relative});if(!r.isTransitioning)return!1;let s=xe(r.currentLocation.pathname,i)||r.currentLocation.pathname,d=xe(r.nextLocation.pathname,i)||r.nextLocation.pathname;return gt(a.pathname,d)!=null||gt(a.pathname,s)!=null}[...ko];const wn=U.createContext({history:[],addToHistory:()=>{},popFromHistory:()=>"",replaceHistory:()=>{}}),Uo=()=>{const[e,t]=Ao(),r=U.useMemo(()=>Object.fromEntries(e.entries()),[e]),i=U.useCallback(c=>{const v={};return c.forEach(w=>{v[w]=e.get(w)}),v},[e]),a=U.useCallback(c=>{const v=e.get(c);return v==null||v==null,v},[e]),s=U.useCallback((c,v)=>{const w=new URLSearchParams(e);w.set(c,String(v)),t(w)},[e,t]),d=U.useCallback(c=>{const v=new URLSearchParams(e);Object.entries(c).forEach(([w,x])=>{x!=null&&v.set(w,String(x))}),t(v)},[e,t]),l=U.useCallback(c=>{const v=new URLSearchParams(e);v.delete(c),t(v)},[e,t]),u=U.useCallback(c=>{const v=new URLSearchParams(e);c.forEach(w=>{v.delete(String(w))}),t(v)},[e,t]);return{getAll:()=>r,get:a,getMany:i,set:s,setMany:d,remove:l,removeMany:u}},Yo=()=>{const e=Xt(),t=ke(),r=Uo(),i=U.useContext(wn),a=l=>{const u=new URL(l.path,"http://dummy-base");return l.params&&Object.entries(l.params).forEach(([c,v])=>{v!=null&&u.searchParams.set(c,String(v))}),u.pathname+u.search},s=U.useCallback(l=>{const u=a(l);l.addToHistory!==!1?(e(u),i.addToHistory(u)):(e(u,{replace:!0}),i.popFromHistory(1),i.addToHistory(u))},[e]),d=U.useCallback(l=>{const u=l||1;e(-u),i.popFromHistory(u)},[e]);return{currentPath:t.pathname,history:i.history,searchParams:r,goBack:d,goTo:s}},Bo=({isReady:e=!0,routes:t,children:r})=>{const i=U.useRef([]),[a,s]=U.useState([]),d=U.useCallback(w=>{i.current=w,s(w)},[]),l=(w,x=!1)=>{let L=[...i.current];x&&(L=L.slice(0,L.length-1)),L=[...L,w],d(L)},u=w=>{let x="",L=[];return i.current.length===0?"/":(i.current.length<=w?(x=i.current[0],L=[x]):(L=i.current.slice(0,i.current.length-w),x=L[L.length-1]),d(L),x)},c=w=>{d(w)},v=t.map(w=>X.jsx(hn,{path:w.path,element:w.render}));return X.jsx(wn.Provider,{value:{history:a,addToHistory:l,popFromHistory:u,replaceHistory:c},children:X.jsx(Lo,{children:e&&X.jsxs(X.Fragment,{children:[r,X.jsx(oo,{children:v})]})})})},Sn=U.createContext({visibleItems:[],isItemVisible:()=>!1,showItem:()=>{},hideItem:()=>{}}),Vo=({children:e})=>{const t=U.useRef([]),[r,i]=U.useState([]),a=U.useCallback(u=>{t.current=u,i(u)},[]),s=U.useCallback(u=>t.current.some(c=>c===u),[]),d=U.useCallback(u=>{s(u)||a([...t.current,u])},[s,a]),l=U.useCallback(u=>{s(u)&&a(t.current.filter(v=>v!==u))},[s,a]);return X.jsx(Sn.Provider,{value:{visibleItems:r,isItemVisible:s,showItem:d,hideItem:l},children:e})},et=()=>{const e=U.useContext(Sn),t=a=>e.visibleItems.some(s=>s===a),r=a=>{e.showItem(a)},i=a=>{e.hideItem(a)};return{visibleItems:e.visibleItems,isItemVisible:t,showItem:r,hideItem:i}},qo=({id:e,onCloseDrawer:t,drawerCloseOffset:r=15})=>{const{isItemVisible:i}=et(),[a,s]=U.useState({isDragging:!1}),d=U.useRef(null),l=U.useRef(null),u=U.useRef(null),[c,v]=U.useState(0),w=C=>{s(C)},x=C=>{s(C),v(0)};return Qr({ref:u,onDrag:C=>{s(C);const p=l.current?.clientHeight||0;C.distanceY&&(v(C.distanceY<0?0:-C.distanceY),C.distanceY>=p-r&&(t?.(),x(C)))},onDragEnd:x,onDragStart:w}),{isVisible:i(e),drawerParentRef:d,drawerRef:l,drawerBottomDistance:c,handleRef:u}},Xo=e=>{const{children:t,backgroundStyles:r,contentStyles:i,handle:a}=e,{isVisible:s,drawerParentRef:d,drawerRef:l,handleRef:u,drawerBottomDistance:c}=qo(e);return X.jsx(X.Fragment,{children:s&&X.jsx("div",{ref:d,style:{width:"100%",height:"100%",minHeight:"100vh",left:0,top:0,background:"#00000068",position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column",touchAction:"none",...r},children:X.jsxs("div",{ref:l,style:{width:"100%",height:"fit-content",minHeight:"80px",maxHeight:"90%",background:"#ffffff",borderTopLeftRadius:"16px",borderTopRightRadius:"16px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px",zIndex:1001,position:"absolute",bottom:`${c}px`,...i},onClick:v=>{v.stopPropagation()},children:[X.jsx("div",{ref:u,style:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0px",height:"24px",width:"100%",cursor:"pointer",...a?.styles},children:a?.render}),t]})})})},Go=({onPreSubmit:e,onSubmit:t,configurations:r})=>{const i=U.useRef(null),a=U.useRef(!1),s=c=>{const v=Array.from(c.currentTarget.elements).filter(x=>!!x.getAttribute("name")),w=[];for(const x of v){const L=x.name;w.push({name:L,value:x.value})}return w},d=async c=>{try{const x=(r||[]).find(L=>L.name===c.name);if(!x)return c;var v=c.value,w=c.value;if(x.emptyValidation&&x.emptyValidation.allow===!1&&!v)return c.error=x.emptyValidation.errorMessage,c;if(x.minLengthValidation&&v.length<x.minLengthValidation.value)return c.error=x.minLengthValidation.errorMessage,c;if(x.maxLengthValidation&&v.length>x.maxLengthValidation.value)return c.error=x.maxLengthValidation.errorMessage,c;if(!isNaN(w)){if(x.minValueValidation&&w<x.minValueValidation.value)return c.error=x.minValueValidation.errorMessage,c;if(x.maxValueValidation&&w>x.maxValueValidation.value)return c.error=x.maxValueValidation.errorMessage,c}if(x.exactValueValidation&&x.exactValueValidation.value!==c.value)return c.error=x.exactValueValidation.errorMessage,c;for(let L=0;L<(x.validations||[]).length;L++){const C=await x.validations?.[L](c.value);if(C)return c.error=C,c}}catch(x){console.error(`Form > Failed To Validate Field ${c.name}: `,x)}return c},l=U.useCallback(async c=>{if(a.current)return;a.current=!0,e?.(),c.preventDefault(),c.stopPropagation();let v=s(c);v=await Promise.all(v.map(async w=>await d(w))),a.current=!1,t?.(v)},[t,e]);return{ref:i,submitForm:c=>{i.current&&i.current.requestSubmit()},handleFormSubmission:l}},Ko=Pe.div`
|
|
126
|
+
Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let w=ke(),x;if(t){let k=typeof t=="string"?De(t):t;ae(c==="/"||k.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${k.pathname}" was given in the \`location\` prop.`),x=k}else x=w;let L=x.pathname||"/",C=L;if(c!=="/"){let k=c.replace(/^\//,"").split("/");C="/"+L.replace(/^\//,"").split("/").slice(k.length).join("/")}let p=tn(e,{pathname:C});ve(v||p!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),ve(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.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 I=Ja(p&&p.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Se([c,a.encodeLocation?a.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?c:Se([c,a.encodeLocation?a.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),s,r,i);return t&&I?M.createElement(Je.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...x},navigationType:"POP"}},I):I}function qa(){let e=ro(),t=Na(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:i},s={padding:"2px 4px",backgroundColor:i},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=M.createElement(M.Fragment,null,M.createElement("p",null,"💿 Hey developer 👋"),M.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",M.createElement("code",{style:s},"ErrorBoundary")," or"," ",M.createElement("code",{style:s},"errorElement")," prop on your route.")),M.createElement(M.Fragment,null,M.createElement("h2",null,"Unexpected Application Error!"),M.createElement("h3",{style:{fontStyle:"italic"}},t),r?M.createElement("pre",{style:a},r):null,d)}var Xa=M.createElement(qa,null),Ga=class extends M.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?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?M.createElement(Oe.Provider,{value:this.props.routeContext},M.createElement(qt.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Ka({routeContext:e,match:t,children:r}){let i=M.useContext(Me);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),M.createElement(Oe.Provider,{value:e},r)}function Ja(e,t=[],r=null,i=null){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 a=e,s=r?.errors;if(s!=null){let u=a.findIndex(c=>c.route.id&&s?.[c.route.id]!==void 0);ae(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let d=!1,l=-1;if(r)for(let u=0;u<a.length;u++){let c=a[u];if((c.route.HydrateFallback||c.route.hydrateFallbackElement)&&(l=u),c.route.id){let{loaderData:v,errors:w}=r,x=c.route.loader&&!v.hasOwnProperty(c.route.id)&&(!w||w[c.route.id]===void 0);if(c.route.lazy||x){d=!0,l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}return a.reduceRight((u,c,v)=>{let w,x=!1,L=null,C=null;r&&(w=s&&c.route.id?s[c.route.id]:void 0,L=c.route.errorElement||Xa,d&&(l<0&&v===0?(dn("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,C=null):l===v&&(x=!0,C=c.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,v+1)),I=()=>{let k;return w?k=L:x?k=C:c.route.Component?k=M.createElement(c.route.Component,null):c.route.element?k=c.route.element:k=u,M.createElement(Ka,{match:c,routeContext:{outlet:u,matches:p,isDataRoute:r!=null},children:k})};return r&&(c.route.ErrorBoundary||c.route.errorElement||v===0)?M.createElement(Ga,{location:r.location,revalidation:r.revalidation,component:L,error:w,children:I(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):I()},null)}function Gt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Za(e){let t=M.useContext(Me);return ae(t,Gt(e)),t}function Qa(e){let t=M.useContext(Ot);return ae(t,Gt(e)),t}function eo(e){let t=M.useContext(Oe);return ae(t,Gt(e)),t}function Kt(e){let t=eo(e),r=t.matches[t.matches.length-1];return ae(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function to(){return Kt("useRouteId")}function ro(){let e=M.useContext(qt),t=Qa("useRouteError"),r=Kt("useRouteError");return e!==void 0?e:t.errors?.[r]}function no(){let{router:e}=Za("useNavigate"),t=Kt("useNavigate"),r=M.useRef(!1);return cn(()=>{r.current=!0}),M.useCallback(async(a,s={})=>{ve(r.current,un),r.current&&(typeof a=="number"?e.navigate(a):await e.navigate(a,{fromRouteId:t,...s}))},[e,t])}var jr={};function dn(e,t,r){!t&&!jr[e]&&(jr[e]=!0,ve(!1,r))}M.memo(io);function io({routes:e,future:t,state:r}){return fn(e,void 0,r,t)}function hn(e){ae(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function ao({basename:e="/",children:t=null,location:r,navigationType:i="POP",navigator:a,static:s=!1}){ae(!Ze(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),l=M.useMemo(()=>({basename:d,navigator:a,static:s,future:{}}),[d,a,s]);typeof r=="string"&&(r=De(r));let{pathname:u="/",search:c="",hash:v="",state:w=null,key:x="default"}=r,L=M.useMemo(()=>{let C=xe(u,d);return C==null?null:{location:{pathname:C,search:c,hash:v,state:w,key:x},navigationType:i}},[d,u,c,v,w,x,i]);return ve(L!=null,`<Router basename="${d}"> is not able to match the URL "${u}${c}${v}" because it does not start with the basename, so the <Router> won't render anything.`),L==null?null:M.createElement(we.Provider,{value:l},M.createElement(Je.Provider,{children:t,value:L}))}function oo({children:e,location:t}){return Va(Ft(e),t)}function Ft(e,t=[]){let r=[];return M.Children.forEach(e,(i,a)=>{if(!M.isValidElement(i))return;let s=[...t,a];if(i.type===M.Fragment){r.push.apply(r,Ft(i.props.children,s));return}ae(i.type===hn,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ae(!i.props.index||!i.props.children,"An index route cannot have child routes.");let d={id:i.props.id||s.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(d.children=Ft(i.props.children,s)),r.push(d)}),r}var ut="get",ct="application/x-www-form-urlencoded";function kt(e){return e!=null&&typeof e.tagName=="string"}function so(e){return kt(e)&&e.tagName.toLowerCase()==="button"}function lo(e){return kt(e)&&e.tagName.toLowerCase()==="form"}function uo(e){return kt(e)&&e.tagName.toLowerCase()==="input"}function co(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fo(e,t){return e.button===0&&(!t||t==="_self")&&!co(e)}function Wt(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let i=e[r];return t.concat(Array.isArray(i)?i.map(a=>[r,a]):[[r,i]])},[]))}function ho(e,t){let r=Wt(e);return t&&t.forEach((i,a)=>{r.has(a)||t.getAll(a).forEach(s=>{r.append(a,s)})}),r}var at=null;function po(){if(at===null)try{new FormData(document.createElement("form"),0),at=!1}catch{at=!0}return at}var mo=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function $t(e){return e!=null&&!mo.has(e)?(ve(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ct}"`),null):e}function vo(e,t){let r,i,a,s,d;if(lo(e)){let l=e.getAttribute("action");i=l?xe(l,t):null,r=e.getAttribute("method")||ut,a=$t(e.getAttribute("enctype"))||ct,s=new FormData(e)}else if(so(e)||uo(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||l.getAttribute("action");if(i=u?xe(u,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||ut,a=$t(e.getAttribute("formenctype"))||$t(l.getAttribute("enctype"))||ct,s=new FormData(l,e),!po()){let{name:c,type:v,value:w}=e;if(v==="image"){let x=c?`${c}.`:"";s.append(`${x}x`,"0"),s.append(`${x}y`,"0")}else c&&s.append(c,w)}}else{if(kt(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ut,i=null,a=ct,d=e}return s&&a==="text/plain"&&(d=s,s=void 0),{action:i,method:r.toLowerCase(),encType:a,formData:s,body:d}}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function go(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function yo(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 bo(e,t,r){let i=await Promise.all(e.map(async a=>{let s=t.routes[a.route.id];if(s){let d=await go(s,r);return d.links?d.links():[]}return[]}));return Oo(i.flat(1).filter(yo).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Lr(e,t,r,i,a,s){let d=(u,c)=>r[c]?u.route.id!==r[c].route.id:!0,l=(u,c)=>r[c].pathname!==u.pathname||r[c].route.path?.endsWith("*")&&r[c].params["*"]!==u.params["*"];return s==="assets"?t.filter((u,c)=>d(u,c)||l(u,c)):s==="data"?t.filter((u,c)=>{let v=i.routes[u.route.id];if(!v||!v.hasLoader)return!1;if(d(u,c)||l(u,c))return!0;if(u.route.shouldRevalidate){let w=u.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function wo(e,t,{includeHydrateFallback:r}={}){return So(e.map(i=>{let a=t.routes[i.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),r&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function So(e){return[...new Set(e)]}function xo(e){let t={},r=Object.keys(e).sort();for(let i of r)t[i]=e[i];return t}function Oo(e,t){let r=new Set;return new Set(t),e.reduce((i,a)=>{let s=JSON.stringify(xo(a));return r.has(s)||(r.add(s),i.push({key:s,link:a})),i},[])}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ko=new Set([100,101,204,205]);function Co(e,t){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname="_root.data":t&&xe(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.data`:r.pathname=`${r.pathname.replace(/\/$/,"")}.data`,r}function pn(){let e=M.useContext(Me);return Jt(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Po(){let e=M.useContext(Ot);return Jt(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Zt=M.createContext(void 0);Zt.displayName="FrameworkContext";function mn(){let e=M.useContext(Zt);return Jt(e,"You must render this element inside a <HydratedRouter> element"),e}function Eo(e,t){let r=M.useContext(Zt),[i,a]=M.useState(!1),[s,d]=M.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:v,onTouchStart:w}=t,x=M.useRef(null);M.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let p=k=>{k.forEach(F=>{d(F.isIntersecting)})},I=new IntersectionObserver(p,{threshold:.5});return x.current&&I.observe(x.current),()=>{I.disconnect()}}},[e]),M.useEffect(()=>{if(i){let p=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(p)}}},[i]);let L=()=>{a(!0)},C=()=>{a(!1),d(!1)};return r?e!=="intent"?[s,x,{}]:[s,x,{onFocus:Ye(l,L),onBlur:Ye(u,C),onMouseEnter:Ye(c,L),onMouseLeave:Ye(v,C),onTouchStart:Ye(w,L)}]:[!1,x,{}]}function Ye(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Ro({page:e,...t}){let{router:r}=pn(),i=M.useMemo(()=>tn(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?M.createElement(_o,{page:e,matches:i,...t}):null}function To(e){let{manifest:t,routeModules:r}=mn(),[i,a]=M.useState([]);return M.useEffect(()=>{let s=!1;return bo(e,t,r).then(d=>{s||a(d)}),()=>{s=!0}},[e,t,r]),i}function _o({page:e,matches:t,...r}){let i=ke(),{manifest:a,routeModules:s}=mn(),{basename:d}=pn(),{loaderData:l,matches:u}=Po(),c=M.useMemo(()=>Lr(e,t,u,a,i,"data"),[e,t,u,a,i]),v=M.useMemo(()=>Lr(e,t,u,a,i,"assets"),[e,t,u,a,i]),w=M.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let C=new Set,p=!1;if(t.forEach(k=>{let F=a.routes[k.route.id];!F||!F.hasLoader||(!c.some(Y=>Y.route.id===k.route.id)&&k.route.id in l&&s[k.route.id]?.shouldRevalidate||F.hasClientLoader?p=!0:C.add(k.route.id))}),C.size===0)return[];let I=Co(e,d);return p&&C.size>0&&I.searchParams.set("_routes",t.filter(k=>C.has(k.route.id)).map(k=>k.route.id).join(",")),[I.pathname+I.search]},[d,l,i,a,c,t,e,s]),x=M.useMemo(()=>wo(v,a),[v,a]),L=To(v);return M.createElement(M.Fragment,null,w.map(C=>M.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),x.map(C=>M.createElement("link",{key:C,rel:"modulepreload",href:C,...r})),L.map(({key:C,link:p})=>M.createElement("link",{key:C,...p})))}function jo(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var vn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{vn&&(window.__reactRouterVersion="7.6.3")}catch{}function Lo({basename:e,children:t,window:r}){let i=M.useRef();i.current==null&&(i.current=ga({window:r,v5Compat:!0}));let a=i.current,[s,d]=M.useState({action:a.action,location:a.location}),l=M.useCallback(u=>{M.startTransition(()=>d(u))},[d]);return M.useLayoutEffect(()=>a.listen(l),[a,l]),M.createElement(ao,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a})}var gn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yn=M.forwardRef(function({onClick:t,discover:r="render",prefetch:i="none",relative:a,reloadDocument:s,replace:d,state:l,target:u,to:c,preventScrollReset:v,viewTransition:w,...x},L){let{basename:C}=M.useContext(we),p=typeof c=="string"&&gn.test(c),I,k=!1;if(typeof c=="string"&&p&&(I=c,vn))try{let y=new URL(window.location.href),h=c.startsWith("//")?new URL(y.protocol+c):new URL(c),P=xe(h.pathname,C);h.origin===y.origin&&P!=null?c=P+h.search+h.hash:k=!0}catch{ve(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let F=Ya(c,{relative:a}),[Y,V,g]=Eo(i,x),b=Io(c,{replace:d,state:l,target:u,preventScrollReset:v,relative:a,viewTransition:w});function S(y){t&&t(y),y.defaultPrevented||b(y)}let R=M.createElement("a",{...x,...g,href:I||F,onClick:k||s?t:S,ref:jo(L,V),target:u,"data-discover":!p&&r==="render"?"true":void 0});return Y&&!p?M.createElement(M.Fragment,null,R,M.createElement(Ro,{page:F})):R});yn.displayName="Link";var Do=M.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:i="",end:a=!1,style:s,to:d,viewTransition:l,children:u,...c},v){let w=Qe(d,{relative:c.relative}),x=ke(),L=M.useContext(Ot),{navigator:C,basename:p}=M.useContext(we),I=L!=null&&Wo(w)&&l===!0,k=C.encodeLocation?C.encodeLocation(w).pathname:w.pathname,F=x.pathname,Y=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(F=F.toLowerCase(),Y=Y?Y.toLowerCase():null,k=k.toLowerCase()),Y&&p&&(Y=xe(Y,p)||Y);const V=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let g=F===k||!a&&F.startsWith(k)&&F.charAt(V)==="/",b=Y!=null&&(Y===k||!a&&Y.startsWith(k)&&Y.charAt(k.length)==="/"),S={isActive:g,isPending:b,isTransitioning:I},R=g?t:void 0,y;typeof i=="function"?y=i(S):y=[i,g?"active":null,b?"pending":null,I?"transitioning":null].filter(Boolean).join(" ");let h=typeof s=="function"?s(S):s;return M.createElement(yn,{...c,"aria-current":R,className:y,ref:v,style:h,to:d,viewTransition:l},typeof u=="function"?u(S):u)});Do.displayName="NavLink";var Mo=M.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:a,state:s,method:d=ut,action:l,onSubmit:u,relative:c,preventScrollReset:v,viewTransition:w,...x},L)=>{let C=No(),p=Fo(l,{relative:c}),I=d.toLowerCase()==="get"?"get":"post",k=typeof l=="string"&&gn.test(l),F=Y=>{if(u&&u(Y),Y.defaultPrevented)return;Y.preventDefault();let V=Y.nativeEvent.submitter,g=V?.getAttribute("formmethod")||d;C(V||Y.currentTarget,{fetcherKey:t,method:g,navigate:r,replace:a,state:s,relative:c,preventScrollReset:v,viewTransition:w})};return M.createElement("form",{ref:L,method:I,action:p,onSubmit:i?u:F,...x,"data-discover":!k&&e==="render"?"true":void 0})});Mo.displayName="Form";function $o(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bn(e){let t=M.useContext(Me);return ae(t,$o(e)),t}function Io(e,{target:t,replace:r,state:i,preventScrollReset:a,relative:s,viewTransition:d}={}){let l=Xt(),u=ke(),c=Qe(e,{relative:s});return M.useCallback(v=>{if(fo(v,t)){v.preventDefault();let w=r!==void 0?r:Xe(u)===Xe(c);l(e,{replace:w,state:i,preventScrollReset:a,relative:s,viewTransition:d})}},[u,l,c,r,i,t,e,a,s,d])}function Ao(e){ve(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=M.useRef(Wt(e)),r=M.useRef(!1),i=ke(),a=M.useMemo(()=>ho(i.search,r.current?null:t.current),[i.search]),s=Xt(),d=M.useCallback((l,u)=>{const c=Wt(typeof l=="function"?l(a):l);r.current=!0,s("?"+c,u)},[s,a]);return[a,d]}var Ho=0,zo=()=>`__${String(++Ho)}__`;function No(){let{router:e}=bn("useSubmit"),{basename:t}=M.useContext(we),r=to();return M.useCallback(async(i,a={})=>{let{action:s,method:d,encType:l,formData:u,body:c}=vo(i,t);if(a.navigate===!1){let v=a.fetcherKey||zo();await e.fetch(v,r,a.action||s,{preventScrollReset:a.preventScrollReset,formData:u,body:c,formMethod:a.method||d,formEncType:a.encType||l,flushSync:a.flushSync})}else await e.navigate(a.action||s,{preventScrollReset:a.preventScrollReset,formData:u,body:c,formMethod:a.method||d,formEncType:a.encType||l,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,r])}function Fo(e,{relative:t}={}){let{basename:r}=M.useContext(we),i=M.useContext(Oe);ae(i,"useFormAction must be used inside a RouteContext");let[a]=i.matches.slice(-1),s={...Qe(e||".",{relative:t})},d=ke();if(e==null){s.search=d.search;let l=new URLSearchParams(s.search),u=l.getAll("index");if(u.some(v=>v==="")){l.delete("index"),u.filter(w=>w).forEach(w=>l.append("index",w));let v=l.toString();s.search=v?`?${v}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(s.pathname=s.pathname==="/"?r:Se([r,s.pathname])),Xe(s)}function Wo(e,t={}){let r=M.useContext(ln);ae(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=bn("useViewTransitionState"),a=Qe(e,{relative:t.relative});if(!r.isTransitioning)return!1;let s=xe(r.currentLocation.pathname,i)||r.currentLocation.pathname,d=xe(r.nextLocation.pathname,i)||r.nextLocation.pathname;return gt(a.pathname,d)!=null||gt(a.pathname,s)!=null}[...ko];const wn=U.createContext({history:[],addToHistory:()=>{},popFromHistory:()=>"",replaceHistory:()=>{}}),Uo=()=>{const[e,t]=Ao(),r=U.useMemo(()=>Object.fromEntries(e.entries()),[e]),i=U.useCallback(c=>{const v={};return c.forEach(w=>{v[w]=e.get(w)}),v},[e]),a=U.useCallback(c=>{const v=e.get(c);return v==null||v==null,v},[e]),s=U.useCallback((c,v)=>{const w=new URLSearchParams(e);w.set(c,String(v)),t(w)},[e,t]),d=U.useCallback(c=>{const v=new URLSearchParams(e);Object.entries(c).forEach(([w,x])=>{x!=null&&v.set(w,String(x))}),t(v)},[e,t]),l=U.useCallback(c=>{const v=new URLSearchParams(e);v.delete(c),t(v)},[e,t]),u=U.useCallback(c=>{const v=new URLSearchParams(e);c.forEach(w=>{v.delete(String(w))}),t(v)},[e,t]);return{getAll:()=>r,get:a,getMany:i,set:s,setMany:d,remove:l,removeMany:u}},Yo=()=>{const e=Xt(),t=ke(),r=Uo(),i=U.useContext(wn),a=l=>{const u=new URL(l.path,"http://dummy-base");return l.params&&Object.entries(l.params).forEach(([c,v])=>{v!=null&&u.searchParams.set(c,String(v))}),u.pathname+u.search},s=U.useCallback(l=>{const u=a(l);l.addToHistory!==!1?(e(u),i.addToHistory(u)):(e(u,{replace:!0}),i.popFromHistory(1),i.addToHistory(u))},[e]),d=U.useCallback(l=>{const u=l||1;e(-u),i.popFromHistory(u)},[e]);return{currentPath:t.pathname,history:i.history,searchParams:r,goBack:d,goTo:s}},Bo=({isReady:e=!0,routes:t,children:r})=>{const i=U.useRef([]),[a,s]=U.useState([]),d=U.useCallback(w=>{i.current=w,s(w)},[]),l=(w,x=!1)=>{let L=[...i.current];x&&(L=L.slice(0,L.length-1)),L=[...L,w],d(L)},u=w=>{let x="",L=[];return i.current.length===0?"/":(i.current.length<=w?(x=i.current[0],L=[x]):(L=i.current.slice(0,i.current.length-w),x=L[L.length-1]),d(L),x)},c=w=>{d(w)},v=t.map(w=>X.jsx(hn,{path:w.path,element:w.render}));return X.jsx(wn.Provider,{value:{history:a,addToHistory:l,popFromHistory:u,replaceHistory:c},children:X.jsx(Lo,{children:e&&X.jsxs(X.Fragment,{children:[r,X.jsx(oo,{children:v})]})})})},Sn=U.createContext({visibleItems:[],isItemVisible:()=>!1,showItem:()=>{},hideItem:()=>{}}),Vo=({children:e})=>{const t=U.useRef([]),[r,i]=U.useState([]),a=U.useCallback(u=>{t.current=u,i(u)},[]),s=U.useCallback(u=>t.current.some(c=>c===u),[]),d=U.useCallback(u=>{s(u)||a([...t.current,u])},[s,a]),l=U.useCallback(u=>{s(u)&&a(t.current.filter(v=>v!==u))},[s,a]);return X.jsx(Sn.Provider,{value:{visibleItems:r,isItemVisible:s,showItem:d,hideItem:l},children:e})},et=()=>{const e=U.useContext(Sn),t=a=>e.visibleItems.some(s=>s===a),r=a=>{e.showItem(a)},i=a=>{e.hideItem(a)};return{visibleItems:e.visibleItems,isItemVisible:t,showItem:r,hideItem:i}},qo=({id:e,onCloseDrawer:t,drawerCloseOffset:r=15})=>{const{isItemVisible:i}=et(),[a,s]=U.useState({isDragging:!1}),d=U.useRef(null),l=U.useRef(null),u=U.useRef(null),[c,v]=U.useState(0),w=C=>{s(C)},x=C=>{s(C),v(0)};return Qr({ref:u,onDrag:C=>{s(C);const p=l.current?.clientHeight||0;C.distanceY&&(v(C.distanceY<0?0:-C.distanceY),C.distanceY>=p-r&&(t?.(),x(C)))},onDragEnd:x,onDragStart:w}),{isVisible:i(e),drawerParentRef:d,drawerRef:l,drawerBottomDistance:c,handleRef:u}},Xo=e=>{const{children:t,backgroundStyles:r,contentStyles:i,handle:a}=e,{isVisible:s,drawerParentRef:d,drawerRef:l,handleRef:u,drawerBottomDistance:c}=qo(e);return X.jsx(X.Fragment,{children:s&&X.jsx("div",{ref:d,style:{width:"100%",height:"100%",minHeight:"100vh",left:0,top:0,background:"#00000068",position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column",touchAction:"none",...r},children:X.jsxs("div",{ref:l,style:{width:"100%",height:"fit-content",minHeight:"80px",maxHeight:"90%",background:"#ffffff",borderTopLeftRadius:"16px",borderTopRightRadius:"16px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px",zIndex:1001,position:"absolute",bottom:`${c}px`,...i},onClick:v=>{v.stopPropagation()},children:[X.jsx("div",{ref:u,style:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0px",height:"24px",width:"100%",cursor:"pointer",...a?.styles},children:a?.render}),t]})})})},Go=({onPreSubmit:e,onSubmit:t,configurations:r})=>{const i=U.useRef(null),a=U.useRef(!1),s=c=>{const v=Array.from(c.currentTarget.elements).filter(x=>!!x.getAttribute("name")),w=[];for(const x of v){const L=x.name;w.push({name:L,value:x.value})}return w},d=async c=>{try{const x=(r||[]).find(L=>L.name===c.name);if(!x)return c;var v=c.value,w=c.value;if(x.emptyValidation&&x.emptyValidation.allow===!1&&!v)return c.error=x.emptyValidation.errorMessage,c;if(x.minLengthValidation&&v.length<x.minLengthValidation.value)return c.error=x.minLengthValidation.errorMessage,c;if(x.maxLengthValidation&&v.length>x.maxLengthValidation.value)return c.error=x.maxLengthValidation.errorMessage,c;if(!isNaN(w)){if(x.minValueValidation&&w<x.minValueValidation.value)return c.error=x.minValueValidation.errorMessage,c;if(x.maxValueValidation&&w>x.maxValueValidation.value)return c.error=x.maxValueValidation.errorMessage,c}if(x.exactValueValidation&&x.exactValueValidation.value!==c.value)return c.error=x.exactValueValidation.errorMessage,c;for(let L=0;L<(x.validations||[]).length;L++){const C=await x.validations?.[L](c.value);if(C)return c.error=C,c}}catch(x){console.error(`Form > Failed To Validate Field ${c.name}: `,x)}return c},l=U.useCallback(async c=>{try{if(a.current)return;a.current=!0,e?.(),c.preventDefault(),c.stopPropagation();let v=s(c);v=await Promise.all(v.map(async w=>await d(w))),a.current=!1,t?.(v)}catch(v){a.current=!1,console.error("Form > OnSubmit > Error submitting: ",v)}},[t,e]);return{ref:i,submitForm:c=>{i.current&&i.current.requestSubmit()},handleFormSubmission:l}},Ko=Pe.div`
|
|
127
127
|
display: flex;
|
|
128
128
|
width: 100%;
|
|
129
129
|
align-items: center;
|
package/dist/index.es.js
CHANGED
|
@@ -6165,13 +6165,17 @@ const Sn = V.createContext({
|
|
|
6165
6165
|
return c;
|
|
6166
6166
|
}, l = V.useCallback(
|
|
6167
6167
|
async (c) => {
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
v
|
|
6174
|
-
|
|
6168
|
+
try {
|
|
6169
|
+
if (a.current)
|
|
6170
|
+
return;
|
|
6171
|
+
a.current = !0, e?.(), c.preventDefault(), c.stopPropagation();
|
|
6172
|
+
let v = s(c);
|
|
6173
|
+
v = await Promise.all(
|
|
6174
|
+
v.map(async (w) => await d(w))
|
|
6175
|
+
), a.current = !1, t?.(v);
|
|
6176
|
+
} catch (v) {
|
|
6177
|
+
a.current = !1, console.error("Form > OnSubmit > Error submitting: ", v);
|
|
6178
|
+
}
|
|
6175
6179
|
},
|
|
6176
6180
|
[t, e]
|
|
6177
6181
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eliseubatista99/react-scaffold-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A library which provides basic components, hooks, helpers and providers to easily build a React application and avoid repeating the usual code.",
|
|
6
6
|
"main": "dist/index.cjs.js",
|