(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[73197],{27585:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/reference/supabase-adapter",function(){return r(62909)}])},62909:function(e,t,r){"use strict";r.r(t),r.d(t,{useTOC:function(){return c}});var a=r(651),s=r(64211),n=r(1089),i=r(15593),l=r(63195),d=r(21769);function c(e){return[{value:"Installation",id:"installation",depth:2},{value:"SupabaseAdapterOptions",id:"supabaseadapteroptions",depth:2},{value:"Properties",id:"properties",depth:3},{value:"secret",id:"secret",depth:4},{value:"url",id:"url",depth:4},{value:"SupabaseAdapter()",id:"supabaseadapter",depth:2},{value:"Parameters",id:"parameters",depth:3},{value:"Returns",id:"returns",depth:3},{value:"format()",id:"format",depth:2},{value:"Type parameters",id:"type-parameters",depth:3},{value:"Parameters",id:"parameters-1",depth:3},{value:"Returns",id:"returns-1",depth:3}]}function o(e,t){throw Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}t.default=(0,s.c)(function(e){let{toc:t=c(e)}=e,r={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",hr:"hr",p:"p",pre:"pre",span:"span",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.a)(),...e.components};return l.m||o("$Tabs",!1),l.m.Tab||o("$Tabs.Tab",!0),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.h1,{children:"@auth/supabase-adapter"}),"\n",(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:16},children:[(0,a.jsxs)("p",{children:["Official ",(0,a.jsx)("a",{href:"https://supabase.com/docs",children:"Supabase"})," adapter for Auth.js / NextAuth.js."]}),(0,a.jsx)("a",{href:"https://supabase.com/",children:(0,a.jsx)("img",{style:{display:"block"},src:"https://authjs.dev/img/adapters/supabase.svg",width:"50"})})]}),"\n",(0,a.jsx)(r.h2,{id:t[0].id,children:t[0].value}),"\n",(0,a.jsxs)(l.m,{items:["npm","pnpm","yarn","bun"],storageKey:"selectedPackageManager",children:[(0,a.jsx)(l.m.Tab,{children:(0,a.jsx)(r.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,a.jsx)(r.code,{children:(0,a.jsxs)(r.span,{children:[(0,a.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"npm"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" install"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @supabase/supabase-js"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @auth/supabase-adapter"})]})})})}),(0,a.jsx)(l.m.Tab,{children:(0,a.jsx)(r.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,a.jsx)(r.code,{children:(0,a.jsxs)(r.span,{children:[(0,a.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"pnpm"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" add"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @supabase/supabase-js"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @auth/supabase-adapter"})]})})})}),(0,a.jsx)(l.m.Tab,{children:(0,a.jsx)(r.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,a.jsx)(r.code,{children:(0,a.jsxs)(r.span,{children:[(0,a.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"yarn"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" add"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @supabase/supabase-js"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @auth/supabase-adapter"})]})})})}),(0,a.jsx)(l.m.Tab,{children:(0,a.jsx)(r.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,a.jsx)(r.code,{children:(0,a.jsxs)(r.span,{children:[(0,a.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"bun"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" add"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @supabase/supabase-js"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @auth/supabase-adapter"})]})})})})]}),"\n",(0,a.jsx)(r.h2,{id:t[1].id,children:t[1].value}),"\n",(0,a.jsx)(r.p,{children:"This is the interface of the Supabase adapter options."}),"\n",(0,a.jsx)(r.h3,{id:t[2].id,children:t[2].value}),"\n",(0,a.jsx)(r.h4,{id:t[3].id,children:t[3].value}),"\n",(0,a.jsx)(r.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-copy":"",children:(0,a.jsx)(r.code,{children:(0,a.jsxs)(r.span,{children:[(0,a.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"secret"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:": string;"})]})})}),"\n",(0,a.jsx)(r.p,{children:"The secret to grant access to the database"}),"\n",(0,a.jsx)(r.h4,{id:t[4].id,children:t[4].value}),"\n",(0,a.jsx)(r.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-copy":"",children:(0,a.jsx)(r.code,{children:(0,a.jsxs)(r.span,{children:[(0,a.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"url"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:": string;"})]})})}),"\n",(0,a.jsx)(r.p,{children:"The URL of your Supabase database"}),"\n",(0,a.jsx)(r.hr,{}),"\n",(0,a.jsx)(r.h2,{id:t[5].id,children:t[5].value}),"\n",(0,a.jsx)(r.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-copy":"",children:(0,a.jsx)(r.code,{children:(0,a.jsxs)(r.span,{children:[(0,a.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"SupabaseAdapter"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"(options): Adapter"})]})})}),"\n",(0,a.jsx)(r.h3,{id:t[6].id,children:t[6].value}),"\n",(0,a.jsxs)(r.table,{children:[(0,a.jsx)(r.thead,{children:(0,a.jsxs)(r.tr,{children:[(0,a.jsx)(r.th,{style:{textAlign:"left"},children:"Parameter"}),(0,a.jsx)(r.th,{style:{textAlign:"left"},children:"Type"})]})}),(0,a.jsx)(r.tbody,{children:(0,a.jsxs)(r.tr,{children:[(0,a.jsx)(r.td,{style:{textAlign:"left"},children:(0,a.jsx)(r.code,{children:"options"})}),(0,a.jsx)(r.td,{style:{textAlign:"left"},children:(0,a.jsx)(r.a,{href:"supabase-adapter#supabaseadapteroptions",children:(0,a.jsx)(r.code,{children:"SupabaseAdapterOptions"})})})]})})]}),"\n",(0,a.jsx)(r.h3,{id:t[7].id,children:t[7].value}),"\n",(0,a.jsx)(r.p,{children:(0,a.jsx)(r.a,{href:"express/adapters#adapter",children:(0,a.jsx)(r.code,{children:"Adapter"})})}),"\n",(0,a.jsx)(r.hr,{}),"\n",(0,a.jsx)(r.h2,{id:t[8].id,children:t[8].value}),"\n",(0,a.jsx)(r.pre,{icon:d.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-copy":"",children:(0,a.jsx)(r.code,{children:(0,a.jsxs)(r.span,{children:[(0,a.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"format"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"<"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"T"}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:">(obj): "}),(0,a.jsx)(r.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"T"})]})})}),"\n",(0,a.jsx)(r.h3,{id:t[9].id,children:t[9].value}),"\n",(0,a.jsxs)(r.table,{children:[(0,a.jsx)(r.thead,{children:(0,a.jsx)(r.tr,{children:(0,a.jsx)(r.th,{style:{textAlign:"left"},children:"Type parameter"})})}),(0,a.jsx)(r.tbody,{children:(0,a.jsx)(r.tr,{children:(0,a.jsx)(r.td,{style:{textAlign:"left"},children:(0,a.jsx)(r.code,{children:"T"})})})})]}),"\n",(0,a.jsx)(r.h3,{id:t[10].id,children:t[10].value}),"\n",(0,a.jsxs)(r.table,{children:[(0,a.jsx)(r.thead,{children:(0,a.jsxs)(r.tr,{children:[(0,a.jsx)(r.th,{style:{textAlign:"left"},children:"Parameter"}),(0,a.jsx)(r.th,{style:{textAlign:"left"},children:"Type"})]})}),(0,a.jsx)(r.tbody,{children:(0,a.jsxs)(r.tr,{children:[(0,a.jsx)(r.td,{style:{textAlign:"left"},children:(0,a.jsx)(r.code,{children:"obj"})}),(0,a.jsxs)(r.td,{style:{textAlign:"left"},children:[(0,a.jsx)(r.a,{href:"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type",children:(0,a.jsx)(r.code,{children:"Record"})}),"<",(0,a.jsx)(r.code,{children:"string"}),", ",(0,a.jsx)(r.code,{children:"any"}),">"]})]})})]}),"\n",(0,a.jsx)(r.h3,{id:t[11].id,children:t[11].value}),"\n",(0,a.jsx)(r.p,{children:(0,a.jsx)(r.code,{children:"T"})})]})},"/reference/supabase-adapter",{filePath:"pages/reference/supabase-adapter.mdx",pageMap:n.v,frontMatter:{},title:"@auth/supabase-adapter"},"undefined"==typeof RemoteContent?c:RemoteContent.useTOC)},63195:function(e,t,r){"use strict";let a,s,n;r.d(t,{m:function(){return K}});var i=r(651),l=r(11263),d=r(68662),c=r(92379),o=r(71452),u=r(45542),h=r(76192),p=r(72099),x=r(70207),b=r(50827),f=r(87327);function j({onFocus:e}){let t;let[r,a]=(0,c.useState)(!0),s=(t=(0,c.useRef)(!1),(0,h.e)(()=>(t.current=!0,()=>{t.current=!1}),[]),t);return r?c.createElement(f._,{as:"button",type:"button",features:f.x.Focusable,onFocus:t=>{t.preventDefault();let r,n=50;r=requestAnimationFrame(function t(){if(n--<=0){r&&cancelAnimationFrame(r);return}if(e()){if(cancelAnimationFrame(r),!s.current)return;a(!1);return}r=requestAnimationFrame(t)})}}):null}var g=r(35873),k=r(20237),y=r(76939),m=r(46751),v=r(10138);let E=c.createContext(null);function F({children:e}){let t=c.useRef({groups:new Map,get(e,t){var r;let a=this.groups.get(e);a||(a=new Map,this.groups.set(e,a));let s=null!=(r=a.get(t))?r:0;return a.set(t,s+1),[Array.from(a.keys()).indexOf(t),function(){let e=a.get(t);e>1?a.set(t,e-1):a.delete(t)}]}});return c.createElement(E.Provider,{value:t},e)}function T(e){let t=c.useContext(E);if(!t)throw Error("You must wrap your component in a <StableCollection>");let r=c.useId(),[a,s]=t.current.get(e,r);return c.useEffect(()=>s,[]),a}var w=r(80579),P=((a=P||{})[a.Forwards=0]="Forwards",a[a.Backwards=1]="Backwards",a),I=((s=I||{})[s.Less=-1]="Less",s[s.Equal=0]="Equal",s[s.Greater=1]="Greater",s),_=((n=_||{})[n.SetSelectedIndex=0]="SetSelectedIndex",n[n.RegisterTab=1]="RegisterTab",n[n.UnregisterTab=2]="UnregisterTab",n[n.RegisterPanel=3]="RegisterPanel",n[n.UnregisterPanel=4]="UnregisterPanel",n);let C={0(e,t){var r;let a=(0,g.z2)(e.tabs,e=>e.current),s=(0,g.z2)(e.panels,e=>e.current),n=a.filter(e=>{var t;return!(null!=(t=e.current)&&t.hasAttribute("disabled"))}),i={...e,tabs:a,panels:s};if(t.index<0||t.index>a.length-1){let r=(0,k.E)(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>(0,k.E)(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(0===n.length)return i;let s=(0,k.E)(r,{0:()=>a.indexOf(n[0]),1:()=>a.indexOf(n[n.length-1])});return{...i,selectedIndex:-1===s?e.selectedIndex:s}}let l=a.slice(0,t.index),d=[...a.slice(t.index),...l].find(e=>n.includes(e));if(!d)return i;let c=null!=(r=a.indexOf(d))?r:e.selectedIndex;return -1===c&&(c=e.selectedIndex),{...i,selectedIndex:c}},1(e,t){if(e.tabs.includes(t.tab))return e;let r=e.tabs[e.selectedIndex],a=(0,g.z2)([...e.tabs,t.tab],e=>e.current),s=e.selectedIndex;return e.info.current.isControlled||-1===(s=a.indexOf(r))&&(s=e.selectedIndex),{...e,tabs:a,selectedIndex:s}},2:(e,t)=>({...e,tabs:e.tabs.filter(e=>e!==t.tab)}),3:(e,t)=>e.panels.includes(t.panel)?e:{...e,panels:(0,g.z2)([...e.panels,t.panel],e=>e.current)},4:(e,t)=>({...e,panels:e.panels.filter(e=>e!==t.panel)})},A=(0,c.createContext)(null);function S(e){let t=(0,c.useContext)(A);if(null===t){let t=Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,S),t}return t}A.displayName="TabsDataContext";let R=(0,c.createContext)(null);function O(e){let t=(0,c.useContext)(R);if(null===t){let t=Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,O),t}return t}function B(e,t){return(0,k.E)(t.type,C,e,t)}R.displayName="TabsActionsContext";let N=v.VN.RenderStrategy|v.VN.Static,M=(0,v.yV)(function(e,t){var r,a;let s=(0,c.useId)(),{id:n=`headlessui-tabs-tab-${s}`,disabled:i=!1,autoFocus:p=!1,...f}=e,{orientation:j,activation:E,selectedIndex:F,tabs:P,panels:I}=S("Tab"),_=O("Tab"),C=S("Tab"),[A,R]=(0,c.useState)(null),B=(0,c.useRef)(null),N=(0,b.T)(B,t,R);(0,h.e)(()=>_.registerTab(B),[_,B]);let M=T("tabs"),z=P.indexOf(B);-1===z&&(z=M);let D=z===F,L=(0,u.z)(e=>{var t;let r=e();if(r===g.fE.Success&&"auto"===E){let e=null==(t=(0,m.r)(B))?void 0:t.activeElement,r=C.tabs.findIndex(t=>t.current===e);-1!==r&&_.change(r)}return r}),V=(0,u.z)(e=>{let t=P.map(e=>e.current).filter(Boolean);if(e.key===w.R.Space||e.key===w.R.Enter){e.preventDefault(),e.stopPropagation(),_.change(z);return}switch(e.key){case w.R.Home:case w.R.PageUp:return e.preventDefault(),e.stopPropagation(),L(()=>(0,g.jA)(t,g.TO.First));case w.R.End:case w.R.PageDown:return e.preventDefault(),e.stopPropagation(),L(()=>(0,g.jA)(t,g.TO.Last))}if(L(()=>(0,k.E)(j,{vertical:()=>e.key===w.R.ArrowUp?(0,g.jA)(t,g.TO.Previous|g.TO.WrapAround):e.key===w.R.ArrowDown?(0,g.jA)(t,g.TO.Next|g.TO.WrapAround):g.fE.Error,horizontal:()=>e.key===w.R.ArrowLeft?(0,g.jA)(t,g.TO.Previous|g.TO.WrapAround):e.key===w.R.ArrowRight?(0,g.jA)(t,g.TO.Next|g.TO.WrapAround):g.fE.Error}))===g.fE.Success)return e.preventDefault()}),G=(0,c.useRef)(!1),U=(0,u.z)(()=>{var e;G.current||(G.current=!0,null==(e=B.current)||e.focus({preventScroll:!0}),_.change(z),(0,y.Y)(()=>{G.current=!1}))}),Y=(0,u.z)(e=>{e.preventDefault()}),{isFocusVisible:K,focusProps:$}=(0,l.F)({autoFocus:p}),{isHovered:q,hoverProps:W}=(0,d.X)({isDisabled:i}),{pressed:X,pressProps:H}=(0,o.x)({disabled:i}),Z=(0,c.useMemo)(()=>({selected:D,hover:q,active:X,focus:K,autofocus:p,disabled:i}),[D,q,K,X,p,i]),J=(0,v.dG)({ref:N,onKeyDown:V,onMouseDown:Y,onClick:U,id:n,role:"tab",type:(0,x.f)(e,A),"aria-controls":null==(a=null==(r=I[z])?void 0:r.current)?void 0:a.id,"aria-selected":D,tabIndex:D?0:-1,disabled:i||void 0,autoFocus:p},$,W,H);return(0,v.sY)({ourProps:J,theirProps:f,slot:Z,defaultTag:"button",name:"Tabs.Tab"})}),z=(0,v.yV)(function(e,t){let{defaultIndex:r=0,vertical:a=!1,manual:s=!1,onChange:n,selectedIndex:i=null,...l}=e,d=a?"vertical":"horizontal",o=s?"manual":"auto",x=null!==i,f=(0,p.E)({isControlled:x}),k=(0,b.T)(t),[y,m]=(0,c.useReducer)(B,{info:f,selectedIndex:null!=i?i:r,tabs:[],panels:[]}),E=(0,c.useMemo)(()=>({selectedIndex:y.selectedIndex}),[y.selectedIndex]),T=(0,p.E)(n||(()=>{})),w=(0,p.E)(y.tabs),P=(0,c.useMemo)(()=>({orientation:d,activation:o,...y}),[d,o,y]),I=(0,u.z)(e=>(m({type:1,tab:e}),()=>m({type:2,tab:e}))),_=(0,u.z)(e=>(m({type:3,panel:e}),()=>m({type:4,panel:e}))),C=(0,u.z)(e=>{S.current!==e&&T.current(e),x||m({type:0,index:e})}),S=(0,p.E)(x?e.selectedIndex:y.selectedIndex),O=(0,c.useMemo)(()=>({registerTab:I,registerPanel:_,change:C}),[]);return(0,h.e)(()=>{m({type:0,index:null!=i?i:r})},[i]),(0,h.e)(()=>{if(void 0===S.current||y.tabs.length<=0)return;let e=(0,g.z2)(y.tabs,e=>e.current);e.some((e,t)=>y.tabs[t]!==e)&&C(e.indexOf(y.tabs[S.current]))}),c.createElement(F,null,c.createElement(R.Provider,{value:O},c.createElement(A.Provider,{value:P},P.tabs.length<=0&&c.createElement(j,{onFocus:()=>{var e,t;for(let r of w.current)if((null==(e=r.current)?void 0:e.tabIndex)===0)return null==(t=r.current)||t.focus(),!0;return!1}}),(0,v.sY)({ourProps:{ref:k},theirProps:l,slot:E,defaultTag:"div",name:"Tabs"}))))}),D=(0,v.yV)(function(e,t){let{orientation:r,selectedIndex:a}=S("Tab.List"),s=(0,b.T)(t),n=(0,c.useMemo)(()=>({selectedIndex:a}),[a]);return(0,v.sY)({ourProps:{ref:s,role:"tablist","aria-orientation":r},theirProps:e,slot:n,defaultTag:"div",name:"Tabs.List"})}),L=(0,v.yV)(function(e,t){let{selectedIndex:r}=S("Tab.Panels"),a=(0,b.T)(t),s=(0,c.useMemo)(()=>({selectedIndex:r}),[r]);return(0,v.sY)({ourProps:{ref:a},theirProps:e,slot:s,defaultTag:"div",name:"Tabs.Panels"})}),V=(0,v.yV)(function(e,t){var r,a,s,n;let i=(0,c.useId)(),{id:d=`headlessui-tabs-panel-${i}`,tabIndex:o=0,...u}=e,{selectedIndex:p,tabs:x,panels:j}=S("Tab.Panel"),g=O("Tab.Panel"),k=(0,c.useRef)(null),y=(0,b.T)(k,t);(0,h.e)(()=>g.registerPanel(k),[g,k]);let m=T("panels"),E=j.indexOf(k);-1===E&&(E=m);let F=E===p,{isFocusVisible:w,focusProps:P}=(0,l.F)(),I=(0,c.useMemo)(()=>({selected:F,focus:w}),[F,w]),_=(0,v.dG)({ref:y,id:d,role:"tabpanel","aria-labelledby":null==(a=null==(r=x[E])?void 0:r.current)?void 0:a.id,tabIndex:F?o:-1},P);return F||null!=(s=u.unmount)&&!s||null!=(n=u.static)&&n?(0,v.sY)({ourProps:_,theirProps:u,slot:I,defaultTag:"div",features:N,visible:F,name:"Tabs.Panel"}):c.createElement(f._,{"aria-hidden":"true",..._})}),G=Object.assign(M,{Group:z,List:D,Panels:L,Panel:V});var U=r(69577);function Y(e){return!!e&&"object"==typeof e&&"label"in e}let K=Object.assign(function({items:e,selectedIndex:t,defaultIndex:r=0,onChange:a,children:s,storageKey:n}){let[l,d]=(0,c.useState)(r);(0,c.useEffect)(()=>{void 0!==t&&d(t)},[t]),(0,c.useEffect)(()=>{if(!n)return;function e(e){e.key===n&&d(Number(e.newValue))}let t=Number(localStorage.getItem(n));return d(Number.isNaN(t)?0:t),window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[]);let o=(0,c.useCallback)(e=>{if(n){let t=String(e);localStorage.setItem(n,t),window.dispatchEvent(new StorageEvent("storage",{key:n,newValue:t}));return}d(e),a?.(e)},[]);return(0,i.jsxs)(z,{selectedIndex:l,defaultIndex:r,onChange:o,tabIndex:-1,children:[(0,i.jsx)(D,{className:(0,U.Z)("nextra-scrollbar _overflow-x-auto _overscroll-x-contain _overflow-y-hidden","_mt-4 _flex _w-full _gap-2 _border-b _border-gray-200 _pb-px dark:_border-neutral-800"),children:e.map((e,t)=>(0,i.jsx)(G,{disabled:Y(e)&&e.disabled,className:(0,U.Z)("_ring-inset","_rounded-t _p-2 _font-medium _leading-5 _transition-colors","_-mb-0.5 _select-none _border-b-2","data-[selected]:!_border-current data-[selected]:!_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","disabled:_pointer-events-none disabled:_text-gray-400 disabled:dark:_text-neutral-600"),children:Y(e)?e.label:e},t))}),(0,i.jsx)(L,{children:s})]})},{displayName:"Tabs",Tab:function({children:e,unmount:t=!1,...r}){return(0,i.jsx)(V,{...r,unmount:t,className:"_rounded _mt-6",children:e})}})}},function(e){e.O(0,[64211,1089,92888,49774,40179],function(){return e(e.s=27585)}),_N_E=e.O()}]);