(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[826],{67:e=>{"use strict";e.exports=require("node:async_hooks")},195:e=>{"use strict";e.exports=require("node:buffer")},477:(e,t,r)=>{"use strict";let n,i,o,a,s,l,c,u,d,p,h,f;r.r(t),r.d(t,{default:()=>cv});var m,g,y,w,b,v={};r.r(v),r.d(v,{hasBrowserEnv:()=>ly,hasStandardBrowserEnv:()=>lw,hasStandardBrowserWebWorkerEnv:()=>lb,origin:()=>lv});var _={};async function S(){let e="_ENTRIES"in globalThis&&_ENTRIES.middleware_instrumentation&&(await _ENTRIES.middleware_instrumentation).register;if(e)try{await e()}catch(e){throw e.message=`An error occurred while loading instrumentation hook: ${e.message}`,e}}r.r(_),r.d(_,{middleware:()=>cf});let E=null;function A(){return E||(E=S()),E}function k(e){return`The edge runtime does not support Node.js '${e}' module.
Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`}process!==r.g.process&&(process.env=r.g.process.env,r.g.process=process),Object.defineProperty(globalThis,"__import_unsupported",{value:function(e){let t=new Proxy(function(){},{get(t,r){if("then"===r)return{};throw Error(k(e))},construct(){throw Error(k(e))},apply(r,n,i){if("function"==typeof i[0])return i[0](t);throw Error(k(e))}});return new Proxy({},{get:()=>t})},enumerable:!1,configurable:!1}),A();class x extends Error{constructor({page:e}){super(`The middleware "${e}" accepts an async API directly with the form:
  
  export function middleware(request, event) {
    return NextResponse.redirect('/new-location')
  }
  
  Read more: https://nextjs.org/docs/messages/middleware-new-signature
  `)}}class T extends Error{constructor(){super(`The request.page has been deprecated in favour of \`URLPattern\`.
  Read more: https://nextjs.org/docs/messages/middleware-request-page
  `)}}class R extends Error{constructor(){super(`The request.ua has been removed in favour of \`userAgent\` function.
  Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent
  `)}}function P(e){let t={},r=[];if(e)for(let[n,i]of e.entries())"set-cookie"===n.toLowerCase()?(r.push(...function(e){var t,r,n,i,o,a=[],s=0;function l(){for(;s<e.length&&/\s/.test(e.charAt(s));)s+=1;return s<e.length}for(;s<e.length;){for(t=s,o=!1;l();)if(","===(r=e.charAt(s))){for(n=s,s+=1,l(),i=s;s<e.length&&"="!==(r=e.charAt(s))&&";"!==r&&","!==r;)s+=1;s<e.length&&"="===e.charAt(s)?(o=!0,s=i,a.push(e.substring(t,n)),t=s):s=n+1}else s+=1;(!o||s>=e.length)&&a.push(e.substring(t,e.length))}return a}(i)),t[n]=1===r.length?r[0]:r):t[n]=i;return t}function O(e){try{return String(new URL(String(e)))}catch(t){throw Error(`URL is malformed "${String(e)}". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`,{cause:t})}}let C=Symbol("response"),I=Symbol("passThrough"),N=Symbol("waitUntil");class U{constructor(e){this[N]=[],this[I]=!1}respondWith(e){this[C]||(this[C]=Promise.resolve(e))}passThroughOnException(){this[I]=!0}waitUntil(e){this[N].push(e)}}class j extends U{constructor(e){super(e.request),this.sourcePage=e.page}get request(){throw new x({page:this.sourcePage})}respondWith(){throw new x({page:this.sourcePage})}}function L(e){return e.replace(/\/$/,"")||"/"}function D(e){let t=e.indexOf("#"),r=e.indexOf("?"),n=r>-1&&(t<0||r<t);return n||t>-1?{pathname:e.substring(0,n?r:t),query:n?e.substring(r,t>-1?t:void 0):"",hash:t>-1?e.slice(t):""}:{pathname:e,query:"",hash:""}}function M(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:r,query:n,hash:i}=D(e);return""+t+r+n+i}function $(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:r,query:n,hash:i}=D(e);return""+r+t+n+i}function H(e,t){if("string"!=typeof e)return!1;let{pathname:r}=D(e);return r===t||r.startsWith(t+"/")}function W(e,t){let r;let n=e.split("/");return(t||[]).some(t=>!!n[1]&&n[1].toLowerCase()===t.toLowerCase()&&(r=t,n.splice(1,1),e=n.join("/")||"/",!0)),{pathname:e,detectedLocale:r}}let B=/(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|\[::1\]|localhost)/;function K(e,t){return new URL(String(e).replace(B,"localhost"),t&&String(t).replace(B,"localhost"))}let q=Symbol("NextURLInternal");class J{constructor(e,t,r){let n,i;"object"==typeof t&&"pathname"in t||"string"==typeof t?(n=t,i=r||{}):i=r||t||{},this[q]={url:K(e,n??i.base),options:i,basePath:""},this.analyze()}analyze(){var e,t,r,n,i;let o=function(e,t){var r,n;let{basePath:i,i18n:o,trailingSlash:a}=null!=(r=t.nextConfig)?r:{},s={pathname:e,trailingSlash:"/"!==e?e.endsWith("/"):a};i&&H(s.pathname,i)&&(s.pathname=function(e,t){if(!H(e,t))return e;let r=e.slice(t.length);return r.startsWith("/")?r:"/"+r}(s.pathname,i),s.basePath=i);let l=s.pathname;if(s.pathname.startsWith("/_next/data/")&&s.pathname.endsWith(".json")){let e=s.pathname.replace(/^\/_next\/data\//,"").replace(/\.json$/,"").split("/"),r=e[0];s.buildId=r,l="index"!==e[1]?"/"+e.slice(1).join("/"):"/",!0===t.parseData&&(s.pathname=l)}if(o){let e=t.i18nProvider?t.i18nProvider.analyze(s.pathname):W(s.pathname,o.locales);s.locale=e.detectedLocale,s.pathname=null!=(n=e.pathname)?n:s.pathname,!e.detectedLocale&&s.buildId&&(e=t.i18nProvider?t.i18nProvider.analyze(l):W(l,o.locales)).detectedLocale&&(s.locale=e.detectedLocale)}return s}(this[q].url.pathname,{nextConfig:this[q].options.nextConfig,parseData:!0,i18nProvider:this[q].options.i18nProvider}),a=function(e,t){let r;if((null==t?void 0:t.host)&&!Array.isArray(t.host))r=t.host.toString().split(":",1)[0];else{if(!e.hostname)return;r=e.hostname}return r.toLowerCase()}(this[q].url,this[q].options.headers);this[q].domainLocale=this[q].options.i18nProvider?this[q].options.i18nProvider.detectDomainLocale(a):function(e,t,r){if(e)for(let o of(r&&(r=r.toLowerCase()),e)){var n,i;if(t===(null==(n=o.domain)?void 0:n.split(":",1)[0].toLowerCase())||r===o.defaultLocale.toLowerCase()||(null==(i=o.locales)?void 0:i.some(e=>e.toLowerCase()===r)))return o}}(null==(t=this[q].options.nextConfig)?void 0:null==(e=t.i18n)?void 0:e.domains,a);let s=(null==(r=this[q].domainLocale)?void 0:r.defaultLocale)||(null==(i=this[q].options.nextConfig)?void 0:null==(n=i.i18n)?void 0:n.defaultLocale);this[q].url.pathname=o.pathname,this[q].defaultLocale=s,this[q].basePath=o.basePath??"",this[q].buildId=o.buildId,this[q].locale=o.locale??s,this[q].trailingSlash=o.trailingSlash}formatPathname(){var e;let t;return t=function(e,t,r,n){if(!t||t===r)return e;let i=e.toLowerCase();return!n&&(H(i,"/api")||H(i,"/"+t.toLowerCase()))?e:M(e,"/"+t)}((e={basePath:this[q].basePath,buildId:this[q].buildId,defaultLocale:this[q].options.forceLocale?void 0:this[q].defaultLocale,locale:this[q].locale,pathname:this[q].url.pathname,trailingSlash:this[q].trailingSlash}).pathname,e.locale,e.buildId?void 0:e.defaultLocale,e.ignorePrefix),(e.buildId||!e.trailingSlash)&&(t=L(t)),e.buildId&&(t=$(M(t,"/_next/data/"+e.buildId),"/"===e.pathname?"index.json":".json")),t=M(t,e.basePath),!e.buildId&&e.trailingSlash?t.endsWith("/")?t:$(t,"/"):L(t)}formatSearch(){return this[q].url.search}get buildId(){return this[q].buildId}set buildId(e){this[q].buildId=e}get locale(){return this[q].locale??""}set locale(e){var t,r;if(!this[q].locale||!(null==(r=this[q].options.nextConfig)?void 0:null==(t=r.i18n)?void 0:t.locales.includes(e)))throw TypeError(`The NextURL configuration includes no locale "${e}"`);this[q].locale=e}get defaultLocale(){return this[q].defaultLocale}get domainLocale(){return this[q].domainLocale}get searchParams(){return this[q].url.searchParams}get host(){return this[q].url.host}set host(e){this[q].url.host=e}get hostname(){return this[q].url.hostname}set hostname(e){this[q].url.hostname=e}get port(){return this[q].url.port}set port(e){this[q].url.port=e}get protocol(){return this[q].url.protocol}set protocol(e){this[q].url.protocol=e}get href(){let e=this.formatPathname(),t=this.formatSearch();return`${this.protocol}//${this.host}${e}${t}${this.hash}`}set href(e){this[q].url=K(e),this.analyze()}get origin(){return this[q].url.origin}get pathname(){return this[q].url.pathname}set pathname(e){this[q].url.pathname=e}get hash(){return this[q].url.hash}set hash(e){this[q].url.hash=e}get search(){return this[q].url.search}set search(e){this[q].url.search=e}get password(){return this[q].url.password}set password(e){this[q].url.password=e}get username(){return this[q].url.username}set username(e){this[q].url.username=e}get basePath(){return this[q].basePath}set basePath(e){this[q].basePath=e.startsWith("/")?e:`/${e}`}toString(){return this.href}toJSON(){return this.href}[Symbol.for("edge-runtime.inspect.custom")](){return{href:this.href,origin:this.origin,protocol:this.protocol,username:this.username,password:this.password,host:this.host,hostname:this.hostname,port:this.port,pathname:this.pathname,search:this.search,searchParams:this.searchParams,hash:this.hash}}clone(){return new J(String(this),this[q].options)}}var F=r(447);let V=Symbol("internal request");class z extends Request{constructor(e,t={}){let r="string"!=typeof e&&"url"in e?e.url:String(e);O(r),e instanceof Request?super(e,t):super(r,t);let n=new J(r,{headers:P(this.headers),nextConfig:t.nextConfig});this[V]={cookies:new F.RequestCookies(this.headers),geo:t.geo||{},ip:t.ip,nextUrl:n,url:n.toString()}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,geo:this.geo,ip:this.ip,nextUrl:this.nextUrl,url:this.url,bodyUsed:this.bodyUsed,cache:this.cache,credentials:this.credentials,destination:this.destination,headers:Object.fromEntries(this.headers),integrity:this.integrity,keepalive:this.keepalive,method:this.method,mode:this.mode,redirect:this.redirect,referrer:this.referrer,referrerPolicy:this.referrerPolicy,signal:this.signal}}get cookies(){return this[V].cookies}get geo(){return this[V].geo}get ip(){return this[V].ip}get nextUrl(){return this[V].nextUrl}get page(){throw new T}get ua(){throw new R}get url(){return this[V].url}}let G=Symbol("internal response"),X=new Set([301,302,303,307,308]);function Y(e,t){var r;if(null==e?void 0:null==(r=e.request)?void 0:r.headers){if(!(e.request.headers instanceof Headers))throw Error("request.headers must be an instance of Headers");let r=[];for(let[n,i]of e.request.headers)t.set("x-middleware-request-"+n,i),r.push(n);t.set("x-middleware-override-headers",r.join(","))}}class Z extends Response{constructor(e,t={}){super(e,t),this[G]={cookies:new F.ResponseCookies(this.headers),url:t.url?new J(t.url,{headers:P(this.headers),nextConfig:t.nextConfig}):void 0}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,url:this.url,body:this.body,bodyUsed:this.bodyUsed,headers:Object.fromEntries(this.headers),ok:this.ok,redirected:this.redirected,status:this.status,statusText:this.statusText,type:this.type}}get cookies(){return this[G].cookies}static json(e,t){let r=Response.json(e,t);return new Z(r.body,r)}static redirect(e,t){let r="number"==typeof t?t:(null==t?void 0:t.status)??307;if(!X.has(r))throw RangeError('Failed to execute "redirect" on "response": Invalid status code');let n="object"==typeof t?t:{},i=new Headers(null==n?void 0:n.headers);return i.set("Location",O(e)),new Z(null,{...n,headers:i,status:r})}static rewrite(e,t){let r=new Headers(null==t?void 0:t.headers);return r.set("x-middleware-rewrite",O(e)),Y(t,r),new Z(null,{...t,headers:r})}static next(e){let t=new Headers(null==e?void 0:e.headers);return t.set("x-middleware-next","1"),Y(e,t),new Z(null,{...e,headers:t})}}function Q(e,t){let r="string"==typeof t?new URL(t):t,n=new URL(e,t),i=r.protocol+"//"+r.host;return n.protocol+"//"+n.host===i?n.toString().replace(i,""):n.toString()}let ee=[["RSC"],["Next-Router-State-Tree"],["Next-Router-Prefetch"]];r(387);let et={client:"client",server:"server",edgeServer:"edge-server"};et.client,et.server,et.edgeServer,Symbol("polyfills");let er=["__nextFallback","__nextLocale","__nextInferredLocaleFromDefault","__nextDefaultLocale","__nextIsNotFound","_rsc"],en=["__nextDataReq"],ei="nxtP",eo={shared:"shared",reactServerComponents:"rsc",serverSideRendering:"ssr",actionBrowser:"action-browser",api:"api",middleware:"middleware",instrument:"instrument",edgeAsset:"edge-asset",appPagesBrowser:"app-pages-browser",appMetadataRoute:"app-metadata-route",appRouteHandler:"app-route-handler"};({...eo,GROUP:{serverOnly:[eo.reactServerComponents,eo.actionBrowser,eo.appMetadataRoute,eo.appRouteHandler,eo.instrument],clientOnly:[eo.serverSideRendering,eo.appPagesBrowser],nonClientServerTarget:[eo.middleware,eo.api],app:[eo.reactServerComponents,eo.actionBrowser,eo.appMetadataRoute,eo.appRouteHandler,eo.serverSideRendering,eo.appPagesBrowser,eo.shared,eo.instrument]}});class ea{static get(e,t,r){let n=Reflect.get(e,t,r);return"function"==typeof n?n.bind(e):n}static set(e,t,r,n){return Reflect.set(e,t,r,n)}static has(e,t){return Reflect.has(e,t)}static deleteProperty(e,t){return Reflect.deleteProperty(e,t)}}class es extends Error{constructor(){super("Headers cannot be modified. Read more: https://nextjs.org/docs/app/api-reference/functions/headers")}static callable(){throw new es}}class el extends Headers{constructor(e){super(),this.headers=new Proxy(e,{get(t,r,n){if("symbol"==typeof r)return ea.get(t,r,n);let i=r.toLowerCase(),o=Object.keys(e).find(e=>e.toLowerCase()===i);if(void 0!==o)return ea.get(t,o,n)},set(t,r,n,i){if("symbol"==typeof r)return ea.set(t,r,n,i);let o=r.toLowerCase(),a=Object.keys(e).find(e=>e.toLowerCase()===o);return ea.set(t,a??r,n,i)},has(t,r){if("symbol"==typeof r)return ea.has(t,r);let n=r.toLowerCase(),i=Object.keys(e).find(e=>e.toLowerCase()===n);return void 0!==i&&ea.has(t,i)},deleteProperty(t,r){if("symbol"==typeof r)return ea.deleteProperty(t,r);let n=r.toLowerCase(),i=Object.keys(e).find(e=>e.toLowerCase()===n);return void 0===i||ea.deleteProperty(t,i)}})}static seal(e){return new Proxy(e,{get(e,t,r){switch(t){case"append":case"delete":case"set":return es.callable;default:return ea.get(e,t,r)}}})}merge(e){return Array.isArray(e)?e.join(", "):e}static from(e){return e instanceof Headers?e:new el(e)}append(e,t){let r=this.headers[e];"string"==typeof r?this.headers[e]=[r,t]:Array.isArray(r)?r.push(t):this.headers[e]=t}delete(e){delete this.headers[e]}get(e){let t=this.headers[e];return void 0!==t?this.merge(t):null}has(e){return void 0!==this.headers[e]}set(e,t){this.headers[e]=t}forEach(e,t){for(let[r,n]of this.entries())e.call(t,n,r,this)}*entries(){for(let e of Object.keys(this.headers)){let t=e.toLowerCase(),r=this.get(t);yield[t,r]}}*keys(){for(let e of Object.keys(this.headers)){let t=e.toLowerCase();yield t}}*values(){for(let e of Object.keys(this.headers)){let t=this.get(e);yield t}}[Symbol.iterator](){return this.entries()}}var ec=r(850);class eu extends Error{constructor(){super("Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#cookiessetname-value-options")}static callable(){throw new eu}}class ed{static seal(e){return new Proxy(e,{get(e,t,r){switch(t){case"clear":case"delete":case"set":return eu.callable;default:return ea.get(e,t,r)}}})}}let ep=Symbol.for("next.mutated.cookies");class eh{static wrap(e,t){let r=new F.ResponseCookies(new Headers);for(let t of e.getAll())r.set(t);let n=[],i=new Set,o=()=>{let e=ec.A.getStore();if(e&&(e.pathWasRevalidated=!0),n=r.getAll().filter(e=>i.has(e.name)),t){let e=[];for(let t of n){let r=new F.ResponseCookies(new Headers);r.set(t),e.push(r.toString())}t(e)}};return new Proxy(r,{get(e,t,r){switch(t){case ep:return n;case"delete":return function(...t){i.add("string"==typeof t[0]?t[0]:t[0].name);try{e.delete(...t)}finally{o()}};case"set":return function(...t){i.add("string"==typeof t[0]?t[0]:t[0].name);try{return e.set(...t)}finally{o()}};default:return ea.get(e,t,r)}}})}}!function(e){e.handleRequest="BaseServer.handleRequest",e.run="BaseServer.run",e.pipe="BaseServer.pipe",e.getStaticHTML="BaseServer.getStaticHTML",e.render="BaseServer.render",e.renderToResponseWithComponents="BaseServer.renderToResponseWithComponents",e.renderToResponse="BaseServer.renderToResponse",e.renderToHTML="BaseServer.renderToHTML",e.renderError="BaseServer.renderError",e.renderErrorToResponse="BaseServer.renderErrorToResponse",e.renderErrorToHTML="BaseServer.renderErrorToHTML",e.render404="BaseServer.render404"}(nM||(nM={})),function(e){e.loadDefaultErrorComponents="LoadComponents.loadDefaultErrorComponents",e.loadComponents="LoadComponents.loadComponents"}(n$||(n$={})),function(e){e.getRequestHandler="NextServer.getRequestHandler",e.getServer="NextServer.getServer",e.getServerRequestHandler="NextServer.getServerRequestHandler",e.createServer="createServer.createServer"}(nH||(nH={})),function(e){e.compression="NextNodeServer.compression",e.getBuildId="NextNodeServer.getBuildId",e.createComponentTree="NextNodeServer.createComponentTree",e.clientComponentLoading="NextNodeServer.clientComponentLoading",e.getLayoutOrPageModule="NextNodeServer.getLayoutOrPageModule",e.generateStaticRoutes="NextNodeServer.generateStaticRoutes",e.generateFsStaticRoutes="NextNodeServer.generateFsStaticRoutes",e.generatePublicRoutes="NextNodeServer.generatePublicRoutes",e.generateImageRoutes="NextNodeServer.generateImageRoutes.route",e.sendRenderResult="NextNodeServer.sendRenderResult",e.proxyRequest="NextNodeServer.proxyRequest",e.runApi="NextNodeServer.runApi",e.render="NextNodeServer.render",e.renderHTML="NextNodeServer.renderHTML",e.imageOptimizer="NextNodeServer.imageOptimizer",e.getPagePath="NextNodeServer.getPagePath",e.getRoutesManifest="NextNodeServer.getRoutesManifest",e.findPageComponents="NextNodeServer.findPageComponents",e.getFontManifest="NextNodeServer.getFontManifest",e.getServerComponentManifest="NextNodeServer.getServerComponentManifest",e.getRequestHandler="NextNodeServer.getRequestHandler",e.renderToHTML="NextNodeServer.renderToHTML",e.renderError="NextNodeServer.renderError",e.renderErrorToHTML="NextNodeServer.renderErrorToHTML",e.render404="NextNodeServer.render404",e.startResponse="NextNodeServer.startResponse",e.route="route",e.onProxyReq="onProxyReq",e.apiResolver="apiResolver",e.internalFetch="internalFetch"}(nW||(nW={})),(nB||(nB={})).startServer="startServer.startServer",function(e){e.getServerSideProps="Render.getServerSideProps",e.getStaticProps="Render.getStaticProps",e.renderToString="Render.renderToString",e.renderDocument="Render.renderDocument",e.createBodyResult="Render.createBodyResult"}(nK||(nK={})),function(e){e.renderToString="AppRender.renderToString",e.renderToReadableStream="AppRender.renderToReadableStream",e.getBodyResult="AppRender.getBodyResult",e.fetch="AppRender.fetch"}(nq||(nq={})),(nJ||(nJ={})).executeRoute="Router.executeRoute",(nF||(nF={})).runHandler="Node.runHandler",(nV||(nV={})).runHandler="AppRouteRouteHandlers.runHandler",function(e){e.generateMetadata="ResolveMetadata.generateMetadata",e.generateViewport="ResolveMetadata.generateViewport"}(nz||(nz={})),(nG||(nG={})).execute="Middleware.execute";let ef=["Middleware.execute","BaseServer.handleRequest","Render.getServerSideProps","Render.getStaticProps","AppRender.fetch","AppRender.getBodyResult","Render.renderDocument","Node.runHandler","AppRouteRouteHandlers.runHandler","ResolveMetadata.generateMetadata","ResolveMetadata.generateViewport","NextNodeServer.createComponentTree","NextNodeServer.findPageComponents","NextNodeServer.getLayoutOrPageModule","NextNodeServer.startResponse","NextNodeServer.clientComponentLoading"],em=["NextNodeServer.findPageComponents","NextNodeServer.createComponentTree","NextNodeServer.clientComponentLoading"],{context:eg,propagation:ey,trace:ew,SpanStatusCode:eb,SpanKind:ev,ROOT_CONTEXT:e_}=n=r(692),eS=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then,eE=(e,t)=>{(null==t?void 0:t.bubble)===!0?e.setAttribute("next.bubble",!0):(t&&e.recordException(t),e.setStatus({code:eb.ERROR,message:null==t?void 0:t.message})),e.end()},eA=new Map,ek=n.createContextKey("next.rootSpanId"),ex=0,eT=()=>ex++;class eR{getTracerInstance(){return ew.getTracer("next.js","0.0.1")}getContext(){return eg}getActiveScopeSpan(){return ew.getSpan(null==eg?void 0:eg.active())}withPropagatedContext(e,t,r){let n=eg.active();if(ew.getSpanContext(n))return t();let i=ey.extract(n,e,r);return eg.with(i,t)}trace(...e){var t;let[r,n,i]=e,{fn:o,options:a}="function"==typeof n?{fn:n,options:{}}:{fn:i,options:{...n}},s=a.spanName??r;if(!ef.includes(r)&&"1"!==process.env.NEXT_OTEL_VERBOSE||a.hideSpan)return o();let l=this.getSpanContext((null==a?void 0:a.parentSpan)??this.getActiveScopeSpan()),c=!1;l?(null==(t=ew.getSpanContext(l))?void 0:t.isRemote)&&(c=!0):(l=(null==eg?void 0:eg.active())??e_,c=!0);let u=eT();return a.attributes={"next.span_name":s,"next.span_type":r,...a.attributes},eg.with(l.setValue(ek,u),()=>this.getTracerInstance().startActiveSpan(s,a,e=>{let t="performance"in globalThis?globalThis.performance.now():void 0,n=()=>{eA.delete(u),t&&process.env.NEXT_OTEL_PERFORMANCE_PREFIX&&em.includes(r||"")&&performance.measure(`${process.env.NEXT_OTEL_PERFORMANCE_PREFIX}:next-${(r.split(".").pop()||"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}`,{start:t,end:performance.now()})};c&&eA.set(u,new Map(Object.entries(a.attributes??{})));try{if(o.length>1)return o(e,t=>eE(e,t));let t=o(e);if(eS(t))return t.then(t=>(e.end(),t)).catch(t=>{throw eE(e,t),t}).finally(n);return e.end(),n(),t}catch(t){throw eE(e,t),n(),t}}))}wrap(...e){let t=this,[r,n,i]=3===e.length?e:[e[0],{},e[1]];return ef.includes(r)||"1"===process.env.NEXT_OTEL_VERBOSE?function(){let e=n;"function"==typeof e&&"function"==typeof i&&(e=e.apply(this,arguments));let o=arguments.length-1,a=arguments[o];if("function"!=typeof a)return t.trace(r,e,()=>i.apply(this,arguments));{let n=t.getContext().bind(eg.active(),a);return t.trace(r,e,(e,t)=>(arguments[o]=function(e){return null==t||t(e),n.apply(this,arguments)},i.apply(this,arguments)))}}:i}startSpan(...e){let[t,r]=e,n=this.getSpanContext((null==r?void 0:r.parentSpan)??this.getActiveScopeSpan());return this.getTracerInstance().startSpan(t,r,n)}getSpanContext(e){return e?ew.setSpan(eg.active(),e):void 0}getRootSpanAttributes(){let e=eg.active().getValue(ek);return eA.get(e)}}let eP=(()=>{let e=new eR;return()=>e})(),eO="__prerender_bypass";Symbol("__next_preview_data"),Symbol(eO);class eC{constructor(e,t,r,n){var i;let o=e&&function(e,t){let r=el.from(e.headers);return{isOnDemandRevalidate:r.get("x-prerender-revalidate")===t.previewModeId,revalidateOnlyGenerated:r.has("x-prerender-revalidate-if-generated")}}(t,e).isOnDemandRevalidate,a=null==(i=r.get(eO))?void 0:i.value;this.isEnabled=!!(!o&&a&&e&&a===e.previewModeId),this._previewModeId=null==e?void 0:e.previewModeId,this._mutableCookies=n}enable(){if(!this._previewModeId)throw Error("Invariant: previewProps missing previewModeId this should never happen");this._mutableCookies.set({name:eO,value:this._previewModeId,httpOnly:!0,sameSite:"none",secure:!0,path:"/"})}disable(){this._mutableCookies.set({name:eO,value:"",httpOnly:!0,sameSite:"none",secure:!0,path:"/",expires:new Date(0)})}}let eI={wrap(e,{req:t,res:r,renderOpts:n},i){let o;function a(e){r&&r.setHeader("Set-Cookie",e)}n&&"previewProps"in n&&(o=n.previewProps);let s={},l={get headers(){return s.headers||(s.headers=function(e){let t=el.from(e);for(let e of ee)t.delete(e.toString().toLowerCase());return el.seal(t)}(t.headers)),s.headers},get cookies(){return s.cookies||(s.cookies=function(e){let t=new F.RequestCookies(el.from(e));return ed.seal(t)}(t.headers)),s.cookies},get mutableCookies(){return s.mutableCookies||(s.mutableCookies=function(e,t){let r=new F.RequestCookies(el.from(e));return eh.wrap(r,t)}(t.headers,(null==n?void 0:n.onUpdateCookies)||(r?a:void 0))),s.mutableCookies},get draftMode(){return s.draftMode||(s.draftMode=new eC(o,t,this.cookies,this.mutableCookies)),s.draftMode},reactLoadableManifest:(null==n?void 0:n.reactLoadableManifest)||{},assetPrefix:(null==n?void 0:n.assetPrefix)||""};return e.run(l,i,l)}};var eN=r(612);let eU=(0,eN.P)();function ej(e){let t=eU.getStore();if(t)return t;throw Error("`"+e+"` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context")}class eL extends z{constructor(e){super(e.input,e.init),this.sourcePage=e.page}get request(){throw new x({page:this.sourcePage})}respondWith(){throw new x({page:this.sourcePage})}waitUntil(){throw new x({page:this.sourcePage})}}let eD={keys:e=>Array.from(e.keys()),get:(e,t)=>e.get(t)??void 0},eM=(e,t)=>eP().withPropagatedContext(e.headers,t,eD),e$=!1;async function eH(e){let t,n;!function(){if(!e$&&(e$=!0,"true"===process.env.NEXT_PRIVATE_TEST_PROXY)){let{interceptTestApis:e,wrapRequestHandler:t}=r(311);e(),eM=t(eM)}}(),await A();let i=void 0!==self.__BUILD_MANIFEST,o="string"==typeof self.__PRERENDER_MANIFEST?JSON.parse(self.__PRERENDER_MANIFEST):void 0;e.request.url=e.request.url.replace(/\.rsc($|\?)/,"$1");let a=new J(e.request.url,{headers:e.request.headers,nextConfig:e.request.nextConfig});for(let e of[...a.searchParams.keys()]){let t=a.searchParams.getAll(e);if(e!==ei&&e.startsWith(ei)){let r=e.substring(ei.length);for(let e of(a.searchParams.delete(r),t))a.searchParams.append(r,e);a.searchParams.delete(e)}}let s=a.buildId;a.buildId="";let l=e.request.headers["x-nextjs-data"];l&&"/index"===a.pathname&&(a.pathname="/");let c=function(e){let t=new Headers;for(let[r,n]of Object.entries(e))for(let e of Array.isArray(n)?n:[n])void 0!==e&&("number"==typeof e&&(e=e.toString()),t.append(r,e));return t}(e.request.headers),u=new Map;if(!i)for(let e of ee){let t=e.toString().toLowerCase();c.get(t)&&(u.set(t,c.get(t)),c.delete(t))}let d=new eL({page:e.page,input:(function(e,t){let r="string"==typeof e,n=r?new URL(e):e;for(let e of er)n.searchParams.delete(e);if(t)for(let e of en)n.searchParams.delete(e);return r?n.toString():n})(a,!0).toString(),init:{body:e.request.body,geo:e.request.geo,headers:c,ip:e.request.ip,method:e.request.method,nextConfig:e.request.nextConfig,signal:e.request.signal}});l&&Object.defineProperty(d,"__isData",{enumerable:!1,value:!0}),!globalThis.__incrementalCache&&e.IncrementalCache&&(globalThis.__incrementalCache=new e.IncrementalCache({appDir:!0,fetchCache:!0,minimalMode:!0,fetchCacheKeyPrefix:"",dev:!1,requestHeaders:e.request.headers,requestProtocol:"https",getPrerenderManifest:()=>({version:-1,routes:{},dynamicRoutes:{},notFoundRoutes:[],preview:{previewModeId:"development-id"}})}));let p=new j({request:d,page:e.page});if((t=await eM(d,()=>"/middleware"===e.page||"/src/middleware"===e.page?eP().trace(nG.execute,{spanName:`middleware ${d.method} ${d.nextUrl.pathname}`,attributes:{"http.target":d.nextUrl.pathname,"http.method":d.method}},()=>eI.wrap(eU,{req:d,renderOpts:{onUpdateCookies:e=>{n=e},previewProps:(null==o?void 0:o.preview)||{previewModeId:"development-id",previewModeEncryptionKey:"",previewModeSigningKey:""}}},()=>e.handler(d,p))):e.handler(d,p)))&&!(t instanceof Response))throw TypeError("Expected an instance of Response to be returned");t&&n&&t.headers.set("set-cookie",n);let h=null==t?void 0:t.headers.get("x-middleware-rewrite");if(t&&h&&!i){let r=new J(h,{forceLocale:!0,headers:e.request.headers,nextConfig:e.request.nextConfig});r.host===d.nextUrl.host&&(r.buildId=s||r.buildId,t.headers.set("x-middleware-rewrite",String(r)));let n=Q(String(r),String(a));l&&t.headers.set("x-nextjs-rewrite",n)}let f=null==t?void 0:t.headers.get("Location");if(t&&f&&!i){let r=new J(f,{forceLocale:!1,headers:e.request.headers,nextConfig:e.request.nextConfig});t=new Response(t.body,t),r.host===d.nextUrl.host&&(r.buildId=s||r.buildId,t.headers.set("Location",String(r))),l&&(t.headers.delete("Location"),t.headers.set("x-nextjs-redirect",Q(String(r),String(a))))}let m=t||Z.next(),g=m.headers.get("x-middleware-override-headers"),y=[];if(g){for(let[e,t]of u)m.headers.set(`x-middleware-request-${e}`,t),y.push(e);y.length>0&&m.headers.set("x-middleware-override-headers",g+","+y.join(","))}return{response:m,waitUntil:Promise.all(p[N]),fetchMetrics:d.fetchMetrics}}var eW=function(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},eB=function(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};function eK(e){let t=e?"__Secure-":"";return{sessionToken:{name:`${t}authjs.session-token`,options:{httpOnly:!0,sameSite:"lax",path:"/",secure:e}},callbackUrl:{name:`${t}authjs.callback-url`,options:{httpOnly:!0,sameSite:"lax",path:"/",secure:e}},csrfToken:{name:`${e?"__Host-":""}authjs.csrf-token`,options:{httpOnly:!0,sameSite:"lax",path:"/",secure:e}},pkceCodeVerifier:{name:`${t}authjs.pkce.code_verifier`,options:{httpOnly:!0,sameSite:"lax",path:"/",secure:e,maxAge:900}},state:{name:`${t}authjs.state`,options:{httpOnly:!0,sameSite:"lax",path:"/",secure:e,maxAge:900}},nonce:{name:`${t}authjs.nonce`,options:{httpOnly:!0,sameSite:"lax",path:"/",secure:e}},webauthnChallenge:{name:`${t}authjs.challenge`,options:{httpOnly:!0,sameSite:"lax",path:"/",secure:e,maxAge:900}}}}class eq{constructor(e,t,r){if(nX.add(this),nY.set(this,{}),nZ.set(this,void 0),nQ.set(this,void 0),eW(this,nQ,r,"f"),eW(this,nZ,e,"f"),!t)return;let{name:n}=e;for(let[e,r]of Object.entries(t))e.startsWith(n)&&r&&(eB(this,nY,"f")[e]=r)}get value(){return Object.keys(eB(this,nY,"f")).sort((e,t)=>parseInt(e.split(".").pop()||"0")-parseInt(t.split(".").pop()||"0")).map(e=>eB(this,nY,"f")[e]).join("")}chunk(e,t){let r=eB(this,nX,"m",n1).call(this);for(let n of eB(this,nX,"m",n0).call(this,{name:eB(this,nZ,"f").name,value:e,options:{...eB(this,nZ,"f").options,...t}}))r[n.name]=n;return Object.values(r)}clean(){return Object.values(eB(this,nX,"m",n1).call(this))}}nY=new WeakMap,nZ=new WeakMap,nQ=new WeakMap,nX=new WeakSet,n0=function(e){let t=Math.ceil(e.value.length/3936);if(1===t)return eB(this,nY,"f")[e.name]=e.value,[e];let r=[];for(let n=0;n<t;n++){let t=`${e.name}.${n}`,i=e.value.substr(3936*n,3936);r.push({...e,name:t,value:i}),eB(this,nY,"f")[t]=i}return eB(this,nQ,"f").debug("CHUNKING_SESSION_COOKIE",{message:"Session cookie exceeds allowed 4096 bytes.",emptyCookieSize:160,valueSize:e.value.length,chunks:r.map(e=>e.value.length+160)}),r},n1=function(){let e={};for(let t in eB(this,nY,"f"))delete eB(this,nY,"f")?.[t],e[t]={name:t,value:"",options:{...eB(this,nZ,"f").options,maxAge:0}};return e};class eJ extends Error{constructor(e,t){e instanceof Error?super(void 0,{cause:{err:e,...e.cause,...t}}):"string"==typeof e?(t instanceof Error&&(t={err:t,...t.cause}),super(e,t)):super(void 0,e),this.name=this.constructor.name,this.type=this.constructor.type??"AuthError",this.kind=this.constructor.kind??"error",Error.captureStackTrace?.(this,this.constructor);let r=`https://errors.authjs.dev#${this.type.toLowerCase()}`;this.message+=`${this.message?". ":""}Read more at ${r}`}}class eF extends eJ{}eF.kind="signIn";class eV extends eJ{}eV.type="AdapterError";class ez extends eJ{}ez.type="AccessDenied";class eG extends eJ{}eG.type="CallbackRouteError";class eX extends eJ{}eX.type="ErrorPageLoop";class eY extends eJ{}eY.type="EventError";class eZ extends eJ{}eZ.type="InvalidCallbackUrl";class eQ extends eF{constructor(){super(...arguments),this.code="credentials"}}eQ.type="CredentialsSignin";class e0 extends eJ{}e0.type="InvalidEndpoints";class e1 extends eJ{}e1.type="InvalidCheck";class e2 extends eJ{}e2.type="JWTSessionError";class e5 extends eJ{}e5.type="MissingAdapter";class e3 extends eJ{}e3.type="MissingAdapterMethods";class e4 extends eJ{}e4.type="MissingAuthorize";class e6 extends eJ{}e6.type="MissingSecret";class e8 extends eF{}e8.type="OAuthAccountNotLinked";class e9 extends eF{}e9.type="OAuthCallbackError";class e7 extends eJ{}e7.type="OAuthProfileParseError";class te extends eJ{}te.type="SessionTokenError";class tt extends eF{}tt.type="OAuthSignInError";class tr extends eF{}tr.type="EmailSignInError";class tn extends eJ{}tn.type="SignOutError";class ti extends eJ{}ti.type="UnknownAction";class to extends eJ{}to.type="UnsupportedStrategy";class ta extends eJ{}ta.type="InvalidProvider";class ts extends eJ{}ts.type="UntrustedHost";class tl extends eJ{}tl.type="Verification";class tc extends eF{}tc.type="MissingCSRF";let tu=new Set(["CredentialsSignin","OAuthAccountNotLinked","OAuthCallbackError","AccessDenied","Verification","MissingCSRF","AccountNotLinked","WebAuthnVerificationError"]);class td extends eJ{}td.type="DuplicateConditionalUI";class tp extends eJ{}tp.type="MissingWebAuthnAutocomplete";class th extends eJ{}th.type="WebAuthnVerificationError";class tf extends eF{}tf.type="AccountNotLinked";class tm extends eJ{}tm.type="ExperimentalFeatureNotEnabled";let tg=!1;function ty(e,t){try{return/^https?:/.test(new URL(e,e.startsWith("/")?t:void 0).protocol)}catch{return!1}}let tw=!1,tb=!1,tv=!1,t_=["createVerificationToken","useVerificationToken","getUserByEmail"],tS=["createUser","getUser","getUserByEmail","getUserByAccount","updateUser","linkAccount","createSession","getSessionAndUser","updateSession","deleteSession"],tE=["createUser","getUser","linkAccount","getAccount","getAuthenticator","createAuthenticator","listAuthenticatorsByUserId","updateAuthenticatorCounter"],tA=()=>{if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;throw Error("unable to locate global object")},tk=async(e,t,r,n,i)=>{let{crypto:{subtle:o}}=tA();return new Uint8Array(await o.deriveBits({name:"HKDF",hash:`SHA-${e.substr(3)}`,salt:r,info:n},await o.importKey("raw",t,"HKDF",!1,["deriveBits"]),i<<3))};function tx(e,t){if("string"==typeof e)return new TextEncoder().encode(e);if(!(e instanceof Uint8Array))throw TypeError(`"${t}"" must be an instance of Uint8Array or a string`);return e}async function tT(e,t,r,n,i){return tk(function(e){switch(e){case"sha256":case"sha384":case"sha512":case"sha1":return e;default:throw TypeError('unsupported "digest" value')}}(e),function(e){let t=tx(e,"ikm");if(!t.byteLength)throw TypeError('"ikm" must be at least one byte in length');return t}(t),tx(r,"salt"),function(e){let t=tx(e,"info");if(t.byteLength>1024)throw TypeError('"info" must not contain more than 1024 bytes');return t}(n),function(e,t){if("number"!=typeof e||!Number.isInteger(e)||e<1)throw TypeError('"keylen" must be a positive integer');if(e>255*(parseInt(t.substr(3),10)>>3||20))throw TypeError('"keylen" too large');return e}(i,e))}let tR=crypto,tP=e=>e instanceof CryptoKey,tO=async(e,t)=>{let r=`SHA-${e.slice(-3)}`;return new Uint8Array(await tR.subtle.digest(r,t))},tC=new TextEncoder,tI=new TextDecoder;function tN(...e){let t=new Uint8Array(e.reduce((e,{length:t})=>e+t,0)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}function tU(e,t,r){if(t<0||t>=4294967296)throw RangeError(`value must be >= 0 and <= ${4294967296-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}function tj(e){let t=new Uint8Array(8);return tU(t,Math.floor(e/4294967296),0),tU(t,e%4294967296,4),t}function tL(e){let t=new Uint8Array(4);return tU(t,e),t}function tD(e){return tN(tL(e.length),e)}async function tM(e,t,r){let n=Math.ceil((t>>3)/32),i=new Uint8Array(32*n);for(let t=0;t<n;t++){let n=new Uint8Array(4+e.length+r.length);n.set(tL(t+1)),n.set(e,4),n.set(r,4+e.length),i.set(await tO("sha256",n),32*t)}return i.slice(0,t>>3)}let t$=e=>{let t=e;"string"==typeof t&&(t=tC.encode(t));let r=[];for(let e=0;e<t.length;e+=32768)r.push(String.fromCharCode.apply(null,t.subarray(e,e+32768)));return btoa(r.join(""))},tH=e=>t$(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),tW=e=>{let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r},tB=e=>{let t=e;t instanceof Uint8Array&&(t=tI.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return tW(t)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}};class tK extends Error{constructor(e,t){super(e,t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}tK.code="ERR_JOSE_GENERIC";class tq extends tK{constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=r,this.reason=n,this.payload=t}}tq.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class tJ extends tK{constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.code="ERR_JWT_EXPIRED",this.claim=r,this.reason=n,this.payload=t}}tJ.code="ERR_JWT_EXPIRED";class tF extends tK{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}tF.code="ERR_JOSE_ALG_NOT_ALLOWED";class tV extends tK{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}tV.code="ERR_JOSE_NOT_SUPPORTED";class tz extends tK{constructor(e="decryption operation failed",t){super(e,t),this.code="ERR_JWE_DECRYPTION_FAILED"}}tz.code="ERR_JWE_DECRYPTION_FAILED";class tG extends tK{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}tG.code="ERR_JWE_INVALID";class tX extends tK{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}tX.code="ERR_JWS_INVALID";class tY extends tK{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}tY.code="ERR_JWT_INVALID";class tZ extends tK{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}tZ.code="ERR_JWK_INVALID";class tQ extends tK{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}tQ.code="ERR_JWKS_INVALID";class t0 extends tK{constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t),this.code="ERR_JWKS_NO_MATCHING_KEY"}}t0.code="ERR_JWKS_NO_MATCHING_KEY";class t1 extends tK{constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}Symbol.asyncIterator,t1.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class t2 extends tK{constructor(e="request timed out",t){super(e,t),this.code="ERR_JWKS_TIMEOUT"}}t2.code="ERR_JWKS_TIMEOUT";class t5 extends tK{constructor(e="signature verification failed",t){super(e,t),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}function t3(e){if(!("object"==typeof e&&null!==e)||"[object Object]"!==Object.prototype.toString.call(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}t5.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";let t4=(e,t)=>{if("string"!=typeof e||!e)throw new tZ(`${t} missing or invalid`)};async function t6(e,t){let r;if(!t3(e))throw TypeError("JWK must be an object");if(t??(t="sha256"),"sha256"!==t&&"sha384"!==t&&"sha512"!==t)throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');switch(e.kty){case"EC":t4(e.crv,'"crv" (Curve) Parameter'),t4(e.x,'"x" (X Coordinate) Parameter'),t4(e.y,'"y" (Y Coordinate) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case"OKP":t4(e.crv,'"crv" (Subtype of Key Pair) Parameter'),t4(e.x,'"x" (Public Key) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x};break;case"RSA":t4(e.e,'"e" (Exponent) Parameter'),t4(e.n,'"n" (Modulus) Parameter'),r={e:e.e,kty:e.kty,n:e.n};break;case"oct":t4(e.k,'"k" (Key Value) Parameter'),r={k:e.k,kty:e.kty};break;default:throw new tV('"kty" (Key Type) Parameter missing or unsupported')}let n=tC.encode(JSON.stringify(r));return tH(await tO(t,n))}let t8=Symbol(),t9=tR.getRandomValues.bind(tR);function t7(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new tV(`Unsupported JWE Algorithm: ${e}`)}}let re=e=>t9(new Uint8Array(t7(e)>>3)),rt=(e,t)=>{if(t.length<<3!==t7(e))throw new tG("Invalid Initialization Vector length")},rr=(e,t)=>{let r=e.byteLength<<3;if(r!==t)throw new tG(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)};function rn(e,t="algorithm.name"){return TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function ri(e,t){return e.name===t}function ro(e,t,...r){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if(!ri(e.algorithm,"AES-GCM"))throw rn("AES-GCM");let r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw rn(r,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!ri(e.algorithm,"AES-KW"))throw rn("AES-KW");let r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw rn(r,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw rn("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!ri(e.algorithm,"PBKDF2"))throw rn("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!ri(e.algorithm,"RSA-OAEP"))throw rn("RSA-OAEP");let r=parseInt(t.slice(9),10)||1;if(parseInt(e.algorithm.hash.name.slice(4),10)!==r)throw rn(`SHA-${r}`,"algorithm.hash");break}default:throw TypeError("CryptoKey does not support this operation")}!function(e,t){if(t.length&&!t.some(t=>e.usages.includes(t))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){let r=t.pop();e+=`one of ${t.join(", ")}, or ${r}.`}else 2===t.length?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw TypeError(e)}}(e,r)}function ra(e,t,...r){if((r=r.filter(Boolean)).length>2){let t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}let rs=(e,...t)=>ra("Key must be ",e,...t);function rl(e,t,...r){return ra(`Key for the ${e} algorithm must be `,t,...r)}let rc=e=>!!tP(e)||e?.[Symbol.toStringTag]==="KeyObject",ru=["CryptoKey"];async function rd(e,t,r,n,i){if(!(r instanceof Uint8Array))throw TypeError(rs(r,"Uint8Array"));let o=parseInt(e.slice(1,4),10),a=await tR.subtle.importKey("raw",r.subarray(o>>3),"AES-CBC",!1,["encrypt"]),s=await tR.subtle.importKey("raw",r.subarray(0,o>>3),{hash:`SHA-${o<<1}`,name:"HMAC"},!1,["sign"]),l=new Uint8Array(await tR.subtle.encrypt({iv:n,name:"AES-CBC"},a,t)),c=tN(i,n,l,tj(i.length<<3));return{ciphertext:l,tag:new Uint8Array((await tR.subtle.sign("HMAC",s,c)).slice(0,o>>3)),iv:n}}async function rp(e,t,r,n,i){let o;r instanceof Uint8Array?o=await tR.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(ro(r,e,"encrypt"),o=r);let a=new Uint8Array(await tR.subtle.encrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},o,t)),s=a.slice(-16);return{ciphertext:a.slice(0,-16),tag:s,iv:n}}let rh=async(e,t,r,n,i)=>{if(!tP(r)&&!(r instanceof Uint8Array))throw TypeError(rs(r,...ru,"Uint8Array"));switch(n?rt(e,n):n=re(e),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&rr(r,parseInt(e.slice(-3),10)),rd(e,t,r,n,i);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&rr(r,parseInt(e.slice(1,4),10)),rp(e,t,r,n,i);default:throw new tV("Unsupported JWE Content Encryption Algorithm")}},rf=[{hash:"SHA-256",name:"HMAC"},!0,["sign"]];function rm(e,t){if(e.algorithm.length!==parseInt(t.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${t}`)}function rg(e,t,r){if(tP(e))return ro(e,t,r),e;if(e instanceof Uint8Array)return tR.subtle.importKey("raw",e,"AES-KW",!0,[r]);throw TypeError(rs(e,...ru,"Uint8Array"))}let ry=async(e,t,r)=>{let n=await rg(t,e,"wrapKey");rm(n,e);let i=await tR.subtle.importKey("raw",r,...rf);return new Uint8Array(await tR.subtle.wrapKey("raw",i,n,"AES-KW"))},rw=async(e,t,r)=>{let n=await rg(t,e,"unwrapKey");rm(n,e);let i=await tR.subtle.unwrapKey("raw",r,n,"AES-KW",...rf);return new Uint8Array(await tR.subtle.exportKey("raw",i))};async function rb(e,t,r,n,i=new Uint8Array(0),o=new Uint8Array(0)){let a;if(!tP(e))throw TypeError(rs(e,...ru));if(ro(e,"ECDH"),!tP(t))throw TypeError(rs(t,...ru));ro(t,"ECDH","deriveBits");let s=tN(tD(tC.encode(r)),tD(i),tD(o),tL(n));return a="X25519"===e.algorithm.name?256:"X448"===e.algorithm.name?448:Math.ceil(parseInt(e.algorithm.namedCurve.substr(-3),10)/8)<<3,tM(new Uint8Array(await tR.subtle.deriveBits({name:e.algorithm.name,public:e},t,a)),n,s)}async function rv(e){if(!tP(e))throw TypeError(rs(e,...ru));return tR.subtle.generateKey(e.algorithm,!0,["deriveBits"])}function r_(e){if(!tP(e))throw TypeError(rs(e,...ru));return["P-256","P-384","P-521"].includes(e.algorithm.namedCurve)||"X25519"===e.algorithm.name||"X448"===e.algorithm.name}async function rS(e,t,r,n){!function(e){if(!(e instanceof Uint8Array)||e.length<8)throw new tG("PBES2 Salt Input must be 8 or more octets")}(e);let i=tN(tC.encode(t),new Uint8Array([0]),e),o=parseInt(t.slice(13,16),10),a={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:i},s=await function(e,t){if(e instanceof Uint8Array)return tR.subtle.importKey("raw",e,"PBKDF2",!1,["deriveBits"]);if(tP(e))return ro(e,t,"deriveBits","deriveKey"),e;throw TypeError(rs(e,...ru,"Uint8Array"))}(n,t);if(s.usages.includes("deriveBits"))return new Uint8Array(await tR.subtle.deriveBits(a,s,o));if(s.usages.includes("deriveKey"))return tR.subtle.deriveKey(a,s,{length:o,name:"AES-KW"},!1,["wrapKey","unwrapKey"]);throw TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"')}let rE=async(e,t,r,n=2048,i=t9(new Uint8Array(16)))=>{let o=await rS(i,e,n,t);return{encryptedKey:await ry(e.slice(-6),o,r),p2c:n,p2s:tH(i)}},rA=async(e,t,r,n,i)=>{let o=await rS(i,e,n,t);return rw(e.slice(-6),o,r)};function rk(e){switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new tV(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}let rx=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}},rT=async(e,t,r)=>{if(!tP(t))throw TypeError(rs(t,...ru));if(ro(t,e,"encrypt","wrapKey"),rx(e,t),t.usages.includes("encrypt"))return new Uint8Array(await tR.subtle.encrypt(rk(e),t,r));if(t.usages.includes("wrapKey")){let n=await tR.subtle.importKey("raw",r,...rf);return new Uint8Array(await tR.subtle.wrapKey("raw",n,t,rk(e)))}throw TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation')},rR=async(e,t,r)=>{if(!tP(t))throw TypeError(rs(t,...ru));if(ro(t,e,"decrypt","unwrapKey"),rx(e,t),t.usages.includes("decrypt"))return new Uint8Array(await tR.subtle.decrypt(rk(e),t,r));if(t.usages.includes("unwrapKey")){let n=await tR.subtle.unwrapKey("raw",r,t,rk(e),...rf);return new Uint8Array(await tR.subtle.exportKey("raw",n))}throw TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation')};function rP(e){return t3(e)&&"string"==typeof e.kty}let rO=async e=>{if(!e.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:t,keyUsages:r}=function(e){let t,r;switch(e.kty){case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new tV('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},r=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},r=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new tV('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"EdDSA":t={name:e.crv},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new tV('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new tV('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}(e),n=[t,e.ext??!1,e.key_ops??r],i={...e};return delete i.alg,delete i.use,tR.subtle.importKey("jwk",i,...n)},rC=e=>tB(e),rI=e=>e?.[Symbol.toStringTag]==="KeyObject",rN=async(e,t,r,n,i=!1)=>{let o=e.get(t);if(o?.[n])return o[n];let a=await rO({...r,alg:n});return i&&Object.freeze(t),o?o[n]=a:e.set(t,{[n]:a}),a},rU={normalizePublicKey:(e,t)=>{if(rI(e)){let r=e.export({format:"jwk"});return(delete r.d,delete r.dp,delete r.dq,delete r.p,delete r.q,delete r.qi,r.k)?rC(r.k):(o||(o=new WeakMap),rN(o,e,r,t))}return rP(e)?e.k?tB(e.k):(o||(o=new WeakMap),rN(o,e,e,t,!0)):e},normalizePrivateKey:(e,t)=>{if(rI(e)){let r=e.export({format:"jwk"});return r.k?rC(r.k):(i||(i=new WeakMap),rN(i,e,r,t))}return rP(e)?e.k?tB(e.k):(i||(i=new WeakMap),rN(i,e,e,t,!0)):e}};function rj(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new tV(`Unsupported JWE Algorithm: ${e}`)}}let rL=e=>t9(new Uint8Array(rj(e)>>3)),rD=async e=>{if(e instanceof Uint8Array)return{kty:"oct",k:tH(e)};if(!tP(e))throw TypeError(rs(e,...ru,"Uint8Array"));if(!e.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:t,key_ops:r,alg:n,use:i,...o}=await tR.subtle.exportKey("jwk",e);return o};async function rM(e){return rD(e)}let r$=e=>e?.[Symbol.toStringTag],rH=(e,t,r)=>{if(void 0!==t.use&&"sig"!==t.use)throw TypeError("Invalid key for this operation, when present its use must be sig");if(void 0!==t.key_ops&&t.key_ops.includes?.(r)!==!0)throw TypeError(`Invalid key for this operation, when present its key_ops must include ${r}`);if(void 0!==t.alg&&t.alg!==e)throw TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0},rW=(e,t,r,n)=>{if(!(t instanceof Uint8Array)){if(n&&rP(t)){if(function(e){return rP(e)&&"oct"===e.kty&&"string"==typeof e.k}(t)&&rH(e,t,r))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!rc(t))throw TypeError(rl(e,t,...ru,"Uint8Array",n?"JSON Web Key":null));if("secret"!==t.type)throw TypeError(`${r$(t)} instances for symmetric algorithms must be of type "secret"`)}},rB=(e,t,r,n)=>{if(n&&rP(t))switch(r){case"sign":if(function(e){return"oct"!==e.kty&&"string"==typeof e.d}(t)&&rH(e,t,r))return;throw TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(function(e){return"oct"!==e.kty&&void 0===e.d}(t)&&rH(e,t,r))return;throw TypeError("JSON Web Key for this operation be a public JWK")}if(!rc(t))throw TypeError(rl(e,t,...ru,n?"JSON Web Key":null));if("secret"===t.type)throw TypeError(`${r$(t)} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===r&&"public"===t.type)throw TypeError(`${r$(t)} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===r&&"public"===t.type)throw TypeError(`${r$(t)} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===r&&"private"===t.type)throw TypeError(`${r$(t)} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===r&&"private"===t.type)throw TypeError(`${r$(t)} instances for asymmetric algorithm encryption must be of type "public"`)};function rK(e,t,r,n){t.startsWith("HS")||"dir"===t||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?rW(t,r,n,e):rB(t,r,n,e)}let rq=rK.bind(void 0,!1);rK.bind(void 0,!0);let rJ=(e,t)=>{if(!(e instanceof Uint8Array))throw TypeError("First argument must be a buffer");if(!(t instanceof Uint8Array))throw TypeError("Second argument must be a buffer");if(e.length!==t.length)throw TypeError("Input buffers must have the same length");let r=e.length,n=0,i=-1;for(;++i<r;)n|=e[i]^t[i];return 0===n};async function rF(e,t,r,n,i,o){let a,s;if(!(t instanceof Uint8Array))throw TypeError(rs(t,"Uint8Array"));let l=parseInt(e.slice(1,4),10),c=await tR.subtle.importKey("raw",t.subarray(l>>3),"AES-CBC",!1,["decrypt"]),u=await tR.subtle.importKey("raw",t.subarray(0,l>>3),{hash:`SHA-${l<<1}`,name:"HMAC"},!1,["sign"]),d=tN(o,n,r,tj(o.length<<3)),p=new Uint8Array((await tR.subtle.sign("HMAC",u,d)).slice(0,l>>3));try{a=rJ(i,p)}catch{}if(!a)throw new tz;try{s=new Uint8Array(await tR.subtle.decrypt({iv:n,name:"AES-CBC"},c,r))}catch{}if(!s)throw new tz;return s}async function rV(e,t,r,n,i,o){let a;t instanceof Uint8Array?a=await tR.subtle.importKey("raw",t,"AES-GCM",!1,["decrypt"]):(ro(t,e,"decrypt"),a=t);try{return new Uint8Array(await tR.subtle.decrypt({additionalData:o,iv:n,name:"AES-GCM",tagLength:128},a,tN(r,i)))}catch{throw new tz}}let rz=async(e,t,r,n,i,o)=>{if(!tP(t)&&!(t instanceof Uint8Array))throw TypeError(rs(t,...ru,"Uint8Array"));if(!n)throw new tG("JWE Initialization Vector missing");if(!i)throw new tG("JWE Authentication Tag missing");switch(rt(e,n),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return t instanceof Uint8Array&&rr(t,parseInt(e.slice(-3),10)),rF(e,t,r,n,i,o);case"A128GCM":case"A192GCM":case"A256GCM":return t instanceof Uint8Array&&rr(t,parseInt(e.slice(1,4),10)),rV(e,t,r,n,i,o);default:throw new tV("Unsupported JWE Content Encryption Algorithm")}};async function rG(e,t,r,n){let i=e.slice(0,7),o=await rh(i,r,t,n,new Uint8Array(0));return{encryptedKey:o.ciphertext,iv:tH(o.iv),tag:tH(o.tag)}}async function rX(e,t,r,n,i){return rz(e.slice(0,7),t,r,n,i,new Uint8Array(0))}async function rY(e,t,r,n,i={}){let o,a,s;switch(rq(e,r,"encrypt"),r=await rU.normalizePublicKey?.(r,e)||r,e){case"dir":s=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!r_(r))throw new tV("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:l,apv:c}=i,{epk:u}=i;u||(u=(await rv(r)).privateKey);let{x:d,y:p,crv:h,kty:f}=await rM(u),m=await rb(r,u,"ECDH-ES"===e?t:e,"ECDH-ES"===e?rj(t):parseInt(e.slice(-5,-2),10),l,c);if(a={epk:{x:d,crv:h,kty:f}},"EC"===f&&(a.epk.y=p),l&&(a.apu=tH(l)),c&&(a.apv=tH(c)),"ECDH-ES"===e){s=m;break}s=n||rL(t);let g=e.slice(-6);o=await ry(g,m,s);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":s=n||rL(t),o=await rT(e,r,s);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{s=n||rL(t);let{p2c:l,p2s:c}=i;({encryptedKey:o,...a}=await rE(e,r,s,l,c));break}case"A128KW":case"A192KW":case"A256KW":s=n||rL(t),o=await ry(e,r,s);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{s=n||rL(t);let{iv:l}=i;({encryptedKey:o,...a}=await rG(e,r,s,l));break}default:throw new tV('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:s,encryptedKey:o,parameters:a}}let rZ=(...e)=>{let t;let r=e.filter(Boolean);if(0===r.length||1===r.length)return!0;for(let e of r){let r=Object.keys(e);if(!t||0===t.size){t=new Set(r);continue}for(let e of r){if(t.has(e))return!1;t.add(e)}}return!0},rQ=function(e,t,r,n,i){let o;if(void 0!==i.crit&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||void 0===n.crit)return new Set;if(!Array.isArray(n.crit)||0===n.crit.length||n.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let a of(o=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t,n.crit)){if(!o.has(a))throw new tV(`Extension Header Parameter "${a}" is not recognized`);if(void 0===i[a])throw new e(`Extension Header Parameter "${a}" is missing`);if(o.get(a)&&void 0===n[a])throw new e(`Extension Header Parameter "${a}" MUST be integrity protected`)}return new Set(n.crit)};class r0{constructor(e){if(!(e instanceof Uint8Array))throw TypeError("plaintext must be an instance of Uint8Array");this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError("setInitializationVector can only be called once");return this._iv=e,this}async encrypt(e,t){let r,n,i,o,a;if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new tG("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!rZ(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new tG("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let s={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(rQ(tG,new Map,t?.crit,this._protectedHeader,s),void 0!==s.zip)throw new tV('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg:l,enc:c}=s;if("string"!=typeof l||!l)throw new tG('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof c||!c)throw new tG('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(this._cek&&("dir"===l||"ECDH-ES"===l))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${l}`);{let i;({cek:n,encryptedKey:r,parameters:i}=await rY(l,c,e,this._cek,this._keyManagementParameters)),i&&(t&&t8 in t?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...i}:this.setUnprotectedHeader(i):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...i}:this.setProtectedHeader(i))}o=this._protectedHeader?tC.encode(tH(JSON.stringify(this._protectedHeader))):tC.encode(""),this._aad?(a=tH(this._aad),i=tN(o,tC.encode("."),tC.encode(a))):i=o;let{ciphertext:u,tag:d,iv:p}=await rh(c,this._plaintext,n,this._iv,i),h={ciphertext:tH(u)};return p&&(h.iv=tH(p)),d&&(h.tag=tH(d)),r&&(h.encrypted_key=tH(r)),a&&(h.aad=a),this._protectedHeader&&(h.protected=tI.decode(o)),this._sharedUnprotectedHeader&&(h.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(h.header=this._unprotectedHeader),h}}class r1{constructor(e){this._flattened=new r0(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){let r=await this._flattened.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}let r2=e=>Math.floor(e.getTime()/1e3),r5=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,r3=e=>{let t;let r=r5.exec(e);if(!r||r[4]&&r[1])throw TypeError("Invalid time period format");let n=parseFloat(r[2]);switch(r[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":t=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":t=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":t=Math.round(3600*n);break;case"day":case"days":case"d":t=Math.round(86400*n);break;case"week":case"weeks":case"w":t=Math.round(604800*n);break;default:t=Math.round(31557600*n)}return"-"===r[1]||"ago"===r[4]?-t:t};function r4(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}class r6{constructor(e={}){if(!t3(e))throw TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return"number"==typeof e?this._payload={...this._payload,nbf:r4("setNotBefore",e)}:e instanceof Date?this._payload={...this._payload,nbf:r4("setNotBefore",r2(e))}:this._payload={...this._payload,nbf:r2(new Date)+r3(e)},this}setExpirationTime(e){return"number"==typeof e?this._payload={...this._payload,exp:r4("setExpirationTime",e)}:e instanceof Date?this._payload={...this._payload,exp:r4("setExpirationTime",r2(e))}:this._payload={...this._payload,exp:r2(new Date)+r3(e)},this}setIssuedAt(e){return void 0===e?this._payload={...this._payload,iat:r2(new Date)}:e instanceof Date?this._payload={...this._payload,iat:r4("setIssuedAt",r2(e))}:"string"==typeof e?this._payload={...this._payload,iat:r4("setIssuedAt",r2(new Date)+r3(e))}:this._payload={...this._payload,iat:r4("setIssuedAt",e)},this}}class r8 extends r6{setProtectedHeader(e){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError("setInitializationVector can only be called once");return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,t){let r=new r1(tC.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),r.setProtectedHeader(this._protectedHeader),this._iv&&r.setInitializationVector(this._iv),this._cek&&r.setContentEncryptionKey(this._cek),this._keyManagementParameters&&r.setKeyManagementParameters(this._keyManagementParameters),r.encrypt(e,t)}}async function r9(e,t){if(!t3(e))throw TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw TypeError('missing "k" (Key Value) Parameter value');return tB(e.k);case"RSA":if(void 0!==e.oth)throw new tV('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return rO({...e,alg:t});default:throw new tV('Unsupported "kty" (Key Type) Parameter value')}}async function r7(e,t,r,n,i){switch(rq(e,t,"decrypt"),t=await rU.normalizePrivateKey?.(t,e)||t,e){case"dir":if(void 0!==r)throw new tG("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new tG("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let i,o;if(!t3(n.epk))throw new tG('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!r_(t))throw new tV("ECDH with the provided key is not allowed or not supported by your javascript runtime");let a=await r9(n.epk,e);if(void 0!==n.apu){if("string"!=typeof n.apu)throw new tG('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{i=tB(n.apu)}catch{throw new tG("Failed to base64url decode the apu")}}if(void 0!==n.apv){if("string"!=typeof n.apv)throw new tG('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{o=tB(n.apv)}catch{throw new tG("Failed to base64url decode the apv")}}let s=await rb(a,t,"ECDH-ES"===e?n.enc:e,"ECDH-ES"===e?rj(n.enc):parseInt(e.slice(-5,-2),10),i,o);if("ECDH-ES"===e)return s;if(void 0===r)throw new tG("JWE Encrypted Key missing");return rw(e.slice(-6),s,r)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===r)throw new tG("JWE Encrypted Key missing");return rR(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{let o;if(void 0===r)throw new tG("JWE Encrypted Key missing");if("number"!=typeof n.p2c)throw new tG('JOSE Header "p2c" (PBES2 Count) missing or invalid');let a=i?.maxPBES2Count||1e4;if(n.p2c>a)throw new tG('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof n.p2s)throw new tG('JOSE Header "p2s" (PBES2 Salt) missing or invalid');try{o=tB(n.p2s)}catch{throw new tG("Failed to base64url decode the p2s")}return rA(e,t,r,n.p2c,o)}case"A128KW":case"A192KW":case"A256KW":if(void 0===r)throw new tG("JWE Encrypted Key missing");return rw(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{let i,o;if(void 0===r)throw new tG("JWE Encrypted Key missing");if("string"!=typeof n.iv)throw new tG('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof n.tag)throw new tG('JOSE Header "tag" (Authentication Tag) missing or invalid');try{i=tB(n.iv)}catch{throw new tG("Failed to base64url decode the iv")}try{o=tB(n.tag)}catch{throw new tG("Failed to base64url decode the tag")}return rX(e,t,r,i,o)}default:throw new tV('Invalid or unsupported "alg" (JWE Algorithm) header value')}}let ne=(e,t)=>{if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)};async function nt(e,t,r){let n,i,o,a,s,l,c;if(!t3(e))throw new tG("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new tG("JOSE Header missing");if(void 0!==e.iv&&"string"!=typeof e.iv)throw new tG("JWE Initialization Vector incorrect type");if("string"!=typeof e.ciphertext)throw new tG("JWE Ciphertext missing or incorrect type");if(void 0!==e.tag&&"string"!=typeof e.tag)throw new tG("JWE Authentication Tag incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new tG("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new tG("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new tG("JWE AAD incorrect type");if(void 0!==e.header&&!t3(e.header))throw new tG("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!t3(e.unprotected))throw new tG("JWE Per-Recipient Unprotected Header incorrect type");if(e.protected)try{let t=tB(e.protected);n=JSON.parse(tI.decode(t))}catch{throw new tG("JWE Protected Header is invalid")}if(!rZ(n,e.header,e.unprotected))throw new tG("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let u={...n,...e.header,...e.unprotected};if(rQ(tG,new Map,r?.crit,n,u),void 0!==u.zip)throw new tV('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg:d,enc:p}=u;if("string"!=typeof d||!d)throw new tG("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof p||!p)throw new tG("missing JWE Encryption Algorithm (enc) in JWE Header");let h=r&&ne("keyManagementAlgorithms",r.keyManagementAlgorithms),f=r&&ne("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(h&&!h.has(d)||!h&&d.startsWith("PBES2"))throw new tF('"alg" (Algorithm) Header Parameter value not allowed');if(f&&!f.has(p))throw new tF('"enc" (Encryption Algorithm) Header Parameter value not allowed');if(void 0!==e.encrypted_key)try{i=tB(e.encrypted_key)}catch{throw new tG("Failed to base64url decode the encrypted_key")}let m=!1;"function"==typeof t&&(t=await t(n,e),m=!0);try{o=await r7(d,t,i,u,r)}catch(e){if(e instanceof TypeError||e instanceof tG||e instanceof tV)throw e;o=rL(p)}if(void 0!==e.iv)try{a=tB(e.iv)}catch{throw new tG("Failed to base64url decode the iv")}if(void 0!==e.tag)try{s=tB(e.tag)}catch{throw new tG("Failed to base64url decode the tag")}let g=tC.encode(e.protected??"");l=void 0!==e.aad?tN(g,tC.encode("."),tC.encode(e.aad)):g;try{c=tB(e.ciphertext)}catch{throw new tG("Failed to base64url decode the ciphertext")}let y={plaintext:await rz(p,o,c,a,s,l)};if(void 0!==e.protected&&(y.protectedHeader=n),void 0!==e.aad)try{y.additionalAuthenticatedData=tB(e.aad)}catch{throw new tG("Failed to base64url decode the aad")}return(void 0!==e.unprotected&&(y.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(y.unprotectedHeader=e.header),m)?{...y,key:t}:y}async function nr(e,t,r){if(e instanceof Uint8Array&&(e=tI.decode(e)),"string"!=typeof e)throw new tG("Compact JWE must be a string or Uint8Array");let{0:n,1:i,2:o,3:a,4:s,length:l}=e.split(".");if(5!==l)throw new tG("Invalid Compact JWE");let c=await nt({ciphertext:a,iv:o||void 0,protected:n,tag:s||void 0,encrypted_key:i||void 0},t,r),u={plaintext:c.plaintext,protectedHeader:c.protectedHeader};return"function"==typeof t?{...u,key:c.key}:u}let nn=e=>e.toLowerCase().replace(/^application\//,""),ni=(e,t)=>"string"==typeof e?t.includes(e):!!Array.isArray(e)&&t.some(Set.prototype.has.bind(new Set(e))),no=(e,t,r={})=>{let n,i;try{n=JSON.parse(tI.decode(t))}catch{}if(!t3(n))throw new tY("JWT Claims Set must be a top-level JSON object");let{typ:o}=r;if(o&&("string"!=typeof e.typ||nn(e.typ)!==nn(o)))throw new tq('unexpected "typ" JWT header value',n,"typ","check_failed");let{requiredClaims:a=[],issuer:s,subject:l,audience:c,maxTokenAge:u}=r,d=[...a];for(let e of(void 0!==u&&d.push("iat"),void 0!==c&&d.push("aud"),void 0!==l&&d.push("sub"),void 0!==s&&d.push("iss"),new Set(d.reverse())))if(!(e in n))throw new tq(`missing required "${e}" claim`,n,e,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(n.iss))throw new tq('unexpected "iss" claim value',n,"iss","check_failed");if(l&&n.sub!==l)throw new tq('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!ni(n.aud,"string"==typeof c?[c]:c))throw new tq('unexpected "aud" claim value',n,"aud","check_failed");switch(typeof r.clockTolerance){case"string":i=r3(r.clockTolerance);break;case"number":i=r.clockTolerance;break;case"undefined":i=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:p}=r,h=r2(p||new Date);if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new tq('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new tq('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>h+i)throw new tq('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new tq('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=h-i)throw new tJ('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){let e=h-n.iat;if(e-i>("number"==typeof u?u:r3(u)))throw new tJ('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-i)throw new tq('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n};async function na(e,t,r){let n=await nr(e,t,r),i=no(n.protectedHeader,n.plaintext,r),{protectedHeader:o}=n;if(void 0!==o.iss&&o.iss!==i.iss)throw new tq('replicated "iss" claim header parameter mismatch',i,"iss","mismatch");if(void 0!==o.sub&&o.sub!==i.sub)throw new tq('replicated "sub" claim header parameter mismatch',i,"sub","mismatch");if(void 0!==o.aud&&JSON.stringify(o.aud)!==JSON.stringify(i.aud))throw new tq('replicated "aud" claim header parameter mismatch',i,"aud","mismatch");let a={payload:i,protectedHeader:o};return"function"==typeof t?{...a,key:n.key}:a}var ns=r(471);let nl=()=>Date.now()/1e3|0,nc="A256CBC-HS512";async function nu(e){let{token:t={},secret:r,maxAge:n=2592e3,salt:i}=e,o=Array.isArray(r)?r:[r],a=await np(nc,o[0],i),s=await t6({kty:"oct",k:tH(a)},`sha${a.byteLength<<3}`);return await new r8(t).setProtectedHeader({alg:"dir",enc:nc,kid:s}).setIssuedAt().setExpirationTime(nl()+n).setJti(crypto.randomUUID()).encrypt(a)}async function nd(e){let{token:t,secret:r,salt:n}=e,i=Array.isArray(r)?r:[r];if(!t)return null;let{payload:o}=await na(t,async({kid:e,enc:t})=>{for(let r of i){let i=await np(t,r,n);if(void 0===e||e===await t6({kty:"oct",k:tH(i)},`sha${i.byteLength<<3}`))return i}throw Error("no matching decryption secret")},{clockTolerance:15,keyManagementAlgorithms:["dir"],contentEncryptionAlgorithms:[nc,"A256GCM"]});return o}async function np(e,t,r){let n;switch(e){case"A256CBC-HS512":n=64;break;case"A256GCM":n=32;break;default:throw Error("Unsupported JWT Content Encryption Algorithm")}return await tT("sha256",t,r,`Auth.js Generated Encryption Key (${r})`,n)}async function nh({options:e,paramValue:t,cookieValue:r}){let{url:n,callbacks:i}=e,o=n.origin;return t?o=await i.redirect({url:t,baseUrl:n.origin}):r&&(o=await i.redirect({url:r,baseUrl:n.origin})),{callbackUrl:o,callbackUrlCookie:o!==r?o:void 0}}let nf="\x1b[31m",nm="\x1b[0m",ng={error(e){let t=e instanceof eJ?e.type:e.name;if(console.error(`${nf}[auth][error]${nm} ${t}: ${e.message}`),e.cause&&"object"==typeof e.cause&&"err"in e.cause&&e.cause.err instanceof Error){let{err:t,...r}=e.cause;console.error(`${nf}[auth][cause]${nm}:`,t.stack),r&&console.error(`${nf}[auth][details]${nm}:`,JSON.stringify(r,null,2))}else e.stack&&console.error(e.stack.replace(/.*/,"").substring(1))},warn(e){let t=`https://warnings.authjs.dev#${e}`;console.warn(`\x1b[33m[auth][warn][${e}]${nm}`,`Read more: ${t}`)},debug(e,t){console.log(`\x1b[90m[auth][debug]:${nm} ${e}`,JSON.stringify(t,null,2))}};function ny(e){let t={...ng};return e.debug||(t.debug=()=>{}),e.logger?.error&&(t.error=e.logger.error),e.logger?.warn&&(t.warn=e.logger.warn),e.logger?.debug&&(t.debug=e.logger.debug),e.logger??(e.logger=t),t}let nw=["providers","session","csrf","signin","signout","callback","verify-request","error","webauthn-options"];async function nb(e){if(!("body"in e)||!e.body||"POST"!==e.method)return;let t=e.headers.get("content-type");return t?.includes("application/json")?await e.json():t?.includes("application/x-www-form-urlencoded")?Object.fromEntries(new URLSearchParams(await e.text())):void 0}async function nv(e,t){try{if("GET"!==e.method&&"POST"!==e.method)throw new ti("Only GET and POST requests are supported");t.basePath??(t.basePath="/auth");let r=new URL(e.url),{action:n,providerId:i}=function(e,t){let r=e.match(RegExp(`^${t}(.+)`));if(null===r)throw new ti(`Cannot parse action at ${e}`);let n=r.at(-1).replace(/^\//,"").split("/").filter(Boolean);if(1!==n.length&&2!==n.length)throw new ti(`Cannot parse action at ${e}`);let[i,o]=n;if(!nw.includes(i)||o&&!["signin","callback","webauthn-options"].includes(i))throw new ti(`Cannot parse action at ${e}`);return{action:i,providerId:o}}(r.pathname,t.basePath);return{url:r,action:n,providerId:i,method:e.method,headers:Object.fromEntries(e.headers),body:e.body?await nb(e):void 0,cookies:(0,ns.Q)(e.headers.get("cookie")??"")??{},error:r.searchParams.get("error")??void 0,query:Object.fromEntries(r.searchParams)}}catch(n){let r=ny(t);r.error(n),r.debug("request",e)}}function n_(e){let t=new Headers(e.headers);e.cookies?.forEach(e=>{let{name:r,value:n,options:i}=e,o=ns.q(r,n,i);t.has("Set-Cookie")?t.append("Set-Cookie",o):t.set("Set-Cookie",o)});let r=e.body;"application/json"===t.get("content-type")?r=JSON.stringify(e.body):"application/x-www-form-urlencoded"===t.get("content-type")&&(r=new URLSearchParams(e.body).toString());let n=new Response(r,{headers:t,status:e.redirect?302:e.status??200});return e.redirect&&n.headers.set("Location",e.redirect),n}async function nS(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>e.toString(16).padStart(2,"0")).join("").toString()}function nE(e){let t=e=>("0"+e.toString(16)).slice(-2);return Array.from(crypto.getRandomValues(new Uint8Array(e))).reduce((e,r)=>e+t(r),"")}async function nA({options:e,cookieValue:t,isPost:r,bodyValue:n}){if(t){let[i,o]=t.split("|");if(o===await nS(`${i}${e.secret}`))return{csrfTokenVerified:r&&i===n,csrfToken:i}}let i=nE(32),o=await nS(`${i}${e.secret}`);return{cookie:`${i}|${o}`,csrfToken:i}}function nk(e,t){if(!t)throw new tc(`CSRF token was missing during an action ${e}`)}function nx(e){return null!==e&&"object"==typeof e}function nT(e,...t){if(!t.length)return e;let r=t.shift();if(nx(e)&&nx(r))for(let t in r)nx(r[t])?(nx(e[t])||(e[t]=Array.isArray(r[t])?[]:{}),nT(e[t],r[t])):void 0!==r[t]&&(e[t]=r[t]);return nT(e,...t)}let nR=Symbol("skip-csrf-check"),nP=Symbol("return-type-raw"),nO=Symbol("custom-fetch"),nC=Symbol("conform-internal"),nI=e=>nU({id:e.sub??e.id??crypto.randomUUID(),name:e.name??e.nickname??e.preferred_username,email:e.email,image:e.picture}),nN=e=>nU({access_token:e.access_token,id_token:e.id_token,refresh_token:e.refresh_token,expires_at:e.expires_at,scope:e.scope,token_type:e.token_type,session_state:e.session_state});function nU(e){let t={};for(let[r,n]of Object.entries(e))void 0!==n&&(t[r]=n);return t}function nj(e,t){if(!e&&t)return;if("string"==typeof e)return{url:new URL(e)};let r=new URL(e?.url??"https://authjs.dev");if(e?.params!=null)for(let[t,n]of Object.entries(e.params))"claims"===t&&(n=JSON.stringify(n)),r.searchParams.set(t,String(n));return{url:r,request:e?.request,conform:e?.conform,...e?.clientPrivateKey?{clientPrivateKey:e?.clientPrivateKey}:null}}let nL={signIn:()=>!0,redirect:({url:e,baseUrl:t})=>e.startsWith("/")?`${t}${e}`:new URL(e).origin===t?e:t,session:({session:e})=>({user:{name:e.user?.name,email:e.user?.email,image:e.user?.image},expires:e.expires?.toISOString?.()??e.expires}),jwt:({token:e})=>e};async function nD({authOptions:e,providerId:t,action:r,url:n,cookies:i,callbackUrl:o,csrfToken:a,csrfDisabled:s,isPost:l}){var c;let u=ny(e),{providers:d,provider:p}=function(e){let{providerId:t,config:r}=e,n=new URL(r.basePath??"/auth",e.url.origin),i=r.providers.map(e=>{let t="function"==typeof e?e():e,{options:i,...o}=t,a=i?.id??o.id,s=nT(o,i,{signinUrl:`${n}/signin/${a}`,callbackUrl:`${n}/callback/${a}`});if("oauth"===t.type||"oidc"===t.type){s.redirectProxyUrl??(s.redirectProxyUrl=i?.redirectProxyUrl??r.redirectProxyUrl);let e=function(e){e.issuer&&(e.wellKnown??(e.wellKnown=`${e.issuer}/.well-known/openid-configuration`));let t=nj(e.authorization,e.issuer);t&&!t.url?.searchParams.has("scope")&&t.url.searchParams.set("scope","openid profile email");let r=nj(e.token,e.issuer),n=nj(e.userinfo,e.issuer),i=e.checks??["pkce"];return e.redirectProxyUrl&&(i.includes("state")||i.push("state"),e.redirectProxyUrl=`${e.redirectProxyUrl}/callback/${e.id}`),{...e,authorization:t,token:r,checks:i,userinfo:n,profile:e.profile??nI,account:e.account??nN}}(s);return e.authorization?.url.searchParams.get("response_mode")==="form_post"&&delete e.redirectProxyUrl,e[nO]??(e[nO]=i?.[nO]),e}return s});return{providers:i,provider:i.find(({id:e})=>e===t)}}({url:n,providerId:t,config:e}),h=!1;if((p?.type==="oauth"||p?.type==="oidc")&&p.redirectProxyUrl)try{h=new URL(p.redirectProxyUrl).origin===n.origin}catch{throw TypeError(`redirectProxyUrl must be a valid URL. Received: ${p.redirectProxyUrl}`)}let f={debug:!1,pages:{},theme:{colorScheme:"auto",logo:"",brandColor:"",buttonText:""},...e,url:n,action:r,provider:p,cookies:nT(eK(e.useSecureCookies??"https:"===n.protocol),e.cookies),providers:d,session:{strategy:e.adapter?"database":"jwt",maxAge:2592e3,updateAge:86400,generateSessionToken:()=>crypto.randomUUID(),...e.session},jwt:{secret:e.secret,maxAge:e.session?.maxAge??2592e3,encode:nu,decode:nd,...e.jwt},events:Object.keys(c=e.events??{}).reduce((e,t)=>(e[t]=async(...e)=>{try{let r=c[t];return await r(...e)}catch(e){u.error(new eY(e))}},e),{}),adapter:function(e,t){if(e)return Object.keys(e).reduce((r,n)=>(r[n]=async(...r)=>{try{t.debug(`adapter_${n}`,{args:r});let i=e[n];return await i(...r)}catch(r){let e=new eV(r);throw t.error(e),e}},r),{})}(e.adapter,u),callbacks:{...nL,...e.callbacks},logger:u,callbackUrl:n.origin,isOnRedirectProxy:h,experimental:{...e.experimental}},m=[];if(s)f.csrfTokenVerified=!0;else{let{csrfToken:e,cookie:t,csrfTokenVerified:r}=await nA({options:f,cookieValue:i?.[f.cookies.csrfToken.name],isPost:l,bodyValue:a});f.csrfToken=e,f.csrfTokenVerified=r,t&&m.push({name:f.cookies.csrfToken.name,value:t,options:f.cookies.csrfToken.options})}let{callbackUrl:g,callbackUrlCookie:y}=await nh({options:f,cookieValue:i?.[f.cookies.callbackUrl.name],paramValue:o});return f.callbackUrl=g,y&&m.push({name:f.cookies.callbackUrl.name,value:y,options:f.cookies.callbackUrl.options}),{options:f,cookies:m}}var nM,n$,nH,nW,nB,nK,nq,nJ,nF,nV,nz,nG,nX,nY,nZ,nQ,n0,n1,n2,n5,n3,n4,n6,n8={},n9=[],n7=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function ie(e,t){for(var r in t)e[r]=t[r];return e}function it(e){var t=e.parentNode;t&&t.removeChild(e)}function ir(e,t,r,n,i){var o={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==i?++n3:i};return null==i&&null!=n5.vnode&&n5.vnode(o),o}function ii(e){return e.children}function io(e,t){this.props=e,this.context=t}function ia(e,t){if(null==t)return e.__?ia(e.__,e.__.__k.indexOf(e)+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?ia(e):null}function is(e){(!e.__d&&(e.__d=!0)&&n4.push(e)&&!il.__r++||n6!==n5.debounceRendering)&&((n6=n5.debounceRendering)||setTimeout)(il)}function il(){for(var e;il.__r=n4.length;)e=n4.sort(function(e,t){return e.__v.__b-t.__v.__b}),n4=[],e.some(function(e){var t,r,n,i,o;e.__d&&(i=(n=e.__v).__e,(o=e.__P)&&(t=[],(r=ie({},n)).__v=n.__v+1,ig(o,n,r,e.__n,void 0!==o.ownerSVGElement,null!=n.__h?[i]:null,t,null==i?ia(n):i,n.__h),iy(t,n),n.__e!=i&&function e(t){var r,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,r=0;r<t.__k.length;r++)if(null!=(n=t.__k[r])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return e(t)}}(n)))})}function ic(e,t,r,n,i,o,a,s,l,c){var u,d,p,h,f,m,g,y=n&&n.__k||n9,w=y.length;for(r.__k=[],u=0;u<t.length;u++)if(null!=(h=r.__k[u]=null==(h=t[u])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h||"bigint"==typeof h?ir(null,h,null,null,h):Array.isArray(h)?ir(ii,{children:h},null,null,null):h.__b>0?ir(h.type,h.props,h.key,h.ref?h.ref:null,h.__v):h)){if(h.__=r,h.__b=r.__b+1,null===(p=y[u])||p&&h.key==p.key&&h.type===p.type)y[u]=void 0;else for(d=0;d<w;d++){if((p=y[d])&&h.key==p.key&&h.type===p.type){y[d]=void 0;break}p=null}ig(e,h,p=p||n8,i,o,a,s,l,c),f=h.__e,(d=h.ref)&&p.ref!=d&&(g||(g=[]),p.ref&&g.push(p.ref,null,h),g.push(d,h.__c||f,h)),null!=f?(null==m&&(m=f),"function"==typeof h.type&&h.__k===p.__k?h.__d=l=function e(t,r,n){for(var i,o=t.__k,a=0;o&&a<o.length;a++)(i=o[a])&&(i.__=t,r="function"==typeof i.type?e(i,r,n):iu(n,i,i,o,i.__e,r));return r}(h,l,e):l=iu(e,h,p,y,f,l),"function"==typeof r.type&&(r.__d=l)):l&&p.__e==l&&l.parentNode!=e&&(l=ia(p))}for(r.__e=m,u=w;u--;)null!=y[u]&&function e(t,r,n){var i,o;if(n5.unmount&&n5.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||iw(i,null,r)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n5.__e(e,r)}i.base=i.__P=null,t.__c=void 0}if(i=t.__k)for(o=0;o<i.length;o++)i[o]&&e(i[o],r,n||"function"!=typeof t.type);n||null==t.__e||it(t.__e),t.__=t.__e=t.__d=void 0}(y[u],y[u]);if(g)for(u=0;u<g.length;u++)iw(g[u],g[++u],g[++u])}function iu(e,t,r,n,i,o){var a,s,l;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(null==r||i!=o||null==i.parentNode)e:if(null==o||o.parentNode!==e)e.appendChild(i),a=null;else{for(s=o,l=0;(s=s.nextSibling)&&l<n.length;l+=1)if(s==i)break e;e.insertBefore(i,o),a=o}return void 0!==a?a:i.nextSibling}function id(e,t,r){"-"===t[0]?e.setProperty(t,r):e[t]=null==r?"":"number"!=typeof r||n7.test(t)?r:r+"px"}function ip(e,t,r,n,i){var o;e:if("style"===t){if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof n&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||id(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||id(e.style,t,r[t])}}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase() in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=r,r?n||e.addEventListener(t,o?im:ih,o):e.removeEventListener(t,o?im:ih,o);else if("dangerouslySetInnerHTML"!==t){if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&-1==t.indexOf("-")?e.removeAttribute(t):e.setAttribute(t,r))}}function ih(e){this.l[e.type+!1](n5.event?n5.event(e):e)}function im(e){this.l[e.type+!0](n5.event?n5.event(e):e)}function ig(e,t,r,n,i,o,a,s,l){var c,u,d,p,h,f,m,g,y,w,b,v,_,S,E,A=t.type;if(void 0!==t.constructor)return null;null!=r.__h&&(l=r.__h,s=t.__e=r.__e,t.__h=null,o=[s]),(c=n5.__b)&&c(t);try{e:if("function"==typeof A){if(g=t.props,y=(c=A.contextType)&&n[c.__c],w=c?y?y.props.value:c.__:n,r.__c?m=(u=t.__c=r.__c).__=u.__E:("prototype"in A&&A.prototype.render?t.__c=u=new A(g,w):(t.__c=u=new io(g,w),u.constructor=A,u.render=ib),y&&y.sub(u),u.props=g,u.state||(u.state={}),u.context=w,u.__n=n,d=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=A.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=ie({},u.__s)),ie(u.__s,A.getDerivedStateFromProps(g,u.__s))),p=u.props,h=u.state,d)null==A.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==A.getDerivedStateFromProps&&g!==p&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(g,w),!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(g,u.__s,w)||t.__v===r.__v){for(u.props=g,u.state=u.__s,t.__v!==r.__v&&(u.__d=!1),u.__v=t,t.__e=r.__e,t.__k=r.__k,t.__k.forEach(function(e){e&&(e.__=t)}),b=0;b<u._sb.length;b++)u.__h.push(u._sb[b]);u._sb=[],u.__h.length&&a.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(g,u.__s,w),null!=u.componentDidUpdate&&u.__h.push(function(){u.componentDidUpdate(p,h,f)})}if(u.context=w,u.props=g,u.__v=t,u.__P=e,v=n5.__r,_=0,"prototype"in A&&A.prototype.render){for(u.state=u.__s,u.__d=!1,v&&v(t),c=u.render(u.props,u.state,u.context),S=0;S<u._sb.length;S++)u.__h.push(u._sb[S]);u._sb=[]}else do u.__d=!1,v&&v(t),c=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++_<25);u.state=u.__s,null!=u.getChildContext&&(n=ie(ie({},n),u.getChildContext())),d||null==u.getSnapshotBeforeUpdate||(f=u.getSnapshotBeforeUpdate(p,h)),E=null!=c&&c.type===ii&&null==c.key?c.props.children:c,ic(e,Array.isArray(E)?E:[E],t,r,n,i,o,a,s,l),u.base=t.__e,t.__h=null,u.__h.length&&a.push(u),m&&(u.__E=u.__=null),u.__e=!1}else null==o&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=function(e,t,r,n,i,o,a,s){var l,c,u,d=r.props,p=t.props,h=t.type,f=0;if("svg"===h&&(i=!0),null!=o){for(;f<o.length;f++)if((l=o[f])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,o[f]=null;break}}if(null==e){if(null===h)return document.createTextNode(p);e=i?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,p.is&&p),o=null,s=!1}if(null===h)d===p||s&&e.data===p||(e.data=p);else{if(o=o&&n2.call(e.childNodes),c=(d=r.props||n8).dangerouslySetInnerHTML,u=p.dangerouslySetInnerHTML,!s){if(null!=o)for(d={},f=0;f<e.attributes.length;f++)d[e.attributes[f].name]=e.attributes[f].value;(u||c)&&(u&&(c&&u.__html==c.__html||u.__html===e.innerHTML)||(e.innerHTML=u&&u.__html||""))}if(function(e,t,r,n,i){var o;for(o in r)"children"===o||"key"===o||o in t||ip(e,o,null,r[o],n);for(o in t)i&&"function"!=typeof t[o]||"children"===o||"key"===o||"value"===o||"checked"===o||r[o]===t[o]||ip(e,o,t[o],r[o],n)}(e,p,d,i,s),u)t.__k=[];else if(ic(e,Array.isArray(f=t.props.children)?f:[f],t,r,n,i&&"foreignObject"!==h,o,a,o?o[0]:r.__k&&ia(r,0),s),null!=o)for(f=o.length;f--;)null!=o[f]&&it(o[f]);s||("value"in p&&void 0!==(f=p.value)&&(f!==e.value||"progress"===h&&!f||"option"===h&&f!==d.value)&&ip(e,"value",f,d.value,!1),"checked"in p&&void 0!==(f=p.checked)&&f!==e.checked&&ip(e,"checked",f,d.checked,!1))}return e}(r.__e,t,r,n,i,o,a,l);(c=n5.diffed)&&c(t)}catch(e){t.__v=null,(l||null!=o)&&(t.__e=s,t.__h=!!l,o[o.indexOf(s)]=null),n5.__e(e,t,r)}}function iy(e,t){n5.__c&&n5.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){n5.__e(e,t.__v)}})}function iw(e,t,r){try{"function"==typeof e?e(t):e.current=t}catch(e){n5.__e(e,r)}}function ib(e,t,r){return this.constructor(e,r)}function iv(e,t){var r,n,i,o;r=e,n5.__&&n5.__(r,t),i=(n="function"==typeof iv)?null:iv&&iv.__k||t.__k,o=[],ig(t,r=(!n&&iv||t).__k=function(e,t,r){var n,i,o,a={};for(o in t)"key"==o?n=t[o]:"ref"==o?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?n2.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===a[o]&&(a[o]=e.defaultProps[o]);return ir(e,a,n,i,null)}(ii,null,[r]),i||n8,n8,void 0!==t.ownerSVGElement,!n&&iv?[iv]:i?null:t.firstChild?n2.call(t.childNodes):null,o,!n&&iv?iv:i?i.__e:t.firstChild,n),iy(o,r)}n2=n9.slice,n5={__e:function(e,t,r,n){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,n||{}),a=i.__d),a)return i.__E=i}catch(t){e=t}throw e}},n3=0,io.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=ie({},this.state),"function"==typeof e&&(e=e(ie({},r),this.props)),e&&ie(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),is(this))},io.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),is(this))},io.prototype.render=ii,n4=[],il.__r=0;var i_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,iS=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,iE=/[\s\n\\/='"\0<>]/,iA=/^xlink:?./,ik=/["&<]/;function ix(e){if(!1===ik.test(e+=""))return e;for(var t=0,r=0,n="",i="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:i="&quot;";break;case 38:i="&amp;";break;case 60:i="&lt;";break;default:continue}r!==t&&(n+=e.slice(t,r)),n+=i,t=r+1}return r!==t&&(n+=e.slice(t,r)),n}var iT=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"	"))},iR=function(e,t,r){return String(e).length>(t||40)||!r&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},iP={},iO=/([A-Z])/g;function iC(e){var t="";for(var r in e){var n=e[r];null!=n&&""!==n&&(t&&(t+=" "),t+="-"==r[0]?r:iP[r]||(iP[r]=r.replace(iO,"-$1").toLowerCase()),t="number"==typeof n&&!1===i_.test(r)?t+": "+n+"px;":t+": "+n+";")}return t||void 0}function iI(e,t){return Array.isArray(t)?t.reduce(iI,e):null!=t&&!1!==t&&e.push(t),e}function iN(){this.__d=!0}function iU(e,t){return{__v:e,context:t,props:e.props,setState:iN,forceUpdate:iN,__d:!0,__h:[]}}function ij(e,t){var r=e.contextType,n=r&&t[r.__c];return null!=r?n?n.props.value:r.__:t}var iL=[],iD={shallow:!0};i$.render=i$;var iM=[];function i$(e,t,r){t=t||{};var n,i=n5.__s;return n5.__s=!0,n=r&&(r.pretty||r.voidElements||r.sortAttributes||r.shallow||r.allAttributes||r.xml||r.attributeHook)?function e(t,r,n,i,o,a){if(null==t||"boolean"==typeof t)return"";if("object"!=typeof t)return ix(t);var s=n.pretty,l=s&&"string"==typeof s?s:"	";if(Array.isArray(t)){for(var c="",u=0;u<t.length;u++)s&&u>0&&(c+="\n"),c+=e(t[u],r,n,i,o,a);return c}var d,p=t.type,h=t.props,f=!1;if("function"==typeof p){if(f=!0,!n.shallow||!i&&!1!==n.renderRootComponent){if(p===ii){var m=[];return iI(m,t.props.children),e(m,r,n,!1!==n.shallowHighOrder,o,a)}var g,y=t.__c=iU(t,r);n5.__b&&n5.__b(t);var w=n5.__r;if(p.prototype&&"function"==typeof p.prototype.render){var b=ij(p,r);(y=t.__c=new p(h,b)).__v=t,y._dirty=y.__d=!0,y.props=h,null==y.state&&(y.state={}),null==y._nextState&&null==y.__s&&(y._nextState=y.__s=y.state),y.context=b,p.getDerivedStateFromProps?y.state=Object.assign({},y.state,p.getDerivedStateFromProps(y.props,y.state)):y.componentWillMount&&(y.componentWillMount(),y.state=y._nextState!==y.state?y._nextState:y.__s!==y.state?y.__s:y.state),w&&w(t),g=y.render(y.props,y.state,y.context)}else for(var v=ij(p,r),_=0;y.__d&&_++<25;)y.__d=!1,w&&w(t),g=p.call(t.__c,h,v);return y.getChildContext&&(r=Object.assign({},r,y.getChildContext())),n5.diffed&&n5.diffed(t),e(g,r,n,!1!==n.shallowHighOrder,o,a)}p=(d=p).displayName||d!==Function&&d.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var r=-1,n=iL.length;n--;)if(iL[n]===e){r=n;break}r<0&&(r=iL.push(e)-1),t="UnnamedComponent"+r}return t}(d)}var S,E,A="<"+p;if(h){var k=Object.keys(h);n&&!0===n.sortAttributes&&k.sort();for(var x=0;x<k.length;x++){var T=k[x],R=h[T];if("children"!==T){if(!iE.test(T)&&(n&&n.allAttributes||"key"!==T&&"ref"!==T&&"__self"!==T&&"__source"!==T)){if("defaultValue"===T)T="value";else if("defaultChecked"===T)T="checked";else if("defaultSelected"===T)T="selected";else if("className"===T){if(void 0!==h.class)continue;T="class"}else o&&iA.test(T)&&(T=T.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===T){if(h.for)continue;T="for"}"style"===T&&R&&"object"==typeof R&&(R=iC(R)),"a"===T[0]&&"r"===T[1]&&"boolean"==typeof R&&(R=String(R));var P=n.attributeHook&&n.attributeHook(T,R,r,n,f);if(P||""===P)A+=P;else if("dangerouslySetInnerHTML"===T)E=R&&R.__html;else if("textarea"===p&&"value"===T)S=R;else if((R||0===R||""===R)&&"function"!=typeof R){if(!(!0!==R&&""!==R||(R=T,n&&n.xml))){A=A+" "+T;continue}if("value"===T){if("select"===p){a=R;continue}"option"===p&&a==R&&void 0===h.selected&&(A+=" selected")}A=A+" "+T+'="'+ix(R)+'"'}}}else S=R}}if(s){var O=A.replace(/\n\s*/," ");O===A||~O.indexOf("\n")?s&&~A.indexOf("\n")&&(A+="\n"):A=O}if(A+=">",iE.test(p))throw Error(p+" is not a valid HTML tag name in "+A);var C,I=iS.test(p)||n.voidElements&&n.voidElements.test(p),N=[];if(E)s&&iR(E)&&(E="\n"+l+iT(E,l)),A+=E;else if(null!=S&&iI(C=[],S).length){for(var U=s&&~A.indexOf("\n"),j=!1,L=0;L<C.length;L++){var D=C[L];if(null!=D&&!1!==D){var M=e(D,r,n,!0,"svg"===p||"foreignObject"!==p&&o,a);if(s&&!U&&iR(M)&&(U=!0),M){if(s){var $=M.length>0&&"<"!=M[0];j&&$?N[N.length-1]+=M:N.push(M),j=$}else N.push(M)}}}if(s&&U)for(var H=N.length;H--;)N[H]="\n"+l+iT(N[H],l)}if(N.length||E)A+=N.join("");else if(n&&n.xml)return A.substring(0,A.length-1)+" />";return!I||C||E?(s&&~A.indexOf("\n")&&(A+="\n"),A=A+"</"+p+">"):A=A.replace(/>$/," />"),A}(e,t,r):function e(t,r,n,i){if(null==t||!0===t||!1===t||""===t)return"";if("object"!=typeof t)return ix(t);if(iH(t)){for(var o="",a=0;a<t.length;a++)o+=e(t[a],r,n,i);return o}n5.__b&&n5.__b(t);var s=t.type,l=t.props;if("function"==typeof s){if(s===ii)return e(t.props.children,r,n,i);f=s.prototype&&"function"==typeof s.prototype.render?(c=r,d=ij(u=t.type,c),p=new u(t.props,d),t.__c=p,p.__v=t,p.__d=!0,p.props=t.props,null==p.state&&(p.state={}),null==p.__s&&(p.__s=p.state),p.context=d,u.getDerivedStateFromProps?p.state=iW({},p.state,u.getDerivedStateFromProps(p.props,p.state)):p.componentWillMount&&(p.componentWillMount(),p.state=p.__s!==p.state?p.__s:p.state),(h=n5.__r)&&h(t),p.render(p.props,p.state,p.context)):function(e,t){var r,n=iU(e,t),i=ij(e.type,t);e.__c=n;for(var o=n5.__r,a=0;n.__d&&a++<25;)n.__d=!1,o&&o(e),r=e.type.call(n,e.props,i);return r}(t,r);var c,u,d,p,h,f,m=t.__c;m.getChildContext&&(r=iW({},r,m.getChildContext()));var g=e(f,r,n,i);return n5.diffed&&n5.diffed(t),g}var y,w,b="<";if(b+=s,l)for(var v in y=l.children,l){var _,S,E,A=l[v];if(!("key"===v||"ref"===v||"__self"===v||"__source"===v||"children"===v||"className"===v&&"class"in l||"htmlFor"===v&&"for"in l||iE.test(v))){if(S=v="className"===(_=v)?"class":"htmlFor"===_?"for":"defaultValue"===_?"value":"defaultChecked"===_?"checked":"defaultSelected"===_?"selected":n&&iA.test(_)?_.toLowerCase().replace(/^xlink:?/,"xlink:"):_,E=A,A="style"===S&&null!=E&&"object"==typeof E?iC(E):"a"===S[0]&&"r"===S[1]&&"boolean"==typeof E?String(E):E,"dangerouslySetInnerHTML"===v)w=A&&A.__html;else if("textarea"===s&&"value"===v)y=A;else if((A||0===A||""===A)&&"function"!=typeof A){if(!0===A||""===A){A=v,b=b+" "+v;continue}if("value"===v){if("select"===s){i=A;continue}"option"!==s||i!=A||"selected"in l||(b+=" selected")}b=b+" "+v+'="'+ix(A)+'"'}}}var k=b;if(b+=">",iE.test(s))throw Error(s+" is not a valid HTML tag name in "+b);var x="",T=!1;if(w)x+=w,T=!0;else if("string"==typeof y)x+=ix(y),T=!0;else if(iH(y))for(var R=0;R<y.length;R++){var P=y[R];if(null!=P&&!1!==P){var O=e(P,r,"svg"===s||"foreignObject"!==s&&n,i);O&&(x+=O,T=!0)}}else if(null!=y&&!1!==y&&!0!==y){var C=e(y,r,"svg"===s||"foreignObject"!==s&&n,i);C&&(x+=C,T=!0)}if(n5.diffed&&n5.diffed(t),T)b+=x;else if(iS.test(s))return k+" />";return b+"</"+s+">"}(e,t,!1,void 0),n5.__c&&n5.__c(e,iM),n5.__s=i,iM.length=0,n}var iH=Array.isArray,iW=Object.assign;i$.shallowRender=function(e,t){return i$(e,t,iD)};var iB=0;function iK(e,t,r,n,i){var o,a,s={};for(a in t)"ref"==a?o=t[a]:s[a]=t[a];var l={type:e,props:s,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--iB,__source:i,__self:n};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===s[a]&&(s[a]=o[a]);return n5.vnode&&n5.vnode(l),l}async function iq(e,t){let r=window.SimpleWebAuthnBrowser;async function n(r){let n=new URL(`${e}/webauthn-options/${t}`);r&&n.searchParams.append("action",r),o().forEach(e=>{n.searchParams.append(e.name,e.value)});let i=await fetch(n);if(!i.ok){console.error("Failed to fetch options",i);return}return i.json()}function i(){let e=`#${t}-form`,r=document.querySelector(e);if(!r)throw Error(`Form '${e}' not found`);return r}function o(){return Array.from(i().querySelectorAll("input[data-form-field]"))}async function a(e,t){let r=i();if(e){let t=document.createElement("input");t.type="hidden",t.name="action",t.value=e,r.appendChild(t)}if(t){let e=document.createElement("input");e.type="hidden",e.name="data",e.value=JSON.stringify(t),r.appendChild(e)}return r.submit()}async function s(e,t){let n=await r.startAuthentication(e,t);return await a("authenticate",n)}async function l(e){o().forEach(e=>{if(e.required&&!e.value)throw Error(`Missing required field: ${e.name}`)});let t=await r.startRegistration(e);return await a("register",t)}async function c(){if(!r.browserSupportsWebAuthnAutofill())return;let e=await n("authenticate");if(!e){console.error("Failed to fetch option for autofill authentication");return}try{await s(e.options,!0)}catch(e){console.error(e)}}(async function(){let e=i();if(!r.browserSupportsWebAuthn()){e.style.display="none";return}e&&e.addEventListener("submit",async e=>{e.preventDefault();let t=await n(void 0);if(!t){console.error("Failed to fetch options for form submission");return}if("authenticate"===t.action)try{await s(t.options,!1)}catch(e){console.error(e)}else if("register"===t.action)try{await l(t.options)}catch(e){console.error(e)}})})(),c()}let iJ={default:"Unable to sign in.",Signin:"Try signing in with a different account.",OAuthSignin:"Try signing in with a different account.",OAuthCallbackError:"Try signing in with a different account.",OAuthCreateAccount:"Try signing in with a different account.",EmailCreateAccount:"Try signing in with a different account.",Callback:"Try signing in with a different account.",OAuthAccountNotLinked:"To confirm your identity, sign in with the same account you used originally.",EmailSignin:"The e-mail could not be sent.",CredentialsSignin:"Sign in failed. Check the details you provided are correct.",SessionRequired:"Please sign in to access this page."},iF=`:root {
  --border-width: 1px;
  --border-radius: 0.5rem;
  --color-error: #c94b4b;
  --color-info: #157efb;
  --color-info-hover: #0f6ddb;
  --color-info-text: #fff;
}

.__next-auth-theme-auto,
.__next-auth-theme-light {
  --color-background: #ececec;
  --color-background-hover: rgba(236, 236, 236, 0.8);
  --color-background-card: #fff;
  --color-text: #000;
  --color-primary: #444;
  --color-control-border: #bbb;
  --color-button-active-background: #f9f9f9;
  --color-button-active-border: #aaa;
  --color-separator: #ccc;
}

.__next-auth-theme-dark {
  --color-background: #161b22;
  --color-background-hover: rgba(22, 27, 34, 0.8);
  --color-background-card: #0d1117;
  --color-text: #fff;
  --color-primary: #ccc;
  --color-control-border: #555;
  --color-button-active-background: #060606;
  --color-button-active-border: #666;
  --color-separator: #444;
}

@media (prefers-color-scheme: dark) {
  .__next-auth-theme-auto {
    --color-background: #161b22;
    --color-background-hover: rgba(22, 27, 34, 0.8);
    --color-background-card: #0d1117;
    --color-text: #fff;
    --color-primary: #ccc;
    --color-control-border: #555;
    --color-button-active-background: #060606;
    --color-button-active-border: #666;
    --color-separator: #444;
  }

  button,
  a.button {
    color: var(--provider-dark-color, var(--color-primary)) !important;
    background-color: var(
      --provider-dark-bg,
      var(--color-background)
    ) !important;
  }

    :is(button,a.button):hover {
      background-color: var(
        --provider-dark-bg-hover,
        var(--color-background-hover)
      ) !important;
    }

    :is(button,a.button) span {
      color: var(--provider-dark-bg) !important;
    }
}

html {
  box-sizing: border-box;
}

*,
*:before,
*:after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-background);
  margin: 0;
  padding: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    "Noto Sans",
    sans-serif,
    "Apple Color Emoji",
    "Segoe UI Emoji",
    "Segoe UI Symbol",
    "Noto Color Emoji";
}

h1 {
  margin-bottom: 1.5rem;
  padding: 0 1rem;
  font-weight: 400;
  color: var(--color-text);
}

p {
  margin-bottom: 1.5rem;
  padding: 0 1rem;
  color: var(--color-text);
}

form {
  margin: 0;
  padding: 0;
}

label {
  font-weight: 500;
  text-align: left;
  margin-bottom: 0.25rem;
  display: block;
  color: var(--color-text);
}

input[type] {
  box-sizing: border-box;
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  border: var(--border-width) solid var(--color-control-border);
  background: var(--color-background-card);
  font-size: 1rem;
  border-radius: var(--border-radius);
  color: var(--color-text);
}

p {
  font-size: 1.1rem;
  line-height: 2rem;
}

a.button {
  text-decoration: none;
  line-height: 1rem;
}

a.button:link,
  a.button:visited {
    background-color: var(--color-background);
    color: var(--color-primary);
  }

button,
a.button {
  padding: 0.75rem 1rem;
  color: var(--provider-color, var(--color-primary));
  background-color: var(--provider-bg, var(--color-background));
  border: 1px solid #00000031;
  font-size: 0.9rem;
  height: 50px;
  border-radius: var(--border-radius);
  transition: background-color 250ms ease-in-out;
  font-weight: 300;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

:is(button,a.button):hover {
    background-color: var(--provider-bg-hover, var(--color-background-hover));
    cursor: pointer;
  }

:is(button,a.button):active {
    cursor: pointer;
  }

:is(button,a.button) span {
    color: #fff;
  }

#submitButton {
  color: var(--button-text-color, var(--color-info-text));
  background-color: var(--brand-color, var(--color-info));
  width: 100%;
}

#submitButton:hover {
    background-color: var(
      --button-hover-bg,
      var(--color-info-hover)
    ) !important;
  }

a.site {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 1rem;
  line-height: 2rem;
}

a.site:hover {
    text-decoration: underline;
  }

.page {
  position: absolute;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.page > div {
    text-align: center;
  }

.error a.button {
    padding-left: 2rem;
    padding-right: 2rem;
    margin-top: 0.5rem;
  }

.error .message {
    margin-bottom: 1.5rem;
  }

.signin input[type="text"] {
    margin-left: auto;
    margin-right: auto;
    display: block;
  }

.signin hr {
    display: block;
    border: 0;
    border-top: 1px solid var(--color-separator);
    margin: 2rem auto 1rem auto;
    overflow: visible;
  }

.signin hr::before {
      content: "or";
      background: var(--color-background-card);
      color: #888;
      padding: 0 0.4rem;
      position: relative;
      top: -0.7rem;
    }

.signin .error {
    background: #f5f5f5;
    font-weight: 500;
    border-radius: 0.3rem;
    background: var(--color-error);
  }

.signin .error p {
      text-align: left;
      padding: 0.5rem 1rem;
      font-size: 0.9rem;
      line-height: 1.2rem;
      color: var(--color-info-text);
    }

.signin > div,
  .signin form {
    display: block;
  }

.signin > div input[type], .signin form input[type] {
      margin-bottom: 0.5rem;
    }

.signin > div button, .signin form button {
      width: 100%;
    }

.signin .provider + .provider {
    margin-top: 1rem;
  }

.logo {
  display: inline-block;
  max-width: 150px;
  margin: 1.25rem 0;
  max-height: 70px;
}

.card {
  background-color: var(--color-background-card);
  border-radius: 1rem;
  padding: 1.25rem 2rem;
}

.card .header {
    color: var(--color-primary);
  }

.card input[type]::-moz-placeholder {
    color: color-mix(
      in srgb,
      var(--color-text) 20%,
      var(--color-button-active-background)
    );
  }

.card input[type]::placeholder {
    color: color-mix(
      in srgb,
      var(--color-text) 20%,
      var(--color-button-active-background)
    );
  }

.card input[type] {
    background: color-mix(in srgb, var(--color-background-card) 95%, black);
  }

.section-header {
  color: var(--color-text);
}

@media screen and (min-width: 450px) {
  .card {
    margin: 2rem 0;
    width: 368px;
  }
}

@media screen and (max-width: 450px) {
  .card {
    margin: 1rem 0;
    width: 343px;
  }
}
`;function iV({html:e,title:t,status:r,cookies:n,theme:i,headTags:o}){return{cookies:n,status:r,headers:{"Content-Type":"text/html"},body:`<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><style>${iF}</style><title>${t}</title>${o??""}</head><body class="__next-auth-theme-${i?.colorScheme??"auto"}"><div class="page">${i$(e)}</div></body></html>`}}function iz(e){let{url:t,theme:r,query:n,cookies:i,pages:o,providers:a}=e;return{csrf:(e,t,r)=>e?(t.logger.warn("csrf-disabled"),r.push({name:t.cookies.csrfToken.name,value:"",options:{...t.cookies.csrfToken.options,maxAge:0}}),{status:404,cookies:r}):{headers:{"Content-Type":"application/json"},body:{csrfToken:t.csrfToken},cookies:r},providers:e=>({headers:{"Content-Type":"application/json"},body:e.reduce((e,{id:t,name:r,type:n,signinUrl:i,callbackUrl:o})=>(e[t]={id:t,name:r,type:n,signinUrl:i,callbackUrl:o},e),{})}),signin(t,s){if(t)throw new ti("Unsupported action");if(o?.signIn){let t=`${o.signIn}${o.signIn.includes("?")?"&":"?"}${new URLSearchParams({callbackUrl:e.callbackUrl??"/"})}`;return s&&(t=`${t}&${new URLSearchParams({error:s})}`),{redirect:t,cookies:i}}let l=a?.find(e=>"webauthn"===e.type&&e.enableConditionalUI&&!!e.simpleWebAuthnBrowserVersion),c="";if(l){let{simpleWebAuthnBrowserVersion:e}=l;c=`<script src="https://unpkg.com/@simplewebauthn/browser@${e}/dist/bundle/index.umd.min.js" crossorigin="anonymous"></script>`}return iV({cookies:i,theme:r,html:function(e){let{csrfToken:t,providers:r=[],callbackUrl:n,theme:i,email:o,error:a}=e;"undefined"!=typeof document&&i?.brandColor&&document.documentElement.style.setProperty("--brand-color",i.brandColor),"undefined"!=typeof document&&i?.buttonText&&document.documentElement.style.setProperty("--button-text-color",i.buttonText);let s=a&&(iJ[a]??iJ.default),l=r.find(e=>"webauthn"===e.type&&e.enableConditionalUI)?.id;return iK("div",{className:"signin",children:[i?.brandColor&&iK("style",{dangerouslySetInnerHTML:{__html:`:root {--brand-color: ${i.brandColor}}`}}),i?.buttonText&&iK("style",{dangerouslySetInnerHTML:{__html:`
        :root {
          --button-text-color: ${i.buttonText}
        }
      `}}),iK("div",{className:"card",children:[s&&iK("div",{className:"error",children:iK("p",{children:s})}),i?.logo&&iK("img",{src:i.logo,alt:"Logo",className:"logo"}),r.map((e,i)=>{let a,s,l;("oauth"===e.type||"oidc"===e.type)&&({bg:a="#fff",brandColor:s,logo:l=`https://authjs.dev/img/providers/${e.id}.svg`}=e.style??{});let c=s??a??"#fff";return iK("div",{className:"provider",children:["oauth"===e.type||"oidc"===e.type?iK("form",{action:e.signinUrl,method:"POST",children:[iK("input",{type:"hidden",name:"csrfToken",value:t}),n&&iK("input",{type:"hidden",name:"callbackUrl",value:n}),iK("button",{type:"submit",className:"button",style:{"--provider-bg":"#fff","--provider-bg-hover":`color-mix(in srgb, ${c} 30%, #fff)`,"--provider-dark-bg":"#161b22","--provider-dark-bg-hover":`color-mix(in srgb, ${c} 30%, #000)`},tabIndex:0,children:[iK("span",{style:{filter:"invert(1) grayscale(1) brightness(1.3) contrast(9000)","mix-blend-mode":"luminosity",opacity:.95},children:["Sign in with ",e.name]}),l&&iK("img",{loading:"lazy",height:24,src:l})]})]}):null,("email"===e.type||"credentials"===e.type||"webauthn"===e.type)&&i>0&&"email"!==r[i-1].type&&"credentials"!==r[i-1].type&&"webauthn"!==r[i-1].type&&iK("hr",{}),"email"===e.type&&iK("form",{action:e.signinUrl,method:"POST",children:[iK("input",{type:"hidden",name:"csrfToken",value:t}),iK("label",{className:"section-header",htmlFor:`input-email-for-${e.id}-provider`,children:"Email"}),iK("input",{id:`input-email-for-${e.id}-provider`,autoFocus:!0,type:"email",name:"email",value:o,placeholder:"email@example.com",required:!0}),iK("button",{id:"submitButton",type:"submit",tabIndex:0,children:["Sign in with ",e.name]})]}),"credentials"===e.type&&iK("form",{action:e.callbackUrl,method:"POST",children:[iK("input",{type:"hidden",name:"csrfToken",value:t}),Object.keys(e.credentials).map(t=>iK("div",{children:[iK("label",{className:"section-header",htmlFor:`input-${t}-for-${e.id}-provider`,children:e.credentials[t].label??t}),iK("input",{name:t,id:`input-${t}-for-${e.id}-provider`,type:e.credentials[t].type??"text",placeholder:e.credentials[t].placeholder??"",...e.credentials[t]})]},`input-group-${e.id}`)),iK("button",{id:"submitButton",type:"submit",tabIndex:0,children:["Sign in with ",e.name]})]}),"webauthn"===e.type&&iK("form",{action:e.callbackUrl,method:"POST",id:`${e.id}-form`,children:[iK("input",{type:"hidden",name:"csrfToken",value:t}),Object.keys(e.formFields).map(t=>iK("div",{children:[iK("label",{className:"section-header",htmlFor:`input-${t}-for-${e.id}-provider`,children:e.formFields[t].label??t}),iK("input",{name:t,"data-form-field":!0,id:`input-${t}-for-${e.id}-provider`,type:e.formFields[t].type??"text",placeholder:e.formFields[t].placeholder??"",...e.formFields[t]})]},`input-group-${e.id}`)),iK("button",{id:`submitButton-${e.id}`,type:"submit",tabIndex:0,children:["Sign in with ",e.name]})]}),("email"===e.type||"credentials"===e.type||"webauthn"===e.type)&&i+1<r.length&&iK("hr",{})]},e.id)})]}),l&&iK(ii,{children:iK("script",{dangerouslySetInnerHTML:{__html:`
const currentURL = window.location.href;
const authURL = currentURL.substring(0, currentURL.lastIndexOf('/'));
(${iq})(authURL, "${l}");
`}})})]})}({csrfToken:e.csrfToken,providers:e.providers?.filter(e=>["email","oauth","oidc"].includes(e.type)||"credentials"===e.type&&e.credentials||"webauthn"===e.type&&e.formFields||!1),callbackUrl:e.callbackUrl,theme:e.theme,error:s,...n}),title:"Sign In",headTags:c})},signout:()=>o?.signOut?{redirect:o.signOut,cookies:i}:iV({cookies:i,theme:r,html:function(e){let{url:t,csrfToken:r,theme:n}=e;return iK("div",{className:"signout",children:[n?.brandColor&&iK("style",{dangerouslySetInnerHTML:{__html:`
        :root {
          --brand-color: ${n.brandColor}
        }
      `}}),n?.buttonText&&iK("style",{dangerouslySetInnerHTML:{__html:`
        :root {
          --button-text-color: ${n.buttonText}
        }
      `}}),iK("div",{className:"card",children:[n?.logo&&iK("img",{src:n.logo,alt:"Logo",className:"logo"}),iK("h1",{children:"Signout"}),iK("p",{children:"Are you sure you want to sign out?"}),iK("form",{action:t?.toString(),method:"POST",children:[iK("input",{type:"hidden",name:"csrfToken",value:r}),iK("button",{id:"submitButton",type:"submit",children:"Sign out"})]})]})]})}({csrfToken:e.csrfToken,url:t,theme:r}),title:"Sign Out"}),verifyRequest:e=>o?.verifyRequest?{redirect:o.verifyRequest,cookies:i}:iV({cookies:i,theme:r,html:function(e){let{url:t,theme:r}=e;return iK("div",{className:"verify-request",children:[r.brandColor&&iK("style",{dangerouslySetInnerHTML:{__html:`
        :root {
          --brand-color: ${r.brandColor}
        }
      `}}),iK("div",{className:"card",children:[r.logo&&iK("img",{src:r.logo,alt:"Logo",className:"logo"}),iK("h1",{children:"Check your email"}),iK("p",{children:"A sign in link has been sent to your email address."}),iK("p",{children:iK("a",{className:"site",href:t.origin,children:t.host})})]})]})}({url:t,theme:r,...e}),title:"Verify Request"}),error:e=>o?.error?{redirect:`${o.error}${o.error.includes("?")?"&":"?"}error=${e}`,cookies:i}:iV({cookies:i,theme:r,...function(e){let{url:t,error:r="default",theme:n}=e,i=`${t}/signin`,o={default:{status:200,heading:"Error",message:iK("p",{children:iK("a",{className:"site",href:t?.origin,children:t?.host})})},Configuration:{status:500,heading:"Server error",message:iK("div",{children:[iK("p",{children:"There is a problem with the server configuration."}),iK("p",{children:"Check the server logs for more information."})]})},AccessDenied:{status:403,heading:"Access Denied",message:iK("div",{children:[iK("p",{children:"You do not have permission to sign in."}),iK("p",{children:iK("a",{className:"button",href:i,children:"Sign in"})})]})},Verification:{status:403,heading:"Unable to sign in",message:iK("div",{children:[iK("p",{children:"The sign in link is no longer valid."}),iK("p",{children:"It may have been used already or it may have expired."})]}),signin:iK("a",{className:"button",href:i,children:"Sign in"})}},{status:a,heading:s,message:l,signin:c}=o[r]??o.default;return{status:a,html:iK("div",{className:"error",children:[n?.brandColor&&iK("style",{dangerouslySetInnerHTML:{__html:`
        :root {
          --brand-color: ${n?.brandColor}
        }
      `}}),iK("div",{className:"card",children:[n?.logo&&iK("img",{src:n?.logo,alt:"Logo",className:"logo"}),iK("h1",{children:s}),iK("div",{className:"message",children:l}),c]})]})}}({url:t,theme:r,error:e}),title:"Error"})}}function iG(e,t=Date.now()){return new Date(t+1e3*e)}async function iX(e,t,r,n){if(!r?.providerAccountId||!r.type)throw Error("Missing or invalid provider account");if(!["email","oauth","oidc","webauthn"].includes(r.type))throw Error("Provider not supported");let{adapter:i,jwt:o,events:a,session:{strategy:s,generateSessionToken:l}}=n;if(!i)return{user:t,account:r};let c=r,{createUser:u,updateUser:d,getUser:p,getUserByAccount:h,getUserByEmail:f,linkAccount:m,createSession:g,getSessionAndUser:y,deleteSession:w}=i,b=null,v=null,_=!1,S="jwt"===s;if(e){if(S)try{let t=n.cookies.sessionToken.name;(b=await o.decode({...o,token:e,salt:t}))&&"sub"in b&&b.sub&&(v=await p(b.sub))}catch{}else{let t=await y(e);t&&(b=t.session,v=t.user)}}if("email"===c.type){let r=await f(t.email);return r?(v?.id!==r.id&&!S&&e&&await w(e),v=await d({id:r.id,emailVerified:new Date}),await a.updateUser?.({user:v})):(v=await u({...t,emailVerified:new Date}),await a.createUser?.({user:v}),_=!0),{session:b=S?{}:await g({sessionToken:l(),userId:v.id,expires:iG(n.session.maxAge)}),user:v,isNewUser:_}}if("webauthn"===c.type){let e=await h({providerAccountId:c.providerAccountId,provider:c.provider});if(e){if(v){if(e.id===v.id){let e={...c,userId:v.id};return{session:b,user:v,isNewUser:_,account:e}}throw new tf("The account is already associated with another user",{provider:c.provider})}b=S?{}:await g({sessionToken:l(),userId:e.id,expires:iG(n.session.maxAge)});let t={...c,userId:e.id};return{session:b,user:e,isNewUser:_,account:t}}{if(v){await m({...c,userId:v.id}),await a.linkAccount?.({user:v,account:c,profile:t});let e={...c,userId:v.id};return{session:b,user:v,isNewUser:_,account:e}}if(t.email?await f(t.email):null)throw new tf("Another account already exists with the same e-mail address",{provider:c.provider});v=await u({...t}),await a.createUser?.({user:v}),await m({...c,userId:v.id}),await a.linkAccount?.({user:v,account:c,profile:t}),b=S?{}:await g({sessionToken:l(),userId:v.id,expires:iG(n.session.maxAge)});let e={...c,userId:v.id};return{session:b,user:v,isNewUser:!0,account:e}}}let E=await h({providerAccountId:c.providerAccountId,provider:c.provider});if(E){if(v){if(E.id===v.id)return{session:b,user:v,isNewUser:_};throw new e8("The account is already associated with another user",{provider:c.provider})}return{session:b=S?{}:await g({sessionToken:l(),userId:E.id,expires:iG(n.session.maxAge)}),user:E,isNewUser:_}}{let{provider:e}=n,{type:r,provider:i,providerAccountId:o,userId:s,...d}=c;if(c=Object.assign(e.account(d)??{},{providerAccountId:o,provider:i,type:r,userId:s}),v)return await m({...c,userId:v.id}),await a.linkAccount?.({user:v,account:c,profile:t}),{session:b,user:v,isNewUser:_};let p=t.email?await f(t.email):null;if(p){let e=n.provider;if(e?.allowDangerousEmailAccountLinking)v=p,_=!1;else throw new e8("Another account already exists with the same e-mail address",{provider:c.provider})}else v=await u({...t,emailVerified:null}),_=!0;return await a.createUser?.({user:v}),await m({...c,userId:v.id}),await a.linkAccount?.({user:v,account:c,profile:t}),{session:b=S?{}:await g({sessionToken:l(),userId:v.id,expires:iG(n.session.maxAge)}),user:v,isNewUser:_}}}function iY(e,t){if(null==e)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch{return!1}}"undefined"!=typeof navigator&&navigator.userAgent?.startsWith?.("Mozilla/5.0 ")||(a="oauth4webapi/v3.1.2");let iZ="ERR_INVALID_ARG_VALUE",iQ="ERR_INVALID_ARG_TYPE";function i0(e,t,r){let n=TypeError(e,{cause:r});return Object.assign(n,{code:t}),n}let i1=Symbol(),i2=Symbol(),i5=Symbol(),i3=Symbol(),i4=Symbol(),i6=Symbol(),i8=Symbol(),i9=new TextEncoder,i7=new TextDecoder;function oe(e){return"string"==typeof e?i9.encode(e):i7.decode(e)}function ot(e){return"string"==typeof e?function(e){try{let t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}catch(e){throw i0("The input to be decoded is not correctly encoded.",iZ,e)}}(e):function(e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));let t=[];for(let r=0;r<e.byteLength;r+=32768)t.push(String.fromCharCode.apply(null,e.subarray(r,r+32768)));return btoa(t.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e)}class or extends Error{code;constructor(e,t){super(e,t),this.name=this.constructor.name,this.code=o7,Error.captureStackTrace?.(this,this.constructor)}}class on extends Error{code;constructor(e,t){super(e,t),this.name=this.constructor.name,t?.code&&(this.code=t?.code),Error.captureStackTrace?.(this,this.constructor)}}function oi(e,t,r){return new on(e,{code:t,cause:r})}function oo(e){return!(null===e||"object"!=typeof e||Array.isArray(e))}function oa(e){iY(e,Headers)&&(e=Object.fromEntries(e.entries()));let t=new Headers(e);if(a&&!t.has("user-agent")&&t.set("user-agent",a),t.has("authorization"))throw i0('"options.headers" must not include the "authorization" header name',iZ);if(t.has("dpop"))throw i0('"options.headers" must not include the "dpop" header name',iZ);return t}function os(e){if("function"==typeof e&&(e=e()),!(e instanceof AbortSignal))throw i0('"options.signal" must return or be an instance of AbortSignal',iQ);return e}async function ol(e,t){if(!(e instanceof URL))throw i0('"issuerIdentifier" must be an instance of URL',iQ);ok(e,t?.[i1]!==!0);let r=new URL(e.href);switch(t?.algorithm){case void 0:case"oidc":r.pathname=`${r.pathname}/.well-known/openid-configuration`.replace("//","/");break;case"oauth2":"/"===r.pathname?r.pathname=".well-known/oauth-authorization-server":r.pathname=`.well-known/oauth-authorization-server/${r.pathname}`.replace("//","/");break;default:throw i0('"options.algorithm" must be "oidc" (default), or "oauth2"',iZ)}let n=oa(t?.headers);return n.set("accept","application/json"),(t?.[i3]||fetch)(r.href,{body:void 0,headers:Object.fromEntries(n.entries()),method:"GET",redirect:"manual",signal:t?.signal?os(t.signal):void 0})}function oc(e,t,r,n,i){try{if("number"!=typeof e||!Number.isFinite(e))throw i0(`${r} must be a number`,iQ,i);if(e>0)return;if(t&&0!==e)throw i0(`${r} must be a non-negative number`,iZ,i);throw i0(`${r} must be a positive number`,iZ,i)}catch(e){if(n)throw oi(e.message,n,i);throw e}}function ou(e,t,r,n){try{if("string"!=typeof e)throw i0(`${t} must be a string`,iQ,n);if(0===e.length)throw i0(`${t} must not be empty`,iZ,n)}catch(e){if(r)throw oi(e.message,r,n);throw e}}async function od(e,t){let r;if(!(e instanceof URL)&&e!==aP)throw i0('"expectedIssuer" must be an instance of URL',iQ);if(!iY(t,Response))throw i0('"response" must be an instance of Response',iQ);if(200!==t.status)throw oi('"response" is not a conform Authorization Server Metadata response',ao,t);af(t),op(t);try{r=await t.json()}catch(e){throw oi('failed to parse "response" body as JSON',ar,e)}if(!oo(r))throw oi('"response" body must be a top level object',an,{body:r});if(ou(r.issuer,'"response" body "issuer" property',an,{body:r}),new URL(r.issuer).href!==e.href&&e!==aP)throw oi('"response" body "issuer" property does not match the expected value',au,{expected:e.href,body:r,attribute:"issuer"});return r}function op(e){!function(e,t){if(oH(e)!==t)throw oh(e,t)}(e,"application/json")}function oh(e,...t){let r='"response" content-type must be ';if(t.length>2){let e=t.pop();r+=`${t.join(", ")}, or ${e}`}else 2===t.length?r+=`${t[0]} or ${t[1]}`:r+=t[0];return oi(r,ai,e)}function of(){return ot(crypto.getRandomValues(new Uint8Array(32)))}async function om(e){return ou(e,"codeVerifier"),ot(await crypto.subtle.digest("SHA-256",oe(e)))}function og(e){let t=e?.[i2];return"number"==typeof t&&Number.isFinite(t)?t:0}function oy(e){let t=e?.[i5];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function ow(){return Math.floor(Date.now()/1e3)}function ob(e){if("object"!=typeof e||null===e)throw i0('"as" must be an object',iQ);ou(e.issuer,'"as.issuer"')}function ov(e){if("object"!=typeof e||null===e)throw i0('"client" must be an object',iQ);ou(e.client_id,'"client.client_id"')}function o_(e,t){let r=ow()+og(t);return{jti:of(),aud:e.issuer,exp:r+60,iat:r,nbf:r,iss:t.client_id,sub:t.client_id}}async function oS(e,t,r){if(!r.usages.includes("sign"))throw i0('CryptoKey instances used for signing assertions must include "sign" in their "usages"',iZ);let n=`${ot(oe(JSON.stringify(e)))}.${ot(oe(JSON.stringify(t)))}`,i=ot(await crypto.subtle.sign(ab(r),r,oe(n)));return`${n}.${i}`}async function oE(e){let{kty:t,e:r,n,x:i,y:o,crv:a}=await crypto.subtle.exportKey("jwk",e),l={kty:t,e:r,n,x:i,y:o,crv:a};return s.set(e,l),l}let oA=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch{return null}};function ok(e,t){if(t&&"https:"!==e.protocol)throw oi("only requests to HTTPS are allowed",aa,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw oi("only HTTP and HTTPS requests are allowed",as,e)}function ox(e,t,r,n){let i;if("string"!=typeof e||!(i=oA(e)))throw oi(`authorization server metadata does not contain a valid ${r?`"as.mtls_endpoint_aliases.${t}"`:`"as.${t}"`}`,void 0===e?ap:ah,{attribute:r?`mtls_endpoint_aliases.${t}`:t});return ok(i,n),i}function oT(e,t,r,n){return r&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?ox(e.mtls_endpoint_aliases[t],t,r,n):ox(e[t],t,r,n)}class oR extends Error{cause;code;error;status;error_description;response;constructor(e,t){super(e,t),this.name=this.constructor.name,this.code=o9,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),Error.captureStackTrace?.(this,this.constructor)}}class oP extends Error{cause;code;error;error_description;constructor(e,t){super(e,t),this.name=this.constructor.name,this.code=ae,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=t.cause.get("error_description")??void 0,Error.captureStackTrace?.(this,this.constructor)}}class oO extends Error{cause;code;response;status;constructor(e,t){super(e,t),this.name=this.constructor.name,this.code=o8,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),Error.captureStackTrace?.(this,this.constructor)}}let oC=/((?:,|, )?[0-9a-zA-Z!#$%&'*+-.^_`|~]+=)/,oI=/(?:^|, ?)([0-9a-zA-Z!#$%&'*+\-.^_`|~]+)(?=$|[ ,])/g;function oN(e){if(!iY(e,Response))throw i0('"response" must be an instance of Response',iQ);let t=e.headers.get("www-authenticate");if(null===t)return;let r=[];for(let{1:e,index:n}of t.matchAll(oI))r.push([e,n]);if(r.length)return r.map(([e,r],n,i)=>{let o=i[n+1];return function(e,t){let r=t.split(oC).slice(1);if(!r.length)return{scheme:e.toLowerCase(),parameters:{}};r[r.length-1]=r[r.length-1].replace(/,$/,"");let n={};for(let e=1;e<r.length;e+=2){var i;let t=e;if('"'===r[t][0])for(;'"'!==r[t].slice(-1)&&++e<r.length;)r[t]+=r[e];n[r[t-1].replace(/^(?:, ?)|=$/g,"").toLowerCase()]=(i=r[t]).length>=2&&'"'===i[0]&&'"'===i[i.length-1]?i.slice(1,-1):i}return{scheme:e.toLowerCase(),parameters:n}}(e,o?t.slice(r,o[1]):t.slice(r))})}function oU(e){if(!oZ.has(e))throw i0('"options.DPoP" is not a valid DPoPHandle',iZ)}async function oj(e,t,r,n,i,o){if(ou(e,'"accessToken"'),!(r instanceof URL))throw i0('"url" must be an instance of URL',iQ);ok(r,o?.[i1]!==!0),n=oa(n),o?.DPoP?(oU(o.DPoP),await o.DPoP.addProof(r,n,t.toUpperCase(),e),n.set("authorization",`DPoP ${e}`)):n.set("authorization",`Bearer ${e}`);let a=await (o?.[i3]||fetch)(r.href,{body:i,headers:Object.fromEntries(n.entries()),method:t,redirect:"manual",signal:o?.signal?os(o.signal):void 0});return o?.DPoP?.cacheNonce(a),a}async function oL(e,t,r,n){ob(e),ov(t);let i=oT(e,"userinfo_endpoint",t.use_mtls_endpoint_aliases,n?.[i1]!==!0),o=oa(n?.headers);return t.userinfo_signed_response_alg?o.set("accept","application/jwt"):(o.set("accept","application/json"),o.append("accept","application/jwt")),oj(r,"GET",i,o,null,{...n,[i2]:og(t)})}function oD(e,t,r,n){(l||=new WeakMap).set(e,{jwks:t,uat:r,get age(){return ow()-this.uat}}),n&&Object.assign(n,{jwks:structuredClone(t),uat:r})}function oM(e,t){l?.delete(e),delete t?.jwks,delete t?.uat}let o$=Symbol();function oH(e){return e.headers.get("content-type")?.split(";")[0]}async function oW(e,t,r,n,i){let o,a;if(ob(e),ov(t),!iY(n,Response))throw i0('"response" must be an instance of Response',iQ);if(o=oN(n))throw new oO("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:o,response:n});if(200!==n.status)throw oi('"response" is not a conform UserInfo Endpoint response',ao,n);if(af(n),"application/jwt"===oH(n)){let{claims:r,jwt:o}=await av(await n.text(),aE.bind(void 0,t.userinfo_signed_response_alg,e.userinfo_signing_alg_values_supported,void 0),og(t),oy(t),i?.[i6]).then(oz.bind(void 0,t.client_id)).then(oX.bind(void 0,e));oJ.set(n,o),a=r}else{if(t.userinfo_signed_response_alg)throw oi("JWT UserInfo Response expected",at,n);op(n);try{a=await n.json()}catch(e){throw oi('failed to parse "response" body as JSON',ar,e)}}if(!oo(a))throw oi('"response" body must be a top level object',an,{body:a});if(ou(a.sub,'"response" body "sub" property',an,{body:a}),r===o$);else if(ou(r,'"expectedSubject"'),a.sub!==r)throw oi('unexpected "response" body "sub" property value',au,{expected:r,body:a,attribute:"sub"});return a}async function oB(e,t,r,n,i,o,a){return await r(e,t,i,o),o.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),(a?.[i3]||fetch)(n.href,{body:i,headers:Object.fromEntries(o.entries()),method:"POST",redirect:"manual",signal:a?.signal?os(a.signal):void 0})}async function oK(e,t,r,n,i,o){let a=oT(e,"token_endpoint",t.use_mtls_endpoint_aliases,o?.[i1]!==!0);i.set("grant_type",n);let s=oa(o?.headers);s.set("accept","application/json"),o?.DPoP!==void 0&&(oU(o.DPoP),await o.DPoP.addProof(a,s,"POST"));let l=await oB(e,t,r,a,i,s,o);return o?.DPoP?.cacheNonce(l),l}let oq=new WeakMap,oJ=new WeakMap;function oF(e){if(!e.id_token)return;let t=oq.get(e);if(!t)throw i0('"ref" was already garbage collected or did not resolve from the proper sources',iZ);return t}async function oV(e,t,r,n,i){let o,a;if(ob(e),ov(t),!iY(r,Response))throw i0('"response" must be an instance of Response',iQ);if(o=oN(r))throw new oO("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:o,response:r});if(200!==r.status){let e;if(e=await ay(r))throw await r.body?.cancel(),new oR("server responded with an error in the response body",{cause:e,response:r});throw oi('"response" is not a conform Token Endpoint response',ao,r)}af(r),op(r);try{a=await r.json()}catch(e){throw oi('failed to parse "response" body as JSON',ar,e)}if(!oo(a))throw oi('"response" body must be a top level object',an,{body:a});if(ou(a.access_token,'"response" body "access_token" property',an,{body:a}),ou(a.token_type,'"response" body "token_type" property',an,{body:a}),a.token_type=a.token_type.toLowerCase(),"dpop"!==a.token_type&&"bearer"!==a.token_type)throw new or("unsupported `token_type` value",{cause:{body:a}});if(void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;oc(e,!1,'"response" body "expires_in" property',an,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&ou(a.refresh_token,'"response" body "refresh_token" property',an,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw oi('"response" body "scope" property must be a string',an,{body:a});if(void 0!==a.id_token){ou(a.id_token,'"response" body "id_token" property',an,{body:a});let o=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&o.push("auth_time"),void 0!==t.default_max_age&&(oc(t.default_max_age,!1,'"client.default_max_age"'),o.push("auth_time")),n?.length&&o.push(...n);let{claims:s,jwt:l}=await av(a.id_token,aE.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),og(t),oy(t),i?.[i6]).then(o1.bind(void 0,o)).then(oY.bind(void 0,e)).then(oG.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw oi('ID Token "aud" (audience) claim includes additional untrusted audiences',ac,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw oi('unexpected ID Token "azp" (authorized party) claim value',ac,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&oc(s.auth_time,!1,'ID Token "auth_time" (authentication time)',an,{claims:s}),oJ.set(r,l),oq.set(a,s)}return a}function oz(e,t){return void 0!==t.claims.aud?oG(e,t):t}function oG(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw oi('unexpected JWT "aud" (audience) claim value',ac,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw oi('unexpected JWT "aud" (audience) claim value',ac,{expected:e,claims:t.claims,claim:"aud"});return t}function oX(e,t){return void 0!==t.claims.iss?oY(e,t):t}function oY(e,t){let r=e[aO]?.(t)??e.issuer;if(t.claims.iss!==r)throw oi('unexpected JWT "iss" (issuer) claim value',ac,{expected:r,claims:t.claims,claim:"iss"});return t}let oZ=new WeakSet;async function oQ(e,t,r,n,i,o,a){if(ob(e),ov(t),!oZ.has(n))throw i0('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',iZ);ou(i,'"redirectUri"');let s=aA(n,"code");if(!s)throw oi('no authorization code in "callbackParameters"',an);let l=new URLSearchParams(a?.additionalParameters);return l.set("redirect_uri",i),l.set("code",s),o!==aR&&(ou(o,'"codeVerifier"'),l.set("code_verifier",o)),oK(e,t,r,"authorization_code",l,a)}let o0={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function o1(e,t){for(let r of e)if(void 0===t.claims[r])throw oi(`JWT "${r}" (${o0[r]}) claim missing`,an,{claims:t.claims});return t}let o2=Symbol(),o5=Symbol();async function o3(e,t,r,n){return"string"==typeof n?.expectedNonce||"number"==typeof n?.maxAge||n?.requireIdToken?o4(e,t,r,n.expectedNonce,n.maxAge,{[i6]:n[i6]}):o6(e,t,r,n)}async function o4(e,t,r,n,i,o){let a=[];switch(n){case void 0:n=o2;break;case o2:break;default:ou(n,'"expectedNonce" argument'),a.push("nonce")}switch(i??=t.default_max_age){case void 0:i=o5;break;case o5:break;default:oc(i,!1,'"maxAge" argument'),a.push("auth_time")}let s=await oV(e,t,r,a,o);ou(s.id_token,'"response" body "id_token" property',an,{body:s});let l=oF(s);if(i!==o5){let e=ow()+og(t),r=oy(t);if(l.auth_time+i<e-r)throw oi("too much time has elapsed since the last End-User authentication",al,{claims:l,now:e,tolerance:r,claim:"auth_time"})}if(n===o2){if(void 0!==l.nonce)throw oi('unexpected ID Token "nonce" claim value',ac,{expected:void 0,claims:l,claim:"nonce"})}else if(l.nonce!==n)throw oi('unexpected ID Token "nonce" claim value',ac,{expected:n,claims:l,claim:"nonce"});return s}async function o6(e,t,r,n){let i=await oV(e,t,r,void 0,n),o=oF(i);if(o){if(void 0!==t.default_max_age){oc(t.default_max_age,!1,'"client.default_max_age"');let e=ow()+og(t),r=oy(t);if(o.auth_time+t.default_max_age<e-r)throw oi("too much time has elapsed since the last End-User authentication",al,{claims:o,now:e,tolerance:r,claim:"auth_time"})}if(void 0!==o.nonce)throw oi('unexpected ID Token "nonce" claim value',ac,{expected:void 0,claims:o,claim:"nonce"})}return i}let o8="OAUTH_WWW_AUTHENTICATE_CHALLENGE",o9="OAUTH_RESPONSE_BODY_ERROR",o7="OAUTH_UNSUPPORTED_OPERATION",ae="OAUTH_AUTHORIZATION_RESPONSE_ERROR",at="OAUTH_JWT_USERINFO_EXPECTED",ar="OAUTH_PARSE_ERROR",an="OAUTH_INVALID_RESPONSE",ai="OAUTH_RESPONSE_IS_NOT_JSON",ao="OAUTH_RESPONSE_IS_NOT_CONFORM",aa="OAUTH_HTTP_REQUEST_FORBIDDEN",as="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",al="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",ac="OAUTH_JWT_CLAIM_COMPARISON_FAILED",au="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",ad="OAUTH_KEY_SELECTION_FAILED",ap="OAUTH_MISSING_SERVER_METADATA",ah="OAUTH_INVALID_SERVER_METADATA";function af(e){if(e.bodyUsed)throw i0('"response" body has been used already',iZ)}async function am(e,t){ob(e);let r=oT(e,"jwks_uri",!1,t?.[i1]!==!0),n=oa(t?.headers);return n.set("accept","application/json"),n.append("accept","application/jwk-set+json"),(t?.[i3]||fetch)(r.href,{body:void 0,headers:Object.fromEntries(n.entries()),method:"GET",redirect:"manual",signal:t?.signal?os(t.signal):void 0})}async function ag(e){let t;if(!iY(e,Response))throw i0('"response" must be an instance of Response',iQ);if(200!==e.status)throw oi('"response" is not a conform JSON Web Key Set response',ao,e);af(e),function(e,...t){if(!t.includes(oH(e)))throw oh(e,...t)}(e,"application/json","application/jwk-set+json");try{t=await e.json()}catch(e){throw oi('failed to parse "response" body as JSON',ar,e)}if(!oo(t))throw oi('"response" body must be a top level object',an,{body:t});if(!Array.isArray(t.keys))throw oi('"response" body "keys" property must be an array',an,{body:t});if(!Array.prototype.every.call(t.keys,oo))throw oi('"response" body "keys" property members must be JWK formatted objects',an,{body:t});return t}async function ay(e){if(e.status>399&&e.status<500){af(e),op(e);try{let t=await e.clone().json();if(oo(t)&&"string"==typeof t.error&&t.error.length)return t}catch{}}}function aw(e){let{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new or(`unsupported ${t.name} modulusLength`,{cause:e})}function ab(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:function(e){let{algorithm:t}=e;switch(t.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new or("unsupported ECDSA namedCurve",{cause:e})}}(e)};case"RSA-PSS":switch(aw(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new or("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return aw(e),e.algorithm.name;case"Ed25519":case"EdDSA":return e.algorithm.name}throw new or("unsupported CryptoKey algorithm name",{cause:e})}async function av(e,t,r,n,i){let o,a,{0:s,1:l,length:c}=e.split(".");if(5===c){if(void 0!==i)e=await i(e),{0:s,1:l,length:c}=e.split(".");else throw new or("JWE decryption is not configured",{cause:e})}if(3!==c)throw oi("Invalid JWT",an,e);try{o=JSON.parse(oe(ot(s)))}catch(e){throw oi("failed to parse JWT Header body as base64url encoded JSON",ar,e)}if(!oo(o))throw oi("JWT Header must be a top level object",an,e);if(t(o),void 0!==o.crit)throw new or('no JWT "crit" header parameter extensions are supported',{cause:{header:o}});try{a=JSON.parse(oe(ot(l)))}catch(e){throw oi("failed to parse JWT Payload body as base64url encoded JSON",ar,e)}if(!oo(a))throw oi("JWT Payload must be a top level object",an,e);let u=ow()+r;if(void 0!==a.exp){if("number"!=typeof a.exp)throw oi('unexpected JWT "exp" (expiration time) claim type',an,{claims:a});if(a.exp<=u-n)throw oi('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',al,{claims:a,now:u,tolerance:n,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw oi('unexpected JWT "iat" (issued at) claim type',an,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw oi('unexpected JWT "iss" (issuer) claim type',an,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw oi('unexpected JWT "nbf" (not before) claim type',an,{claims:a});if(a.nbf>u+n)throw oi('unexpected JWT "nbf" (not before) claim value',al,{claims:a,now:u,tolerance:n,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw oi('unexpected JWT "aud" (audience) claim type',an,{claims:a});return{header:o,claims:a,jwt:e}}async function a_(e,t,r){let n;switch(t.alg){case"RS256":case"PS256":case"ES256":n="SHA-256";break;case"RS384":case"PS384":case"ES384":n="SHA-384";break;case"RS512":case"PS512":case"ES512":case"Ed25519":case"EdDSA":n="SHA-512";break;default:throw new or(`unsupported JWS algorithm for ${r} calculation`,{cause:{alg:t.alg}})}let i=await crypto.subtle.digest(n,oe(e));return ot(i.slice(0,i.byteLength/2))}async function aS(e){if(e.bodyUsed)throw i0("form_post Request instances must contain a readable body",iZ,{cause:e});return e.text()}function aE(e,t,r,n){if(void 0!==e){if("string"==typeof e?n.alg!==e:!e.includes(n.alg))throw oi('unexpected JWT "alg" header parameter',an,{header:n,expected:e,reason:"client configuration"});return}if(Array.isArray(t)){if(!t.includes(n.alg))throw oi('unexpected JWT "alg" header parameter',an,{header:n,expected:t,reason:"authorization server metadata"});return}if(void 0!==r){if("string"==typeof r?n.alg!==r:"function"==typeof r?!r(n.alg):!r.includes(n.alg))throw oi('unexpected JWT "alg" header parameter',an,{header:n,expected:r,reason:"default value"});return}throw oi('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:r})}function aA(e,t){let{0:r,length:n}=e.getAll(t);if(n>1)throw oi(`"${t}" parameter must be provided only once`,an);return r}let ak=Symbol(),ax=Symbol();async function aT(e,t){let{ext:r,key_ops:n,use:i,...o}=t;return crypto.subtle.importKey("jwk",o,function(e){switch(e){case"PS256":case"PS384":case"PS512":return{name:"RSA-PSS",hash:`SHA-${e.slice(-3)}`};case"RS256":case"RS384":case"RS512":return{name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.slice(-3)}`};case"ES256":case"ES384":return{name:"ECDSA",namedCurve:`P-${e.slice(-3)}`};case"ES512":return{name:"ECDSA",namedCurve:"P-521"};case"Ed25519":case"EdDSA":return"Ed25519";default:throw new or("unsupported JWS algorithm",{cause:{alg:e}})}}(e),!0,["verify"])}let aR=Symbol(),aP=Symbol(),aO=Symbol();async function aC(e,t,r){let{cookies:n,logger:i}=r,o=n[e],a=new Date;a.setTime(a.getTime()+9e5),i.debug(`CREATE_${e.toUpperCase()}`,{name:o.name,payload:t,COOKIE_TTL:900,expires:a});let s=await nu({...r.jwt,maxAge:900,token:{value:t},salt:o.name}),l={...o.options,expires:a};return{name:o.name,value:s,options:l}}async function aI(e,t,r){try{let{logger:n,cookies:i,jwt:o}=r;if(n.debug(`PARSE_${e.toUpperCase()}`,{cookie:t}),!t)throw new e1(`${e} cookie was missing`);let a=await nd({...o,token:t,salt:i[e].name});if(a?.value)return a.value;throw Error("Invalid cookie")}catch(t){throw new e1(`${e} value could not be parsed`,{cause:t})}}function aN(e,t,r){let{logger:n,cookies:i}=t,o=i[e];n.debug(`CLEAR_${e.toUpperCase()}`,{cookie:o}),r.push({name:o.name,value:"",options:{...i[e].options,maxAge:0}})}function aU(e,t){return async function(r,n,i){let{provider:o,logger:a}=i;if(!o?.checks?.includes(e))return;let s=r?.[i.cookies[t].name];a.debug(`USE_${t.toUpperCase()}`,{value:s});let l=await aI(t,s,i);return aN(t,i,n),l}}let aj={async create(e){let t=of(),r=await om(t);return{cookie:await aC("pkceCodeVerifier",t,e),value:r}},use:aU("pkce","pkceCodeVerifier")},aL="encodedState",aD={async create(e,t){let{provider:r}=e;if(!r.checks.includes("state")){if(t)throw new e1("State data was provided but the provider is not configured to use state");return}let n={origin:t,random:of()},i=await nu({secret:e.jwt.secret,token:n,salt:aL,maxAge:900});return{cookie:await aC("state",i,e),value:i}},use:aU("state","state"),async decode(e,t){try{t.logger.debug("DECODE_STATE",{state:e});let r=await nd({secret:t.jwt.secret,token:e,salt:aL});if(r)return r;throw Error("Invalid state")}catch(e){throw new e1("State could not be decoded",{cause:e})}}},aM={async create(e){if(!e.provider.checks.includes("nonce"))return;let t=of();return{cookie:await aC("nonce",t,e),value:t}},use:aU("nonce","nonce")},a$="encodedWebauthnChallenge",aH={create:async(e,t,r)=>({cookie:await aC("webauthnChallenge",await nu({secret:e.jwt.secret,token:{challenge:t,registerData:r},salt:a$,maxAge:900}),e)}),async use(e,t,r){let n=t?.[e.cookies.webauthnChallenge.name],i=await aI("webauthnChallenge",n,e),o=await nd({secret:e.jwt.secret,token:i,salt:a$});if(aN("webauthnChallenge",e,r),!o)throw new e1("WebAuthn challenge was missing");return o}};function aW(e){return encodeURIComponent(e).replace(/%20/g,"+")}async function aB(e,t,r){let n,i,o;let{logger:a,provider:s}=r,{token:l,userinfo:c}=s;if(l?.url&&"authjs.dev"!==l.url.host||c?.url&&"authjs.dev"!==c.url.host)n={issuer:s.issuer??"https://authjs.dev",token_endpoint:l?.url.toString(),userinfo_endpoint:c?.url.toString()};else{let e=new URL(s.issuer),t=await ol(e,{[i1]:!0,[i3]:s[nO]});if(!(n=await od(e,t)).token_endpoint)throw TypeError("TODO: Authorization server did not provide a token endpoint.");if(!n.userinfo_endpoint)throw TypeError("TODO: Authorization server did not provide a userinfo endpoint.")}let u={client_id:s.clientId,...s.client};switch(u.token_endpoint_auth_method){case void 0:case"client_secret_basic":i=(e,t,r,n)=>{n.set("authorization",function(e,t){let r=aW(e),n=aW(t),i=btoa(`${r}:${n}`);return`Basic ${i}`}(s.clientId,s.clientSecret))};break;case"client_secret_post":var d;ou(d=s.clientSecret,'"clientSecret"'),i=(e,t,r,n)=>{r.set("client_id",t.client_id),r.set("client_secret",d)};break;case"client_secret_jwt":i=function(e,t){let r;ou(e,'"clientSecret"');let n=void 0;return async(t,i,o,a)=>{r||=await crypto.subtle.importKey("raw",oe(e),{hash:"SHA-256",name:"HMAC"},!1,["sign"]);let s={alg:"HS256"},l=o_(t,i);n?.(s,l);let c=`${ot(oe(JSON.stringify(s)))}.${ot(oe(JSON.stringify(l)))}`,u=await crypto.subtle.sign(r.algorithm,r,oe(c));o.set("client_id",i.client_id),o.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),o.set("client_assertion",`${c}.${ot(new Uint8Array(u))}`)}}(s.clientSecret);break;case"private_key_jwt":i=function(e,t){let{key:r,kid:n}=e instanceof CryptoKey?{key:e}:e?.key instanceof CryptoKey?(void 0!==e.kid&&ou(e.kid,'"kid"'),{key:e.key,kid:e.kid}):{};return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw i0(`${t} must be a CryptoKey`,iQ)}(e,t),"private"!==e.type)throw i0(`${t} must be a private CryptoKey`,iZ)}(r,'"clientPrivateKey.key"'),async(e,i,o,a)=>{let s={alg:function(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new or("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new or("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new or("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"EdDSA":return"Ed25519";default:throw new or("unsupported CryptoKey algorithm name",{cause:e})}}(r),kid:n},l=o_(e,i);t?.[i4]?.(s,l),o.set("client_id",i.client_id),o.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),o.set("client_assertion",await oS(s,l,r))}}(s.token.clientPrivateKey,{[i4](e,t){t.aud=[n.issuer,n.token_endpoint]}});break;case"none":i=(e,t,r,n)=>{r.set("client_id",t.client_id)};break;default:throw Error("unsupported client authentication method")}let p=[],h=await aD.use(t,p,r);try{o=function(e,t,r,n){var i;if(ob(e),ov(t),r instanceof URL&&(r=r.searchParams),!(r instanceof URLSearchParams))throw i0('"parameters" must be an instance of URLSearchParams, or URL',iQ);if(aA(r,"response"))throw oi('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',an,{parameters:r});let o=aA(r,"iss"),a=aA(r,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw oi('response parameter "iss" (issuer) missing',an,{parameters:r});if(o&&o!==e.issuer)throw oi('unexpected "iss" (issuer) response parameter value',an,{expected:e.issuer,parameters:r});switch(n){case void 0:case ax:if(void 0!==a)throw oi('unexpected "state" response parameter encountered',an,{expected:void 0,parameters:r});break;case ak:break;default:if(ou(n,'"expectedState" argument'),a!==n)throw oi(void 0===a?'response parameter "state" missing':'unexpected "state" response parameter value',an,{expected:n,parameters:r})}if(aA(r,"error"))throw new oP("authorization response from the server is an error",{cause:r});let s=aA(r,"id_token"),l=aA(r,"token");if(void 0!==s||void 0!==l)throw new or("implicit and hybrid flows are not supported");return i=new URLSearchParams(r),oZ.add(i),i}(n,u,new URLSearchParams(e),s.checks.includes("state")?h:ak)}catch(e){if(e instanceof oP){let t={providerId:s.id,...Object.fromEntries(e.cause.entries())};throw a.debug("OAuthCallbackError",t),new e9("OAuth Provider returned an error",t)}throw e}let f=await aj.use(t,p,r),m=s.callbackUrl;!r.isOnRedirectProxy&&s.redirectProxyUrl&&(m=s.redirectProxyUrl);let g=await oQ(n,u,i,o,m,f??"decoy",{[i1]:!0,[i3]:(...e)=>(s.checks.includes("pkce")||e[1].body.delete("code_verifier"),(s[nO]??fetch)(...e))});s.token?.conform&&(g=await s.token.conform(g.clone())??g);let y={},w="oidc"===s.type;if(s[nC])switch(s.id){case"microsoft-entra-id":case"azure-ad":{let{tid:e}=function(e){let t,r;if("string"!=typeof e)throw new tY("JWTs must use Compact JWS serialization, JWT must be a string");let{1:n,length:i}=e.split(".");if(5===i)throw new tY("Only JWTs using Compact JWS serialization can be decoded");if(3!==i)throw new tY("Invalid JWT");if(!n)throw new tY("JWTs must contain a payload");try{t=tB(n)}catch{throw new tY("Failed to base64url decode the payload")}try{r=JSON.parse(tI.decode(t))}catch{throw new tY("Failed to parse the decoded payload as JSON")}if(!t3(r))throw new tY("Invalid JWT Claims Set");return r}((await g.clone().json()).id_token);if("string"==typeof e){let t=n.issuer?.match(/microsoftonline\.com\/(\w+)\/v2\.0/)?.[1]??"common",r=new URL(n.issuer.replace(t,e)),i=await ol(r,{[i3]:s[nO]});n=await od(r,i)}}}let b=await o3(n,u,g,{expectedNonce:await aM.use(t,p,r),requireIdToken:w});if(w){let t=oF(b);if(y=t,s[nC]&&"apple"===s.id)try{y.user=JSON.parse(e?.user)}catch{}if(!1===s.idToken){let e=await oL(n,u,b.access_token,{[i3]:s[nO],[i1]:!0});y=await oW(n,u,t.sub,e)}}else if(c?.request){let e=await c.request({tokens:b,provider:s});e instanceof Object&&(y=e)}else if(c?.url){let e=await oL(n,u,b.access_token,{[i3]:s[nO]});y=await e.json()}else throw TypeError("No userinfo endpoint configured");return b.expires_in&&(b.expires_at=Math.floor(Date.now()/1e3)+Number(b.expires_in)),{...await aK(y,s,b,a),profile:y,cookies:p}}async function aK(e,t,r,n){try{let n=await t.profile(e,r);return{user:{...n,id:crypto.randomUUID(),email:n.email?.toLowerCase()},account:{...r,provider:t.id,type:t.type,providerAccountId:n.id??crypto.randomUUID()}}}catch(r){n.debug("getProfile error details",e),n.error(new e7(r,{provider:t.id}))}}var aq=r(195).Buffer;async function aJ(e,t,r,n){let i=await aX(e,t,r),{cookie:o}=await aH.create(e,i.challenge,r);return{status:200,cookies:[...n??[],o],body:{action:"register",options:i},headers:{"Content-Type":"application/json"}}}async function aF(e,t,r,n){let i=await aG(e,t,r),{cookie:o}=await aH.create(e,i.challenge);return{status:200,cookies:[...n??[],o],body:{action:"authenticate",options:i},headers:{"Content-Type":"application/json"}}}async function aV(e,t,r){let n;let{adapter:i,provider:o}=e,a=t.body&&"string"==typeof t.body.data?JSON.parse(t.body.data):void 0;if(!a||"object"!=typeof a||!("id"in a)||"string"!=typeof a.id)throw new eJ("Invalid WebAuthn Authentication response");let s=aQ(aZ(a.id)),l=await i.getAuthenticator(s);if(!l)throw new eJ(`WebAuthn authenticator not found in database: ${JSON.stringify({credentialID:s})}`);let{challenge:c}=await aH.use(e,t.cookies,r);try{let r=o.getRelayingParty(e,t);n=await o.simpleWebAuthn.verifyAuthenticationResponse({...o.verifyAuthenticationOptions,expectedChallenge:c,response:a,authenticator:{...l,credentialDeviceType:l.credentialDeviceType,transports:a0(l.transports),credentialID:aZ(l.credentialID),credentialPublicKey:aZ(l.credentialPublicKey)},expectedOrigin:r.origin,expectedRPID:r.id})}catch(e){throw new th(e)}let{verified:u,authenticationInfo:d}=n;if(!u)throw new th("WebAuthn authentication response could not be verified");try{let{newCounter:e}=d;await i.updateAuthenticatorCounter(l.credentialID,e)}catch(e){throw new eV(`Failed to update authenticator counter. This may cause future authentication attempts to fail. ${JSON.stringify({credentialID:s,oldCounter:l.counter,newCounter:d.newCounter})}`,e)}let p=await i.getAccount(l.providerAccountId,o.id);if(!p)throw new eJ(`WebAuthn account not found in database: ${JSON.stringify({credentialID:s,providerAccountId:l.providerAccountId})}`);let h=await i.getUser(p.userId);if(!h)throw new eJ(`WebAuthn user not found in database: ${JSON.stringify({credentialID:s,providerAccountId:l.providerAccountId,userID:p.userId})}`);return{account:p,user:h}}async function az(e,t,r){var n;let i;let{provider:o}=e,a=t.body&&"string"==typeof t.body.data?JSON.parse(t.body.data):void 0;if(!a||"object"!=typeof a||!("id"in a)||"string"!=typeof a.id)throw new eJ("Invalid WebAuthn Registration response");let{challenge:s,registerData:l}=await aH.use(e,t.cookies,r);if(!l)throw new eJ("Missing user registration data in WebAuthn challenge cookie");try{let r=o.getRelayingParty(e,t);i=await o.simpleWebAuthn.verifyRegistrationResponse({...o.verifyRegistrationOptions,expectedChallenge:s,response:a,expectedOrigin:r.origin,expectedRPID:r.id})}catch(e){throw new th(e)}if(!i.verified||!i.registrationInfo)throw new th("WebAuthn registration response could not be verified");let c={providerAccountId:aQ(i.registrationInfo.credentialID),provider:e.provider.id,type:o.type},u={providerAccountId:c.providerAccountId,counter:i.registrationInfo.counter,credentialID:aQ(i.registrationInfo.credentialID),credentialPublicKey:aQ(i.registrationInfo.credentialPublicKey),credentialBackedUp:i.registrationInfo.credentialBackedUp,credentialDeviceType:i.registrationInfo.credentialDeviceType,transports:(n=a.response.transports,n?.join(","))};return{user:l,account:c,authenticator:u}}async function aG(e,t,r){let{provider:n,adapter:i}=e,o=r&&r.id?await i.listAuthenticatorsByUserId(r.id):null,a=n.getRelayingParty(e,t);return await n.simpleWebAuthn.generateAuthenticationOptions({...n.authenticationOptions,rpID:a.id,allowCredentials:o?.map(e=>({id:aZ(e.credentialID),type:"public-key",transports:a0(e.transports)}))})}async function aX(e,t,r){let{provider:n,adapter:i}=e,o=r.id?await i.listAuthenticatorsByUserId(r.id):null,a=nE(32),s=n.getRelayingParty(e,t);return await n.simpleWebAuthn.generateRegistrationOptions({...n.registrationOptions,userID:a,userName:r.email,userDisplayName:r.name??void 0,rpID:s.id,rpName:s.name,excludeCredentials:o?.map(e=>({id:aZ(e.credentialID),type:"public-key",transports:a0(e.transports)}))})}function aY(e){let{provider:t,adapter:r}=e;if(!r)throw new e5("An adapter is required for the WebAuthn provider");if(!t||"webauthn"!==t.type)throw new ta("Provider must be WebAuthn");return{...e,provider:t,adapter:r}}function aZ(e){return new Uint8Array(aq.from(e,"base64"))}function aQ(e){return aq.from(e).toString("base64")}function a0(e){return e?e.split(","):void 0}async function a1(e,t,r,n){if(!t.provider)throw new ta("Callback route called without provider");let{query:i,body:o,method:a,headers:s}=e,{provider:l,adapter:c,url:u,callbackUrl:d,pages:p,jwt:h,events:f,callbacks:m,session:{strategy:g,maxAge:y},logger:w}=t,b="jwt"===g;try{if("oauth"===l.type||"oidc"===l.type){let a;let s=l.authorization?.url.searchParams.get("response_mode")==="form_post"?o:i;if(t.isOnRedirectProxy&&s?.state){let e=await aD.decode(s.state,t);if(e?.origin&&new URL(e.origin).origin!==t.url.origin){let t=`${e.origin}?${new URLSearchParams(s)}`;return w.debug("Proxy redirecting to",t),{redirect:t,cookies:n}}}let g=await aB(s,e.cookies,t);g.cookies.length&&n.push(...g.cookies),w.debug("authorization result",g);let{user:v,account:_,profile:S}=g;if(!v||!_||!S)return{redirect:`${u}/signin`,cookies:n};if(c){let{getUserByAccount:e}=c;a=await e({providerAccountId:_.providerAccountId,provider:l.id})}let E=await a2({user:a??v,account:_,profile:S},t);if(E)return{redirect:E,cookies:n};let{user:A,session:k,isNewUser:x}=await iX(r.value,v,_,t);if(b){let e={name:A.name,email:A.email,picture:A.image,sub:A.id?.toString()},i=await m.jwt({token:e,user:A,account:_,profile:S,isNewUser:x,trigger:x?"signUp":"signIn"});if(null===i)n.push(...r.clean());else{let e=t.cookies.sessionToken.name,o=await h.encode({...h,token:i,salt:e}),a=new Date;a.setTime(a.getTime()+1e3*y);let s=r.chunk(o,{expires:a});n.push(...s)}}else n.push({name:t.cookies.sessionToken.name,value:k.sessionToken,options:{...t.cookies.sessionToken.options,expires:k.expires}});if(await f.signIn?.({user:A,account:_,profile:S,isNewUser:x}),x&&p.newUser)return{redirect:`${p.newUser}${p.newUser.includes("?")?"&":"?"}${new URLSearchParams({callbackUrl:d})}`,cookies:n};return{redirect:d,cookies:n}}if("email"===l.type){let e=i?.token,o=i?.email;if(!e){let t=TypeError("Missing token. The sign-in URL was manually opened without token or the link was not sent correctly in the email.",{cause:{hasToken:!!e}});throw t.name="Configuration",t}let a=l.secret??t.secret,s=await c.useVerificationToken({identifier:o,token:await nS(`${e}${a}`)}),u=!!s,g=u&&s.expires.valueOf()<Date.now();if(!u||g||o&&s.identifier!==o)throw new tl({hasInvite:u,expired:g});let{identifier:w}=s,v=await c.getUserByEmail(w)??{id:crypto.randomUUID(),email:w,emailVerified:null},_={providerAccountId:v.email,userId:v.id,type:"email",provider:l.id},S=await a2({user:v,account:_},t);if(S)return{redirect:S,cookies:n};let{user:E,session:A,isNewUser:k}=await iX(r.value,v,_,t);if(b){let e={name:E.name,email:E.email,picture:E.image,sub:E.id?.toString()},i=await m.jwt({token:e,user:E,account:_,isNewUser:k,trigger:k?"signUp":"signIn"});if(null===i)n.push(...r.clean());else{let e=t.cookies.sessionToken.name,o=await h.encode({...h,token:i,salt:e}),a=new Date;a.setTime(a.getTime()+1e3*y);let s=r.chunk(o,{expires:a});n.push(...s)}}else n.push({name:t.cookies.sessionToken.name,value:A.sessionToken,options:{...t.cookies.sessionToken.options,expires:A.expires}});if(await f.signIn?.({user:E,account:_,isNewUser:k}),k&&p.newUser)return{redirect:`${p.newUser}${p.newUser.includes("?")?"&":"?"}${new URLSearchParams({callbackUrl:d})}`,cookies:n};return{redirect:d,cookies:n}}if("credentials"===l.type&&"POST"===a){let e=o??{};Object.entries(i??{}).forEach(([e,t])=>u.searchParams.set(e,t));let c=await l.authorize(e,new Request(u,{headers:s,method:a,body:JSON.stringify(o)}));if(c)c.id=c.id?.toString()??crypto.randomUUID();else throw new eQ;let p={providerAccountId:c.id,type:"credentials",provider:l.id},g=await a2({user:c,account:p,credentials:e},t);if(g)return{redirect:g,cookies:n};let w={name:c.name,email:c.email,picture:c.image,sub:c.id},b=await m.jwt({token:w,user:c,account:p,isNewUser:!1,trigger:"signIn"});if(null===b)n.push(...r.clean());else{let e=t.cookies.sessionToken.name,i=await h.encode({...h,token:b,salt:e}),o=new Date;o.setTime(o.getTime()+1e3*y);let a=r.chunk(i,{expires:o});n.push(...a)}return await f.signIn?.({user:c,account:p}),{redirect:d,cookies:n}}if("webauthn"===l.type&&"POST"===a){let i,o,a;let s=e.body?.action;if("string"!=typeof s||"authenticate"!==s&&"register"!==s)throw new eJ("Invalid action parameter");let l=aY(t);switch(s){case"authenticate":{let t=await aV(l,e,n);i=t.user,o=t.account;break}case"register":{let r=await az(t,e,n);i=r.user,o=r.account,a=r.authenticator}}await a2({user:i,account:o},t);let{user:c,isNewUser:u,session:g,account:w}=await iX(r.value,i,o,t);if(!w)throw new eJ("Error creating or finding account");if(a&&c.id&&await l.adapter.createAuthenticator({...a,userId:c.id}),b){let e={name:c.name,email:c.email,picture:c.image,sub:c.id?.toString()},i=await m.jwt({token:e,user:c,account:w,isNewUser:u,trigger:u?"signUp":"signIn"});if(null===i)n.push(...r.clean());else{let e=t.cookies.sessionToken.name,o=await h.encode({...h,token:i,salt:e}),a=new Date;a.setTime(a.getTime()+1e3*y);let s=r.chunk(o,{expires:a});n.push(...s)}}else n.push({name:t.cookies.sessionToken.name,value:g.sessionToken,options:{...t.cookies.sessionToken.options,expires:g.expires}});if(await f.signIn?.({user:c,account:w,isNewUser:u}),u&&p.newUser)return{redirect:`${p.newUser}${p.newUser.includes("?")?"&":"?"}${new URLSearchParams({callbackUrl:d})}`,cookies:n};return{redirect:d,cookies:n}}throw new ta(`Callback for provider type (${l.type}) is not supported`)}catch(t){if(t instanceof eJ)throw t;let e=new eG(t,{provider:l.id});throw w.debug("callback route error details",{method:a,query:i,body:o}),e}}async function a2(e,t){let r;let{signIn:n,redirect:i}=t.callbacks;try{r=await n(e)}catch(e){if(e instanceof eJ)throw e;throw new ez(e)}if(!r)throw new ez("AccessDenied");if("string"==typeof r)return await i({url:r,baseUrl:t.url.origin})}async function a5(e,t,r,n,i){let{adapter:o,jwt:a,events:s,callbacks:l,logger:c,session:{strategy:u,maxAge:d}}=e,p={body:null,headers:{"Content-Type":"application/json"},cookies:r},h=t.value;if(!h)return p;if("jwt"===u){try{let r=e.cookies.sessionToken.name,o=await a.decode({...a,token:h,salt:r});if(!o)throw Error("Invalid JWT");let c=await l.jwt({token:o,...n&&{trigger:"update"},session:i}),u=iG(d);if(null!==c){let e={user:{name:c.name,email:c.email,image:c.picture},expires:u.toISOString()},n=await l.session({session:e,token:c});p.body=n;let i=await a.encode({...a,token:c,salt:r}),o=t.chunk(i,{expires:u});p.cookies?.push(...o),await s.session?.({session:n,token:c})}else p.cookies?.push(...t.clean())}catch(e){c.error(new e2(e)),p.cookies?.push(...t.clean())}return p}try{let{getSessionAndUser:r,deleteSession:a,updateSession:c}=o,u=await r(h);if(u&&u.session.expires.valueOf()<Date.now()&&(await a(h),u=null),u){let{user:t,session:r}=u,o=e.session.updateAge,a=r.expires.valueOf()-1e3*d+1e3*o,f=iG(d);a<=Date.now()&&await c({sessionToken:h,expires:f});let m=await l.session({session:{...r,user:t},user:t,newSession:i,...n?{trigger:"update"}:{}});p.body=m,p.cookies?.push({name:e.cookies.sessionToken.name,value:h,options:{...e.cookies.sessionToken.options,expires:f}}),await s.session?.({session:m})}else h&&p.cookies?.push(...t.clean())}catch(e){c.error(new te(e))}return p}async function a3(e,t){let r,n;let{logger:i,provider:o}=t,a=o.authorization?.url;if(!a||"authjs.dev"===a.host){let e=new URL(o.issuer),t=await ol(e,{[i3]:o[nO],[i1]:!0}),r=await od(e,t);if(!r.authorization_endpoint)throw TypeError("Authorization server did not provide an authorization endpoint.");a=new URL(r.authorization_endpoint)}let s=a.searchParams,l=o.callbackUrl;!t.isOnRedirectProxy&&o.redirectProxyUrl&&(l=o.redirectProxyUrl,n=o.callbackUrl,i.debug("using redirect proxy",{redirect_uri:l,data:n}));let c=Object.assign({response_type:"code",client_id:o.clientId,redirect_uri:l,...o.authorization?.params},Object.fromEntries(o.authorization?.url.searchParams??[]),e);for(let e in c)s.set(e,c[e]);let u=[];o.authorization?.url.searchParams.get("response_mode")==="form_post"&&(t.cookies.state.options.sameSite="none",t.cookies.state.options.secure=!0,t.cookies.nonce.options.sameSite="none",t.cookies.nonce.options.secure=!0);let d=await aD.create(t,n);if(d&&(s.set("state",d.value),u.push(d.cookie)),o.checks?.includes("pkce")){if(r&&!r.code_challenge_methods_supported?.includes("S256"))"oidc"===o.type&&(o.checks=["nonce"]);else{let{value:e,cookie:r}=await aj.create(t);s.set("code_challenge",e),s.set("code_challenge_method","S256"),u.push(r)}}let p=await aM.create(t);return p&&(s.set("nonce",p.value),u.push(p.cookie)),"oidc"!==o.type||a.searchParams.has("scope")||a.searchParams.set("scope","openid profile email"),i.debug("authorization url is ready",{url:a,cookies:u,provider:o}),{redirect:a.toString(),cookies:u}}async function a4(e,t){let r;let{body:n}=e,{provider:i,callbacks:o,adapter:a}=t,s=(i.normalizeIdentifier??function(e){if(!e)throw Error("Missing email from request body.");let[t,r]=e.toLowerCase().trim().split("@");return r=r.split(",")[0],`${t}@${r}`})(n?.email),l={id:crypto.randomUUID(),email:s,emailVerified:null},c=await a.getUserByEmail(s)??l,u={providerAccountId:s,userId:c.id,type:"email",provider:i.id};try{r=await o.signIn({user:c,account:u,email:{verificationRequest:!0}})}catch(e){throw new ez(e)}if(!r)throw new ez("AccessDenied");if("string"==typeof r)return{redirect:await o.redirect({url:r,baseUrl:t.url.origin})};let{callbackUrl:d,theme:p}=t,h=await i.generateVerificationToken?.()??nE(32),f=new Date(Date.now()+(i.maxAge??86400)*1e3),m=i.secret??t.secret,g=new URL(t.basePath,t.url.origin),y=i.sendVerificationRequest({identifier:s,token:h,expires:f,url:`${g}/callback/${i.id}?${new URLSearchParams({callbackUrl:d,token:h,email:s})}`,provider:i,theme:p,request:new Request(e.url,{headers:e.headers,method:e.method,body:"POST"===e.method?JSON.stringify(e.body??{}):void 0})}),w=a.createVerificationToken?.({identifier:s,token:await nS(`${h}${m}`),expires:f});return await Promise.all([y,w]),{redirect:`${g}/verify-request?${new URLSearchParams({provider:i.id,type:i.type})}`}}async function a6(e,t,r){let n=`${r.url.origin}${r.basePath}/signin`;if(!r.provider)return{redirect:n,cookies:t};switch(r.provider.type){case"oauth":case"oidc":{let{redirect:n,cookies:i}=await a3(e.query,r);return i&&t.push(...i),{redirect:n,cookies:t}}case"email":return{...await a4(e,r),cookies:t};default:return{redirect:n,cookies:t}}}async function a8(e,t,r){let{jwt:n,events:i,callbackUrl:o,logger:a,session:s}=r,l=t.value;if(!l)return{redirect:o,cookies:e};try{if("jwt"===s.strategy){let e=r.cookies.sessionToken.name,t=await n.decode({...n,token:l,salt:e});await i.signOut?.({token:t})}else{let e=await r.adapter?.deleteSession(l);await i.signOut?.({session:e})}}catch(e){a.error(new tn(e))}return e.push(...t.clean()),{redirect:o,cookies:e}}async function a9(e,t){let{adapter:r,jwt:n,session:{strategy:i}}=e,o=t.value;if(!o)return null;if("jwt"===i){let t=e.cookies.sessionToken.name,r=await n.decode({...n,token:o,salt:t});if(r&&r.sub)return{id:r.sub,name:r.name,email:r.email,image:r.picture}}else{let e=await r?.getSessionAndUser(o);if(e)return e.user}return null}async function a7(e,t,r,n){let i=aY(t),{provider:o}=i,{action:a}=e.query??{};if("register"!==a&&"authenticate"!==a&&void 0!==a)return{status:400,body:{error:"Invalid action"},cookies:n,headers:{"Content-Type":"application/json"}};let s=await a9(t,r),l=s?{user:s,exists:!0}:await o.getUserInfo(t,e),c=l?.user;switch(function(e,t,r){let{user:n,exists:i=!1}=r??{};switch(e){case"authenticate":return"authenticate";case"register":if(n&&t===i)return"register";break;case void 0:if(!t){if(!n||i)return"authenticate";return"register"}}return null}(a,!!s,l)){case"authenticate":return aF(i,e,c,n);case"register":if("string"==typeof c?.email)return aJ(i,e,c,n);break;default:return{status:400,body:{error:"Invalid request"},cookies:n,headers:{"Content-Type":"application/json"}}}}async function se(e,t){let{action:r,providerId:n,error:i,method:o}=e,a=t.skipCSRFCheck===nR,{options:s,cookies:l}=await nD({authOptions:t,action:r,providerId:n,url:e.url,callbackUrl:e.body?.callbackUrl??e.query?.callbackUrl,csrfToken:e.body?.csrfToken,cookies:e.cookies,isPost:"POST"===o,csrfDisabled:a}),c=new eq(s.cookies.sessionToken,e.cookies,s.logger);if("GET"===o){let t=iz({...s,query:e.query,cookies:l});switch(r){case"callback":return await a1(e,s,c,l);case"csrf":return t.csrf(a,s,l);case"error":return t.error(i);case"providers":return t.providers(s.providers);case"session":return await a5(s,c,l);case"signin":return t.signin(n,i);case"signout":return t.signout();case"verify-request":return t.verifyRequest();case"webauthn-options":return await a7(e,s,c,l)}}else{let{csrfTokenVerified:t}=s;switch(r){case"callback":return"credentials"===s.provider.type&&nk(r,t),await a1(e,s,c,l);case"session":return nk(r,t),await a5(s,c,l,!0,e.body?.data);case"signin":return nk(r,t),await a6(e,l,s);case"signout":return nk(r,t),await a8(l,c,s)}}throw new ti(`Cannot handle action: ${r}`)}function st(e,t,r,n,i){let o;let a=i?.basePath,s=n.AUTH_URL??n.NEXTAUTH_URL;if(s)o=new URL(s),a&&"/"!==a&&"/"!==o.pathname&&(o.pathname!==a&&ny(i).warn("env-url-basepath-mismatch"),o.pathname="/");else{let e=r.get("x-forwarded-host")??r.get("host"),n=r.get("x-forwarded-proto")??t??"https",i=n.endsWith(":")?n:n+":";o=new URL(`${i}//${e}`)}let l=o.toString().replace(/\/$/,"");if(a){let t=a?.replace(/(^\/|\/$)/g,"")??"";return new URL(`${l}/${t}/${e}`)}return new URL(`${l}/${e}`)}async function sr(e,t){let r=ny(t),n=await nv(e,t);if(!n)return Response.json("Bad request.",{status:400});let i=function(e,t){let{url:r}=e,n=[];if(!tg&&t.debug&&n.push("debug-enabled"),!t.trustHost)return new ts(`Host must be trusted. URL was: ${e.url}`);if(!t.secret?.length)return new e6("Please define a `secret`");let i=e.query?.callbackUrl;if(i&&!ty(i,r.origin))return new eZ(`Invalid callback URL. Received: ${i}`);let{callbackUrl:o}=eK(t.useSecureCookies??"https:"===r.protocol),a=e.cookies?.[t.cookies?.callbackUrl?.name??o.name];if(a&&!ty(a,r.origin))return new eZ(`Invalid callback URL. Received: ${a}`);let s=!1;for(let e of t.providers){let t="function"==typeof e?e():e;if(("oauth"===t.type||"oidc"===t.type)&&!(t.issuer??t.options?.issuer)){let e;let{authorization:r,token:n,userinfo:i}=t;if("string"==typeof r||r?.url?"string"==typeof n||n?.url?"string"==typeof i||i?.url||(e="userinfo"):e="token":e="authorization",e)return new e0(`Provider "${t.id}" is missing both \`issuer\` and \`${e}\` endpoint config. At least one of them is required`)}if("credentials"===t.type)tw=!0;else if("email"===t.type)tb=!0;else if("webauthn"===t.type){var l;if(tv=!0,t.simpleWebAuthnBrowserVersion&&(l=t.simpleWebAuthnBrowserVersion,!/^v\d+(?:\.\d+){0,2}$/.test(l)))return new eJ(`Invalid provider config for "${t.id}": simpleWebAuthnBrowserVersion "${t.simpleWebAuthnBrowserVersion}" must be a valid semver string.`);if(t.enableConditionalUI){if(s)return new td("Multiple webauthn providers have 'enableConditionalUI' set to True. Only one provider can have this option enabled at a time");if(s=!0,!Object.values(t.formFields).some(e=>e.autocomplete&&e.autocomplete.toString().indexOf("webauthn")>-1))return new tp(`Provider "${t.id}" has 'enableConditionalUI' set to True, but none of its formFields have 'webauthn' in their autocomplete param`)}}}if(tw){let e=t.session?.strategy==="database",r=!t.providers.some(e=>"credentials"!==("function"==typeof e?e():e).type);if(e&&r)return new to("Signing in with credentials only supported if JWT strategy is enabled");if(t.providers.some(e=>{let t="function"==typeof e?e():e;return"credentials"===t.type&&!t.authorize}))return new e4("Must define an authorize() handler to use credentials authentication provider")}let{adapter:c,session:u}=t,d=[];if(tb||u?.strategy==="database"||!u?.strategy&&c){if(tb){if(!c)return new e5("Email login requires an adapter");d.push(...t_)}else{if(!c)return new e5("Database session requires an adapter");d.push(...tS)}}if(tv){if(!t.experimental?.enableWebAuthn)return new tm("WebAuthn is an experimental feature. To enable it, set `experimental.enableWebAuthn` to `true` in your config");if(n.push("experimental-webauthn"),!c)return new e5("WebAuthn requires an adapter");d.push(...tE)}if(c){let e=d.filter(e=>!(e in c));if(e.length)return new e3(`Required adapter methods were missing: ${e.join(", ")}`)}return tg||(tg=!0),n}(n,t);if(Array.isArray(i))i.forEach(r.warn);else if(i){if(r.error(i),!new Set(["signin","signout","error","verify-request"]).has(n.action)||"GET"!==n.method)return Response.json({message:"There was a problem with the server configuration. Check the server logs for more information."},{status:500});let{pages:e,theme:o}=t,a=e?.error&&n.url.searchParams.get("callbackUrl")?.startsWith(e.error);if(!e?.error||a)return a&&r.error(new eX(`The error page ${e?.error} should not require authentication`)),n_(iz({theme:o}).error("Configuration"));let s=`${n.url.origin}${e.error}?error=Configuration`;return Response.redirect(s)}let o=e.headers?.has("X-Auth-Return-Redirect"),a=t.raw===nP;try{let e=await se(n,t);if(a)return e;let r=n_(e),i=r.headers.get("Location");if(!o||!i)return r;return Response.json({url:i},{headers:r.headers})}catch(d){r.error(d);let i=d instanceof eJ;if(i&&a&&!o)throw d;if("POST"===e.method&&"session"===n.action)return Response.json(null,{status:400});let s=new URLSearchParams({error:d instanceof eJ&&tu.has(d.type)?d.type:"Configuration"});d instanceof eQ&&s.set("code",d.code);let l=i&&d.kind||"error",c=t.pages?.[l]??`${t.basePath}/${l.toLowerCase()}`,u=`${n.url.origin}${c}?${s}`;if(o)return Response.json({url:u});return Response.redirect(u)}}function sn(e){let t=process.env.AUTH_URL??process.env.NEXTAUTH_URL;if(!t)return e;let{origin:r}=new URL(t),{href:n,origin:i}=e.nextUrl;return new z(n.replace(i,r),e)}function si(e){try{e.secret??(e.secret=process.env.AUTH_SECRET??process.env.NEXTAUTH_SECRET);let t=process.env.AUTH_URL??process.env.NEXTAUTH_URL;if(!t)return;let{pathname:r}=new URL(t);if("/"===r)return;e.basePath||(e.basePath=r)}catch{}finally{e.basePath||(e.basePath="/api/auth"),function(e,t,r=!1){try{let n=e.AUTH_URL;n&&(t.basePath?r||ny(t).warn("env-url-basepath-redundant"):t.basePath=new URL(n).pathname)}catch{}finally{t.basePath??(t.basePath="/auth")}if(!t.secret?.length){t.secret=[];let r=e.AUTH_SECRET;for(let n of(r&&t.secret.push(r),[1,2,3])){let r=e[`AUTH_SECRET_${n}`];r&&t.secret.unshift(r)}}t.redirectProxyUrl??(t.redirectProxyUrl=e.AUTH_REDIRECT_PROXY_URL),t.trustHost??(t.trustHost=!!(e.AUTH_URL??e.AUTH_TRUST_HOST??e.VERCEL??e.CF_PAGES??"production"!==e.NODE_ENV)),t.providers=t.providers.map(t=>{let{id:r}="function"==typeof t?t({}):t,n=r.toUpperCase().replace(/-/g,"_"),i=e[`AUTH_${n}_ID`],o=e[`AUTH_${n}_SECRET`],a=e[`AUTH_${n}_ISSUER`],s=e[`AUTH_${n}_KEY`],l="function"==typeof t?t({clientId:i,clientSecret:o,issuer:a,apiKey:s}):t;return"oauth"===l.type||"oidc"===l.type?(l.clientId??(l.clientId=i),l.clientSecret??(l.clientSecret=o),l.issuer??(l.issuer=a)):"email"===l.type&&(l.apiKey??(l.apiKey=s)),l})}(process.env,e,!0)}}r(568),"undefined"==typeof URLPattern||URLPattern;let so=(0,eN.P)();var sa=r(942);class ss extends Error{constructor(e){super("Dynamic server usage: "+e),this.description=e,this.digest="DYNAMIC_SERVER_USAGE"}}class sl extends Error{constructor(...e){super(...e),this.code="NEXT_STATIC_GEN_BAILOUT"}}let sc="function"==typeof sa.unstable_postpone;function su(e,t){let r=new URL(e.urlPathname,"http://n").pathname;if(e.isUnstableCacheCallback)throw Error(`Route ${r} used "${t}" inside a function cached with "unstable_cache(...)". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "${t}" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`);if(e.dynamicShouldError)throw new sl(`Route ${r} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);if(e.prerenderState)!function(e,t,r){!function(){if(!sc)throw Error("Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js")}();let n=`Route ${r} needs to bail out of prerendering at this point because it used ${t}. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`;e.dynamicAccesses.push({stack:e.isDebugSkeleton?Error().stack:void 0,expression:t}),sa.unstable_postpone(n)}(e.prerenderState,t,r);else if(e.revalidate=0,e.isStaticGeneration){let n=new ss(`Route ${r} couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`);throw e.dynamicUsageDescription=t,e.dynamicUsageStack=n.stack,n}}function sd(){let e="headers",t=ec.A.getStore();if(t){if(t.forceStatic)return el.seal(new Headers({}));su(t,e)}return ej(e).headers}function sp(){let e="cookies",t=ec.A.getStore();if(t){if(t.forceStatic)return ed.seal(new F.RequestCookies(new Headers({})));su(t,e)}let r=ej(e),n=so.getStore();return(null==n?void 0:n.isAction)||(null==n?void 0:n.isAppRoute)?r.mutableCookies:r.cookies}async function sh(e,t){return sr(new Request(st("session",e.get("x-forwarded-proto"),e,process.env,t),{headers:{cookie:e.get("cookie")??""}}),{...t,callbacks:{...t.callbacks,async session(...e){let r=await t.callbacks?.session?.(...e)??{...e[0].session,expires:e[0].session.expires?.toISOString?.()??e[0].session.expires};return{user:e[0].user??e[0].token,...r}}}})}function sf(e){return"function"==typeof e}function sm(e,t){return"function"==typeof e?async(...r)=>{if(!r.length){let r=await sd(),n=await e(void 0);return t?.(n),sh(r,n).then(e=>e.json())}if(r[0]instanceof Request){let n=r[0],i=r[1],o=await e(n);return t?.(o),sg([n,i],o)}if(sf(r[0])){let n=r[0];return async(...r)=>{let i=await e(r[0]);return t?.(i),sg(r,i,n)}}let n="req"in r[0]?r[0].req:r[0],i="res"in r[0]?r[0].res:r[1],o=await e(n);return t?.(o),sh(new Headers(n.headers),o).then(async e=>{let t=await e.json();for(let t of e.headers.getSetCookie())"headers"in i?i.headers.append("set-cookie",t):i.appendHeader("set-cookie",t);return t})}:(...t)=>{if(!t.length)return Promise.resolve(sd()).then(t=>sh(t,e).then(e=>e.json()));if(t[0]instanceof Request)return sg([t[0],t[1]],e);if(sf(t[0])){let r=t[0];return async(...t)=>sg(t,e,r).then(e=>e)}let r="req"in t[0]?t[0].req:t[0],n="res"in t[0]?t[0].res:t[1];return sh(new Headers(r.headers),e).then(async e=>{let t=await e.json();for(let t of e.headers.getSetCookie())"headers"in n?n.headers.append("set-cookie",t):n.appendHeader("set-cookie",t);return t})}}async function sg(e,t,r){let n=sn(e[0]),i=await sh(n.headers,t),o=await i.json(),a=!0;t.callbacks?.authorized&&(a=await t.callbacks.authorized({request:n,auth:o}));let s=Z.next?.();if(a instanceof Response){s=a;let e=a.headers.get("Location"),{pathname:r}=n.nextUrl;e&&function(e,t,r){let n=t.replace(`${e}/`,""),i=Object.values(r.pages??{});return(sy.has(n)||i.includes(t))&&t===e}(r,new URL(e).pathname,t)&&(a=!0)}else if(r)n.auth=o,s=await r(n,e[1])??Z.next();else if(!a){let e=t.pages?.signIn??`${t.basePath}/signin`;if(n.nextUrl.pathname!==e){let t=n.nextUrl.clone();t.pathname=e,t.searchParams.set("callbackUrl",n.nextUrl.href),s=Z.redirect(t)}}let l=new Response(s?.body,s);for(let e of i.headers.getSetCookie())l.headers.append("set-cookie",e);return l}let sy=new Set(["providers","session","csrf","signin","signout","callback","verify-request","error"]);!function(e){e[e.SeeOther=303]="SeeOther",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect"}(w||(w={}));let sw="NEXT_REDIRECT";function sb(e,t){void 0===t&&(t="replace");let r=so.getStore();throw function(e,t,r){void 0===r&&(r=w.TemporaryRedirect);let n=Error(sw);n.digest=sw+";"+t+";"+e+";"+r+";";let i=eU.getStore();return i&&(n.mutableCookies=i.mutableCookies),n}(e,t,(null==r?void 0:r.isAction)?w.SeeOther:w.TemporaryRedirect)}async function sv(e,t={},r,n){let i=new Headers(await sd()),{redirect:o=!0,redirectTo:a,...s}=t instanceof FormData?Object.fromEntries(t):t,l=a?.toString()??i.get("Referer")??"/",c=st("signin",i.get("x-forwarded-proto"),i,process.env,n);if(!e)return c.searchParams.append("callbackUrl",l),o&&sb(c.toString()),c.toString();let u=`${c}/${e}?${new URLSearchParams(r)}`,d={};for(let t of n.providers){let{options:r,...n}="function"==typeof t?t():t,i=r?.id??n.id;if(i===e){d={id:i,type:r?.type??n.type};break}}if(!d.id){let e=`${c}?${new URLSearchParams({callbackUrl:l})}`;return o&&sb(e),e}"credentials"===d.type&&(u=u.replace("signin","callback")),i.set("Content-Type","application/x-www-form-urlencoded");let p=new Request(u,{method:"POST",headers:i,body:new URLSearchParams({...s,callbackUrl:l})}),h=await sr(p,{...n,raw:nP,skipCSRFCheck:nR}),f=await sp();for(let e of h?.cookies??[])f.set(e.name,e.value,e.options);let m=(h instanceof Response?h.headers.get("Location"):h.redirect)??u;return o?sb(m):m}async function s_(e,t){let r=new Headers(await sd());r.set("Content-Type","application/x-www-form-urlencoded");let n=st("signout",r.get("x-forwarded-proto"),r,process.env,t),i=new URLSearchParams({callbackUrl:e?.redirectTo??r.get("Referer")??"/"}),o=new Request(n,{method:"POST",headers:r,body:i}),a=await sr(o,{...t,raw:nP,skipCSRFCheck:nR}),s=await sp();for(let e of a?.cookies??[])s.set(e.name,e.value,e.options);return e?.redirect??!0?sb(a.redirect):a}async function sS(e,t){let r=new Headers(await sd());r.set("Content-Type","application/json");let n=new Request(st("session",r.get("x-forwarded-proto"),r,process.env,t),{method:"POST",headers:r,body:JSON.stringify({data:e})}),i=await sr(n,{...t,raw:nP,skipCSRFCheck:nR}),o=await sp();for(let e of i?.cookies??[])o.set(e.name,e.value,e.options);return i.body}function sE(e,t){return function(){return e.apply(t,arguments)}}!function(e){e.push="push",e.replace="replace"}(b||(b={}));let{toString:sA}=Object.prototype,{getPrototypeOf:sk}=Object,sx=(c=Object.create(null),e=>{let t=sA.call(e);return c[t]||(c[t]=t.slice(8,-1).toLowerCase())}),sT=e=>(e=e.toLowerCase(),t=>sx(t)===e),sR=e=>t=>typeof t===e,{isArray:sP}=Array,sO=sR("undefined"),sC=sT("ArrayBuffer"),sI=sR("string"),sN=sR("function"),sU=sR("number"),sj=e=>null!==e&&"object"==typeof e,sL=e=>{if("object"!==sx(e))return!1;let t=sk(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},sD=sT("Date"),sM=sT("File"),s$=sT("Blob"),sH=sT("FileList"),sW=sT("URLSearchParams"),[sB,sK,sq,sJ]=["ReadableStream","Request","Response","Headers"].map(sT);function sF(e,t,{allOwnKeys:r=!1}={}){let n,i;if(null!=e){if("object"!=typeof e&&(e=[e]),sP(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{let i;let o=r?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length;for(n=0;n<a;n++)i=o[n],t.call(null,e[i],i,e)}}}function sV(e,t){let r;t=t.toLowerCase();let n=Object.keys(e),i=n.length;for(;i-- >0;)if(t===(r=n[i]).toLowerCase())return r;return null}let sz="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,sG=e=>!sO(e)&&e!==sz,sX=(u="undefined"!=typeof Uint8Array&&sk(Uint8Array),e=>u&&e instanceof u),sY=sT("HTMLFormElement"),sZ=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),sQ=sT("RegExp"),s0=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};sF(r,(r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)}),Object.defineProperties(e,n)},s1="abcdefghijklmnopqrstuvwxyz",s2="0123456789",s5={DIGIT:s2,ALPHA:s1,ALPHA_DIGIT:s1+s1.toUpperCase()+s2},s3=sT("AsyncFunction"),s4=(m="function"==typeof setImmediate,g=sN(sz.postMessage),m?setImmediate:g?(h=`axios@${Math.random()}`,f=[],sz.addEventListener("message",({source:e,data:t})=>{e===sz&&t===h&&f.length&&f.shift()()},!1),e=>{f.push(e),sz.postMessage(h,"*")}):e=>setTimeout(e)),s6="undefined"!=typeof queueMicrotask?queueMicrotask.bind(sz):"undefined"!=typeof process&&process.nextTick||s4,s8={isArray:sP,isArrayBuffer:sC,isBuffer:function(e){return null!==e&&!sO(e)&&null!==e.constructor&&!sO(e.constructor)&&sN(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||sN(e.append)&&("formdata"===(t=sx(e))||"object"===t&&sN(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&sC(e.buffer)},isString:sI,isNumber:sU,isBoolean:e=>!0===e||!1===e,isObject:sj,isPlainObject:sL,isReadableStream:sB,isRequest:sK,isResponse:sq,isHeaders:sJ,isUndefined:sO,isDate:sD,isFile:sM,isBlob:s$,isRegExp:sQ,isFunction:sN,isStream:e=>sj(e)&&sN(e.pipe),isURLSearchParams:sW,isTypedArray:sX,isFileList:sH,forEach:sF,merge:function e(){let{caseless:t}=sG(this)&&this||{},r={},n=(n,i)=>{let o=t&&sV(r,i)||i;sL(r[o])&&sL(n)?r[o]=e(r[o],n):sL(n)?r[o]=e({},n):sP(n)?r[o]=n.slice():r[o]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&sF(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(sF(t,(t,n)=>{r&&sN(t)?e[n]=sE(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,o,a;let s={};if(t=t||{},null==e)return t;do{for(o=(i=Object.getOwnPropertyNames(e)).length;o-- >0;)a=i[o],(!n||n(a,e,t))&&!s[a]&&(t[a]=e[a],s[a]=!0);e=!1!==r&&sk(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:sx,kindOfTest:sT,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return -1!==n&&n===r},toArray:e=>{if(!e)return null;if(sP(e))return e;let t=e.length;if(!sU(t))return null;let r=Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{let r;let n=(e&&e[Symbol.iterator]).call(e);for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let r;let n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:sY,hasOwnProperty:sZ,hasOwnProp:sZ,reduceDescriptors:s0,freezeMethods:e=>{s0(e,(t,r)=>{if(sN(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;if(sN(e[r])){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},toObjectSet:(e,t)=>{let r={};return(e=>{e.forEach(e=>{r[e]=!0})})(sP(e)?e:String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:sV,global:sz,isContextDefined:sG,ALPHABET:s5,generateString:(e=16,t=s5.ALPHA_DIGIT)=>{let r="",{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&sN(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{let t=Array(10),r=(e,n)=>{if(sj(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;let i=sP(e)?[]:{};return sF(e,(e,t)=>{let o=r(e,n+1);sO(o)||(i[t]=o)}),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:s3,isThenable:e=>e&&(sj(e)||sN(e))&&sN(e.then)&&sN(e.catch),setImmediate:s4,asap:s6};function s9(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}s8.inherits(s9,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:s8.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});let s7=s9.prototype,le={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{le[e]={value:e}}),Object.defineProperties(s9,le),Object.defineProperty(s7,"isAxiosError",{value:!0}),s9.from=(e,t,r,n,i,o)=>{let a=Object.create(s7);return s8.toFlatObject(e,a,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),s9.call(a,e.message,t,r,n,i),a.cause=e,a.name=e.name,o&&Object.assign(a,o),a};var lt=r(195).Buffer;function lr(e){return s8.isPlainObject(e)||s8.isArray(e)}function ln(e){return s8.endsWith(e,"[]")?e.slice(0,-2):e}function li(e,t,r){return e?e.concat(t).map(function(e,t){return e=ln(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}let lo=s8.toFlatObject(s8,{},null,function(e){return/^is[A-Z]/.test(e)}),la=function(e,t,r){if(!s8.isObject(e))throw TypeError("target must be an object");t=t||new FormData;let n=(r=s8.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!s8.isUndefined(t[e])})).metaTokens,i=r.visitor||c,o=r.dots,a=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&s8.isSpecCompliantForm(t);if(!s8.isFunction(i))throw TypeError("visitor must be a function");function l(e){if(null===e)return"";if(s8.isDate(e))return e.toISOString();if(!s&&s8.isBlob(e))throw new s9("Blob is not supported. Use a Buffer instead.");return s8.isArrayBuffer(e)||s8.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):lt.from(e):e}function c(e,r,i){let s=e;if(e&&!i&&"object"==typeof e){if(s8.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else{var c;if(s8.isArray(e)&&(c=e,s8.isArray(c)&&!c.some(lr))||(s8.isFileList(e)||s8.endsWith(r,"[]"))&&(s=s8.toArray(e)))return r=ln(r),s.forEach(function(e,n){s8.isUndefined(e)||null===e||t.append(!0===a?li([r],n,o):null===a?r:r+"[]",l(e))}),!1}}return!!lr(e)||(t.append(li(i,r,o),l(e)),!1)}let u=[],d=Object.assign(lo,{defaultVisitor:c,convertValue:l,isVisitable:lr});if(!s8.isObject(e))throw TypeError("data must be an object");return!function e(r,n){if(!s8.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),s8.forEach(r,function(r,o){!0===(!(s8.isUndefined(r)||null===r)&&i.call(t,r,s8.isString(o)?o.trim():o,n,d))&&e(r,n?n.concat(o):[o])}),u.pop()}}(e),t};function ls(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ll(e,t){this._pairs=[],e&&la(e,this,t)}let lc=ll.prototype;function lu(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ld(e,t,r){let n;if(!t)return e;let i=r&&r.encode||lu,o=r&&r.serialize;if(n=o?o(t,r):s8.isURLSearchParams(t)?t.toString():new ll(t,r).toString(i)){let t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}lc.append=function(e,t){this._pairs.push([e,t])},lc.toString=function(e){let t=e?function(t){return e.call(this,t,ls)}:ls;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class lp{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){s8.forEach(this.handlers,function(t){null!==t&&e(t)})}}let lh={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},lf="undefined"!=typeof URLSearchParams?URLSearchParams:ll,lm="undefined"!=typeof FormData?FormData:null,lg="undefined"!=typeof Blob?Blob:null,ly="undefined"!=typeof window&&"undefined"!=typeof document,lw=(d="undefined"!=typeof navigator&&navigator.product,ly&&0>["ReactNative","NativeScript","NS"].indexOf(d)),lb="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,lv=ly&&window.location.href||"http://localhost",l_={...v,isBrowser:!0,classes:{URLSearchParams:lf,FormData:lm,Blob:lg},protocols:["http","https","file","blob","url","data"]},lS=function(e){if(s8.isFormData(e)&&s8.isFunction(e.entries)){let t={};return s8.forEachEntry(e,(e,r)=>{!function e(t,r,n,i){let o=t[i++];if("__proto__"===o)return!0;let a=Number.isFinite(+o),s=i>=t.length;return(o=!o&&s8.isArray(n)?n.length:o,s)?s8.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r:(n[o]&&s8.isObject(n[o])||(n[o]=[]),e(t,r,n[o],i)&&s8.isArray(n[o])&&(n[o]=function(e){let t,r;let n={},i=Object.keys(e),o=i.length;for(t=0;t<o;t++)n[r=i[t]]=e[r];return n}(n[o]))),!a}(s8.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0]),r,t,0)}),t}return null},lE={transitional:lh,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){let r;let n=t.getContentType()||"",i=n.indexOf("application/json")>-1,o=s8.isObject(e);if(o&&s8.isHTMLForm(e)&&(e=new FormData(e)),s8.isFormData(e))return i?JSON.stringify(lS(e)):e;if(s8.isArrayBuffer(e)||s8.isBuffer(e)||s8.isStream(e)||s8.isFile(e)||s8.isBlob(e)||s8.isReadableStream(e))return e;if(s8.isArrayBufferView(e))return e.buffer;if(s8.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1){var a,s;return(a=e,s=this.formSerializer,la(a,new l_.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return l_.isNode&&s8.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},s))).toString()}if((r=s8.isFileList(e))||n.indexOf("multipart/form-data")>-1){let t=this.env&&this.env.FormData;return la(r?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||i?(t.setContentType("application/json",!1),function(e,t,r){if(s8.isString(e))try{return(0,JSON.parse)(e),s8.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){let t=this.transitional||lE.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(s8.isResponse(e)||s8.isReadableStream(e))return e;if(e&&s8.isString(e)&&(r&&!this.responseType||n)){let r=t&&t.silentJSONParsing;try{return JSON.parse(e)}catch(e){if(!r&&n){if("SyntaxError"===e.name)throw s9.from(e,s9.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:l_.classes.FormData,Blob:l_.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};s8.forEach(["delete","get","head","post","put","patch"],e=>{lE.headers[e]={}});let lA=s8.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),lk=e=>{let t,r,n;let i={};return e&&e.split("\n").forEach(function(e){n=e.indexOf(":"),t=e.substring(0,n).trim().toLowerCase(),r=e.substring(n+1).trim(),!t||i[t]&&lA[t]||("set-cookie"===t?i[t]?i[t].push(r):i[t]=[r]:i[t]=i[t]?i[t]+", "+r:r)}),i},lx=Symbol("internals");function lT(e){return e&&String(e).trim().toLowerCase()}function lR(e){return!1===e||null==e?e:s8.isArray(e)?e.map(lR):String(e)}let lP=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function lO(e,t,r,n,i){if(s8.isFunction(n))return n.call(this,t,r);if(i&&(t=r),s8.isString(t)){if(s8.isString(n))return -1!==t.indexOf(n);if(s8.isRegExp(n))return n.test(t)}}class lC{constructor(e){e&&this.set(e)}set(e,t,r){let n=this;function i(e,t,r){let i=lT(t);if(!i)throw Error("header name must be a non-empty string");let o=s8.findKey(n,i);o&&void 0!==n[o]&&!0!==r&&(void 0!==r||!1===n[o])||(n[o||t]=lR(e))}let o=(e,t)=>s8.forEach(e,(e,r)=>i(e,r,t));if(s8.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(s8.isString(e)&&(e=e.trim())&&!lP(e))o(lk(e),t);else if(s8.isHeaders(e))for(let[t,n]of e.entries())i(n,t,r);else null!=e&&i(t,e,r);return this}get(e,t){if(e=lT(e)){let r=s8.findKey(this,e);if(r){let e=this[r];if(!t)return e;if(!0===t)return function(e){let t;let r=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;for(;t=n.exec(e);)r[t[1]]=t[2];return r}(e);if(s8.isFunction(t))return t.call(this,e,r);if(s8.isRegExp(t))return t.exec(e);throw TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=lT(e)){let r=s8.findKey(this,e);return!!(r&&void 0!==this[r]&&(!t||lO(this,this[r],r,t)))}return!1}delete(e,t){let r=this,n=!1;function i(e){if(e=lT(e)){let i=s8.findKey(r,e);i&&(!t||lO(r,r[i],i,t))&&(delete r[i],n=!0)}}return s8.isArray(e)?e.forEach(i):i(e),n}clear(e){let t=Object.keys(this),r=t.length,n=!1;for(;r--;){let i=t[r];(!e||lO(this,this[i],i,e,!0))&&(delete this[i],n=!0)}return n}normalize(e){let t=this,r={};return s8.forEach(this,(n,i)=>{let o=s8.findKey(r,i);if(o){t[o]=lR(n),delete t[i];return}let a=e?i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r):String(i).trim();a!==i&&delete t[i],t[a]=lR(n),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return s8.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&s8.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){let t=(this[lx]=this[lx]={accessors:{}}).accessors,r=this.prototype;function n(e){let n=lT(e);t[n]||(!function(e,t){let r=s8.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})})}(r,e),t[n]=!0)}return s8.isArray(e)?e.forEach(n):n(e),this}}function lI(e,t){let r=this||lE,n=t||r,i=lC.from(n.headers),o=n.data;return s8.forEach(e,function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function lN(e){return!!(e&&e.__CANCEL__)}function lU(e,t,r){s9.call(this,null==e?"canceled":e,s9.ERR_CANCELED,t,r),this.name="CanceledError"}function lj(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new s9("Request failed with status code "+r.status,[s9.ERR_BAD_REQUEST,s9.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}lC.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),s8.reduceDescriptors(lC.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),s8.freezeMethods(lC),s8.inherits(lU,s9,{__CANCEL__:!0});let lL=function(e,t){let r;let n=Array(e=e||10),i=Array(e),o=0,a=0;return t=void 0!==t?t:1e3,function(s){let l=Date.now(),c=i[a];r||(r=l),n[o]=s,i[o]=l;let u=a,d=0;for(;u!==o;)d+=n[u++],u%=e;if((o=(o+1)%e)===a&&(a=(a+1)%e),l-r<t)return;let p=c&&l-c;return p?Math.round(1e3*d/p):void 0}},lD=function(e,t){let r,n,i=0,o=1e3/t,a=(t,o=Date.now())=>{i=o,r=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[(...e)=>{let t=Date.now(),s=t-i;s>=o?a(e,t):(r=e,n||(n=setTimeout(()=>{n=null,a(r)},o-s)))},()=>r&&a(r)]},lM=(e,t,r=3)=>{let n=0,i=lL(50,250);return lD(r=>{let o=r.loaded,a=r.lengthComputable?r.total:void 0,s=o-n,l=i(s);n=o,e({loaded:o,total:a,progress:a?o/a:void 0,bytes:s,rate:l||void 0,estimated:l&&a&&o<=a?(a-o)/l:void 0,event:r,lengthComputable:null!=a,[t?"download":"upload"]:!0})},r)},l$=(e,t)=>{let r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},lH=e=>(...t)=>s8.asap(()=>e(...t)),lW=l_.hasStandardBrowserEnv?function(){let e;let t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){let n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){let r=s8.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},lB=l_.hasStandardBrowserEnv?{write(e,t,r,n,i,o){let a=[e+"="+encodeURIComponent(t)];s8.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),s8.isString(n)&&a.push("path="+n),s8.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read(e){let t=document.cookie.match(RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function lK(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e:t}let lq=e=>e instanceof lC?{...e}:e;function lJ(e,t){t=t||{};let r={};function n(e,t,r){return s8.isPlainObject(e)&&s8.isPlainObject(t)?s8.merge.call({caseless:r},e,t):s8.isPlainObject(t)?s8.merge({},t):s8.isArray(t)?t.slice():t}function i(e,t,r){return s8.isUndefined(t)?s8.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function o(e,t){if(!s8.isUndefined(t))return n(void 0,t)}function a(e,t){return s8.isUndefined(t)?s8.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,o){return o in t?n(r,i):o in e?n(void 0,r):void 0}let l={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(e,t)=>i(lq(e),lq(t),!0)};return s8.forEach(Object.keys(Object.assign({},e,t)),function(n){let o=l[n]||i,a=o(e[n],t[n],n);s8.isUndefined(a)&&o!==s||(r[n]=a)}),r}let lF=e=>{let t;let r=lJ({},e),{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:a,headers:s,auth:l}=r;if(r.headers=s=lC.from(s),r.url=ld(lK(r.baseURL,r.url),e.params,e.paramsSerializer),l&&s.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),s8.isFormData(n)){if(l_.hasStandardBrowserEnv||l_.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(t=s.getContentType())){let[e,...r]=t?t.split(";").map(e=>e.trim()).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...r].join("; "))}}if(l_.hasStandardBrowserEnv&&(i&&s8.isFunction(i)&&(i=i(r)),i||!1!==i&&lW(r.url))){let e=o&&a&&lB.read(a);e&&s.set(o,e)}return r},lV="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){let n,i,o,a,s;let l=lF(e),c=l.data,u=lC.from(l.headers).normalize(),{responseType:d,onUploadProgress:p,onDownloadProgress:h}=l;function f(){a&&a(),s&&s(),l.cancelToken&&l.cancelToken.unsubscribe(n),l.signal&&l.signal.removeEventListener("abort",n)}let m=new XMLHttpRequest;function g(){if(!m)return;let n=lC.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());lj(function(e){t(e),f()},function(e){r(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(l.method.toUpperCase(),l.url,!0),m.timeout=l.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(r(new s9("Request aborted",s9.ECONNABORTED,e,m)),m=null)},m.onerror=function(){r(new s9("Network Error",s9.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded",n=l.transitional||lh;l.timeoutErrorMessage&&(t=l.timeoutErrorMessage),r(new s9(t,n.clarifyTimeoutError?s9.ETIMEDOUT:s9.ECONNABORTED,e,m)),m=null},void 0===c&&u.setContentType(null),"setRequestHeader"in m&&s8.forEach(u.toJSON(),function(e,t){m.setRequestHeader(t,e)}),s8.isUndefined(l.withCredentials)||(m.withCredentials=!!l.withCredentials),d&&"json"!==d&&(m.responseType=l.responseType),h&&([o,s]=lM(h,!0),m.addEventListener("progress",o)),p&&m.upload&&([i,a]=lM(p),m.upload.addEventListener("progress",i),m.upload.addEventListener("loadend",a)),(l.cancelToken||l.signal)&&(n=t=>{m&&(r(!t||t.type?new lU(null,e,m):t),m.abort(),m=null)},l.cancelToken&&l.cancelToken.subscribe(n),l.signal&&(l.signal.aborted?n():l.signal.addEventListener("abort",n)));let y=function(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(l.url);if(y&&-1===l_.protocols.indexOf(y)){r(new s9("Unsupported protocol "+y+":",s9.ERR_BAD_REQUEST,e));return}m.send(c||null)})},lz=(e,t)=>{let r,n=new AbortController,i=function(e){if(!r){r=!0,a();let t=e instanceof Error?e:this.reason;n.abort(t instanceof s9?t:new lU(t instanceof Error?t.message:t))}},o=t&&setTimeout(()=>{i(new s9(`timeout ${t} of ms exceeded`,s9.ETIMEDOUT))},t),a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e&&(e.removeEventListener?e.removeEventListener("abort",i):e.unsubscribe(i))}),e=null)};e.forEach(e=>e&&e.addEventListener&&e.addEventListener("abort",i));let{signal:s}=n;return s.unsubscribe=a,[s,()=>{o&&clearTimeout(o),o=null}]},lG=function*(e,t){let r,n=e.byteLength;if(!t||n<t){yield e;return}let i=0;for(;i<n;)r=i+t,yield e.slice(i,r),i=r},lX=async function*(e,t,r){for await(let n of e)yield*lG(ArrayBuffer.isView(n)?n:await r(String(n)),t)},lY=(e,t,r,n,i)=>{let o;let a=lX(e,t,i),s=0,l=e=>{!o&&(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{let{done:t,value:n}=await a.next();if(t){l(),e.close();return}let i=n.byteLength;if(r){let e=s+=i;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw l(e),e}},cancel:e=>(l(e),a.return())},{highWaterMark:2})},lZ="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,lQ=lZ&&"function"==typeof ReadableStream,l0=lZ&&("function"==typeof TextEncoder?(p=new TextEncoder,e=>p.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer())),l1=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},l2=lQ&&l1(()=>{let e=!1,t=new Request(l_.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),l5=lQ&&l1(()=>s8.isReadableStream(new Response("").body)),l3={stream:l5&&(e=>e.body)};lZ&&(y=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{l3[e]||(l3[e]=s8.isFunction(y[e])?t=>t[e]():(t,r)=>{throw new s9(`Response type '${e}' is not supported`,s9.ERR_NOT_SUPPORT,r)})}));let l4=async e=>null==e?0:s8.isBlob(e)?e.size:s8.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:s8.isArrayBufferView(e)||s8.isArrayBuffer(e)?e.byteLength:(s8.isURLSearchParams(e)&&(e+=""),s8.isString(e))?(await l0(e)).byteLength:void 0,l6=async(e,t)=>{let r=s8.toFiniteNumber(e.getContentLength());return null==r?l4(t):r},l8={http:null,xhr:lV,fetch:lZ&&(async e=>{let t,r,n,{url:i,method:o,data:a,signal:s,cancelToken:l,timeout:c,onDownloadProgress:u,onUploadProgress:d,responseType:p,headers:h,withCredentials:f="same-origin",fetchOptions:m}=lF(e);p=p?(p+"").toLowerCase():"text";let[g,y]=s||l||c?lz([s,l],c):[],w=()=>{t||setTimeout(()=>{g&&g.unsubscribe()}),t=!0};try{if(d&&l2&&"get"!==o&&"head"!==o&&0!==(n=await l6(h,a))){let e,t=new Request(i,{method:"POST",body:a,duplex:"half"});if(s8.isFormData(a)&&(e=t.headers.get("content-type"))&&h.setContentType(e),t.body){let[e,r]=l$(n,lM(lH(d)));a=lY(t.body,65536,e,r,l0)}}s8.isString(f)||(f=f?"include":"omit"),r=new Request(i,{...m,signal:g,method:o.toUpperCase(),headers:h.normalize().toJSON(),body:a,duplex:"half",credentials:f});let t=await fetch(r),s=l5&&("stream"===p||"response"===p);if(l5&&(u||s)){let e={};["status","statusText","headers"].forEach(r=>{e[r]=t[r]});let r=s8.toFiniteNumber(t.headers.get("content-length")),[n,i]=u&&l$(r,lM(lH(u),!0))||[];t=new Response(lY(t.body,65536,n,()=>{i&&i(),s&&w()},l0),e)}p=p||"text";let l=await l3[s8.findKey(l3,p)||"text"](t,e);return s||w(),y&&y(),await new Promise((n,i)=>{lj(n,i,{data:l,headers:lC.from(t.headers),status:t.status,statusText:t.statusText,config:e,request:r})})}catch(t){if(w(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new s9("Network Error",s9.ERR_NETWORK,e,r),{cause:t.cause||t});throw s9.from(t,t&&t.code,e,r)}})};s8.forEach(l8,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});let l9=e=>`- ${e}`,l7=e=>s8.isFunction(e)||null===e||!1===e,ce={getAdapter:e=>{let t,r;let{length:n}=e=s8.isArray(e)?e:[e],i={};for(let o=0;o<n;o++){let n;if(r=t=e[o],!l7(t)&&void 0===(r=l8[(n=String(t)).toLowerCase()]))throw new s9(`Unknown adapter '${n}'`);if(r)break;i[n||"#"+o]=r}if(!r){let e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new s9("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(l9).join("\n"):" "+l9(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r}};function ct(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new lU(null,e)}function cr(e){return ct(e),e.headers=lC.from(e.headers),e.data=lI.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ce.getAdapter(e.adapter||lE.adapter)(e).then(function(t){return ct(e),t.data=lI.call(e,e.transformResponse,t),t.headers=lC.from(t.headers),t},function(t){return!lN(t)&&(ct(e),t&&t.response&&(t.response.data=lI.call(e,e.transformResponse,t.response),t.response.headers=lC.from(t.response.headers))),Promise.reject(t)})}let cn="1.7.3",ci={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ci[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});let co={};ci.transitional=function(e,t,r){function n(e,t){return"[Axios v"+cn+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new s9(n(i," has been removed"+(t?" in "+t:"")),s9.ERR_DEPRECATED);return t&&!co[i]&&(co[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,o)}};let ca={assertOptions:function(e,t,r){if("object"!=typeof e)throw new s9("options must be an object",s9.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),i=n.length;for(;i-- >0;){let o=n[i],a=t[o];if(a){let t=e[o],r=void 0===t||a(t,o,e);if(!0!==r)throw new s9("option "+o+" must be "+r,s9.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new s9("Unknown option "+o,s9.ERR_BAD_OPTION)}},validators:ci},cs=ca.validators;class cl{constructor(e){this.defaults=e,this.interceptors={request:new lp,response:new lp}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=Error();let r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){let r,n;"string"==typeof e?(t=t||{}).url=e:t=e||{};let{transitional:i,paramsSerializer:o,headers:a}=t=lJ(this.defaults,t);void 0!==i&&ca.assertOptions(i,{silentJSONParsing:cs.transitional(cs.boolean),forcedJSONParsing:cs.transitional(cs.boolean),clarifyTimeoutError:cs.transitional(cs.boolean)},!1),null!=o&&(s8.isFunction(o)?t.paramsSerializer={serialize:o}:ca.assertOptions(o,{encode:cs.function,serialize:cs.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=a&&s8.merge(a.common,a[t.method]);a&&s8.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=lC.concat(s,a);let l=[],c=!0;this.interceptors.request.forEach(function(e){("function"!=typeof e.runWhen||!1!==e.runWhen(t))&&(c=c&&e.synchronous,l.unshift(e.fulfilled,e.rejected))});let u=[];this.interceptors.response.forEach(function(e){u.push(e.fulfilled,e.rejected)});let d=0;if(!c){let e=[cr.bind(this),void 0];for(e.unshift.apply(e,l),e.push.apply(e,u),n=e.length,r=Promise.resolve(t);d<n;)r=r.then(e[d++],e[d++]);return r}n=l.length;let p=t;for(d=0;d<n;){let e=l[d++],t=l[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{r=cr.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,n=u.length;d<n;)r=r.then(u[d++],u[d++]);return r}getUri(e){return ld(lK((e=lJ(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}s8.forEach(["delete","get","head","options"],function(e){cl.prototype[e]=function(t,r){return this.request(lJ(r||{},{method:e,url:t,data:(r||{}).data}))}}),s8.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,i){return this.request(lJ(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}cl.prototype[e]=t(),cl.prototype[e+"Form"]=t(!0)});class cc{constructor(e){let t;if("function"!=typeof e)throw TypeError("executor must be a function.");this.promise=new Promise(function(e){t=e});let r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;let n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,i){r.reason||(r.reason=new lU(e,n,i),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new cc(function(t){e=t}),cancel:e}}}let cu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(cu).forEach(([e,t])=>{cu[t]=e});let cd=function e(t){let r=new cl(t),n=sE(cl.prototype.request,r);return s8.extend(n,cl.prototype,r,{allOwnKeys:!0}),s8.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(lJ(t,r))},n}(lE);cd.Axios=cl,cd.CanceledError=lU,cd.CancelToken=cc,cd.isCancel=lN,cd.VERSION=cn,cd.toFormData=la,cd.AxiosError=s9,cd.Cancel=cd.CanceledError,cd.all=function(e){return Promise.all(e)},cd.spread=function(e){return function(t){return e.apply(null,t)}},cd.isAxiosError=function(e){return s8.isObject(e)&&!0===e.isAxiosError},cd.mergeConfig=lJ,cd.AxiosHeaders=lC,cd.formToJSON=e=>lS(s8.isHTMLForm(e)?new FormData(e):e),cd.getAdapter=ce.getAdapter,cd.HttpStatusCode=cu,cd.default=cd;let cp=cd.create({baseURL:"https://cloud.247tranzact.com/api/",headers:{"Content-Type":"application/json"}}),{handlers:ch,auth:cf,signIn:cm,signOut:cg}=function(e){if("function"==typeof e){let t=async t=>{let r=await e(t);return si(r),sr(sn(t),r)};return{handlers:{GET:t,POST:t},auth:sm(e,e=>si(e)),signIn:async(t,r,n)=>{let i=await e(void 0);return si(i),sv(t,r,n,i)},signOut:async t=>{let r=await e(void 0);return si(r),s_(t,r)},unstable_update:async t=>{let r=await e(void 0);return si(r),sS(t,r)}}}si(e);let t=t=>sr(sn(t),e);return{handlers:{GET:t,POST:t},auth:sm(e),signIn:(t,r,n)=>sv(t,r,n,e),signOut:t=>s_(t,e),unstable_update:t=>sS(t,e)}}({basePath:"/api/auth",trustHost:!0,secret:process.env.AUTH_SECRET,session:{strategy:"jwt",maxAge:86400},pages:{signIn:"/auth/sign_in"},providers:[{id:"credentials",name:"Credentials",type:"credentials",credentials:{},authorize:()=>null,options:{credentials:{Email:{},Password:{}},authorize:async(e,t)=>{let{email:r,password:n}=e;try{let t=await cp.post("/auth/login",e);console.log(t.data);let{email:r,id:n,username:i}=t.data;return{email:r,id:n,name:i}}catch(e){return console.log(e),null}}}}],callbacks:{jwt:async({token:e,user:t})=>t?{...e,id:t.id}:e,session:async({session:e,token:t})=>({...e,user:{...e.user,id:t.id}})}}),cy={..._},cw=cy.middleware||cy.default,cb="/middleware";if("function"!=typeof cw)throw Error(`The Middleware "${cb}" must export a \`middleware\` or a \`default\` function`);function cv(e){return eH({...e,page:cb,handler:cw})}},471:(e,t)=>{"use strict";/*!
 * cookie
 * Copyright(c) 2012-2014 Roman Shtylman
 * Copyright(c) 2015 Douglas Christopher Wilson
 * MIT Licensed
 */t.Q=function(e,t){if("string"!=typeof e)throw TypeError("argument str must be a string");var r={},n=e.length;if(n<2)return r;var i=t&&t.decode||c,o=0,a=0,u=0;do{if(-1===(a=e.indexOf("=",o)))break;if(-1===(u=e.indexOf(";",o)))u=n;else if(a>u){o=e.lastIndexOf(";",a-1)+1;continue}var d=s(e,o,a),p=l(e,a,d),h=e.slice(d,p);if(!r.hasOwnProperty(h)){var f=s(e,a+1,u),m=l(e,u,f);34===e.charCodeAt(f)&&34===e.charCodeAt(m-1)&&(f++,m--);var g=e.slice(f,m);r[h]=function(e,t){try{return t(e)}catch(t){return e}}(g,i)}o=u+1}while(o<n);return r},t.q=function(e,t,s){var l=s&&s.encode||encodeURIComponent;if("function"!=typeof l)throw TypeError("option encode is invalid");if(!n.test(e))throw TypeError("argument name is invalid");var c=l(t);if(!i.test(c))throw TypeError("argument val is invalid");var u=e+"="+c;if(!s)return u;if(null!=s.maxAge){var d=Math.floor(s.maxAge);if(!isFinite(d))throw TypeError("option maxAge is invalid");u+="; Max-Age="+d}if(s.domain){if(!o.test(s.domain))throw TypeError("option domain is invalid");u+="; Domain="+s.domain}if(s.path){if(!a.test(s.path))throw TypeError("option path is invalid");u+="; Path="+s.path}if(s.expires){var p=s.expires;if("[object Date]"!==r.call(p)||isNaN(p.valueOf()))throw TypeError("option expires is invalid");u+="; Expires="+p.toUTCString()}if(s.httpOnly&&(u+="; HttpOnly"),s.secure&&(u+="; Secure"),s.partitioned&&(u+="; Partitioned"),s.priority)switch("string"==typeof s.priority?s.priority.toLowerCase():s.priority){case"low":u+="; Priority=Low";break;case"medium":u+="; Priority=Medium";break;case"high":u+="; Priority=High";break;default:throw TypeError("option priority is invalid")}if(s.sameSite)switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case!0:case"strict":u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"none":u+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid")}return u};var r=Object.prototype.toString,n=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,i=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,o=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,a=/^[\u0020-\u003A\u003D-\u007E]*$/;function s(e,t,r){do{var n=e.charCodeAt(t);if(32!==n&&9!==n)return t}while(++t<r);return r}function l(e,t,r){for(;t>r;){var n=e.charCodeAt(--t);if(32!==n&&9!==n)return t+1}return r}function c(e){return -1!==e.indexOf("%")?decodeURIComponent(e):e}},447:e=>{"use strict";var t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o={};function a(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),n=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?n:`${n}; ${r.join("; ")}`}function s(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[n,i]=[r.slice(0,e),r.slice(e+1)];try{t.set(n,decodeURIComponent(null!=i?i:"true"))}catch{}}return t}function l(e){var t,r;if(!e)return;let[[n,i],...o]=s(e),{domain:a,expires:l,httponly:d,maxage:p,path:h,samesite:f,secure:m,partitioned:g,priority:y}=Object.fromEntries(o.map(([e,t])=>[e.toLowerCase(),t]));return function(e){let t={};for(let r in e)e[r]&&(t[r]=e[r]);return t}({name:n,value:decodeURIComponent(i),domain:a,...l&&{expires:new Date(l)},...d&&{httpOnly:!0},..."string"==typeof p&&{maxAge:Number(p)},path:h,...f&&{sameSite:c.includes(t=(t=f).toLowerCase())?t:void 0},...m&&{secure:!0},...y&&{priority:u.includes(r=(r=y).toLowerCase())?r:void 0},...g&&{partitioned:!0}})}((e,r)=>{for(var n in r)t(e,n,{get:r[n],enumerable:!0})})(o,{RequestCookies:()=>d,ResponseCookies:()=>p,parseCookie:()=>s,parseSetCookie:()=>l,stringifyCookie:()=>a}),e.exports=((e,o,a,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let l of n(o))i.call(e,l)||l===a||t(e,l,{get:()=>o[l],enumerable:!(s=r(o,l))||s.enumerable});return e})(t({},"__esModule",{value:!0}),o);var c=["strict","lax","none"],u=["low","medium","high"],d=class{constructor(e){this._parsed=new Map,this._headers=e;let t=e.get("cookie");if(t)for(let[e,r]of s(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===n).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,n=this._parsed;return n.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(n).map(([e,t])=>a(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>a(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},p=class{constructor(e){var t,r,n;this._parsed=new Map,this._headers=e;let i=null!=(n=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?n:[];for(let e of Array.isArray(i)?i:function(e){if(!e)return[];var t,r,n,i,o,a=[],s=0;function l(){for(;s<e.length&&/\s/.test(e.charAt(s));)s+=1;return s<e.length}for(;s<e.length;){for(t=s,o=!1;l();)if(","===(r=e.charAt(s))){for(n=s,s+=1,l(),i=s;s<e.length&&"="!==(r=e.charAt(s))&&";"!==r&&","!==r;)s+=1;s<e.length&&"="===e.charAt(s)?(o=!0,s=i,a.push(e.substring(t,n)),t=s):s=n+1}else s+=1;(!o||s>=e.length)&&a.push(e.substring(t,e.length))}return a}(i)){let t=l(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===n)}has(e){return this._parsed.has(e)}set(...e){let[t,r,n]=1===e.length?[e[0].name,e[0].value,e[0]]:e,i=this._parsed;return i.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...n})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=a(r);t.append("set-cookie",e)}}(i,this._headers),this}delete(...e){let[t,r,n]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0].path,e[0].domain];return this.set({name:t,path:r,domain:n,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(a).join("; ")}}},692:(e,t,r)=>{(()=>{"use strict";var t={491:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ContextAPI=void 0;let n=r(223),i=r(172),o=r(930),a="context",s=new n.NoopContextManager;class l{constructor(){}static getInstance(){return this._instance||(this._instance=new l),this._instance}setGlobalContextManager(e){return(0,i.registerGlobal)(a,e,o.DiagAPI.instance())}active(){return this._getContextManager().active()}with(e,t,r,...n){return this._getContextManager().with(e,t,r,...n)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return(0,i.getGlobal)(a)||s}disable(){this._getContextManager().disable(),(0,i.unregisterGlobal)(a,o.DiagAPI.instance())}}t.ContextAPI=l},930:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagAPI=void 0;let n=r(56),i=r(912),o=r(957),a=r(172);class s{constructor(){function e(e){return function(...t){let r=(0,a.getGlobal)("diag");if(r)return r[e](...t)}}let t=this;t.setLogger=(e,r={logLevel:o.DiagLogLevel.INFO})=>{var n,s,l;if(e===t){let e=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error(null!==(n=e.stack)&&void 0!==n?n:e.message),!1}"number"==typeof r&&(r={logLevel:r});let c=(0,a.getGlobal)("diag"),u=(0,i.createLogLevelDiagLogger)(null!==(s=r.logLevel)&&void 0!==s?s:o.DiagLogLevel.INFO,e);if(c&&!r.suppressOverrideMessage){let e=null!==(l=Error().stack)&&void 0!==l?l:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${e}`),u.warn(`Current logger will overwrite one already registered from ${e}`)}return(0,a.registerGlobal)("diag",u,t,!0)},t.disable=()=>{(0,a.unregisterGlobal)("diag",t)},t.createComponentLogger=e=>new n.DiagComponentLogger(e),t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}static instance(){return this._instance||(this._instance=new s),this._instance}}t.DiagAPI=s},653:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MetricsAPI=void 0;let n=r(660),i=r(172),o=r(930),a="metrics";class s{constructor(){}static getInstance(){return this._instance||(this._instance=new s),this._instance}setGlobalMeterProvider(e){return(0,i.registerGlobal)(a,e,o.DiagAPI.instance())}getMeterProvider(){return(0,i.getGlobal)(a)||n.NOOP_METER_PROVIDER}getMeter(e,t,r){return this.getMeterProvider().getMeter(e,t,r)}disable(){(0,i.unregisterGlobal)(a,o.DiagAPI.instance())}}t.MetricsAPI=s},181:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PropagationAPI=void 0;let n=r(172),i=r(874),o=r(194),a=r(277),s=r(369),l=r(930),c="propagation",u=new i.NoopTextMapPropagator;class d{constructor(){this.createBaggage=s.createBaggage,this.getBaggage=a.getBaggage,this.getActiveBaggage=a.getActiveBaggage,this.setBaggage=a.setBaggage,this.deleteBaggage=a.deleteBaggage}static getInstance(){return this._instance||(this._instance=new d),this._instance}setGlobalPropagator(e){return(0,n.registerGlobal)(c,e,l.DiagAPI.instance())}inject(e,t,r=o.defaultTextMapSetter){return this._getGlobalPropagator().inject(e,t,r)}extract(e,t,r=o.defaultTextMapGetter){return this._getGlobalPropagator().extract(e,t,r)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,n.unregisterGlobal)(c,l.DiagAPI.instance())}_getGlobalPropagator(){return(0,n.getGlobal)(c)||u}}t.PropagationAPI=d},997:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TraceAPI=void 0;let n=r(172),i=r(846),o=r(139),a=r(607),s=r(930),l="trace";class c{constructor(){this._proxyTracerProvider=new i.ProxyTracerProvider,this.wrapSpanContext=o.wrapSpanContext,this.isSpanContextValid=o.isSpanContextValid,this.deleteSpan=a.deleteSpan,this.getSpan=a.getSpan,this.getActiveSpan=a.getActiveSpan,this.getSpanContext=a.getSpanContext,this.setSpan=a.setSpan,this.setSpanContext=a.setSpanContext}static getInstance(){return this._instance||(this._instance=new c),this._instance}setGlobalTracerProvider(e){let t=(0,n.registerGlobal)(l,this._proxyTracerProvider,s.DiagAPI.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return(0,n.getGlobal)(l)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){(0,n.unregisterGlobal)(l,s.DiagAPI.instance()),this._proxyTracerProvider=new i.ProxyTracerProvider}}t.TraceAPI=c},277:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deleteBaggage=t.setBaggage=t.getActiveBaggage=t.getBaggage=void 0;let n=r(491),i=(0,r(780).createContextKey)("OpenTelemetry Baggage Key");function o(e){return e.getValue(i)||void 0}t.getBaggage=o,t.getActiveBaggage=function(){return o(n.ContextAPI.getInstance().active())},t.setBaggage=function(e,t){return e.setValue(i,t)},t.deleteBaggage=function(e){return e.deleteValue(i)}},993:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaggageImpl=void 0;class r{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries()).map(([e,t])=>[e,t])}setEntry(e,t){let n=new r(this._entries);return n._entries.set(e,t),n}removeEntry(e){let t=new r(this._entries);return t._entries.delete(e),t}removeEntries(...e){let t=new r(this._entries);for(let r of e)t._entries.delete(r);return t}clear(){return new r}}t.BaggageImpl=r},830:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.baggageEntryMetadataSymbol=void 0,t.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")},369:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.baggageEntryMetadataFromString=t.createBaggage=void 0;let n=r(930),i=r(993),o=r(830),a=n.DiagAPI.instance();t.createBaggage=function(e={}){return new i.BaggageImpl(new Map(Object.entries(e)))},t.baggageEntryMetadataFromString=function(e){return"string"!=typeof e&&(a.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=""),{__TYPE__:o.baggageEntryMetadataSymbol,toString:()=>e}}},67:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.context=void 0;let n=r(491);t.context=n.ContextAPI.getInstance()},223:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NoopContextManager=void 0;let n=r(780);class i{active(){return n.ROOT_CONTEXT}with(e,t,r,...n){return t.call(r,...n)}bind(e,t){return t}enable(){return this}disable(){return this}}t.NoopContextManager=i},780:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ROOT_CONTEXT=t.createContextKey=void 0,t.createContextKey=function(e){return Symbol.for(e)};class r{constructor(e){let t=this;t._currentContext=e?new Map(e):new Map,t.getValue=e=>t._currentContext.get(e),t.setValue=(e,n)=>{let i=new r(t._currentContext);return i._currentContext.set(e,n),i},t.deleteValue=e=>{let n=new r(t._currentContext);return n._currentContext.delete(e),n}}}t.ROOT_CONTEXT=new r},506:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.diag=void 0;let n=r(930);t.diag=n.DiagAPI.instance()},56:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagComponentLogger=void 0;let n=r(172);class i{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return o("debug",this._namespace,e)}error(...e){return o("error",this._namespace,e)}info(...e){return o("info",this._namespace,e)}warn(...e){return o("warn",this._namespace,e)}verbose(...e){return o("verbose",this._namespace,e)}}function o(e,t,r){let i=(0,n.getGlobal)("diag");if(i)return r.unshift(t),i[e](...r)}t.DiagComponentLogger=i},972:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagConsoleLogger=void 0;let r=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class n{constructor(){for(let e=0;e<r.length;e++)this[r[e].n]=function(e){return function(...t){if(console){let r=console[e];if("function"!=typeof r&&(r=console.log),"function"==typeof r)return r.apply(console,t)}}}(r[e].c)}}t.DiagConsoleLogger=n},912:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createLogLevelDiagLogger=void 0;let n=r(957);t.createLogLevelDiagLogger=function(e,t){function r(r,n){let i=t[r];return"function"==typeof i&&e>=n?i.bind(t):function(){}}return e<n.DiagLogLevel.NONE?e=n.DiagLogLevel.NONE:e>n.DiagLogLevel.ALL&&(e=n.DiagLogLevel.ALL),t=t||{},{error:r("error",n.DiagLogLevel.ERROR),warn:r("warn",n.DiagLogLevel.WARN),info:r("info",n.DiagLogLevel.INFO),debug:r("debug",n.DiagLogLevel.DEBUG),verbose:r("verbose",n.DiagLogLevel.VERBOSE)}}},957:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagLogLevel=void 0,function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"}(t.DiagLogLevel||(t.DiagLogLevel={}))},172:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unregisterGlobal=t.getGlobal=t.registerGlobal=void 0;let n=r(200),i=r(521),o=r(130),a=i.VERSION.split(".")[0],s=Symbol.for(`opentelemetry.js.api.${a}`),l=n._globalThis;t.registerGlobal=function(e,t,r,n=!1){var o;let a=l[s]=null!==(o=l[s])&&void 0!==o?o:{version:i.VERSION};if(!n&&a[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(t.stack||t.message),!1}if(a.version!==i.VERSION){let t=Error(`@opentelemetry/api: Registration of version v${a.version} for ${e} does not match previously registered API v${i.VERSION}`);return r.error(t.stack||t.message),!1}return a[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${i.VERSION}.`),!0},t.getGlobal=function(e){var t,r;let n=null===(t=l[s])||void 0===t?void 0:t.version;if(n&&(0,o.isCompatible)(n))return null===(r=l[s])||void 0===r?void 0:r[e]},t.unregisterGlobal=function(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${i.VERSION}.`);let r=l[s];r&&delete r[e]}},130:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isCompatible=t._makeCompatibilityCheck=void 0;let n=r(521),i=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function o(e){let t=new Set([e]),r=new Set,n=e.match(i);if(!n)return()=>!1;let o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(null!=o.prerelease)return function(t){return t===e};function a(e){return r.add(e),!1}return function(e){if(t.has(e))return!0;if(r.has(e))return!1;let n=e.match(i);if(!n)return a(e);let s={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};return null!=s.prerelease||o.major!==s.major?a(e):0===o.major?o.minor===s.minor&&o.patch<=s.patch?(t.add(e),!0):a(e):o.minor<=s.minor?(t.add(e),!0):a(e)}}t._makeCompatibilityCheck=o,t.isCompatible=o(n.VERSION)},886:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.metrics=void 0;let n=r(653);t.metrics=n.MetricsAPI.getInstance()},901:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueType=void 0,function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"}(t.ValueType||(t.ValueType={}))},102:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createNoopMeter=t.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=t.NOOP_OBSERVABLE_GAUGE_METRIC=t.NOOP_OBSERVABLE_COUNTER_METRIC=t.NOOP_UP_DOWN_COUNTER_METRIC=t.NOOP_HISTOGRAM_METRIC=t.NOOP_COUNTER_METRIC=t.NOOP_METER=t.NoopObservableUpDownCounterMetric=t.NoopObservableGaugeMetric=t.NoopObservableCounterMetric=t.NoopObservableMetric=t.NoopHistogramMetric=t.NoopUpDownCounterMetric=t.NoopCounterMetric=t.NoopMetric=t.NoopMeter=void 0;class r{constructor(){}createHistogram(e,r){return t.NOOP_HISTOGRAM_METRIC}createCounter(e,r){return t.NOOP_COUNTER_METRIC}createUpDownCounter(e,r){return t.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(e,r){return t.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(e,r){return t.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(e,r){return t.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}}t.NoopMeter=r;class n{}t.NoopMetric=n;class i extends n{add(e,t){}}t.NoopCounterMetric=i;class o extends n{add(e,t){}}t.NoopUpDownCounterMetric=o;class a extends n{record(e,t){}}t.NoopHistogramMetric=a;class s{addCallback(e){}removeCallback(e){}}t.NoopObservableMetric=s;class l extends s{}t.NoopObservableCounterMetric=l;class c extends s{}t.NoopObservableGaugeMetric=c;class u extends s{}t.NoopObservableUpDownCounterMetric=u,t.NOOP_METER=new r,t.NOOP_COUNTER_METRIC=new i,t.NOOP_HISTOGRAM_METRIC=new a,t.NOOP_UP_DOWN_COUNTER_METRIC=new o,t.NOOP_OBSERVABLE_COUNTER_METRIC=new l,t.NOOP_OBSERVABLE_GAUGE_METRIC=new c,t.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new u,t.createNoopMeter=function(){return t.NOOP_METER}},660:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NOOP_METER_PROVIDER=t.NoopMeterProvider=void 0;let n=r(102);class i{getMeter(e,t,r){return n.NOOP_METER}}t.NoopMeterProvider=i,t.NOOP_METER_PROVIDER=new i},200:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(46),t)},651:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._globalThis=void 0,t._globalThis="object"==typeof globalThis?globalThis:r.g},46:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(651),t)},939:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.propagation=void 0;let n=r(181);t.propagation=n.PropagationAPI.getInstance()},874:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NoopTextMapPropagator=void 0;class r{inject(e,t){}extract(e,t){return e}fields(){return[]}}t.NoopTextMapPropagator=r},194:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultTextMapSetter=t.defaultTextMapGetter=void 0,t.defaultTextMapGetter={get(e,t){if(null!=e)return e[t]},keys:e=>null==e?[]:Object.keys(e)},t.defaultTextMapSetter={set(e,t,r){null!=e&&(e[t]=r)}}},845:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.trace=void 0;let n=r(997);t.trace=n.TraceAPI.getInstance()},403:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NonRecordingSpan=void 0;let n=r(476);class i{constructor(e=n.INVALID_SPAN_CONTEXT){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}t.NonRecordingSpan=i},614:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NoopTracer=void 0;let n=r(491),i=r(607),o=r(403),a=r(139),s=n.ContextAPI.getInstance();class l{startSpan(e,t,r=s.active()){if(null==t?void 0:t.root)return new o.NonRecordingSpan;let n=r&&(0,i.getSpanContext)(r);return"object"==typeof n&&"string"==typeof n.spanId&&"string"==typeof n.traceId&&"number"==typeof n.traceFlags&&(0,a.isSpanContextValid)(n)?new o.NonRecordingSpan(n):new o.NonRecordingSpan}startActiveSpan(e,t,r,n){let o,a,l;if(arguments.length<2)return;2==arguments.length?l=t:3==arguments.length?(o=t,l=r):(o=t,a=r,l=n);let c=null!=a?a:s.active(),u=this.startSpan(e,o,c),d=(0,i.setSpan)(c,u);return s.with(d,l,void 0,u)}}t.NoopTracer=l},124:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NoopTracerProvider=void 0;let n=r(614);class i{getTracer(e,t,r){return new n.NoopTracer}}t.NoopTracerProvider=i},125:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProxyTracer=void 0;let n=new(r(614)).NoopTracer;class i{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}startSpan(e,t,r){return this._getTracer().startSpan(e,t,r)}startActiveSpan(e,t,r,n){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):n}}t.ProxyTracer=i},846:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProxyTracerProvider=void 0;let n=r(125),i=new(r(124)).NoopTracerProvider;class o{getTracer(e,t,r){var i;return null!==(i=this.getDelegateTracer(e,t,r))&&void 0!==i?i:new n.ProxyTracer(this,e,t,r)}getDelegate(){var e;return null!==(e=this._delegate)&&void 0!==e?e:i}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,r){var n;return null===(n=this._delegate)||void 0===n?void 0:n.getTracer(e,t,r)}}t.ProxyTracerProvider=o},996:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SamplingDecision=void 0,function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(t.SamplingDecision||(t.SamplingDecision={}))},607:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSpanContext=t.setSpanContext=t.deleteSpan=t.setSpan=t.getActiveSpan=t.getSpan=void 0;let n=r(780),i=r(403),o=r(491),a=(0,n.createContextKey)("OpenTelemetry Context Key SPAN");function s(e){return e.getValue(a)||void 0}function l(e,t){return e.setValue(a,t)}t.getSpan=s,t.getActiveSpan=function(){return s(o.ContextAPI.getInstance().active())},t.setSpan=l,t.deleteSpan=function(e){return e.deleteValue(a)},t.setSpanContext=function(e,t){return l(e,new i.NonRecordingSpan(t))},t.getSpanContext=function(e){var t;return null===(t=s(e))||void 0===t?void 0:t.spanContext()}},325:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TraceStateImpl=void 0;let n=r(564);class i{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,t){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,t),r}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+"="+this.get(t)),e),[]).join(",")}_parse(e){!(e.length>512)&&(this._internalState=e.split(",").reverse().reduce((e,t)=>{let r=t.trim(),i=r.indexOf("=");if(-1!==i){let o=r.slice(0,i),a=r.slice(i+1,t.length);(0,n.validateKey)(o)&&(0,n.validateValue)(a)&&e.set(o,a)}return e},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new i;return e._internalState=new Map(this._internalState),e}}t.TraceStateImpl=i},564:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateValue=t.validateKey=void 0;let r="[_0-9a-z-*/]",n=`[a-z]${r}{0,255}`,i=`[a-z0-9]${r}{0,240}@[a-z]${r}{0,13}`,o=RegExp(`^(?:${n}|${i})$`),a=/^[ -~]{0,255}[!-~]$/,s=/,|=/;t.validateKey=function(e){return o.test(e)},t.validateValue=function(e){return a.test(e)&&!s.test(e)}},98:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createTraceState=void 0;let n=r(325);t.createTraceState=function(e){return new n.TraceStateImpl(e)}},476:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.INVALID_SPAN_CONTEXT=t.INVALID_TRACEID=t.INVALID_SPANID=void 0;let n=r(475);t.INVALID_SPANID="0000000000000000",t.INVALID_TRACEID="00000000000000000000000000000000",t.INVALID_SPAN_CONTEXT={traceId:t.INVALID_TRACEID,spanId:t.INVALID_SPANID,traceFlags:n.TraceFlags.NONE}},357:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SpanKind=void 0,function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"}(t.SpanKind||(t.SpanKind={}))},139:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.wrapSpanContext=t.isSpanContextValid=t.isValidSpanId=t.isValidTraceId=void 0;let n=r(476),i=r(403),o=/^([0-9a-f]{32})$/i,a=/^[0-9a-f]{16}$/i;function s(e){return o.test(e)&&e!==n.INVALID_TRACEID}function l(e){return a.test(e)&&e!==n.INVALID_SPANID}t.isValidTraceId=s,t.isValidSpanId=l,t.isSpanContextValid=function(e){return s(e.traceId)&&l(e.spanId)},t.wrapSpanContext=function(e){return new i.NonRecordingSpan(e)}},847:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SpanStatusCode=void 0,function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"}(t.SpanStatusCode||(t.SpanStatusCode={}))},475:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TraceFlags=void 0,function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"}(t.TraceFlags||(t.TraceFlags={}))},521:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,t.VERSION="1.6.0"}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={exports:{}},a=!0;try{t[e].call(o.exports,o,o.exports,i),a=!1}finally{a&&delete n[e]}return o.exports}i.ab="//";var o={};(()=>{Object.defineProperty(o,"__esModule",{value:!0}),o.trace=o.propagation=o.metrics=o.diag=o.context=o.INVALID_SPAN_CONTEXT=o.INVALID_TRACEID=o.INVALID_SPANID=o.isValidSpanId=o.isValidTraceId=o.isSpanContextValid=o.createTraceState=o.TraceFlags=o.SpanStatusCode=o.SpanKind=o.SamplingDecision=o.ProxyTracerProvider=o.ProxyTracer=o.defaultTextMapSetter=o.defaultTextMapGetter=o.ValueType=o.createNoopMeter=o.DiagLogLevel=o.DiagConsoleLogger=o.ROOT_CONTEXT=o.createContextKey=o.baggageEntryMetadataFromString=void 0;var e=i(369);Object.defineProperty(o,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return e.baggageEntryMetadataFromString}});var t=i(780);Object.defineProperty(o,"createContextKey",{enumerable:!0,get:function(){return t.createContextKey}}),Object.defineProperty(o,"ROOT_CONTEXT",{enumerable:!0,get:function(){return t.ROOT_CONTEXT}});var r=i(972);Object.defineProperty(o,"DiagConsoleLogger",{enumerable:!0,get:function(){return r.DiagConsoleLogger}});var n=i(957);Object.defineProperty(o,"DiagLogLevel",{enumerable:!0,get:function(){return n.DiagLogLevel}});var a=i(102);Object.defineProperty(o,"createNoopMeter",{enumerable:!0,get:function(){return a.createNoopMeter}});var s=i(901);Object.defineProperty(o,"ValueType",{enumerable:!0,get:function(){return s.ValueType}});var l=i(194);Object.defineProperty(o,"defaultTextMapGetter",{enumerable:!0,get:function(){return l.defaultTextMapGetter}}),Object.defineProperty(o,"defaultTextMapSetter",{enumerable:!0,get:function(){return l.defaultTextMapSetter}});var c=i(125);Object.defineProperty(o,"ProxyTracer",{enumerable:!0,get:function(){return c.ProxyTracer}});var u=i(846);Object.defineProperty(o,"ProxyTracerProvider",{enumerable:!0,get:function(){return u.ProxyTracerProvider}});var d=i(996);Object.defineProperty(o,"SamplingDecision",{enumerable:!0,get:function(){return d.SamplingDecision}});var p=i(357);Object.defineProperty(o,"SpanKind",{enumerable:!0,get:function(){return p.SpanKind}});var h=i(847);Object.defineProperty(o,"SpanStatusCode",{enumerable:!0,get:function(){return h.SpanStatusCode}});var f=i(475);Object.defineProperty(o,"TraceFlags",{enumerable:!0,get:function(){return f.TraceFlags}});var m=i(98);Object.defineProperty(o,"createTraceState",{enumerable:!0,get:function(){return m.createTraceState}});var g=i(139);Object.defineProperty(o,"isSpanContextValid",{enumerable:!0,get:function(){return g.isSpanContextValid}}),Object.defineProperty(o,"isValidTraceId",{enumerable:!0,get:function(){return g.isValidTraceId}}),Object.defineProperty(o,"isValidSpanId",{enumerable:!0,get:function(){return g.isValidSpanId}});var y=i(476);Object.defineProperty(o,"INVALID_SPANID",{enumerable:!0,get:function(){return y.INVALID_SPANID}}),Object.defineProperty(o,"INVALID_TRACEID",{enumerable:!0,get:function(){return y.INVALID_TRACEID}}),Object.defineProperty(o,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return y.INVALID_SPAN_CONTEXT}});let w=i(67);Object.defineProperty(o,"context",{enumerable:!0,get:function(){return w.context}});let b=i(506);Object.defineProperty(o,"diag",{enumerable:!0,get:function(){return b.diag}});let v=i(886);Object.defineProperty(o,"metrics",{enumerable:!0,get:function(){return v.metrics}});let _=i(939);Object.defineProperty(o,"propagation",{enumerable:!0,get:function(){return _.propagation}});let S=i(845);Object.defineProperty(o,"trace",{enumerable:!0,get:function(){return S.trace}}),o.default={context:w.context,diag:b.diag,metrics:v.metrics,propagation:_.propagation,trace:S.trace}})(),e.exports=o})()},373:e=>{(()=>{"use strict";"undefined"!=typeof __nccwpck_require__&&(__nccwpck_require__.ab="//");var t={};(()=>{/*!
 * cookie
 * Copyright(c) 2012-2014 Roman Shtylman
 * Copyright(c) 2015 Douglas Christopher Wilson
 * MIT Licensed
 */t.parse=function(t,r){if("string"!=typeof t)throw TypeError("argument str must be a string");for(var i={},o=t.split(n),a=(r||{}).decode||e,s=0;s<o.length;s++){var l=o[s],c=l.indexOf("=");if(!(c<0)){var u=l.substr(0,c).trim(),d=l.substr(++c,l.length).trim();'"'==d[0]&&(d=d.slice(1,-1)),void 0==i[u]&&(i[u]=function(e,t){try{return t(e)}catch(t){return e}}(d,a))}}return i},t.serialize=function(e,t,n){var o=n||{},a=o.encode||r;if("function"!=typeof a)throw TypeError("option encode is invalid");if(!i.test(e))throw TypeError("argument name is invalid");var s=a(t);if(s&&!i.test(s))throw TypeError("argument val is invalid");var l=e+"="+s;if(null!=o.maxAge){var c=o.maxAge-0;if(isNaN(c)||!isFinite(c))throw TypeError("option maxAge is invalid");l+="; Max-Age="+Math.floor(c)}if(o.domain){if(!i.test(o.domain))throw TypeError("option domain is invalid");l+="; Domain="+o.domain}if(o.path){if(!i.test(o.path))throw TypeError("option path is invalid");l+="; Path="+o.path}if(o.expires){if("function"!=typeof o.expires.toUTCString)throw TypeError("option expires is invalid");l+="; Expires="+o.expires.toUTCString()}if(o.httpOnly&&(l+="; HttpOnly"),o.secure&&(l+="; Secure"),o.sameSite)switch("string"==typeof o.sameSite?o.sameSite.toLowerCase():o.sameSite){case!0:case"strict":l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"none":l+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid")}return l};var e=decodeURIComponent,r=encodeURIComponent,n=/; */,i=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/})(),e.exports=t})()},568:(e,t,r)=>{var n;(()=>{var i={226:function(i,o){!function(a,s){"use strict";var l="function",c="undefined",u="object",d="string",p="major",h="model",f="name",m="type",g="vendor",y="version",w="architecture",b="console",v="mobile",_="tablet",S="smarttv",E="wearable",A="embedded",k="Amazon",x="Apple",T="ASUS",R="BlackBerry",P="Browser",O="Chrome",C="Firefox",I="Google",N="Huawei",U="Microsoft",j="Motorola",L="Opera",D="Samsung",M="Sharp",$="Sony",H="Xiaomi",W="Zebra",B="Facebook",K="Chromium OS",q="Mac OS",J=function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},F=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},V=function(e,t){return typeof e===d&&-1!==z(t).indexOf(z(e))},z=function(e){return e.toLowerCase()},G=function(e,t){if(typeof e===d)return e=e.replace(/^\s\s*/,""),typeof t===c?e:e.substring(0,350)},X=function(e,t){for(var r,n,i,o,a,c,d=0;d<t.length&&!a;){var p=t[d],h=t[d+1];for(r=n=0;r<p.length&&!a&&p[r];)if(a=p[r++].exec(e))for(i=0;i<h.length;i++)c=a[++n],typeof(o=h[i])===u&&o.length>0?2===o.length?typeof o[1]==l?this[o[0]]=o[1].call(this,c):this[o[0]]=o[1]:3===o.length?typeof o[1]!==l||o[1].exec&&o[1].test?this[o[0]]=c?c.replace(o[1],o[2]):void 0:this[o[0]]=c?o[1].call(this,c,o[2]):void 0:4===o.length&&(this[o[0]]=c?o[3].call(this,c.replace(o[1],o[2])):void 0):this[o]=c||s;d+=2}},Y=function(e,t){for(var r in t)if(typeof t[r]===u&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(V(t[r][n],e))return"?"===r?s:r}else if(V(t[r],e))return"?"===r?s:r;return e},Z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Q={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[y,[f,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[y,[f,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[f,y],[/opios[\/ ]+([\w\.]+)/i],[y,[f,L+" Mini"]],[/\bopr\/([\w\.]+)/i],[y,[f,L]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[f,y],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[y,[f,"UC"+P]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[y,[f,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[y,[f,"WeChat"]],[/konqueror\/([\w\.]+)/i],[y,[f,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[y,[f,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[y,[f,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[f,/(.+)/,"$1 Secure "+P],y],[/\bfocus\/([\w\.]+)/i],[y,[f,C+" Focus"]],[/\bopt\/([\w\.]+)/i],[y,[f,L+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[y,[f,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[y,[f,"Dolphin"]],[/coast\/([\w\.]+)/i],[y,[f,L+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[y,[f,"MIUI "+P]],[/fxios\/([-\w\.]+)/i],[y,[f,C]],[/\bqihu|(qi?ho?o?|360)browser/i],[[f,"360 "+P]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[f,/(.+)/,"$1 "+P],y],[/(comodo_dragon)\/([\w\.]+)/i],[[f,/_/g," "],y],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[f,y],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[f],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[f,B],y],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[f,y],[/\bgsa\/([\w\.]+) .*safari\//i],[y,[f,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[y,[f,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[y,[f,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[f,O+" WebView"],y],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[y,[f,"Android "+P]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[f,y],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[y,[f,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[y,f],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[f,[y,Y,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[f,y],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[f,"Netscape"],y],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[y,[f,C+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[f,y],[/(cobalt)\/([\w\.]+)/i],[f,[y,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[w,"amd64"]],[/(ia32(?=;))/i],[[w,z]],[/((?:i[346]|x)86)[;\)]/i],[[w,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[w,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[w,"armhf"]],[/windows (ce|mobile); ppc;/i],[[w,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[w,/ower/,"",z]],[/(sun4\w)[;\)]/i],[[w,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[w,z]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[g,D],[m,_]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[h,[g,D],[m,v]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[h,[g,x],[m,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[g,x],[m,_]],[/(macintosh);/i],[h,[g,x]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[g,M],[m,v]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[g,N],[m,_]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[g,N],[m,v]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[h,/_/g," "],[g,H],[m,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[g,H],[m,_]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[g,"OPPO"],[m,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[g,"Vivo"],[m,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[h,[g,"Realme"],[m,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[g,j],[m,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[g,j],[m,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[g,"LG"],[m,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[g,"LG"],[m,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[g,"Lenovo"],[m,_]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[g,"Nokia"],[m,v]],[/(pixel c)\b/i],[h,[g,I],[m,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[g,I],[m,v]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[g,$],[m,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[g,$],[m,_]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[g,"OnePlus"],[m,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[g,k],[m,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[g,k],[m,v]],[/(playbook);[-\w\),; ]+(rim)/i],[h,g,[m,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[g,R],[m,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[g,T],[m,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[g,T],[m,v]],[/(nexus 9)/i],[h,[g,"HTC"],[m,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[g,[h,/_/g," "],[m,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[g,"Acer"],[m,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[g,"Meizu"],[m,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[g,h,[m,v]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[g,h,[m,_]],[/(surface duo)/i],[h,[g,U],[m,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[g,"Fairphone"],[m,v]],[/(u304aa)/i],[h,[g,"AT&T"],[m,v]],[/\bsie-(\w*)/i],[h,[g,"Siemens"],[m,v]],[/\b(rct\w+) b/i],[h,[g,"RCA"],[m,_]],[/\b(venue[\d ]{2,7}) b/i],[h,[g,"Dell"],[m,_]],[/\b(q(?:mv|ta)\w+) b/i],[h,[g,"Verizon"],[m,_]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[g,"Barnes & Noble"],[m,_]],[/\b(tm\d{3}\w+) b/i],[h,[g,"NuVision"],[m,_]],[/\b(k88) b/i],[h,[g,"ZTE"],[m,_]],[/\b(nx\d{3}j) b/i],[h,[g,"ZTE"],[m,v]],[/\b(gen\d{3}) b.+49h/i],[h,[g,"Swiss"],[m,v]],[/\b(zur\d{3}) b/i],[h,[g,"Swiss"],[m,_]],[/\b((zeki)?tb.*\b) b/i],[h,[g,"Zeki"],[m,_]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[g,"Dragon Touch"],h,[m,_]],[/\b(ns-?\w{0,9}) b/i],[h,[g,"Insignia"],[m,_]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[g,"NextBook"],[m,_]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[g,"Voice"],h,[m,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[g,"LvTel"],h,[m,v]],[/\b(ph-1) /i],[h,[g,"Essential"],[m,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[g,"Envizen"],[m,_]],[/\b(trio[-\w\. ]+) b/i],[h,[g,"MachSpeed"],[m,_]],[/\btu_(1491) b/i],[h,[g,"Rotor"],[m,_]],[/(shield[\w ]+) b/i],[h,[g,"Nvidia"],[m,_]],[/(sprint) (\w+)/i],[g,h,[m,v]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[g,U],[m,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[g,W],[m,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[g,W],[m,v]],[/smart-tv.+(samsung)/i],[g,[m,S]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[g,D],[m,S]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[g,"LG"],[m,S]],[/(apple) ?tv/i],[g,[h,x+" TV"],[m,S]],[/crkey/i],[[h,O+"cast"],[g,I],[m,S]],[/droid.+aft(\w)( bui|\))/i],[h,[g,k],[m,S]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[g,M],[m,S]],[/(bravia[\w ]+)( bui|\))/i],[h,[g,$],[m,S]],[/(mitv-\w{5}) bui/i],[h,[g,H],[m,S]],[/Hbbtv.*(technisat) (.*);/i],[g,h,[m,S]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[g,G],[h,G],[m,S]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[m,S]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[g,h,[m,b]],[/droid.+; (shield) bui/i],[h,[g,"Nvidia"],[m,b]],[/(playstation [345portablevi]+)/i],[h,[g,$],[m,b]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[g,U],[m,b]],[/((pebble))app/i],[g,h,[m,E]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[h,[g,x],[m,E]],[/droid.+; (glass) \d/i],[h,[g,I],[m,E]],[/droid.+; (wt63?0{2,3})\)/i],[h,[g,W],[m,E]],[/(quest( 2| pro)?)/i],[h,[g,B],[m,E]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[g,[m,A]],[/(aeobc)\b/i],[h,[g,k],[m,A]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[h,[m,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[m,_]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[m,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[m,v]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[g,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[y,[f,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[y,[f,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[f,y],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[y,f]],os:[[/microsoft (windows) (vista|xp)/i],[f,y],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[f,[y,Y,Z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,"Windows"],[y,Y,Z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[y,/_/g,"."],[f,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[f,q],[y,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[y,f],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[f,y],[/\(bb(10);/i],[y,[f,R]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[y,[f,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[y,[f,C+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[y,[f,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[y,[f,"watchOS"]],[/crkey\/([\d\.]+)/i],[y,[f,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[f,K],y],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[f,y],[/(sunos) ?([\w\.\d]*)/i],[[f,"Solaris"],y],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[f,y]]},ee=function(e,t){if(typeof e===u&&(t=e,e=s),!(this instanceof ee))return new ee(e,t).getResult();var r=typeof a!==c&&a.navigator?a.navigator:s,n=e||(r&&r.userAgent?r.userAgent:""),i=r&&r.userAgentData?r.userAgentData:s,o=t?J(Q,t):Q,b=r&&r.userAgent==n;return this.getBrowser=function(){var e,t={};return t[f]=s,t[y]=s,X.call(t,n,o.browser),t[p]=typeof(e=t[y])===d?e.replace(/[^\d\.]/g,"").split(".")[0]:s,b&&r&&r.brave&&typeof r.brave.isBrave==l&&(t[f]="Brave"),t},this.getCPU=function(){var e={};return e[w]=s,X.call(e,n,o.cpu),e},this.getDevice=function(){var e={};return e[g]=s,e[h]=s,e[m]=s,X.call(e,n,o.device),b&&!e[m]&&i&&i.mobile&&(e[m]=v),b&&"Macintosh"==e[h]&&r&&typeof r.standalone!==c&&r.maxTouchPoints&&r.maxTouchPoints>2&&(e[h]="iPad",e[m]=_),e},this.getEngine=function(){var e={};return e[f]=s,e[y]=s,X.call(e,n,o.engine),e},this.getOS=function(){var e={};return e[f]=s,e[y]=s,X.call(e,n,o.os),b&&!e[f]&&i&&"Unknown"!=i.platform&&(e[f]=i.platform.replace(/chrome os/i,K).replace(/macos/i,q)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===d&&e.length>350?G(e,350):e,this},this.setUA(n),this};ee.VERSION="1.0.35",ee.BROWSER=F([f,y,p]),ee.CPU=F([w]),ee.DEVICE=F([h,g,m,b,v,S,_,E,A]),ee.ENGINE=ee.OS=F([f,y]),typeof o!==c?(i.exports&&(o=i.exports=ee),o.UAParser=ee):r.amdO?void 0!==(n=(function(){return ee}).call(t,r,t,e))&&(e.exports=n):typeof a!==c&&(a.UAParser=ee);var et=typeof a!==c&&(a.jQuery||a.Zepto);if(et&&!et.ua){var er=new ee;et.ua=er.getResult(),et.ua.get=function(){return er.getUA()},et.ua.set=function(e){er.setUA(e);var t=er.getResult();for(var r in t)et.ua[r]=t[r]}}}("object"==typeof window?window:this)}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}},n=!0;try{i[e].call(r.exports,r,r.exports,a),n=!1}finally{n&&delete o[e]}return r.exports}a.ab="//";var s=a(226);e.exports=s})()},566:(e,t,r)=>{"use strict";r.r(t),r.d(t,{bailoutToClientRendering:()=>o});class n extends Error{constructor(e){super("Bail out to client-side rendering: "+e),this.reason=e,this.digest="BAILOUT_TO_CLIENT_SIDE_RENDERING"}}var i=r(850);function o(e){let t=i.A.getStore();if((null==t||!t.forceStatic)&&(null==t?void 0:t.isStaticGeneration))throw new n(e)}},850:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(612).P)()},387:e=>{"use strict";e.exports=["chrome 64","edge 79","firefox 67","opera 51","safari 12"]},703:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getTestReqInfo:function(){return a},withRequest:function(){return o}});let n=new(r(67)).AsyncLocalStorage;function i(e,t){let r=t.header(e,"next-test-proxy-port");if(r)return{url:t.url(e),proxyPort:Number(r),testData:t.header(e,"next-test-data")||""}}function o(e,t,r){let o=i(e,t);return o?n.run(o,r):r()}function a(e,t){return n.getStore()||(e&&t?i(e,t):void 0)}},407:(e,t,r)=>{"use strict";var n=r(195).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{handleFetch:function(){return s},interceptFetch:function(){return l},reader:function(){return o}});let i=r(703),o={url:e=>e.url,header:(e,t)=>e.headers.get(t)};async function a(e,t){let{url:r,method:i,headers:o,body:a,cache:s,credentials:l,integrity:c,mode:u,redirect:d,referrer:p,referrerPolicy:h}=t;return{testData:e,api:"fetch",request:{url:r,method:i,headers:[...Array.from(o),["next-test-stack",function(){let e=(Error().stack??"").split("\n");for(let t=1;t<e.length;t++)if(e[t].length>0){e=e.slice(t);break}return(e=(e=(e=e.filter(e=>!e.includes("/next/dist/"))).slice(0,5)).map(e=>e.replace("webpack-internal:///(rsc)/","").trim())).join("    ")}()]],body:a?n.from(await t.arrayBuffer()).toString("base64"):null,cache:s,credentials:l,integrity:c,mode:u,redirect:d,referrer:p,referrerPolicy:h}}}async function s(e,t){let r=(0,i.getTestReqInfo)(t,o);if(!r)return e(t);let{testData:s,proxyPort:l}=r,c=await a(s,t),u=await e(`http://localhost:${l}`,{method:"POST",body:JSON.stringify(c),next:{internal:!0}});if(!u.ok)throw Error(`Proxy request failed: ${u.status}`);let d=await u.json(),{api:p}=d;switch(p){case"continue":return e(t);case"abort":case"unhandled":throw Error(`Proxy request aborted [${t.method} ${t.url}]`)}return function(e){let{status:t,headers:r,body:i}=e.response;return new Response(i?n.from(i,"base64"):null,{status:t,headers:new Headers(r)})}(d)}function l(e){return r.g.fetch=function(t,r){var n;return(null==r?void 0:null==(n=r.next)?void 0:n.internal)?e(t,r):s(e,new Request(t,r))},()=>{r.g.fetch=e}}},311:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{interceptTestApis:function(){return o},wrapRequestHandler:function(){return a}});let n=r(703),i=r(407);function o(){return(0,i.interceptFetch)(r.g.fetch)}function a(e){return(t,r)=>(0,n.withRequest)(t,i.reader,()=>e(t,r))}},222:(e,t)=>{"use strict";/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.iterator,f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,g={};function y(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||f}function w(){}function b(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||f}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},w.prototype=y.prototype;var v=b.prototype=new w;v.constructor=b,m(v,y.prototype),v.isPureReactComponent=!0;var _=Array.isArray,S=Object.prototype.hasOwnProperty,E={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function k(e,t,n){var i,o={},a=null,s=null;if(null!=t)for(i in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(a=""+t.key),t)S.call(t,i)&&!A.hasOwnProperty(i)&&(o[i]=t[i]);var l=arguments.length-2;if(1===l)o.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];o.children=c}if(e&&e.defaultProps)for(i in l=e.defaultProps)void 0===o[i]&&(o[i]=l[i]);return{$$typeof:r,type:e,key:a,ref:s,props:o,_owner:E.current}}function x(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var T=/\/+/g;function R(e,t){var r,n;return"object"==typeof e&&null!==e&&null!=e.key?(r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,function(e){return n[e]})):t.toString(36)}function P(e,t,i){if(null==e)return e;var o=[],a=0;return!function e(t,i,o,a,s){var l,c,u,d=typeof t;("undefined"===d||"boolean"===d)&&(t=null);var p=!1;if(null===t)p=!0;else switch(d){case"string":case"number":p=!0;break;case"object":switch(t.$$typeof){case r:case n:p=!0}}if(p)return s=s(p=t),t=""===a?"."+R(p,0):a,_(s)?(o="",null!=t&&(o=t.replace(T,"$&/")+"/"),e(s,i,o,"",function(e){return e})):null!=s&&(x(s)&&(l=s,c=o+(!s.key||p&&p.key===s.key?"":(""+s.key).replace(T,"$&/")+"/")+t,s={$$typeof:r,type:l.type,key:c,ref:l.ref,props:l.props,_owner:l._owner}),i.push(s)),1;if(p=0,a=""===a?".":a+":",_(t))for(var f=0;f<t.length;f++){var m=a+R(d=t[f],f);p+=e(d,i,o,m,s)}else if("function"==typeof(m=null===(u=t)||"object"!=typeof u?null:"function"==typeof(u=h&&u[h]||u["@@iterator"])?u:null))for(t=m.call(t),f=0;!(d=t.next()).done;)m=a+R(d=d.value,f++),p+=e(d,i,o,m,s);else if("object"===d)throw Error("Objects are not valid as a React child (found: "+("[object Object]"===(i=String(t))?"object with keys {"+Object.keys(t).join(", ")+"}":i)+"). If you meant to render a collection of children, use an array instead.");return p}(e,o,"","",function(e){return t.call(i,e,a++)}),o}function O(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var C={current:null},I={transition:null};function N(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:P,forEach:function(e,t,r){P(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!x(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=y,t.Fragment=i,t.Profiler=a,t.PureComponent=b,t.StrictMode=o,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED={ReactCurrentDispatcher:C,ReactCurrentBatchConfig:I,ReactCurrentOwner:E},t.act=N,t.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=m({},e.props),o=e.key,a=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(a=t.ref,s=E.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)S.call(t,c)&&!A.hasOwnProperty(c)&&(i[c]=void 0===t[c]&&void 0!==l?l[c]:t[c])}var c=arguments.length-2;if(1===c)i.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];i.children=l}return{$$typeof:r,type:e.type,key:o,ref:a,props:i,_owner:s}},t.createContext=function(e){return(e={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=k,t.createFactory=function(e){var t=k.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=x,t.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:O}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=I.transition;I.transition={};try{e()}finally{I.transition=t}},t.unstable_act=N,t.useCallback=function(e,t){return C.current.useCallback(e,t)},t.useContext=function(e){return C.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return C.current.useDeferredValue(e)},t.useEffect=function(e,t){return C.current.useEffect(e,t)},t.useId=function(){return C.current.useId()},t.useImperativeHandle=function(e,t,r){return C.current.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return C.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return C.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return C.current.useMemo(e,t)},t.useReducer=function(e,t,r){return C.current.useReducer(e,t,r)},t.useRef=function(e){return C.current.useRef(e)},t.useState=function(e){return C.current.useState(e)},t.useSyncExternalStore=function(e,t,r){return C.current.useSyncExternalStore(e,t,r)},t.useTransition=function(){return C.current.useTransition()},t.version="18.3.1"},942:(e,t,r)=>{"use strict";e.exports=r(222)},612:(e,t,r)=>{"use strict";r.d(t,{P:()=>a});let n=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class i{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}}let o=globalThis.AsyncLocalStorage;function a(){return o?new o:new i}}},e=>{var t=e(e.s=477);(_ENTRIES="undefined"==typeof _ENTRIES?{}:_ENTRIES).middleware_middleware=t}]);
//# sourceMappingURL=middleware.js.map