mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-12 20:30:05 +01:00
5 lines
44 KiB
JavaScript
5 lines
44 KiB
JavaScript
function nt(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in e)){const u=Object.getOwnPropertyDescriptor(n,i);u&&Object.defineProperty(e,i,u.get?u:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function De(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ce={exports:{}},R={};var Se;function ot(){if(Se)return R;Se=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),s=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),o=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),m=Symbol.iterator;function v(a){return a===null||typeof a!="object"?null:(a=m&&a[m]||a["@@iterator"],typeof a=="function"?a:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,y={};function g(a,h,_){this.props=a,this.context=h,this.refs=y,this.updater=_||w}g.prototype.isReactComponent={},g.prototype.setState=function(a,h){if(typeof a!="object"&&typeof a!="function"&&a!=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,a,h,"setState")},g.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};function E(){}E.prototype=g.prototype;function S(a,h,_){this.props=a,this.context=h,this.refs=y,this.updater=_||w}var k=S.prototype=new E;k.constructor=S,x(k,g.prototype),k.isPureReactComponent=!0;var A=Array.isArray;function U(){}var b={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function F(a,h,_){var C=_.ref;return{$$typeof:e,type:a,key:h,ref:C!==void 0?C:null,props:_}}function I(a,h){return F(a.type,h,a.props)}function Y(a){return typeof a=="object"&&a!==null&&a.$$typeof===e}function te(a){var h={"=":"=0",":":"=2"};return"$"+a.replace(/[=:]/g,function(_){return h[_]})}var _e=/\/+/g;function se(a,h){return typeof a=="object"&&a!==null&&a.key!=null?te(""+a.key):h.toString(36)}function Ze(a){switch(a.status){case"fulfilled":return a.value;case"rejected":throw a.reason;default:switch(typeof a.status=="string"?a.then(U,U):(a.status="pending",a.then(function(h){a.status==="pending"&&(a.status="fulfilled",a.value=h)},function(h){a.status==="pending"&&(a.status="rejected",a.reason=h)})),a.status){case"fulfilled":return a.value;case"rejected":throw a.reason}}throw a}function K(a,h,_,C,P){var T=typeof a;(T==="undefined"||T==="boolean")&&(a=null);var L=!1;if(a===null)L=!0;else switch(T){case"bigint":case"string":case"number":L=!0;break;case"object":switch(a.$$typeof){case e:case t:L=!0;break;case d:return L=a._init,K(L(a._payload),h,_,C,P)}}if(L)return P=P(a),L=C===""?"."+se(a,0):C,A(P)?(_="",L!=null&&(_=L.replace(_e,"$&/")+"/"),K(P,h,_,"",function(rt){return rt})):P!=null&&(Y(P)&&(P=I(P,_+(P.key==null||a&&a.key===P.key?"":(""+P.key).replace(_e,"$&/")+"/")+L)),h.push(P)),1;L=0;var j=C===""?".":C+":";if(A(a))for(var N=0;N<a.length;N++)C=a[N],T=j+se(C,N),L+=K(C,h,_,T,P);else if(N=v(a),typeof N=="function")for(a=N.call(a),N=0;!(C=a.next()).done;)C=C.value,T=j+se(C,N++),L+=K(C,h,_,T,P);else if(T==="object"){if(typeof a.then=="function")return K(Ze(a),h,_,C,P);throw h=String(a),Error("Objects are not valid as a React child (found: "+(h==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":h)+"). If you meant to render a collection of children, use an array instead.")}return L}function re(a,h,_){if(a==null)return a;var C=[],P=0;return K(a,C,"","",function(T){return h.call(_,T,P++)}),C}function et(a){if(a._status===-1){var h=a._result;h=h(),h.then(function(_){(a._status===0||a._status===-1)&&(a._status=1,a._result=_)},function(_){(a._status===0||a._status===-1)&&(a._status=2,a._result=_)}),a._status===-1&&(a._status=0,a._result=h)}if(a._status===1)return a._result.default;throw a._result}var xe=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var h=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(h))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},tt={map:re,forEach:function(a,h,_){re(a,function(){h.apply(this,arguments)},_)},count:function(a){var h=0;return re(a,function(){h++}),h},toArray:function(a){return re(a,function(h){return h})||[]},only:function(a){if(!Y(a))throw Error("React.Children.only expected to receive a single React element child.");return a}};return R.Activity=p,R.Children=tt,R.Component=g,R.Fragment=r,R.Profiler=i,R.PureComponent=S,R.StrictMode=n,R.Suspense=l,R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=b,R.__COMPILER_RUNTIME={__proto__:null,c:function(a){return b.H.useMemoCache(a)}},R.cache=function(a){return function(){return a.apply(null,arguments)}},R.cacheSignal=function(){return null},R.cloneElement=function(a,h,_){if(a==null)throw Error("The argument must be a React element, but you passed "+a+".");var C=x({},a.props),P=a.key;if(h!=null)for(T in h.key!==void 0&&(P=""+h.key),h)!q.call(h,T)||T==="key"||T==="__self"||T==="__source"||T==="ref"&&h.ref===void 0||(C[T]=h[T]);var T=arguments.length-2;if(T===1)C.children=_;else if(1<T){for(var L=Array(T),j=0;j<T;j++)L[j]=arguments[j+2];C.children=L}return F(a.type,P,C)},R.createContext=function(a){return a={$$typeof:s,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null},a.Provider=a,a.Consumer={$$typeof:u,_context:a},a},R.createElement=function(a,h,_){var C,P={},T=null;if(h!=null)for(C in h.key!==void 0&&(T=""+h.key),h)q.call(h,C)&&C!=="key"&&C!=="__self"&&C!=="__source"&&(P[C]=h[C]);var L=arguments.length-2;if(L===1)P.children=_;else if(1<L){for(var j=Array(L),N=0;N<L;N++)j[N]=arguments[N+2];P.children=j}if(a&&a.defaultProps)for(C in L=a.defaultProps,L)P[C]===void 0&&(P[C]=L[C]);return F(a,T,P)},R.createRef=function(){return{current:null}},R.forwardRef=function(a){return{$$typeof:f,render:a}},R.isValidElement=Y,R.lazy=function(a){return{$$typeof:d,_payload:{_status:-1,_result:a},_init:et}},R.memo=function(a,h){return{$$typeof:o,type:a,compare:h===void 0?null:h}},R.startTransition=function(a){var h=b.T,_={};b.T=_;try{var C=a(),P=b.S;P!==null&&P(_,C),typeof C=="object"&&C!==null&&typeof C.then=="function"&&C.then(U,xe)}catch(T){xe(T)}finally{h!==null&&_.types!==null&&(h.types=_.types),b.T=h}},R.unstable_useCacheRefresh=function(){return b.H.useCacheRefresh()},R.use=function(a){return b.H.use(a)},R.useActionState=function(a,h,_){return b.H.useActionState(a,h,_)},R.useCallback=function(a,h){return b.H.useCallback(a,h)},R.useContext=function(a){return b.H.useContext(a)},R.useDebugValue=function(){},R.useDeferredValue=function(a,h){return b.H.useDeferredValue(a,h)},R.useEffect=function(a,h){return b.H.useEffect(a,h)},R.useEffectEvent=function(a){return b.H.useEffectEvent(a)},R.useId=function(){return b.H.useId()},R.useImperativeHandle=function(a,h,_){return b.H.useImperativeHandle(a,h,_)},R.useInsertionEffect=function(a,h){return b.H.useInsertionEffect(a,h)},R.useLayoutEffect=function(a,h){return b.H.useLayoutEffect(a,h)},R.useMemo=function(a,h){return b.H.useMemo(a,h)},R.useOptimistic=function(a,h){return b.H.useOptimistic(a,h)},R.useReducer=function(a,h,_){return b.H.useReducer(a,h,_)},R.useRef=function(a){return b.H.useRef(a)},R.useState=function(a){return b.H.useState(a)},R.useSyncExternalStore=function(a,h,_){return b.H.useSyncExternalStore(a,h,_)},R.useTransition=function(){return b.H.useTransition()},R.version="19.2.1",R}var be;function Me(){return be||(be=1,ce.exports=ot()),ce.exports}var c=Me();const at=De(c),Dr=nt({__proto__:null,default:at},[c]);var fe={exports:{}},$={};var Pe;function it(){if(Pe)return $;Pe=1;var e=Me();function t(l){var o="https://react.dev/errors/"+l;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+l+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},i=Symbol.for("react.portal");function u(l,o,d){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:p==null?null:""+p,children:l,containerInfo:o,implementation:d}}var s=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(l,o){if(l==="font")return"";if(typeof o=="string")return o==="use-credentials"?o:""}return $.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,$.createPortal=function(l,o){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)throw Error(t(299));return u(l,o,null,d)},$.flushSync=function(l){var o=s.T,d=n.p;try{if(s.T=null,n.p=2,l)return l()}finally{s.T=o,n.p=d,n.d.f()}},$.preconnect=function(l,o){typeof l=="string"&&(o?(o=o.crossOrigin,o=typeof o=="string"?o==="use-credentials"?o:"":void 0):o=null,n.d.C(l,o))},$.prefetchDNS=function(l){typeof l=="string"&&n.d.D(l)},$.preinit=function(l,o){if(typeof l=="string"&&o&&typeof o.as=="string"){var d=o.as,p=f(d,o.crossOrigin),m=typeof o.integrity=="string"?o.integrity:void 0,v=typeof o.fetchPriority=="string"?o.fetchPriority:void 0;d==="style"?n.d.S(l,typeof o.precedence=="string"?o.precedence:void 0,{crossOrigin:p,integrity:m,fetchPriority:v}):d==="script"&&n.d.X(l,{crossOrigin:p,integrity:m,fetchPriority:v,nonce:typeof o.nonce=="string"?o.nonce:void 0})}},$.preinitModule=function(l,o){if(typeof l=="string")if(typeof o=="object"&&o!==null){if(o.as==null||o.as==="script"){var d=f(o.as,o.crossOrigin);n.d.M(l,{crossOrigin:d,integrity:typeof o.integrity=="string"?o.integrity:void 0,nonce:typeof o.nonce=="string"?o.nonce:void 0})}}else o==null&&n.d.M(l)},$.preload=function(l,o){if(typeof l=="string"&&typeof o=="object"&&o!==null&&typeof o.as=="string"){var d=o.as,p=f(d,o.crossOrigin);n.d.L(l,d,{crossOrigin:p,integrity:typeof o.integrity=="string"?o.integrity:void 0,nonce:typeof o.nonce=="string"?o.nonce:void 0,type:typeof o.type=="string"?o.type:void 0,fetchPriority:typeof o.fetchPriority=="string"?o.fetchPriority:void 0,referrerPolicy:typeof o.referrerPolicy=="string"?o.referrerPolicy:void 0,imageSrcSet:typeof o.imageSrcSet=="string"?o.imageSrcSet:void 0,imageSizes:typeof o.imageSizes=="string"?o.imageSizes:void 0,media:typeof o.media=="string"?o.media:void 0})}},$.preloadModule=function(l,o){if(typeof l=="string")if(o){var d=f(o.as,o.crossOrigin);n.d.m(l,{as:typeof o.as=="string"&&o.as!=="script"?o.as:void 0,crossOrigin:d,integrity:typeof o.integrity=="string"?o.integrity:void 0})}else n.d.m(l)},$.requestFormReset=function(l){n.d.r(l)},$.unstable_batchedUpdates=function(l,o){return l(o)},$.useFormState=function(l,o,d){return s.H.useFormState(l,o,d)},$.useFormStatus=function(){return s.H.useHostTransitionStatus()},$.version="19.2.1",$}var Te;function ut(){if(Te)return fe.exports;Te=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),fe.exports=it(),fe.exports}var lt=ut();const Mr=De(lt);var Le="popstate";function st(e={}){function t(n,i){let{pathname:u,search:s,hash:f}=n.location;return he("",{pathname:u,search:s,hash:f},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(n,i){return typeof i=="string"?i:Q(i)}return ft(t,r,null,e)}function O(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function D(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ct(){return Math.random().toString(36).substring(2,10)}function Oe(e,t){return{usr:e.state,key:e.key,idx:t}}function he(e,t,r=null,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?V(t):t,state:r,key:t&&t.key||n||ct()}}function Q({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 V(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function ft(e,t,r,n={}){let{window:i=document.defaultView,v5Compat:u=!1}=n,s=i.history,f="POP",l=null,o=d();o==null&&(o=0,s.replaceState({...s.state,idx:o},""));function d(){return(s.state||{idx:null}).idx}function p(){f="POP";let y=d(),g=y==null?null:y-o;o=y,l&&l({action:f,location:x.location,delta:g})}function m(y,g){f="PUSH";let E=he(x.location,y,g);o=d()+1;let S=Oe(E,o),k=x.createHref(E);try{s.pushState(S,"",k)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;i.location.assign(k)}u&&l&&l({action:f,location:x.location,delta:1})}function v(y,g){f="REPLACE";let E=he(x.location,y,g);o=d();let S=Oe(E,o),k=x.createHref(E);s.replaceState(S,"",k),u&&l&&l({action:f,location:x.location,delta:0})}function w(y){return dt(y)}let x={get action(){return f},get location(){return e(i,s)},listen(y){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(Le,p),l=y,()=>{i.removeEventListener(Le,p),l=null}},createHref(y){return t(i,y)},createURL:w,encodeLocation(y){let g=w(y);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:m,replace:v,go(y){return s.go(y)}};return x}function dt(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),O(r,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:Q(e);return n=n.replace(/ $/,"%20"),!t&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function Ie(e,t,r="/"){return pt(e,t,r,!1)}function pt(e,t,r,n){let i=typeof t=="string"?V(t):t,u=W(i.pathname||"/",r);if(u==null)return null;let s=He(e);ht(s);let f=null;for(let l=0;f==null&&l<s.length;++l){let o=St(u);f=_t(s[l],o,n)}return f}function He(e,t=[],r=[],n="",i=!1){let u=(s,f,l=i,o)=>{let d={relativePath:o===void 0?s.path||"":o,caseSensitive:s.caseSensitive===!0,childrenIndex:f,route:s};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(n)&&l)return;O(d.relativePath.startsWith(n),`Absolute route path "${d.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(n.length)}let p=B([n,d.relativePath]),m=r.concat(d);s.children&&s.children.length>0&&(O(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),He(s.children,t,m,p,l)),!(s.path==null&&!s.index)&&t.push({path:p,score:wt(p,s.index),routesMeta:m})};return e.forEach((s,f)=>{if(s.path===""||!s.path?.includes("?"))u(s,f);else for(let l of Ue(s.path))u(s,f,!0,l)}),t}function Ue(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,i=r.endsWith("?"),u=r.replace(/\?$/,"");if(n.length===0)return i?[u,""]:[u];let s=Ue(n.join("/")),f=[];return f.push(...s.map(l=>l===""?u:[u,l].join("/"))),i&&f.push(...s),f.map(l=>e.startsWith("/")&&l===""?"/":l)}function ht(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Ct(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var mt=/^:[\w-]+$/,yt=3,gt=2,vt=1,Et=10,Rt=-2,ke=e=>e==="*";function wt(e,t){let r=e.split("/"),n=r.length;return r.some(ke)&&(n+=Rt),t&&(n+=gt),r.filter(i=>!ke(i)).reduce((i,u)=>i+(mt.test(u)?yt:u===""?vt:Et),n)}function Ct(e,t){return e.length===t.length&&e.slice(0,-1).every((n,i)=>n===t[i])?e[e.length-1]-t[t.length-1]:0}function _t(e,t,r=!1){let{routesMeta:n}=e,i={},u="/",s=[];for(let f=0;f<n.length;++f){let l=n[f],o=f===n.length-1,d=u==="/"?t:t.slice(u.length)||"/",p=ie({path:l.relativePath,caseSensitive:l.caseSensitive,end:o},d),m=l.route;if(!p&&o&&r&&!n[n.length-1].route.index&&(p=ie({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!p)return null;Object.assign(i,p.params),s.push({params:i,pathname:B([u,p.pathname]),pathnameBase:Ot(B([u,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(u=B([u,p.pathnameBase]))}return s}function ie(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=xt(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let u=i[0],s=u.replace(/(.)\/+$/,"$1"),f=i.slice(1);return{params:n.reduce((o,{paramName:d,isOptional:p},m)=>{if(d==="*"){let w=f[m]||"";s=u.slice(0,u.length-w.length).replace(/(.)\/+$/,"$1")}const v=f[m];return p&&!v?o[d]=void 0:o[d]=(v||"").replace(/%2F/g,"/"),o},{}),pathname:u,pathnameBase:s,pattern:e}}function xt(e,t=!1,r=!0){D(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,f,l)=>(n.push({paramName:f,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),n]}function St(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return D(!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 W(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}var bt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pt=e=>bt.test(e);function Tt(e,t="/"){let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?V(e):e,u;if(r)if(Pt(r))u=r;else{if(r.includes("//")){let s=r;r=r.replace(/\/\/+/g,"/"),D(!1,`Pathnames cannot have embedded double slashes - normalizing ${s} -> ${r}`)}r.startsWith("/")?u=$e(r.substring(1),"/"):u=$e(r,t)}else u=t;return{pathname:u,search:kt(n),hash:$t(i)}}function $e(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function de(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Lt(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function ye(e){let t=Lt(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function ge(e,t,r,n=!1){let i;typeof e=="string"?i=V(e):(i={...e},O(!i.pathname||!i.pathname.includes("?"),de("?","pathname","search",i)),O(!i.pathname||!i.pathname.includes("#"),de("#","pathname","hash",i)),O(!i.search||!i.search.includes("#"),de("#","search","hash",i)));let u=e===""||i.pathname==="",s=u?"/":i.pathname,f;if(s==null)f=r;else{let p=t.length-1;if(!n&&s.startsWith("..")){let m=s.split("/");for(;m[0]==="..";)m.shift(),p-=1;i.pathname=m.join("/")}f=p>=0?t[p]:"/"}let l=Tt(i,f),o=s&&s!=="/"&&s.endsWith("/"),d=(u||s===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(o||d)&&(l.pathname+="/"),l}var B=e=>e.join("/").replace(/\/\/+/g,"/"),Ot=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),kt=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,$t=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function At(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Nt(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Fe=["POST","PUT","PATCH","DELETE"];new Set(Fe);var Dt=["GET",...Fe];new Set(Dt);var G=c.createContext(null);G.displayName="DataRouter";var ue=c.createContext(null);ue.displayName="DataRouterState";c.createContext(!1);var je=c.createContext({isTransitioning:!1});je.displayName="ViewTransition";var Mt=c.createContext(new Map);Mt.displayName="Fetchers";var It=c.createContext(null);It.displayName="Await";var M=c.createContext(null);M.displayName="Navigation";var Z=c.createContext(null);Z.displayName="Location";var H=c.createContext({outlet:null,matches:[],isDataRoute:!1});H.displayName="Route";var ve=c.createContext(null);ve.displayName="RouteError";function Ht(e,{relative:t}={}){O(J(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=c.useContext(M),{hash:i,pathname:u,search:s}=ee(e,{relative:t}),f=u;return r!=="/"&&(f=u==="/"?r:B([r,u])),n.createHref({pathname:f,search:s,hash:i})}function J(){return c.useContext(Z)!=null}function z(){return O(J(),"useLocation() may be used only in the context of a <Router> component."),c.useContext(Z).location}var Be="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function We(e){c.useContext(M).static||c.useLayoutEffect(e)}function Ye(){let{isDataRoute:e}=c.useContext(H);return e?Zt():Ut()}function Ut(){O(J(),"useNavigate() may be used only in the context of a <Router> component.");let e=c.useContext(G),{basename:t,navigator:r}=c.useContext(M),{matches:n}=c.useContext(H),{pathname:i}=z(),u=JSON.stringify(ye(n)),s=c.useRef(!1);return We(()=>{s.current=!0}),c.useCallback((l,o={})=>{if(D(s.current,Be),!s.current)return;if(typeof l=="number"){r.go(l);return}let d=ge(l,JSON.parse(u),i,o.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:B([t,d.pathname])),(o.replace?r.replace:r.push)(d,o.state,o)},[t,r,u,i,e])}var Ft=c.createContext(null);function jt(e){let t=c.useContext(H).outlet;return c.useMemo(()=>t&&c.createElement(Ft.Provider,{value:e},t),[t,e])}function ee(e,{relative:t}={}){let{matches:r}=c.useContext(H),{pathname:n}=z(),i=JSON.stringify(ye(r));return c.useMemo(()=>ge(e,JSON.parse(i),n,t==="path"),[e,i,n,t])}function Bt(e,t){return ze(e,t)}function ze(e,t,r,n,i){O(J(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:u}=c.useContext(M),{matches:s}=c.useContext(H),f=s[s.length-1],l=f?f.params:{},o=f?f.pathname:"/",d=f?f.pathnameBase:"/",p=f&&f.route;{let E=p&&p.path||"";qe(o,!p||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (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.
|
|
|
|
Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let m=z(),v;if(t){let E=typeof t=="string"?V(t):t;O(d==="/"||E.pathname?.startsWith(d),`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 "${d}" but pathname "${E.pathname}" was given in the \`location\` prop.`),v=E}else v=m;let w=v.pathname||"/",x=w;if(d!=="/"){let E=d.replace(/^\//,"").split("/");x="/"+w.replace(/^\//,"").split("/").slice(E.length).join("/")}let y=Ie(e,{pathname:x});D(p||y!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),D(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.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=Kt(y&&y.map(E=>Object.assign({},E,{params:Object.assign({},l,E.params),pathname:B([d,u.encodeLocation?u.encodeLocation(E.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?d:B([d,u.encodeLocation?u.encodeLocation(E.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),s,r,n,i);return t&&g?c.createElement(Z.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...v},navigationType:"POP"}},g):g}function Wt(){let e=Qt(),t=At(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:n},u={padding:"2px 4px",backgroundColor:n},s=null;return console.error("Error handled by React Router default ErrorBoundary:",e),s=c.createElement(c.Fragment,null,c.createElement("p",null,"💿 Hey developer 👋"),c.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",c.createElement("code",{style:u},"ErrorBoundary")," or"," ",c.createElement("code",{style:u},"errorElement")," prop on your route.")),c.createElement(c.Fragment,null,c.createElement("h2",null,"Unexpected Application Error!"),c.createElement("h3",{style:{fontStyle:"italic"}},t),r?c.createElement("pre",{style:i},r):null,s)}var Yt=c.createElement(Wt,null),zt=class extends c.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){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?c.createElement(H.Provider,{value:this.props.routeContext},c.createElement(ve.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function qt({routeContext:e,match:t,children:r}){let n=c.useContext(G);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),c.createElement(H.Provider,{value:e},r)}function Kt(e,t=[],r=null,n=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 u=e,s=r?.errors;if(s!=null){let d=u.findIndex(p=>p.route.id&&s?.[p.route.id]!==void 0);O(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),u=u.slice(0,Math.min(u.length,d+1))}let f=!1,l=-1;if(r)for(let d=0;d<u.length;d++){let p=u[d];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(l=d),p.route.id){let{loaderData:m,errors:v}=r,w=p.route.loader&&!m.hasOwnProperty(p.route.id)&&(!v||v[p.route.id]===void 0);if(p.route.lazy||w){f=!0,l>=0?u=u.slice(0,l+1):u=[u[0]];break}}}let o=r&&n?(d,p)=>{n(d,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:Nt(r.matches),errorInfo:p})}:void 0;return u.reduceRight((d,p,m)=>{let v,w=!1,x=null,y=null;r&&(v=s&&p.route.id?s[p.route.id]:void 0,x=p.route.errorElement||Yt,f&&(l<0&&m===0?(qe("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,y=null):l===m&&(w=!0,y=p.route.hydrateFallbackElement||null)));let g=t.concat(u.slice(0,m+1)),E=()=>{let S;return v?S=x:w?S=y:p.route.Component?S=c.createElement(p.route.Component,null):p.route.element?S=p.route.element:S=d,c.createElement(qt,{match:p,routeContext:{outlet:d,matches:g,isDataRoute:r!=null},children:S})};return r&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?c.createElement(zt,{location:r.location,revalidation:r.revalidation,component:x,error:v,children:E(),routeContext:{outlet:null,matches:g,isDataRoute:!0},onError:o}):E()},null)}function Ee(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Vt(e){let t=c.useContext(G);return O(t,Ee(e)),t}function Gt(e){let t=c.useContext(ue);return O(t,Ee(e)),t}function Jt(e){let t=c.useContext(H);return O(t,Ee(e)),t}function Re(e){let t=Jt(e),r=t.matches[t.matches.length-1];return O(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Xt(){return Re("useRouteId")}function Qt(){let e=c.useContext(ve),t=Gt("useRouteError"),r=Re("useRouteError");return e!==void 0?e:t.errors?.[r]}function Zt(){let{router:e}=Vt("useNavigate"),t=Re("useNavigate"),r=c.useRef(!1);return We(()=>{r.current=!0}),c.useCallback(async(i,u={})=>{D(r.current,Be),r.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...u}))},[e,t])}var Ae={};function qe(e,t,r){!t&&!Ae[e]&&(Ae[e]=!0,D(!1,r))}c.memo(er);function er({routes:e,future:t,state:r,unstable_onError:n}){return ze(e,void 0,r,n,t)}function Ir({to:e,replace:t,state:r,relative:n}){O(J(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=c.useContext(M);D(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:u}=c.useContext(H),{pathname:s}=z(),f=Ye(),l=ge(e,ye(u),s,n==="path"),o=JSON.stringify(l);return c.useEffect(()=>{f(JSON.parse(o),{replace:t,state:r,relative:n})},[f,o,n,t,r]),null}function Hr(e){return jt(e.context)}function tr(e){O(!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 rr({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:i,static:u=!1,unstable_useTransitions:s}){O(!J(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),l=c.useMemo(()=>({basename:f,navigator:i,static:u,unstable_useTransitions:s,future:{}}),[f,i,u,s]);typeof r=="string"&&(r=V(r));let{pathname:o="/",search:d="",hash:p="",state:m=null,key:v="default"}=r,w=c.useMemo(()=>{let x=W(o,f);return x==null?null:{location:{pathname:x,search:d,hash:p,state:m,key:v},navigationType:n}},[f,o,d,p,m,v,n]);return D(w!=null,`<Router basename="${f}"> is not able to match the URL "${o}${d}${p}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:c.createElement(M.Provider,{value:l},c.createElement(Z.Provider,{children:t,value:w}))}function Ur({children:e,location:t}){return Bt(me(e),t)}function me(e,t=[]){let r=[];return c.Children.forEach(e,(n,i)=>{if(!c.isValidElement(n))return;let u=[...t,i];if(n.type===c.Fragment){r.push.apply(r,me(n.props.children,u));return}O(n.type===tr,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),O(!n.props.index||!n.props.children,"An index route cannot have child routes.");let s={id:n.props.id||u.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=me(n.props.children,u)),r.push(s)}),r}var oe="get",ae="application/x-www-form-urlencoded";function le(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function nr(e){return le(e)&&e.tagName.toLowerCase()==="button"}function or(e){return le(e)&&e.tagName.toLowerCase()==="form"}function ar(e){return le(e)&&e.tagName.toLowerCase()==="input"}function ir(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ur(e,t){return e.button===0&&(!t||t==="_self")&&!ir(e)}var ne=null;function lr(){if(ne===null)try{new FormData(document.createElement("form"),0),ne=!1}catch{ne=!0}return ne}var sr=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function pe(e){return e!=null&&!sr.has(e)?(D(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ae}"`),null):e}function cr(e,t){let r,n,i,u,s;if(or(e)){let f=e.getAttribute("action");n=f?W(f,t):null,r=e.getAttribute("method")||oe,i=pe(e.getAttribute("enctype"))||ae,u=new FormData(e)}else if(nr(e)||ar(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||f.getAttribute("action");if(n=l?W(l,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||oe,i=pe(e.getAttribute("formenctype"))||pe(f.getAttribute("enctype"))||ae,u=new FormData(f,e),!lr()){let{name:o,type:d,value:p}=e;if(d==="image"){let m=o?`${o}.`:"";u.append(`${m}x`,"0"),u.append(`${m}y`,"0")}else o&&u.append(o,p)}}else{if(le(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=oe,n=null,i=ae,s=e}return u&&i==="text/plain"&&(s=u,u=void 0),{action:n,method:r.toLowerCase(),encType:i,formData:u,body:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function we(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function fr(e,t,r){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n.pathname==="/"?n.pathname=`_root.${r}`:t&&W(n.pathname,t)==="/"?n.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:n.pathname=`${n.pathname.replace(/\/$/,"")}.${r}`,n}async function dr(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 pr(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 hr(e,t,r){let n=await Promise.all(e.map(async i=>{let u=t.routes[i.route.id];if(u){let s=await dr(u,r);return s.links?s.links():[]}return[]}));return vr(n.flat(1).filter(pr).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Ne(e,t,r,n,i,u){let s=(l,o)=>r[o]?l.route.id!==r[o].route.id:!0,f=(l,o)=>r[o].pathname!==l.pathname||r[o].route.path?.endsWith("*")&&r[o].params["*"]!==l.params["*"];return u==="assets"?t.filter((l,o)=>s(l,o)||f(l,o)):u==="data"?t.filter((l,o)=>{let d=n.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(s(l,o)||f(l,o))return!0;if(l.route.shouldRevalidate){let p=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function mr(e,t,{includeHydrateFallback:r}={}){return yr(e.map(n=>{let i=t.routes[n.route.id];if(!i)return[];let u=[i.module];return i.clientActionModule&&(u=u.concat(i.clientActionModule)),i.clientLoaderModule&&(u=u.concat(i.clientLoaderModule)),r&&i.hydrateFallbackModule&&(u=u.concat(i.hydrateFallbackModule)),i.imports&&(u=u.concat(i.imports)),u}).flat(1))}function yr(e){return[...new Set(e)]}function gr(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function vr(e,t){let r=new Set;return new Set(t),e.reduce((n,i)=>{let u=JSON.stringify(gr(i));return r.has(u)||(r.add(u),n.push({key:u,link:i})),n},[])}function Ke(){let e=c.useContext(G);return we(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Er(){let e=c.useContext(ue);return we(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ce=c.createContext(void 0);Ce.displayName="FrameworkContext";function Ve(){let e=c.useContext(Ce);return we(e,"You must render this element inside a <HydratedRouter> element"),e}function Rr(e,t){let r=c.useContext(Ce),[n,i]=c.useState(!1),[u,s]=c.useState(!1),{onFocus:f,onBlur:l,onMouseEnter:o,onMouseLeave:d,onTouchStart:p}=t,m=c.useRef(null);c.useEffect(()=>{if(e==="render"&&s(!0),e==="viewport"){let x=g=>{g.forEach(E=>{s(E.isIntersecting)})},y=new IntersectionObserver(x,{threshold:.5});return m.current&&y.observe(m.current),()=>{y.disconnect()}}},[e]),c.useEffect(()=>{if(n){let x=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(x)}}},[n]);let v=()=>{i(!0)},w=()=>{i(!1),s(!1)};return r?e!=="intent"?[u,m,{}]:[u,m,{onFocus:X(f,v),onBlur:X(l,w),onMouseEnter:X(o,v),onMouseLeave:X(d,w),onTouchStart:X(p,v)}]:[!1,m,{}]}function X(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function wr({page:e,...t}){let{router:r}=Ke(),n=c.useMemo(()=>Ie(r.routes,e,r.basename),[r.routes,e,r.basename]);return n?c.createElement(_r,{page:e,matches:n,...t}):null}function Cr(e){let{manifest:t,routeModules:r}=Ve(),[n,i]=c.useState([]);return c.useEffect(()=>{let u=!1;return hr(e,t,r).then(s=>{u||i(s)}),()=>{u=!0}},[e,t,r]),n}function _r({page:e,matches:t,...r}){let n=z(),{manifest:i,routeModules:u}=Ve(),{basename:s}=Ke(),{loaderData:f,matches:l}=Er(),o=c.useMemo(()=>Ne(e,t,l,i,n,"data"),[e,t,l,i,n]),d=c.useMemo(()=>Ne(e,t,l,i,n,"assets"),[e,t,l,i,n]),p=c.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let w=new Set,x=!1;if(t.forEach(g=>{let E=i.routes[g.route.id];!E||!E.hasLoader||(!o.some(S=>S.route.id===g.route.id)&&g.route.id in f&&u[g.route.id]?.shouldRevalidate||E.hasClientLoader?x=!0:w.add(g.route.id))}),w.size===0)return[];let y=fr(e,s,"data");return x&&w.size>0&&y.searchParams.set("_routes",t.filter(g=>w.has(g.route.id)).map(g=>g.route.id).join(",")),[y.pathname+y.search]},[s,f,n,i,o,t,e,u]),m=c.useMemo(()=>mr(d,i),[d,i]),v=Cr(d);return c.createElement(c.Fragment,null,p.map(w=>c.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...r})),m.map(w=>c.createElement("link",{key:w,rel:"modulepreload",href:w,...r})),v.map(({key:w,link:x})=>c.createElement("link",{key:w,nonce:r.nonce,...x})))}function xr(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Ge=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ge&&(window.__reactRouterVersion="7.10.1")}catch{}function Fr({basename:e,children:t,unstable_useTransitions:r,window:n}){let i=c.useRef();i.current==null&&(i.current=st({window:n,v5Compat:!0}));let u=i.current,[s,f]=c.useState({action:u.action,location:u.location}),l=c.useCallback(o=>{r===!1?f(o):c.startTransition(()=>f(o))},[r]);return c.useLayoutEffect(()=>u.listen(l),[u,l]),c.createElement(rr,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:u,unstable_useTransitions:r===!0})}var Je=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xe=c.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:i,reloadDocument:u,replace:s,state:f,target:l,to:o,preventScrollReset:d,viewTransition:p,...m},v){let{basename:w,unstable_useTransitions:x}=c.useContext(M),y=typeof o=="string"&&Je.test(o),g,E=!1;if(typeof o=="string"&&y&&(g=o,Ge))try{let I=new URL(window.location.href),Y=o.startsWith("//")?new URL(I.protocol+o):new URL(o),te=W(Y.pathname,w);Y.origin===I.origin&&te!=null?o=te+Y.search+Y.hash:E=!0}catch{D(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let S=Ht(o,{relative:i}),[k,A,U]=Rr(n,m),b=Tr(o,{replace:s,state:f,target:l,preventScrollReset:d,relative:i,viewTransition:p,unstable_useTransitions:x});function q(I){t&&t(I),I.defaultPrevented||b(I)}let F=c.createElement("a",{...m,...U,href:g||S,onClick:E||u?t:q,ref:xr(v,A),target:l,"data-discover":!y&&r==="render"?"true":void 0});return k&&!y?c.createElement(c.Fragment,null,F,c.createElement(wr,{page:S})):F});Xe.displayName="Link";var Sr=c.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:i=!1,style:u,to:s,viewTransition:f,children:l,...o},d){let p=ee(s,{relative:o.relative}),m=z(),v=c.useContext(ue),{navigator:w,basename:x}=c.useContext(M),y=v!=null&&Ar(p)&&f===!0,g=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,E=m.pathname,S=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(E=E.toLowerCase(),S=S?S.toLowerCase():null,g=g.toLowerCase()),S&&x&&(S=W(S,x)||S);const k=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let A=E===g||!i&&E.startsWith(g)&&E.charAt(k)==="/",U=S!=null&&(S===g||!i&&S.startsWith(g)&&S.charAt(g.length)==="/"),b={isActive:A,isPending:U,isTransitioning:y},q=A?t:void 0,F;typeof n=="function"?F=n(b):F=[n,A?"active":null,U?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let I=typeof u=="function"?u(b):u;return c.createElement(Xe,{...o,"aria-current":q,className:F,ref:d,style:I,to:s,viewTransition:f},typeof l=="function"?l(b):l)});Sr.displayName="NavLink";var br=c.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:i,state:u,method:s=oe,action:f,onSubmit:l,relative:o,preventScrollReset:d,viewTransition:p,...m},v)=>{let{unstable_useTransitions:w}=c.useContext(M),x=kr(),y=$r(f,{relative:o}),g=s.toLowerCase()==="get"?"get":"post",E=typeof f=="string"&&Je.test(f),S=k=>{if(l&&l(k),k.defaultPrevented)return;k.preventDefault();let A=k.nativeEvent.submitter,U=A?.getAttribute("formmethod")||s,b=()=>x(A||k.currentTarget,{fetcherKey:t,method:U,navigate:r,replace:i,state:u,relative:o,preventScrollReset:d,viewTransition:p});w&&r!==!1?c.startTransition(()=>b()):b()};return c.createElement("form",{ref:v,method:g,action:y,onSubmit:n?l:S,...m,"data-discover":!E&&e==="render"?"true":void 0})});br.displayName="Form";function Pr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Qe(e){let t=c.useContext(G);return O(t,Pr(e)),t}function Tr(e,{target:t,replace:r,state:n,preventScrollReset:i,relative:u,viewTransition:s,unstable_useTransitions:f}={}){let l=Ye(),o=z(),d=ee(e,{relative:u});return c.useCallback(p=>{if(ur(p,t)){p.preventDefault();let m=r!==void 0?r:Q(o)===Q(d),v=()=>l(e,{replace:m,state:n,preventScrollReset:i,relative:u,viewTransition:s});f?c.startTransition(()=>v()):v()}},[o,l,d,r,n,t,e,i,u,s,f])}var Lr=0,Or=()=>`__${String(++Lr)}__`;function kr(){let{router:e}=Qe("useSubmit"),{basename:t}=c.useContext(M),r=Xt(),n=e.fetch,i=e.navigate;return c.useCallback(async(u,s={})=>{let{action:f,method:l,encType:o,formData:d,body:p}=cr(u,t);if(s.navigate===!1){let m=s.fetcherKey||Or();await n(m,r,s.action||f,{preventScrollReset:s.preventScrollReset,formData:d,body:p,formMethod:s.method||l,formEncType:s.encType||o,flushSync:s.flushSync})}else await i(s.action||f,{preventScrollReset:s.preventScrollReset,formData:d,body:p,formMethod:s.method||l,formEncType:s.encType||o,replace:s.replace,state:s.state,fromRouteId:r,flushSync:s.flushSync,viewTransition:s.viewTransition})},[n,i,t,r])}function $r(e,{relative:t}={}){let{basename:r}=c.useContext(M),n=c.useContext(H);O(n,"useFormAction must be used inside a RouteContext");let[i]=n.matches.slice(-1),u={...ee(e||".",{relative:t})},s=z();if(e==null){u.search=s.search;let f=new URLSearchParams(u.search),l=f.getAll("index");if(l.some(d=>d==="")){f.delete("index"),l.filter(p=>p).forEach(p=>f.append("index",p));let d=f.toString();u.search=d?`?${d}`:""}}return(!e||e===".")&&i.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:B([r,u.pathname])),Q(u)}function Ar(e,{relative:t}={}){let r=c.useContext(je);O(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=Qe("useViewTransitionState"),i=ee(e,{relative:t});if(!r.isTransitioning)return!1;let u=W(r.currentLocation.pathname,n)||r.currentLocation.pathname,s=W(r.nextLocation.pathname,n)||r.nextLocation.pathname;return ie(i.pathname,s)!=null||ie(i.pathname,u)!=null}export{Fr as B,Xe as L,Sr as N,Hr as O,at as R,Mr as a,Me as b,ut as c,Dr as d,lt as e,Ir as f,Nr as g,Ye as h,Ur as i,tr as j,c as r,z as u};
|
|
//# sourceMappingURL=react-Dt2M6tWj.js.map
|