(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[84350],{91750:function(e,i,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/getting-started/providers/slack",function(){return s(11753)}])},84765:function(e,i,s){"use strict";s.d(i,{E:function(){return u}});var t=s(651),n=s(83119),r=s(36045),a=s(84726),l=s(92379);let d="authjs.codeTab.framework";u.Next=p,u.NextClient=k,u.Svelte=x,u.Express=E,u.Qwik=g;let h={[p.name]:"Next.js",[g.name]:"Qwik",[x.name]:"SvelteKit",[E.name]:"Express"},c={[p.name]:"Next.js",[k.name]:"Next.js (Client)",[g.name]:"Qwik",[x.name]:"SvelteKit",[E.name]:"Express"},o=(e,i)=>Object.values(e).findIndex(e=>e.toLowerCase()===i.toLowerCase());function u(e){let{children:i}=e,s=(0,n.useRouter)(),{query:{framework:u}}=s,p=l.Children.toArray(i),{project:x}=(0,r.LU)(),E=p.some(e=>e&&e.type.name===k.name)?c:h,[g,j]=(0,l.useState)(0);return(0,l.useEffect)(()=>{let e=Number(window.localStorage.getItem(d));u?(window.localStorage.setItem(d,String(o(E,u))),j(o(E,u))):e&&j(e)},[u,E]),(0,t.jsx)("div",{className:"[&_div[role='tablist']]:!pb-0",children:(0,t.jsx)(a.m,{storageKey:d,items:Object.values(E),selectedIndex:g,children:Object.keys(E).map(e=>{var i;let n=p.find(i=>{var s;return(null==i?void 0:null===(s=i.type)||void 0===s?void 0:s.name)===e});return Object.keys(null!==(i=null==n?void 0:n.props)&&void 0!==i?i:{}).length?n:(0,t.jsx)(a.m.Tab,{children:(0,t.jsxs)("p",{className:"rounded-lg bg-slate-100 p-6 font-semibold dark:bg-neutral-950",children:[E[e]," not documented yet. Help us by contributing"," ",(0,t.jsx)("a",{className:"underline",target:"_blank",href:"".concat(x.link,"/edit/main/docs/pages").concat(s.pathname,".mdx"),rel:"noreferrer",children:"here"}),"."]})},e)})})})}function k(e){let{children:i}=e;return(0,t.jsx)(a.m.Tab,{children:i})}function p(e){let{children:i}=e;return(0,t.jsx)(a.m.Tab,{children:i})}function x(e){let{children:i}=e;return(0,t.jsx)(a.m.Tab,{children:i})}function E(e){let{children:i}=e;return(0,t.jsx)(a.m.Tab,{children:i})}function g(e){let{children:i}=e;return(0,t.jsx)(a.m.Tab,{children:i})}},11753:function(e,i,s){"use strict";s.r(i),s.d(i,{useTOC:function(){return h}});var t=s(651),n=s(10767),r=s(21461),a=s(16164),l=s(84765),d=s(95779);function h(e){return[{value:"Resources",id:"resources",depth:2},{value:"Setup",id:"setup",depth:2},{value:"Callback URL",id:"callback-url",depth:3},{value:"Environment Variables",id:"environment-variables",depth:3},{value:"Configuration",id:"configuration",depth:3},{value:"Notes",id:"notes",depth:3}]}function c(e,i){throw Error("Expected "+(i?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}i.default=(0,n.c)(function(e){let{toc:i=h(e)}=e,s={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",pre:"pre",span:"span",ul:"ul",...(0,a.a)(),...e.components};return l.E||c("Code",!1),l.E.Express||c("Code.Express",!0),l.E.Next||c("Code.Next",!0),l.E.Qwik||c("Code.Qwik",!0),l.E.Svelte||c("Code.Svelte",!0),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("img",{align:"right",src:"/img/providers/slack.svg",height:"64",width:"64"}),"\n",(0,t.jsx)(s.h1,{children:"Slack Provider"}),"\n",(0,t.jsx)(s.h2,{id:i[0].id,children:i[0].value}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsx)(s.li,{children:(0,t.jsx)(s.a,{href:"https://api.slack.com/authentication",children:"Slack Authentication documentation"})}),"\n",(0,t.jsx)(s.li,{children:(0,t.jsx)(s.a,{href:"https://api.slack.com/docs/sign-in-with-slack",children:"Sign-in with Slack"})}),"\n",(0,t.jsx)(s.li,{children:(0,t.jsx)(s.a,{href:"https://api.slack.com/apps",children:"Slack app console"})}),"\n"]}),"\n",(0,t.jsx)(s.h2,{id:i[1].id,children:i[1].value}),"\n",(0,t.jsx)(s.h3,{id:i[2].id,children:i[2].value}),"\n",(0,t.jsxs)(l.E,{children:[(0,t.jsx)(l.E.Next,{children:(0,t.jsx)(s.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,t.jsx)(s.code,{children:(0,t.jsx)(s.span,{children:(0,t.jsx)(s.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"https://example.com/api/auth/callback/slack"})})})})}),(0,t.jsx)(l.E.Qwik,{children:(0,t.jsx)(s.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,t.jsx)(s.code,{children:(0,t.jsx)(s.span,{children:(0,t.jsx)(s.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"https://example.com/auth/callback/slack"})})})})}),(0,t.jsx)(l.E.Svelte,{children:(0,t.jsx)(s.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,t.jsx)(s.code,{children:(0,t.jsx)(s.span,{children:(0,t.jsx)(s.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"https://example.com/auth/callback/slack"})})})})})]}),"\n",(0,t.jsx)(s.h3,{id:i[3].id,children:i[3].value}),"\n",(0,t.jsx)(s.pre,{"data-word-wrap":"","data-copy":"",children:(0,t.jsx)(s.code,{children:"AUTH_SLACK_ID\nAUTH_SLACK_SECRET\n"})}),"\n",(0,t.jsx)(s.h3,{id:i[4].id,children:i[4].value}),"\n",(0,t.jsxs)(l.E,{children:[(0,t.jsx)(l.E.Next,{children:(0,t.jsx)(s.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"/auth.ts","data-copy":"",children:(0,t.jsxs)(s.code,{children:[(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" NextAuth "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "next-auth"'})]}),"\n",(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" Slack "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "next-auth/providers/slack"'})]}),"\n",(0,t.jsx)(s.span,{children:" "}),"\n",(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"handlers"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"auth"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signIn"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signOut"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" NextAuth"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,t.jsx)(s.span,{children:(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  providers: [Slack],"})}),"\n",(0,t.jsx)(s.span,{children:(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"})"})})]})})}),(0,t.jsx)(l.E.Qwik,{children:(0,t.jsx)(s.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"/src/routes/plugin@auth.ts","data-copy":"",children:(0,t.jsxs)(s.code,{children:[(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { QwikAuth$ } "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/qwik"'})]}),"\n",(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" Slack "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/qwik/providers/slack"'})]}),"\n",(0,t.jsx)(s.span,{children:" "}),"\n",(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"onRequest"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"useSession"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"useSignIn"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"useSignOut"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" QwikAuth$"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("})]}),"\n",(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  () "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"=>"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" ({"})]}),"\n",(0,t.jsx)(s.span,{children:(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    providers: [Slack],"})}),"\n",(0,t.jsx)(s.span,{children:(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  })"})}),"\n",(0,t.jsx)(s.span,{children:(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:")"})})]})})}),(0,t.jsx)(l.E.Svelte,{children:(0,t.jsx)(s.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"/src/auth.ts","data-copy":"",children:(0,t.jsxs)(s.code,{children:[(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { SvelteKitAuth } "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/sveltekit"'})]}),"\n",(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" Slack "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/sveltekit/providers/slack"'})]}),"\n",(0,t.jsx)(s.span,{children:" "}),"\n",(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"handle"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signIn"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signOut"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" SvelteKitAuth"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,t.jsx)(s.span,{children:(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  providers: [Slack],"})}),"\n",(0,t.jsx)(s.span,{children:(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"})"})})]})})}),(0,t.jsx)(l.E.Express,{children:(0,t.jsx)(s.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"/src/app.ts","data-copy":"",children:(0,t.jsxs)(s.code,{children:[(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { ExpressAuth } "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/express"'})]}),"\n",(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" Slack "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/express/providers/slack"'})]}),"\n",(0,t.jsx)(s.span,{children:" "}),"\n",(0,t.jsxs)(s.span,{children:[(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"app."}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"use"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:'"/auth/*"'}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"ExpressAuth"}),(0,t.jsx)(s.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({ providers: [Slack] }))"})]})]})})})]}),"\n",(0,t.jsx)(s.h3,{id:i[5].id,children:i[5].value}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["Slack requires that the redirect URL of your app uses https, even for local development. An easy workaround for this is using a service like ",(0,t.jsx)(s.a,{href:"https://ngrok.com/",children:"ngrok"})," that creates a secure tunnel to your app, using https. Remember to set the url as ",(0,t.jsx)(s.code,{children:"AUTH_URL"})," as well."]}),"\n"]})]})},"/getting-started/providers/slack",{filePath:"pages/getting-started/providers/slack.mdx",timestamp:1728431155e3,pageMap:r.v,frontMatter:{},title:"Slack Provider"},"undefined"==typeof RemoteContent?h:RemoteContent.useTOC)},84726:function(e,i,s){"use strict";let t,n,r;s.d(i,{m:function(){return U}});var a=s(651),l=s(92379),d=s(15902),h=s(88637),c=s(252),o=s(22848),u=s(92400),k=s(97172),p=s(37786),x=s(76179),E=s(59514);function g({onFocus:e}){let[i,s]=(0,l.useState)(!0),t=(0,x.t)();return i?l.createElement(E._,{as:"button",type:"button",features:E.A.Focusable,onFocus:i=>{i.preventDefault();let n,r=50;n=requestAnimationFrame(function i(){if(r--<=0){n&&cancelAnimationFrame(n);return}if(e()){if(cancelAnimationFrame(n),!t.current)return;s(!1);return}n=requestAnimationFrame(i)})}}):null}var j=s(44211),y=s(63399),f=s(96427),m=s(4376),b=s(63574);let v=l.createContext(null);function F({children:e}){let i=l.useRef({groups:new Map,get(e,i){var s;let t=this.groups.get(e);t||(t=new Map,this.groups.set(e,t));let n=null!=(s=t.get(i))?s:0;return t.set(i,n+1),[Array.from(t.keys()).indexOf(i),function(){let e=t.get(i);e>1?t.set(i,e-1):t.delete(i)}]}});return l.createElement(v.Provider,{value:i},e)}function w(e){let i=l.useContext(v);if(!i)throw Error("You must wrap your component in a <StableCollection>");let s=function(){var e,i,s;let t=null!=(s=null==(i=null==(e=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)?void 0:e.ReactCurrentOwner)?void 0:i.current)?s:null;if(!t)return Symbol();let n=[],r=t;for(;r;)n.push(r.index),r=r.return;return"$."+n.join(".")}(),[t,n]=i.current.get(e,s);return l.useEffect(()=>n,[]),t}var C=((t=C||{})[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t),A=((n=A||{})[n.Less=-1]="Less",n[n.Equal=0]="Equal",n[n.Greater=1]="Greater",n),T=((r=T||{})[r.SetSelectedIndex=0]="SetSelectedIndex",r[r.RegisterTab=1]="RegisterTab",r[r.UnregisterTab=2]="UnregisterTab",r[r.RegisterPanel=3]="RegisterPanel",r[r.UnregisterPanel=4]="UnregisterPanel",r);let _={0(e,i){var s;let t=(0,j.z2)(e.tabs,e=>e.current),n=(0,j.z2)(e.panels,e=>e.current),r=t.filter(e=>{var i;return!(null!=(i=e.current)&&i.hasAttribute("disabled"))}),a={...e,tabs:t,panels:n};if(i.index<0||i.index>t.length-1){let s=(0,y.E)(Math.sign(i.index-e.selectedIndex),{[-1]:()=>1,0:()=>(0,y.E)(Math.sign(i.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(0===r.length)return a;let n=(0,y.E)(s,{0:()=>t.indexOf(r[0]),1:()=>t.indexOf(r[r.length-1])});return{...a,selectedIndex:-1===n?e.selectedIndex:n}}let l=t.slice(0,i.index),d=[...t.slice(i.index),...l].find(e=>r.includes(e));if(!d)return a;let h=null!=(s=t.indexOf(d))?s:e.selectedIndex;return -1===h&&(h=e.selectedIndex),{...a,selectedIndex:h}},1(e,i){if(e.tabs.includes(i.tab))return e;let s=e.tabs[e.selectedIndex],t=(0,j.z2)([...e.tabs,i.tab],e=>e.current),n=e.selectedIndex;return e.info.current.isControlled||-1===(n=t.indexOf(s))&&(n=e.selectedIndex),{...e,tabs:t,selectedIndex:n}},2:(e,i)=>({...e,tabs:e.tabs.filter(e=>e!==i.tab)}),3:(e,i)=>e.panels.includes(i.panel)?e:{...e,panels:(0,j.z2)([...e.panels,i.panel],e=>e.current)},4:(e,i)=>({...e,panels:e.panels.filter(e=>e!==i.panel)})},S=(0,l.createContext)(null);function I(e){let i=(0,l.useContext)(S);if(null===i){let i=Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(i,I),i}return i}S.displayName="TabsDataContext";let P=(0,l.createContext)(null);function D(e){let i=(0,l.useContext)(P);if(null===i){let i=Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(i,D),i}return i}function N(e,i){return(0,y.E)(i.type,_,e,i)}P.displayName="TabsActionsContext";let O=l.Fragment,R=b.AN.RenderStrategy|b.AN.Static,B=Object.assign((0,b.yV)(function(e,i){var s,t;let n=(0,c.M)(),{id:r=`headlessui-tabs-tab-${n}`,...a}=e,{orientation:u,activation:x,selectedIndex:E,tabs:g,panels:v}=I("Tab"),F=D("Tab"),C=I("Tab"),A=(0,l.useRef)(null),T=(0,p.T)(A,i);(0,o.e)(()=>F.registerTab(A),[F,A]);let _=w("tabs"),S=g.indexOf(A);-1===S&&(S=_);let P=S===E,N=(0,h.z)(e=>{var i;let s=e();if(s===j.fE.Success&&"auto"===x){let e=null==(i=(0,m.r)(A))?void 0:i.activeElement,s=C.tabs.findIndex(i=>i.current===e);-1!==s&&F.change(s)}return s}),O=(0,h.z)(e=>{let i=g.map(e=>e.current).filter(Boolean);if(e.key===d.R.Space||e.key===d.R.Enter){e.preventDefault(),e.stopPropagation(),F.change(S);return}switch(e.key){case d.R.Home:case d.R.PageUp:return e.preventDefault(),e.stopPropagation(),N(()=>(0,j.jA)(i,j.TO.First));case d.R.End:case d.R.PageDown:return e.preventDefault(),e.stopPropagation(),N(()=>(0,j.jA)(i,j.TO.Last))}if(N(()=>(0,y.E)(u,{vertical:()=>e.key===d.R.ArrowUp?(0,j.jA)(i,j.TO.Previous|j.TO.WrapAround):e.key===d.R.ArrowDown?(0,j.jA)(i,j.TO.Next|j.TO.WrapAround):j.fE.Error,horizontal:()=>e.key===d.R.ArrowLeft?(0,j.jA)(i,j.TO.Previous|j.TO.WrapAround):e.key===d.R.ArrowRight?(0,j.jA)(i,j.TO.Next|j.TO.WrapAround):j.fE.Error}))===j.fE.Success)return e.preventDefault()}),R=(0,l.useRef)(!1),B=(0,h.z)(()=>{var e;R.current||(R.current=!0,null==(e=A.current)||e.focus({preventScroll:!0}),F.change(S),(0,f.Y)(()=>{R.current=!1}))}),L=(0,h.z)(e=>{e.preventDefault()}),M=(0,l.useMemo)(()=>{var i;return{selected:P,disabled:null!=(i=e.disabled)&&i}},[P,e.disabled]),U={ref:T,onKeyDown:O,onMouseDown:L,onClick:B,id:r,role:"tab",type:(0,k.f)(e,A),"aria-controls":null==(t=null==(s=v[S])?void 0:s.current)?void 0:t.id,"aria-selected":P,tabIndex:P?0:-1};return(0,b.sY)({ourProps:U,theirProps:a,slot:M,defaultTag:"button",name:"Tabs.Tab"})}),{Group:(0,b.yV)(function(e,i){let{defaultIndex:s=0,vertical:t=!1,manual:n=!1,onChange:r,selectedIndex:a=null,...d}=e,c=t?"vertical":"horizontal",k=n?"manual":"auto",x=null!==a,E=(0,u.E)({isControlled:x}),y=(0,p.T)(i),[f,m]=(0,l.useReducer)(N,{info:E,selectedIndex:null!=a?a:s,tabs:[],panels:[]}),v=(0,l.useMemo)(()=>({selectedIndex:f.selectedIndex}),[f.selectedIndex]),w=(0,u.E)(r||(()=>{})),C=(0,u.E)(f.tabs),A=(0,l.useMemo)(()=>({orientation:c,activation:k,...f}),[c,k,f]),T=(0,h.z)(e=>(m({type:1,tab:e}),()=>m({type:2,tab:e}))),_=(0,h.z)(e=>(m({type:3,panel:e}),()=>m({type:4,panel:e}))),I=(0,h.z)(e=>{D.current!==e&&w.current(e),x||m({type:0,index:e})}),D=(0,u.E)(x?e.selectedIndex:f.selectedIndex),R=(0,l.useMemo)(()=>({registerTab:T,registerPanel:_,change:I}),[]);return(0,o.e)(()=>{m({type:0,index:null!=a?a:s})},[a]),(0,o.e)(()=>{if(void 0===D.current||f.tabs.length<=0)return;let e=(0,j.z2)(f.tabs,e=>e.current);e.some((e,i)=>f.tabs[i]!==e)&&I(e.indexOf(f.tabs[D.current]))}),l.createElement(F,null,l.createElement(P.Provider,{value:R},l.createElement(S.Provider,{value:A},A.tabs.length<=0&&l.createElement(g,{onFocus:()=>{var e,i;for(let s of C.current)if((null==(e=s.current)?void 0:e.tabIndex)===0)return null==(i=s.current)||i.focus(),!0;return!1}}),(0,b.sY)({ourProps:{ref:y},theirProps:d,slot:v,defaultTag:O,name:"Tabs"}))))}),List:(0,b.yV)(function(e,i){let{orientation:s,selectedIndex:t}=I("Tab.List"),n=(0,p.T)(i);return(0,b.sY)({ourProps:{ref:n,role:"tablist","aria-orientation":s},theirProps:e,slot:{selectedIndex:t},defaultTag:"div",name:"Tabs.List"})}),Panels:(0,b.yV)(function(e,i){let{selectedIndex:s}=I("Tab.Panels"),t=(0,p.T)(i),n=(0,l.useMemo)(()=>({selectedIndex:s}),[s]);return(0,b.sY)({ourProps:{ref:t},theirProps:e,slot:n,defaultTag:"div",name:"Tabs.Panels"})}),Panel:(0,b.yV)(function(e,i){var s,t,n,r;let a=(0,c.M)(),{id:d=`headlessui-tabs-panel-${a}`,tabIndex:h=0,...u}=e,{selectedIndex:k,tabs:x,panels:g}=I("Tab.Panel"),j=D("Tab.Panel"),y=(0,l.useRef)(null),f=(0,p.T)(y,i);(0,o.e)(()=>j.registerPanel(y),[j,y,d]);let m=w("panels"),v=g.indexOf(y);-1===v&&(v=m);let F=v===k,C=(0,l.useMemo)(()=>({selected:F}),[F]),A={ref:f,id:d,role:"tabpanel","aria-labelledby":null==(t=null==(s=x[v])?void 0:s.current)?void 0:t.id,tabIndex:F?h:-1};return F||null!=(n=u.unmount)&&!n||null!=(r=u.static)&&r?(0,b.sY)({ourProps:A,theirProps:u,slot:C,defaultTag:"div",features:R,visible:F,name:"Tabs.Panel"}):l.createElement(E._,{as:"span","aria-hidden":"true",...A})})});var L=s(69577);function M(e){return!!e&&"object"==typeof e&&"label"in e}let U=Object.assign(function({items:e,selectedIndex:i,defaultIndex:s=0,onChange:t,children:n,storageKey:r}){let[d,h]=(0,l.useState)(s);(0,l.useEffect)(()=>{void 0!==i&&h(i)},[i]),(0,l.useEffect)(()=>{if(!r)return;function e(e){e.key===r&&h(Number(e.newValue))}let i=Number(localStorage.getItem(r));return h(Number.isNaN(i)?0:i),window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[]);let c=(0,l.useCallback)(e=>{if(r){let i=String(e);localStorage.setItem(r,i),window.dispatchEvent(new StorageEvent("storage",{key:r,newValue:i}));return}h(e),t?.(e)},[]);return(0,a.jsxs)(B.Group,{selectedIndex:d,defaultIndex:s,onChange:c,children:[(0,a.jsx)("div",{className:"nextra-scrollbar _overflow-x-auto _overflow-y-hidden _overscroll-x-contain",children:(0,a.jsx)(B.List,{className:"_mt-4 _flex _w-max _min-w-full _border-b _border-gray-200 _pb-px dark:_border-neutral-800",children:e.map((e,i)=>{let s=M(e)&&e.disabled;return(0,a.jsx)(B,{disabled:s,className:({selected:e})=>(0,L.Z)("_mr-2 _rounded-t _p-2 _font-medium _leading-5 _transition-colors","_-mb-0.5 _select-none _border-b-2",e?"_border-primary-500 _text-primary-600":"_border-transparent _text-gray-600 hover:_border-gray-200 hover:_text-black dark:_text-gray-200 dark:hover:_border-neutral-800 dark:hover:_text-white",s&&"_pointer-events-none _text-gray-400 dark:_text-neutral-600"),children:M(e)?e.label:e},i)})})}),(0,a.jsx)(B.Panels,{children:n})]})},{displayName:"Tabs",Tab:function({children:e,unmount:i=!1,...s}){return(0,a.jsx)(B.Panel,{...s,unmount:i,className:"_rounded _pt-6",children:e})}})}},function(e){e.O(0,[10767,21461,92888,49774,40179],function(){return e(e.s=91750)}),_N_E=e.O()}]);