cat-bookmarker/assets/node_modules/react-router-dom/react-router-dom.production...

13 lines
3.4 KiB
JavaScript

/**
* React Router DOM v6.3.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
import{useRef as t,useState as e,useLayoutEffect as n,createElement as a,forwardRef as r,useCallback as o,useMemo as i}from"react";import{createBrowserHistory as c,createHashHistory as s}from"history";import{Router as l,useHref as u,createPath as f,useLocation as h,useResolvedPath as m,useNavigate as p}from"react-router";export{MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,Routes,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,createPath,createRoutesFromChildren,generatePath,matchPath,matchRoutes,parsePath,renderMatches,resolvePath,useHref,useInRouterContext,useLocation,useMatch,useNavigate,useNavigationType,useOutlet,useOutletContext,useParams,useResolvedPath,useRoutes}from"react-router";function y({basename:r,children:o,window:i}){let s=t();null==s.current&&(s.current=c({window:i}));let u=s.current,[f,h]=e({action:u.action,location:u.location});return n((()=>u.listen(h)),[u]),a(l,{basename:r,children:o,location:f.location,navigationType:f.action,navigator:u})}function g({basename:r,children:o,window:i}){let c=t();null==c.current&&(c.current=s({window:i}));let u=c.current,[f,h]=e({action:u.action,location:u.location});return n((()=>u.listen(h)),[u]),a(l,{basename:r,children:o,location:f.location,navigationType:f.action,navigator:u})}function d({basename:t,children:r,history:o}){const[i,c]=e({action:o.action,location:o.location});return n((()=>o.listen(c)),[o]),a(l,{basename:t,children:r,location:i.location,navigationType:i.action,navigator:o})}const v=r((function({onClick:t,reloadDocument:e,replace:n=!1,state:r,target:o,to:i,...c},s){let l=u(i),f=A(i,{replace:n,state:r,target:o});return a("a",Object.assign({},c,{href:l,onClick:function(n){t&&t(n),n.defaultPrevented||e||f(n)},ref:s,target:o}))})),R=r((function({"aria-current":t="page",caseSensitive:e=!1,className:n="",end:r=!1,style:o,to:i,children:c,...s},l){let u=h(),f=m(i),p=u.pathname,y=f.pathname;e||(p=p.toLowerCase(),y=y.toLowerCase());let g,d=p===y||!r&&p.startsWith(y)&&"/"===p.charAt(y.length),R=d?t:void 0;g="function"==typeof n?n({isActive:d}):[n,d?"active":null].filter(Boolean).join(" ");let A="function"==typeof o?o({isActive:d}):o;return a(v,Object.assign({},s,{"aria-current":R,className:g,ref:l,style:A,to:i}),"function"==typeof c?c({isActive:d}):c)}));function A(t,{target:e,replace:n,state:a}={}){let r=p(),i=h(),c=m(t);return o((o=>{if(!(0!==o.button||e&&"_self"!==e||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(o))){o.preventDefault();let e=!!n||f(i)===f(c);r(t,{replace:e,state:a})}}),[i,r,c,n,a,e,t])}function b(e){let n=t(w(e)),a=h(),r=i((()=>{let t=w(a.search);for(let e of n.current.keys())t.has(e)||n.current.getAll(e).forEach((n=>{t.append(e,n)}));return t}),[a.search]),c=p();return[r,o(((t,e)=>{c("?"+w(t),e)}),[c])]}function w(t=""){return new URLSearchParams("string"==typeof t||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce(((e,n)=>{let a=t[n];return e.concat(Array.isArray(a)?a.map((t=>[n,t])):[[n,a]])}),[]))}export{y as BrowserRouter,g as HashRouter,v as Link,R as NavLink,w as createSearchParams,d as unstable_HistoryRouter,A as useLinkClickHandler,b as useSearchParams};
//# sourceMappingURL=react-router-dom.production.min.js.map