@samanhappy/mcphub 1.0.35 → 1.0.36
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/README.fr.md +2 -1
- package/README.md +8 -5
- package/README.zh.md +7 -4
- package/dist/clients/openapi.js +32 -1
- package/dist/clients/openapi.js.map +1 -1
- package/dist/controllers/credentialBindingController.js +56 -0
- package/dist/controllers/credentialBindingController.js.map +1 -0
- package/dist/controllers/serverController.js +8 -4
- package/dist/controllers/serverController.js.map +1 -1
- package/dist/controllers/userController.js +3 -0
- package/dist/controllers/userController.js.map +1 -1
- package/dist/dao/CredentialBindingDao.js +48 -0
- package/dist/dao/CredentialBindingDao.js.map +1 -0
- package/dist/dao/CredentialBindingDaoDbImpl.js +20 -0
- package/dist/dao/CredentialBindingDaoDbImpl.js.map +1 -0
- package/dist/dao/DaoFactory.js +7 -0
- package/dist/dao/DaoFactory.js.map +1 -1
- package/dist/dao/DatabaseDaoFactory.js +4 -0
- package/dist/dao/DatabaseDaoFactory.js.map +1 -1
- package/dist/dao/ServerDaoDbImpl.js +3 -0
- package/dist/dao/ServerDaoDbImpl.js.map +1 -1
- package/dist/db/entities/CredentialBinding.js +33 -0
- package/dist/db/entities/CredentialBinding.js.map +1 -0
- package/dist/db/entities/Server.js +4 -0
- package/dist/db/entities/Server.js.map +1 -1
- package/dist/db/entities/index.js +3 -1
- package/dist/db/entities/index.js.map +1 -1
- package/dist/middlewares/auth.js +2 -0
- package/dist/middlewares/auth.js.map +1 -1
- package/dist/middlewares/i18n.js +2 -1
- package/dist/middlewares/i18n.js.map +1 -1
- package/dist/routes/index.js +15 -1
- package/dist/routes/index.js.map +1 -1
- package/dist/services/activityLoggingService.js +21 -8
- package/dist/services/activityLoggingService.js.map +1 -1
- package/dist/services/credentialBindingService.js +193 -0
- package/dist/services/credentialBindingService.js.map +1 -0
- package/dist/services/mcpService.js +429 -65
- package/dist/services/mcpService.js.map +1 -1
- package/dist/services/principalRuntimeService.js +109 -0
- package/dist/services/principalRuntimeService.js.map +1 -0
- package/dist/services/serverConfigPresenter.js +3 -0
- package/dist/services/serverConfigPresenter.js.map +1 -1
- package/dist/services/sseService.js +2 -9
- package/dist/services/sseService.js.map +1 -1
- package/dist/utils/credentialTemplate.js +38 -0
- package/dist/utils/credentialTemplate.js.map +1 -0
- package/dist/utils/migration.js +9 -0
- package/dist/utils/migration.js.map +1 -1
- package/dist/utils/serverConfigPersistence.js +2 -0
- package/dist/utils/serverConfigPersistence.js.map +1 -1
- package/frontend/dist/assets/{ActivityPage-B4OBJUBq.js → ActivityPage-ZRx6b9hm.js} +2 -2
- package/frontend/dist/assets/{ActivityPage-B4OBJUBq.js.map → ActivityPage-ZRx6b9hm.js.map} +1 -1
- package/frontend/dist/assets/{ConfirmDialog-3APts2Y9.js → ConfirmDialog-uWBwm8J1.js} +2 -2
- package/frontend/dist/assets/{ConfirmDialog-3APts2Y9.js.map → ConfirmDialog-uWBwm8J1.js.map} +1 -1
- package/frontend/dist/assets/CredentialsPage-C9vnh01H.js +2 -0
- package/frontend/dist/assets/CredentialsPage-C9vnh01H.js.map +1 -0
- package/frontend/dist/assets/{Dashboard-czP-DGHn.js → Dashboard-BDGDQNz1.js} +2 -2
- package/frontend/dist/assets/{Dashboard-czP-DGHn.js.map → Dashboard-BDGDQNz1.js.map} +1 -1
- package/frontend/dist/assets/{DeleteDialog-D9ycSRvn.js → DeleteDialog-BYhrMGZo.js} +2 -2
- package/frontend/dist/assets/{DeleteDialog-D9ycSRvn.js.map → DeleteDialog-BYhrMGZo.js.map} +1 -1
- package/frontend/dist/assets/{EndpointCopy-CDwtdCHE.js → EndpointCopy-BY51t0Ks.js} +2 -2
- package/frontend/dist/assets/{EndpointCopy-CDwtdCHE.js.map → EndpointCopy-BY51t0Ks.js.map} +1 -1
- package/frontend/dist/assets/{GroupsPage-BgUHjkGb.js → GroupsPage-DyHyW7NW.js} +2 -2
- package/frontend/dist/assets/GroupsPage-DyHyW7NW.js.map +1 -0
- package/frontend/dist/assets/{LoginPage-BBzViqLx.js → LoginPage-CZOKlkR_.js} +2 -2
- package/frontend/dist/assets/{LoginPage-BBzViqLx.js.map → LoginPage-CZOKlkR_.js.map} +1 -1
- package/frontend/dist/assets/{LogsPage-CqbaqFiQ.js → LogsPage-FDWOOIPg.js} +2 -2
- package/frontend/dist/assets/{LogsPage-CqbaqFiQ.js.map → LogsPage-FDWOOIPg.js.map} +1 -1
- package/frontend/dist/assets/{MarketPage-DinCKwrj.js → MarketPage-DKfZgoIs.js} +2 -2
- package/frontend/dist/assets/{MarketPage-DinCKwrj.js.map → MarketPage-DKfZgoIs.js.map} +1 -1
- package/frontend/dist/assets/{OAuthConsentPage-BuPcJ2zS.js → OAuthConsentPage-Hk_DJ0dW.js} +2 -2
- package/frontend/dist/assets/{OAuthConsentPage-BuPcJ2zS.js.map → OAuthConsentPage-Hk_DJ0dW.js.map} +1 -1
- package/frontend/dist/assets/{Pagination-Dwko3g48.js → Pagination-CLUvn47x.js} +2 -2
- package/frontend/dist/assets/{Pagination-Dwko3g48.js.map → Pagination-CLUvn47x.js.map} +1 -1
- package/frontend/dist/assets/{PromptsPage-CJ-wYRAL.js → PromptsPage-CT0C0_BI.js} +2 -2
- package/frontend/dist/assets/{PromptsPage-CJ-wYRAL.js.map → PromptsPage-CT0C0_BI.js.map} +1 -1
- package/frontend/dist/assets/{ResourcesPage-DRV8gnZV.js → ResourcesPage-CBgu-N5m.js} +2 -2
- package/frontend/dist/assets/{ResourcesPage-DRV8gnZV.js.map → ResourcesPage-CBgu-N5m.js.map} +1 -1
- package/frontend/dist/assets/ServersPage-CvcP8LFv.js +39 -0
- package/frontend/dist/assets/ServersPage-CvcP8LFv.js.map +1 -0
- package/frontend/dist/assets/{SettingsPage-Czv4OhtK.js → SettingsPage-DDSVt_xk.js} +2 -2
- package/frontend/dist/assets/{SettingsPage-Czv4OhtK.js.map → SettingsPage-DDSVt_xk.js.map} +1 -1
- package/frontend/dist/assets/{StatusDot-CwpmIlJi.js → StatusDot-uIIW4IuH.js} +2 -2
- package/frontend/dist/assets/{StatusDot-CwpmIlJi.js.map → StatusDot-uIIW4IuH.js.map} +1 -1
- package/frontend/dist/assets/{ToggleGroup-1qFTkDqh.js → ToggleGroup-BToroeZy.js} +2 -2
- package/frontend/dist/assets/{ToggleGroup-1qFTkDqh.js.map → ToggleGroup-BToroeZy.js.map} +1 -1
- package/frontend/dist/assets/{UsersPage-CAMXgywh.js → UsersPage-BjgJjf6L.js} +2 -2
- package/frontend/dist/assets/{UsersPage-CAMXgywh.js.map → UsersPage-BjgJjf6L.js.map} +1 -1
- package/frontend/dist/assets/{framework-vendor-BHAQX05P.js → framework-vendor-_YL27Pfc.js} +2 -2
- package/frontend/dist/assets/{framework-vendor-BHAQX05P.js.map → framework-vendor-_YL27Pfc.js.map} +1 -1
- package/frontend/dist/assets/{i18n-vendor-CMcB7XUR.js → i18n-vendor-BMaj5qV8.js} +2 -2
- package/frontend/dist/assets/{i18n-vendor-CMcB7XUR.js.map → i18n-vendor-BMaj5qV8.js.map} +1 -1
- package/frontend/dist/assets/{icons-vendor-HZHHWeTa.js → icons-vendor-VW-UwEhw.js} +3 -3
- package/frontend/dist/assets/{icons-vendor-HZHHWeTa.js.map → icons-vendor-VW-UwEhw.js.map} +1 -1
- package/frontend/dist/assets/{index-DtrCVU1h.css → index-B3OqAhGz.css} +1 -1
- package/frontend/dist/assets/index-DjNOC0Ov.js +3 -0
- package/frontend/dist/assets/index-DjNOC0Ov.js.map +1 -0
- package/frontend/dist/assets/{resourceService-BTVgor9F.js → resourceService-sD9dxx3E.js} +2 -2
- package/frontend/dist/assets/{resourceService-BTVgor9F.js.map → resourceService-sD9dxx3E.js.map} +1 -1
- package/frontend/dist/assets/{useCostData-CDVGUx_e.js → useCostData-QoPbsqyD.js} +2 -2
- package/frontend/dist/assets/{useCostData-CDVGUx_e.js.map → useCostData-QoPbsqyD.js.map} +1 -1
- package/frontend/dist/assets/useSettingsData-C4JrLqDh.js +2 -0
- package/frontend/dist/assets/{useSettingsData-92nglN_X.js.map → useSettingsData-C4JrLqDh.js.map} +1 -1
- package/frontend/dist/assets/variableDetection-iFAhGAKs.js +16 -0
- package/frontend/dist/assets/variableDetection-iFAhGAKs.js.map +1 -0
- package/frontend/dist/index.html +5 -5
- package/package.json +4 -5
- package/frontend/dist/assets/GroupsPage-BgUHjkGb.js.map +0 -1
- package/frontend/dist/assets/ServersPage-CbtcAcVH.js +0 -39
- package/frontend/dist/assets/ServersPage-CbtcAcVH.js.map +0 -1
- package/frontend/dist/assets/index-Cb6IBpZR.js +0 -3
- package/frontend/dist/assets/index-Cb6IBpZR.js.map +0 -1
- package/frontend/dist/assets/useSettingsData-92nglN_X.js +0 -2
- package/frontend/dist/assets/variableDetection-BlOwsGsz.js +0 -16
- package/frontend/dist/assets/variableDetection-BlOwsGsz.js.map +0 -1
|
@@ -57,5 +57,5 @@ Error generating stack: `+a.message+`
|
|
|
57
57
|
* @license MIT
|
|
58
58
|
*/var or=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,kh=/^[\\/]{2}/;function n0(i,c){return c+i.replace(/\\/g,"/")}var Nh="popstate";function Hh(i){return typeof i=="object"&&i!=null&&"pathname"in i&&"search"in i&&"hash"in i&&"state"in i&&"key"in i}function u0(i={}){function c(r,d){var m;let h=(m=d.state)==null?void 0:m.masked,{pathname:v,search:E,hash:y}=h||r.location;return ur("",{pathname:v,search:E,hash:y},d.state&&d.state.usr||null,d.state&&d.state.key||"default",h?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function s(r,d){return typeof d=="string"?d:Gn(d)}return c0(c,s,null,i)}function Ct(i,c){if(i===!1||i===null||typeof i>"u")throw new Error(c)}function Ue(i,c){if(!i){typeof console<"u"&&console.warn(c);try{throw new Error(c)}catch{}}}function i0(){return Math.random().toString(36).substring(2,10)}function xh(i,c){return{usr:i.state,key:i.key,idx:c,masked:i.mask?{pathname:i.pathname,search:i.search,hash:i.hash}:void 0}}function ur(i,c,s=null,r,d){return{pathname:typeof i=="string"?i:i.pathname,search:"",hash:"",...typeof c=="string"?Ya(c):c,state:s,key:c&&c.key||r||i0(),mask:d}}function Gn({pathname:i="/",search:c="",hash:s=""}){return c&&c!=="?"&&(i+=c.charAt(0)==="?"?c:"?"+c),s&&s!=="#"&&(i+=s.charAt(0)==="#"?s:"#"+s),i}function Ya(i){let c={};if(i){let s=i.indexOf("#");s>=0&&(c.hash=i.substring(s),i=i.substring(0,s));let r=i.indexOf("?");r>=0&&(c.search=i.substring(r),i=i.substring(0,r)),i&&(c.pathname=i)}return c}function c0(i,c,s,r={}){let{window:d=document.defaultView,v5Compat:h=!1}=r,v=d.history,E="POP",y=null,m=p();m==null&&(m=0,v.replaceState({...v.state,idx:m},""));function p(){return(v.state||{idx:null}).idx}function R(){E="POP";let L=p(),q=L==null?null:L-m;m=L,y&&y({action:E,location:j.location,delta:q})}function D(L,q){E="PUSH";let F=Hh(L)?L:ur(j.location,L,q);m=p()+1;let V=xh(F,m),W=j.createHref(F.mask||F);try{v.pushState(V,"",W)}catch(nt){if(nt instanceof DOMException&&nt.name==="DataCloneError")throw nt;d.location.assign(W)}h&&y&&y({action:E,location:j.location,delta:1})}function B(L,q){E="REPLACE";let F=Hh(L)?L:ur(j.location,L,q);m=p();let V=xh(F,m),W=j.createHref(F.mask||F);v.replaceState(V,"",W),h&&y&&y({action:E,location:j.location,delta:0})}function Y(L){return f0(d,L)}let j={get action(){return E},get location(){return i(d,v)},listen(L){if(y)throw new Error("A history only accepts one active listener");return d.addEventListener(Nh,R),y=L,()=>{d.removeEventListener(Nh,R),y=null}},createHref(L){return c(d,L)},createURL:Y,encodeLocation(L){let q=Y(L);return{pathname:q.pathname,search:q.search,hash:q.hash}},push:D,replace:B,go(L){return v.go(L)}};return j}function f0(i,c,s=!1){let r="http://localhost";i&&(r=i.location.origin!=="null"?i.location.origin:i.location.href),Ct(r,"No window.location.(origin|href) available to create URL");let d=typeof c=="string"?c:Gn(c);return d=d.replace(/ $/,"%20"),!s&&kh.test(d)&&(d=r+d),new URL(d,r)}function Fh(i,c,s="/"){return r0(i,c,s,!1)}function r0(i,c,s,r,d){let h=typeof c=="string"?Ya(c):c,v=il(h.pathname||"/",s);if(v==null)return null;let E=s0(i),y=null,m=E0(v);for(let p=0;y==null&&p<E.length;++p)y=b0(E[p],m,r);return y}function s0(i){let c=Ph(i);return o0(c),c}function Ph(i,c=[],s=[],r="",d=!1){let h=(v,E,y=d,m)=>{let p={relativePath:m===void 0?v.path||"":m,caseSensitive:v.caseSensitive===!0,childrenIndex:E,route:v};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&y)return;Ct(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let R=Le([r,p.relativePath]),D=s.concat(p);v.children&&v.children.length>0&&(Ct(v.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${R}".`),Ph(v.children,c,D,R,y)),!(v.path==null&&!v.index)&&c.push({path:R,score:p0(R,v.index),routesMeta:D.map((B,Y)=>{let[j,L]=em(B.relativePath,B.caseSensitive,Y===D.length-1);return{...B,matcher:j,compiledParams:L}})})};return i.forEach((v,E)=>{var y;if(v.path===""||!((y=v.path)!=null&&y.includes("?")))h(v,E);else for(let m of Ih(v.path))h(v,E,!0,m)}),c}function Ih(i){let c=i.split("/");if(c.length===0)return[];let[s,...r]=c,d=s.endsWith("?"),h=s.replace(/\?$/,"");if(r.length===0)return d?[h,""]:[h];let v=Ih(r.join("/")),E=[];return E.push(...v.map(y=>y===""?h:[h,y].join("/"))),d&&E.push(...v),E.map(y=>i.startsWith("/")&&y===""?"/":y)}function o0(i){i.sort((c,s)=>c.score!==s.score?s.score-c.score:S0(c.routesMeta.map(r=>r.childrenIndex),s.routesMeta.map(r=>r.childrenIndex)))}var d0=/^:[\w-]+$/,h0=3,m0=2,y0=1,v0=10,g0=-2,Lh=i=>i==="*";function p0(i,c){let s=i.split("/"),r=s.length;return s.some(Lh)&&(r+=g0),c&&(r+=m0),s.filter(d=>!Lh(d)).reduce((d,h)=>d+(d0.test(h)?h0:h===""?y0:v0),r)}function S0(i,c){return i.length===c.length&&i.slice(0,-1).every((r,d)=>r===c[d])?i[i.length-1]-c[c.length-1]:0}function b0(i,c,s=!1){let{routesMeta:r}=i,d={},h="/",v=[];for(let E=0;E<r.length;++E){let y=r[E],m=E===r.length-1,p=h==="/"?c:c.slice(h.length)||"/",R={path:y.relativePath,caseSensitive:y.caseSensitive,end:m},D=y.matcher&&y.compiledParams?tm(R,p,y.matcher,y.compiledParams):vi(R,p),B=y.route;if(!D&&m&&s&&!r[r.length-1].route.index&&(D=vi({path:y.relativePath,caseSensitive:y.caseSensitive,end:!1},p)),!D)return null;Object.assign(d,D.params),v.push({params:d,pathname:Le([h,D.pathname]),pathnameBase:_0(Le([h,D.pathnameBase])),route:B}),D.pathnameBase!=="/"&&(h=Le([h,D.pathnameBase]))}return v}function vi(i,c){typeof i=="string"&&(i={path:i,caseSensitive:!1,end:!0});let[s,r]=em(i.path,i.caseSensitive,i.end);return tm(i,c,s,r)}function tm(i,c,s,r){let d=c.match(s);if(!d)return null;let h=d[0],v=h.replace(/(.)\/+$/,"$1"),E=d.slice(1);return{params:r.reduce((m,{paramName:p,isOptional:R},D)=>{if(p==="*"){let Y=E[D]||"";v=h.slice(0,h.length-Y.length).replace(/(.)\/+$/,"$1")}const B=E[D];return R&&!B?m[p]=void 0:m[p]=(B||"").replace(/%2F/g,"/"),m},{}),pathname:h,pathnameBase:v,pattern:i}}function em(i,c=!1,s=!0){Ue(i==="*"||!i.endsWith("*")||i.endsWith("/*"),`Route path "${i}" will be treated as if it were "${i.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${i.replace(/\*$/,"/*")}".`);let r=[],d="^"+i.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(v,E,y,m,p)=>{if(r.push({paramName:E,isOptional:y!=null}),y){let R=p.charAt(m+v.length);return R&&R!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return i.endsWith("*")?(r.push({paramName:"*"}),d+=i==="*"||i==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?d+="\\/*$":i!==""&&i!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,c?void 0:"i"),r]}function E0(i){try{return i.split("/").map(c=>decodeURIComponent(c).replace(/\//g,"%2F")).join("/")}catch(c){return Ue(!1,`The URL path "${i}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${c}).`),i}}function il(i,c){if(c==="/")return i;if(!i.toLowerCase().startsWith(c.toLowerCase()))return null;let s=c.endsWith("/")?c.length-1:c.length,r=i.charAt(s);return r&&r!=="/"?null:i.slice(s)||"/"}function T0(i,c="/"){let{pathname:s,search:r="",hash:d=""}=typeof i=="string"?Ya(i):i,h;return s?(s=lm(s),s.startsWith("/")?h=Bh(s.substring(1),"/"):h=Bh(s,c)):h=c,{pathname:h,search:A0(r),hash:O0(d)}}function Bh(i,c){let s=gi(c).split("/");return i.split("/").forEach(d=>{d===".."?s.length>1&&s.pop():d!=="."&&s.push(d)}),s.length>1?s.join("/"):"/"}function $f(i,c,s,r){return`Cannot include a '${i}' character in a manually specified \`to.${c}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function R0(i){return i.filter((c,s)=>s===0||c.route.path&&c.route.path.length>0)}function dr(i){let c=R0(i);return c.map((s,r)=>r===c.length-1?s.pathname:s.pathnameBase)}function Si(i,c,s,r=!1){let d;typeof i=="string"?d=Ya(i):(d={...i},Ct(!d.pathname||!d.pathname.includes("?"),$f("?","pathname","search",d)),Ct(!d.pathname||!d.pathname.includes("#"),$f("#","pathname","hash",d)),Ct(!d.search||!d.search.includes("#"),$f("#","search","hash",d)));let h=i===""||d.pathname==="",v=h?"/":d.pathname,E;if(v==null)E=s;else{let R=c.length-1;if(!r&&v.startsWith("..")){let D=v.split("/");for(;D[0]==="..";)D.shift(),R-=1;d.pathname=D.join("/")}E=R>=0?c[R]:"/"}let y=T0(d,E),m=v&&v!=="/"&&v.endsWith("/"),p=(h||v===".")&&s.endsWith("/");return!y.pathname.endsWith("/")&&(m||p)&&(y.pathname+="/"),y}var lm=i=>i.replace(/[\\/]{2,}/g,"/"),Le=i=>lm(i.join("/")),gi=i=>i.replace(/\/+$/,""),_0=i=>gi(i).replace(/^\/*/,"/"),A0=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,O0=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i,z0=class{constructor(i,c,s,r=!1){this.status=i,this.statusText=c||"",this.internal=r,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function U0(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}function M0(i){let c=i.map(s=>s.route.path).filter(Boolean);return Le(c)||"/"}var am=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nm(i,c){let s=i;if(typeof s!="string"||!or.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let r=s,d=!1;if(am)try{let h=new URL(window.location.href),v=kh.test(s)?new URL(n0(s,h.protocol)):new URL(s),E=il(v.pathname,c);v.origin===h.origin&&E!=null?s=E+v.search+v.hash:d=!0}catch{Ue(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:d,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var um=["POST","PUT","PATCH","DELETE"];new Set(um);var D0=["GET",...um];new Set(D0);var C0=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function N0(i){try{return C0.includes(new URL(i).protocol)}catch{return!1}}var wa=U.createContext(null);wa.displayName="DataRouter";var bi=U.createContext(null);bi.displayName="DataRouterState";var im=U.createContext(!1);function H0(){return U.useContext(im)}var cm=U.createContext({isTransitioning:!1});cm.displayName="ViewTransition";var x0=U.createContext(new Map);x0.displayName="Fetchers";var L0=U.createContext(null);L0.displayName="Await";var ge=U.createContext(null);ge.displayName="Navigation";var Xn=U.createContext(null);Xn.displayName="Location";var Me=U.createContext({outlet:null,matches:[],isDataRoute:!1});Me.displayName="Route";var hr=U.createContext(null);hr.displayName="RouteError";var fm="REACT_ROUTER_ERROR",B0="REDIRECT",q0="ROUTE_ERROR_RESPONSE";function j0(i){if(i.startsWith(`${fm}:${B0}:{`))try{let c=JSON.parse(i.slice(28));if(typeof c=="object"&&c&&typeof c.status=="number"&&typeof c.statusText=="string"&&typeof c.location=="string"&&typeof c.reloadDocument=="boolean"&&typeof c.replace=="boolean")return c}catch{}}function Y0(i){if(i.startsWith(`${fm}:${q0}:{`))try{let c=JSON.parse(i.slice(40));if(typeof c=="object"&&c&&typeof c.status=="number"&&typeof c.statusText=="string")return new z0(c.status,c.statusText,c.data)}catch{}}function w0(i,{relative:c}={}){Ct(Ga(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:r}=U.useContext(ge),{hash:d,pathname:h,search:v}=Qn(i,{relative:c}),E=h;return s!=="/"&&(E=h==="/"?s:Le([s,h])),r.createHref({pathname:E,search:v,hash:d})}function Ga(){return U.useContext(Xn)!=null}function Be(){return Ct(Ga(),"useLocation() may be used only in the context of a <Router> component."),U.useContext(Xn).location}var rm="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function sm(i){U.useContext(ge).static||U.useLayoutEffect(i)}function mr(){let{isDataRoute:i}=U.useContext(Me);return i?eg():G0()}function G0(){Ct(Ga(),"useNavigate() may be used only in the context of a <Router> component.");let i=U.useContext(wa),{basename:c,navigator:s}=U.useContext(ge),{matches:r}=U.useContext(Me),{pathname:d}=Be(),h=JSON.stringify(dr(r)),v=U.useRef(!1);return sm(()=>{v.current=!0}),U.useCallback((y,m={})=>{if(Ue(v.current,rm),!v.current)return;if(typeof y=="number"){s.go(y);return}let p=Si(y,JSON.parse(h),d,m.relative==="path");i==null&&c!=="/"&&(p.pathname=p.pathname==="/"?c:Le([c,p.pathname])),(m.replace?s.replace:s.push)(p,m.state,m)},[c,s,h,d,i])}var X0=U.createContext(null);function Q0(i){let c=U.useContext(Me).outlet;return U.useMemo(()=>c&&U.createElement(X0.Provider,{value:i},c),[c,i])}function fS(){let{matches:i}=U.useContext(Me),c=i[i.length-1];return(c==null?void 0:c.params)??{}}function Qn(i,{relative:c}={}){let{matches:s}=U.useContext(Me),{pathname:r}=Be(),d=JSON.stringify(dr(s));return U.useMemo(()=>Si(i,JSON.parse(d),r,c==="path"),[i,d,r,c])}function Z0(i,c){return om(i,c)}function om(i,c,s){var L;Ct(Ga(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=U.useContext(ge),{matches:d}=U.useContext(Me),h=d[d.length-1],v=h?h.params:{},E=h?h.pathname:"/",y=h?h.pathnameBase:"/",m=h&&h.route;{let q=m&&m.path||"";hm(E,!m||q.endsWith("*")||q.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${E}" (under <Route path="${q}">) 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.
|
|
59
59
|
|
|
60
|
-
Please change the parent <Route path="${q}"> to <Route path="${q==="/"?"*":`${q}/*`}">.`)}let p=Be(),R;if(c){let q=typeof c=="string"?Ya(c):c;Ct(y==="/"||((L=q.pathname)==null?void 0:L.startsWith(y)),`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 "${y}" but pathname "${q.pathname}" was given in the \`location\` prop.`),R=q}else R=p;let D=R.pathname||"/",B=D;if(y!=="/"){let q=y.replace(/^\//,"").split("/");B="/"+D.replace(/^\//,"").split("/").slice(q.length).join("/")}let Y=s&&s.state.matches.length?s.state.matches.map(q=>Object.assign(q,{route:s.manifest[q.route.id]||q.route})):Fh(i,{pathname:B});Ue(m||Y!=null,`No routes matched location "${R.pathname}${R.search}${R.hash}" `),Ue(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 "${R.pathname}${R.search}${R.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 j=W0(Y&&Y.map(q=>Object.assign({},q,{params:Object.assign({},v,q.params),pathname:Le([y,r.encodeLocation?r.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?y:Le([y,r.encodeLocation?r.encodeLocation(q.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathnameBase])})),d,s);return c&&j?U.createElement(Xn.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...R},navigationType:"POP"}},j):j}function V0(){let i=tg(),c=U0(i)?`${i.status} ${i.statusText}`:i instanceof Error?i.message:JSON.stringify(i),s=i instanceof Error?i.stack:null,r="rgba(200,200,200, 0.5)",d={padding:"0.5rem",backgroundColor:r},h={padding:"2px 4px",backgroundColor:r},v=null;return console.error("Error handled by React Router default ErrorBoundary:",i),v=U.createElement(U.Fragment,null,U.createElement("p",null,"💿 Hey developer 👋"),U.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",U.createElement("code",{style:h},"ErrorBoundary")," or"," ",U.createElement("code",{style:h},"errorElement")," prop on your route.")),U.createElement(U.Fragment,null,U.createElement("h2",null,"Unexpected Application Error!"),U.createElement("h3",{style:{fontStyle:"italic"}},c),s?U.createElement("pre",{style:d},s):null,v)}var J0=U.createElement(V0,null),dm=class extends U.Component{constructor(i){super(i),this.state={location:i.location,revalidation:i.revalidation,error:i.error}}static getDerivedStateFromError(i){return{error:i}}static getDerivedStateFromProps(i,c){return c.location!==i.location||c.revalidation!=="idle"&&i.revalidation==="idle"?{error:i.error,location:i.location,revalidation:i.revalidation}:{error:i.error!==void 0?i.error:c.error,location:c.location,revalidation:i.revalidation||c.revalidation}}componentDidCatch(i,c){this.props.onError?this.props.onError(i,c):console.error("React Router caught the following error during render",i)}render(){let i=this.state.error;if(this.context&&typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){const s=Y0(i.digest);s&&(i=s)}let c=i!==void 0?U.createElement(Me.Provider,{value:this.props.routeContext},U.createElement(hr.Provider,{value:i,children:this.props.component})):this.props.children;return this.context?U.createElement(K0,{error:i},c):c}};dm.contextType=im;var Wf=new WeakMap;function K0({children:i,error:c}){let{basename:s}=U.useContext(ge);if(typeof c=="object"&&c&&"digest"in c&&typeof c.digest=="string"){let r=j0(c.digest);if(r){let d=Wf.get(c);if(d)throw d;let h=nm(r.location,s),v=h.absoluteURL||h.to;if(N0(v))throw new Error("Invalid redirect location");if(am&&!Wf.get(c))if(h.isExternal||r.reloadDocument)window.location.href=v;else{const E=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(h.to,{replace:r.replace}));throw Wf.set(c,E),E}return U.createElement("meta",{httpEquiv:"refresh",content:`0;url=${v}`})}}return i}function $0({routeContext:i,match:c,children:s}){let r=U.useContext(wa);return r&&r.static&&r.staticContext&&(c.route.errorElement||c.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=c.route.id),U.createElement(Me.Provider,{value:i},s)}function W0(i,c=[],s){let r=s==null?void 0:s.state;if(i==null){if(!r)return null;if(r.errors)i=r.matches;else if(c.length===0&&!r.initialized&&r.matches.length>0)i=r.matches;else return null}let d=i,h=r==null?void 0:r.errors;if(h!=null){let p=d.findIndex(R=>R.route.id&&(h==null?void 0:h[R.route.id])!==void 0);Ct(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(h).join(",")}`),d=d.slice(0,Math.min(d.length,p+1))}let v=!1,E=-1;if(s&&r){v=r.renderFallback;for(let p=0;p<d.length;p++){let R=d[p];if((R.route.HydrateFallback||R.route.hydrateFallbackElement)&&(E=p),R.route.id){let{loaderData:D,errors:B}=r,Y=R.route.loader&&!D.hasOwnProperty(R.route.id)&&(!B||B[R.route.id]===void 0);if(R.route.lazy||Y){s.isStatic&&(v=!0),E>=0?d=d.slice(0,E+1):d=[d[0]];break}}}}let y=s==null?void 0:s.onError,m=r&&y?(p,R)=>{var D,B;y(p,{location:r.location,params:((B=(D=r.matches)==null?void 0:D[0])==null?void 0:B.params)??{},pattern:M0(r.matches),errorInfo:R})}:void 0;return d.reduceRight((p,R,D)=>{let B,Y=!1,j=null,L=null;r&&(B=h&&R.route.id?h[R.route.id]:void 0,j=R.route.errorElement||J0,v&&(E<0&&D===0?(hm("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),Y=!0,L=null):E===D&&(Y=!0,L=R.route.hydrateFallbackElement||null)));let q=c.concat(d.slice(0,D+1)),F=()=>{let V;return B?V=j:Y?V=L:R.route.Component?V=U.createElement(R.route.Component,null):R.route.element?V=R.route.element:V=p,U.createElement($0,{match:R,routeContext:{outlet:p,matches:q,isDataRoute:r!=null},children:V})};return r&&(R.route.ErrorBoundary||R.route.errorElement||D===0)?U.createElement(dm,{location:r.location,revalidation:r.revalidation,component:j,error:B,children:F(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:m}):F()},null)}function yr(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function k0(i){let c=U.useContext(wa);return Ct(c,yr(i)),c}function F0(i){let c=U.useContext(bi);return Ct(c,yr(i)),c}function P0(i){let c=U.useContext(Me);return Ct(c,yr(i)),c}function vr(i){let c=P0(i),s=c.matches[c.matches.length-1];return Ct(s.route.id,`${i} can only be used on routes that contain a unique "id"`),s.route.id}function I0(){return vr("useRouteId")}function tg(){var r;let i=U.useContext(hr),c=F0("useRouteError"),s=vr("useRouteError");return i!==void 0?i:(r=c.errors)==null?void 0:r[s]}function eg(){let{router:i}=k0("useNavigate"),c=vr("useNavigate"),s=U.useRef(!1);return sm(()=>{s.current=!0}),U.useCallback(async(d,h={})=>{Ue(s.current,rm),s.current&&(typeof d=="number"?await i.navigate(d):await i.navigate(d,{fromRouteId:c,...h}))},[i,c])}var qh={};function hm(i,c,s){!c&&!qh[i]&&(qh[i]=!0,Ue(!1,s))}U.memo(lg);function lg({routes:i,manifest:c,future:s,state:r,isStatic:d,onError:h}){return om(i,void 0,{manifest:c,state:r,isStatic:d,onError:h})}function rS({to:i,replace:c,state:s,relative:r}){Ct(Ga(),"<Navigate> may be used only in the context of a <Router> component.");let{static:d}=U.useContext(ge);Ue(!d,"<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:h}=U.useContext(Me),{pathname:v}=Be(),E=mr(),y=Si(i,dr(h),v,r==="path"),m=JSON.stringify(y);return U.useEffect(()=>{E(JSON.parse(m),{replace:c,state:s,relative:r})},[E,m,r,c,s]),null}function sS(i){return Q0(i.context)}function ag(i){Ct(!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 ng({basename:i="/",children:c=null,location:s,navigationType:r="POP",navigator:d,static:h=!1,useTransitions:v}){Ct(!Ga(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let E=i.replace(/^\/*/,"/"),y=U.useMemo(()=>({basename:E,navigator:d,static:h,useTransitions:v,future:{}}),[E,d,h,v]);typeof s=="string"&&(s=Ya(s));let{pathname:m="/",search:p="",hash:R="",state:D=null,key:B="default",mask:Y}=s,j=U.useMemo(()=>{let L=il(m,E);return L==null?null:{location:{pathname:L,search:p,hash:R,state:D,key:B,mask:Y},navigationType:r}},[E,m,p,R,D,B,r,Y]);return Ue(j!=null,`<Router basename="${E}"> is not able to match the URL "${m}${p}${R}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:U.createElement(ge.Provider,{value:y},U.createElement(Xn.Provider,{children:c,value:j}))}function oS({children:i,location:c}){return Z0(ir(i),c)}function ir(i,c=[]){let s=[];return U.Children.forEach(i,(r,d)=>{if(!U.isValidElement(r))return;let h=[...c,d];if(r.type===U.Fragment){s.push.apply(s,ir(r.props.children,h));return}Ct(r.type===ag,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ct(!r.props.index||!r.props.children,"An index route cannot have child routes.");let v={id:r.props.id||h.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(v.children=ir(r.props.children,h)),s.push(v)}),s}var oi="get",di="application/x-www-form-urlencoded";function Ei(i){return typeof HTMLElement<"u"&&i instanceof HTMLElement}function ug(i){return Ei(i)&&i.tagName.toLowerCase()==="button"}function ig(i){return Ei(i)&&i.tagName.toLowerCase()==="form"}function cg(i){return Ei(i)&&i.tagName.toLowerCase()==="input"}function fg(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function rg(i,c){return i.button===0&&(!c||c==="_self")&&!fg(i)}function cr(i=""){return new URLSearchParams(typeof i=="string"||Array.isArray(i)||i instanceof URLSearchParams?i:Object.keys(i).reduce((c,s)=>{let r=i[s];return c.concat(Array.isArray(r)?r.map(d=>[s,d]):[[s,r]])},[]))}function sg(i,c){let s=cr(i);return c&&c.forEach((r,d)=>{s.has(d)||c.getAll(d).forEach(h=>{s.append(d,h)})}),s}var fi=null;function og(){if(fi===null)try{new FormData(document.createElement("form"),0),fi=!1}catch{fi=!0}return fi}var dg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function kf(i){return i!=null&&!dg.has(i)?(Ue(!1,`"${i}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${di}"`),null):i}function hg(i,c){let s,r,d,h,v;if(ig(i)){let E=i.getAttribute("action");r=E?il(E,c):null,s=i.getAttribute("method")||oi,d=kf(i.getAttribute("enctype"))||di,h=new FormData(i)}else if(ug(i)||cg(i)&&(i.type==="submit"||i.type==="image")){let E=i.form;if(E==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let y=i.getAttribute("formaction")||E.getAttribute("action");if(r=y?il(y,c):null,s=i.getAttribute("formmethod")||E.getAttribute("method")||oi,d=kf(i.getAttribute("formenctype"))||kf(E.getAttribute("enctype"))||di,h=new FormData(E,i),!og()){let{name:m,type:p,value:R}=i;if(p==="image"){let D=m?`${m}.`:"";h.append(`${D}x`,"0"),h.append(`${D}y`,"0")}else m&&h.append(m,R)}}else{if(Ei(i))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=oi,r=null,d=di,v=i}return h&&d==="text/plain"&&(v=h,h=void 0),{action:r,method:s.toLowerCase(),encType:d,formData:h,body:v}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function gr(i,c){if(i===!1||i===null||typeof i>"u")throw new Error(c)}function mm(i,c,s,r){let d=typeof i=="string"?new URL(i,typeof window>"u"?"server://singlefetch/":window.location.origin):i;return s?d.pathname.endsWith("/")?d.pathname=`${d.pathname}_.${r}`:d.pathname=`${d.pathname}.${r}`:d.pathname==="/"?d.pathname=`_root.${r}`:c&&il(d.pathname,c)==="/"?d.pathname=`${gi(c)}/_root.${r}`:d.pathname=`${gi(d.pathname)}.${r}`,d}async function mg(i,c){if(i.id in c)return c[i.id];try{let s=await import(i.module);return c[i.id]=s,s}catch(s){return console.error(`Error loading route module \`${i.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function yg(i){return i==null?!1:i.href==null?i.rel==="preload"&&typeof i.imageSrcSet=="string"&&typeof i.imageSizes=="string":typeof i.rel=="string"&&typeof i.href=="string"}async function vg(i,c,s){let r=await Promise.all(i.map(async d=>{let h=c.routes[d.route.id];if(h){let v=await mg(h,s);return v.links?v.links():[]}return[]}));return bg(r.flat(1).filter(yg).filter(d=>d.rel==="stylesheet"||d.rel==="preload").map(d=>d.rel==="stylesheet"?{...d,rel:"prefetch",as:"style"}:{...d,rel:"prefetch"}))}function jh(i,c,s,r,d,h){let v=(y,m)=>s[m]?y.route.id!==s[m].route.id:!0,E=(y,m)=>{var p;return s[m].pathname!==y.pathname||((p=s[m].route.path)==null?void 0:p.endsWith("*"))&&s[m].params["*"]!==y.params["*"]};return h==="assets"?c.filter((y,m)=>v(y,m)||E(y,m)):h==="data"?c.filter((y,m)=>{var R;let p=r.routes[y.route.id];if(!p||!p.hasLoader)return!1;if(v(y,m)||E(y,m))return!0;if(y.route.shouldRevalidate){let D=y.route.shouldRevalidate({currentUrl:new URL(d.pathname+d.search+d.hash,window.origin),currentParams:((R=s[0])==null?void 0:R.params)||{},nextUrl:new URL(i,window.origin),nextParams:y.params,defaultShouldRevalidate:!0});if(typeof D=="boolean")return D}return!0}):[]}function gg(i,c,{includeHydrateFallback:s}={}){return pg(i.map(r=>{let d=c.routes[r.route.id];if(!d)return[];let h=[d.module];return d.clientActionModule&&(h=h.concat(d.clientActionModule)),d.clientLoaderModule&&(h=h.concat(d.clientLoaderModule)),s&&d.hydrateFallbackModule&&(h=h.concat(d.hydrateFallbackModule)),d.imports&&(h=h.concat(d.imports)),h}).flat(1))}function pg(i){return[...new Set(i)]}function Sg(i){let c={},s=Object.keys(i).sort();for(let r of s)c[r]=i[r];return c}function bg(i,c){let s=new Set;return new Set(c),i.reduce((r,d)=>{let h=JSON.stringify(Sg(d));return s.has(h)||(s.add(h),r.push({key:h,link:d})),r},[])}function pr(){let i=U.useContext(wa);return gr(i,"You must render this element inside a <DataRouterContext.Provider> element"),i}function Eg(){let i=U.useContext(bi);return gr(i,"You must render this element inside a <DataRouterStateContext.Provider> element"),i}var Sr=U.createContext(void 0);Sr.displayName="FrameworkContext";function Ti(){let i=U.useContext(Sr);return gr(i,"You must render this element inside a <HydratedRouter> element"),i}function Tg(i,c){let s=U.useContext(Sr),[r,d]=U.useState(!1),[h,v]=U.useState(!1),{onFocus:E,onBlur:y,onMouseEnter:m,onMouseLeave:p,onTouchStart:R}=c,D=U.useRef(null);U.useEffect(()=>{if(i==="render"&&v(!0),i==="viewport"){let j=q=>{q.forEach(F=>{v(F.isIntersecting)})},L=new IntersectionObserver(j,{threshold:.5});return D.current&&L.observe(D.current),()=>{L.disconnect()}}},[i]),U.useEffect(()=>{if(r){let j=setTimeout(()=>{v(!0)},100);return()=>{clearTimeout(j)}}},[r]);let B=()=>{d(!0)},Y=()=>{d(!1),v(!1)};return s?i!=="intent"?[h,D,{}]:[h,D,{onFocus:jn(E,B),onBlur:jn(y,Y),onMouseEnter:jn(m,B),onMouseLeave:jn(p,Y),onTouchStart:jn(R,B)}]:[!1,D,{}]}function jn(i,c){return s=>{i&&i(s),s.defaultPrevented||c(s)}}function Rg({page:i,...c}){let s=H0(),{nonce:r}=Ti(),{router:d}=pr(),h=U.useMemo(()=>Fh(d.routes,i,d.basename),[d.routes,i,d.basename]);return h?(c.nonce==null&&r&&(c={...c,nonce:r}),s?U.createElement(Ag,{page:i,matches:h,...c}):U.createElement(Og,{page:i,matches:h,...c})):null}function _g(i){let{manifest:c,routeModules:s}=Ti(),[r,d]=U.useState([]);return U.useEffect(()=>{let h=!1;return vg(i,c,s).then(v=>{h||d(v)}),()=>{h=!0}},[i,c,s]),r}function Ag({page:i,matches:c,...s}){let r=Be(),{future:d}=Ti(),{basename:h}=pr(),v=U.useMemo(()=>{if(i===r.pathname+r.search+r.hash)return[];let E=mm(i,h,d.v8_trailingSlashAwareDataRequests,"rsc"),y=!1,m=[];for(let p of c)typeof p.route.shouldRevalidate=="function"?y=!0:m.push(p.route.id);return y&&m.length>0&&E.searchParams.set("_routes",m.join(",")),[E.pathname+E.search]},[h,d.v8_trailingSlashAwareDataRequests,i,r,c]);return U.createElement(U.Fragment,null,v.map(E=>U.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...s})))}function Og({page:i,matches:c,...s}){let r=Be(),{future:d,manifest:h,routeModules:v}=Ti(),{basename:E}=pr(),{loaderData:y,matches:m}=Eg(),p=U.useMemo(()=>jh(i,c,m,h,r,"data"),[i,c,m,h,r]),R=U.useMemo(()=>jh(i,c,m,h,r,"assets"),[i,c,m,h,r]),D=U.useMemo(()=>{if(i===r.pathname+r.search+r.hash)return[];let j=new Set,L=!1;if(c.forEach(F=>{var W;let V=h.routes[F.route.id];!V||!V.hasLoader||(!p.some(nt=>nt.route.id===F.route.id)&&F.route.id in y&&((W=v[F.route.id])!=null&&W.shouldRevalidate)||V.hasClientLoader?L=!0:j.add(F.route.id))}),j.size===0)return[];let q=mm(i,E,d.v8_trailingSlashAwareDataRequests,"data");return L&&j.size>0&&q.searchParams.set("_routes",c.filter(F=>j.has(F.route.id)).map(F=>F.route.id).join(",")),[q.pathname+q.search]},[E,d.v8_trailingSlashAwareDataRequests,y,r,h,p,c,i,v]),B=U.useMemo(()=>gg(R,h),[R,h]),Y=_g(R);return U.createElement(U.Fragment,null,D.map(j=>U.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...s})),B.map(j=>U.createElement("link",{key:j,rel:"modulepreload",href:j,...s})),Y.map(({key:j,link:L})=>U.createElement("link",{key:j,nonce:s.nonce,...L,crossOrigin:L.crossOrigin??s.crossOrigin})))}function zg(...i){return c=>{i.forEach(s=>{typeof s=="function"?s(c):s!=null&&(s.current=c)})}}var Ug=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ug&&(window.__reactRouterVersion="7.18.2")}catch{}function dS({basename:i,children:c,useTransitions:s,window:r}){let d=U.useRef();d.current==null&&(d.current=u0({window:r,v5Compat:!0}));let h=d.current,[v,E]=U.useState({action:h.action,location:h.location}),y=U.useCallback(m=>{s===!1?E(m):U.startTransition(()=>E(m))},[s]);return U.useLayoutEffect(()=>h.listen(y),[h,y]),U.createElement(ng,{basename:i,children:c,location:v.location,navigationType:v.action,navigator:h,useTransitions:s})}var ym=U.forwardRef(function({onClick:c,discover:s="render",prefetch:r="none",relative:d,reloadDocument:h,replace:v,mask:E,state:y,target:m,to:p,preventScrollReset:R,viewTransition:D,defaultShouldRevalidate:B,...Y},j){let{basename:L,navigator:q,useTransitions:F}=U.useContext(ge),V=typeof p=="string"&&or.test(p),W=nm(p,L);p=W.to;let nt=w0(p,{relative:d}),X=Be(),$=null;if(E){let vt=Si(E,[],X.mask?X.mask.pathname:"/",!0);L!=="/"&&(vt.pathname=vt.pathname==="/"?L:Le([L,vt.pathname])),$=q.createHref(vt)}let[mt,Ot,kt]=Tg(r,Y),Gt=Ng(p,{replace:v,mask:E,state:y,target:m,preventScrollReset:R,relative:d,viewTransition:D,defaultShouldRevalidate:B,useTransitions:F});function J(vt){c&&c(vt),vt.defaultPrevented||Gt(vt)}let zt=!(W.isExternal||h),yt=U.createElement("a",{...Y,...kt,href:(zt?$:void 0)||W.absoluteURL||nt,onClick:zt?J:c,ref:zg(j,Ot),target:m,"data-discover":!V&&s==="render"?"true":void 0});return mt&&!V?U.createElement(U.Fragment,null,yt,U.createElement(Rg,{page:nt})):yt});ym.displayName="Link";var Mg=U.forwardRef(function({"aria-current":c="page",caseSensitive:s=!1,className:r="",end:d=!1,style:h,to:v,viewTransition:E,children:y,...m},p){let R=Qn(v,{relative:m.relative}),D=Be(),B=U.useContext(bi),{navigator:Y,basename:j}=U.useContext(ge),L=B!=null&&qg(R)&&E===!0,q=Y.encodeLocation?Y.encodeLocation(R).pathname:R.pathname,F=D.pathname,V=B&&B.navigation&&B.navigation.location?B.navigation.location.pathname:null;s||(F=F.toLowerCase(),V=V?V.toLowerCase():null,q=q.toLowerCase()),V&&j&&(V=il(V,j)||V);const W=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let nt=F===q||!d&&F.startsWith(q)&&F.charAt(W)==="/",X=V!=null&&(V===q||!d&&V.startsWith(q)&&V.charAt(q.length)==="/"),$={isActive:nt,isPending:X,isTransitioning:L},mt=nt?c:void 0,Ot;typeof r=="function"?Ot=r($):Ot=[r,nt?"active":null,X?"pending":null,L?"transitioning":null].filter(Boolean).join(" ");let kt=typeof h=="function"?h($):h;return U.createElement(ym,{...m,"aria-current":mt,className:Ot,ref:p,style:kt,to:v,viewTransition:E},typeof y=="function"?y($):y)});Mg.displayName="NavLink";var Dg=U.forwardRef(({discover:i="render",fetcherKey:c,navigate:s,reloadDocument:r,replace:d,state:h,method:v=oi,action:E,onSubmit:y,relative:m,preventScrollReset:p,viewTransition:R,defaultShouldRevalidate:D,...B},Y)=>{let{useTransitions:j}=U.useContext(ge),L=Lg(),q=Bg(E,{relative:m}),F=v.toLowerCase()==="get"?"get":"post",V=typeof E=="string"&&or.test(E),W=nt=>{if(y&&y(nt),nt.defaultPrevented)return;nt.preventDefault();let X=nt.nativeEvent.submitter,$=(X==null?void 0:X.getAttribute("formmethod"))||v,mt=()=>L(X||nt.currentTarget,{fetcherKey:c,method:$,navigate:s,replace:d,state:h,relative:m,preventScrollReset:p,viewTransition:R,defaultShouldRevalidate:D});j&&s!==!1?U.startTransition(()=>mt()):mt()};return U.createElement("form",{ref:Y,method:F,action:q,onSubmit:r?y:W,...B,"data-discover":!V&&i==="render"?"true":void 0})});Dg.displayName="Form";function Cg(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vm(i){let c=U.useContext(wa);return Ct(c,Cg(i)),c}function Ng(i,{target:c,replace:s,mask:r,state:d,preventScrollReset:h,relative:v,viewTransition:E,defaultShouldRevalidate:y,useTransitions:m}={}){let p=mr(),R=Be(),D=Qn(i,{relative:v});return U.useCallback(B=>{if(rg(B,c)){B.preventDefault();let Y=s!==void 0?s:Gn(R)===Gn(D),j=()=>p(i,{replace:Y,mask:r,state:d,preventScrollReset:h,relative:v,viewTransition:E,defaultShouldRevalidate:y});m?U.startTransition(()=>j()):j()}},[R,p,D,s,r,d,c,i,h,v,E,y,m])}function hS(i){Ue(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 c=U.useRef(cr(i)),s=U.useRef(!1),r=Be(),d=U.useMemo(()=>sg(r.search,s.current?null:c.current),[r.search]),h=mr(),v=U.useCallback((E,y)=>{const m=cr(typeof E=="function"?E(new URLSearchParams(d)):E);s.current=!0,h("?"+m,y)},[h,d]);return[d,v]}var Hg=0,xg=()=>`__${String(++Hg)}__`;function Lg(){let{router:i}=vm("useSubmit"),{basename:c}=U.useContext(ge),s=I0(),r=i.fetch,d=i.navigate;return U.useCallback(async(h,v={})=>{let{action:E,method:y,encType:m,formData:p,body:R}=hg(h,c);if(v.navigate===!1){let D=v.fetcherKey||xg();await r(D,s,v.action||E,{defaultShouldRevalidate:v.defaultShouldRevalidate,preventScrollReset:v.preventScrollReset,formData:p,body:R,formMethod:v.method||y,formEncType:v.encType||m,flushSync:v.flushSync})}else await d(v.action||E,{defaultShouldRevalidate:v.defaultShouldRevalidate,preventScrollReset:v.preventScrollReset,formData:p,body:R,formMethod:v.method||y,formEncType:v.encType||m,replace:v.replace,state:v.state,fromRouteId:s,flushSync:v.flushSync,viewTransition:v.viewTransition})},[r,d,c,s])}function Bg(i,{relative:c}={}){let{basename:s}=U.useContext(ge),r=U.useContext(Me);Ct(r,"useFormAction must be used inside a RouteContext");let[d]=r.matches.slice(-1),h={...Qn(i||".",{relative:c})},v=Be();if(i==null){h.search=v.search;let E=new URLSearchParams(h.search),y=E.getAll("index");if(y.some(p=>p==="")){E.delete("index"),y.filter(R=>R).forEach(R=>E.append("index",R));let p=E.toString();h.search=p?`?${p}`:""}}return(!i||i===".")&&d.route.index&&(h.search=h.search?h.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(h.pathname=h.pathname==="/"?s:Le([s,h.pathname])),Gn(h)}function qg(i,{relative:c}={}){let s=U.useContext(cm);Ct(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=vm("useViewTransitionState"),d=Qn(i,{relative:c});if(!s.isTransitioning)return!1;let h=il(s.currentLocation.pathname,r)||s.currentLocation.pathname,v=il(s.nextLocation.pathname,r)||s.nextLocation.pathname;return vi(d.pathname,v)!=null||vi(d.pathname,h)!=null}var jg={};const hi=Object.create(null),Yn=i=>{var c;return jg||((c=globalThis.Deno)==null?void 0:c.env.toObject())||globalThis.__env__||(i?hi:globalThis)},Nl=new Proxy(hi,{get(i,c){return Yn()[c]??hi[c]},has(i,c){return c in Yn()||c in hi},set(i,c,s){const r=Yn(!0);return r[c]=s,!0},deleteProperty(i,c){if(!c)return!1;const s=Yn(!0);return delete s[c],!0},ownKeys(){const i=Yn(!0);return Object.keys(i)}});Nl.NODE_ENV;var mi=class extends Error{constructor(i,c){super(i,c),this.name="BetterAuthError",this.message=i,this.stack=""}};const Yg=47;function gm(i){let c=i.length;for(;c>0&&i.charCodeAt(c-1)===Yg;)c--;return c===i.length?i:i.slice(0,c)}function wg(i){try{return(gm(new URL(i).pathname)||"/")!=="/"}catch{throw new mi(`Invalid base URL: ${i}. Please provide a valid base URL.`)}}function Gg(i){try{const c=new URL(i);if(c.protocol!=="http:"&&c.protocol!=="https:")throw new mi(`Invalid base URL: ${i}. URL must include 'http://' or 'https://'`)}catch(c){throw c instanceof mi?c:new mi(`Invalid base URL: ${i}. Please provide a valid base URL.`,{cause:c})}}function Ff(i,c="/api/auth"){if(Gg(i),wg(i))return i;const s=gm(i);return!c||c==="/"?s:(c=c.startsWith("/")?c:`/${c}`,`${s}${c}`)}function Xg(i,c,s,r,d){if(i)return Ff(i,c);{const h=Nl.BETTER_AUTH_URL||Nl.NEXT_PUBLIC_BETTER_AUTH_URL||Nl.PUBLIC_BETTER_AUTH_URL||Nl.NUXT_PUBLIC_BETTER_AUTH_URL||Nl.NUXT_PUBLIC_AUTH_URL||(Nl.BASE_URL!=="/"?Nl.BASE_URL:void 0);if(h)return Ff(h,c)}if(typeof window<"u"&&window.location)return Ff(window.location.origin,c)}const Qg={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},Zg=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,Yh={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},Vg=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Jg(i){return i instanceof Date&&!isNaN(i.getTime())}function Kg(i){const c=Vg.exec(i);if(!c)return null;const[,s,r,d,h,v,E,y,m,p,R]=c,D=new Date(Date.UTC(parseInt(s,10),parseInt(r,10)-1,parseInt(d,10),parseInt(h,10),parseInt(v,10),parseInt(E,10),y?parseInt(y.padEnd(3,"0"),10):0));if(m){const B=(parseInt(p,10)*60+parseInt(R,10))*(m==="+"?-1:1);D.setUTCMinutes(D.getUTCMinutes()+B)}return Jg(D)?D:null}function $g(i,c={}){const{strict:s=!1,warnings:r=!1,reviver:d,parseDates:h=!0}=c;if(typeof i!="string")return i;const v=i.trim(),E=v.toLowerCase();if(E.length<=9&&E in Yh)return Yh[E];if(!Zg.test(v)){if(s)throw new SyntaxError("[better-json] Invalid JSON");return i}if(Object.entries(Qg).some(([y,m])=>{const p=m.test(v);return p&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${y} pattern`),p})&&s)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(v,(m,p)=>{if(m==="__proto__"||m==="constructor"&&p&&typeof p=="object"&&"prototype"in p){r&&console.warn(`[better-json] Dropping "${m}" key to prevent prototype pollution`);return}if(h&&typeof p=="string"){const R=Kg(p);if(R)return R}return d?d(m,p):p})}catch(y){if(s)throw y;return i}}function Wg(i,c={strict:!0}){return $g(i,c)}const kg=["javascript:","data:","vbscript:"];function Fg(i){let c;try{c=new URL(i)}catch{return!0}return!kg.includes(c.protocol)}const Pg={id:"redirect",name:"Redirect",hooks:{onSuccess(i){var c,s;if((c=i.data)!=null&&c.url&&((s=i.data)!=null&&s.redirect)&&Fg(i.data.url)&&typeof window<"u"&&window.location&&window.location)try{window.location.href=i.data.url}catch{}}}};let xe=[],Hl=0;const yi=4,Ig=globalThis.nanostoresGlobal||(globalThis.nanostoresGlobal={epoch:0});let tp=()=>{for(Hl=0;Hl<xe.length;Hl+=yi)xe[Hl](xe[Hl+1].value,xe[Hl+2],xe[Hl+3]);xe.length=0};const wh=i=>{let c=[],s={get(){return s.lc||s.listen(()=>{})(),s.value},init:i,lc:0,listen(r){return s.lc=c.push(r),()=>{for(let h=Hl+yi;h<xe.length;)xe[h]===r?xe.splice(h,yi):h+=yi;let d=c.indexOf(r);~d&&(c.splice(d,1),--s.lc||s.off())}},notify(r,d){Ig.epoch++;let h=!xe.length&&!0;for(let v of c)xe.push(v,s,r,d);h&&tp()},off(){},set(r){let d=s.value;d!==r&&(s.value=r,s.notify(d))},subscribe(r){let d=s.listen(r);return r(s.value),d},value:i};return s},ep=2,lp=5,ri=6,si=10;let pm=(i,c,s,r)=>(i.events=i.events||{},i.events[s+si]||(i.events[s+si]=r(d=>{i.events[s].reduceRight((h,v)=>(v(h),h),{shared:{},...d})})),i.events[s]=i.events[s]||[],i.events[s].push(c),()=>{let d=i.events[s],h=d.indexOf(c);d.splice(h,1),d.length||(delete i.events[s],i.events[s+si](),delete i.events[s+si])}),ap=(i,c)=>pm(i,c,ep,s=>{let r=i.set,d=i.setKey;return i.setKey&&(i.setKey=(h,v)=>{let E;if(s({abort:()=>{E=!0},changed:h,newValue:{...i.value,[h]:v}}),!E)return d(h,v)}),i.set=h=>{let v;if(s({abort:()=>{v=!0},newValue:h}),!v)return r(h)},()=>{i.set=r,i.setKey=d}});const np=1e3;let up=(i,c)=>pm(i,r=>{let d=c(r);d&&i.events[ri].push(d)},lp,r=>{let d=i.listen;i.listen=(...v)=>(!i.lc&&!i.active&&(i.active=!0,r()),d(...v));let h=i.off;return i.events[ri]=[],i.off=()=>{h(),setTimeout(()=>{if(i.active&&!i.lc){i.active=!1;for(let v of i.events[ri])v();i.events[ri]=[]}},np)},()=>{i.listen=d,i.off=h}});function ip(i,c,s){let r=new Set(c);return i.listen((d,h,v)=>{(v===void 0?c.some(E=>d[E]!==h[E]):r.has(v)||r.has(v.split(/\.|\[/)[0]))&&s(d,h,v)})}function Gh(i){if(typeof i!="object"||i===null)return!1;const c=Object.getPrototypeOf(i);return c===Object.prototype||c===null}function pi(i,c){if(i===c)return!0;if(Array.isArray(i)&&Array.isArray(c)){if(i.length!==c.length)return!1;for(let s=0;s<i.length;s++)if(!pi(i[s],c[s]))return!1;return!0}if(Gh(i)&&Gh(c)){const s=Object.keys(i),r=Object.keys(c);if(s.length!==r.length)return!1;for(const d of s)if(!(d in c)||!pi(i[d],c[d]))return!1;return!0}return!1}function cp(i,c){return ap(i,({newValue:s,abort:r})=>{c(i.value,s)&&r()})}const Pf=Symbol.for("better-auth:broadcast-channel"),fp=()=>Math.floor(Date.now()/1e3);var rp=class{constructor(i="better-auth.message"){ja(this,"listeners",new Set);ja(this,"name");this.name=i}subscribe(i){return this.listeners.add(i),()=>{this.listeners.delete(i)}}post(i){if(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...i,timestamp:fp()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const i=c=>{if(c.key!==this.name)return;const s=JSON.parse(c.newValue??"{}");(s==null?void 0:s.event)!=="session"||!(s!=null&&s.data)||this.listeners.forEach(r=>r(s))};return window.addEventListener("storage",i),()=>{window.removeEventListener("storage",i)}}};function If(i="better-auth.message"){return globalThis[Pf]||(globalThis[Pf]=new rp(i)),globalThis[Pf]}const tr=Symbol.for("better-auth:focus-manager");var sp=class{constructor(){ja(this,"listeners",new Set)}subscribe(i){return this.listeners.add(i),()=>{this.listeners.delete(i)}}setFocused(i){this.listeners.forEach(c=>c(i))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};const i=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",i,!1),()=>{document.removeEventListener("visibilitychange",i,!1)}}};function Xh(){return globalThis[tr]||(globalThis[tr]=new sp),globalThis[tr]}const er=Symbol.for("better-auth:online-manager");var op=class{constructor(){ja(this,"listeners",new Set);ja(this,"isOnline",typeof navigator<"u"?navigator.onLine:!0)}subscribe(i){return this.listeners.add(i),()=>{this.listeners.delete(i)}}setOnline(i){this.isOnline=i,this.listeners.forEach(c=>c(i))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const i=()=>this.setOnline(!0),c=()=>this.setOnline(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",c,!1),()=>{window.removeEventListener("online",i,!1),window.removeEventListener("offline",c,!1)}}};function lr(){return globalThis[er]||(globalThis[er]=new op),globalThis[er]}const ar=()=>Math.floor(Date.now()/1e3),dp=5;function hp(i){var V,W,nt;const{fetchSession:c,shouldPollSession:s=()=>!0,sessionSignal:r,options:d={}}=i,h=((V=d.sessionOptions)==null?void 0:V.refetchInterval)??0,v=((W=d.sessionOptions)==null?void 0:W.refetchOnWindowFocus)??!0,E=((nt=d.sessionOptions)==null?void 0:nt.refetchWhenOffline)??!1,y={isInitialized:!1,lastSessionRequest:0},m=()=>E||lr().isOnline,p=X=>{if(m()){if((X==null?void 0:X.event)==="storage"){c();return}if((X==null?void 0:X.event)==="poll"){y.lastSessionRequest=ar(),c();return}if((X==null?void 0:X.event)==="visibilitychange"){if(ar()-y.lastSessionRequest<dp)return;y.lastSessionRequest=ar(),c();return}c()}},R=X=>{If().post({event:"session",data:{trigger:X},clientId:Math.random().toString(36).substring(7)})},D=()=>{h&&h>0&&(y.pollInterval=setInterval(()=>{s()&&p({event:"poll"})},h*1e3))},B=()=>{y.unsubscribeBroadcast=If().subscribe(()=>{p({event:"storage"})})},Y=()=>{v&&(y.unsubscribeFocus=Xh().subscribe(()=>{p({event:"visibilitychange"})}))},j=()=>{y.unsubscribeOnline=lr().subscribe(X=>{X&&p({event:"visibilitychange"})})},L=()=>{y.unsubscribeSignal=r.listen(()=>{c()})};return{init:()=>{y.isInitialized||(y.isInitialized=!0,D(),B(),Y(),j(),L(),y.cleanupBroadcastSetup=If().setup(),y.cleanupFocusSetup=Xh().setup(),y.cleanupOnlineSetup=lr().setup())},cleanup:()=>{y.isInitialized&&(y.pollInterval&&(clearInterval(y.pollInterval),y.pollInterval=void 0),y.unsubscribeBroadcast&&(y.unsubscribeBroadcast(),y.unsubscribeBroadcast=void 0),y.unsubscribeFocus&&(y.unsubscribeFocus(),y.unsubscribeFocus=void 0),y.unsubscribeOnline&&(y.unsubscribeOnline(),y.unsubscribeOnline=void 0),y.unsubscribeSignal&&(y.unsubscribeSignal(),y.unsubscribeSignal=void 0),y.cleanupBroadcastSetup&&(y.cleanupBroadcastSetup(),y.cleanupBroadcastSetup=void 0),y.cleanupFocusSetup&&(y.cleanupFocusSetup(),y.cleanupFocusSetup=void 0),y.cleanupOnlineSetup&&(y.cleanupOnlineSetup(),y.cleanupOnlineSetup=void 0),y.isInitialized=!1,y.lastSessionRequest=0)},triggerRefetch:p,broadcastSessionUpdate:R}}const mp=()=>typeof window>"u";function Qh(i){return typeof i=="object"&&i!==null&&"data"in i&&"error"in i?i:{data:i,error:null}}function yp(i){return!i||i.session===null&&i.user===null?null:i}function vp(i,c){return pi(i.data,c.data)&&i.error===c.error&&i.isPending===c.isPending&&i.isRefetching===c.isRefetching&&i.refetch===c.refetch}function gp(i,c){const s=wh(!1);let r;const d=m=>E(m),h=wh({data:null,error:null,isPending:!0,isRefetching:!1,refetch:d});cp(h,vp);const v=m=>{if(r!==m)return;const p=h.get();r=void 0,!(!p.isPending&&!p.isRefetching)&&h.set({...p,isPending:!1,isRefetching:!1,refetch:d})},E=async m=>{r==null||r.abort();const p=new AbortController;r=p;const R=h.get();h.set({...R,isPending:R.data===null,isRefetching:!0,error:null,refetch:d});try{const D=await i("/get-session",{method:"GET",query:m==null?void 0:m.query,signal:p.signal});if(p.signal.aborted){v(p);return}let{data:B,error:Y}=Qh(D);if(B!=null&&B.needsRefresh)try{const F=await i("/get-session",{method:"POST",signal:p.signal});if(p.signal.aborted){v(p);return}({data:B,error:Y}=Qh(F))}catch{if(p.signal.aborted){v(p);return}}if(Y){const F=h.get(),V=(Y==null?void 0:Y.status)===401;h.set({data:V?null:F.data,error:Y,isPending:!1,isRefetching:!1,refetch:d});return}const j=yp(B),L=h.get(),q=L.data!=null&&j!=null&&pi(L.data,j)?L.data:j;h.set({data:q,error:null,isPending:!1,isRefetching:!1,refetch:d})}catch(D){if(p.signal.aborted){v(p);return}const B=h.get();h.set({data:B.data,error:D,isPending:!1,isRefetching:!1,refetch:d})}};let y=()=>{};return up(h,()=>{let m;mp()||(m=setTimeout(()=>{E()},0));const p=hp({fetchSession:E,shouldPollSession:()=>h.get().data!=null,sessionSignal:s,options:c});return p.init(),y=p.broadcastSessionUpdate,()=>{m&&clearTimeout(m);const R=r;R==null||R.abort(),R&&v(R),p.cleanup()}}),{session:h,$sessionSignal:s,broadcastSessionUpdate:m=>y(m)}}function nr(i){if(i===null||typeof i!="object")return!1;const c=Object.getPrototypeOf(i);return c!==null&&c!==Object.prototype&&Object.getPrototypeOf(c)!==null||Symbol.iterator in i?!1:Symbol.toStringTag in i?Object.prototype.toString.call(i)==="[object Module]":!0}function fr(i,c,s=".",r){if(!nr(c))return fr(i,{},s,r);const d={...c};for(const h of Object.keys(i)){if(h==="__proto__"||h==="constructor")continue;const v=i[h];v!=null&&(r&&r(d,h,v,s)||(Array.isArray(v)&&Array.isArray(d[h])?d[h]=[...v,...d[h]]:nr(v)&&nr(d[h])?d[h]=fr(v,d[h],(s?`${s}.`:"")+h.toString(),r):d[h]=v))}return d}function pp(i){return(...c)=>c.reduce((s,r)=>fr(s,r,"",i),{})}const Sp=pp();var bp=Object.defineProperty,Ep=Object.defineProperties,Tp=Object.getOwnPropertyDescriptors,Zh=Object.getOwnPropertySymbols,Rp=Object.prototype.hasOwnProperty,_p=Object.prototype.propertyIsEnumerable,Vh=(i,c,s)=>c in i?bp(i,c,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[c]=s,He=(i,c)=>{for(var s in c||(c={}))Rp.call(c,s)&&Vh(i,s,c[s]);if(Zh)for(var s of Zh(c))_p.call(c,s)&&Vh(i,s,c[s]);return i},Ge=(i,c)=>Ep(i,Tp(c)),Ap=class extends Error{constructor(i,c,s){super(c||i.toString(),{cause:s}),this.status=i,this.statusText=c,this.error=s,Error.captureStackTrace(this,this.constructor)}},Op=async(i,c)=>{var s,r,d,h,v,E;let y=c||{};const m={onRequest:[c==null?void 0:c.onRequest],onResponse:[c==null?void 0:c.onResponse],onSuccess:[c==null?void 0:c.onSuccess],onError:[c==null?void 0:c.onError],onRetry:[c==null?void 0:c.onRetry]};if(!c||!(c!=null&&c.plugins))return{url:i,options:y,hooks:m};for(const p of(c==null?void 0:c.plugins)||[]){if(p.init){const R=await((s=p.init)==null?void 0:s.call(p,i.toString(),c));y=R.options||y,i=R.url}m.onRequest.push((r=p.hooks)==null?void 0:r.onRequest),m.onResponse.push((d=p.hooks)==null?void 0:d.onResponse),m.onSuccess.push((h=p.hooks)==null?void 0:h.onSuccess),m.onError.push((v=p.hooks)==null?void 0:v.onError),m.onRetry.push((E=p.hooks)==null?void 0:E.onRetry)}return{url:i,options:y,hooks:m}},Jh=class{constructor(i){this.options=i}shouldAttemptRetry(i,c){return this.options.shouldRetry?Promise.resolve(i<this.options.attempts&&this.options.shouldRetry(c)):Promise.resolve(i<this.options.attempts)}getDelay(){return this.options.delay}},zp=class{constructor(i){this.options=i}shouldAttemptRetry(i,c){return this.options.shouldRetry?Promise.resolve(i<this.options.attempts&&this.options.shouldRetry(c)):Promise.resolve(i<this.options.attempts)}getDelay(i){return Math.min(this.options.maxDelay,this.options.baseDelay*2**i)}};function Up(i){if(typeof i=="number")return new Jh({type:"linear",attempts:i,delay:1e3});switch(i.type){case"linear":return new Jh(i);case"exponential":return new zp(i);default:throw new Error("Invalid retry strategy")}}var Mp=async i=>{const c={},s=async r=>typeof r=="function"?await r():r;if(i!=null&&i.auth){if(i.auth.type==="Bearer"){const r=await s(i.auth.token);if(!r)return c;c.authorization=`Bearer ${r}`}else if(i.auth.type==="Basic"){const[r,d]=await Promise.all([s(i.auth.username),s(i.auth.password)]);if(!r||!d)return c;c.authorization=`Basic ${btoa(`${r}:${d}`)}`}else if(i.auth.type==="Custom"){const[r,d]=await Promise.all([s(i.auth.prefix),s(i.auth.value)]);if(!d)return c;c.authorization=`${r??""} ${d}`}}return c},Dp=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Cp(i){const c=i.headers.get("content-type"),s=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!c)return"json";const r=c.split(";").shift()||"";return Dp.test(r)?"json":s.has(r)||r.startsWith("text/")?"text":"blob"}function Np(i){try{return JSON.parse(i),!0}catch{return!1}}function Sm(i){if(i===void 0)return!1;const c=typeof i;return c==="string"||c==="number"||c==="boolean"||c===null?!0:c!=="object"?!1:Array.isArray(i)?!0:i.buffer?!1:i.constructor&&i.constructor.name==="Object"||typeof i.toJSON=="function"}function Kh(i){try{return JSON.parse(i)}catch{return i}}function $h(i){return typeof i=="function"}function Hp(i){if(i!=null&&i.customFetchImpl)return i.customFetchImpl;if(typeof globalThis<"u"&&$h(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&$h(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}function bm(...i){const c={};for(const s of i)if(s)if(s instanceof Headers)s.forEach((r,d)=>{c[d]=r});else{const r=Array.isArray(s)?s:Object.entries(s);for(const[d,h]of r)h!=null&&(c[d]=h)}return c}async function xp(i){const c=new Headers(bm(i==null?void 0:i.headers,await Mp(i)));if(!c.has("content-type")){const s=Lp(i==null?void 0:i.body);s&&c.set("content-type",s)}return c}function Lp(i){return Sm(i)?"application/json":null}function Bp(i){const c=i.get("content-type");return c?c.split(";")[0].trim().toLowerCase():null}function qp(i,c){const{body:s}=i;return s?!Sm(s)||typeof s=="string"?s:Bp(c)==="application/x-www-form-urlencoded"?new URLSearchParams(s).toString():JSON.stringify(s):null}function jp(i,c){var s;if(c!=null&&c.method)return c.method.toUpperCase();if(i.startsWith("@")){const r=(s=i.split("@")[1])==null?void 0:s.split("/")[0];return Tm.includes(r)?r.toUpperCase():c!=null&&c.body?"POST":"GET"}return c!=null&&c.body?"POST":"GET"}function Yp(i,c){let s;return!(i!=null&&i.signal)&&(i!=null&&i.timeout)&&(s=setTimeout(()=>c==null?void 0:c.abort(),i==null?void 0:i.timeout)),{abortTimeout:s,clearTimeout:()=>{s&&clearTimeout(s)}}}var wp=class Em extends Error{constructor(c,s){super(s||JSON.stringify(c,null,2)),this.issues=c,Object.setPrototypeOf(this,Em.prototype)}};async function wn(i,c){const s=await i["~standard"].validate(c);if(s.issues)throw new wp(s.issues);return s.value}var Tm=["get","post","put","patch","delete"],Gp=i=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(c,s){var r,d,h,v;const E=((d=(r=i.plugins)==null?void 0:r.find(y=>{var m;return(m=y.schema)!=null&&m.config?c.startsWith(y.schema.config.baseURL||"")||c.startsWith(y.schema.config.prefix||""):!1}))==null?void 0:d.schema)||i.schema;if(E){let y=c;(h=E.config)!=null&&h.prefix&&y.startsWith(E.config.prefix)&&(y=y.replace(E.config.prefix,""),E.config.baseURL&&(c=c.replace(E.config.prefix,E.config.baseURL))),(v=E.config)!=null&&v.baseURL&&y.startsWith(E.config.baseURL)&&(y=y.replace(E.config.baseURL,"")),y.startsWith("/")&&y.charAt(1)==="@"&&(y=y.substring(1));const m=E.schema[y];if(m){let p=s==null?void 0:s.headers;if(m.headers&&!(s!=null&&s.disableValidation)){const D={};if(s!=null&&s.headers){if(s.headers instanceof Headers)s.headers.forEach((j,L)=>{D[L.toLowerCase()]=j});else if(typeof s.headers=="object")for(const[j,L]of Object.entries(s.headers))L!=null&&(D[j.toLowerCase()]=L)}const B=await wn(m.headers,D),Y={};for(const[j,L]of Object.entries(B))Y[j.toLowerCase()]=L;p=Y}let R=Ge(He({},s),{method:m.method,output:m.output,headers:p});return s!=null&&s.disableValidation||(R=Ge(He({},R),{body:m.input?await wn(m.input,s==null?void 0:s.body):s==null?void 0:s.body,params:m.params?await wn(m.params,s==null?void 0:s.params):s==null?void 0:s.params,query:m.query?await wn(m.query,s==null?void 0:s.query):s==null?void 0:s.query})),{url:c,options:R}}}return{url:c,options:s}}}),Xp=i=>{async function c(s,r){const d=Ge(He(He({},i),r),{headers:bm(i==null?void 0:i.headers,r==null?void 0:r.headers),plugins:[...(i==null?void 0:i.plugins)||[],Gp(i||{}),...(r==null?void 0:r.plugins)||[]]});if(i!=null&&i.catchAllError)try{return await rr(s,d)}catch(h){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:h}}}return await rr(s,d)}return c},Qp=i=>i==="."||i==="..";function Zp(i,c){let s=i;for(const[r,d]of c)s=s.replace(r,d);if(Qp(s))throw new TypeError("Path parameters cannot be reserved path segments");return encodeURIComponent(s)}function Vp(i,c){const{baseURL:s,params:r,query:d}=c||{query:{},params:{},baseURL:""};let h=i.startsWith("http")?i.split("/").slice(0,3).join("/"):s||"";if(i.startsWith("@")){const D=i.toString().split("@")[1].split("/")[0];Tm.includes(D)&&(i=i.replace(`@${D}/`,"/"))}h.endsWith("/")||(h+="/");let[v,E]=i.replace(h,"").split("?");const y=new URLSearchParams(E);for(const[D,B]of Object.entries(d||{})){if(B==null)continue;let Y;if(typeof B=="string")Y=B;else if(Array.isArray(B)){for(const j of B)y.append(D,j);continue}else Y=JSON.stringify(B);y.set(D,Y)}const m=new Map;if(r)if(Array.isArray(r)){const D=v.split("/").filter(B=>B.startsWith(":"));for(const[B,Y]of D.entries()){const j=r[B];m.set(Y,String(j))}}else for(const[D,B]of Object.entries(r))m.set(`:${D}`,String(B));v=v.split("/").map(D=>Zp(D,m)).join("/"),v=v.replace(/^\/+/,"");let p=y.toString();return p=p.length>0?`?${p}`.replace(/\+/g,"%20"):"",h.startsWith("http")?new URL(`${v}${p}`,h):`${h}${v}${p}`}var rr=async(i,c)=>{var s,r,d,h,v,E,y,m;const{hooks:p,url:R,options:D}=await Op(i,c),B=Hp(D),Y=new AbortController,j=(s=D.signal)!=null?s:Y.signal,L=Vp(R,D),q=await xp(D),F=qp(D,q),V=jp(R,D),W=Ge(He({},D),{url:L,headers:q,body:F,method:V,signal:j});for(const zt of p.onRequest)if(zt){const yt=await zt(W);typeof yt=="object"&&yt!==null&&Object.assign(W,yt)}("pipeTo"in W&&typeof W.pipeTo=="function"||typeof((r=c==null?void 0:c.body)==null?void 0:r.pipe)=="function")&&("duplex"in W||(W.duplex="half"));const{clearTimeout:nt}=Yp(D,Y);let X=await B(W.url,W);nt();const $={response:X,request:W};for(const zt of p.onResponse)if(zt){const yt=await zt(Ge(He({},$),{response:(d=c==null?void 0:c.hookOptions)!=null&&d.cloneResponse?X.clone():X}));yt instanceof Response?X=yt:typeof yt=="object"&&yt!==null&&(X=yt.response)}if(X.ok){if(!(W.method!=="HEAD"))return{data:"",error:null};const yt=Cp(X),vt={data:null,response:X,request:W};if(yt==="json"||yt==="text"){const M=await X.text(),w=(h=W.jsonParser)!=null?h:Kh;vt.data=await w(M)}else vt.data=await X[yt]();W!=null&&W.output&&W.output&&!W.disableValidation&&(vt.data=await wn(W.output,vt.data));for(const M of p.onSuccess)M&&await M(Ge(He({},vt),{response:(v=c==null?void 0:c.hookOptions)!=null&&v.cloneResponse?X.clone():X}));return c!=null&&c.throw?vt.data:{data:vt.data,error:null}}const mt=(E=c==null?void 0:c.jsonParser)!=null?E:Kh,Ot=await X.text(),kt=Np(Ot),Gt=kt?await mt(Ot):null,J={response:X,responseText:Ot,request:W,error:Ge(He({},Gt),{status:X.status,statusText:X.statusText})};for(const zt of p.onError)zt&&await zt(Ge(He({},J),{response:(y=c==null?void 0:c.hookOptions)!=null&&y.cloneResponse?X.clone():X}));if(c!=null&&c.retry){const zt=Up(c.retry),yt=(m=c.retryAttempt)!=null?m:0;if(await zt.shouldAttemptRetry(yt,X)){for(const M of p.onRetry)M&&await M($);const vt=zt.getDelay(yt);return await new Promise(M=>setTimeout(M,vt)),await rr(i,Ge(He({},c),{retryAttempt:yt+1}))}}if(c!=null&&c.throw)throw new Ap(X.status,X.statusText,kt?Gt:Ot);return{data:null,error:Ge(He({},Gt),{status:X.status,statusText:X.statusText})}},Il={};const Jp=i=>{if(typeof process>"u")return;const c=i??"/api/auth";if(Il.NEXT_PUBLIC_AUTH_URL)return Il.NEXT_PUBLIC_AUTH_URL;if(typeof window>"u"){if(Il.NEXTAUTH_URL)try{return Il.NEXTAUTH_URL}catch{}if(Il.VERCEL_URL)try{const s=Il.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${s}${Il.VERCEL_URL}`).origin}${c}`}catch{}}},Kp=(i,c)=>{var nt,X,$,mt,Ot,kt,Gt;const s="credentials"in Request.prototype,r=Xg(i==null?void 0:i.baseURL,i==null?void 0:i.basePath)??Jp(i==null?void 0:i.basePath)??"/api/auth",d=((nt=i==null?void 0:i.plugins)==null?void 0:nt.flatMap(J=>J.fetchPlugins).filter(J=>J!==void 0))||[],h={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:(X=i==null?void 0:i.fetchOptions)==null?void 0:X.onSuccess,onError:($=i==null?void 0:i.fetchOptions)==null?void 0:$.onError,onRequest:(mt=i==null?void 0:i.fetchOptions)==null?void 0:mt.onRequest,onResponse:(Ot=i==null?void 0:i.fetchOptions)==null?void 0:Ot.onResponse}},{onSuccess:v,onError:E,onRequest:y,onResponse:m,...p}=(i==null?void 0:i.fetchOptions)||{},R=Xp({baseURL:r,...s?{credentials:"include"}:{},method:"GET",jsonParser(J){return J?Wg(J,{strict:!1}):null},customFetchImpl:fetch,...p,plugins:[h,...p.plugins||[],...i!=null&&i.disableDefaultFetchPlugins?[]:[Pg],...d]}),{$sessionSignal:D,session:B,broadcastSessionUpdate:Y}=gp(R,i),j=(i==null?void 0:i.plugins)||[];let L={};const q={$sessionSignal:D,session:B},F={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},V=[{signal:"$sessionSignal",matcher(J){return J==="/sign-out"||J==="/update-user"||J==="/update-session"||J==="/sign-up/email"||J==="/sign-in/email"||J==="/delete-user"||J==="/verify-email"||J==="/revoke-sessions"||J==="/revoke-session"||J==="/revoke-other-sessions"||J==="/change-email"||J==="/change-password"},callback(J){J==="/sign-out"?Y("signout"):(J==="/update-user"||J==="/update-session")&&Y("updateUser")}}];for(const J of j)J.getAtoms&&Object.assign(q,(kt=J.getAtoms)==null?void 0:kt.call(J,R)),J.pathMethods&&Object.assign(F,J.pathMethods),J.atomListeners&&V.push(...J.atomListeners);const W={notify:J=>{q[J].set(!q[J].get())},listen:(J,zt)=>{q[J].subscribe(zt)},atoms:q};for(const J of j)J.getActions&&(L=Sp(((Gt=J.getActions)==null?void 0:Gt.call(J,R,W,i))??{},L));return{get baseURL(){return r},pluginsActions:L,pluginsAtoms:q,pluginPathMethods:F,atomListeners:V,$fetch:R,$store:W}};function $p(i){return typeof i=="object"&&i!==null&&"get"in i&&typeof i.get=="function"&&"lc"in i&&typeof i.lc=="number"}function Wp(i){return i.charAt(0).toUpperCase()+i.slice(1)}const kp=new RegExp("[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+","gu"),Fp=/['\u2019]/g;function Pp(i){return i.replace(Fp,"").match(kp)??[]}function Ip(i){return Pp(i).map(c=>c.toLowerCase()).join("-")}function tS(i,c,s){const r=c[i],{fetchOptions:d,query:h,...v}=s||{};return r||(d!=null&&d.method?d.method:v&&Object.keys(v).length>0?"POST":"GET")}function eS(i,c,s,r,d){function h(v=[]){return new Proxy(function(){},{get(E,y){if(typeof y!="string"||y==="then"||y==="catch"||y==="finally")return;const m=[...v,y];let p=i;for(const R of m)if(p&&typeof p=="object"&&R in p)p=p[R];else{p=void 0;break}return typeof p=="function"||$p(p)?p:h(m)},apply:async(E,y,m)=>{const p="/"+v.map(Ip).join("/"),R=m[0]||{},D=m[1]||{},{query:B,fetchOptions:Y,...j}=R,L={...D,...Y},q=tS(p,s,R);return await c(p,{...L,body:q==="GET"?void 0:{...j,...(L==null?void 0:L.body)||{}},query:B||(L==null?void 0:L.query),method:q,async onSuccess(F){var nt,X;if(await((nt=L==null?void 0:L.onSuccess)==null?void 0:nt.call(L,F)),!d||L.disableSignal)return;const V=d.filter($=>$.matcher(p));if(!V.length)return;const W=new Set;for(const $ of V){const mt=r[$.signal];if(!mt)return;if(W.has($.signal))continue;W.add($.signal);const Ot=mt.get();setTimeout(()=>{mt.set(!Ot)},10),(X=$.callback)==null||X.call($,p)}}})}})}return h()}function lS(i,c={}){const s=U.useRef(i.get()),{keys:r,deps:d=[i,r]}=c,h=U.useCallback(E=>{const y=m=>{s.current!==m&&(s.current=m,E())};return y(i.value),r!=null&&r.length?ip(i,r,y):i.listen(y)},d),v=()=>s.current;return U.useSyncExternalStore(h,v,v)}function aS(i){return`use${Wp(i)}`}function mS(i){const{pluginPathMethods:c,pluginsActions:s,pluginsAtoms:r,$fetch:d,$store:h,atomListeners:v}=Kp(i),E={};for(const[y,m]of Object.entries(r))E[aS(y)]=()=>lS(m);return eS({...s,...E,$fetch:d,$store:h},d,c,r,v)}export{dS as B,Mg as N,sS as O,iS as R,sr as a,fS as b,mS as c,mr as d,rS as e,oS as f,ag as g,cS as h,hS as i,uS as j,U as r,Be as u};
|
|
61
|
-
//# sourceMappingURL=framework-vendor-
|
|
60
|
+
Please change the parent <Route path="${q}"> to <Route path="${q==="/"?"*":`${q}/*`}">.`)}let p=Be(),R;if(c){let q=typeof c=="string"?Ya(c):c;Ct(y==="/"||((L=q.pathname)==null?void 0:L.startsWith(y)),`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 "${y}" but pathname "${q.pathname}" was given in the \`location\` prop.`),R=q}else R=p;let D=R.pathname||"/",B=D;if(y!=="/"){let q=y.replace(/^\//,"").split("/");B="/"+D.replace(/^\//,"").split("/").slice(q.length).join("/")}let Y=s&&s.state.matches.length?s.state.matches.map(q=>Object.assign(q,{route:s.manifest[q.route.id]||q.route})):Fh(i,{pathname:B});Ue(m||Y!=null,`No routes matched location "${R.pathname}${R.search}${R.hash}" `),Ue(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 "${R.pathname}${R.search}${R.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 j=W0(Y&&Y.map(q=>Object.assign({},q,{params:Object.assign({},v,q.params),pathname:Le([y,r.encodeLocation?r.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?y:Le([y,r.encodeLocation?r.encodeLocation(q.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathnameBase])})),d,s);return c&&j?U.createElement(Xn.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...R},navigationType:"POP"}},j):j}function V0(){let i=tg(),c=U0(i)?`${i.status} ${i.statusText}`:i instanceof Error?i.message:JSON.stringify(i),s=i instanceof Error?i.stack:null,r="rgba(200,200,200, 0.5)",d={padding:"0.5rem",backgroundColor:r},h={padding:"2px 4px",backgroundColor:r},v=null;return console.error("Error handled by React Router default ErrorBoundary:",i),v=U.createElement(U.Fragment,null,U.createElement("p",null,"💿 Hey developer 👋"),U.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",U.createElement("code",{style:h},"ErrorBoundary")," or"," ",U.createElement("code",{style:h},"errorElement")," prop on your route.")),U.createElement(U.Fragment,null,U.createElement("h2",null,"Unexpected Application Error!"),U.createElement("h3",{style:{fontStyle:"italic"}},c),s?U.createElement("pre",{style:d},s):null,v)}var J0=U.createElement(V0,null),dm=class extends U.Component{constructor(i){super(i),this.state={location:i.location,revalidation:i.revalidation,error:i.error}}static getDerivedStateFromError(i){return{error:i}}static getDerivedStateFromProps(i,c){return c.location!==i.location||c.revalidation!=="idle"&&i.revalidation==="idle"?{error:i.error,location:i.location,revalidation:i.revalidation}:{error:i.error!==void 0?i.error:c.error,location:c.location,revalidation:i.revalidation||c.revalidation}}componentDidCatch(i,c){this.props.onError?this.props.onError(i,c):console.error("React Router caught the following error during render",i)}render(){let i=this.state.error;if(this.context&&typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){const s=Y0(i.digest);s&&(i=s)}let c=i!==void 0?U.createElement(Me.Provider,{value:this.props.routeContext},U.createElement(hr.Provider,{value:i,children:this.props.component})):this.props.children;return this.context?U.createElement(K0,{error:i},c):c}};dm.contextType=im;var Wf=new WeakMap;function K0({children:i,error:c}){let{basename:s}=U.useContext(ge);if(typeof c=="object"&&c&&"digest"in c&&typeof c.digest=="string"){let r=j0(c.digest);if(r){let d=Wf.get(c);if(d)throw d;let h=nm(r.location,s),v=h.absoluteURL||h.to;if(N0(v))throw new Error("Invalid redirect location");if(am&&!Wf.get(c))if(h.isExternal||r.reloadDocument)window.location.href=v;else{const E=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(h.to,{replace:r.replace}));throw Wf.set(c,E),E}return U.createElement("meta",{httpEquiv:"refresh",content:`0;url=${v}`})}}return i}function $0({routeContext:i,match:c,children:s}){let r=U.useContext(wa);return r&&r.static&&r.staticContext&&(c.route.errorElement||c.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=c.route.id),U.createElement(Me.Provider,{value:i},s)}function W0(i,c=[],s){let r=s==null?void 0:s.state;if(i==null){if(!r)return null;if(r.errors)i=r.matches;else if(c.length===0&&!r.initialized&&r.matches.length>0)i=r.matches;else return null}let d=i,h=r==null?void 0:r.errors;if(h!=null){let p=d.findIndex(R=>R.route.id&&(h==null?void 0:h[R.route.id])!==void 0);Ct(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(h).join(",")}`),d=d.slice(0,Math.min(d.length,p+1))}let v=!1,E=-1;if(s&&r){v=r.renderFallback;for(let p=0;p<d.length;p++){let R=d[p];if((R.route.HydrateFallback||R.route.hydrateFallbackElement)&&(E=p),R.route.id){let{loaderData:D,errors:B}=r,Y=R.route.loader&&!D.hasOwnProperty(R.route.id)&&(!B||B[R.route.id]===void 0);if(R.route.lazy||Y){s.isStatic&&(v=!0),E>=0?d=d.slice(0,E+1):d=[d[0]];break}}}}let y=s==null?void 0:s.onError,m=r&&y?(p,R)=>{var D,B;y(p,{location:r.location,params:((B=(D=r.matches)==null?void 0:D[0])==null?void 0:B.params)??{},pattern:M0(r.matches),errorInfo:R})}:void 0;return d.reduceRight((p,R,D)=>{let B,Y=!1,j=null,L=null;r&&(B=h&&R.route.id?h[R.route.id]:void 0,j=R.route.errorElement||J0,v&&(E<0&&D===0?(hm("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),Y=!0,L=null):E===D&&(Y=!0,L=R.route.hydrateFallbackElement||null)));let q=c.concat(d.slice(0,D+1)),F=()=>{let V;return B?V=j:Y?V=L:R.route.Component?V=U.createElement(R.route.Component,null):R.route.element?V=R.route.element:V=p,U.createElement($0,{match:R,routeContext:{outlet:p,matches:q,isDataRoute:r!=null},children:V})};return r&&(R.route.ErrorBoundary||R.route.errorElement||D===0)?U.createElement(dm,{location:r.location,revalidation:r.revalidation,component:j,error:B,children:F(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:m}):F()},null)}function yr(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function k0(i){let c=U.useContext(wa);return Ct(c,yr(i)),c}function F0(i){let c=U.useContext(bi);return Ct(c,yr(i)),c}function P0(i){let c=U.useContext(Me);return Ct(c,yr(i)),c}function vr(i){let c=P0(i),s=c.matches[c.matches.length-1];return Ct(s.route.id,`${i} can only be used on routes that contain a unique "id"`),s.route.id}function I0(){return vr("useRouteId")}function tg(){var r;let i=U.useContext(hr),c=F0("useRouteError"),s=vr("useRouteError");return i!==void 0?i:(r=c.errors)==null?void 0:r[s]}function eg(){let{router:i}=k0("useNavigate"),c=vr("useNavigate"),s=U.useRef(!1);return sm(()=>{s.current=!0}),U.useCallback(async(d,h={})=>{Ue(s.current,rm),s.current&&(typeof d=="number"?await i.navigate(d):await i.navigate(d,{fromRouteId:c,...h}))},[i,c])}var qh={};function hm(i,c,s){!c&&!qh[i]&&(qh[i]=!0,Ue(!1,s))}U.memo(lg);function lg({routes:i,manifest:c,future:s,state:r,isStatic:d,onError:h}){return om(i,void 0,{manifest:c,state:r,isStatic:d,onError:h})}function rS({to:i,replace:c,state:s,relative:r}){Ct(Ga(),"<Navigate> may be used only in the context of a <Router> component.");let{static:d}=U.useContext(ge);Ue(!d,"<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:h}=U.useContext(Me),{pathname:v}=Be(),E=mr(),y=Si(i,dr(h),v,r==="path"),m=JSON.stringify(y);return U.useEffect(()=>{E(JSON.parse(m),{replace:c,state:s,relative:r})},[E,m,r,c,s]),null}function sS(i){return Q0(i.context)}function ag(i){Ct(!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 ng({basename:i="/",children:c=null,location:s,navigationType:r="POP",navigator:d,static:h=!1,useTransitions:v}){Ct(!Ga(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let E=i.replace(/^\/*/,"/"),y=U.useMemo(()=>({basename:E,navigator:d,static:h,useTransitions:v,future:{}}),[E,d,h,v]);typeof s=="string"&&(s=Ya(s));let{pathname:m="/",search:p="",hash:R="",state:D=null,key:B="default",mask:Y}=s,j=U.useMemo(()=>{let L=il(m,E);return L==null?null:{location:{pathname:L,search:p,hash:R,state:D,key:B,mask:Y},navigationType:r}},[E,m,p,R,D,B,r,Y]);return Ue(j!=null,`<Router basename="${E}"> is not able to match the URL "${m}${p}${R}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:U.createElement(ge.Provider,{value:y},U.createElement(Xn.Provider,{children:c,value:j}))}function oS({children:i,location:c}){return Z0(ir(i),c)}function ir(i,c=[]){let s=[];return U.Children.forEach(i,(r,d)=>{if(!U.isValidElement(r))return;let h=[...c,d];if(r.type===U.Fragment){s.push.apply(s,ir(r.props.children,h));return}Ct(r.type===ag,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ct(!r.props.index||!r.props.children,"An index route cannot have child routes.");let v={id:r.props.id||h.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(v.children=ir(r.props.children,h)),s.push(v)}),s}var oi="get",di="application/x-www-form-urlencoded";function Ei(i){return typeof HTMLElement<"u"&&i instanceof HTMLElement}function ug(i){return Ei(i)&&i.tagName.toLowerCase()==="button"}function ig(i){return Ei(i)&&i.tagName.toLowerCase()==="form"}function cg(i){return Ei(i)&&i.tagName.toLowerCase()==="input"}function fg(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function rg(i,c){return i.button===0&&(!c||c==="_self")&&!fg(i)}function cr(i=""){return new URLSearchParams(typeof i=="string"||Array.isArray(i)||i instanceof URLSearchParams?i:Object.keys(i).reduce((c,s)=>{let r=i[s];return c.concat(Array.isArray(r)?r.map(d=>[s,d]):[[s,r]])},[]))}function sg(i,c){let s=cr(i);return c&&c.forEach((r,d)=>{s.has(d)||c.getAll(d).forEach(h=>{s.append(d,h)})}),s}var fi=null;function og(){if(fi===null)try{new FormData(document.createElement("form"),0),fi=!1}catch{fi=!0}return fi}var dg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function kf(i){return i!=null&&!dg.has(i)?(Ue(!1,`"${i}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${di}"`),null):i}function hg(i,c){let s,r,d,h,v;if(ig(i)){let E=i.getAttribute("action");r=E?il(E,c):null,s=i.getAttribute("method")||oi,d=kf(i.getAttribute("enctype"))||di,h=new FormData(i)}else if(ug(i)||cg(i)&&(i.type==="submit"||i.type==="image")){let E=i.form;if(E==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let y=i.getAttribute("formaction")||E.getAttribute("action");if(r=y?il(y,c):null,s=i.getAttribute("formmethod")||E.getAttribute("method")||oi,d=kf(i.getAttribute("formenctype"))||kf(E.getAttribute("enctype"))||di,h=new FormData(E,i),!og()){let{name:m,type:p,value:R}=i;if(p==="image"){let D=m?`${m}.`:"";h.append(`${D}x`,"0"),h.append(`${D}y`,"0")}else m&&h.append(m,R)}}else{if(Ei(i))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=oi,r=null,d=di,v=i}return h&&d==="text/plain"&&(v=h,h=void 0),{action:r,method:s.toLowerCase(),encType:d,formData:h,body:v}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function gr(i,c){if(i===!1||i===null||typeof i>"u")throw new Error(c)}function mm(i,c,s,r){let d=typeof i=="string"?new URL(i,typeof window>"u"?"server://singlefetch/":window.location.origin):i;return s?d.pathname.endsWith("/")?d.pathname=`${d.pathname}_.${r}`:d.pathname=`${d.pathname}.${r}`:d.pathname==="/"?d.pathname=`_root.${r}`:c&&il(d.pathname,c)==="/"?d.pathname=`${gi(c)}/_root.${r}`:d.pathname=`${gi(d.pathname)}.${r}`,d}async function mg(i,c){if(i.id in c)return c[i.id];try{let s=await import(i.module);return c[i.id]=s,s}catch(s){return console.error(`Error loading route module \`${i.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function yg(i){return i==null?!1:i.href==null?i.rel==="preload"&&typeof i.imageSrcSet=="string"&&typeof i.imageSizes=="string":typeof i.rel=="string"&&typeof i.href=="string"}async function vg(i,c,s){let r=await Promise.all(i.map(async d=>{let h=c.routes[d.route.id];if(h){let v=await mg(h,s);return v.links?v.links():[]}return[]}));return bg(r.flat(1).filter(yg).filter(d=>d.rel==="stylesheet"||d.rel==="preload").map(d=>d.rel==="stylesheet"?{...d,rel:"prefetch",as:"style"}:{...d,rel:"prefetch"}))}function jh(i,c,s,r,d,h){let v=(y,m)=>s[m]?y.route.id!==s[m].route.id:!0,E=(y,m)=>{var p;return s[m].pathname!==y.pathname||((p=s[m].route.path)==null?void 0:p.endsWith("*"))&&s[m].params["*"]!==y.params["*"]};return h==="assets"?c.filter((y,m)=>v(y,m)||E(y,m)):h==="data"?c.filter((y,m)=>{var R;let p=r.routes[y.route.id];if(!p||!p.hasLoader)return!1;if(v(y,m)||E(y,m))return!0;if(y.route.shouldRevalidate){let D=y.route.shouldRevalidate({currentUrl:new URL(d.pathname+d.search+d.hash,window.origin),currentParams:((R=s[0])==null?void 0:R.params)||{},nextUrl:new URL(i,window.origin),nextParams:y.params,defaultShouldRevalidate:!0});if(typeof D=="boolean")return D}return!0}):[]}function gg(i,c,{includeHydrateFallback:s}={}){return pg(i.map(r=>{let d=c.routes[r.route.id];if(!d)return[];let h=[d.module];return d.clientActionModule&&(h=h.concat(d.clientActionModule)),d.clientLoaderModule&&(h=h.concat(d.clientLoaderModule)),s&&d.hydrateFallbackModule&&(h=h.concat(d.hydrateFallbackModule)),d.imports&&(h=h.concat(d.imports)),h}).flat(1))}function pg(i){return[...new Set(i)]}function Sg(i){let c={},s=Object.keys(i).sort();for(let r of s)c[r]=i[r];return c}function bg(i,c){let s=new Set;return new Set(c),i.reduce((r,d)=>{let h=JSON.stringify(Sg(d));return s.has(h)||(s.add(h),r.push({key:h,link:d})),r},[])}function pr(){let i=U.useContext(wa);return gr(i,"You must render this element inside a <DataRouterContext.Provider> element"),i}function Eg(){let i=U.useContext(bi);return gr(i,"You must render this element inside a <DataRouterStateContext.Provider> element"),i}var Sr=U.createContext(void 0);Sr.displayName="FrameworkContext";function Ti(){let i=U.useContext(Sr);return gr(i,"You must render this element inside a <HydratedRouter> element"),i}function Tg(i,c){let s=U.useContext(Sr),[r,d]=U.useState(!1),[h,v]=U.useState(!1),{onFocus:E,onBlur:y,onMouseEnter:m,onMouseLeave:p,onTouchStart:R}=c,D=U.useRef(null);U.useEffect(()=>{if(i==="render"&&v(!0),i==="viewport"){let j=q=>{q.forEach(F=>{v(F.isIntersecting)})},L=new IntersectionObserver(j,{threshold:.5});return D.current&&L.observe(D.current),()=>{L.disconnect()}}},[i]),U.useEffect(()=>{if(r){let j=setTimeout(()=>{v(!0)},100);return()=>{clearTimeout(j)}}},[r]);let B=()=>{d(!0)},Y=()=>{d(!1),v(!1)};return s?i!=="intent"?[h,D,{}]:[h,D,{onFocus:jn(E,B),onBlur:jn(y,Y),onMouseEnter:jn(m,B),onMouseLeave:jn(p,Y),onTouchStart:jn(R,B)}]:[!1,D,{}]}function jn(i,c){return s=>{i&&i(s),s.defaultPrevented||c(s)}}function Rg({page:i,...c}){let s=H0(),{nonce:r}=Ti(),{router:d}=pr(),h=U.useMemo(()=>Fh(d.routes,i,d.basename),[d.routes,i,d.basename]);return h?(c.nonce==null&&r&&(c={...c,nonce:r}),s?U.createElement(Ag,{page:i,matches:h,...c}):U.createElement(Og,{page:i,matches:h,...c})):null}function _g(i){let{manifest:c,routeModules:s}=Ti(),[r,d]=U.useState([]);return U.useEffect(()=>{let h=!1;return vg(i,c,s).then(v=>{h||d(v)}),()=>{h=!0}},[i,c,s]),r}function Ag({page:i,matches:c,...s}){let r=Be(),{future:d}=Ti(),{basename:h}=pr(),v=U.useMemo(()=>{if(i===r.pathname+r.search+r.hash)return[];let E=mm(i,h,d.v8_trailingSlashAwareDataRequests,"rsc"),y=!1,m=[];for(let p of c)typeof p.route.shouldRevalidate=="function"?y=!0:m.push(p.route.id);return y&&m.length>0&&E.searchParams.set("_routes",m.join(",")),[E.pathname+E.search]},[h,d.v8_trailingSlashAwareDataRequests,i,r,c]);return U.createElement(U.Fragment,null,v.map(E=>U.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...s})))}function Og({page:i,matches:c,...s}){let r=Be(),{future:d,manifest:h,routeModules:v}=Ti(),{basename:E}=pr(),{loaderData:y,matches:m}=Eg(),p=U.useMemo(()=>jh(i,c,m,h,r,"data"),[i,c,m,h,r]),R=U.useMemo(()=>jh(i,c,m,h,r,"assets"),[i,c,m,h,r]),D=U.useMemo(()=>{if(i===r.pathname+r.search+r.hash)return[];let j=new Set,L=!1;if(c.forEach(F=>{var W;let V=h.routes[F.route.id];!V||!V.hasLoader||(!p.some(nt=>nt.route.id===F.route.id)&&F.route.id in y&&((W=v[F.route.id])!=null&&W.shouldRevalidate)||V.hasClientLoader?L=!0:j.add(F.route.id))}),j.size===0)return[];let q=mm(i,E,d.v8_trailingSlashAwareDataRequests,"data");return L&&j.size>0&&q.searchParams.set("_routes",c.filter(F=>j.has(F.route.id)).map(F=>F.route.id).join(",")),[q.pathname+q.search]},[E,d.v8_trailingSlashAwareDataRequests,y,r,h,p,c,i,v]),B=U.useMemo(()=>gg(R,h),[R,h]),Y=_g(R);return U.createElement(U.Fragment,null,D.map(j=>U.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...s})),B.map(j=>U.createElement("link",{key:j,rel:"modulepreload",href:j,...s})),Y.map(({key:j,link:L})=>U.createElement("link",{key:j,nonce:s.nonce,...L,crossOrigin:L.crossOrigin??s.crossOrigin})))}function zg(...i){return c=>{i.forEach(s=>{typeof s=="function"?s(c):s!=null&&(s.current=c)})}}var Ug=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ug&&(window.__reactRouterVersion="7.18.2")}catch{}function dS({basename:i,children:c,useTransitions:s,window:r}){let d=U.useRef();d.current==null&&(d.current=u0({window:r,v5Compat:!0}));let h=d.current,[v,E]=U.useState({action:h.action,location:h.location}),y=U.useCallback(m=>{s===!1?E(m):U.startTransition(()=>E(m))},[s]);return U.useLayoutEffect(()=>h.listen(y),[h,y]),U.createElement(ng,{basename:i,children:c,location:v.location,navigationType:v.action,navigator:h,useTransitions:s})}var ym=U.forwardRef(function({onClick:c,discover:s="render",prefetch:r="none",relative:d,reloadDocument:h,replace:v,mask:E,state:y,target:m,to:p,preventScrollReset:R,viewTransition:D,defaultShouldRevalidate:B,...Y},j){let{basename:L,navigator:q,useTransitions:F}=U.useContext(ge),V=typeof p=="string"&&or.test(p),W=nm(p,L);p=W.to;let nt=w0(p,{relative:d}),X=Be(),$=null;if(E){let vt=Si(E,[],X.mask?X.mask.pathname:"/",!0);L!=="/"&&(vt.pathname=vt.pathname==="/"?L:Le([L,vt.pathname])),$=q.createHref(vt)}let[mt,Ot,kt]=Tg(r,Y),Gt=Ng(p,{replace:v,mask:E,state:y,target:m,preventScrollReset:R,relative:d,viewTransition:D,defaultShouldRevalidate:B,useTransitions:F});function J(vt){c&&c(vt),vt.defaultPrevented||Gt(vt)}let zt=!(W.isExternal||h),yt=U.createElement("a",{...Y,...kt,href:(zt?$:void 0)||W.absoluteURL||nt,onClick:zt?J:c,ref:zg(j,Ot),target:m,"data-discover":!V&&s==="render"?"true":void 0});return mt&&!V?U.createElement(U.Fragment,null,yt,U.createElement(Rg,{page:nt})):yt});ym.displayName="Link";var Mg=U.forwardRef(function({"aria-current":c="page",caseSensitive:s=!1,className:r="",end:d=!1,style:h,to:v,viewTransition:E,children:y,...m},p){let R=Qn(v,{relative:m.relative}),D=Be(),B=U.useContext(bi),{navigator:Y,basename:j}=U.useContext(ge),L=B!=null&&qg(R)&&E===!0,q=Y.encodeLocation?Y.encodeLocation(R).pathname:R.pathname,F=D.pathname,V=B&&B.navigation&&B.navigation.location?B.navigation.location.pathname:null;s||(F=F.toLowerCase(),V=V?V.toLowerCase():null,q=q.toLowerCase()),V&&j&&(V=il(V,j)||V);const W=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let nt=F===q||!d&&F.startsWith(q)&&F.charAt(W)==="/",X=V!=null&&(V===q||!d&&V.startsWith(q)&&V.charAt(q.length)==="/"),$={isActive:nt,isPending:X,isTransitioning:L},mt=nt?c:void 0,Ot;typeof r=="function"?Ot=r($):Ot=[r,nt?"active":null,X?"pending":null,L?"transitioning":null].filter(Boolean).join(" ");let kt=typeof h=="function"?h($):h;return U.createElement(ym,{...m,"aria-current":mt,className:Ot,ref:p,style:kt,to:v,viewTransition:E},typeof y=="function"?y($):y)});Mg.displayName="NavLink";var Dg=U.forwardRef(({discover:i="render",fetcherKey:c,navigate:s,reloadDocument:r,replace:d,state:h,method:v=oi,action:E,onSubmit:y,relative:m,preventScrollReset:p,viewTransition:R,defaultShouldRevalidate:D,...B},Y)=>{let{useTransitions:j}=U.useContext(ge),L=Lg(),q=Bg(E,{relative:m}),F=v.toLowerCase()==="get"?"get":"post",V=typeof E=="string"&&or.test(E),W=nt=>{if(y&&y(nt),nt.defaultPrevented)return;nt.preventDefault();let X=nt.nativeEvent.submitter,$=(X==null?void 0:X.getAttribute("formmethod"))||v,mt=()=>L(X||nt.currentTarget,{fetcherKey:c,method:$,navigate:s,replace:d,state:h,relative:m,preventScrollReset:p,viewTransition:R,defaultShouldRevalidate:D});j&&s!==!1?U.startTransition(()=>mt()):mt()};return U.createElement("form",{ref:Y,method:F,action:q,onSubmit:r?y:W,...B,"data-discover":!V&&i==="render"?"true":void 0})});Dg.displayName="Form";function Cg(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vm(i){let c=U.useContext(wa);return Ct(c,Cg(i)),c}function Ng(i,{target:c,replace:s,mask:r,state:d,preventScrollReset:h,relative:v,viewTransition:E,defaultShouldRevalidate:y,useTransitions:m}={}){let p=mr(),R=Be(),D=Qn(i,{relative:v});return U.useCallback(B=>{if(rg(B,c)){B.preventDefault();let Y=s!==void 0?s:Gn(R)===Gn(D),j=()=>p(i,{replace:Y,mask:r,state:d,preventScrollReset:h,relative:v,viewTransition:E,defaultShouldRevalidate:y});m?U.startTransition(()=>j()):j()}},[R,p,D,s,r,d,c,i,h,v,E,y,m])}function hS(i){Ue(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 c=U.useRef(cr(i)),s=U.useRef(!1),r=Be(),d=U.useMemo(()=>sg(r.search,s.current?null:c.current),[r.search]),h=mr(),v=U.useCallback((E,y)=>{const m=cr(typeof E=="function"?E(new URLSearchParams(d)):E);s.current=!0,h("?"+m,y)},[h,d]);return[d,v]}var Hg=0,xg=()=>`__${String(++Hg)}__`;function Lg(){let{router:i}=vm("useSubmit"),{basename:c}=U.useContext(ge),s=I0(),r=i.fetch,d=i.navigate;return U.useCallback(async(h,v={})=>{let{action:E,method:y,encType:m,formData:p,body:R}=hg(h,c);if(v.navigate===!1){let D=v.fetcherKey||xg();await r(D,s,v.action||E,{defaultShouldRevalidate:v.defaultShouldRevalidate,preventScrollReset:v.preventScrollReset,formData:p,body:R,formMethod:v.method||y,formEncType:v.encType||m,flushSync:v.flushSync})}else await d(v.action||E,{defaultShouldRevalidate:v.defaultShouldRevalidate,preventScrollReset:v.preventScrollReset,formData:p,body:R,formMethod:v.method||y,formEncType:v.encType||m,replace:v.replace,state:v.state,fromRouteId:s,flushSync:v.flushSync,viewTransition:v.viewTransition})},[r,d,c,s])}function Bg(i,{relative:c}={}){let{basename:s}=U.useContext(ge),r=U.useContext(Me);Ct(r,"useFormAction must be used inside a RouteContext");let[d]=r.matches.slice(-1),h={...Qn(i||".",{relative:c})},v=Be();if(i==null){h.search=v.search;let E=new URLSearchParams(h.search),y=E.getAll("index");if(y.some(p=>p==="")){E.delete("index"),y.filter(R=>R).forEach(R=>E.append("index",R));let p=E.toString();h.search=p?`?${p}`:""}}return(!i||i===".")&&d.route.index&&(h.search=h.search?h.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(h.pathname=h.pathname==="/"?s:Le([s,h.pathname])),Gn(h)}function qg(i,{relative:c}={}){let s=U.useContext(cm);Ct(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=vm("useViewTransitionState"),d=Qn(i,{relative:c});if(!s.isTransitioning)return!1;let h=il(s.currentLocation.pathname,r)||s.currentLocation.pathname,v=il(s.nextLocation.pathname,r)||s.nextLocation.pathname;return vi(d.pathname,v)!=null||vi(d.pathname,h)!=null}var jg={};const hi=Object.create(null),Yn=i=>{var c;return jg||((c=globalThis.Deno)==null?void 0:c.env.toObject())||globalThis.__env__||(i?hi:globalThis)},Nl=new Proxy(hi,{get(i,c){return Yn()[c]??hi[c]},has(i,c){return c in Yn()||c in hi},set(i,c,s){const r=Yn(!0);return r[c]=s,!0},deleteProperty(i,c){if(!c)return!1;const s=Yn(!0);return delete s[c],!0},ownKeys(){const i=Yn(!0);return Object.keys(i)}});Nl.NODE_ENV;var mi=class extends Error{constructor(i,c){super(i,c),this.name="BetterAuthError",this.message=i,this.stack=""}};const Yg=47;function gm(i){let c=i.length;for(;c>0&&i.charCodeAt(c-1)===Yg;)c--;return c===i.length?i:i.slice(0,c)}function wg(i){try{return(gm(new URL(i).pathname)||"/")!=="/"}catch{throw new mi(`Invalid base URL: ${i}. Please provide a valid base URL.`)}}function Gg(i){try{const c=new URL(i);if(c.protocol!=="http:"&&c.protocol!=="https:")throw new mi(`Invalid base URL: ${i}. URL must include 'http://' or 'https://'`)}catch(c){throw c instanceof mi?c:new mi(`Invalid base URL: ${i}. Please provide a valid base URL.`,{cause:c})}}function Ff(i,c="/api/auth"){if(Gg(i),wg(i))return i;const s=gm(i);return!c||c==="/"?s:(c=c.startsWith("/")?c:`/${c}`,`${s}${c}`)}function Xg(i,c,s,r,d){if(i)return Ff(i,c);{const h=Nl.BETTER_AUTH_URL||Nl.NEXT_PUBLIC_BETTER_AUTH_URL||Nl.PUBLIC_BETTER_AUTH_URL||Nl.NUXT_PUBLIC_BETTER_AUTH_URL||Nl.NUXT_PUBLIC_AUTH_URL||(Nl.BASE_URL!=="/"?Nl.BASE_URL:void 0);if(h)return Ff(h,c)}if(typeof window<"u"&&window.location)return Ff(window.location.origin,c)}const Qg={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},Zg=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,Yh={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},Vg=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Jg(i){return i instanceof Date&&!isNaN(i.getTime())}function Kg(i){const c=Vg.exec(i);if(!c)return null;const[,s,r,d,h,v,E,y,m,p,R]=c,D=new Date(Date.UTC(parseInt(s,10),parseInt(r,10)-1,parseInt(d,10),parseInt(h,10),parseInt(v,10),parseInt(E,10),y?parseInt(y.padEnd(3,"0"),10):0));if(m){const B=(parseInt(p,10)*60+parseInt(R,10))*(m==="+"?-1:1);D.setUTCMinutes(D.getUTCMinutes()+B)}return Jg(D)?D:null}function $g(i,c={}){const{strict:s=!1,warnings:r=!1,reviver:d,parseDates:h=!0}=c;if(typeof i!="string")return i;const v=i.trim(),E=v.toLowerCase();if(E.length<=9&&E in Yh)return Yh[E];if(!Zg.test(v)){if(s)throw new SyntaxError("[better-json] Invalid JSON");return i}if(Object.entries(Qg).some(([y,m])=>{const p=m.test(v);return p&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${y} pattern`),p})&&s)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(v,(m,p)=>{if(m==="__proto__"||m==="constructor"&&p&&typeof p=="object"&&"prototype"in p){r&&console.warn(`[better-json] Dropping "${m}" key to prevent prototype pollution`);return}if(h&&typeof p=="string"){const R=Kg(p);if(R)return R}return d?d(m,p):p})}catch(y){if(s)throw y;return i}}function Wg(i,c={strict:!0}){return $g(i,c)}const kg=["javascript:","data:","vbscript:"];function Fg(i){let c;try{c=new URL(i)}catch{return!0}return!kg.includes(c.protocol)}const Pg={id:"redirect",name:"Redirect",hooks:{onSuccess(i){var c,s;if((c=i.data)!=null&&c.url&&((s=i.data)!=null&&s.redirect)&&Fg(i.data.url)&&typeof window<"u"&&window.location&&window.location)try{window.location.href=i.data.url}catch{}}}};let xe=[],Hl=0;const yi=4,Ig=globalThis.nanostoresGlobal||(globalThis.nanostoresGlobal={epoch:0});let tp=()=>{for(Hl=0;Hl<xe.length;Hl+=yi)xe[Hl](xe[Hl+1].value,xe[Hl+2],xe[Hl+3]);xe.length=0};const wh=i=>{let c=[],s={get(){return s.lc||s.listen(()=>{})(),s.value},init:i,lc:0,listen(r){return s.lc=c.push(r),()=>{for(let h=Hl+yi;h<xe.length;)xe[h]===r?xe.splice(h,yi):h+=yi;let d=c.indexOf(r);~d&&(c.splice(d,1),--s.lc||s.off())}},notify(r,d){Ig.epoch++;let h=!xe.length&&!0;for(let v of c)xe.push(v,s,r,d);h&&tp()},off(){},set(r){let d=s.value;d!==r&&(s.value=r,s.notify(d))},subscribe(r){let d=s.listen(r);return r(s.value),d},value:i};return s},ep=2,lp=5,ri=6,si=10;let pm=(i,c,s,r)=>(i.events=i.events||{},i.events[s+si]||(i.events[s+si]=r(d=>{i.events[s].reduceRight((h,v)=>(v(h),h),{shared:{},...d})})),i.events[s]=i.events[s]||[],i.events[s].push(c),()=>{let d=i.events[s],h=d.indexOf(c);d.splice(h,1),d.length||(delete i.events[s],i.events[s+si](),delete i.events[s+si])}),ap=(i,c)=>pm(i,c,ep,s=>{let r=i.set,d=i.setKey;return i.setKey&&(i.setKey=(h,v)=>{let E;if(s({abort:()=>{E=!0},changed:h,newValue:{...i.value,[h]:v}}),!E)return d(h,v)}),i.set=h=>{let v;if(s({abort:()=>{v=!0},newValue:h}),!v)return r(h)},()=>{i.set=r,i.setKey=d}});const np=1e3;let up=(i,c)=>pm(i,r=>{let d=c(r);d&&i.events[ri].push(d)},lp,r=>{let d=i.listen;i.listen=(...v)=>(!i.lc&&!i.active&&(i.active=!0,r()),d(...v));let h=i.off;return i.events[ri]=[],i.off=()=>{h(),setTimeout(()=>{if(i.active&&!i.lc){i.active=!1;for(let v of i.events[ri])v();i.events[ri]=[]}},np)},()=>{i.listen=d,i.off=h}});function ip(i,c,s){let r=new Set(c);return i.listen((d,h,v)=>{(v===void 0?c.some(E=>d[E]!==h[E]):r.has(v)||r.has(v.split(/\.|\[/)[0]))&&s(d,h,v)})}function Gh(i){if(typeof i!="object"||i===null)return!1;const c=Object.getPrototypeOf(i);return c===Object.prototype||c===null}function pi(i,c){if(i===c)return!0;if(Array.isArray(i)&&Array.isArray(c)){if(i.length!==c.length)return!1;for(let s=0;s<i.length;s++)if(!pi(i[s],c[s]))return!1;return!0}if(Gh(i)&&Gh(c)){const s=Object.keys(i),r=Object.keys(c);if(s.length!==r.length)return!1;for(const d of s)if(!(d in c)||!pi(i[d],c[d]))return!1;return!0}return!1}function cp(i,c){return ap(i,({newValue:s,abort:r})=>{c(i.value,s)&&r()})}const Pf=Symbol.for("better-auth:broadcast-channel"),fp=()=>Math.floor(Date.now()/1e3);var rp=class{constructor(i="better-auth.message"){ja(this,"listeners",new Set);ja(this,"name");this.name=i}subscribe(i){return this.listeners.add(i),()=>{this.listeners.delete(i)}}post(i){if(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...i,timestamp:fp()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const i=c=>{if(c.key!==this.name)return;const s=JSON.parse(c.newValue??"{}");(s==null?void 0:s.event)!=="session"||!(s!=null&&s.data)||this.listeners.forEach(r=>r(s))};return window.addEventListener("storage",i),()=>{window.removeEventListener("storage",i)}}};function If(i="better-auth.message"){return globalThis[Pf]||(globalThis[Pf]=new rp(i)),globalThis[Pf]}const tr=Symbol.for("better-auth:focus-manager");var sp=class{constructor(){ja(this,"listeners",new Set)}subscribe(i){return this.listeners.add(i),()=>{this.listeners.delete(i)}}setFocused(i){this.listeners.forEach(c=>c(i))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};const i=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",i,!1),()=>{document.removeEventListener("visibilitychange",i,!1)}}};function Xh(){return globalThis[tr]||(globalThis[tr]=new sp),globalThis[tr]}const er=Symbol.for("better-auth:online-manager");var op=class{constructor(){ja(this,"listeners",new Set);ja(this,"isOnline",typeof navigator<"u"?navigator.onLine:!0)}subscribe(i){return this.listeners.add(i),()=>{this.listeners.delete(i)}}setOnline(i){this.isOnline=i,this.listeners.forEach(c=>c(i))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const i=()=>this.setOnline(!0),c=()=>this.setOnline(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",c,!1),()=>{window.removeEventListener("online",i,!1),window.removeEventListener("offline",c,!1)}}};function lr(){return globalThis[er]||(globalThis[er]=new op),globalThis[er]}const ar=()=>Math.floor(Date.now()/1e3),dp=5;function hp(i){var V,W,nt;const{fetchSession:c,shouldPollSession:s=()=>!0,sessionSignal:r,options:d={}}=i,h=((V=d.sessionOptions)==null?void 0:V.refetchInterval)??0,v=((W=d.sessionOptions)==null?void 0:W.refetchOnWindowFocus)??!0,E=((nt=d.sessionOptions)==null?void 0:nt.refetchWhenOffline)??!1,y={isInitialized:!1,lastSessionRequest:0},m=()=>E||lr().isOnline,p=X=>{if(m()){if((X==null?void 0:X.event)==="storage"){c();return}if((X==null?void 0:X.event)==="poll"){y.lastSessionRequest=ar(),c();return}if((X==null?void 0:X.event)==="visibilitychange"){if(ar()-y.lastSessionRequest<dp)return;y.lastSessionRequest=ar(),c();return}c()}},R=X=>{If().post({event:"session",data:{trigger:X},clientId:Math.random().toString(36).substring(7)})},D=()=>{h&&h>0&&(y.pollInterval=setInterval(()=>{s()&&p({event:"poll"})},h*1e3))},B=()=>{y.unsubscribeBroadcast=If().subscribe(()=>{p({event:"storage"})})},Y=()=>{v&&(y.unsubscribeFocus=Xh().subscribe(()=>{p({event:"visibilitychange"})}))},j=()=>{y.unsubscribeOnline=lr().subscribe(X=>{X&&p({event:"visibilitychange"})})},L=()=>{y.unsubscribeSignal=r.listen(()=>{c()})};return{init:()=>{y.isInitialized||(y.isInitialized=!0,D(),B(),Y(),j(),L(),y.cleanupBroadcastSetup=If().setup(),y.cleanupFocusSetup=Xh().setup(),y.cleanupOnlineSetup=lr().setup())},cleanup:()=>{y.isInitialized&&(y.pollInterval&&(clearInterval(y.pollInterval),y.pollInterval=void 0),y.unsubscribeBroadcast&&(y.unsubscribeBroadcast(),y.unsubscribeBroadcast=void 0),y.unsubscribeFocus&&(y.unsubscribeFocus(),y.unsubscribeFocus=void 0),y.unsubscribeOnline&&(y.unsubscribeOnline(),y.unsubscribeOnline=void 0),y.unsubscribeSignal&&(y.unsubscribeSignal(),y.unsubscribeSignal=void 0),y.cleanupBroadcastSetup&&(y.cleanupBroadcastSetup(),y.cleanupBroadcastSetup=void 0),y.cleanupFocusSetup&&(y.cleanupFocusSetup(),y.cleanupFocusSetup=void 0),y.cleanupOnlineSetup&&(y.cleanupOnlineSetup(),y.cleanupOnlineSetup=void 0),y.isInitialized=!1,y.lastSessionRequest=0)},triggerRefetch:p,broadcastSessionUpdate:R}}const mp=()=>typeof window>"u";function Qh(i){return typeof i=="object"&&i!==null&&"data"in i&&"error"in i?i:{data:i,error:null}}function yp(i){return!i||i.session===null&&i.user===null?null:i}function vp(i,c){return pi(i.data,c.data)&&i.error===c.error&&i.isPending===c.isPending&&i.isRefetching===c.isRefetching&&i.refetch===c.refetch}function gp(i,c){const s=wh(!1);let r;const d=m=>E(m),h=wh({data:null,error:null,isPending:!0,isRefetching:!1,refetch:d});cp(h,vp);const v=m=>{if(r!==m)return;const p=h.get();r=void 0,!(!p.isPending&&!p.isRefetching)&&h.set({...p,isPending:!1,isRefetching:!1,refetch:d})},E=async m=>{r==null||r.abort();const p=new AbortController;r=p;const R=h.get();h.set({...R,isPending:R.data===null,isRefetching:!0,error:null,refetch:d});try{const D=await i("/get-session",{method:"GET",query:m==null?void 0:m.query,signal:p.signal});if(p.signal.aborted){v(p);return}let{data:B,error:Y}=Qh(D);if(B!=null&&B.needsRefresh)try{const F=await i("/get-session",{method:"POST",signal:p.signal});if(p.signal.aborted){v(p);return}({data:B,error:Y}=Qh(F))}catch{if(p.signal.aborted){v(p);return}}if(Y){const F=h.get(),V=(Y==null?void 0:Y.status)===401;h.set({data:V?null:F.data,error:Y,isPending:!1,isRefetching:!1,refetch:d});return}const j=yp(B),L=h.get(),q=L.data!=null&&j!=null&&pi(L.data,j)?L.data:j;h.set({data:q,error:null,isPending:!1,isRefetching:!1,refetch:d})}catch(D){if(p.signal.aborted){v(p);return}const B=h.get();h.set({data:B.data,error:D,isPending:!1,isRefetching:!1,refetch:d})}};let y=()=>{};return up(h,()=>{let m;mp()||(m=setTimeout(()=>{E()},0));const p=hp({fetchSession:E,shouldPollSession:()=>h.get().data!=null,sessionSignal:s,options:c});return p.init(),y=p.broadcastSessionUpdate,()=>{m&&clearTimeout(m);const R=r;R==null||R.abort(),R&&v(R),p.cleanup()}}),{session:h,$sessionSignal:s,broadcastSessionUpdate:m=>y(m)}}function nr(i){if(i===null||typeof i!="object")return!1;const c=Object.getPrototypeOf(i);return c!==null&&c!==Object.prototype&&Object.getPrototypeOf(c)!==null||Symbol.iterator in i?!1:Symbol.toStringTag in i?Object.prototype.toString.call(i)==="[object Module]":!0}function fr(i,c,s=".",r){if(!nr(c))return fr(i,{},s,r);const d={...c};for(const h of Object.keys(i)){if(h==="__proto__"||h==="constructor")continue;const v=i[h];v!=null&&(r&&r(d,h,v,s)||(Array.isArray(v)&&Array.isArray(d[h])?d[h]=[...v,...d[h]]:nr(v)&&nr(d[h])?d[h]=fr(v,d[h],(s?`${s}.`:"")+h.toString(),r):d[h]=v))}return d}function pp(i){return(...c)=>c.reduce((s,r)=>fr(s,r,"",i),{})}const Sp=pp();var bp=Object.defineProperty,Ep=Object.defineProperties,Tp=Object.getOwnPropertyDescriptors,Zh=Object.getOwnPropertySymbols,Rp=Object.prototype.hasOwnProperty,_p=Object.prototype.propertyIsEnumerable,Vh=(i,c,s)=>c in i?bp(i,c,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[c]=s,He=(i,c)=>{for(var s in c||(c={}))Rp.call(c,s)&&Vh(i,s,c[s]);if(Zh)for(var s of Zh(c))_p.call(c,s)&&Vh(i,s,c[s]);return i},Ge=(i,c)=>Ep(i,Tp(c)),Ap=class extends Error{constructor(i,c,s){super(c||i.toString(),{cause:s}),this.status=i,this.statusText=c,this.error=s,Error.captureStackTrace(this,this.constructor)}},Op=async(i,c)=>{var s,r,d,h,v,E;let y=c||{};const m={onRequest:[c==null?void 0:c.onRequest],onResponse:[c==null?void 0:c.onResponse],onSuccess:[c==null?void 0:c.onSuccess],onError:[c==null?void 0:c.onError],onRetry:[c==null?void 0:c.onRetry]};if(!c||!(c!=null&&c.plugins))return{url:i,options:y,hooks:m};for(const p of(c==null?void 0:c.plugins)||[]){if(p.init){const R=await((s=p.init)==null?void 0:s.call(p,i.toString(),c));y=R.options||y,i=R.url}m.onRequest.push((r=p.hooks)==null?void 0:r.onRequest),m.onResponse.push((d=p.hooks)==null?void 0:d.onResponse),m.onSuccess.push((h=p.hooks)==null?void 0:h.onSuccess),m.onError.push((v=p.hooks)==null?void 0:v.onError),m.onRetry.push((E=p.hooks)==null?void 0:E.onRetry)}return{url:i,options:y,hooks:m}},Jh=class{constructor(i){this.options=i}shouldAttemptRetry(i,c){return this.options.shouldRetry?Promise.resolve(i<this.options.attempts&&this.options.shouldRetry(c)):Promise.resolve(i<this.options.attempts)}getDelay(){return this.options.delay}},zp=class{constructor(i){this.options=i}shouldAttemptRetry(i,c){return this.options.shouldRetry?Promise.resolve(i<this.options.attempts&&this.options.shouldRetry(c)):Promise.resolve(i<this.options.attempts)}getDelay(i){return Math.min(this.options.maxDelay,this.options.baseDelay*2**i)}};function Up(i){if(typeof i=="number")return new Jh({type:"linear",attempts:i,delay:1e3});switch(i.type){case"linear":return new Jh(i);case"exponential":return new zp(i);default:throw new Error("Invalid retry strategy")}}var Mp=async i=>{const c={},s=async r=>typeof r=="function"?await r():r;if(i!=null&&i.auth){if(i.auth.type==="Bearer"){const r=await s(i.auth.token);if(!r)return c;c.authorization=`Bearer ${r}`}else if(i.auth.type==="Basic"){const[r,d]=await Promise.all([s(i.auth.username),s(i.auth.password)]);if(!r||!d)return c;c.authorization=`Basic ${btoa(`${r}:${d}`)}`}else if(i.auth.type==="Custom"){const[r,d]=await Promise.all([s(i.auth.prefix),s(i.auth.value)]);if(!d)return c;c.authorization=`${r??""} ${d}`}}return c},Dp=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Cp(i){const c=i.headers.get("content-type"),s=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!c)return"json";const r=c.split(";").shift()||"";return Dp.test(r)?"json":s.has(r)||r.startsWith("text/")?"text":"blob"}function Np(i){try{return JSON.parse(i),!0}catch{return!1}}function Sm(i){if(i===void 0)return!1;const c=typeof i;return c==="string"||c==="number"||c==="boolean"||c===null?!0:c!=="object"?!1:Array.isArray(i)?!0:i.buffer?!1:i.constructor&&i.constructor.name==="Object"||typeof i.toJSON=="function"}function Kh(i){try{return JSON.parse(i)}catch{return i}}function $h(i){return typeof i=="function"}function Hp(i){if(i!=null&&i.customFetchImpl)return i.customFetchImpl;if(typeof globalThis<"u"&&$h(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&$h(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}function bm(...i){const c={};for(const s of i)if(s)if(s instanceof Headers)s.forEach((r,d)=>{c[d]=r});else{const r=Array.isArray(s)?s:Object.entries(s);for(const[d,h]of r)h!=null&&(c[d]=h)}return c}async function xp(i){const c=new Headers(bm(i==null?void 0:i.headers,await Mp(i)));if(!c.has("content-type")){const s=Lp(i==null?void 0:i.body);s&&c.set("content-type",s)}return c}function Lp(i){return Sm(i)?"application/json":null}function Bp(i){const c=i.get("content-type");return c?c.split(";")[0].trim().toLowerCase():null}function qp(i,c){const{body:s}=i;return s?!Sm(s)||typeof s=="string"?s:Bp(c)==="application/x-www-form-urlencoded"?new URLSearchParams(s).toString():JSON.stringify(s):null}function jp(i,c){var s;if(c!=null&&c.method)return c.method.toUpperCase();if(i.startsWith("@")){const r=(s=i.split("@")[1])==null?void 0:s.split("/")[0];return Tm.includes(r)?r.toUpperCase():c!=null&&c.body?"POST":"GET"}return c!=null&&c.body?"POST":"GET"}function Yp(i,c){let s;return!(i!=null&&i.signal)&&(i!=null&&i.timeout)&&(s=setTimeout(()=>c==null?void 0:c.abort(),i==null?void 0:i.timeout)),{abortTimeout:s,clearTimeout:()=>{s&&clearTimeout(s)}}}var wp=class Em extends Error{constructor(c,s){super(s||JSON.stringify(c,null,2)),this.issues=c,Object.setPrototypeOf(this,Em.prototype)}};async function wn(i,c){const s=await i["~standard"].validate(c);if(s.issues)throw new wp(s.issues);return s.value}var Tm=["get","post","put","patch","delete"],Gp=i=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(c,s){var r,d,h,v;const E=((d=(r=i.plugins)==null?void 0:r.find(y=>{var m;return(m=y.schema)!=null&&m.config?c.startsWith(y.schema.config.baseURL||"")||c.startsWith(y.schema.config.prefix||""):!1}))==null?void 0:d.schema)||i.schema;if(E){let y=c;(h=E.config)!=null&&h.prefix&&y.startsWith(E.config.prefix)&&(y=y.replace(E.config.prefix,""),E.config.baseURL&&(c=c.replace(E.config.prefix,E.config.baseURL))),(v=E.config)!=null&&v.baseURL&&y.startsWith(E.config.baseURL)&&(y=y.replace(E.config.baseURL,"")),y.startsWith("/")&&y.charAt(1)==="@"&&(y=y.substring(1));const m=E.schema[y];if(m){let p=s==null?void 0:s.headers;if(m.headers&&!(s!=null&&s.disableValidation)){const D={};if(s!=null&&s.headers){if(s.headers instanceof Headers)s.headers.forEach((j,L)=>{D[L.toLowerCase()]=j});else if(typeof s.headers=="object")for(const[j,L]of Object.entries(s.headers))L!=null&&(D[j.toLowerCase()]=L)}const B=await wn(m.headers,D),Y={};for(const[j,L]of Object.entries(B))Y[j.toLowerCase()]=L;p=Y}let R=Ge(He({},s),{method:m.method,output:m.output,headers:p});return s!=null&&s.disableValidation||(R=Ge(He({},R),{body:m.input?await wn(m.input,s==null?void 0:s.body):s==null?void 0:s.body,params:m.params?await wn(m.params,s==null?void 0:s.params):s==null?void 0:s.params,query:m.query?await wn(m.query,s==null?void 0:s.query):s==null?void 0:s.query})),{url:c,options:R}}}return{url:c,options:s}}}),Xp=i=>{async function c(s,r){const d=Ge(He(He({},i),r),{headers:bm(i==null?void 0:i.headers,r==null?void 0:r.headers),plugins:[...(i==null?void 0:i.plugins)||[],Gp(i||{}),...(r==null?void 0:r.plugins)||[]]});if(i!=null&&i.catchAllError)try{return await rr(s,d)}catch(h){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:h}}}return await rr(s,d)}return c},Qp=i=>i==="."||i==="..";function Zp(i,c){let s=i;for(const[r,d]of c)s=s.replace(r,d);if(Qp(s))throw new TypeError("Path parameters cannot be reserved path segments");return encodeURIComponent(s)}function Vp(i,c){const{baseURL:s,params:r,query:d}=c||{query:{},params:{},baseURL:""};let h=i.startsWith("http")?i.split("/").slice(0,3).join("/"):s||"";if(i.startsWith("@")){const D=i.toString().split("@")[1].split("/")[0];Tm.includes(D)&&(i=i.replace(`@${D}/`,"/"))}h.endsWith("/")||(h+="/");let[v,E]=i.replace(h,"").split("?");const y=new URLSearchParams(E);for(const[D,B]of Object.entries(d||{})){if(B==null)continue;let Y;if(typeof B=="string")Y=B;else if(Array.isArray(B)){for(const j of B)y.append(D,j);continue}else Y=JSON.stringify(B);y.set(D,Y)}const m=new Map;if(r)if(Array.isArray(r)){const D=v.split("/").filter(B=>B.startsWith(":"));for(const[B,Y]of D.entries()){const j=r[B];m.set(Y,String(j))}}else for(const[D,B]of Object.entries(r))m.set(`:${D}`,String(B));v=v.split("/").map(D=>Zp(D,m)).join("/"),v=v.replace(/^\/+/,"");let p=y.toString();return p=p.length>0?`?${p}`.replace(/\+/g,"%20"):"",h.startsWith("http")?new URL(`${v}${p}`,h):`${h}${v}${p}`}var rr=async(i,c)=>{var s,r,d,h,v,E,y,m;const{hooks:p,url:R,options:D}=await Op(i,c),B=Hp(D),Y=new AbortController,j=(s=D.signal)!=null?s:Y.signal,L=Vp(R,D),q=await xp(D),F=qp(D,q),V=jp(R,D),W=Ge(He({},D),{url:L,headers:q,body:F,method:V,signal:j});for(const zt of p.onRequest)if(zt){const yt=await zt(W);typeof yt=="object"&&yt!==null&&Object.assign(W,yt)}("pipeTo"in W&&typeof W.pipeTo=="function"||typeof((r=c==null?void 0:c.body)==null?void 0:r.pipe)=="function")&&("duplex"in W||(W.duplex="half"));const{clearTimeout:nt}=Yp(D,Y);let X=await B(W.url,W);nt();const $={response:X,request:W};for(const zt of p.onResponse)if(zt){const yt=await zt(Ge(He({},$),{response:(d=c==null?void 0:c.hookOptions)!=null&&d.cloneResponse?X.clone():X}));yt instanceof Response?X=yt:typeof yt=="object"&&yt!==null&&(X=yt.response)}if(X.ok){if(!(W.method!=="HEAD"))return{data:"",error:null};const yt=Cp(X),vt={data:null,response:X,request:W};if(yt==="json"||yt==="text"){const M=await X.text(),w=(h=W.jsonParser)!=null?h:Kh;vt.data=await w(M)}else vt.data=await X[yt]();W!=null&&W.output&&W.output&&!W.disableValidation&&(vt.data=await wn(W.output,vt.data));for(const M of p.onSuccess)M&&await M(Ge(He({},vt),{response:(v=c==null?void 0:c.hookOptions)!=null&&v.cloneResponse?X.clone():X}));return c!=null&&c.throw?vt.data:{data:vt.data,error:null}}const mt=(E=c==null?void 0:c.jsonParser)!=null?E:Kh,Ot=await X.text(),kt=Np(Ot),Gt=kt?await mt(Ot):null,J={response:X,responseText:Ot,request:W,error:Ge(He({},Gt),{status:X.status,statusText:X.statusText})};for(const zt of p.onError)zt&&await zt(Ge(He({},J),{response:(y=c==null?void 0:c.hookOptions)!=null&&y.cloneResponse?X.clone():X}));if(c!=null&&c.retry){const zt=Up(c.retry),yt=(m=c.retryAttempt)!=null?m:0;if(await zt.shouldAttemptRetry(yt,X)){for(const M of p.onRetry)M&&await M($);const vt=zt.getDelay(yt);return await new Promise(M=>setTimeout(M,vt)),await rr(i,Ge(He({},c),{retryAttempt:yt+1}))}}if(c!=null&&c.throw)throw new Ap(X.status,X.statusText,kt?Gt:Ot);return{data:null,error:Ge(He({},Gt),{status:X.status,statusText:X.statusText})}},Il={};const Jp=i=>{if(typeof process>"u")return;const c=i??"/api/auth";if(Il.NEXT_PUBLIC_AUTH_URL)return Il.NEXT_PUBLIC_AUTH_URL;if(typeof window>"u"){if(Il.NEXTAUTH_URL)try{return Il.NEXTAUTH_URL}catch{}if(Il.VERCEL_URL)try{const s=Il.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${s}${Il.VERCEL_URL}`).origin}${c}`}catch{}}},Kp=(i,c)=>{var nt,X,$,mt,Ot,kt,Gt;const s="credentials"in Request.prototype,r=Xg(i==null?void 0:i.baseURL,i==null?void 0:i.basePath)??Jp(i==null?void 0:i.basePath)??"/api/auth",d=((nt=i==null?void 0:i.plugins)==null?void 0:nt.flatMap(J=>J.fetchPlugins).filter(J=>J!==void 0))||[],h={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:(X=i==null?void 0:i.fetchOptions)==null?void 0:X.onSuccess,onError:($=i==null?void 0:i.fetchOptions)==null?void 0:$.onError,onRequest:(mt=i==null?void 0:i.fetchOptions)==null?void 0:mt.onRequest,onResponse:(Ot=i==null?void 0:i.fetchOptions)==null?void 0:Ot.onResponse}},{onSuccess:v,onError:E,onRequest:y,onResponse:m,...p}=(i==null?void 0:i.fetchOptions)||{},R=Xp({baseURL:r,...s?{credentials:"include"}:{},method:"GET",jsonParser(J){return J?Wg(J,{strict:!1}):null},customFetchImpl:fetch,...p,plugins:[h,...p.plugins||[],...i!=null&&i.disableDefaultFetchPlugins?[]:[Pg],...d]}),{$sessionSignal:D,session:B,broadcastSessionUpdate:Y}=gp(R,i),j=(i==null?void 0:i.plugins)||[];let L={};const q={$sessionSignal:D,session:B},F={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},V=[{signal:"$sessionSignal",matcher(J){return J==="/sign-out"||J==="/update-user"||J==="/update-session"||J==="/sign-up/email"||J==="/sign-in/email"||J==="/delete-user"||J==="/verify-email"||J==="/revoke-sessions"||J==="/revoke-session"||J==="/revoke-other-sessions"||J==="/change-email"||J==="/change-password"},callback(J){J==="/sign-out"?Y("signout"):(J==="/update-user"||J==="/update-session")&&Y("updateUser")}}];for(const J of j)J.getAtoms&&Object.assign(q,(kt=J.getAtoms)==null?void 0:kt.call(J,R)),J.pathMethods&&Object.assign(F,J.pathMethods),J.atomListeners&&V.push(...J.atomListeners);const W={notify:J=>{q[J].set(!q[J].get())},listen:(J,zt)=>{q[J].subscribe(zt)},atoms:q};for(const J of j)J.getActions&&(L=Sp(((Gt=J.getActions)==null?void 0:Gt.call(J,R,W,i))??{},L));return{get baseURL(){return r},pluginsActions:L,pluginsAtoms:q,pluginPathMethods:F,atomListeners:V,$fetch:R,$store:W}};function $p(i){return typeof i=="object"&&i!==null&&"get"in i&&typeof i.get=="function"&&"lc"in i&&typeof i.lc=="number"}function Wp(i){return i.charAt(0).toUpperCase()+i.slice(1)}const kp=new RegExp("[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+","gu"),Fp=/['\u2019]/g;function Pp(i){return i.replace(Fp,"").match(kp)??[]}function Ip(i){return Pp(i).map(c=>c.toLowerCase()).join("-")}function tS(i,c,s){const r=c[i],{fetchOptions:d,query:h,...v}=s||{};return r||(d!=null&&d.method?d.method:v&&Object.keys(v).length>0?"POST":"GET")}function eS(i,c,s,r,d){function h(v=[]){return new Proxy(function(){},{get(E,y){if(typeof y!="string"||y==="then"||y==="catch"||y==="finally")return;const m=[...v,y];let p=i;for(const R of m)if(p&&typeof p=="object"&&R in p)p=p[R];else{p=void 0;break}return typeof p=="function"||$p(p)?p:h(m)},apply:async(E,y,m)=>{const p="/"+v.map(Ip).join("/"),R=m[0]||{},D=m[1]||{},{query:B,fetchOptions:Y,...j}=R,L={...D,...Y},q=tS(p,s,R);return await c(p,{...L,body:q==="GET"?void 0:{...j,...(L==null?void 0:L.body)||{}},query:B||(L==null?void 0:L.query),method:q,async onSuccess(F){var nt,X;if(await((nt=L==null?void 0:L.onSuccess)==null?void 0:nt.call(L,F)),!d||L.disableSignal)return;const V=d.filter($=>$.matcher(p));if(!V.length)return;const W=new Set;for(const $ of V){const mt=r[$.signal];if(!mt)return;if(W.has($.signal))continue;W.add($.signal);const Ot=mt.get();setTimeout(()=>{mt.set(!Ot)},10),(X=$.callback)==null||X.call($,p)}}})}})}return h()}function lS(i,c={}){const s=U.useRef(i.get()),{keys:r,deps:d=[i,r]}=c,h=U.useCallback(E=>{const y=m=>{s.current!==m&&(s.current=m,E())};return y(i.value),r!=null&&r.length?ip(i,r,y):i.listen(y)},d),v=()=>s.current;return U.useSyncExternalStore(h,v,v)}function aS(i){return`use${Wp(i)}`}function mS(i){const{pluginPathMethods:c,pluginsActions:s,pluginsAtoms:r,$fetch:d,$store:h,atomListeners:v}=Kp(i),E={};for(const[y,m]of Object.entries(r))E[aS(y)]=()=>lS(m);return eS({...s,...E,$fetch:d,$store:h},d,c,r,v)}export{dS as B,ym as L,Mg as N,sS as O,iS as R,sr as a,fS as b,mS as c,mr as d,rS as e,oS as f,ag as g,cS as h,hS as i,uS as j,U as r,Be as u};
|
|
61
|
+
//# sourceMappingURL=framework-vendor-_YL27Pfc.js.map
|