"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3687],{73687:function(e,t,n){n.d(t,{OK:function(){return E},td:function(){return C},x4:function(){return P},nP:function(){return N},mQ:function(){return D}});var r,a,o=n(67294),l=n.t(o,2),u=n(72677);function i(e,t={}){let n=o.createContext({descendants:[],registerDescendant:()=>u.ZT,...t});return n.displayName=e,n}function c(e,t,n){let r=(0,u.NW)(),{registerDescendant:a,descendants:l}=o.useContext(t),i=n??l.findIndex(t=>t.element===e.element);return(0,u.LI)(()=>(e.element||r(),a({...e,index:i})),[e,r,i,a,...Object.values(e)]),i}function s(){return o.useState([])}function f({context:e,children:t,items:n,set:r}){let a=o.useCallback(({element:e,index:t,...n})=>e?(r(r=>{if(null!=t&&-1!==t)return m(r,{element:e,index:t,...n},t);if(0===r.length)return[{...n,element:e,index:0}];if(r.find(t=>t.element===e))return console.warn("[reach-ui]: `useDescendant` was called with an element that was already registered.\n\nIf you are using the `@reach/descendants` package directly, make sure to only register descendants once. Registering a descendant more than once will lead to bugs in your app.\n\nIf you are using another `reach-ui` package, this is probably our bug!\n\nTo report a bug, open a new issue:\n\n https://github.com/reach/reach-ui/issues/new?assignees=&labels=&template=Bug_report.md\n\nIMPORTANT: this check will only run in the development build, so if you see this warning please be aware that your app may crash when deployed."),r.sort((e,t)=>e.element&&t.element?d(e.element,t.element)?-1:1:0).map((e,t)=>({...e,index:t}));let a=function(e,t){if(!t||!e.length)return -1;let n=e.length;for(;n--;){let r=e[n].element;if(r&&d(r,t))return n+1}return -1}(r,e);return -1===a?[...r,{...n,element:e,index:r.length}]:m(r,{...n,element:e,index:a},a)}),()=>{e&&r(t=>t.filter(t=>e!==t.element))}):u.ZT,[]);return o.createElement(e.Provider,{value:o.useMemo(()=>({descendants:n,registerDescendant:a}),[n,a])},t)}function d(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function m(e,t,n){return null!=n&&n in e?[...e.slice(0,n),t,...e.slice(n)]:[...e,t]}var b=!1,p=0,h=l["useId".toString()],w=i("TabsDescendantsContext"),v=i("TabPanelDescendantsContext"),[g,y]=(0,u.kr)("Tabs"),x=((r=x||{}).Auto="auto",r.Manual="manual",r),k=((a=k||{}).Horizontal="horizontal",a.Vertical="vertical",a),D=o.forwardRef(({as:e="div",children:t,defaultIndex:n,orientation:r="horizontal",index:a,keyboardActivation:l="auto",onChange:i,readOnly:c=!1,...d},m)=>{let{current:v}=o.useRef(void 0!==a),y=function(e){if(void 0!==h){let t=h();return e??t}let t=e??(b?++p:null),[n,r]=o.useState(t);return(0,u.LI)(()=>{null===n&&r(++p)},[]),o.useEffect(()=>{!1===b&&(b=!0)},[]),e??n??void 0}(d.id||"tabs"),x=o.useRef(null),k=o.useRef(!1),[D,R]=(0,u.zk)({controlledValue:a,defaultValue:n??0,calledFrom:"Tabs"}),[C,E]=o.useState(-1),[T,N]=s(),P=o.useCallback(()=>{x.current&&(0,u.mf)(x.current.focus)&&x.current.focus()},[]),I=o.useCallback(e=>{i&&i(e),R(e)},[i,R]),S=o.useCallback(e=>{let t=T[e]?.element,n=(0,u.r3)(t);"auto"===l&&(i&&i(e),R(e)),t&&t!==n.activeElement&&(0,u.mf)(t.focus)&&t.focus()},[l,i,R,T]);return o.createElement(f,{context:w,items:T,set:N},o.createElement(g,{focusedIndex:C,id:y,isControlled:v,isRTL:k,keyboardActivation:l,onFocusPanel:P,onSelectTab:c?u.ZT:I,onSelectTabWithKeyboard:c?u.ZT:S,orientation:r,selectedIndex:D,selectedPanelRef:x,setFocusedIndex:E,setSelectedIndex:R},o.createElement(e,{...d,ref:m,"data-reach-tabs":"","data-orientation":r,id:d.id},(0,u.mf)(t)?t({focusedIndex:C,id:y,selectedIndex:D}):t)))});D.displayName="Tabs";var R=o.forwardRef(({children:e,as:t="div",onKeyDown:n,...r},a)=>{let{focusedIndex:l,isControlled:i,isRTL:c,keyboardActivation:s,onSelectTabWithKeyboard:f,orientation:d,selectedIndex:m,setSelectedIndex:b}=y("TabList"),p=o.useContext(w).descendants,h=o.useRef(null),v=(0,u.ex)(a,h);o.useEffect(()=>{h.current&&(h.current.ownerDocument&&"rtl"===h.current.ownerDocument.dir||"rtl"===(0,u.Dx)(h.current,"direction"))&&(c.current=!0)},[c]);let g=(0,u.Mj)(n,function(e,t){let{descendants:n}=o.useContext(e),{callback:r,currentIndex:a,filter:l,key:u="index",orientation:i="vertical",rotate:c=!0,rtl:s=!1}=t;return function(e){if(!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"].includes(e.key))return;let t=a??-1,o=l?n.filter(l):n;if(!o.length)return;let f=o.findIndex(e=>e.index===a);function d(){return t===b().index?c?o[0]:o[f]:o[(f+1)%o.length]}function m(){return t===o[0].index?c?b():o[f]:o[(f-1+o.length)%o.length]}function b(){return o[o.length-1]}switch(e.key){case"ArrowDown":if("vertical"===i||"both"===i){e.preventDefault();let t=d();r("option"===u?t:t[u])}break;case"ArrowUp":if("vertical"===i||"both"===i){e.preventDefault();let t=m();r("option"===u?t:t[u])}break;case"ArrowLeft":if("horizontal"===i||"both"===i){e.preventDefault();let t=(s?d:m)();r("option"===u?t:t[u])}break;case"ArrowRight":if("horizontal"===i||"both"===i){e.preventDefault();let t=(s?m:d)();r("option"===u?t:t[u])}break;case"PageUp":e.preventDefault();let p=(e.ctrlKey?m:function(){return o[0]})();r("option"===u?p:p[u]);break;case"Home":e.preventDefault();let h=o[0];r("option"===u?h:h[u]);break;case"PageDown":e.preventDefault();let w=(e.ctrlKey?d:b)();r("option"===u?w:w[u]);break;case"End":e.preventDefault();let v=b();r("option"===u?v:v[u])}}}(w,{currentIndex:"manual"===s?l:m,orientation:d,rotate:!0,callback:f,filter:e=>!e.disabled,rtl:c.current}));return(0,u.LI)(()=>{var e;if(!i&&("true"===(e=p[m]?.disabled)||(0,u.jn)(e)&&e)){let e=p.find(e=>!e.disabled);e&&b(e.index)}},[p,i,m,b]),o.createElement(t,{role:"tablist","aria-orientation":d,...r,"data-reach-tab-list":"",ref:v,onKeyDown:g},e)});R.displayName="TabList";var C=o.memo(R);C.displayName="TabList";var E=o.forwardRef(({isSelected:e,children:t,as:n="button",index:r,disabled:a,onBlur:l,onFocus:i,...s},f)=>{let{id:d,onSelectTab:m,orientation:b,selectedIndex:p,setFocusedIndex:h}=y("Tab"),v=o.useRef(null),[g,x]=(0,u.BR)(v,null),k=(0,u.ex)(f,x),D=c(o.useMemo(()=>({element:g,disabled:!!a}),[a,g]),w,r),R="button"===n&&null==s.type?"button":s.type,C=D===p;return o.createElement(n,{"aria-controls":(0,u.qR)(d,"panel",D),"aria-disabled":a,"aria-selected":C,role:"tab",tabIndex:C?0:-1,...s,ref:k,"data-reach-tab":"","data-orientation":b,"data-selected":C?"":void 0,disabled:a,id:(0,u.qR)(d,"tab",D),onClick:function(){m(D)},onFocus:(0,u.Mj)(i,()=>{h(D)}),onBlur:(0,u.Mj)(l,()=>{h(-1)}),type:R},t)});E.displayName="Tab";var T=o.forwardRef(({children:e,as:t="div",...n},r)=>{let a=o.useRef(),l=(0,u.ex)(a,r),[i,c]=s();return o.createElement(f,{context:v,items:i,set:c},o.createElement(t,{...n,ref:l,"data-reach-tab-panels":""},e))});T.displayName="TabPanels";var N=o.memo(T);N.displayName="TabPanels";var P=o.forwardRef(({children:e,"aria-label":t,as:n="div",index:r,...a},l)=>{let{selectedPanelRef:i,selectedIndex:s,id:f}=y("TabPanel"),d=o.useRef(null),[m,b]=(0,u.BR)(d,null),p=c(o.useMemo(()=>({element:m}),[m]),v,r),h=(0,u.qR)(f,"panel",p),w=p===s,g=o.useRef(!1),x=!!g.current&&!w;o.useEffect(()=>{g.current=!0},[]);let k=(0,u.ex)(l,b,w?i:null);return o.createElement(n,{"aria-labelledby":(0,u.qR)(f,"tab",p),hidden:x,role:"tabpanel",tabIndex:w?0:-1,...a,ref:k,"data-reach-tab-panel":"",id:h},e)});P.displayName="TabPanel"},72677:function(e,t,n){n.d(t,{BR:function(){return w},Dx:function(){return s},LI:function(){return h},Mj:function(){return o},NW:function(){return p},ZT:function(){return m},ex:function(){return i},jn:function(){return l},kr:function(){return f},mf:function(){return u},qR:function(){return d},r3:function(){return c},zk:function(){return b}});var r=n(67294);function a(){return!!("undefined"!=typeof window&&window.document&&window.document.createElement)}function o(e,t){return n=>{if(e&&e(n),!n.defaultPrevented)return t(n)}}function l(e){return"boolean"==typeof e}function u(e){return!!(e&&"[object Function]"==({}).toString.call(e))}function i(...e){return(0,r.useCallback)(t=>{for(let n of e)!function(e,t){if(null!=e){if(u(e))e(t);else try{e.current=t}catch(n){throw Error(`Cannot assign value "${t}" to ref "${e}"`)}}}(n,t)},e)}function c(e){return a()?e?e.ownerDocument:document:null}function s(e,t){let n,r;return((r=(n=c(e))?n.defaultView||window:null)?r.getComputedStyle(e,null):null)?.getPropertyValue(t)||null}function f(e,t){let n=r.createContext(t);function a(e){let{children:t,...a}=e,o=r.useMemo(()=>a,Object.values(a));return r.createElement(n.Provider,{value:o},t)}return n.displayName=`${e}Context`,a.displayName=`${e}Provider`,[a,function(a){let o=r.useContext(n);if(o)return o;if(t)return t;throw Error(`${a} must be rendered inside of a ${e} component.`)}]}function d(...e){return e.filter(e=>null!=e).join("--")}function m(){}function b({controlledValue:e,defaultValue:t,calledFrom:n="A component"}){let a=void 0!==e,o=(0,r.useRef)(a);!o.current&&a&&console.warn(`${n} is changing from controlled to uncontrolled. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),o.current&&!a&&console.warn(`${n} is changing from uncontrolled to controlled. Components should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);let[l,u]=(0,r.useState)(o.current?e:t),i=(0,r.useCallback)(e=>{o.current||u(e)},[]);return[o.current?e:l,i]}function p(){let[,e]=(0,r.useState)(Object.create(null));return(0,r.useCallback)(()=>{e(Object.create(null))},[])}var h=a()?r.useLayoutEffect:r.useEffect;function w(e,t){let[n,a]=(0,r.useState)(t);return[n,(0,r.useCallback)(t=>{e.current=t,a(t)},[])]}}}]);