Build 576754stable
Module 207970
4,839 characters · in 25536.0ec29f5a59959fec.jsDependencies
Source Raw
function(e,t,n){"use strict";var r,o,a,i;function u(e,t){if(!1===e||null==e)throw Error(t)}function l(e,t){if(!e){"u">typeof console&&console.warn(t);try{throw Error(t)}catch(e){}}}function s(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function c(e,t,n){return void 0===n&&(n="/"),function(e,t,n,r){let o=p(("string"==typeof t?s(t):t).pathname||"/",n);if(null==o)return null;let a=function e(t,n,r,o){void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===o&&(o="");let a=(t,a,i)=>{var l,s;let c,h,p={relativePath:void 0===i?t.path||"":i,caseSensitive:!0===t.caseSensitive,childrenIndex:a,route:t};p.relativePath.startsWith("/")&&(u(p.relativePath.startsWith(o),'Absolute route path "'+p.relativePath+'" nested under path "'+o+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),p.relativePath=p.relativePath.slice(o.length));let y=v([o,p.relativePath]),m=r.concat(p);t.children&&t.children.length>0&&(u(!0!==t.index,'Index routes must not have child routes. Please remove all child routes from route path "'+y+'".'),e(t.children,n,m,y)),(null!=t.path||t.index)&&n.push({path:y,score:(l=y,s=t.index,h=(c=l.split("/")).length,c.some(d)&&(h+=-2),s&&(h+=2),c.filter(e=>!d(e)).reduce((e,t)=>e+(f.test(t)?3:""===t?1:10),h)),routesMeta:m})};return t.forEach((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let n of function e(t){let n=t.split("/");if(0===n.length)return[];let[r,...o]=n,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(0===o.length)return a?[i,""]:[i];let u=e(o.join("/")),l=[];return l.push(...u.map(e=>""===e?i:[i,e].join("/"))),a&&l.push(...u),l.map(e=>t.startsWith("/")&&""===e?"/":e)}(e.path))a(e,t,n);else a(e,t)}),n}(e);a.sort((e,t)=>{var n,r;return e.score!==t.score?t.score-e.score:(n=e.routesMeta.map(e=>e.childrenIndex),r=t.routesMeta.map(e=>e.childrenIndex),n.length===r.length&&n.slice(0,-1).every((e,t)=>e===r[t])?n[n.length-1]-r[r.length-1]:0)});let i=null;for(let e=0;null==i&&e<a.length;++e){let t=function(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return l(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}(o);i=function(e,t,n){void 0===n&&(n=!1);let{routesMeta:r}=e,o={},a="/",i=[];for(let e=0;e<r.length;++e){let u=r[e],l=e===r.length-1,s="/"===a?t:t.slice(a.length)||"/",c=h({path:u.relativePath,caseSensitive:u.caseSensitive,end:l},s),f=u.route;if(!c&&l&&n&&!r[r.length-1].route.index&&(c=h({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},s)),!c)return null;Object.assign(o,c.params),i.push({params:o,pathname:v([a,c.pathname]),pathnameBase:y(v([a,c.pathnameBase])),route:f}),"/"!==c.pathnameBase&&(a=v([a,c.pathnameBase]))}return i}(a[e],t,r)}return i}(e,t,n,!1)}n.d(t,{HS:()=>v,Oi:()=>u,Rr:()=>s,pX:()=>g,pb:()=>p,rc:()=>r,tH:()=>m,ue:()=>c}),(a=r||(r={})).Pop="POP",a.Push="PUSH",a.Replace="REPLACE",(i=o||(o={})).data="data",i.deferred="deferred",i.redirect="redirect",i.error="error";let f=/^:[\w-]+$/,d=e=>"*"===e;function h(e,t){var n,r,o;let a,i;"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[u,s]=(n=e.path,r=e.caseSensitive,o=e.end,void 0===r&&(r=!1),void 0===o&&(o=!0),l("*"===n||!n.endsWith("*")||n.endsWith("/*"),'Route path "'+n+'" will be treated as if it were "'+n.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+n.replace(/\*$/,"/*")+'".'),a=[],i="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(a.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")),n.endsWith("*")?(a.push({paramName:"*"}),i+="*"===n||"/*"===n?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?i+="\\/*$":""!==n&&"/"!==n&&(i+="(?:(?=\\/|$))"),[new RegExp(i,r?void 0:"i"),a]),c=t.match(u);if(!c)return null;let f=c[0],d=f.replace(/(.)\/+$/,"$1"),h=c.slice(1);return{params:s.reduce((e,t,n)=>{let{paramName:r,isOptional:o}=t;if("*"===r){let e=h[n]||"";d=f.slice(0,f.length-e.length).replace(/(.)\/+$/,"$1")}let a=h[n];return o&&!a?e[r]=void 0:e[r]=(a||"").replace(/%2F/g,"/"),e},{}),pathname:f,pathnameBase:d,pattern:e}}function p(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}let v=e=>e.join("/").replace(/\/\/+/g,"/"),y=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/");class m extends Error{}function g(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}Symbol("deferred")}