@headlessui/react
Advanced tools
Comparing version 1.1.1 to 1.2.0-2279cd9
@@ -33,3 +33,3 @@ import React, { ElementType, MutableRefObject, Ref } from 'react'; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -50,3 +50,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -67,3 +67,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -84,3 +84,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -101,3 +101,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -118,3 +118,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -135,3 +135,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -152,3 +152,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -169,3 +169,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -186,3 +186,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -203,3 +203,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -220,3 +220,3 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; | ||
} & { | ||
open: boolean; | ||
open?: boolean | undefined; | ||
onClose(value: boolean): void; | ||
@@ -223,0 +223,0 @@ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined; |
@@ -8,3 +8,3 @@ import React, { ElementType } from 'react'; | ||
} | ||
export declare function Portal<TTag extends ElementType = typeof DEFAULT_PORTAL_TAG>(props: Props<TTag, PortalRenderPropArg>): JSX.Element; | ||
export declare function Portal<TTag extends ElementType = typeof DEFAULT_PORTAL_TAG>(props: Props<TTag, PortalRenderPropArg>): React.ReactPortal | null; | ||
export declare namespace Portal { | ||
@@ -11,0 +11,0 @@ var Group: <TTag extends React.ElementType<any> = React.ExoticComponent<{ |
@@ -1,2 +0,2 @@ | ||
import { ElementType, MutableRefObject } from 'react'; | ||
import React, { ElementType, MutableRefObject } from 'react'; | ||
import { Props } from '../../types'; | ||
@@ -8,2 +8,3 @@ import { Features, PropsForFeatures } from '../../utils/render'; | ||
enterTo?: string; | ||
entered?: string; | ||
leave?: string; | ||
@@ -25,11 +26,10 @@ leaveFrom?: string; | ||
declare let TransitionChildRenderFeatures: Features; | ||
declare function TransitionChild<TTag extends ElementType = typeof DEFAULT_TRANSITION_CHILD_TAG>(props: TransitionChildProps<TTag>): JSX.Element; | ||
export declare function Transition<TTag extends ElementType = typeof DEFAULT_TRANSITION_CHILD_TAG>(props: TransitionChildProps<TTag> & { | ||
show: boolean; | ||
show?: boolean; | ||
appear?: boolean; | ||
}): JSX.Element; | ||
export declare namespace Transition { | ||
var Child: typeof TransitionChild; | ||
var Child: <TTag extends React.ElementType<any> = "div">(props: TransitionChildProps<TTag>) => JSX.Element; | ||
var Root: typeof Transition; | ||
} | ||
export {}; |
@@ -5,2 +5,2 @@ export declare enum Reason { | ||
} | ||
export declare function transition(node: HTMLElement, base: string[], from: string[], to: string[], done?: (reason: Reason) => void): () => void; | ||
export declare function transition(node: HTMLElement, base: string[], from: string[], to: string[], entered: string[], done?: (reason: Reason) => void): () => void; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n,t,r,o=require("react"),u=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,a=require("react-dom");function i(){return(i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function l(e,n){if(null==e)return{};var t,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n.indexOf(t=u[r])>=0||(o[t]=e[t]);return o}function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function s(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return c(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}function f(e,n){if(e in n){for(var t=n[e],r=arguments.length,o=new Array(r>2?r-2:0),u=2;u<r;u++)o[u-2]=arguments[u];return"function"==typeof t?t.apply(void 0,o):t}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(n).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,f),a}function d(e){var r=e.props,o=e.slot,u=e.defaultTag,a=e.features,c=e.visible,s=e.name;if(void 0===c||c)return p(r,o,u,s);var d=null!=a?a:n.None;if(d&n.Static){var v=r.static,m=void 0!==v&&v,b=l(r,["static"]);if(m)return p(b,o,u,s)}if(d&n.RenderStrategy){var g,y=r.unmount,h=void 0===y||y,S=l(r,["unmount"]);return f(h?t.Unmount:t.Hidden,((g={})[t.Unmount]=function(){return null},g[t.Hidden]=function(){return p(i({},S,{hidden:!0,style:{display:"none"}}),o,u,s)},g))}return p(r,o,u,s)}function p(e,n,t,r){var u;void 0===n&&(n={});var a=m(e,["unmount","static"]),i=a.as,c=void 0===i?t:i,f=a.children,d=a.refName,p=void 0===d?"ref":d,v=l(a,["as","children","refName"]),b=void 0!==e.ref?((u={})[p]=e.ref,u):{},g="function"==typeof f?f(n):f;if(v.className&&"function"==typeof v.className&&(v.className=v.className(n)),c===o.Fragment&&Object.keys(v).length>0){if(!o.isValidElement(g)||Array.isArray(g)&&g.length>1)throw new Error(['Passing props on "Fragment"!',"","The current component <"+r+' /> is rendering a "Fragment".',"However we need to passthrough the following props:",Object.keys(v).map((function(e){return" - "+e})).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((function(e){return" - "+e})).join("\n")].join("\n"));return o.cloneElement(g,Object.assign({},function(e,n,t){for(var r,o=Object.assign({},e),u=function(){var t,u=r.value;void 0!==e[u]&&void 0!==n[u]&&Object.assign(o,((t={})[u]=function(t){t.defaultPrevented||e[u](t),t.defaultPrevented||n[u](t)},t))},a=s(["onClick"]);!(r=a()).done;)u();return o}(function(e){var n=Object.assign({},e);for(var t in n)void 0===n[t]&&delete n[t];return n}(m(v,["ref"])),g.props),b))}return o.createElement(c,Object.assign({},m(v,["ref"]),c!==o.Fragment&&b),g)}function v(e){var n;return Object.assign(o.forwardRef(e),{displayName:null!=(n=e.displayName)?n:e.name})}function m(e,n){void 0===n&&(n=[]);for(var t,r=Object.assign({},e),o=s(n);!(t=o()).done;){var u=t.value;u in r&&delete r[u]}return r}function b(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=o.useRef(n);return o.useEffect((function(){r.current=n}),[n]),o.useCallback((function(e){for(var n,t=s(r.current);!(n=t()).done;){var o=n.value;null!=o&&("function"==typeof o?o(e):o.current=e)}}),[r])}function g(e){for(var n,t,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var u=null!=(n=""===(null==(t=r)?void 0:t.getAttribute("disabled")))&&n;return(!u||!function(e){if(!e)return!1;for(var n=e.previousElementSibling;null!==n;){if(n instanceof HTMLLegendElement)return!1;n=n.previousElementSibling}return!0}(o))&&u}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(n||(n={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(t||(t={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(r||(r={}));var y="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,h={serverHandoffComplete:!1},S=0;function C(){return++S}function x(){var e=o.useState(h.serverHandoffComplete?C:null),n=e[0],t=e[1];return y((function(){null===n&&t(C())}),[n]),o.useEffect((function(){!1===h.serverHandoffComplete&&(h.serverHandoffComplete=!0)}),[]),null!=n?""+n:void 0}var E,I,O,w,k=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function R(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(k))}function P(e,n){var t;return void 0===n&&(n=w.Strict),e!==document.body&&f(n,((t={})[w.Strict]=function(){return e.matches(k)},t[w.Loose]=function(){for(var n=e;null!==n;){if(n.matches(k))return!0;n=n.parentElement}return!1},t))}function T(e){null==e||e.focus({preventScroll:!0})}function D(e,n){var t=Array.isArray(e)?e:R(e),r=document.activeElement,o=function(){if(n&(E.First|E.Next))return O.Next;if(n&(E.Previous|E.Last))return O.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),u=function(){if(n&E.First)return 0;if(n&E.Previous)return Math.max(0,t.indexOf(r))-1;if(n&E.Next)return Math.max(0,t.indexOf(r))+1;if(n&E.Last)return t.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),a=n&E.NoScroll?{preventScroll:!0}:{},i=0,l=t.length,c=void 0;do{var s;if(i>=l||i+l<=0)return I.Error;var f=u+i;if(n&E.WrapAround)f=(f+l)%l;else{if(f<0)return I.Underflow;if(f>=l)return I.Overflow}null==(s=c=t[f])||s.focus(a),i+=o}while(c!==document.activeElement);return c.hasAttribute("tabindex")||c.setAttribute("tabindex","0"),I.Success}function F(e,n){for(var t,r=s(e);!(t=r()).done;)if(t.value.contains(n))return!0;return!1}function L(e,n,t){o.useEffect((function(){return window.addEventListener(e,n,t),function(){return window.removeEventListener(e,n,t)}}),[e,n,t])}function A(e,n,t){void 0===n&&(n=!0),void 0===t&&(t={});var u=o.useRef("undefined"!=typeof window?document.activeElement:null),a=o.useRef(null),i=o.useRef(!1);y((function(){var r,o;if(n&&1===e.current.size){i.current=!0;var l,c=document.activeElement;if(null==(r=t.initialFocus)?void 0:r.current){if((null==(l=t.initialFocus)?void 0:l.current)===c)return}else if(F(e.current,c))return;if(u.current=c,null==(o=t.initialFocus)?void 0:o.current)T(t.initialFocus.current);else{for(var f,d=!1,p=s(e.current);!(f=p()).done;)if(D(f.value,E.First)===I.Success){d=!0;break}if(!d)throw new Error("There are no focusable elements inside the <FocusTrap />")}return a.current=document.activeElement,function(){i.current=!1,T(u.current),u.current=null,a.current=null}}}),[n,e,i,t.initialFocus]),L("keydown",(function(t){if(n&&t.key===r.Tab&&document.activeElement&&1===e.current.size){t.preventDefault();for(var o,u=s(e.current);!(o=u()).done;)if(D(o.value,(t.shiftKey?E.Previous:E.Next)|E.WrapAround)===I.Success){a.current=document.activeElement;break}}})),L("focus",(function(t){if(n&&1===e.current.size){var r=a.current;if(r&&i.current){var o=t.target;o&&o instanceof HTMLElement?F(e.current,o)?(a.current=o,T(o)):(t.preventDefault(),t.stopPropagation(),T(r)):T(a.current)}}}),!0)}!function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"}(E||(E={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(I||(I={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(O||(O={})),function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"}(w||(w={}));var M=new Set,N=new Map;function U(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function j(e){var n=N.get(e);n&&(null===n["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert)}var G,B=o.createContext((function(){}));function H(){return o.useContext(B)}function V(e){var n=e.children,t=e.onUpdate,r=H(),a=o.useCallback((function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];null==t||t.apply(void 0,n),r.apply(void 0,n)}),[r,t]);return u.createElement(B.Provider,{value:a},n)}B.displayName="StackContext",function(e){e[e.AddElement=0]="AddElement",e[e.RemoveElement=1]="RemoveElement"}(G||(G={}));var K=o.createContext(!1);function Q(e){return u.createElement(K.Provider,{value:e.force},e.children)}var W=o.Fragment;function q(e){var n=e,t=function(){var e=o.useContext(K),n=o.useContext(Y),t=o.useState((function(){if(!e&&null!==n)return null;if("undefined"==typeof window)return null;var t=document.getElementById("headlessui-portal-root");if(t)return t;var r=document.createElement("div");return r.setAttribute("id","headlessui-portal-root"),document.body.appendChild(r)})),r=t[0],u=t[1];return o.useEffect((function(){e||null!==n&&u(n.current)}),[n,u,e]),r}(),r=o.useState((function(){return"undefined"==typeof window?null:document.createElement("div")}))[0];return function(e){var n=H();y((function(){if(e)return n(G.AddElement,e),function(){return n(G.RemoveElement,e)}}),[e])}(r),y((function(){if(t&&r)return t.appendChild(r),function(){var e;t&&r&&(t.removeChild(r),t.childNodes.length<=0&&(null==(e=t.parentElement)||e.removeChild(t)))}}),[t,r]),u.createElement(V,null,t&&r?a.createPortal(d({props:n,defaultTag:W,name:"Portal"}),r):null)}var _=o.Fragment,Y=o.createContext(null);q.Group=function(e){var n=e.target,t=l(e,["target"]);return u.createElement(Y.Provider,{value:n},d({props:t,defaultTag:_,name:"Popover.Group"}))};var z,J,$,X=o.createContext(null);function Z(){var e=o.useContext(X);if(null===e){var n=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Z),n}return e}function ee(){var e=o.useState([]),n=e[0],t=e[1];return[n.length>0?n.join(" "):void 0,o.useMemo((function(){return function(e){var n=o.useCallback((function(e){return t((function(n){return[].concat(n,[e])})),function(){return t((function(n){var t=n.slice(),r=t.indexOf(e);return-1!==r&&t.splice(r,1),t}))}}),[]),r=o.useMemo((function(){return{register:n,slot:e.slot,name:e.name,props:e.props}}),[n,e.slot,e.name,e.props]);return u.createElement(X.Provider,{value:r},e.children)}}),[t])]}function ne(e){var n=Z(),t="headlessui-description-"+x();y((function(){return n.register(t)}),[t,n.register]);var r=e,o=i({},n.props,{id:t});return d({props:i({},r,o),slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(J||(J={})),function(e){e[e.SetTitleId=0]="SetTitleId"}($||($={}));var te=((z={})[$.SetTitleId]=function(e,n){return e.titleId===n.id?e:i({},e,{titleId:n.id})},z),re=o.createContext(null);function oe(e){var n=o.useContext(re);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+se.displayName+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,oe),t}return n}function ue(e,n){return f(n.type,te,e,n)}re.displayName="DialogContext";var ae,ie,le,ce=n.RenderStrategy|n.Static,se=Object.assign(v((function(e,n){var t=e.open,a=e.onClose,c=e.initialFocus,p=l(e,["open","onClose","initialFocus"]),v=o.useRef(new Set),m=o.useRef(null),g=b(m,n),h=e.hasOwnProperty("open"),S=e.hasOwnProperty("onClose");if(!h&&!S)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!h)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!S)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof t)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+t);if("function"!=typeof a)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+a);var C=t?J.Open:J.Closed,E=o.useReducer(ue,{titleId:null,descriptionId:null}),I=E[0],O=E[1],w=o.useCallback((function(){return a(!1)}),[a]),k=o.useCallback((function(e){return O({type:$.SetTitleId,id:e})}),[O]);L("mousedown",(function(e){C===J.Open&&1===v.current.size&&(F(v.current,e.target)||w())})),o.useEffect((function(){if(C===J.Open){var e=document.documentElement.style.overflow,n=document.documentElement.style.paddingRight,t=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=t+"px",function(){document.documentElement.style.overflow=e,document.documentElement.style.paddingRight=n}}}),[C]),o.useEffect((function(){if(C===J.Open&&m.current){var e=new IntersectionObserver((function(e){for(var n,t=s(e);!(n=t()).done;){var r=n.value;0===r.boundingClientRect.x&&0===r.boundingClientRect.y&&0===r.boundingClientRect.width&&0===r.boundingClientRect.height&&w()}}));return e.observe(m.current),function(){return e.disconnect()}}}),[C,m,w]);var R=C===J.Open;A(v,R,{initialFocus:c}),function(e,n){void 0===n&&(n=!0),y((function(){if(n&&e.current){var t=e.current;M.add(t);for(var r,o=s(N.keys());!(r=o()).done;){var u=r.value;u.contains(t)&&(j(u),N.delete(u))}return document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var n,t=s(M);!(n=t()).done;)if(e.contains(n.value))return;1===M.size&&(N.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),U(e))}})),function(){if(M.delete(t),M.size>0)document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!N.has(e)){for(var n,t=s(M);!(n=t()).done;)if(e.contains(n.value))return;N.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),U(e)}}));else for(var e,n=s(N.keys());!(e=n()).done;){var r=e.value;j(r),N.delete(r)}}}}),[n])}(m,R);var P=ee(),T=P[0],D=P[1],B="headlessui-dialog-"+x(),H=o.useMemo((function(){return[{dialogState:C,close:w,setTitleId:k},I]}),[C,I,w,k]),K=o.useMemo((function(){return{open:C===J.Open}}),[C]);return u.createElement(V,{onUpdate:function(e,n){var t;return f(e,((t={})[G.AddElement]=function(){v.current.add(n)},t[G.RemoveElement]=function(){v.current.delete(n)},t))}},u.createElement(Q,{force:!0},u.createElement(q,null,u.createElement(re.Provider,{value:H},u.createElement(q.Group,{target:m},u.createElement(Q,{force:!1},u.createElement(D,{slot:K,name:"Dialog.Description"},d({props:i({},p,{ref:g,id:B,role:"dialog","aria-modal":C===J.Open||void 0,"aria-labelledby":I.titleId,"aria-describedby":T,onClick:function(e){e.stopPropagation()},onKeyDown:function(e){e.key===r.Escape&&C===J.Open&&(v.current.size>1||(e.preventDefault(),e.stopPropagation(),w()))}}),slot:K,defaultTag:"div",features:ce,visible:C===J.Open,name:"Dialog"}))))))))})),{Overlay:v((function e(n,t){var r=oe([se.displayName,e.name].join("."))[0],u=r.dialogState,a=r.close,l=b(t),c="headlessui-dialog-overlay-"+x(),s=o.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),a()}),[a]),f=o.useMemo((function(){return{open:u===J.Open}}),[u]);return d({props:i({},n,{ref:l,id:c,"aria-hidden":!0,onClick:s}),slot:f,defaultTag:"div",name:"Dialog.Overlay"})})),Title:function e(n){var t=oe([se.displayName,e.name].join("."))[0],r=t.dialogState,u=t.setTitleId,a="headlessui-dialog-title-"+x();o.useEffect((function(){return u(a),function(){return u(null)}}),[a,u]);var l=o.useMemo((function(){return{open:r===J.Open}}),[r]);return d({props:i({},n,{id:a}),slot:l,defaultTag:"h2",name:"Dialog.Title"})},Description:ne});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(ie||(ie={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.SetButtonId=1]="SetButtonId",e[e.SetPanelId=2]="SetPanelId",e[e.LinkPanel=3]="LinkPanel",e[e.UnlinkPanel=4]="UnlinkPanel"}(le||(le={}));var fe=((ae={})[le.ToggleDisclosure]=function(e){var n;return i({},e,{disclosureState:f(e.disclosureState,(n={},n[ie.Open]=ie.Closed,n[ie.Closed]=ie.Open,n))})},ae[le.LinkPanel]=function(e){return!0===e.linkedPanel?e:i({},e,{linkedPanel:!0})},ae[le.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:i({},e,{linkedPanel:!1})},ae[le.SetButtonId]=function(e,n){return e.buttonId===n.buttonId?e:i({},e,{buttonId:n.buttonId})},ae[le.SetPanelId]=function(e,n){return e.panelId===n.panelId?e:i({},e,{panelId:n.panelId})},ae),de=o.createContext(null);function pe(e){var n=o.useContext(de);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+be.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,pe),t}return n}function ve(e,n){return f(n.type,fe,e,n)}de.displayName="DisclosureContext";var me=o.Fragment;function be(e){var n=e.defaultOpen,t=void 0!==n&&n,r=l(e,["defaultOpen"]),a="headlessui-disclosure-button-"+x(),i="headlessui-disclosure-panel-"+x(),c=o.useReducer(ve,{disclosureState:t?ie.Open:ie.Closed,linkedPanel:!1,buttonId:a,panelId:i}),s=c[0].disclosureState,f=c[1];o.useEffect((function(){return f({type:le.SetButtonId,buttonId:a})}),[a,f]),o.useEffect((function(){return f({type:le.SetPanelId,panelId:i})}),[i,f]);var p=o.useMemo((function(){return{open:s===ie.Open}}),[s]);return u.createElement(de.Provider,{value:c},d({props:r,slot:p,defaultTag:me,name:"Disclosure"}))}var ge,ye,he,Se,Ce=v((function e(n,t){var u=pe([be.name,e.name].join(".")),a=u[0],l=u[1],c=b(t),s=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:e.preventDefault(),e.stopPropagation(),l({type:le.ToggleDisclosure})}}),[l]),f=o.useCallback((function(e){switch(e.key){case r.Space:e.preventDefault()}}),[]),p=o.useCallback((function(e){g(e.currentTarget)||n.disabled||l({type:le.ToggleDisclosure})}),[l,n.disabled]),v=o.useMemo((function(){return{open:a.disclosureState===ie.Open}}),[a]);return d({props:i({},n,{ref:c,id:a.buttonId,type:"button","aria-expanded":a.disclosureState===ie.Open||void 0,"aria-controls":a.linkedPanel?a.panelId:void 0,onKeyDown:s,onKeyUp:f,onClick:p}),slot:v,defaultTag:"button",name:"Disclosure.Button"})})),xe=n.RenderStrategy|n.Static,Ee=v((function e(n,t){var r=pe([be.name,e.name].join(".")),u=r[0],a=r[1],l=b(t,(function(){u.linkedPanel||a({type:le.LinkPanel})}));o.useEffect((function(){return function(){return a({type:le.UnlinkPanel})}}),[a]),o.useEffect((function(){var e;u.disclosureState!==ie.Closed||null!=(e=n.unmount)&&!e||a({type:le.UnlinkPanel})}),[u.disclosureState,n.unmount,a]);var c=o.useMemo((function(){return{open:u.disclosureState===ie.Open}}),[u]);return d({props:i({},n,{ref:l,id:u.panelId}),slot:c,defaultTag:"div",features:xe,visible:u.disclosureState===ie.Open,name:"Disclosure.Panel"})}));function Ie(){var e=[],n={requestAnimationFrame:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=requestAnimationFrame.apply(void 0,arguments);n.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];n.requestAnimationFrame((function(){n.requestAnimationFrame.apply(n,t)}))},setTimeout:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=setTimeout.apply(void 0,arguments);n.add((function(){return clearTimeout(e)}))})),add:function(n){e.push(n)},dispose:function(){for(var n,t=s(e.splice(0));!(n=t()).done;)(0,n.value)()}};return n}function Oe(){var e=o.useState(Ie)[0];return o.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function we(e,n){var t=o.useState(e),r=t[0],u=t[1],a=o.useRef(e);return y((function(){a.current=e}),[e]),y((function(){return u(a.current)}),[a,u].concat(n)),r}function ke(e,n){var t=n.resolveItems();if(t.length<=0)return null;var r=n.resolveActiveIndex(),o=null!=r?r:-1,u=function(){switch(e.focus){case ge.First:return t.findIndex((function(e){return!n.resolveDisabled(e)}));case ge.Previous:var r=t.slice().reverse().findIndex((function(e,t,r){return!(-1!==o&&r.length-t-1>=o||n.resolveDisabled(e))}));return-1===r?r:t.length-1-r;case ge.Next:return t.findIndex((function(e,t){return!(t<=o||n.resolveDisabled(e))}));case ge.Last:var u=t.slice().reverse().findIndex((function(e){return!n.resolveDisabled(e)}));return-1===u?u:t.length-1-u;case ge.Specific:return t.findIndex((function(t){return n.resolveId(t)===e.id}));case ge.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?r:u}be.Button=Ce,be.Panel=Ee,function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(ge||(ge={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(he||(he={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(Se||(Se={}));var Re=((ye={})[Se.CloseListbox]=function(e){return e.disabled||e.listboxState===he.Closed?e:i({},e,{activeOptionIndex:null,listboxState:he.Closed})},ye[Se.OpenListbox]=function(e){return e.disabled||e.listboxState===he.Open?e:i({},e,{listboxState:he.Open})},ye[Se.SetDisabled]=function(e,n){return e.disabled===n.disabled?e:i({},e,{disabled:n.disabled})},ye[Se.GoToOption]=function(e,n){if(e.disabled)return e;if(e.listboxState===he.Closed)return e;var t=ke(n,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===t?e:i({},e,{searchQuery:"",activeOptionIndex:t})},ye[Se.Search]=function(e,n){if(e.disabled)return e;if(e.listboxState===he.Closed)return e;var t=e.searchQuery+n.value.toLowerCase(),r=e.options.findIndex((function(e){var n;return!e.dataRef.current.disabled&&(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(t))}));return i({},e,-1===r||r===e.activeOptionIndex?{searchQuery:t}:{searchQuery:t,activeOptionIndex:r})},ye[Se.ClearSearch]=function(e){return e.disabled||e.listboxState===he.Closed||""===e.searchQuery?e:i({},e,{searchQuery:""})},ye[Se.RegisterOption]=function(e,n){return i({},e,{options:[].concat(e.options,[{id:n.id,dataRef:n.dataRef}])})},ye[Se.UnregisterOption]=function(e,n){var t=e.options.slice(),r=null!==e.activeOptionIndex?t[e.activeOptionIndex]:null,o=t.findIndex((function(e){return e.id===n.id}));return-1!==o&&t.splice(o,1),i({},e,{options:t,activeOptionIndex:o===e.activeOptionIndex||null===r?null:t.indexOf(r)})},ye),Pe=o.createContext(null);function Te(e){var n=o.useContext(Pe);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+Le.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Te),t}return n}function De(e,n){return f(n.type,Re,e,n)}Pe.displayName="ListboxContext";var Fe=o.Fragment;function Le(e){var n=e.value,t=e.onChange,r=e.disabled,a=void 0!==r&&r,i=l(e,["value","onChange","disabled"]),c=o.useReducer(De,{listboxState:he.Closed,propsRef:{current:{value:n,onChange:t}},labelRef:o.createRef(),buttonRef:o.createRef(),optionsRef:o.createRef(),disabled:a,options:[],searchQuery:"",activeOptionIndex:null}),s=c[0],f=s.listboxState,p=s.propsRef,v=s.optionsRef,m=s.buttonRef,b=c[1];y((function(){p.current.value=n}),[n,p]),y((function(){p.current.onChange=t}),[t,p]),y((function(){return b({type:Se.SetDisabled,disabled:a})}),[a]),L("mousedown",(function(e){var n,t,r,o=e.target;f===he.Open&&((null==(n=m.current)?void 0:n.contains(o))||(null==(t=v.current)?void 0:t.contains(o))||(b({type:Se.CloseListbox}),P(o,w.Loose)||(e.preventDefault(),null==(r=m.current)||r.focus())))}));var g=o.useMemo((function(){return{open:f===he.Open,disabled:a}}),[f,a]);return u.createElement(Pe.Provider,{value:c},d({props:i,slot:g,defaultTag:Fe,name:"Listbox"}))}var Ae,Me,Ne,Ue=v((function e(n,t){var u,a=Te([Le.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.buttonRef,t),f="headlessui-listbox-button-"+x(),p=Oe(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),c({type:Se.OpenListbox}),p.nextFrame((function(){l.propsRef.current.value||c({type:Se.GoToOption,focus:ge.First})}));break;case r.ArrowUp:e.preventDefault(),c({type:Se.OpenListbox}),p.nextFrame((function(){l.propsRef.current.value||c({type:Se.GoToOption,focus:ge.Last})}))}}),[c,l,p]),m=o.useCallback((function(e){switch(e.key){case r.Space:e.preventDefault()}}),[]),y=o.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();l.listboxState===he.Open?(c({type:Se.CloseListbox}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),c({type:Se.OpenListbox}))}),[c,p,l]),h=we((function(){if(l.labelRef.current)return[l.labelRef.current.id,f].join(" ")}),[l.labelRef.current,f]),S=o.useMemo((function(){return{open:l.listboxState===he.Open,disabled:l.disabled}}),[l]);return d({props:i({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(u=l.optionsRef.current)?void 0:u.id,"aria-expanded":l.listboxState===he.Open||void 0,"aria-labelledby":h,disabled:l.disabled,onKeyDown:v,onKeyUp:m,onClick:y}),slot:S,defaultTag:"button",name:"Listbox.Button"})})),je=n.RenderStrategy|n.Static,Ge=v((function e(n,t){var u,a=Te([Le.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.optionsRef,t),f="headlessui-listbox-options-"+x(),p=Oe(),v=Oe();y((function(){var e=l.optionsRef.current;e&&l.listboxState===he.Open&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[l.listboxState,l.optionsRef]);var m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==l.searchQuery)return e.preventDefault(),e.stopPropagation(),c({type:Se.Search,value:e.key});case r.Enter:e.preventDefault(),e.stopPropagation(),c({type:Se.CloseListbox}),null!==l.activeOptionIndex&&l.propsRef.current.onChange(l.options[l.activeOptionIndex].dataRef.current.value),Ie().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),e.stopPropagation(),c({type:Se.GoToOption,focus:ge.Next});case r.ArrowUp:return e.preventDefault(),e.stopPropagation(),c({type:Se.GoToOption,focus:ge.Previous});case r.Home:case r.PageUp:return e.preventDefault(),e.stopPropagation(),c({type:Se.GoToOption,focus:ge.First});case r.End:case r.PageDown:return e.preventDefault(),e.stopPropagation(),c({type:Se.GoToOption,focus:ge.Last});case r.Escape:return e.preventDefault(),e.stopPropagation(),c({type:Se.CloseListbox}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case r.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(c({type:Se.Search,value:e.key}),v.setTimeout((function(){return c({type:Se.ClearSearch})}),350))}}),[p,c,v,l]),g=we((function(){var e,n,t;return null!=(e=null==(n=l.labelRef.current)?void 0:n.id)?e:null==(t=l.buttonRef.current)?void 0:t.id}),[l.labelRef.current,l.buttonRef.current]),h=o.useMemo((function(){return{open:l.listboxState===he.Open}}),[l]);return d({props:i({},n,{"aria-activedescendant":null===l.activeOptionIndex||null==(u=l.options[l.activeOptionIndex])?void 0:u.id,"aria-labelledby":g,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),slot:h,defaultTag:"ul",features:je,visible:l.listboxState===he.Open,name:"Listbox.Options"})}));function Be(e){var n=e.container,t=e.accept,r=e.walk,u=e.enabled,a=void 0===u||u,i=o.useRef(t),l=o.useRef(r);o.useEffect((function(){i.current=t,l.current=r}),[t,r]),y((function(){if(n&&a)for(var e=i.current,t=l.current,r=Object.assign((function(n){return e(n)}),{acceptNode:e}),o=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,r,!1);o.nextNode();)t(o.currentNode)}),[n,a,i,l])}Le.Button=Ue,Le.Label=function e(n){var t=Te([Le.name,e.name].join("."))[0],r="headlessui-listbox-label-"+x(),u=o.useCallback((function(){var e;return null==(e=t.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[t.buttonRef]),a=o.useMemo((function(){return{open:t.listboxState===he.Open,disabled:t.disabled}}),[t]);return d({props:i({},n,{ref:t.labelRef,id:r,onClick:u}),slot:a,defaultTag:"label",name:"Listbox.Label"})},Le.Options=Ge,Le.Option=function e(n){var t=n.disabled,r=void 0!==t&&t,u=n.value,a=l(n,["disabled","value"]),c=Te([Le.name,e.name].join(".")),s=c[0],f=c[1],p="headlessui-listbox-option-"+x(),v=null!==s.activeOptionIndex&&s.options[s.activeOptionIndex].id===p,m=s.propsRef.current.value===u,b=o.useRef({disabled:r,value:u});y((function(){b.current.disabled=r}),[b,r]),y((function(){b.current.value=u}),[b,u]),y((function(){var e,n;b.current.textValue=null==(e=document.getElementById(p))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[b,p]);var g=o.useCallback((function(){return s.propsRef.current.onChange(u)}),[s.propsRef,u]);y((function(){return f({type:Se.RegisterOption,id:p,dataRef:b}),function(){return f({type:Se.UnregisterOption,id:p})}}),[b,p]),y((function(){var e;s.listboxState===he.Open&&m&&(f({type:Se.GoToOption,focus:ge.Specific,id:p}),null==(e=document.getElementById(p))||null==e.focus||e.focus())}),[s.listboxState]),y((function(){if(s.listboxState===he.Open&&v){var e=Ie();return e.nextFrame((function(){var e;return null==(e=document.getElementById(p))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[p,v,s.listboxState]);var h=o.useCallback((function(e){if(r)return e.preventDefault();g(),f({type:Se.CloseListbox}),Ie().nextFrame((function(){var e;return null==(e=s.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[f,s.buttonRef,r,g]),S=o.useCallback((function(){if(r)return f({type:Se.GoToOption,focus:ge.Nothing});f({type:Se.GoToOption,focus:ge.Specific,id:p})}),[r,p,f]),C=o.useCallback((function(){r||v||f({type:Se.GoToOption,focus:ge.Specific,id:p})}),[r,v,p,f]),E=o.useCallback((function(){r||v&&f({type:Se.GoToOption,focus:ge.Nothing})}),[r,v,f]),I=o.useMemo((function(){return{active:v,selected:m,disabled:r}}),[v,m,r]);return d({props:i({},a,{id:p,role:"option",tabIndex:-1,"aria-disabled":!0===r||void 0,"aria-selected":!0===m||void 0,onClick:h,onFocus:S,onPointerMove:C,onMouseMove:C,onPointerLeave:E,onMouseLeave:E}),slot:I,defaultTag:"li",name:"Listbox.Option"})},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Me||(Me={})),function(e){e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem"}(Ne||(Ne={}));var He=((Ae={})[Ne.CloseMenu]=function(e){return e.menuState===Me.Closed?e:i({},e,{activeItemIndex:null,menuState:Me.Closed})},Ae[Ne.OpenMenu]=function(e){return e.menuState===Me.Open?e:i({},e,{menuState:Me.Open})},Ae[Ne.GoToItem]=function(e,n){var t=ke(n,{resolveItems:function(){return e.items},resolveActiveIndex:function(){return e.activeItemIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeItemIndex===t?e:i({},e,{searchQuery:"",activeItemIndex:t})},Ae[Ne.Search]=function(e,n){var t=e.searchQuery+n.value.toLowerCase(),r=e.items.findIndex((function(e){var n;return(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(t))&&!e.dataRef.current.disabled}));return i({},e,-1===r||r===e.activeItemIndex?{searchQuery:t}:{searchQuery:t,activeItemIndex:r})},Ae[Ne.ClearSearch]=function(e){return""===e.searchQuery?e:i({},e,{searchQuery:""})},Ae[Ne.RegisterItem]=function(e,n){return i({},e,{items:[].concat(e.items,[{id:n.id,dataRef:n.dataRef}])})},Ae[Ne.UnregisterItem]=function(e,n){var t=e.items.slice(),r=null!==e.activeItemIndex?t[e.activeItemIndex]:null,o=t.findIndex((function(e){return e.id===n.id}));return-1!==o&&t.splice(o,1),i({},e,{items:t,activeItemIndex:o===e.activeItemIndex||null===r?null:t.indexOf(r)})},Ae),Ve=o.createContext(null);function Ke(e){var n=o.useContext(Ve);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+qe.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Ke),t}return n}function Qe(e,n){return f(n.type,He,e,n)}Ve.displayName="MenuContext";var We=o.Fragment;function qe(e){var n=o.useReducer(Qe,{menuState:Me.Closed,buttonRef:o.createRef(),itemsRef:o.createRef(),items:[],searchQuery:"",activeItemIndex:null}),t=n[0],r=t.menuState,a=t.itemsRef,i=t.buttonRef,l=n[1];L("mousedown",(function(e){var n,t,o,u=e.target;r===Me.Open&&((null==(n=i.current)?void 0:n.contains(u))||(null==(t=a.current)?void 0:t.contains(u))||(l({type:Ne.CloseMenu}),P(u,w.Loose)||(e.preventDefault(),null==(o=i.current)||o.focus())))}));var c=o.useMemo((function(){return{open:r===Me.Open}}),[r]);return u.createElement(Ve.Provider,{value:n},d({props:e,slot:c,defaultTag:We,name:"Menu"}))}var _e,Ye,ze,Je=v((function e(n,t){var u,a=Ke([qe.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.buttonRef,t),f="headlessui-menu-button-"+x(),p=Oe(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),e.stopPropagation(),c({type:Ne.OpenMenu}),p.nextFrame((function(){return c({type:Ne.GoToItem,focus:ge.First})}));break;case r.ArrowUp:e.preventDefault(),e.stopPropagation(),c({type:Ne.OpenMenu}),p.nextFrame((function(){return c({type:Ne.GoToItem,focus:ge.Last})}))}}),[c,p]),m=o.useCallback((function(e){switch(e.key){case r.Space:e.preventDefault()}}),[]),y=o.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();n.disabled||(l.menuState===Me.Open?(c({type:Ne.CloseMenu}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),e.stopPropagation(),c({type:Ne.OpenMenu})))}),[c,p,l,n.disabled]),h=o.useMemo((function(){return{open:l.menuState===Me.Open}}),[l]);return d({props:i({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(u=l.itemsRef.current)?void 0:u.id,"aria-expanded":l.menuState===Me.Open||void 0,onKeyDown:v,onKeyUp:m,onClick:y}),slot:h,defaultTag:"button",name:"Menu.Button"})})),$e=n.RenderStrategy|n.Static,Xe=v((function e(n,t){var u,a,l=Ke([qe.name,e.name].join(".")),c=l[0],s=l[1],f=b(c.itemsRef,t),p="headlessui-menu-items-"+x(),v=Oe();o.useEffect((function(){var e=c.itemsRef.current;e&&c.menuState===Me.Open&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[c.menuState,c.itemsRef]),Be({container:c.itemsRef.current,enabled:c.menuState===Me.Open,accept:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk:function(e){e.setAttribute("role","none")}});var m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==c.searchQuery)return e.preventDefault(),e.stopPropagation(),s({type:Ne.Search,value:e.key});case r.Enter:var n;e.preventDefault(),e.stopPropagation(),s({type:Ne.CloseMenu}),null!==c.activeItemIndex&&(null==(n=document.getElementById(c.items[c.activeItemIndex].id))||n.click()),Ie().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),e.stopPropagation(),s({type:Ne.GoToItem,focus:ge.Next});case r.ArrowUp:return e.preventDefault(),e.stopPropagation(),s({type:Ne.GoToItem,focus:ge.Previous});case r.Home:case r.PageUp:return e.preventDefault(),e.stopPropagation(),s({type:Ne.GoToItem,focus:ge.First});case r.End:case r.PageDown:return e.preventDefault(),e.stopPropagation(),s({type:Ne.GoToItem,focus:ge.Last});case r.Escape:e.preventDefault(),e.stopPropagation(),s({type:Ne.CloseMenu}),Ie().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(s({type:Ne.Search,value:e.key}),v.setTimeout((function(){return s({type:Ne.ClearSearch})}),350))}}),[s,v,c]),g=o.useCallback((function(e){switch(e.key){case r.Space:e.preventDefault()}}),[]),y=o.useMemo((function(){return{open:c.menuState===Me.Open}}),[c]);return d({props:i({},n,{"aria-activedescendant":null===c.activeItemIndex||null==(u=c.items[c.activeItemIndex])?void 0:u.id,"aria-labelledby":null==(a=c.buttonRef.current)?void 0:a.id,id:p,onKeyDown:m,onKeyUp:g,role:"menu",tabIndex:0,ref:f}),slot:y,defaultTag:"div",features:$e,visible:c.menuState===Me.Open,name:"Menu.Items"})})),Ze=o.Fragment;qe.Button=Je,qe.Items=Xe,qe.Item=function e(n){var t=n.disabled,r=void 0!==t&&t,u=n.onClick,a=l(n,["disabled","onClick"]),c=Ke([qe.name,e.name].join(".")),s=c[0],f=c[1],p="headlessui-menu-item-"+x(),v=null!==s.activeItemIndex&&s.items[s.activeItemIndex].id===p;y((function(){if(s.menuState===Me.Open&&v){var e=Ie();return e.nextFrame((function(){var e;return null==(e=document.getElementById(p))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[p,v,s.menuState]);var m=o.useRef({disabled:r});y((function(){m.current.disabled=r}),[m,r]),y((function(){var e,n;m.current.textValue=null==(e=document.getElementById(p))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[m,p]),y((function(){return f({type:Ne.RegisterItem,id:p,dataRef:m}),function(){return f({type:Ne.UnregisterItem,id:p})}}),[m,p]);var b=o.useCallback((function(e){return r?e.preventDefault():(f({type:Ne.CloseMenu}),Ie().nextFrame((function(){var e;return null==(e=s.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[f,s.buttonRef,r,u]),g=o.useCallback((function(){if(r)return f({type:Ne.GoToItem,focus:ge.Nothing});f({type:Ne.GoToItem,focus:ge.Specific,id:p})}),[r,p,f]),h=o.useCallback((function(){r||v||f({type:Ne.GoToItem,focus:ge.Specific,id:p})}),[r,v,p,f]),S=o.useCallback((function(){r||v&&f({type:Ne.GoToItem,focus:ge.Nothing})}),[r,v,f]),C=o.useMemo((function(){return{active:v,disabled:r}}),[v,r]);return d({props:i({},a,{id:p,role:"menuitem",tabIndex:-1,"aria-disabled":!0===r||void 0,onClick:b,onFocus:g,onPointerMove:h,onMouseMove:h,onPointerLeave:S,onMouseLeave:S}),slot:C,defaultTag:Ze,name:"Menu.Item"})},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Ye||(Ye={})),function(e){e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId"}(ze||(ze={}));var en=((_e={})[ze.TogglePopover]=function(e){var n;return i({},e,{popoverState:f(e.popoverState,(n={},n[Ye.Open]=Ye.Closed,n[Ye.Closed]=Ye.Open,n))})},_e[ze.ClosePopover]=function(e){return e.popoverState===Ye.Closed?e:i({},e,{popoverState:Ye.Closed})},_e[ze.SetButton]=function(e,n){return e.button===n.button?e:i({},e,{button:n.button})},_e[ze.SetButtonId]=function(e,n){return e.buttonId===n.buttonId?e:i({},e,{buttonId:n.buttonId})},_e[ze.SetPanel]=function(e,n){return e.panel===n.panel?e:i({},e,{panel:n.panel})},_e[ze.SetPanelId]=function(e,n){return e.panelId===n.panelId?e:i({},e,{panelId:n.panelId})},_e),nn=o.createContext(null);function tn(e){var n=o.useContext(nn);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+ln.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,tn),t}return n}nn.displayName="PopoverContext";var rn=o.createContext(null);function on(){return o.useContext(rn)}rn.displayName="PopoverGroupContext";var un=o.createContext(null);function an(e,n){return f(n.type,en,e,n)}function ln(e){var n="headlessui-popover-button-"+x(),t="headlessui-popover-panel-"+x(),r=o.useReducer(an,{popoverState:Ye.Closed,button:null,buttonId:n,panel:null,panelId:t}),a=r[0],i=a.popoverState,l=a.button,c=a.panel,s=r[1];o.useEffect((function(){return s({type:ze.SetButtonId,buttonId:n})}),[n,s]),o.useEffect((function(){return s({type:ze.SetPanelId,panelId:t})}),[t,s]);var f=o.useMemo((function(){return{buttonId:n,panelId:t,close:function(){return s({type:ze.ClosePopover})}}}),[n,t,s]),p=on(),v=null==p?void 0:p.registerPopover,m=o.useCallback((function(){var e;return null!=(e=null==p?void 0:p.isFocusWithinPopoverGroup())?e:(null==l?void 0:l.contains(document.activeElement))||(null==c?void 0:c.contains(document.activeElement))}),[p,l,c]);o.useEffect((function(){return null==v?void 0:v(f)}),[v,f]),L("focus",(function(){i===Ye.Open&&(m()||l&&c&&s({type:ze.ClosePopover}))}),!0),L("mousedown",(function(e){var n=e.target;i===Ye.Open&&((null==l?void 0:l.contains(n))||(null==c?void 0:c.contains(n))||(s({type:ze.ClosePopover}),P(n,w.Loose)||(e.preventDefault(),null==l||l.focus())))}));var b=o.useMemo((function(){return{open:i===Ye.Open}}),[i]);return u.createElement(nn.Provider,{value:r},d({props:e,slot:b,defaultTag:"div",name:"Popover"}))}un.displayName="PopoverPanelContext";var cn=v((function e(n,t){var u=tn([ln.name,e.name].join(".")),a=u[0],l=u[1],c=o.useRef(null),s=on(),f=null==s?void 0:s.closeOthers,p=o.useContext(un),v=null!==p&&p===a.panelId,m=b(c,t,v?null:function(e){return l({type:ze.SetButton,button:e})}),y=o.useRef(null),h=o.useRef("undefined"==typeof window?null:document.activeElement);L("focus",(function(){h.current=y.current,y.current=document.activeElement}),!0);var S=o.useCallback((function(e){var n;if(v){if(a.popoverState===Ye.Closed)return;switch(e.key){case r.Space:case r.Enter:e.preventDefault(),e.stopPropagation(),l({type:ze.ClosePopover}),null==(n=a.button)||n.focus()}}else switch(e.key){case r.Space:case r.Enter:e.preventDefault(),e.stopPropagation(),a.popoverState===Ye.Closed&&(null==f||f(a.buttonId)),l({type:ze.TogglePopover});break;case r.Escape:if(a.popoverState!==Ye.Open)return null==f?void 0:f(a.buttonId);if(!c.current)return;if(!c.current.contains(document.activeElement))return;l({type:ze.ClosePopover});break;case r.Tab:if(a.popoverState!==Ye.Open)return;if(!a.panel)return;if(!a.button)return;if(e.shiftKey){var t;if(!h.current)return;if(null==(t=a.button)?void 0:t.contains(h.current))return;if(a.panel.contains(h.current))return;var o=R(),u=o.indexOf(h.current);if(o.indexOf(a.button)>u)return;e.preventDefault(),e.stopPropagation(),D(a.panel,E.Last)}else e.preventDefault(),e.stopPropagation(),D(a.panel,E.First)}}),[l,a.popoverState,a.buttonId,a.button,a.panel,c,f,v]),C=o.useCallback((function(e){var n;if(!v&&(e.key===r.Space&&e.preventDefault(),a.popoverState===Ye.Open&&a.panel&&a.button))switch(e.key){case r.Tab:if(!h.current)return;if(null==(n=a.button)?void 0:n.contains(h.current))return;if(a.panel.contains(h.current))return;var t=R(),o=t.indexOf(h.current);if(t.indexOf(a.button)>o)return;e.preventDefault(),e.stopPropagation(),D(a.panel,E.Last)}}),[a.popoverState,a.panel,a.button,v]),x=o.useCallback((function(e){var t,r;g(e.currentTarget)||n.disabled||(v?(l({type:ze.ClosePopover}),null==(t=a.button)||t.focus()):(a.popoverState===Ye.Closed&&(null==f||f(a.buttonId)),null==(r=a.button)||r.focus(),l({type:ze.TogglePopover})))}),[l,a.button,a.popoverState,a.buttonId,n.disabled,f,v]),I=o.useMemo((function(){return{open:a.popoverState===Ye.Open}}),[a]);return d({props:i({},n,v?{type:"button",onKeyDown:S,onClick:x}:{ref:m,id:a.buttonId,type:"button","aria-expanded":a.popoverState===Ye.Open||void 0,"aria-controls":a.panel?a.panelId:void 0,onKeyDown:S,onKeyUp:C,onClick:x}),slot:I,defaultTag:"button",name:"Popover.Button"})})),sn=n.RenderStrategy|n.Static,fn=v((function e(n,t){var r=tn([ln.name,e.name].join(".")),u=r[0].popoverState,a=r[1],l=b(t),c="headlessui-popover-overlay-"+x(),s=o.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();a({type:ze.ClosePopover})}),[a]),f=o.useMemo((function(){return{open:u===Ye.Open}}),[u]);return d({props:i({},n,{ref:l,id:c,"aria-hidden":!0,onClick:s}),slot:f,defaultTag:"div",features:sn,visible:u===Ye.Open,name:"Popover.Overlay"})})),dn=n.RenderStrategy|n.Static,pn=v((function e(n,t){var a=n.focus,c=void 0!==a&&a,s=l(n,["focus"]),f=tn([ln.name,e.name].join(".")),p=f[0],v=f[1],m=o.useRef(null),g=b(m,t,(function(e){v({type:ze.SetPanel,panel:e})})),y=o.useCallback((function(e){var n;switch(e.key){case r.Escape:if(p.popoverState!==Ye.Open)return;if(!m.current)return;if(!m.current.contains(document.activeElement))return;e.preventDefault(),v({type:ze.ClosePopover}),null==(n=p.button)||n.focus()}}),[p,m,v]);o.useEffect((function(){return function(){return v({type:ze.SetPanel,panel:null})}}),[v]),o.useEffect((function(){var e;p.popoverState!==Ye.Closed||null!=(e=n.unmount)&&!e||v({type:ze.SetPanel,panel:null})}),[p.popoverState,n.unmount,v]),o.useEffect((function(){if(c&&p.popoverState===Ye.Open&&m.current){var e=document.activeElement;m.current.contains(e)||D(m.current,E.First)}}),[c,m,p.popoverState]),L("keydown",(function(e){if(p.popoverState===Ye.Open&&m.current&&e.key===r.Tab&&document.activeElement&&m.current&&m.current.contains(document.activeElement)){e.preventDefault();var n,t=D(m.current,e.shiftKey?E.Previous:E.Next);if(t===I.Underflow)return null==(n=p.button)?void 0:n.focus();if(t===I.Overflow){if(!p.button)return;var o=R(),u=o.indexOf(p.button);D(o.splice(u+1).filter((function(e){var n;return!(null==(n=m.current)?void 0:n.contains(e))})),E.First)===I.Error&&D(document.body,E.First)}}})),L("focus",(function(){var e;c&&p.popoverState===Ye.Open&&m.current&&((null==(e=m.current)?void 0:e.contains(document.activeElement))||v({type:ze.ClosePopover}))}),!0);var h=o.useMemo((function(){return{open:p.popoverState===Ye.Open}}),[p]);return u.createElement(un.Provider,{value:p.panelId},d({props:i({},s,{ref:g,id:p.panelId,onKeyDown:y}),slot:h,defaultTag:"div",features:dn,visible:p.popoverState===Ye.Open,name:"Popover.Panel"}))}));ln.Button=cn,ln.Overlay=fn,ln.Panel=pn,ln.Group=function(e){var n=o.useRef(null),t=o.useState([]),r=t[0],a=t[1],l=o.useCallback((function(e){a((function(n){var t=n.indexOf(e);if(-1!==t){var r=n.slice();return r.splice(t,1),r}return n}))}),[a]),c=o.useCallback((function(e){return a((function(n){return[].concat(n,[e])})),function(){return l(e)}}),[a,l]),f=o.useCallback((function(){var e,t=document.activeElement;return!!(null==(e=n.current)?void 0:e.contains(t))||r.some((function(e){var n,r;return(null==(n=document.getElementById(e.buttonId))?void 0:n.contains(t))||(null==(r=document.getElementById(e.panelId))?void 0:r.contains(t))}))}),[n,r]),p=o.useCallback((function(e){for(var n,t=s(r);!(n=t()).done;){var o=n.value;o.buttonId!==e&&o.close()}}),[r]),v=o.useMemo((function(){return{registerPopover:c,unregisterPopover:l,isFocusWithinPopoverGroup:f,closeOthers:p}}),[c,l,f,p]),m=o.useMemo((function(){return{}}),[]);return u.createElement(rn.Provider,{value:v},d({props:i({},e,{ref:n}),slot:m,defaultTag:"div",name:"Popover.Group"}))};var vn,mn,bn=o.createContext(null);function gn(){var e=o.useContext(bn);if(null===e){var n=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,gn),n}return e}function yn(){var e=o.useState([]),n=e[0],t=e[1];return[n.length>0?n.join(" "):void 0,o.useMemo((function(){return function(e){var n=o.useCallback((function(e){return t((function(n){return[].concat(n,[e])})),function(){return t((function(n){var t=n.slice(),r=t.indexOf(e);return-1!==r&&t.splice(r,1),t}))}}),[]),r=o.useMemo((function(){return{register:n,slot:e.slot,name:e.name,props:e.props}}),[n,e.slot,e.name,e.props]);return u.createElement(bn.Provider,{value:r},e.children)}}),[t])]}function hn(e){var n=e.passive,t=void 0!==n&&n,r=l(e,["passive"]),o=gn(),u="headlessui-label-"+x();y((function(){return o.register(u)}),[u,o.register]);var a=i({},o.props,{id:u}),c=i({},r,a);return t&&delete c.onClick,d({props:c,slot:o.slot||{},defaultTag:"label",name:o.name||"Label"})}!function(e){e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption"}(mn||(mn={}));var Sn,Cn=((vn={})[mn.RegisterOption]=function(e,n){return i({},e,{options:[].concat(e.options,[{id:n.id,element:n.element,propsRef:n.propsRef}])})},vn[mn.UnregisterOption]=function(e,n){var t=e.options.slice(),r=e.options.findIndex((function(e){return e.id===n.id}));return-1===r?e:(t.splice(r,1),i({},e,{options:t}))},vn),xn=o.createContext(null);function En(e){var n=o.useContext(xn);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+On.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,En),t}return n}function In(e,n){return f(n.type,Cn,e,n)}function On(e){var n=e.value,t=e.onChange,a=e.disabled,c=void 0!==a&&a,s=l(e,["value","onChange","disabled"]),f=o.useReducer(In,{options:[]}),p=f[0].options,v=f[1],m=yn(),b=m[0],g=m[1],y=ee(),h=y[0],S=y[1],C="headlessui-radiogroup-"+x(),O=o.useRef(null),w=o.useMemo((function(){return p.find((function(e){return!e.propsRef.current.disabled}))}),[p]),k=o.useMemo((function(){return p.some((function(e){return e.propsRef.current.value===n}))}),[p,n]),R=o.useCallback((function(e){var r;if(c)return!1;if(e===n)return!1;var o=null==(r=p.find((function(n){return n.propsRef.current.value===e})))?void 0:r.propsRef.current;return!(null==o?void 0:o.disabled)&&(t(e),!0)}),[t,n,c,p]);Be({container:O.current,accept:function(e){return"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk:function(e){e.setAttribute("role","none")}});var P=o.useCallback((function(e){if(O.current){var n=p.filter((function(e){return!1===e.propsRef.current.disabled})).map((function(e){return e.element.current}));switch(e.key){case r.ArrowLeft:case r.ArrowUp:if(e.preventDefault(),e.stopPropagation(),D(n,E.Previous|E.WrapAround)===I.Success){var t=p.find((function(e){return e.element.current===document.activeElement}));t&&R(t.propsRef.current.value)}break;case r.ArrowRight:case r.ArrowDown:if(e.preventDefault(),e.stopPropagation(),D(n,E.Next|E.WrapAround)===I.Success){var o=p.find((function(e){return e.element.current===document.activeElement}));o&&R(o.propsRef.current.value)}break;case r.Space:e.preventDefault(),e.stopPropagation();var u=p.find((function(e){return e.element.current===document.activeElement}));u&&R(u.propsRef.current.value)}}}),[O,p,R]),T=o.useCallback((function(e){return v(i({type:mn.RegisterOption},e)),function(){return v({type:mn.UnregisterOption,id:e.id})}}),[v]),F=o.useMemo((function(){return{registerOption:T,firstOption:w,containsCheckedOption:k,change:R,disabled:c,value:n}}),[T,w,k,R,c,n]);return u.createElement(S,{name:"RadioGroup.Description"},u.createElement(g,{name:"RadioGroup.Label"},u.createElement(xn.Provider,{value:F},d({props:i({},s,{ref:O,id:C,role:"radiogroup","aria-labelledby":b,"aria-describedby":h,onKeyDown:P}),defaultTag:"div",name:"RadioGroup"}))))}xn.displayName="RadioGroupContext",function(e){e[e.Empty=1]="Empty",e[e.Active=2]="Active"}(Sn||(Sn={})),On.Option=function e(n){var t=o.useRef(null),r="headlessui-radiogroup-option-"+x(),a=yn(),c=a[0],s=a[1],f=ee(),p=f[0],v=f[1],m=function(e){void 0===e&&(e=0);var n=o.useState(e),t=n[0],r=n[1];return{addFlag:o.useCallback((function(e){return r((function(n){return n|e}))}),[r]),hasFlag:o.useCallback((function(e){return Boolean(t&e)}),[t]),removeFlag:o.useCallback((function(e){return r((function(n){return n&~e}))}),[r]),toggleFlag:o.useCallback((function(e){return r((function(n){return n^e}))}),[r])}}(Sn.Empty),b=m.addFlag,g=m.removeFlag,h=m.hasFlag,S=n.value,C=n.disabled,E=void 0!==C&&C,I=l(n,["value","disabled"]),O=o.useRef({value:S,disabled:E});y((function(){O.current.value=S}),[S,O]),y((function(){O.current.disabled=E}),[E,O]);var w=En([On.name,e.name].join(".")),k=w.registerOption,R=w.disabled,P=w.change,T=w.firstOption,D=w.containsCheckedOption,F=w.value;y((function(){return k({id:r,element:t,propsRef:O})}),[r,k,t,n]);var L=o.useCallback((function(){var e;P(S)&&(b(Sn.Active),null==(e=t.current)||e.focus())}),[b,P,S]),A=o.useCallback((function(){return b(Sn.Active)}),[b]),M=o.useCallback((function(){return g(Sn.Active)}),[g]),N=R||E,U=F===S,j={ref:t,id:r,role:"radio","aria-checked":U?"true":"false","aria-labelledby":c,"aria-describedby":p,tabIndex:N?-1:U||!D&&(null==T?void 0:T.id)===r?0:-1,onClick:N?void 0:L,onFocus:N?void 0:A,onBlur:N?void 0:M},G=o.useMemo((function(){return{checked:U,disabled:N,active:h(Sn.Active)}}),[U,N,h]);return u.createElement(v,{name:"RadioGroup.Description"},u.createElement(s,{name:"RadioGroup.Label"},d({props:i({},I,j),slot:G,defaultTag:"div",name:"RadioGroup.Option"})))},On.Label=hn,On.Description=ne;var wn=o.createContext(null);wn.displayName="GroupContext";var kn,Rn=o.Fragment;function Pn(e){var n=e.checked,t=e.onChange,u=l(e,["checked","onChange"]),a="headlessui-switch-"+x(),c=o.useContext(wn),s=o.useCallback((function(){return t(!n)}),[t,n]),f=o.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();e.preventDefault(),s()}),[s]),p=o.useCallback((function(e){e.key!==r.Tab&&e.preventDefault(),e.key===r.Space&&s()}),[s]),v=o.useCallback((function(e){return e.preventDefault()}),[]),m=o.useMemo((function(){return{checked:n}}),[n]),b={id:a,ref:null===c?void 0:c.setSwitch,role:"switch",tabIndex:0,"aria-checked":n,"aria-labelledby":null==c?void 0:c.labelledby,"aria-describedby":null==c?void 0:c.describedby,onClick:f,onKeyUp:p,onKeyPress:v};return"button"===u.as&&Object.assign(b,{type:"button"}),d({props:i({},u,b),slot:m,defaultTag:"button",name:"Switch"})}function Tn(){var e=o.useRef(!0);return o.useEffect((function(){e.current=!1}),[]),e.current}function Dn(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).add.apply(n,r)}function Fn(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).remove.apply(n,r)}function Ln(e,n,t,r,o){var u=Ie(),a=void 0!==o?function(e){var n={called:!1};return function(){if(!n.called)return n.called=!0,e.apply(void 0,arguments)}}(o):function(){};return Dn.apply(void 0,[e].concat(n,t)),u.nextFrame((function(){Fn.apply(void 0,[e].concat(t)),Dn.apply(void 0,[e].concat(r)),u.add(function(e,n){var t=Ie();if(!e)return t.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var n=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,n){return n-e}))[0];return void 0===n?0:n})),u=o[0];return 0!==u?t.setTimeout((function(){n(kn.Finished)}),u+o[1]):n(kn.Finished),t.add((function(){return n(kn.Cancelled)})),t.dispose}(e,(function(t){return Fn.apply(void 0,[e].concat(r,n)),a(t)})))})),u.add((function(){return Fn.apply(void 0,[e].concat(n,t,r))})),u.add((function(){return a(kn.Cancelled)})),u.dispose}function An(e){return void 0===e&&(e=""),o.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Pn.Group=function(e){var n=o.useState(null),t=n[0],r=n[1],a=yn(),i=a[0],l=a[1],c=ee(),s=c[0],f=c[1],p=o.useMemo((function(){return{switch:t,setSwitch:r,labelledby:i,describedby:s}}),[t,r,i,s]);return u.createElement(f,{name:"Switch.Description"},u.createElement(l,{name:"Switch.Label",props:{onClick:function(){t&&(t.click(),t.focus({preventScroll:!0}))}}},u.createElement(wn.Provider,{value:p},d({props:e,defaultTag:Rn,name:"Switch.Group"}))))},Pn.Label=hn,Pn.Description=ne,function(e){e.Finished="finished",e.Cancelled="cancelled"}(kn||(kn={}));var Mn,Nn=o.createContext(null);Nn.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Mn||(Mn={}));var Un=o.createContext(null);function jn(e){return"children"in e?jn(e.children):e.current.filter((function(e){return e.state===Mn.Visible})).length>0}function Gn(e){var n=o.useRef(e),r=o.useRef([]),u=function(){var e=o.useRef(!0);return o.useEffect((function(){return function(){e.current=!1}}),[]),e}();o.useEffect((function(){n.current=e}),[e]);var a=o.useCallback((function(e,o){var a;void 0===o&&(o=t.Hidden);var i=r.current.findIndex((function(n){return n.id===e}));-1!==i&&(f(o,((a={})[t.Unmount]=function(){r.current.splice(i,1)},a[t.Hidden]=function(){r.current[i].state=Mn.Hidden},a)),!jn(r)&&u.current&&(null==n.current||n.current()))}),[n,u,r]),i=o.useCallback((function(e){var n=r.current.find((function(n){return n.id===e}));return n?n.state!==Mn.Visible&&(n.state=Mn.Visible):r.current.push({id:e,state:Mn.Visible}),function(){return a(e,t.Unmount)}}),[r,a]);return o.useMemo((function(){return{children:r,register:i,unregister:a}}),[i,a,r])}function Bn(){}Un.displayName="NestingContext";var Hn=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Vn(e){for(var n,t={},r=s(Hn);!(n=r()).done;){var o,u=n.value;t[u]=null!=(o=e[u])?o:Bn}return t}var Kn=n.RenderStrategy;function Qn(e){var n=e.beforeEnter,r=e.afterEnter,a=e.beforeLeave,c=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,b=e.leaveFrom,g=e.leaveTo,h=l(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),S=o.useRef(null),C=o.useState(Mn.Visible),E=C[0],I=C[1],O=h.unmount?t.Unmount:t.Hidden,w=function(){var e=o.useContext(Nn);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),k=w.show,R=w.appear,P=function(){var e=o.useContext(Un);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),T=P.register,D=P.unregister,F=Tn(),L=x(),A=o.useRef(!1),M=Gn((function(){A.current||(I(Mn.Hidden),D(L),V.current.afterLeave())}));y((function(){if(L)return T(L)}),[T,L]),y((function(){var e;O===t.Hidden&&L&&(k&&E!==Mn.Visible?I(Mn.Visible):f(E,((e={})[Mn.Hidden]=function(){return D(L)},e[Mn.Visible]=function(){return T(L)},e)))}),[E,L,T,D,k,O]);var N=An(s),U=An(p),j=An(v),G=An(m),B=An(b),H=An(g),V=function(e){var n=o.useRef(Vn(e));return o.useEffect((function(){n.current=Vn(e)}),[e]),n}({beforeEnter:n,afterEnter:r,beforeLeave:a,afterLeave:c});o.useEffect((function(){if(E===Mn.Visible&&null===S.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[S,E]);var K=F&&!R;return y((function(){var e=S.current;if(e&&!K)return A.current=!0,k&&V.current.beforeEnter(),k||V.current.beforeLeave(),k?Ln(e,N,U,j,(function(e){A.current=!1,e===kn.Finished&&V.current.afterEnter()})):Ln(e,G,B,H,(function(e){A.current=!1,e===kn.Finished&&(jn(M)||(I(Mn.Hidden),D(L),V.current.afterLeave()))}))}),[V,L,A,D,M,S,K,k,N,U,j,G,B,H]),u.createElement(Un.Provider,{value:M},d({props:i({},h,{ref:S}),defaultTag:"div",features:Kn,visible:E===Mn.Visible,name:"Transition.Child"}))}function Wn(e){var n=e.show,t=e.appear,r=void 0!==t&&t,a=e.unmount,c=l(e,["show","appear","unmount"]);if(![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=o.useState(n?Mn.Visible:Mn.Hidden),f=s[0],p=s[1],v=Gn((function(){p(Mn.Hidden)})),m=Tn(),b=o.useMemo((function(){return{show:n,appear:r||!m}}),[n,r,m]);o.useEffect((function(){n?p(Mn.Visible):jn(v)||p(Mn.Hidden)}),[n,v]);var g={unmount:a};return u.createElement(Un.Provider,{value:v},u.createElement(Nn.Provider,{value:b},d({props:i({},g,{as:o.Fragment,children:u.createElement(Qn,Object.assign({},g,c))}),defaultTag:o.Fragment,features:Kn,visible:f===Mn.Visible,name:"Transition"})))}Wn.Child=Qn,Wn.Root=Wn,exports.Dialog=se,exports.Disclosure=be,exports.FocusTrap=function(e){var n=o.useRef(new Set),t=e.initialFocus,r=l(e,["initialFocus"]);return A(n,!0,{initialFocus:t}),d({props:i({},r,{ref:function(e){e&&n.current.add(e)}}),defaultTag:"div",name:"FocusTrap"})},exports.Listbox=Le,exports.Menu=qe,exports.Popover=ln,exports.Portal=q,exports.RadioGroup=On,exports.Switch=Pn,exports.Transition=Wn; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n,t,r,o=require("react"),u=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,a=require("react-dom");function i(){return(i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function l(e,n){if(null==e)return{};var t,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n.indexOf(t=u[r])>=0||(o[t]=e[t]);return o}function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function s(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return c(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}function d(e,n){if(e in n){for(var t=n[e],r=arguments.length,o=new Array(r>2?r-2:0),u=2;u<r;u++)o[u-2]=arguments[u];return"function"==typeof t?t.apply(void 0,o):t}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(n).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,d),a}function f(e){var r=e.props,o=e.slot,u=e.defaultTag,a=e.features,c=e.visible,s=e.name;if(void 0===c||c)return p(r,o,u,s);var f=null!=a?a:n.None;if(f&n.Static){var v=r.static,m=void 0!==v&&v,b=l(r,["static"]);if(m)return p(b,o,u,s)}if(f&n.RenderStrategy){var g,y=r.unmount,h=void 0===y||y,S=l(r,["unmount"]);return d(h?t.Unmount:t.Hidden,((g={})[t.Unmount]=function(){return null},g[t.Hidden]=function(){return p(i({},S,{hidden:!0,style:{display:"none"}}),o,u,s)},g))}return p(r,o,u,s)}function p(e,n,t,r){var u;void 0===n&&(n={});var a=m(e,["unmount","static"]),i=a.as,c=void 0===i?t:i,d=a.children,f=a.refName,p=void 0===f?"ref":f,v=l(a,["as","children","refName"]),b=void 0!==e.ref?((u={})[p]=e.ref,u):{},g="function"==typeof d?d(n):d;if(v.className&&"function"==typeof v.className&&(v.className=v.className(n)),c===o.Fragment&&Object.keys(v).length>0){if(!o.isValidElement(g)||Array.isArray(g)&&g.length>1)throw new Error(['Passing props on "Fragment"!',"","The current component <"+r+' /> is rendering a "Fragment".',"However we need to passthrough the following props:",Object.keys(v).map((function(e){return" - "+e})).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((function(e){return" - "+e})).join("\n")].join("\n"));return o.cloneElement(g,Object.assign({},function(e,n,t){for(var r,o=Object.assign({},e),u=function(){var t,u=r.value;void 0!==e[u]&&void 0!==n[u]&&Object.assign(o,((t={})[u]=function(t){t.defaultPrevented||e[u](t),t.defaultPrevented||n[u](t)},t))},a=s(["onClick"]);!(r=a()).done;)u();return o}(function(e){var n=Object.assign({},e);for(var t in n)void 0===n[t]&&delete n[t];return n}(m(v,["ref"])),g.props),b))}return o.createElement(c,Object.assign({},m(v,["ref"]),c!==o.Fragment&&b),g)}function v(e){var n;return Object.assign(o.forwardRef(e),{displayName:null!=(n=e.displayName)?n:e.name})}function m(e,n){void 0===n&&(n=[]);for(var t,r=Object.assign({},e),o=s(n);!(t=o()).done;){var u=t.value;u in r&&delete r[u]}return r}function b(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=o.useRef(n);return o.useEffect((function(){r.current=n}),[n]),o.useCallback((function(e){for(var n,t=s(r.current);!(n=t()).done;){var o=n.value;null!=o&&("function"==typeof o?o(e):o.current=e)}}),[r])}function g(e){for(var n,t,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var u=null!=(n=""===(null==(t=r)?void 0:t.getAttribute("disabled")))&&n;return(!u||!function(e){if(!e)return!1;for(var n=e.previousElementSibling;null!==n;){if(n instanceof HTMLLegendElement)return!1;n=n.previousElementSibling}return!0}(o))&&u}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(n||(n={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(t||(t={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(r||(r={}));var y="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,h={serverHandoffComplete:!1};function S(){var e=o.useState(h.serverHandoffComplete),n=e[0],t=e[1];return o.useEffect((function(){!0!==n&&t(!0)}),[n]),o.useEffect((function(){!1===h.serverHandoffComplete&&(h.serverHandoffComplete=!0)}),[]),n}var C=0;function x(){return++C}function E(){var e=S(),n=o.useState(e?x:null),t=n[0],r=n[1];return y((function(){null===t&&r(x())}),[t]),null!=t?""+t:void 0}var O,I,w,k,R,P=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function T(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(P))}function D(e,n){var t;return void 0===n&&(n=k.Strict),e!==document.body&&d(n,((t={})[k.Strict]=function(){return e.matches(P)},t[k.Loose]=function(){for(var n=e;null!==n;){if(n.matches(P))return!0;n=n.parentElement}return!1},t))}function F(e){null==e||e.focus({preventScroll:!0})}function L(e,n){var t=Array.isArray(e)?e:T(e),r=document.activeElement,o=function(){if(n&(O.First|O.Next))return w.Next;if(n&(O.Previous|O.Last))return w.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),u=function(){if(n&O.First)return 0;if(n&O.Previous)return Math.max(0,t.indexOf(r))-1;if(n&O.Next)return Math.max(0,t.indexOf(r))+1;if(n&O.Last)return t.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),a=n&O.NoScroll?{preventScroll:!0}:{},i=0,l=t.length,c=void 0;do{var s;if(i>=l||i+l<=0)return I.Error;var d=u+i;if(n&O.WrapAround)d=(d+l)%l;else{if(d<0)return I.Underflow;if(d>=l)return I.Overflow}null==(s=c=t[d])||s.focus(a),i+=o}while(c!==document.activeElement);return c.hasAttribute("tabindex")||c.setAttribute("tabindex","0"),I.Success}function A(e,n,t){var r=o.useRef(n);r.current=n,o.useEffect((function(){function n(e){r.current.call(window,e)}return window.addEventListener(e,n,t),function(){return window.removeEventListener(e,n,t)}}),[e,t])}function M(){var e=o.useRef(!1);return o.useEffect((function(){return e.current=!0,function(){e.current=!1}}),[]),e}function N(e,n,t){void 0===n&&(n=R.All);var u=void 0===t?{}:t,a=u.initialFocus,i=u.containers,l=o.useRef("undefined"!=typeof window?document.activeElement:null),c=o.useRef(null),d=M(),f=Boolean(n&R.RestoreFocus),p=Boolean(n&R.InitialFocus);o.useEffect((function(){f&&(l.current=document.activeElement)}),[f]),o.useEffect((function(){if(f)return function(){F(l.current),l.current=null}}),[f]),o.useEffect((function(){if(p&&e.current){var n=document.activeElement;if(null==a?void 0:a.current){if((null==a?void 0:a.current)===n)return void(c.current=n)}else if(e.current.contains(n))return void(c.current=n);if(null==a?void 0:a.current)F(a.current);else if(L(e.current,O.First)===I.Error)throw new Error("There are no focusable elements inside the <FocusTrap />");c.current=document.activeElement}}),[e,a,p]),A("keydown",(function(t){n&R.TabLock&&e.current&&t.key===r.Tab&&(t.preventDefault(),L(e.current,(t.shiftKey?O.Previous:O.Next)|O.WrapAround)===I.Success&&(c.current=document.activeElement))})),A("focus",(function(t){if(n&R.FocusLock){var r=new Set(null==i?void 0:i.current);if(r.add(e),r.size){var o=c.current;if(o&&d.current){var u=t.target;u&&u instanceof HTMLElement?function(e,n){for(var t,r=s(e);!(t=r()).done;){var o;if(null==(o=t.value.current)?void 0:o.contains(n))return!0}return!1}(r,u)?(c.current=u,F(u)):(t.preventDefault(),t.stopPropagation(),F(o)):F(c.current)}}}}),!0)}!function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"}(O||(O={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(I||(I={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(w||(w={})),function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"}(k||(k={})),function(e){e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All"}(R||(R={}));var U=new Set,j=new Map;function G(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function B(e){var n=j.get(e);n&&(null===n["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert)}var H=o.createContext(!1);function V(e){return u.createElement(H.Provider,{value:e.force},e.children)}var K=o.Fragment;function Q(e){var n=e,t=function(){var e=o.useContext(H),n=o.useContext(q),t=o.useState((function(){if(!e&&null!==n)return null;if("undefined"==typeof window)return null;var t=document.getElementById("headlessui-portal-root");if(t)return t;var r=document.createElement("div");return r.setAttribute("id","headlessui-portal-root"),document.body.appendChild(r)})),r=t[0],u=t[1];return o.useEffect((function(){e||null!==n&&u(n.current)}),[n,u,e]),r}(),r=o.useState((function(){return"undefined"==typeof window?null:document.createElement("div")}))[0],u=S();return y((function(){if(t&&r)return t.appendChild(r),function(){var e;t&&r&&(t.removeChild(r),t.childNodes.length<=0&&(null==(e=t.parentElement)||e.removeChild(t)))}}),[t,r]),u&&t&&r?a.createPortal(f({props:n,defaultTag:K,name:"Portal"}),r):null}var W=o.Fragment,q=o.createContext(null);Q.Group=function(e){var n=e.target,t=l(e,["target"]);return u.createElement(q.Provider,{value:n},f({props:t,defaultTag:W,name:"Popover.Group"}))};var _=o.createContext(null);function Y(){var e=o.useContext(_);if(null===e){var n=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Y),n}return e}function z(){var e=o.useState([]),n=e[0],t=e[1];return[n.length>0?n.join(" "):void 0,o.useMemo((function(){return function(e){var n=o.useCallback((function(e){return t((function(n){return[].concat(n,[e])})),function(){return t((function(n){var t=n.slice(),r=t.indexOf(e);return-1!==r&&t.splice(r,1),t}))}}),[]),r=o.useMemo((function(){return{register:n,slot:e.slot,name:e.name,props:e.props}}),[n,e.slot,e.name,e.props]);return u.createElement(_.Provider,{value:r},e.children)}}),[t])]}function J(e){var n=Y(),t="headlessui-description-"+E();y((function(){return n.register(t)}),[t,n.register]);var r=e,o=i({},n.props,{id:t});return f({props:i({},r,o),slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})}var $,X=o.createContext(null);function Z(){return o.useContext(X)}function ee(e){return u.createElement(X.Provider,{value:e.value},e.children)}X.displayName="OpenClosedContext",function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}($||($={}));var ne,te,re,oe,ue=o.createContext((function(){}));function ae(e){var n=e.children,t=e.onUpdate,r=e.type,a=e.element,i=o.useContext(ue),l=o.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];null==t||t.apply(void 0,n),i.apply(void 0,n)}),[i,t]);return y((function(){return l(ne.Add,r,a),function(){return l(ne.Remove,r,a)}}),[l,r,a]),u.createElement(ue.Provider,{value:l},n)}ue.displayName="StackContext",function(e){e[e.Add=0]="Add",e[e.Remove=1]="Remove"}(ne||(ne={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(re||(re={})),function(e){e[e.SetTitleId=0]="SetTitleId"}(oe||(oe={}));var ie=((te={})[oe.SetTitleId]=function(e,n){return e.titleId===n.id?e:i({},e,{titleId:n.id})},te),le=o.createContext(null);function ce(e){var n=o.useContext(le);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+me.displayName+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ce),t}return n}function se(e,n){return d(n.type,ie,e,n)}le.displayName="DialogContext";var de,fe,pe,ve=n.RenderStrategy|n.Static,me=Object.assign(v((function(e,n){var t,a=e.open,c=e.onClose,p=e.initialFocus,v=l(e,["open","onClose","initialFocus"]),m=o.useState(0),g=m[0],h=m[1],C=Z();void 0===a&&null!==C&&(a=d(C,((t={})[$.Open]=!0,t[$.Closed]=!1,t)));var x=o.useRef(new Set),O=o.useRef(null),I=b(O,n),w=e.hasOwnProperty("open")||null!==C,k=e.hasOwnProperty("onClose");if(!w&&!k)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!w)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!k)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof a)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+a);if("function"!=typeof c)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+c);var P=a?re.Open:re.Closed,T=null!==C?C===$.Open:P===re.Open,D=o.useReducer(se,{titleId:null,descriptionId:null}),F=D[0],L=D[1],M=o.useCallback((function(){return c(!1)}),[c]),H=o.useCallback((function(e){return L({type:oe.SetTitleId,id:e})}),[L]),K=S()&&P===re.Open,W=g>1,q=null!==o.useContext(le);N(O,K?d(W?"parent":"leaf",{parent:R.RestoreFocus,leaf:R.All}):R.None,{initialFocus:p,containers:x}),function(e,n){void 0===n&&(n=!0),y((function(){if(n&&e.current){var t=e.current;U.add(t);for(var r,o=s(j.keys());!(r=o()).done;){var u=r.value;u.contains(t)&&(B(u),j.delete(u))}return document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var n,t=s(U);!(n=t()).done;)if(e.contains(n.value))return;1===U.size&&(j.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),G(e))}})),function(){if(U.delete(t),U.size>0)document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!j.has(e)){for(var n,t=s(U);!(n=t()).done;)if(e.contains(n.value))return;j.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),G(e)}}));else for(var e,n=s(j.keys());!(e=n()).done;){var r=e.value;B(r),j.delete(r)}}}}),[n])}(O,!!W&&K),A("mousedown",(function(e){var n;P===re.Open&&(W||(null==(n=O.current)?void 0:n.contains(e.target))||M())})),o.useEffect((function(){if(P===re.Open&&!q){var e=document.documentElement.style.overflow,n=document.documentElement.style.paddingRight,t=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=t+"px",function(){document.documentElement.style.overflow=e,document.documentElement.style.paddingRight=n}}}),[P,q]),o.useEffect((function(){if(P===re.Open&&O.current){var e=new IntersectionObserver((function(e){for(var n,t=s(e);!(n=t()).done;){var r=n.value;0===r.boundingClientRect.x&&0===r.boundingClientRect.y&&0===r.boundingClientRect.width&&0===r.boundingClientRect.height&&M()}}));return e.observe(O.current),function(){return e.disconnect()}}}),[P,O,M]);var _=z(),Y=_[0],J=_[1],X="headlessui-dialog-"+E(),ee=o.useMemo((function(){return[{dialogState:P,close:M,setTitleId:H},F]}),[P,F,M,H]),te=o.useMemo((function(){return{open:P===re.Open}}),[P]),ue={ref:I,id:X,role:"dialog","aria-modal":P===re.Open||void 0,"aria-labelledby":F.titleId,"aria-describedby":Y,onClick:function(e){e.stopPropagation()},onKeyDown:function(e){e.key===r.Escape&&P===re.Open&&(W||(e.preventDefault(),e.stopPropagation(),M()))}},ie=v;return u.createElement(ae,{type:"Dialog",element:O,onUpdate:o.useCallback((function(e,n,t){var r;"Dialog"===n&&d(e,((r={})[ne.Add]=function(){x.current.add(t),h((function(e){return e+1}))},r[ne.Remove]=function(){x.current.add(t),h((function(e){return e-1}))},r))}),[])},u.createElement(V,{force:!0},u.createElement(Q,null,u.createElement(le.Provider,{value:ee},u.createElement(Q.Group,{target:O},u.createElement(V,{force:!1},u.createElement(J,{slot:te,name:"Dialog.Description"},f({props:i({},ie,ue),slot:te,defaultTag:"div",features:ve,visible:T,name:"Dialog"}))))))))})),{Overlay:v((function e(n,t){var r=ce([me.displayName,e.name].join("."))[0],u=r.dialogState,a=r.close,l=b(t),c="headlessui-dialog-overlay-"+E(),s=o.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),a()}),[a]),d=o.useMemo((function(){return{open:u===re.Open}}),[u]);return f({props:i({},n,{ref:l,id:c,"aria-hidden":!0,onClick:s}),slot:d,defaultTag:"div",name:"Dialog.Overlay"})})),Title:function e(n){var t=ce([me.displayName,e.name].join("."))[0],r=t.dialogState,u=t.setTitleId,a="headlessui-dialog-title-"+E();o.useEffect((function(){return u(a),function(){return u(null)}}),[a,u]);var l=o.useMemo((function(){return{open:r===re.Open}}),[r]);return f({props:i({},n,{id:a}),slot:l,defaultTag:"h2",name:"Dialog.Title"})},Description:J});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(fe||(fe={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.SetButtonId=1]="SetButtonId",e[e.SetPanelId=2]="SetPanelId",e[e.LinkPanel=3]="LinkPanel",e[e.UnlinkPanel=4]="UnlinkPanel"}(pe||(pe={}));var be=((de={})[pe.ToggleDisclosure]=function(e){var n;return i({},e,{disclosureState:d(e.disclosureState,(n={},n[fe.Open]=fe.Closed,n[fe.Closed]=fe.Open,n))})},de[pe.LinkPanel]=function(e){return!0===e.linkedPanel?e:i({},e,{linkedPanel:!0})},de[pe.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:i({},e,{linkedPanel:!1})},de[pe.SetButtonId]=function(e,n){return e.buttonId===n.buttonId?e:i({},e,{buttonId:n.buttonId})},de[pe.SetPanelId]=function(e,n){return e.panelId===n.panelId?e:i({},e,{panelId:n.panelId})},de),ge=o.createContext(null);function ye(e){var n=o.useContext(ge);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+Ce.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ye),t}return n}function he(e,n){return d(n.type,be,e,n)}ge.displayName="DisclosureContext";var Se=o.Fragment;function Ce(e){var n,t=e.defaultOpen,r=void 0!==t&&t,a=l(e,["defaultOpen"]),i="headlessui-disclosure-button-"+E(),c="headlessui-disclosure-panel-"+E(),s=o.useReducer(he,{disclosureState:r?fe.Open:fe.Closed,linkedPanel:!1,buttonId:i,panelId:c}),p=s[0].disclosureState,v=s[1];o.useEffect((function(){return v({type:pe.SetButtonId,buttonId:i})}),[i,v]),o.useEffect((function(){return v({type:pe.SetPanelId,panelId:c})}),[c,v]);var m=o.useMemo((function(){return{open:p===fe.Open}}),[p]);return u.createElement(ge.Provider,{value:s},u.createElement(ee,{value:d(p,(n={},n[fe.Open]=$.Open,n[fe.Closed]=$.Closed,n))},f({props:a,slot:m,defaultTag:Se,name:"Disclosure"})))}var xe,Ee,Oe,Ie,we=v((function e(n,t){var u=ye([Ce.name,e.name].join(".")),a=u[0],l=u[1],c=b(t),s=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:e.preventDefault(),e.stopPropagation(),l({type:pe.ToggleDisclosure})}}),[l]),d=o.useCallback((function(e){switch(e.key){case r.Space:e.preventDefault()}}),[]),p=o.useCallback((function(e){g(e.currentTarget)||n.disabled||l({type:pe.ToggleDisclosure})}),[l,n.disabled]),v=o.useMemo((function(){return{open:a.disclosureState===fe.Open}}),[a]);return f({props:i({},n,{ref:c,id:a.buttonId,type:"button","aria-expanded":a.disclosureState===fe.Open||void 0,"aria-controls":a.linkedPanel?a.panelId:void 0,onKeyDown:s,onKeyUp:d,onClick:p}),slot:v,defaultTag:"button",name:"Disclosure.Button"})})),ke=n.RenderStrategy|n.Static,Re=v((function e(n,t){var r=ye([Ce.name,e.name].join(".")),u=r[0],a=r[1],l=b(t,(function(){u.linkedPanel||a({type:pe.LinkPanel})})),c=Z(),s=null!==c?c===$.Open:u.disclosureState===fe.Open;o.useEffect((function(){return function(){return a({type:pe.UnlinkPanel})}}),[a]),o.useEffect((function(){var e;u.disclosureState!==fe.Closed||null!=(e=n.unmount)&&!e||a({type:pe.UnlinkPanel})}),[u.disclosureState,n.unmount,a]);var d=o.useMemo((function(){return{open:u.disclosureState===fe.Open}}),[u]);return f({props:i({},n,{ref:l,id:u.panelId}),slot:d,defaultTag:"div",features:ke,visible:s,name:"Disclosure.Panel"})}));function Pe(){var e=[],n={requestAnimationFrame:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=requestAnimationFrame.apply(void 0,arguments);n.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];n.requestAnimationFrame((function(){n.requestAnimationFrame.apply(n,t)}))},setTimeout:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=setTimeout.apply(void 0,arguments);n.add((function(){return clearTimeout(e)}))})),add:function(n){e.push(n)},dispose:function(){for(var n,t=s(e.splice(0));!(n=t()).done;)(0,n.value)()}};return n}function Te(){var e=o.useState(Pe)[0];return o.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function De(e,n){var t=o.useState(e),r=t[0],u=t[1],a=o.useRef(e);return y((function(){a.current=e}),[e]),y((function(){return u(a.current)}),[a,u].concat(n)),r}function Fe(e,n){var t=n.resolveItems();if(t.length<=0)return null;var r=n.resolveActiveIndex(),o=null!=r?r:-1,u=function(){switch(e.focus){case xe.First:return t.findIndex((function(e){return!n.resolveDisabled(e)}));case xe.Previous:var r=t.slice().reverse().findIndex((function(e,t,r){return!(-1!==o&&r.length-t-1>=o||n.resolveDisabled(e))}));return-1===r?r:t.length-1-r;case xe.Next:return t.findIndex((function(e,t){return!(t<=o||n.resolveDisabled(e))}));case xe.Last:var u=t.slice().reverse().findIndex((function(e){return!n.resolveDisabled(e)}));return-1===u?u:t.length-1-u;case xe.Specific:return t.findIndex((function(t){return n.resolveId(t)===e.id}));case xe.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?r:u}Ce.Button=we,Ce.Panel=Re,function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(xe||(xe={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Oe||(Oe={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(Ie||(Ie={}));var Le=((Ee={})[Ie.CloseListbox]=function(e){return e.disabled||e.listboxState===Oe.Closed?e:i({},e,{activeOptionIndex:null,listboxState:Oe.Closed})},Ee[Ie.OpenListbox]=function(e){return e.disabled||e.listboxState===Oe.Open?e:i({},e,{listboxState:Oe.Open})},Ee[Ie.SetDisabled]=function(e,n){return e.disabled===n.disabled?e:i({},e,{disabled:n.disabled})},Ee[Ie.GoToOption]=function(e,n){if(e.disabled)return e;if(e.listboxState===Oe.Closed)return e;var t=Fe(n,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===t?e:i({},e,{searchQuery:"",activeOptionIndex:t})},Ee[Ie.Search]=function(e,n){if(e.disabled)return e;if(e.listboxState===Oe.Closed)return e;var t=e.searchQuery+n.value.toLowerCase(),r=e.options.findIndex((function(e){var n;return!e.dataRef.current.disabled&&(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(t))}));return i({},e,-1===r||r===e.activeOptionIndex?{searchQuery:t}:{searchQuery:t,activeOptionIndex:r})},Ee[Ie.ClearSearch]=function(e){return e.disabled||e.listboxState===Oe.Closed||""===e.searchQuery?e:i({},e,{searchQuery:""})},Ee[Ie.RegisterOption]=function(e,n){return i({},e,{options:[].concat(e.options,[{id:n.id,dataRef:n.dataRef}])})},Ee[Ie.UnregisterOption]=function(e,n){var t=e.options.slice(),r=null!==e.activeOptionIndex?t[e.activeOptionIndex]:null,o=t.findIndex((function(e){return e.id===n.id}));return-1!==o&&t.splice(o,1),i({},e,{options:t,activeOptionIndex:o===e.activeOptionIndex||null===r?null:t.indexOf(r)})},Ee),Ae=o.createContext(null);function Me(e){var n=o.useContext(Ae);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+je.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Me),t}return n}function Ne(e,n){return d(n.type,Le,e,n)}Ae.displayName="ListboxContext";var Ue=o.Fragment;function je(e){var n,t=e.value,r=e.onChange,a=e.disabled,i=void 0!==a&&a,c=l(e,["value","onChange","disabled"]),s=o.useReducer(Ne,{listboxState:Oe.Closed,propsRef:{current:{value:t,onChange:r}},labelRef:o.createRef(),buttonRef:o.createRef(),optionsRef:o.createRef(),disabled:i,options:[],searchQuery:"",activeOptionIndex:null}),p=s[0],v=p.listboxState,m=p.propsRef,b=p.optionsRef,g=p.buttonRef,h=s[1];y((function(){m.current.value=t}),[t,m]),y((function(){m.current.onChange=r}),[r,m]),y((function(){return h({type:Ie.SetDisabled,disabled:i})}),[i]),A("mousedown",(function(e){var n,t,r,o=e.target;v===Oe.Open&&((null==(n=g.current)?void 0:n.contains(o))||(null==(t=b.current)?void 0:t.contains(o))||(h({type:Ie.CloseListbox}),D(o,k.Loose)||(e.preventDefault(),null==(r=g.current)||r.focus())))}));var S=o.useMemo((function(){return{open:v===Oe.Open,disabled:i}}),[v,i]);return u.createElement(Ae.Provider,{value:s},u.createElement(ee,{value:d(v,(n={},n[Oe.Open]=$.Open,n[Oe.Closed]=$.Closed,n))},f({props:c,slot:S,defaultTag:Ue,name:"Listbox"})))}var Ge,Be,He,Ve=v((function e(n,t){var u,a=Me([je.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.buttonRef,t),d="headlessui-listbox-button-"+E(),p=Te(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),c({type:Ie.OpenListbox}),p.nextFrame((function(){l.propsRef.current.value||c({type:Ie.GoToOption,focus:xe.First})}));break;case r.ArrowUp:e.preventDefault(),c({type:Ie.OpenListbox}),p.nextFrame((function(){l.propsRef.current.value||c({type:Ie.GoToOption,focus:xe.Last})}))}}),[c,l,p]),m=o.useCallback((function(e){switch(e.key){case r.Space:e.preventDefault()}}),[]),y=o.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();l.listboxState===Oe.Open?(c({type:Ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),c({type:Ie.OpenListbox}))}),[c,p,l]),h=De((function(){if(l.labelRef.current)return[l.labelRef.current.id,d].join(" ")}),[l.labelRef.current,d]),S=o.useMemo((function(){return{open:l.listboxState===Oe.Open,disabled:l.disabled}}),[l]);return f({props:i({},n,{ref:s,id:d,type:"button","aria-haspopup":!0,"aria-controls":null==(u=l.optionsRef.current)?void 0:u.id,"aria-expanded":l.listboxState===Oe.Open||void 0,"aria-labelledby":h,disabled:l.disabled,onKeyDown:v,onKeyUp:m,onClick:y}),slot:S,defaultTag:"button",name:"Listbox.Button"})})),Ke=n.RenderStrategy|n.Static,Qe=v((function e(n,t){var u,a=Me([je.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.optionsRef,t),d="headlessui-listbox-options-"+E(),p=Te(),v=Te(),m=Z(),g=null!==m?m===$.Open:l.listboxState===Oe.Open;y((function(){var e=l.optionsRef.current;e&&l.listboxState===Oe.Open&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[l.listboxState,l.optionsRef]);var h=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==l.searchQuery)return e.preventDefault(),e.stopPropagation(),c({type:Ie.Search,value:e.key});case r.Enter:e.preventDefault(),e.stopPropagation(),c({type:Ie.CloseListbox}),null!==l.activeOptionIndex&&l.propsRef.current.onChange(l.options[l.activeOptionIndex].dataRef.current.value),Pe().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),e.stopPropagation(),c({type:Ie.GoToOption,focus:xe.Next});case r.ArrowUp:return e.preventDefault(),e.stopPropagation(),c({type:Ie.GoToOption,focus:xe.Previous});case r.Home:case r.PageUp:return e.preventDefault(),e.stopPropagation(),c({type:Ie.GoToOption,focus:xe.First});case r.End:case r.PageDown:return e.preventDefault(),e.stopPropagation(),c({type:Ie.GoToOption,focus:xe.Last});case r.Escape:return e.preventDefault(),e.stopPropagation(),c({type:Ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case r.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(c({type:Ie.Search,value:e.key}),v.setTimeout((function(){return c({type:Ie.ClearSearch})}),350))}}),[p,c,v,l]),S=De((function(){var e,n,t;return null!=(e=null==(n=l.labelRef.current)?void 0:n.id)?e:null==(t=l.buttonRef.current)?void 0:t.id}),[l.labelRef.current,l.buttonRef.current]),C=o.useMemo((function(){return{open:l.listboxState===Oe.Open}}),[l]);return f({props:i({},n,{"aria-activedescendant":null===l.activeOptionIndex||null==(u=l.options[l.activeOptionIndex])?void 0:u.id,"aria-labelledby":S,id:d,onKeyDown:h,role:"listbox",tabIndex:0,ref:s}),slot:C,defaultTag:"ul",features:Ke,visible:g,name:"Listbox.Options"})}));function We(e){var n=e.container,t=e.accept,r=e.walk,u=e.enabled,a=void 0===u||u,i=o.useRef(t),l=o.useRef(r);o.useEffect((function(){i.current=t,l.current=r}),[t,r]),y((function(){if(n&&a)for(var e=i.current,t=l.current,r=Object.assign((function(n){return e(n)}),{acceptNode:e}),o=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,r,!1);o.nextNode();)t(o.currentNode)}),[n,a,i,l])}je.Button=Ve,je.Label=function e(n){var t=Me([je.name,e.name].join("."))[0],r="headlessui-listbox-label-"+E(),u=o.useCallback((function(){var e;return null==(e=t.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[t.buttonRef]),a=o.useMemo((function(){return{open:t.listboxState===Oe.Open,disabled:t.disabled}}),[t]);return f({props:i({},n,{ref:t.labelRef,id:r,onClick:u}),slot:a,defaultTag:"label",name:"Listbox.Label"})},je.Options=Qe,je.Option=function e(n){var t=n.disabled,r=void 0!==t&&t,u=n.value,a=l(n,["disabled","value"]),c=Me([je.name,e.name].join(".")),s=c[0],d=c[1],p="headlessui-listbox-option-"+E(),v=null!==s.activeOptionIndex&&s.options[s.activeOptionIndex].id===p,m=s.propsRef.current.value===u,b=o.useRef({disabled:r,value:u});y((function(){b.current.disabled=r}),[b,r]),y((function(){b.current.value=u}),[b,u]),y((function(){var e,n;b.current.textValue=null==(e=document.getElementById(p))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[b,p]);var g=o.useCallback((function(){return s.propsRef.current.onChange(u)}),[s.propsRef,u]);y((function(){return d({type:Ie.RegisterOption,id:p,dataRef:b}),function(){return d({type:Ie.UnregisterOption,id:p})}}),[b,p]),y((function(){var e;s.listboxState===Oe.Open&&m&&(d({type:Ie.GoToOption,focus:xe.Specific,id:p}),null==(e=document.getElementById(p))||null==e.focus||e.focus())}),[s.listboxState]),y((function(){if(s.listboxState===Oe.Open&&v){var e=Pe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(p))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[p,v,s.listboxState]);var h=o.useCallback((function(e){if(r)return e.preventDefault();g(),d({type:Ie.CloseListbox}),Pe().nextFrame((function(){var e;return null==(e=s.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[d,s.buttonRef,r,g]),S=o.useCallback((function(){if(r)return d({type:Ie.GoToOption,focus:xe.Nothing});d({type:Ie.GoToOption,focus:xe.Specific,id:p})}),[r,p,d]),C=o.useCallback((function(){r||v||d({type:Ie.GoToOption,focus:xe.Specific,id:p})}),[r,v,p,d]),x=o.useCallback((function(){r||v&&d({type:Ie.GoToOption,focus:xe.Nothing})}),[r,v,d]),O=o.useMemo((function(){return{active:v,selected:m,disabled:r}}),[v,m,r]);return f({props:i({},a,{id:p,role:"option",tabIndex:!0===r?void 0:-1,"aria-disabled":!0===r||void 0,"aria-selected":!0===m||void 0,disabled:void 0,onClick:h,onFocus:S,onPointerMove:C,onMouseMove:C,onPointerLeave:x,onMouseLeave:x}),slot:O,defaultTag:"li",name:"Listbox.Option"})},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Be||(Be={})),function(e){e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem"}(He||(He={}));var qe=((Ge={})[He.CloseMenu]=function(e){return e.menuState===Be.Closed?e:i({},e,{activeItemIndex:null,menuState:Be.Closed})},Ge[He.OpenMenu]=function(e){return e.menuState===Be.Open?e:i({},e,{menuState:Be.Open})},Ge[He.GoToItem]=function(e,n){var t=Fe(n,{resolveItems:function(){return e.items},resolveActiveIndex:function(){return e.activeItemIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeItemIndex===t?e:i({},e,{searchQuery:"",activeItemIndex:t})},Ge[He.Search]=function(e,n){var t=e.searchQuery+n.value.toLowerCase(),r=e.items.findIndex((function(e){var n;return(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(t))&&!e.dataRef.current.disabled}));return i({},e,-1===r||r===e.activeItemIndex?{searchQuery:t}:{searchQuery:t,activeItemIndex:r})},Ge[He.ClearSearch]=function(e){return""===e.searchQuery?e:i({},e,{searchQuery:""})},Ge[He.RegisterItem]=function(e,n){return i({},e,{items:[].concat(e.items,[{id:n.id,dataRef:n.dataRef}])})},Ge[He.UnregisterItem]=function(e,n){var t=e.items.slice(),r=null!==e.activeItemIndex?t[e.activeItemIndex]:null,o=t.findIndex((function(e){return e.id===n.id}));return-1!==o&&t.splice(o,1),i({},e,{items:t,activeItemIndex:o===e.activeItemIndex||null===r?null:t.indexOf(r)})},Ge),_e=o.createContext(null);function Ye(e){var n=o.useContext(_e);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+$e.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Ye),t}return n}function ze(e,n){return d(n.type,qe,e,n)}_e.displayName="MenuContext";var Je=o.Fragment;function $e(e){var n,t=o.useReducer(ze,{menuState:Be.Closed,buttonRef:o.createRef(),itemsRef:o.createRef(),items:[],searchQuery:"",activeItemIndex:null}),r=t[0],a=r.menuState,i=r.itemsRef,l=r.buttonRef,c=t[1];A("mousedown",(function(e){var n,t,r,o=e.target;a===Be.Open&&((null==(n=l.current)?void 0:n.contains(o))||(null==(t=i.current)?void 0:t.contains(o))||(c({type:He.CloseMenu}),D(o,k.Loose)||(e.preventDefault(),null==(r=l.current)||r.focus())))}));var s=o.useMemo((function(){return{open:a===Be.Open}}),[a]);return u.createElement(_e.Provider,{value:t},u.createElement(ee,{value:d(a,(n={},n[Be.Open]=$.Open,n[Be.Closed]=$.Closed,n))},f({props:e,slot:s,defaultTag:Je,name:"Menu"})))}var Xe,Ze,en,nn=v((function e(n,t){var u,a=Ye([$e.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.buttonRef,t),d="headlessui-menu-button-"+E(),p=Te(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),e.stopPropagation(),c({type:He.OpenMenu}),p.nextFrame((function(){return c({type:He.GoToItem,focus:xe.First})}));break;case r.ArrowUp:e.preventDefault(),e.stopPropagation(),c({type:He.OpenMenu}),p.nextFrame((function(){return c({type:He.GoToItem,focus:xe.Last})}))}}),[c,p]),m=o.useCallback((function(e){switch(e.key){case r.Space:e.preventDefault()}}),[]),y=o.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();n.disabled||(l.menuState===Be.Open?(c({type:He.CloseMenu}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),e.stopPropagation(),c({type:He.OpenMenu})))}),[c,p,l,n.disabled]),h=o.useMemo((function(){return{open:l.menuState===Be.Open}}),[l]);return f({props:i({},n,{ref:s,id:d,type:"button","aria-haspopup":!0,"aria-controls":null==(u=l.itemsRef.current)?void 0:u.id,"aria-expanded":l.menuState===Be.Open||void 0,onKeyDown:v,onKeyUp:m,onClick:y}),slot:h,defaultTag:"button",name:"Menu.Button"})})),tn=n.RenderStrategy|n.Static,rn=v((function e(n,t){var u,a,l=Ye([$e.name,e.name].join(".")),c=l[0],s=l[1],d=b(c.itemsRef,t),p="headlessui-menu-items-"+E(),v=Te(),m=Z(),g=null!==m?m===$.Open:c.menuState===Be.Open;o.useEffect((function(){var e=c.itemsRef.current;e&&c.menuState===Be.Open&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[c.menuState,c.itemsRef]),We({container:c.itemsRef.current,enabled:c.menuState===Be.Open,accept:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk:function(e){e.setAttribute("role","none")}});var y=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==c.searchQuery)return e.preventDefault(),e.stopPropagation(),s({type:He.Search,value:e.key});case r.Enter:var n;e.preventDefault(),e.stopPropagation(),s({type:He.CloseMenu}),null!==c.activeItemIndex&&(null==(n=document.getElementById(c.items[c.activeItemIndex].id))||n.click()),Pe().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),e.stopPropagation(),s({type:He.GoToItem,focus:xe.Next});case r.ArrowUp:return e.preventDefault(),e.stopPropagation(),s({type:He.GoToItem,focus:xe.Previous});case r.Home:case r.PageUp:return e.preventDefault(),e.stopPropagation(),s({type:He.GoToItem,focus:xe.First});case r.End:case r.PageDown:return e.preventDefault(),e.stopPropagation(),s({type:He.GoToItem,focus:xe.Last});case r.Escape:e.preventDefault(),e.stopPropagation(),s({type:He.CloseMenu}),Pe().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(s({type:He.Search,value:e.key}),v.setTimeout((function(){return s({type:He.ClearSearch})}),350))}}),[s,v,c]),h=o.useCallback((function(e){switch(e.key){case r.Space:e.preventDefault()}}),[]),S=o.useMemo((function(){return{open:c.menuState===Be.Open}}),[c]);return f({props:i({},n,{"aria-activedescendant":null===c.activeItemIndex||null==(u=c.items[c.activeItemIndex])?void 0:u.id,"aria-labelledby":null==(a=c.buttonRef.current)?void 0:a.id,id:p,onKeyDown:y,onKeyUp:h,role:"menu",tabIndex:0,ref:d}),slot:S,defaultTag:"div",features:tn,visible:g,name:"Menu.Items"})})),on=o.Fragment;$e.Button=nn,$e.Items=rn,$e.Item=function e(n){var t=n.disabled,r=void 0!==t&&t,u=n.onClick,a=l(n,["disabled","onClick"]),c=Ye([$e.name,e.name].join(".")),s=c[0],d=c[1],p="headlessui-menu-item-"+E(),v=null!==s.activeItemIndex&&s.items[s.activeItemIndex].id===p;y((function(){if(s.menuState===Be.Open&&v){var e=Pe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(p))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[p,v,s.menuState]);var m=o.useRef({disabled:r});y((function(){m.current.disabled=r}),[m,r]),y((function(){var e,n;m.current.textValue=null==(e=document.getElementById(p))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[m,p]),y((function(){return d({type:He.RegisterItem,id:p,dataRef:m}),function(){return d({type:He.UnregisterItem,id:p})}}),[m,p]);var b=o.useCallback((function(e){return r?e.preventDefault():(d({type:He.CloseMenu}),Pe().nextFrame((function(){var e;return null==(e=s.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[d,s.buttonRef,r,u]),g=o.useCallback((function(){if(r)return d({type:He.GoToItem,focus:xe.Nothing});d({type:He.GoToItem,focus:xe.Specific,id:p})}),[r,p,d]),h=o.useCallback((function(){r||v||d({type:He.GoToItem,focus:xe.Specific,id:p})}),[r,v,p,d]),S=o.useCallback((function(){r||v&&d({type:He.GoToItem,focus:xe.Nothing})}),[r,v,d]),C=o.useMemo((function(){return{active:v,disabled:r}}),[v,r]);return f({props:i({},a,{id:p,role:"menuitem",tabIndex:!0===r?void 0:-1,"aria-disabled":!0===r||void 0,disabled:void 0,onClick:b,onFocus:g,onPointerMove:h,onMouseMove:h,onPointerLeave:S,onMouseLeave:S}),slot:C,defaultTag:on,name:"Menu.Item"})},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Ze||(Ze={})),function(e){e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId"}(en||(en={}));var un=((Xe={})[en.TogglePopover]=function(e){var n;return i({},e,{popoverState:d(e.popoverState,(n={},n[Ze.Open]=Ze.Closed,n[Ze.Closed]=Ze.Open,n))})},Xe[en.ClosePopover]=function(e){return e.popoverState===Ze.Closed?e:i({},e,{popoverState:Ze.Closed})},Xe[en.SetButton]=function(e,n){return e.button===n.button?e:i({},e,{button:n.button})},Xe[en.SetButtonId]=function(e,n){return e.buttonId===n.buttonId?e:i({},e,{buttonId:n.buttonId})},Xe[en.SetPanel]=function(e,n){return e.panel===n.panel?e:i({},e,{panel:n.panel})},Xe[en.SetPanelId]=function(e,n){return e.panelId===n.panelId?e:i({},e,{panelId:n.panelId})},Xe),an=o.createContext(null);function ln(e){var n=o.useContext(an);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+pn.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ln),t}return n}an.displayName="PopoverContext";var cn=o.createContext(null);function sn(){return o.useContext(cn)}cn.displayName="PopoverGroupContext";var dn=o.createContext(null);function fn(e,n){return d(n.type,un,e,n)}function pn(e){var n,t="headlessui-popover-button-"+E(),r="headlessui-popover-panel-"+E(),a=o.useReducer(fn,{popoverState:Ze.Closed,button:null,buttonId:t,panel:null,panelId:r}),i=a[0],l=i.popoverState,c=i.button,s=i.panel,p=a[1];o.useEffect((function(){return p({type:en.SetButtonId,buttonId:t})}),[t,p]),o.useEffect((function(){return p({type:en.SetPanelId,panelId:r})}),[r,p]);var v=o.useMemo((function(){return{buttonId:t,panelId:r,close:function(){return p({type:en.ClosePopover})}}}),[t,r,p]),m=sn(),b=null==m?void 0:m.registerPopover,g=o.useCallback((function(){var e;return null!=(e=null==m?void 0:m.isFocusWithinPopoverGroup())?e:(null==c?void 0:c.contains(document.activeElement))||(null==s?void 0:s.contains(document.activeElement))}),[m,c,s]);o.useEffect((function(){return null==b?void 0:b(v)}),[b,v]),A("focus",(function(){l===Ze.Open&&(g()||c&&s&&p({type:en.ClosePopover}))}),!0),A("mousedown",(function(e){var n=e.target;l===Ze.Open&&((null==c?void 0:c.contains(n))||(null==s?void 0:s.contains(n))||(p({type:en.ClosePopover}),D(n,k.Loose)||(e.preventDefault(),null==c||c.focus())))}));var y=o.useMemo((function(){return{open:l===Ze.Open}}),[l]);return u.createElement(an.Provider,{value:a},u.createElement(ee,{value:d(l,(n={},n[Ze.Open]=$.Open,n[Ze.Closed]=$.Closed,n))},f({props:e,slot:y,defaultTag:"div",name:"Popover"})))}dn.displayName="PopoverPanelContext";var vn=v((function e(n,t){var u=ln([pn.name,e.name].join(".")),a=u[0],l=u[1],c=o.useRef(null),s=sn(),d=null==s?void 0:s.closeOthers,p=o.useContext(dn),v=null!==p&&p===a.panelId,m=b(c,t,v?null:function(e){return l({type:en.SetButton,button:e})}),y=o.useRef(null),h=o.useRef("undefined"==typeof window?null:document.activeElement);A("focus",(function(){h.current=y.current,y.current=document.activeElement}),!0);var S=o.useCallback((function(e){var n;if(v){if(a.popoverState===Ze.Closed)return;switch(e.key){case r.Space:case r.Enter:e.preventDefault(),e.stopPropagation(),l({type:en.ClosePopover}),null==(n=a.button)||n.focus()}}else switch(e.key){case r.Space:case r.Enter:e.preventDefault(),e.stopPropagation(),a.popoverState===Ze.Closed&&(null==d||d(a.buttonId)),l({type:en.TogglePopover});break;case r.Escape:if(a.popoverState!==Ze.Open)return null==d?void 0:d(a.buttonId);if(!c.current)return;if(!c.current.contains(document.activeElement))return;l({type:en.ClosePopover});break;case r.Tab:if(a.popoverState!==Ze.Open)return;if(!a.panel)return;if(!a.button)return;if(e.shiftKey){var t;if(!h.current)return;if(null==(t=a.button)?void 0:t.contains(h.current))return;if(a.panel.contains(h.current))return;var o=T(),u=o.indexOf(h.current);if(o.indexOf(a.button)>u)return;e.preventDefault(),e.stopPropagation(),L(a.panel,O.Last)}else e.preventDefault(),e.stopPropagation(),L(a.panel,O.First)}}),[l,a.popoverState,a.buttonId,a.button,a.panel,c,d,v]),C=o.useCallback((function(e){var n;if(!v&&(e.key===r.Space&&e.preventDefault(),a.popoverState===Ze.Open&&a.panel&&a.button))switch(e.key){case r.Tab:if(!h.current)return;if(null==(n=a.button)?void 0:n.contains(h.current))return;if(a.panel.contains(h.current))return;var t=T(),o=t.indexOf(h.current);if(t.indexOf(a.button)>o)return;e.preventDefault(),e.stopPropagation(),L(a.panel,O.Last)}}),[a.popoverState,a.panel,a.button,v]),x=o.useCallback((function(e){var t,r;g(e.currentTarget)||n.disabled||(v?(l({type:en.ClosePopover}),null==(t=a.button)||t.focus()):(a.popoverState===Ze.Closed&&(null==d||d(a.buttonId)),null==(r=a.button)||r.focus(),l({type:en.TogglePopover})))}),[l,a.button,a.popoverState,a.buttonId,n.disabled,d,v]),E=o.useMemo((function(){return{open:a.popoverState===Ze.Open}}),[a]);return f({props:i({},n,v?{type:"button",onKeyDown:S,onClick:x}:{ref:m,id:a.buttonId,type:"button","aria-expanded":a.popoverState===Ze.Open||void 0,"aria-controls":a.panel?a.panelId:void 0,onKeyDown:S,onKeyUp:C,onClick:x}),slot:E,defaultTag:"button",name:"Popover.Button"})})),mn=n.RenderStrategy|n.Static,bn=v((function e(n,t){var r=ln([pn.name,e.name].join(".")),u=r[0].popoverState,a=r[1],l=b(t),c="headlessui-popover-overlay-"+E(),s=Z(),d=null!==s?s===$.Open:u===Ze.Open,p=o.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();a({type:en.ClosePopover})}),[a]),v=o.useMemo((function(){return{open:u===Ze.Open}}),[u]);return f({props:i({},n,{ref:l,id:c,"aria-hidden":!0,onClick:p}),slot:v,defaultTag:"div",features:mn,visible:d,name:"Popover.Overlay"})})),gn=n.RenderStrategy|n.Static,yn=v((function e(n,t){var a=n.focus,c=void 0!==a&&a,s=l(n,["focus"]),d=ln([pn.name,e.name].join(".")),p=d[0],v=d[1],m=o.useRef(null),g=b(m,t,(function(e){v({type:en.SetPanel,panel:e})})),y=Z(),h=null!==y?y===$.Open:p.popoverState===Ze.Open,S=o.useCallback((function(e){var n;switch(e.key){case r.Escape:if(p.popoverState!==Ze.Open)return;if(!m.current)return;if(!m.current.contains(document.activeElement))return;e.preventDefault(),v({type:en.ClosePopover}),null==(n=p.button)||n.focus()}}),[p,m,v]);o.useEffect((function(){return function(){return v({type:en.SetPanel,panel:null})}}),[v]),o.useEffect((function(){var e;p.popoverState!==Ze.Closed||null!=(e=n.unmount)&&!e||v({type:en.SetPanel,panel:null})}),[p.popoverState,n.unmount,v]),o.useEffect((function(){if(c&&p.popoverState===Ze.Open&&m.current){var e=document.activeElement;m.current.contains(e)||L(m.current,O.First)}}),[c,m,p.popoverState]),A("keydown",(function(e){if(p.popoverState===Ze.Open&&m.current&&e.key===r.Tab&&document.activeElement&&m.current&&m.current.contains(document.activeElement)){e.preventDefault();var n,t=L(m.current,e.shiftKey?O.Previous:O.Next);if(t===I.Underflow)return null==(n=p.button)?void 0:n.focus();if(t===I.Overflow){if(!p.button)return;var o=T(),u=o.indexOf(p.button);L(o.splice(u+1).filter((function(e){var n;return!(null==(n=m.current)?void 0:n.contains(e))})),O.First)===I.Error&&L(document.body,O.First)}}})),A("focus",(function(){var e;c&&p.popoverState===Ze.Open&&m.current&&((null==(e=m.current)?void 0:e.contains(document.activeElement))||v({type:en.ClosePopover}))}),!0);var C=o.useMemo((function(){return{open:p.popoverState===Ze.Open}}),[p]);return u.createElement(dn.Provider,{value:p.panelId},f({props:i({},s,{ref:g,id:p.panelId,onKeyDown:S}),slot:C,defaultTag:"div",features:gn,visible:h,name:"Popover.Panel"}))}));pn.Button=vn,pn.Overlay=bn,pn.Panel=yn,pn.Group=function(e){var n=o.useRef(null),t=o.useState([]),r=t[0],a=t[1],l=o.useCallback((function(e){a((function(n){var t=n.indexOf(e);if(-1!==t){var r=n.slice();return r.splice(t,1),r}return n}))}),[a]),c=o.useCallback((function(e){return a((function(n){return[].concat(n,[e])})),function(){return l(e)}}),[a,l]),d=o.useCallback((function(){var e,t=document.activeElement;return!!(null==(e=n.current)?void 0:e.contains(t))||r.some((function(e){var n,r;return(null==(n=document.getElementById(e.buttonId))?void 0:n.contains(t))||(null==(r=document.getElementById(e.panelId))?void 0:r.contains(t))}))}),[n,r]),p=o.useCallback((function(e){for(var n,t=s(r);!(n=t()).done;){var o=n.value;o.buttonId!==e&&o.close()}}),[r]),v=o.useMemo((function(){return{registerPopover:c,unregisterPopover:l,isFocusWithinPopoverGroup:d,closeOthers:p}}),[c,l,d,p]),m=o.useMemo((function(){return{}}),[]);return u.createElement(cn.Provider,{value:v},f({props:i({},e,{ref:n}),slot:m,defaultTag:"div",name:"Popover.Group"}))};var hn,Sn,Cn=o.createContext(null);function xn(){var e=o.useContext(Cn);if(null===e){var n=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,xn),n}return e}function En(){var e=o.useState([]),n=e[0],t=e[1];return[n.length>0?n.join(" "):void 0,o.useMemo((function(){return function(e){var n=o.useCallback((function(e){return t((function(n){return[].concat(n,[e])})),function(){return t((function(n){var t=n.slice(),r=t.indexOf(e);return-1!==r&&t.splice(r,1),t}))}}),[]),r=o.useMemo((function(){return{register:n,slot:e.slot,name:e.name,props:e.props}}),[n,e.slot,e.name,e.props]);return u.createElement(Cn.Provider,{value:r},e.children)}}),[t])]}function On(e){var n=e.passive,t=void 0!==n&&n,r=l(e,["passive"]),o=xn(),u="headlessui-label-"+E();y((function(){return o.register(u)}),[u,o.register]);var a=i({},o.props,{id:u}),c=i({},r,a);return t&&delete c.onClick,f({props:c,slot:o.slot||{},defaultTag:"label",name:o.name||"Label"})}!function(e){e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption"}(Sn||(Sn={}));var In,wn=((hn={})[Sn.RegisterOption]=function(e,n){return i({},e,{options:[].concat(e.options,[{id:n.id,element:n.element,propsRef:n.propsRef}])})},hn[Sn.UnregisterOption]=function(e,n){var t=e.options.slice(),r=e.options.findIndex((function(e){return e.id===n.id}));return-1===r?e:(t.splice(r,1),i({},e,{options:t}))},hn),kn=o.createContext(null);function Rn(e){var n=o.useContext(kn);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+Tn.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Rn),t}return n}function Pn(e,n){return d(n.type,wn,e,n)}function Tn(e){var n=e.value,t=e.onChange,a=e.disabled,c=void 0!==a&&a,s=l(e,["value","onChange","disabled"]),d=o.useReducer(Pn,{options:[]}),p=d[0].options,v=d[1],m=En(),b=m[0],g=m[1],y=z(),h=y[0],S=y[1],C="headlessui-radiogroup-"+E(),x=o.useRef(null),w=o.useMemo((function(){return p.find((function(e){return!e.propsRef.current.disabled}))}),[p]),k=o.useMemo((function(){return p.some((function(e){return e.propsRef.current.value===n}))}),[p,n]),R=o.useCallback((function(e){var r;if(c)return!1;if(e===n)return!1;var o=null==(r=p.find((function(n){return n.propsRef.current.value===e})))?void 0:r.propsRef.current;return!(null==o?void 0:o.disabled)&&(t(e),!0)}),[t,n,c,p]);We({container:x.current,accept:function(e){return"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk:function(e){e.setAttribute("role","none")}});var P=o.useCallback((function(e){if(x.current){var n=p.filter((function(e){return!1===e.propsRef.current.disabled})).map((function(e){return e.element.current}));switch(e.key){case r.ArrowLeft:case r.ArrowUp:if(e.preventDefault(),e.stopPropagation(),L(n,O.Previous|O.WrapAround)===I.Success){var t=p.find((function(e){return e.element.current===document.activeElement}));t&&R(t.propsRef.current.value)}break;case r.ArrowRight:case r.ArrowDown:if(e.preventDefault(),e.stopPropagation(),L(n,O.Next|O.WrapAround)===I.Success){var o=p.find((function(e){return e.element.current===document.activeElement}));o&&R(o.propsRef.current.value)}break;case r.Space:e.preventDefault(),e.stopPropagation();var u=p.find((function(e){return e.element.current===document.activeElement}));u&&R(u.propsRef.current.value)}}}),[x,p,R]),T=o.useCallback((function(e){return v(i({type:Sn.RegisterOption},e)),function(){return v({type:Sn.UnregisterOption,id:e.id})}}),[v]),D=o.useMemo((function(){return{registerOption:T,firstOption:w,containsCheckedOption:k,change:R,disabled:c,value:n}}),[T,w,k,R,c,n]);return u.createElement(S,{name:"RadioGroup.Description"},u.createElement(g,{name:"RadioGroup.Label"},u.createElement(kn.Provider,{value:D},f({props:i({},s,{ref:x,id:C,role:"radiogroup","aria-labelledby":b,"aria-describedby":h,onKeyDown:P}),defaultTag:"div",name:"RadioGroup"}))))}kn.displayName="RadioGroupContext",function(e){e[e.Empty=1]="Empty",e[e.Active=2]="Active"}(In||(In={})),Tn.Option=function e(n){var t=o.useRef(null),r="headlessui-radiogroup-option-"+E(),a=En(),c=a[0],s=a[1],d=z(),p=d[0],v=d[1],m=function(e){void 0===e&&(e=0);var n=o.useState(e),t=n[0],r=n[1];return{addFlag:o.useCallback((function(e){return r((function(n){return n|e}))}),[r]),hasFlag:o.useCallback((function(e){return Boolean(t&e)}),[t]),removeFlag:o.useCallback((function(e){return r((function(n){return n&~e}))}),[r]),toggleFlag:o.useCallback((function(e){return r((function(n){return n^e}))}),[r])}}(In.Empty),b=m.addFlag,g=m.removeFlag,h=m.hasFlag,S=n.value,C=n.disabled,x=void 0!==C&&C,O=l(n,["value","disabled"]),I=o.useRef({value:S,disabled:x});y((function(){I.current.value=S}),[S,I]),y((function(){I.current.disabled=x}),[x,I]);var w=Rn([Tn.name,e.name].join(".")),k=w.registerOption,R=w.disabled,P=w.change,T=w.firstOption,D=w.containsCheckedOption,F=w.value;y((function(){return k({id:r,element:t,propsRef:I})}),[r,k,t,n]);var L=o.useCallback((function(){var e;P(S)&&(b(In.Active),null==(e=t.current)||e.focus())}),[b,P,S]),A=o.useCallback((function(){return b(In.Active)}),[b]),M=o.useCallback((function(){return g(In.Active)}),[g]),N=R||x,U=F===S,j={ref:t,id:r,role:"radio","aria-checked":U?"true":"false","aria-labelledby":c,"aria-describedby":p,tabIndex:N?-1:U||!D&&(null==T?void 0:T.id)===r?0:-1,onClick:N?void 0:L,onFocus:N?void 0:A,onBlur:N?void 0:M},G=o.useMemo((function(){return{checked:U,disabled:N,active:h(In.Active)}}),[U,N,h]);return u.createElement(v,{name:"RadioGroup.Description"},u.createElement(s,{name:"RadioGroup.Label"},f({props:i({},O,j),slot:G,defaultTag:"div",name:"RadioGroup.Option"})))},Tn.Label=On,Tn.Description=J;var Dn=o.createContext(null);Dn.displayName="GroupContext";var Fn,Ln=o.Fragment;function An(e){var n=e.checked,t=e.onChange,u=l(e,["checked","onChange"]),a="headlessui-switch-"+E(),c=o.useContext(Dn),s=o.useCallback((function(){return t(!n)}),[t,n]),d=o.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();e.preventDefault(),s()}),[s]),p=o.useCallback((function(e){e.key!==r.Tab&&e.preventDefault(),e.key===r.Space&&s()}),[s]),v=o.useCallback((function(e){return e.preventDefault()}),[]),m=o.useMemo((function(){return{checked:n}}),[n]),b={id:a,ref:null===c?void 0:c.setSwitch,role:"switch",tabIndex:0,"aria-checked":n,"aria-labelledby":null==c?void 0:c.labelledby,"aria-describedby":null==c?void 0:c.describedby,onClick:d,onKeyUp:p,onKeyPress:v};return"button"===u.as&&Object.assign(b,{type:"button"}),f({props:i({},u,b),slot:m,defaultTag:"button",name:"Switch"})}function Mn(){var e=o.useRef(!0);return o.useEffect((function(){e.current=!1}),[]),e.current}function Nn(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).add.apply(n,r)}function Un(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).remove.apply(n,r)}function jn(e,n,t,r,o,u){var a=Pe(),i=void 0!==u?function(e){var n={called:!1};return function(){if(!n.called)return n.called=!0,e.apply(void 0,arguments)}}(u):function(){};return Un.apply(void 0,[e].concat(o)),Nn.apply(void 0,[e].concat(n,t)),a.nextFrame((function(){Un.apply(void 0,[e].concat(t)),Nn.apply(void 0,[e].concat(r)),a.add(function(e,n){var t=Pe();if(!e)return t.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var n=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,n){return n-e}))[0];return void 0===n?0:n})),u=o[0];return 0!==u?t.setTimeout((function(){n(Fn.Finished)}),u+o[1]):n(Fn.Finished),t.add((function(){return n(Fn.Cancelled)})),t.dispose}(e,(function(t){return Un.apply(void 0,[e].concat(r,n)),Nn.apply(void 0,[e].concat(o)),i(t)})))})),a.add((function(){return Un.apply(void 0,[e].concat(n,t,r,o))})),a.add((function(){return i(Fn.Cancelled)})),a.dispose}function Gn(e){return void 0===e&&(e=""),o.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}An.Group=function(e){var n=o.useState(null),t=n[0],r=n[1],a=En(),i=a[0],l=a[1],c=z(),s=c[0],d=c[1],p=o.useMemo((function(){return{switch:t,setSwitch:r,labelledby:i,describedby:s}}),[t,r,i,s]);return u.createElement(d,{name:"Switch.Description"},u.createElement(l,{name:"Switch.Label",props:{onClick:function(){t&&(t.click(),t.focus({preventScroll:!0}))}}},u.createElement(Dn.Provider,{value:p},f({props:e,defaultTag:Ln,name:"Switch.Group"}))))},An.Label=On,An.Description=J,function(e){e.Finished="finished",e.Cancelled="cancelled"}(Fn||(Fn={}));var Bn,Hn=o.createContext(null);Hn.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Bn||(Bn={}));var Vn=o.createContext(null);function Kn(e){return"children"in e?Kn(e.children):e.current.filter((function(e){return e.state===Bn.Visible})).length>0}function Qn(e){var n=o.useRef(e),r=o.useRef([]),u=M();o.useEffect((function(){n.current=e}),[e]);var a=o.useCallback((function(e,o){var a;void 0===o&&(o=t.Hidden);var i=r.current.findIndex((function(n){return n.id===e}));-1!==i&&(d(o,((a={})[t.Unmount]=function(){r.current.splice(i,1)},a[t.Hidden]=function(){r.current[i].state=Bn.Hidden},a)),!Kn(r)&&u.current&&(null==n.current||n.current()))}),[n,u,r]),i=o.useCallback((function(e){var n=r.current.find((function(n){return n.id===e}));return n?n.state!==Bn.Visible&&(n.state=Bn.Visible):r.current.push({id:e,state:Bn.Visible}),function(){return a(e,t.Unmount)}}),[r,a]);return o.useMemo((function(){return{children:r,register:i,unregister:a}}),[i,a,r])}function Wn(){}Vn.displayName="NestingContext";var qn=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function _n(e){for(var n,t={},r=s(qn);!(n=r()).done;){var o,u=n.value;t[u]=null!=(o=e[u])?o:Wn}return t}var Yn=n.RenderStrategy;function zn(e){var n,r=e.beforeEnter,a=e.afterEnter,c=e.beforeLeave,s=e.afterLeave,p=e.enter,v=e.enterFrom,m=e.enterTo,b=e.entered,g=e.leave,h=e.leaveFrom,C=e.leaveTo,x=l(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"]),O=o.useRef(null),I=o.useState(Bn.Visible),w=I[0],k=I[1],R=x.unmount?t.Unmount:t.Hidden,P=function(){var e=o.useContext(Hn);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),T=P.show,D=P.appear,F=function(){var e=o.useContext(Vn);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),L=F.register,A=F.unregister,M=Mn(),N=E(),U=o.useRef(!1),j=Qn((function(){U.current||(k(Bn.Hidden),A(N),q.current.afterLeave())}));y((function(){if(N)return L(N)}),[L,N]),y((function(){var e;R===t.Hidden&&N&&(T&&w!==Bn.Visible?k(Bn.Visible):d(w,((e={})[Bn.Hidden]=function(){return A(N)},e[Bn.Visible]=function(){return L(N)},e)))}),[w,N,L,A,T,R]);var G=Gn(p),B=Gn(v),H=Gn(m),V=Gn(b),K=Gn(g),Q=Gn(h),W=Gn(C),q=function(e){var n=o.useRef(_n(e));return o.useEffect((function(){n.current=_n(e)}),[e]),n}({beforeEnter:r,afterEnter:a,beforeLeave:c,afterLeave:s}),_=S();o.useEffect((function(){if(_&&w===Bn.Visible&&null===O.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[O,w,_]);var Y=M&&!D;y((function(){var e=O.current;if(e&&!Y)return U.current=!0,T&&q.current.beforeEnter(),T||q.current.beforeLeave(),T?jn(e,G,B,H,V,(function(e){U.current=!1,e===Fn.Finished&&q.current.afterEnter()})):jn(e,K,Q,W,V,(function(e){U.current=!1,e===Fn.Finished&&(Kn(j)||(k(Bn.Hidden),A(N),q.current.afterLeave()))}))}),[q,N,U,A,j,O,Y,T,G,B,H,K,Q,W]);var z={ref:O},J=x;return u.createElement(Vn.Provider,{value:j},u.createElement(ee,{value:d(w,(n={},n[Bn.Visible]=$.Open,n[Bn.Hidden]=$.Closed,n))},f({props:i({},J,z),defaultTag:"div",features:Yn,visible:w===Bn.Visible,name:"Transition.Child"})))}function Jn(e){var n,t=e.show,r=e.appear,a=void 0!==r&&r,c=e.unmount,s=l(e,["show","appear","unmount"]),p=Z();if(void 0===t&&null!==p&&(t=d(p,((n={})[$.Open]=!0,n[$.Closed]=!1,n))),![!0,!1].includes(t))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var v=o.useState(t?Bn.Visible:Bn.Hidden),m=v[0],b=v[1],g=Qn((function(){b(Bn.Hidden)})),y=Mn(),h=o.useMemo((function(){return{show:t,appear:a||!y}}),[t,a,y]);o.useEffect((function(){t?b(Bn.Visible):Kn(g)||b(Bn.Hidden)}),[t,g]);var S={unmount:c};return u.createElement(Vn.Provider,{value:g},u.createElement(Hn.Provider,{value:h},f({props:i({},S,{as:o.Fragment,children:u.createElement(zn,Object.assign({},S,s))}),defaultTag:o.Fragment,features:Yn,visible:m===Bn.Visible,name:"Transition"})))}Jn.Child=function(e){var n=null!==o.useContext(Hn),t=null!==Z();return u.createElement(!n&&t?Jn:zn,Object.assign({},e))},Jn.Root=Jn,exports.Dialog=me,exports.Disclosure=Ce,exports.FocusTrap=function(e){var n=o.useRef(null),t=e.initialFocus,r=l(e,["initialFocus"]);return N(n,S()?R.All:R.None,{initialFocus:t}),f({props:i({},r,{ref:n}),defaultTag:"div",name:"FocusTrap"})},exports.Listbox=je,exports.Menu=$e,exports.Popover=pn,exports.Portal=Q,exports.RadioGroup=Tn,exports.Switch=An,exports.Transition=Jn; | ||
//# sourceMappingURL=headlessui.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],n):n((e=e||self).headlessui={},e.React,e.reactDom)}(this,(function(e,n,t){"use strict";var r,o,u,a="default"in n?n.default:n;function i(){return(i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function l(e,n){if(null==e)return{};var t,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n.indexOf(t=u[r])>=0||(o[t]=e[t]);return o}function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function s(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return c(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}function f(e,n){if(e in n){for(var t=n[e],r=arguments.length,o=new Array(r>2?r-2:0),u=2;u<r;u++)o[u-2]=arguments[u];return"function"==typeof t?t.apply(void 0,o):t}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(n).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,f),a}function d(e){var n=e.props,t=e.slot,u=e.defaultTag,a=e.features,c=e.visible,s=e.name;if(void 0===c||c)return p(n,t,u,s);var d=null!=a?a:r.None;if(d&r.Static){var v=n.static,m=void 0!==v&&v,b=l(n,["static"]);if(m)return p(b,t,u,s)}if(d&r.RenderStrategy){var g,y=n.unmount,h=void 0===y||y,S=l(n,["unmount"]);return f(h?o.Unmount:o.Hidden,((g={})[o.Unmount]=function(){return null},g[o.Hidden]=function(){return p(i({},S,{hidden:!0,style:{display:"none"}}),t,u,s)},g))}return p(n,t,u,s)}function p(e,t,r,o){var u;void 0===t&&(t={});var a=m(e,["unmount","static"]),i=a.as,c=void 0===i?r:i,f=a.children,d=a.refName,p=void 0===d?"ref":d,v=l(a,["as","children","refName"]),b=void 0!==e.ref?((u={})[p]=e.ref,u):{},g="function"==typeof f?f(t):f;if(v.className&&"function"==typeof v.className&&(v.className=v.className(t)),c===n.Fragment&&Object.keys(v).length>0){if(!n.isValidElement(g)||Array.isArray(g)&&g.length>1)throw new Error(['Passing props on "Fragment"!',"","The current component <"+o+' /> is rendering a "Fragment".',"However we need to passthrough the following props:",Object.keys(v).map((function(e){return" - "+e})).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((function(e){return" - "+e})).join("\n")].join("\n"));return n.cloneElement(g,Object.assign({},function(e,n,t){for(var r,o=Object.assign({},e),u=function(){var t,u=r.value;void 0!==e[u]&&void 0!==n[u]&&Object.assign(o,((t={})[u]=function(t){t.defaultPrevented||e[u](t),t.defaultPrevented||n[u](t)},t))},a=s(["onClick"]);!(r=a()).done;)u();return o}(function(e){var n=Object.assign({},e);for(var t in n)void 0===n[t]&&delete n[t];return n}(m(v,["ref"])),g.props),b))}return n.createElement(c,Object.assign({},m(v,["ref"]),c!==n.Fragment&&b),g)}function v(e){var t;return Object.assign(n.forwardRef(e),{displayName:null!=(t=e.displayName)?t:e.name})}function m(e,n){void 0===n&&(n=[]);for(var t,r=Object.assign({},e),o=s(n);!(t=o()).done;){var u=t.value;u in r&&delete r[u]}return r}function b(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o=n.useRef(t);return n.useEffect((function(){o.current=t}),[t]),n.useCallback((function(e){for(var n,t=s(o.current);!(n=t()).done;){var r=n.value;null!=r&&("function"==typeof r?r(e):r.current=e)}}),[o])}function g(e){for(var n,t,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var u=null!=(n=""===(null==(t=r)?void 0:t.getAttribute("disabled")))&&n;return(!u||!function(e){if(!e)return!1;for(var n=e.previousElementSibling;null!==n;){if(n instanceof HTMLLegendElement)return!1;n=n.previousElementSibling}return!0}(o))&&u}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(r||(r={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(o||(o={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(u||(u={}));var y="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,h={serverHandoffComplete:!1},S=0;function C(){return++S}function E(){var e=n.useState(h.serverHandoffComplete?C:null),t=e[0],r=e[1];return y((function(){null===t&&r(C())}),[t]),n.useEffect((function(){!1===h.serverHandoffComplete&&(h.serverHandoffComplete=!0)}),[]),null!=t?""+t:void 0}var x,I,O,w,k=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function R(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(k))}function P(e,n){var t;return void 0===n&&(n=w.Strict),e!==document.body&&f(n,((t={})[w.Strict]=function(){return e.matches(k)},t[w.Loose]=function(){for(var n=e;null!==n;){if(n.matches(k))return!0;n=n.parentElement}return!1},t))}function T(e){null==e||e.focus({preventScroll:!0})}function D(e,n){var t=Array.isArray(e)?e:R(e),r=document.activeElement,o=function(){if(n&(x.First|x.Next))return O.Next;if(n&(x.Previous|x.Last))return O.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),u=function(){if(n&x.First)return 0;if(n&x.Previous)return Math.max(0,t.indexOf(r))-1;if(n&x.Next)return Math.max(0,t.indexOf(r))+1;if(n&x.Last)return t.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),a=n&x.NoScroll?{preventScroll:!0}:{},i=0,l=t.length,c=void 0;do{var s;if(i>=l||i+l<=0)return I.Error;var f=u+i;if(n&x.WrapAround)f=(f+l)%l;else{if(f<0)return I.Underflow;if(f>=l)return I.Overflow}null==(s=c=t[f])||s.focus(a),i+=o}while(c!==document.activeElement);return c.hasAttribute("tabindex")||c.setAttribute("tabindex","0"),I.Success}function F(e,n){for(var t,r=s(e);!(t=r()).done;)if(t.value.contains(n))return!0;return!1}function L(e,t,r){n.useEffect((function(){return window.addEventListener(e,t,r),function(){return window.removeEventListener(e,t,r)}}),[e,t,r])}function A(e,t,r){void 0===t&&(t=!0),void 0===r&&(r={});var o=n.useRef("undefined"!=typeof window?document.activeElement:null),a=n.useRef(null),i=n.useRef(!1);y((function(){var n,u;if(t&&1===e.current.size){i.current=!0;var l,c=document.activeElement;if(null==(n=r.initialFocus)?void 0:n.current){if((null==(l=r.initialFocus)?void 0:l.current)===c)return}else if(F(e.current,c))return;if(o.current=c,null==(u=r.initialFocus)?void 0:u.current)T(r.initialFocus.current);else{for(var f,d=!1,p=s(e.current);!(f=p()).done;)if(D(f.value,x.First)===I.Success){d=!0;break}if(!d)throw new Error("There are no focusable elements inside the <FocusTrap />")}return a.current=document.activeElement,function(){i.current=!1,T(o.current),o.current=null,a.current=null}}}),[t,e,i,r.initialFocus]),L("keydown",(function(n){if(t&&n.key===u.Tab&&document.activeElement&&1===e.current.size){n.preventDefault();for(var r,o=s(e.current);!(r=o()).done;)if(D(r.value,(n.shiftKey?x.Previous:x.Next)|x.WrapAround)===I.Success){a.current=document.activeElement;break}}})),L("focus",(function(n){if(t&&1===e.current.size){var r=a.current;if(r&&i.current){var o=n.target;o&&o instanceof HTMLElement?F(e.current,o)?(a.current=o,T(o)):(n.preventDefault(),n.stopPropagation(),T(r)):T(a.current)}}}),!0)}!function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"}(x||(x={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(I||(I={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(O||(O={})),function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"}(w||(w={}));var M=new Set,N=new Map;function U(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function j(e){var n=N.get(e);n&&(null===n["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert)}var G,B=n.createContext((function(){}));function H(){return n.useContext(B)}function V(e){var t=e.children,r=e.onUpdate,o=H(),u=n.useCallback((function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];null==r||r.apply(void 0,n),o.apply(void 0,n)}),[o,r]);return a.createElement(B.Provider,{value:u},t)}B.displayName="StackContext",function(e){e[e.AddElement=0]="AddElement",e[e.RemoveElement=1]="RemoveElement"}(G||(G={}));var K=n.createContext(!1);function Q(e){return a.createElement(K.Provider,{value:e.force},e.children)}var W=n.Fragment;function q(e){var r=e,o=function(){var e=n.useContext(K),t=n.useContext(Y),r=n.useState((function(){if(!e&&null!==t)return null;if("undefined"==typeof window)return null;var n=document.getElementById("headlessui-portal-root");if(n)return n;var r=document.createElement("div");return r.setAttribute("id","headlessui-portal-root"),document.body.appendChild(r)})),o=r[0],u=r[1];return n.useEffect((function(){e||null!==t&&u(t.current)}),[t,u,e]),o}(),u=n.useState((function(){return"undefined"==typeof window?null:document.createElement("div")}))[0];return function(e){var n=H();y((function(){if(e)return n(G.AddElement,e),function(){return n(G.RemoveElement,e)}}),[e])}(u),y((function(){if(o&&u)return o.appendChild(u),function(){var e;o&&u&&(o.removeChild(u),o.childNodes.length<=0&&(null==(e=o.parentElement)||e.removeChild(o)))}}),[o,u]),a.createElement(V,null,o&&u?t.createPortal(d({props:r,defaultTag:W,name:"Portal"}),u):null)}var _=n.Fragment,Y=n.createContext(null);q.Group=function(e){var n=e.target,t=l(e,["target"]);return a.createElement(Y.Provider,{value:n},d({props:t,defaultTag:_,name:"Popover.Group"}))};var z,J,$,X=n.createContext(null);function Z(){var e=n.useContext(X);if(null===e){var t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Z),t}return e}function ee(){var e=n.useState([]),t=e[0],r=e[1];return[t.length>0?t.join(" "):void 0,n.useMemo((function(){return function(e){var t=n.useCallback((function(e){return r((function(n){return[].concat(n,[e])})),function(){return r((function(n){var t=n.slice(),r=t.indexOf(e);return-1!==r&&t.splice(r,1),t}))}}),[]),o=n.useMemo((function(){return{register:t,slot:e.slot,name:e.name,props:e.props}}),[t,e.slot,e.name,e.props]);return a.createElement(X.Provider,{value:o},e.children)}}),[r])]}function ne(e){var n=Z(),t="headlessui-description-"+E();y((function(){return n.register(t)}),[t,n.register]);var r=e,o=i({},n.props,{id:t});return d({props:i({},r,o),slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(J||(J={})),function(e){e[e.SetTitleId=0]="SetTitleId"}($||($={}));var te=((z={})[$.SetTitleId]=function(e,n){return e.titleId===n.id?e:i({},e,{titleId:n.id})},z),re=n.createContext(null);function oe(e){var t=n.useContext(re);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+se.displayName+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,oe),r}return t}function ue(e,n){return f(n.type,te,e,n)}re.displayName="DialogContext";var ae,ie,le,ce=r.RenderStrategy|r.Static,se=Object.assign(v((function(e,t){var r=e.open,o=e.onClose,c=e.initialFocus,p=l(e,["open","onClose","initialFocus"]),v=n.useRef(new Set),m=n.useRef(null),g=b(m,t),h=e.hasOwnProperty("open"),S=e.hasOwnProperty("onClose");if(!h&&!S)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!h)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!S)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof r)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+r);if("function"!=typeof o)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+o);var C=r?J.Open:J.Closed,x=n.useReducer(ue,{titleId:null,descriptionId:null}),I=x[0],O=x[1],w=n.useCallback((function(){return o(!1)}),[o]),k=n.useCallback((function(e){return O({type:$.SetTitleId,id:e})}),[O]);L("mousedown",(function(e){C===J.Open&&1===v.current.size&&(F(v.current,e.target)||w())})),n.useEffect((function(){if(C===J.Open){var e=document.documentElement.style.overflow,n=document.documentElement.style.paddingRight,t=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=t+"px",function(){document.documentElement.style.overflow=e,document.documentElement.style.paddingRight=n}}}),[C]),n.useEffect((function(){if(C===J.Open&&m.current){var e=new IntersectionObserver((function(e){for(var n,t=s(e);!(n=t()).done;){var r=n.value;0===r.boundingClientRect.x&&0===r.boundingClientRect.y&&0===r.boundingClientRect.width&&0===r.boundingClientRect.height&&w()}}));return e.observe(m.current),function(){return e.disconnect()}}}),[C,m,w]);var R=C===J.Open;A(v,R,{initialFocus:c}),function(e,n){void 0===n&&(n=!0),y((function(){if(n&&e.current){var t=e.current;M.add(t);for(var r,o=s(N.keys());!(r=o()).done;){var u=r.value;u.contains(t)&&(j(u),N.delete(u))}return document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var n,t=s(M);!(n=t()).done;)if(e.contains(n.value))return;1===M.size&&(N.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),U(e))}})),function(){if(M.delete(t),M.size>0)document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!N.has(e)){for(var n,t=s(M);!(n=t()).done;)if(e.contains(n.value))return;N.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),U(e)}}));else for(var e,n=s(N.keys());!(e=n()).done;){var r=e.value;j(r),N.delete(r)}}}}),[n])}(m,R);var P=ee(),T=P[0],D=P[1],B="headlessui-dialog-"+E(),H=n.useMemo((function(){return[{dialogState:C,close:w,setTitleId:k},I]}),[C,I,w,k]),K=n.useMemo((function(){return{open:C===J.Open}}),[C]);return a.createElement(V,{onUpdate:function(e,n){var t;return f(e,((t={})[G.AddElement]=function(){v.current.add(n)},t[G.RemoveElement]=function(){v.current.delete(n)},t))}},a.createElement(Q,{force:!0},a.createElement(q,null,a.createElement(re.Provider,{value:H},a.createElement(q.Group,{target:m},a.createElement(Q,{force:!1},a.createElement(D,{slot:K,name:"Dialog.Description"},d({props:i({},p,{ref:g,id:B,role:"dialog","aria-modal":C===J.Open||void 0,"aria-labelledby":I.titleId,"aria-describedby":T,onClick:function(e){e.stopPropagation()},onKeyDown:function(e){e.key===u.Escape&&C===J.Open&&(v.current.size>1||(e.preventDefault(),e.stopPropagation(),w()))}}),slot:K,defaultTag:"div",features:ce,visible:C===J.Open,name:"Dialog"}))))))))})),{Overlay:v((function e(t,r){var o=oe([se.displayName,e.name].join("."))[0],u=o.dialogState,a=o.close,l=b(r),c="headlessui-dialog-overlay-"+E(),s=n.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),a()}),[a]),f=n.useMemo((function(){return{open:u===J.Open}}),[u]);return d({props:i({},t,{ref:l,id:c,"aria-hidden":!0,onClick:s}),slot:f,defaultTag:"div",name:"Dialog.Overlay"})})),Title:function e(t){var r=oe([se.displayName,e.name].join("."))[0],o=r.dialogState,u=r.setTitleId,a="headlessui-dialog-title-"+E();n.useEffect((function(){return u(a),function(){return u(null)}}),[a,u]);var l=n.useMemo((function(){return{open:o===J.Open}}),[o]);return d({props:i({},t,{id:a}),slot:l,defaultTag:"h2",name:"Dialog.Title"})},Description:ne});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(ie||(ie={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.SetButtonId=1]="SetButtonId",e[e.SetPanelId=2]="SetPanelId",e[e.LinkPanel=3]="LinkPanel",e[e.UnlinkPanel=4]="UnlinkPanel"}(le||(le={}));var fe=((ae={})[le.ToggleDisclosure]=function(e){var n;return i({},e,{disclosureState:f(e.disclosureState,(n={},n[ie.Open]=ie.Closed,n[ie.Closed]=ie.Open,n))})},ae[le.LinkPanel]=function(e){return!0===e.linkedPanel?e:i({},e,{linkedPanel:!0})},ae[le.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:i({},e,{linkedPanel:!1})},ae[le.SetButtonId]=function(e,n){return e.buttonId===n.buttonId?e:i({},e,{buttonId:n.buttonId})},ae[le.SetPanelId]=function(e,n){return e.panelId===n.panelId?e:i({},e,{panelId:n.panelId})},ae),de=n.createContext(null);function pe(e){var t=n.useContext(de);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+be.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,pe),r}return t}function ve(e,n){return f(n.type,fe,e,n)}de.displayName="DisclosureContext";var me=n.Fragment;function be(e){var t=e.defaultOpen,r=void 0!==t&&t,o=l(e,["defaultOpen"]),u="headlessui-disclosure-button-"+E(),i="headlessui-disclosure-panel-"+E(),c=n.useReducer(ve,{disclosureState:r?ie.Open:ie.Closed,linkedPanel:!1,buttonId:u,panelId:i}),s=c[0].disclosureState,f=c[1];n.useEffect((function(){return f({type:le.SetButtonId,buttonId:u})}),[u,f]),n.useEffect((function(){return f({type:le.SetPanelId,panelId:i})}),[i,f]);var p=n.useMemo((function(){return{open:s===ie.Open}}),[s]);return a.createElement(de.Provider,{value:c},d({props:o,slot:p,defaultTag:me,name:"Disclosure"}))}var ge,ye,he,Se,Ce=v((function e(t,r){var o=pe([be.name,e.name].join(".")),a=o[0],l=o[1],c=b(r),s=n.useCallback((function(e){switch(e.key){case u.Space:case u.Enter:e.preventDefault(),e.stopPropagation(),l({type:le.ToggleDisclosure})}}),[l]),f=n.useCallback((function(e){switch(e.key){case u.Space:e.preventDefault()}}),[]),p=n.useCallback((function(e){g(e.currentTarget)||t.disabled||l({type:le.ToggleDisclosure})}),[l,t.disabled]),v=n.useMemo((function(){return{open:a.disclosureState===ie.Open}}),[a]);return d({props:i({},t,{ref:c,id:a.buttonId,type:"button","aria-expanded":a.disclosureState===ie.Open||void 0,"aria-controls":a.linkedPanel?a.panelId:void 0,onKeyDown:s,onKeyUp:f,onClick:p}),slot:v,defaultTag:"button",name:"Disclosure.Button"})})),Ee=r.RenderStrategy|r.Static,xe=v((function e(t,r){var o=pe([be.name,e.name].join(".")),u=o[0],a=o[1],l=b(r,(function(){u.linkedPanel||a({type:le.LinkPanel})}));n.useEffect((function(){return function(){return a({type:le.UnlinkPanel})}}),[a]),n.useEffect((function(){var e;u.disclosureState!==ie.Closed||null!=(e=t.unmount)&&!e||a({type:le.UnlinkPanel})}),[u.disclosureState,t.unmount,a]);var c=n.useMemo((function(){return{open:u.disclosureState===ie.Open}}),[u]);return d({props:i({},t,{ref:l,id:u.panelId}),slot:c,defaultTag:"div",features:Ee,visible:u.disclosureState===ie.Open,name:"Disclosure.Panel"})}));function Ie(){var e=[],n={requestAnimationFrame:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=requestAnimationFrame.apply(void 0,arguments);n.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];n.requestAnimationFrame((function(){n.requestAnimationFrame.apply(n,t)}))},setTimeout:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=setTimeout.apply(void 0,arguments);n.add((function(){return clearTimeout(e)}))})),add:function(n){e.push(n)},dispose:function(){for(var n,t=s(e.splice(0));!(n=t()).done;)(0,n.value)()}};return n}function Oe(){var e=n.useState(Ie)[0];return n.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function we(e,t){var r=n.useState(e),o=r[0],u=r[1],a=n.useRef(e);return y((function(){a.current=e}),[e]),y((function(){return u(a.current)}),[a,u].concat(t)),o}function ke(e,n){var t=n.resolveItems();if(t.length<=0)return null;var r=n.resolveActiveIndex(),o=null!=r?r:-1,u=function(){switch(e.focus){case ge.First:return t.findIndex((function(e){return!n.resolveDisabled(e)}));case ge.Previous:var r=t.slice().reverse().findIndex((function(e,t,r){return!(-1!==o&&r.length-t-1>=o||n.resolveDisabled(e))}));return-1===r?r:t.length-1-r;case ge.Next:return t.findIndex((function(e,t){return!(t<=o||n.resolveDisabled(e))}));case ge.Last:var u=t.slice().reverse().findIndex((function(e){return!n.resolveDisabled(e)}));return-1===u?u:t.length-1-u;case ge.Specific:return t.findIndex((function(t){return n.resolveId(t)===e.id}));case ge.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?r:u}be.Button=Ce,be.Panel=xe,function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(ge||(ge={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(he||(he={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(Se||(Se={}));var Re=((ye={})[Se.CloseListbox]=function(e){return e.disabled||e.listboxState===he.Closed?e:i({},e,{activeOptionIndex:null,listboxState:he.Closed})},ye[Se.OpenListbox]=function(e){return e.disabled||e.listboxState===he.Open?e:i({},e,{listboxState:he.Open})},ye[Se.SetDisabled]=function(e,n){return e.disabled===n.disabled?e:i({},e,{disabled:n.disabled})},ye[Se.GoToOption]=function(e,n){if(e.disabled)return e;if(e.listboxState===he.Closed)return e;var t=ke(n,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===t?e:i({},e,{searchQuery:"",activeOptionIndex:t})},ye[Se.Search]=function(e,n){if(e.disabled)return e;if(e.listboxState===he.Closed)return e;var t=e.searchQuery+n.value.toLowerCase(),r=e.options.findIndex((function(e){var n;return!e.dataRef.current.disabled&&(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(t))}));return i({},e,-1===r||r===e.activeOptionIndex?{searchQuery:t}:{searchQuery:t,activeOptionIndex:r})},ye[Se.ClearSearch]=function(e){return e.disabled||e.listboxState===he.Closed||""===e.searchQuery?e:i({},e,{searchQuery:""})},ye[Se.RegisterOption]=function(e,n){return i({},e,{options:[].concat(e.options,[{id:n.id,dataRef:n.dataRef}])})},ye[Se.UnregisterOption]=function(e,n){var t=e.options.slice(),r=null!==e.activeOptionIndex?t[e.activeOptionIndex]:null,o=t.findIndex((function(e){return e.id===n.id}));return-1!==o&&t.splice(o,1),i({},e,{options:t,activeOptionIndex:o===e.activeOptionIndex||null===r?null:t.indexOf(r)})},ye),Pe=n.createContext(null);function Te(e){var t=n.useContext(Pe);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+Le.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Te),r}return t}function De(e,n){return f(n.type,Re,e,n)}Pe.displayName="ListboxContext";var Fe=n.Fragment;function Le(e){var t=e.value,r=e.onChange,o=e.disabled,u=void 0!==o&&o,i=l(e,["value","onChange","disabled"]),c=n.useReducer(De,{listboxState:he.Closed,propsRef:{current:{value:t,onChange:r}},labelRef:n.createRef(),buttonRef:n.createRef(),optionsRef:n.createRef(),disabled:u,options:[],searchQuery:"",activeOptionIndex:null}),s=c[0],f=s.listboxState,p=s.propsRef,v=s.optionsRef,m=s.buttonRef,b=c[1];y((function(){p.current.value=t}),[t,p]),y((function(){p.current.onChange=r}),[r,p]),y((function(){return b({type:Se.SetDisabled,disabled:u})}),[u]),L("mousedown",(function(e){var n,t,r,o=e.target;f===he.Open&&((null==(n=m.current)?void 0:n.contains(o))||(null==(t=v.current)?void 0:t.contains(o))||(b({type:Se.CloseListbox}),P(o,w.Loose)||(e.preventDefault(),null==(r=m.current)||r.focus())))}));var g=n.useMemo((function(){return{open:f===he.Open,disabled:u}}),[f,u]);return a.createElement(Pe.Provider,{value:c},d({props:i,slot:g,defaultTag:Fe,name:"Listbox"}))}var Ae,Me,Ne,Ue=v((function e(t,r){var o,a=Te([Le.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.buttonRef,r),f="headlessui-listbox-button-"+E(),p=Oe(),v=n.useCallback((function(e){switch(e.key){case u.Space:case u.Enter:case u.ArrowDown:e.preventDefault(),c({type:Se.OpenListbox}),p.nextFrame((function(){l.propsRef.current.value||c({type:Se.GoToOption,focus:ge.First})}));break;case u.ArrowUp:e.preventDefault(),c({type:Se.OpenListbox}),p.nextFrame((function(){l.propsRef.current.value||c({type:Se.GoToOption,focus:ge.Last})}))}}),[c,l,p]),m=n.useCallback((function(e){switch(e.key){case u.Space:e.preventDefault()}}),[]),y=n.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();l.listboxState===he.Open?(c({type:Se.CloseListbox}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),c({type:Se.OpenListbox}))}),[c,p,l]),h=we((function(){if(l.labelRef.current)return[l.labelRef.current.id,f].join(" ")}),[l.labelRef.current,f]),S=n.useMemo((function(){return{open:l.listboxState===he.Open,disabled:l.disabled}}),[l]);return d({props:i({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=l.optionsRef.current)?void 0:o.id,"aria-expanded":l.listboxState===he.Open||void 0,"aria-labelledby":h,disabled:l.disabled,onKeyDown:v,onKeyUp:m,onClick:y}),slot:S,defaultTag:"button",name:"Listbox.Button"})})),je=r.RenderStrategy|r.Static,Ge=v((function e(t,r){var o,a=Te([Le.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.optionsRef,r),f="headlessui-listbox-options-"+E(),p=Oe(),v=Oe();y((function(){var e=l.optionsRef.current;e&&l.listboxState===he.Open&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[l.listboxState,l.optionsRef]);var m=n.useCallback((function(e){switch(v.dispose(),e.key){case u.Space:if(""!==l.searchQuery)return e.preventDefault(),e.stopPropagation(),c({type:Se.Search,value:e.key});case u.Enter:e.preventDefault(),e.stopPropagation(),c({type:Se.CloseListbox}),null!==l.activeOptionIndex&&l.propsRef.current.onChange(l.options[l.activeOptionIndex].dataRef.current.value),Ie().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case u.ArrowDown:return e.preventDefault(),e.stopPropagation(),c({type:Se.GoToOption,focus:ge.Next});case u.ArrowUp:return e.preventDefault(),e.stopPropagation(),c({type:Se.GoToOption,focus:ge.Previous});case u.Home:case u.PageUp:return e.preventDefault(),e.stopPropagation(),c({type:Se.GoToOption,focus:ge.First});case u.End:case u.PageDown:return e.preventDefault(),e.stopPropagation(),c({type:Se.GoToOption,focus:ge.Last});case u.Escape:return e.preventDefault(),e.stopPropagation(),c({type:Se.CloseListbox}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case u.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(c({type:Se.Search,value:e.key}),v.setTimeout((function(){return c({type:Se.ClearSearch})}),350))}}),[p,c,v,l]),g=we((function(){var e,n,t;return null!=(e=null==(n=l.labelRef.current)?void 0:n.id)?e:null==(t=l.buttonRef.current)?void 0:t.id}),[l.labelRef.current,l.buttonRef.current]),h=n.useMemo((function(){return{open:l.listboxState===he.Open}}),[l]);return d({props:i({},t,{"aria-activedescendant":null===l.activeOptionIndex||null==(o=l.options[l.activeOptionIndex])?void 0:o.id,"aria-labelledby":g,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),slot:h,defaultTag:"ul",features:je,visible:l.listboxState===he.Open,name:"Listbox.Options"})}));function Be(e){var t=e.container,r=e.accept,o=e.walk,u=e.enabled,a=void 0===u||u,i=n.useRef(r),l=n.useRef(o);n.useEffect((function(){i.current=r,l.current=o}),[r,o]),y((function(){if(t&&a)for(var e=i.current,n=l.current,r=Object.assign((function(n){return e(n)}),{acceptNode:e}),o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,r,!1);o.nextNode();)n(o.currentNode)}),[t,a,i,l])}Le.Button=Ue,Le.Label=function e(t){var r=Te([Le.name,e.name].join("."))[0],o="headlessui-listbox-label-"+E(),u=n.useCallback((function(){var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[r.buttonRef]),a=n.useMemo((function(){return{open:r.listboxState===he.Open,disabled:r.disabled}}),[r]);return d({props:i({},t,{ref:r.labelRef,id:o,onClick:u}),slot:a,defaultTag:"label",name:"Listbox.Label"})},Le.Options=Ge,Le.Option=function e(t){var r=t.disabled,o=void 0!==r&&r,u=t.value,a=l(t,["disabled","value"]),c=Te([Le.name,e.name].join(".")),s=c[0],f=c[1],p="headlessui-listbox-option-"+E(),v=null!==s.activeOptionIndex&&s.options[s.activeOptionIndex].id===p,m=s.propsRef.current.value===u,b=n.useRef({disabled:o,value:u});y((function(){b.current.disabled=o}),[b,o]),y((function(){b.current.value=u}),[b,u]),y((function(){var e,n;b.current.textValue=null==(e=document.getElementById(p))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[b,p]);var g=n.useCallback((function(){return s.propsRef.current.onChange(u)}),[s.propsRef,u]);y((function(){return f({type:Se.RegisterOption,id:p,dataRef:b}),function(){return f({type:Se.UnregisterOption,id:p})}}),[b,p]),y((function(){var e;s.listboxState===he.Open&&m&&(f({type:Se.GoToOption,focus:ge.Specific,id:p}),null==(e=document.getElementById(p))||null==e.focus||e.focus())}),[s.listboxState]),y((function(){if(s.listboxState===he.Open&&v){var e=Ie();return e.nextFrame((function(){var e;return null==(e=document.getElementById(p))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[p,v,s.listboxState]);var h=n.useCallback((function(e){if(o)return e.preventDefault();g(),f({type:Se.CloseListbox}),Ie().nextFrame((function(){var e;return null==(e=s.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[f,s.buttonRef,o,g]),S=n.useCallback((function(){if(o)return f({type:Se.GoToOption,focus:ge.Nothing});f({type:Se.GoToOption,focus:ge.Specific,id:p})}),[o,p,f]),C=n.useCallback((function(){o||v||f({type:Se.GoToOption,focus:ge.Specific,id:p})}),[o,v,p,f]),x=n.useCallback((function(){o||v&&f({type:Se.GoToOption,focus:ge.Nothing})}),[o,v,f]),I=n.useMemo((function(){return{active:v,selected:m,disabled:o}}),[v,m,o]);return d({props:i({},a,{id:p,role:"option",tabIndex:-1,"aria-disabled":!0===o||void 0,"aria-selected":!0===m||void 0,onClick:h,onFocus:S,onPointerMove:C,onMouseMove:C,onPointerLeave:x,onMouseLeave:x}),slot:I,defaultTag:"li",name:"Listbox.Option"})},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Me||(Me={})),function(e){e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem"}(Ne||(Ne={}));var He=((Ae={})[Ne.CloseMenu]=function(e){return e.menuState===Me.Closed?e:i({},e,{activeItemIndex:null,menuState:Me.Closed})},Ae[Ne.OpenMenu]=function(e){return e.menuState===Me.Open?e:i({},e,{menuState:Me.Open})},Ae[Ne.GoToItem]=function(e,n){var t=ke(n,{resolveItems:function(){return e.items},resolveActiveIndex:function(){return e.activeItemIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeItemIndex===t?e:i({},e,{searchQuery:"",activeItemIndex:t})},Ae[Ne.Search]=function(e,n){var t=e.searchQuery+n.value.toLowerCase(),r=e.items.findIndex((function(e){var n;return(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(t))&&!e.dataRef.current.disabled}));return i({},e,-1===r||r===e.activeItemIndex?{searchQuery:t}:{searchQuery:t,activeItemIndex:r})},Ae[Ne.ClearSearch]=function(e){return""===e.searchQuery?e:i({},e,{searchQuery:""})},Ae[Ne.RegisterItem]=function(e,n){return i({},e,{items:[].concat(e.items,[{id:n.id,dataRef:n.dataRef}])})},Ae[Ne.UnregisterItem]=function(e,n){var t=e.items.slice(),r=null!==e.activeItemIndex?t[e.activeItemIndex]:null,o=t.findIndex((function(e){return e.id===n.id}));return-1!==o&&t.splice(o,1),i({},e,{items:t,activeItemIndex:o===e.activeItemIndex||null===r?null:t.indexOf(r)})},Ae),Ve=n.createContext(null);function Ke(e){var t=n.useContext(Ve);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+qe.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Ke),r}return t}function Qe(e,n){return f(n.type,He,e,n)}Ve.displayName="MenuContext";var We=n.Fragment;function qe(e){var t=n.useReducer(Qe,{menuState:Me.Closed,buttonRef:n.createRef(),itemsRef:n.createRef(),items:[],searchQuery:"",activeItemIndex:null}),r=t[0],o=r.menuState,u=r.itemsRef,i=r.buttonRef,l=t[1];L("mousedown",(function(e){var n,t,r,a=e.target;o===Me.Open&&((null==(n=i.current)?void 0:n.contains(a))||(null==(t=u.current)?void 0:t.contains(a))||(l({type:Ne.CloseMenu}),P(a,w.Loose)||(e.preventDefault(),null==(r=i.current)||r.focus())))}));var c=n.useMemo((function(){return{open:o===Me.Open}}),[o]);return a.createElement(Ve.Provider,{value:t},d({props:e,slot:c,defaultTag:We,name:"Menu"}))}var _e,Ye,ze,Je=v((function e(t,r){var o,a=Ke([qe.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.buttonRef,r),f="headlessui-menu-button-"+E(),p=Oe(),v=n.useCallback((function(e){switch(e.key){case u.Space:case u.Enter:case u.ArrowDown:e.preventDefault(),e.stopPropagation(),c({type:Ne.OpenMenu}),p.nextFrame((function(){return c({type:Ne.GoToItem,focus:ge.First})}));break;case u.ArrowUp:e.preventDefault(),e.stopPropagation(),c({type:Ne.OpenMenu}),p.nextFrame((function(){return c({type:Ne.GoToItem,focus:ge.Last})}))}}),[c,p]),m=n.useCallback((function(e){switch(e.key){case u.Space:e.preventDefault()}}),[]),y=n.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();t.disabled||(l.menuState===Me.Open?(c({type:Ne.CloseMenu}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),e.stopPropagation(),c({type:Ne.OpenMenu})))}),[c,p,l,t.disabled]),h=n.useMemo((function(){return{open:l.menuState===Me.Open}}),[l]);return d({props:i({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=l.itemsRef.current)?void 0:o.id,"aria-expanded":l.menuState===Me.Open||void 0,onKeyDown:v,onKeyUp:m,onClick:y}),slot:h,defaultTag:"button",name:"Menu.Button"})})),$e=r.RenderStrategy|r.Static,Xe=v((function e(t,r){var o,a,l=Ke([qe.name,e.name].join(".")),c=l[0],s=l[1],f=b(c.itemsRef,r),p="headlessui-menu-items-"+E(),v=Oe();n.useEffect((function(){var e=c.itemsRef.current;e&&c.menuState===Me.Open&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[c.menuState,c.itemsRef]),Be({container:c.itemsRef.current,enabled:c.menuState===Me.Open,accept:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk:function(e){e.setAttribute("role","none")}});var m=n.useCallback((function(e){switch(v.dispose(),e.key){case u.Space:if(""!==c.searchQuery)return e.preventDefault(),e.stopPropagation(),s({type:Ne.Search,value:e.key});case u.Enter:var n;e.preventDefault(),e.stopPropagation(),s({type:Ne.CloseMenu}),null!==c.activeItemIndex&&(null==(n=document.getElementById(c.items[c.activeItemIndex].id))||n.click()),Ie().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case u.ArrowDown:return e.preventDefault(),e.stopPropagation(),s({type:Ne.GoToItem,focus:ge.Next});case u.ArrowUp:return e.preventDefault(),e.stopPropagation(),s({type:Ne.GoToItem,focus:ge.Previous});case u.Home:case u.PageUp:return e.preventDefault(),e.stopPropagation(),s({type:Ne.GoToItem,focus:ge.First});case u.End:case u.PageDown:return e.preventDefault(),e.stopPropagation(),s({type:Ne.GoToItem,focus:ge.Last});case u.Escape:e.preventDefault(),e.stopPropagation(),s({type:Ne.CloseMenu}),Ie().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case u.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(s({type:Ne.Search,value:e.key}),v.setTimeout((function(){return s({type:Ne.ClearSearch})}),350))}}),[s,v,c]),g=n.useCallback((function(e){switch(e.key){case u.Space:e.preventDefault()}}),[]),y=n.useMemo((function(){return{open:c.menuState===Me.Open}}),[c]);return d({props:i({},t,{"aria-activedescendant":null===c.activeItemIndex||null==(o=c.items[c.activeItemIndex])?void 0:o.id,"aria-labelledby":null==(a=c.buttonRef.current)?void 0:a.id,id:p,onKeyDown:m,onKeyUp:g,role:"menu",tabIndex:0,ref:f}),slot:y,defaultTag:"div",features:$e,visible:c.menuState===Me.Open,name:"Menu.Items"})})),Ze=n.Fragment;qe.Button=Je,qe.Items=Xe,qe.Item=function e(t){var r=t.disabled,o=void 0!==r&&r,u=t.onClick,a=l(t,["disabled","onClick"]),c=Ke([qe.name,e.name].join(".")),s=c[0],f=c[1],p="headlessui-menu-item-"+E(),v=null!==s.activeItemIndex&&s.items[s.activeItemIndex].id===p;y((function(){if(s.menuState===Me.Open&&v){var e=Ie();return e.nextFrame((function(){var e;return null==(e=document.getElementById(p))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[p,v,s.menuState]);var m=n.useRef({disabled:o});y((function(){m.current.disabled=o}),[m,o]),y((function(){var e,n;m.current.textValue=null==(e=document.getElementById(p))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[m,p]),y((function(){return f({type:Ne.RegisterItem,id:p,dataRef:m}),function(){return f({type:Ne.UnregisterItem,id:p})}}),[m,p]);var b=n.useCallback((function(e){return o?e.preventDefault():(f({type:Ne.CloseMenu}),Ie().nextFrame((function(){var e;return null==(e=s.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[f,s.buttonRef,o,u]),g=n.useCallback((function(){if(o)return f({type:Ne.GoToItem,focus:ge.Nothing});f({type:Ne.GoToItem,focus:ge.Specific,id:p})}),[o,p,f]),h=n.useCallback((function(){o||v||f({type:Ne.GoToItem,focus:ge.Specific,id:p})}),[o,v,p,f]),S=n.useCallback((function(){o||v&&f({type:Ne.GoToItem,focus:ge.Nothing})}),[o,v,f]),C=n.useMemo((function(){return{active:v,disabled:o}}),[v,o]);return d({props:i({},a,{id:p,role:"menuitem",tabIndex:-1,"aria-disabled":!0===o||void 0,onClick:b,onFocus:g,onPointerMove:h,onMouseMove:h,onPointerLeave:S,onMouseLeave:S}),slot:C,defaultTag:Ze,name:"Menu.Item"})},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Ye||(Ye={})),function(e){e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId"}(ze||(ze={}));var en=((_e={})[ze.TogglePopover]=function(e){var n;return i({},e,{popoverState:f(e.popoverState,(n={},n[Ye.Open]=Ye.Closed,n[Ye.Closed]=Ye.Open,n))})},_e[ze.ClosePopover]=function(e){return e.popoverState===Ye.Closed?e:i({},e,{popoverState:Ye.Closed})},_e[ze.SetButton]=function(e,n){return e.button===n.button?e:i({},e,{button:n.button})},_e[ze.SetButtonId]=function(e,n){return e.buttonId===n.buttonId?e:i({},e,{buttonId:n.buttonId})},_e[ze.SetPanel]=function(e,n){return e.panel===n.panel?e:i({},e,{panel:n.panel})},_e[ze.SetPanelId]=function(e,n){return e.panelId===n.panelId?e:i({},e,{panelId:n.panelId})},_e),nn=n.createContext(null);function tn(e){var t=n.useContext(nn);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+ln.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,tn),r}return t}nn.displayName="PopoverContext";var rn=n.createContext(null);function on(){return n.useContext(rn)}rn.displayName="PopoverGroupContext";var un=n.createContext(null);function an(e,n){return f(n.type,en,e,n)}function ln(e){var t="headlessui-popover-button-"+E(),r="headlessui-popover-panel-"+E(),o=n.useReducer(an,{popoverState:Ye.Closed,button:null,buttonId:t,panel:null,panelId:r}),u=o[0],i=u.popoverState,l=u.button,c=u.panel,s=o[1];n.useEffect((function(){return s({type:ze.SetButtonId,buttonId:t})}),[t,s]),n.useEffect((function(){return s({type:ze.SetPanelId,panelId:r})}),[r,s]);var f=n.useMemo((function(){return{buttonId:t,panelId:r,close:function(){return s({type:ze.ClosePopover})}}}),[t,r,s]),p=on(),v=null==p?void 0:p.registerPopover,m=n.useCallback((function(){var e;return null!=(e=null==p?void 0:p.isFocusWithinPopoverGroup())?e:(null==l?void 0:l.contains(document.activeElement))||(null==c?void 0:c.contains(document.activeElement))}),[p,l,c]);n.useEffect((function(){return null==v?void 0:v(f)}),[v,f]),L("focus",(function(){i===Ye.Open&&(m()||l&&c&&s({type:ze.ClosePopover}))}),!0),L("mousedown",(function(e){var n=e.target;i===Ye.Open&&((null==l?void 0:l.contains(n))||(null==c?void 0:c.contains(n))||(s({type:ze.ClosePopover}),P(n,w.Loose)||(e.preventDefault(),null==l||l.focus())))}));var b=n.useMemo((function(){return{open:i===Ye.Open}}),[i]);return a.createElement(nn.Provider,{value:o},d({props:e,slot:b,defaultTag:"div",name:"Popover"}))}un.displayName="PopoverPanelContext";var cn=v((function e(t,r){var o=tn([ln.name,e.name].join(".")),a=o[0],l=o[1],c=n.useRef(null),s=on(),f=null==s?void 0:s.closeOthers,p=n.useContext(un),v=null!==p&&p===a.panelId,m=b(c,r,v?null:function(e){return l({type:ze.SetButton,button:e})}),y=n.useRef(null),h=n.useRef("undefined"==typeof window?null:document.activeElement);L("focus",(function(){h.current=y.current,y.current=document.activeElement}),!0);var S=n.useCallback((function(e){var n;if(v){if(a.popoverState===Ye.Closed)return;switch(e.key){case u.Space:case u.Enter:e.preventDefault(),e.stopPropagation(),l({type:ze.ClosePopover}),null==(n=a.button)||n.focus()}}else switch(e.key){case u.Space:case u.Enter:e.preventDefault(),e.stopPropagation(),a.popoverState===Ye.Closed&&(null==f||f(a.buttonId)),l({type:ze.TogglePopover});break;case u.Escape:if(a.popoverState!==Ye.Open)return null==f?void 0:f(a.buttonId);if(!c.current)return;if(!c.current.contains(document.activeElement))return;l({type:ze.ClosePopover});break;case u.Tab:if(a.popoverState!==Ye.Open)return;if(!a.panel)return;if(!a.button)return;if(e.shiftKey){var t;if(!h.current)return;if(null==(t=a.button)?void 0:t.contains(h.current))return;if(a.panel.contains(h.current))return;var r=R(),o=r.indexOf(h.current);if(r.indexOf(a.button)>o)return;e.preventDefault(),e.stopPropagation(),D(a.panel,x.Last)}else e.preventDefault(),e.stopPropagation(),D(a.panel,x.First)}}),[l,a.popoverState,a.buttonId,a.button,a.panel,c,f,v]),C=n.useCallback((function(e){var n;if(!v&&(e.key===u.Space&&e.preventDefault(),a.popoverState===Ye.Open&&a.panel&&a.button))switch(e.key){case u.Tab:if(!h.current)return;if(null==(n=a.button)?void 0:n.contains(h.current))return;if(a.panel.contains(h.current))return;var t=R(),r=t.indexOf(h.current);if(t.indexOf(a.button)>r)return;e.preventDefault(),e.stopPropagation(),D(a.panel,x.Last)}}),[a.popoverState,a.panel,a.button,v]),E=n.useCallback((function(e){var n,r;g(e.currentTarget)||t.disabled||(v?(l({type:ze.ClosePopover}),null==(n=a.button)||n.focus()):(a.popoverState===Ye.Closed&&(null==f||f(a.buttonId)),null==(r=a.button)||r.focus(),l({type:ze.TogglePopover})))}),[l,a.button,a.popoverState,a.buttonId,t.disabled,f,v]),I=n.useMemo((function(){return{open:a.popoverState===Ye.Open}}),[a]);return d({props:i({},t,v?{type:"button",onKeyDown:S,onClick:E}:{ref:m,id:a.buttonId,type:"button","aria-expanded":a.popoverState===Ye.Open||void 0,"aria-controls":a.panel?a.panelId:void 0,onKeyDown:S,onKeyUp:C,onClick:E}),slot:I,defaultTag:"button",name:"Popover.Button"})})),sn=r.RenderStrategy|r.Static,fn=v((function e(t,r){var o=tn([ln.name,e.name].join(".")),u=o[0].popoverState,a=o[1],l=b(r),c="headlessui-popover-overlay-"+E(),s=n.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();a({type:ze.ClosePopover})}),[a]),f=n.useMemo((function(){return{open:u===Ye.Open}}),[u]);return d({props:i({},t,{ref:l,id:c,"aria-hidden":!0,onClick:s}),slot:f,defaultTag:"div",features:sn,visible:u===Ye.Open,name:"Popover.Overlay"})})),dn=r.RenderStrategy|r.Static,pn=v((function e(t,r){var o=t.focus,c=void 0!==o&&o,s=l(t,["focus"]),f=tn([ln.name,e.name].join(".")),p=f[0],v=f[1],m=n.useRef(null),g=b(m,r,(function(e){v({type:ze.SetPanel,panel:e})})),y=n.useCallback((function(e){var n;switch(e.key){case u.Escape:if(p.popoverState!==Ye.Open)return;if(!m.current)return;if(!m.current.contains(document.activeElement))return;e.preventDefault(),v({type:ze.ClosePopover}),null==(n=p.button)||n.focus()}}),[p,m,v]);n.useEffect((function(){return function(){return v({type:ze.SetPanel,panel:null})}}),[v]),n.useEffect((function(){var e;p.popoverState!==Ye.Closed||null!=(e=t.unmount)&&!e||v({type:ze.SetPanel,panel:null})}),[p.popoverState,t.unmount,v]),n.useEffect((function(){if(c&&p.popoverState===Ye.Open&&m.current){var e=document.activeElement;m.current.contains(e)||D(m.current,x.First)}}),[c,m,p.popoverState]),L("keydown",(function(e){if(p.popoverState===Ye.Open&&m.current&&e.key===u.Tab&&document.activeElement&&m.current&&m.current.contains(document.activeElement)){e.preventDefault();var n,t=D(m.current,e.shiftKey?x.Previous:x.Next);if(t===I.Underflow)return null==(n=p.button)?void 0:n.focus();if(t===I.Overflow){if(!p.button)return;var r=R(),o=r.indexOf(p.button);D(r.splice(o+1).filter((function(e){var n;return!(null==(n=m.current)?void 0:n.contains(e))})),x.First)===I.Error&&D(document.body,x.First)}}})),L("focus",(function(){var e;c&&p.popoverState===Ye.Open&&m.current&&((null==(e=m.current)?void 0:e.contains(document.activeElement))||v({type:ze.ClosePopover}))}),!0);var h=n.useMemo((function(){return{open:p.popoverState===Ye.Open}}),[p]);return a.createElement(un.Provider,{value:p.panelId},d({props:i({},s,{ref:g,id:p.panelId,onKeyDown:y}),slot:h,defaultTag:"div",features:dn,visible:p.popoverState===Ye.Open,name:"Popover.Panel"}))}));ln.Button=cn,ln.Overlay=fn,ln.Panel=pn,ln.Group=function(e){var t=n.useRef(null),r=n.useState([]),o=r[0],u=r[1],l=n.useCallback((function(e){u((function(n){var t=n.indexOf(e);if(-1!==t){var r=n.slice();return r.splice(t,1),r}return n}))}),[u]),c=n.useCallback((function(e){return u((function(n){return[].concat(n,[e])})),function(){return l(e)}}),[u,l]),f=n.useCallback((function(){var e,n=document.activeElement;return!!(null==(e=t.current)?void 0:e.contains(n))||o.some((function(e){var t,r;return(null==(t=document.getElementById(e.buttonId))?void 0:t.contains(n))||(null==(r=document.getElementById(e.panelId))?void 0:r.contains(n))}))}),[t,o]),p=n.useCallback((function(e){for(var n,t=s(o);!(n=t()).done;){var r=n.value;r.buttonId!==e&&r.close()}}),[o]),v=n.useMemo((function(){return{registerPopover:c,unregisterPopover:l,isFocusWithinPopoverGroup:f,closeOthers:p}}),[c,l,f,p]),m=n.useMemo((function(){return{}}),[]);return a.createElement(rn.Provider,{value:v},d({props:i({},e,{ref:t}),slot:m,defaultTag:"div",name:"Popover.Group"}))};var vn,mn,bn=n.createContext(null);function gn(){var e=n.useContext(bn);if(null===e){var t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,gn),t}return e}function yn(){var e=n.useState([]),t=e[0],r=e[1];return[t.length>0?t.join(" "):void 0,n.useMemo((function(){return function(e){var t=n.useCallback((function(e){return r((function(n){return[].concat(n,[e])})),function(){return r((function(n){var t=n.slice(),r=t.indexOf(e);return-1!==r&&t.splice(r,1),t}))}}),[]),o=n.useMemo((function(){return{register:t,slot:e.slot,name:e.name,props:e.props}}),[t,e.slot,e.name,e.props]);return a.createElement(bn.Provider,{value:o},e.children)}}),[r])]}function hn(e){var n=e.passive,t=void 0!==n&&n,r=l(e,["passive"]),o=gn(),u="headlessui-label-"+E();y((function(){return o.register(u)}),[u,o.register]);var a=i({},o.props,{id:u}),c=i({},r,a);return t&&delete c.onClick,d({props:c,slot:o.slot||{},defaultTag:"label",name:o.name||"Label"})}!function(e){e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption"}(mn||(mn={}));var Sn,Cn=((vn={})[mn.RegisterOption]=function(e,n){return i({},e,{options:[].concat(e.options,[{id:n.id,element:n.element,propsRef:n.propsRef}])})},vn[mn.UnregisterOption]=function(e,n){var t=e.options.slice(),r=e.options.findIndex((function(e){return e.id===n.id}));return-1===r?e:(t.splice(r,1),i({},e,{options:t}))},vn),En=n.createContext(null);function xn(e){var t=n.useContext(En);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+On.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,xn),r}return t}function In(e,n){return f(n.type,Cn,e,n)}function On(e){var t=e.value,r=e.onChange,o=e.disabled,c=void 0!==o&&o,s=l(e,["value","onChange","disabled"]),f=n.useReducer(In,{options:[]}),p=f[0].options,v=f[1],m=yn(),b=m[0],g=m[1],y=ee(),h=y[0],S=y[1],C="headlessui-radiogroup-"+E(),O=n.useRef(null),w=n.useMemo((function(){return p.find((function(e){return!e.propsRef.current.disabled}))}),[p]),k=n.useMemo((function(){return p.some((function(e){return e.propsRef.current.value===t}))}),[p,t]),R=n.useCallback((function(e){var n;if(c)return!1;if(e===t)return!1;var o=null==(n=p.find((function(n){return n.propsRef.current.value===e})))?void 0:n.propsRef.current;return!(null==o?void 0:o.disabled)&&(r(e),!0)}),[r,t,c,p]);Be({container:O.current,accept:function(e){return"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk:function(e){e.setAttribute("role","none")}});var P=n.useCallback((function(e){if(O.current){var n=p.filter((function(e){return!1===e.propsRef.current.disabled})).map((function(e){return e.element.current}));switch(e.key){case u.ArrowLeft:case u.ArrowUp:if(e.preventDefault(),e.stopPropagation(),D(n,x.Previous|x.WrapAround)===I.Success){var t=p.find((function(e){return e.element.current===document.activeElement}));t&&R(t.propsRef.current.value)}break;case u.ArrowRight:case u.ArrowDown:if(e.preventDefault(),e.stopPropagation(),D(n,x.Next|x.WrapAround)===I.Success){var r=p.find((function(e){return e.element.current===document.activeElement}));r&&R(r.propsRef.current.value)}break;case u.Space:e.preventDefault(),e.stopPropagation();var o=p.find((function(e){return e.element.current===document.activeElement}));o&&R(o.propsRef.current.value)}}}),[O,p,R]),T=n.useCallback((function(e){return v(i({type:mn.RegisterOption},e)),function(){return v({type:mn.UnregisterOption,id:e.id})}}),[v]),F=n.useMemo((function(){return{registerOption:T,firstOption:w,containsCheckedOption:k,change:R,disabled:c,value:t}}),[T,w,k,R,c,t]);return a.createElement(S,{name:"RadioGroup.Description"},a.createElement(g,{name:"RadioGroup.Label"},a.createElement(En.Provider,{value:F},d({props:i({},s,{ref:O,id:C,role:"radiogroup","aria-labelledby":b,"aria-describedby":h,onKeyDown:P}),defaultTag:"div",name:"RadioGroup"}))))}En.displayName="RadioGroupContext",function(e){e[e.Empty=1]="Empty",e[e.Active=2]="Active"}(Sn||(Sn={})),On.Option=function e(t){var r=n.useRef(null),o="headlessui-radiogroup-option-"+E(),u=yn(),c=u[0],s=u[1],f=ee(),p=f[0],v=f[1],m=function(e){void 0===e&&(e=0);var t=n.useState(e),r=t[0],o=t[1];return{addFlag:n.useCallback((function(e){return o((function(n){return n|e}))}),[o]),hasFlag:n.useCallback((function(e){return Boolean(r&e)}),[r]),removeFlag:n.useCallback((function(e){return o((function(n){return n&~e}))}),[o]),toggleFlag:n.useCallback((function(e){return o((function(n){return n^e}))}),[o])}}(Sn.Empty),b=m.addFlag,g=m.removeFlag,h=m.hasFlag,S=t.value,C=t.disabled,x=void 0!==C&&C,I=l(t,["value","disabled"]),O=n.useRef({value:S,disabled:x});y((function(){O.current.value=S}),[S,O]),y((function(){O.current.disabled=x}),[x,O]);var w=xn([On.name,e.name].join(".")),k=w.registerOption,R=w.disabled,P=w.change,T=w.firstOption,D=w.containsCheckedOption,F=w.value;y((function(){return k({id:o,element:r,propsRef:O})}),[o,k,r,t]);var L=n.useCallback((function(){var e;P(S)&&(b(Sn.Active),null==(e=r.current)||e.focus())}),[b,P,S]),A=n.useCallback((function(){return b(Sn.Active)}),[b]),M=n.useCallback((function(){return g(Sn.Active)}),[g]),N=R||x,U=F===S,j={ref:r,id:o,role:"radio","aria-checked":U?"true":"false","aria-labelledby":c,"aria-describedby":p,tabIndex:N?-1:U||!D&&(null==T?void 0:T.id)===o?0:-1,onClick:N?void 0:L,onFocus:N?void 0:A,onBlur:N?void 0:M},G=n.useMemo((function(){return{checked:U,disabled:N,active:h(Sn.Active)}}),[U,N,h]);return a.createElement(v,{name:"RadioGroup.Description"},a.createElement(s,{name:"RadioGroup.Label"},d({props:i({},I,j),slot:G,defaultTag:"div",name:"RadioGroup.Option"})))},On.Label=hn,On.Description=ne;var wn=n.createContext(null);wn.displayName="GroupContext";var kn,Rn=n.Fragment;function Pn(e){var t=e.checked,r=e.onChange,o=l(e,["checked","onChange"]),a="headlessui-switch-"+E(),c=n.useContext(wn),s=n.useCallback((function(){return r(!t)}),[r,t]),f=n.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();e.preventDefault(),s()}),[s]),p=n.useCallback((function(e){e.key!==u.Tab&&e.preventDefault(),e.key===u.Space&&s()}),[s]),v=n.useCallback((function(e){return e.preventDefault()}),[]),m=n.useMemo((function(){return{checked:t}}),[t]),b={id:a,ref:null===c?void 0:c.setSwitch,role:"switch",tabIndex:0,"aria-checked":t,"aria-labelledby":null==c?void 0:c.labelledby,"aria-describedby":null==c?void 0:c.describedby,onClick:f,onKeyUp:p,onKeyPress:v};return"button"===o.as&&Object.assign(b,{type:"button"}),d({props:i({},o,b),slot:m,defaultTag:"button",name:"Switch"})}function Tn(){var e=n.useRef(!0);return n.useEffect((function(){e.current=!1}),[]),e.current}function Dn(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).add.apply(n,r)}function Fn(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).remove.apply(n,r)}function Ln(e,n,t,r,o){var u=Ie(),a=void 0!==o?function(e){var n={called:!1};return function(){if(!n.called)return n.called=!0,e.apply(void 0,arguments)}}(o):function(){};return Dn.apply(void 0,[e].concat(n,t)),u.nextFrame((function(){Fn.apply(void 0,[e].concat(t)),Dn.apply(void 0,[e].concat(r)),u.add(function(e,n){var t=Ie();if(!e)return t.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var n=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,n){return n-e}))[0];return void 0===n?0:n})),u=o[0];return 0!==u?t.setTimeout((function(){n(kn.Finished)}),u+o[1]):n(kn.Finished),t.add((function(){return n(kn.Cancelled)})),t.dispose}(e,(function(t){return Fn.apply(void 0,[e].concat(r,n)),a(t)})))})),u.add((function(){return Fn.apply(void 0,[e].concat(n,t,r))})),u.add((function(){return a(kn.Cancelled)})),u.dispose}function An(e){return void 0===e&&(e=""),n.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Pn.Group=function(e){var t=n.useState(null),r=t[0],o=t[1],u=yn(),i=u[0],l=u[1],c=ee(),s=c[0],f=c[1],p=n.useMemo((function(){return{switch:r,setSwitch:o,labelledby:i,describedby:s}}),[r,o,i,s]);return a.createElement(f,{name:"Switch.Description"},a.createElement(l,{name:"Switch.Label",props:{onClick:function(){r&&(r.click(),r.focus({preventScroll:!0}))}}},a.createElement(wn.Provider,{value:p},d({props:e,defaultTag:Rn,name:"Switch.Group"}))))},Pn.Label=hn,Pn.Description=ne,function(e){e.Finished="finished",e.Cancelled="cancelled"}(kn||(kn={}));var Mn,Nn=n.createContext(null);Nn.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Mn||(Mn={}));var Un=n.createContext(null);function jn(e){return"children"in e?jn(e.children):e.current.filter((function(e){return e.state===Mn.Visible})).length>0}function Gn(e){var t=n.useRef(e),r=n.useRef([]),u=function(){var e=n.useRef(!0);return n.useEffect((function(){return function(){e.current=!1}}),[]),e}();n.useEffect((function(){t.current=e}),[e]);var a=n.useCallback((function(e,n){var a;void 0===n&&(n=o.Hidden);var i=r.current.findIndex((function(n){return n.id===e}));-1!==i&&(f(n,((a={})[o.Unmount]=function(){r.current.splice(i,1)},a[o.Hidden]=function(){r.current[i].state=Mn.Hidden},a)),!jn(r)&&u.current&&(null==t.current||t.current()))}),[t,u,r]),i=n.useCallback((function(e){var n=r.current.find((function(n){return n.id===e}));return n?n.state!==Mn.Visible&&(n.state=Mn.Visible):r.current.push({id:e,state:Mn.Visible}),function(){return a(e,o.Unmount)}}),[r,a]);return n.useMemo((function(){return{children:r,register:i,unregister:a}}),[i,a,r])}function Bn(){}Un.displayName="NestingContext";var Hn=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Vn(e){for(var n,t={},r=s(Hn);!(n=r()).done;){var o,u=n.value;t[u]=null!=(o=e[u])?o:Bn}return t}var Kn=r.RenderStrategy;function Qn(e){var t=e.beforeEnter,r=e.afterEnter,u=e.beforeLeave,c=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,b=e.leaveFrom,g=e.leaveTo,h=l(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),S=n.useRef(null),C=n.useState(Mn.Visible),x=C[0],I=C[1],O=h.unmount?o.Unmount:o.Hidden,w=function(){var e=n.useContext(Nn);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),k=w.show,R=w.appear,P=function(){var e=n.useContext(Un);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),T=P.register,D=P.unregister,F=Tn(),L=E(),A=n.useRef(!1),M=Gn((function(){A.current||(I(Mn.Hidden),D(L),V.current.afterLeave())}));y((function(){if(L)return T(L)}),[T,L]),y((function(){var e;O===o.Hidden&&L&&(k&&x!==Mn.Visible?I(Mn.Visible):f(x,((e={})[Mn.Hidden]=function(){return D(L)},e[Mn.Visible]=function(){return T(L)},e)))}),[x,L,T,D,k,O]);var N=An(s),U=An(p),j=An(v),G=An(m),B=An(b),H=An(g),V=function(e){var t=n.useRef(Vn(e));return n.useEffect((function(){t.current=Vn(e)}),[e]),t}({beforeEnter:t,afterEnter:r,beforeLeave:u,afterLeave:c});n.useEffect((function(){if(x===Mn.Visible&&null===S.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[S,x]);var K=F&&!R;return y((function(){var e=S.current;if(e&&!K)return A.current=!0,k&&V.current.beforeEnter(),k||V.current.beforeLeave(),k?Ln(e,N,U,j,(function(e){A.current=!1,e===kn.Finished&&V.current.afterEnter()})):Ln(e,G,B,H,(function(e){A.current=!1,e===kn.Finished&&(jn(M)||(I(Mn.Hidden),D(L),V.current.afterLeave()))}))}),[V,L,A,D,M,S,K,k,N,U,j,G,B,H]),a.createElement(Un.Provider,{value:M},d({props:i({},h,{ref:S}),defaultTag:"div",features:Kn,visible:x===Mn.Visible,name:"Transition.Child"}))}function Wn(e){var t=e.show,r=e.appear,o=void 0!==r&&r,u=e.unmount,c=l(e,["show","appear","unmount"]);if(![!0,!1].includes(t))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=n.useState(t?Mn.Visible:Mn.Hidden),f=s[0],p=s[1],v=Gn((function(){p(Mn.Hidden)})),m=Tn(),b=n.useMemo((function(){return{show:t,appear:o||!m}}),[t,o,m]);n.useEffect((function(){t?p(Mn.Visible):jn(v)||p(Mn.Hidden)}),[t,v]);var g={unmount:u};return a.createElement(Un.Provider,{value:v},a.createElement(Nn.Provider,{value:b},d({props:i({},g,{as:n.Fragment,children:a.createElement(Qn,Object.assign({},g,c))}),defaultTag:n.Fragment,features:Kn,visible:f===Mn.Visible,name:"Transition"})))}Wn.Child=Qn,Wn.Root=Wn,e.Dialog=se,e.Disclosure=be,e.FocusTrap=function(e){var t=n.useRef(new Set),r=e.initialFocus,o=l(e,["initialFocus"]);return A(t,!0,{initialFocus:r}),d({props:i({},o,{ref:function(e){e&&t.current.add(e)}}),defaultTag:"div",name:"FocusTrap"})},e.Listbox=Le,e.Menu=qe,e.Popover=ln,e.Portal=q,e.RadioGroup=On,e.Switch=Pn,e.Transition=Wn,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],n):n((e=e||self).headlessui={},e.React,e.reactDom)}(this,(function(e,n,t){"use strict";var r,o,u,a="default"in n?n.default:n;function i(){return(i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function l(e,n){if(null==e)return{};var t,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n.indexOf(t=u[r])>=0||(o[t]=e[t]);return o}function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function s(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return c(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}function d(e,n){if(e in n){for(var t=n[e],r=arguments.length,o=new Array(r>2?r-2:0),u=2;u<r;u++)o[u-2]=arguments[u];return"function"==typeof t?t.apply(void 0,o):t}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(n).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,d),a}function f(e){var n=e.props,t=e.slot,u=e.defaultTag,a=e.features,c=e.visible,s=e.name;if(void 0===c||c)return p(n,t,u,s);var f=null!=a?a:r.None;if(f&r.Static){var v=n.static,m=void 0!==v&&v,b=l(n,["static"]);if(m)return p(b,t,u,s)}if(f&r.RenderStrategy){var g,y=n.unmount,h=void 0===y||y,S=l(n,["unmount"]);return d(h?o.Unmount:o.Hidden,((g={})[o.Unmount]=function(){return null},g[o.Hidden]=function(){return p(i({},S,{hidden:!0,style:{display:"none"}}),t,u,s)},g))}return p(n,t,u,s)}function p(e,t,r,o){var u;void 0===t&&(t={});var a=m(e,["unmount","static"]),i=a.as,c=void 0===i?r:i,d=a.children,f=a.refName,p=void 0===f?"ref":f,v=l(a,["as","children","refName"]),b=void 0!==e.ref?((u={})[p]=e.ref,u):{},g="function"==typeof d?d(t):d;if(v.className&&"function"==typeof v.className&&(v.className=v.className(t)),c===n.Fragment&&Object.keys(v).length>0){if(!n.isValidElement(g)||Array.isArray(g)&&g.length>1)throw new Error(['Passing props on "Fragment"!',"","The current component <"+o+' /> is rendering a "Fragment".',"However we need to passthrough the following props:",Object.keys(v).map((function(e){return" - "+e})).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((function(e){return" - "+e})).join("\n")].join("\n"));return n.cloneElement(g,Object.assign({},function(e,n,t){for(var r,o=Object.assign({},e),u=function(){var t,u=r.value;void 0!==e[u]&&void 0!==n[u]&&Object.assign(o,((t={})[u]=function(t){t.defaultPrevented||e[u](t),t.defaultPrevented||n[u](t)},t))},a=s(["onClick"]);!(r=a()).done;)u();return o}(function(e){var n=Object.assign({},e);for(var t in n)void 0===n[t]&&delete n[t];return n}(m(v,["ref"])),g.props),b))}return n.createElement(c,Object.assign({},m(v,["ref"]),c!==n.Fragment&&b),g)}function v(e){var t;return Object.assign(n.forwardRef(e),{displayName:null!=(t=e.displayName)?t:e.name})}function m(e,n){void 0===n&&(n=[]);for(var t,r=Object.assign({},e),o=s(n);!(t=o()).done;){var u=t.value;u in r&&delete r[u]}return r}function b(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o=n.useRef(t);return n.useEffect((function(){o.current=t}),[t]),n.useCallback((function(e){for(var n,t=s(o.current);!(n=t()).done;){var r=n.value;null!=r&&("function"==typeof r?r(e):r.current=e)}}),[o])}function g(e){for(var n,t,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var u=null!=(n=""===(null==(t=r)?void 0:t.getAttribute("disabled")))&&n;return(!u||!function(e){if(!e)return!1;for(var n=e.previousElementSibling;null!==n;){if(n instanceof HTMLLegendElement)return!1;n=n.previousElementSibling}return!0}(o))&&u}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(r||(r={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(o||(o={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(u||(u={}));var y="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,h={serverHandoffComplete:!1};function S(){var e=n.useState(h.serverHandoffComplete),t=e[0],r=e[1];return n.useEffect((function(){!0!==t&&r(!0)}),[t]),n.useEffect((function(){!1===h.serverHandoffComplete&&(h.serverHandoffComplete=!0)}),[]),t}var C=0;function E(){return++C}function x(){var e=S(),t=n.useState(e?E:null),r=t[0],o=t[1];return y((function(){null===r&&o(E())}),[r]),null!=r?""+r:void 0}var O,I,w,k,R,P=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function T(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(P))}function D(e,n){var t;return void 0===n&&(n=k.Strict),e!==document.body&&d(n,((t={})[k.Strict]=function(){return e.matches(P)},t[k.Loose]=function(){for(var n=e;null!==n;){if(n.matches(P))return!0;n=n.parentElement}return!1},t))}function F(e){null==e||e.focus({preventScroll:!0})}function L(e,n){var t=Array.isArray(e)?e:T(e),r=document.activeElement,o=function(){if(n&(O.First|O.Next))return w.Next;if(n&(O.Previous|O.Last))return w.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),u=function(){if(n&O.First)return 0;if(n&O.Previous)return Math.max(0,t.indexOf(r))-1;if(n&O.Next)return Math.max(0,t.indexOf(r))+1;if(n&O.Last)return t.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),a=n&O.NoScroll?{preventScroll:!0}:{},i=0,l=t.length,c=void 0;do{var s;if(i>=l||i+l<=0)return I.Error;var d=u+i;if(n&O.WrapAround)d=(d+l)%l;else{if(d<0)return I.Underflow;if(d>=l)return I.Overflow}null==(s=c=t[d])||s.focus(a),i+=o}while(c!==document.activeElement);return c.hasAttribute("tabindex")||c.setAttribute("tabindex","0"),I.Success}function A(e,t,r){var o=n.useRef(t);o.current=t,n.useEffect((function(){function n(e){o.current.call(window,e)}return window.addEventListener(e,n,r),function(){return window.removeEventListener(e,n,r)}}),[e,r])}function M(){var e=n.useRef(!1);return n.useEffect((function(){return e.current=!0,function(){e.current=!1}}),[]),e}function N(e,t,r){void 0===t&&(t=R.All);var o=void 0===r?{}:r,a=o.initialFocus,i=o.containers,l=n.useRef("undefined"!=typeof window?document.activeElement:null),c=n.useRef(null),d=M(),f=Boolean(t&R.RestoreFocus),p=Boolean(t&R.InitialFocus);n.useEffect((function(){f&&(l.current=document.activeElement)}),[f]),n.useEffect((function(){if(f)return function(){F(l.current),l.current=null}}),[f]),n.useEffect((function(){if(p&&e.current){var n=document.activeElement;if(null==a?void 0:a.current){if((null==a?void 0:a.current)===n)return void(c.current=n)}else if(e.current.contains(n))return void(c.current=n);if(null==a?void 0:a.current)F(a.current);else if(L(e.current,O.First)===I.Error)throw new Error("There are no focusable elements inside the <FocusTrap />");c.current=document.activeElement}}),[e,a,p]),A("keydown",(function(n){t&R.TabLock&&e.current&&n.key===u.Tab&&(n.preventDefault(),L(e.current,(n.shiftKey?O.Previous:O.Next)|O.WrapAround)===I.Success&&(c.current=document.activeElement))})),A("focus",(function(n){if(t&R.FocusLock){var r=new Set(null==i?void 0:i.current);if(r.add(e),r.size){var o=c.current;if(o&&d.current){var u=n.target;u&&u instanceof HTMLElement?function(e,n){for(var t,r=s(e);!(t=r()).done;){var o;if(null==(o=t.value.current)?void 0:o.contains(n))return!0}return!1}(r,u)?(c.current=u,F(u)):(n.preventDefault(),n.stopPropagation(),F(o)):F(c.current)}}}}),!0)}!function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"}(O||(O={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(I||(I={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(w||(w={})),function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"}(k||(k={})),function(e){e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All"}(R||(R={}));var U=new Set,j=new Map;function G(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function B(e){var n=j.get(e);n&&(null===n["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert)}var H=n.createContext(!1);function V(e){return a.createElement(H.Provider,{value:e.force},e.children)}var K=n.Fragment;function Q(e){var r=e,o=function(){var e=n.useContext(H),t=n.useContext(q),r=n.useState((function(){if(!e&&null!==t)return null;if("undefined"==typeof window)return null;var n=document.getElementById("headlessui-portal-root");if(n)return n;var r=document.createElement("div");return r.setAttribute("id","headlessui-portal-root"),document.body.appendChild(r)})),o=r[0],u=r[1];return n.useEffect((function(){e||null!==t&&u(t.current)}),[t,u,e]),o}(),u=n.useState((function(){return"undefined"==typeof window?null:document.createElement("div")}))[0],a=S();return y((function(){if(o&&u)return o.appendChild(u),function(){var e;o&&u&&(o.removeChild(u),o.childNodes.length<=0&&(null==(e=o.parentElement)||e.removeChild(o)))}}),[o,u]),a&&o&&u?t.createPortal(f({props:r,defaultTag:K,name:"Portal"}),u):null}var W=n.Fragment,q=n.createContext(null);Q.Group=function(e){var n=e.target,t=l(e,["target"]);return a.createElement(q.Provider,{value:n},f({props:t,defaultTag:W,name:"Popover.Group"}))};var _=n.createContext(null);function Y(){var e=n.useContext(_);if(null===e){var t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Y),t}return e}function z(){var e=n.useState([]),t=e[0],r=e[1];return[t.length>0?t.join(" "):void 0,n.useMemo((function(){return function(e){var t=n.useCallback((function(e){return r((function(n){return[].concat(n,[e])})),function(){return r((function(n){var t=n.slice(),r=t.indexOf(e);return-1!==r&&t.splice(r,1),t}))}}),[]),o=n.useMemo((function(){return{register:t,slot:e.slot,name:e.name,props:e.props}}),[t,e.slot,e.name,e.props]);return a.createElement(_.Provider,{value:o},e.children)}}),[r])]}function J(e){var n=Y(),t="headlessui-description-"+x();y((function(){return n.register(t)}),[t,n.register]);var r=e,o=i({},n.props,{id:t});return f({props:i({},r,o),slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})}var $,X=n.createContext(null);function Z(){return n.useContext(X)}function ee(e){return a.createElement(X.Provider,{value:e.value},e.children)}X.displayName="OpenClosedContext",function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}($||($={}));var ne,te,re,oe,ue=n.createContext((function(){}));function ae(e){var t=e.children,r=e.onUpdate,o=e.type,u=e.element,i=n.useContext(ue),l=n.useCallback((function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];null==r||r.apply(void 0,n),i.apply(void 0,n)}),[i,r]);return y((function(){return l(ne.Add,o,u),function(){return l(ne.Remove,o,u)}}),[l,o,u]),a.createElement(ue.Provider,{value:l},t)}ue.displayName="StackContext",function(e){e[e.Add=0]="Add",e[e.Remove=1]="Remove"}(ne||(ne={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(re||(re={})),function(e){e[e.SetTitleId=0]="SetTitleId"}(oe||(oe={}));var ie=((te={})[oe.SetTitleId]=function(e,n){return e.titleId===n.id?e:i({},e,{titleId:n.id})},te),le=n.createContext(null);function ce(e){var t=n.useContext(le);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+me.displayName+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,ce),r}return t}function se(e,n){return d(n.type,ie,e,n)}le.displayName="DialogContext";var de,fe,pe,ve=r.RenderStrategy|r.Static,me=Object.assign(v((function(e,t){var r,o=e.open,c=e.onClose,p=e.initialFocus,v=l(e,["open","onClose","initialFocus"]),m=n.useState(0),g=m[0],h=m[1],C=Z();void 0===o&&null!==C&&(o=d(C,((r={})[$.Open]=!0,r[$.Closed]=!1,r)));var E=n.useRef(new Set),O=n.useRef(null),I=b(O,t),w=e.hasOwnProperty("open")||null!==C,k=e.hasOwnProperty("onClose");if(!w&&!k)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!w)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!k)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof o)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+o);if("function"!=typeof c)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+c);var P=o?re.Open:re.Closed,T=null!==C?C===$.Open:P===re.Open,D=n.useReducer(se,{titleId:null,descriptionId:null}),F=D[0],L=D[1],M=n.useCallback((function(){return c(!1)}),[c]),H=n.useCallback((function(e){return L({type:oe.SetTitleId,id:e})}),[L]),K=S()&&P===re.Open,W=g>1,q=null!==n.useContext(le);N(O,K?d(W?"parent":"leaf",{parent:R.RestoreFocus,leaf:R.All}):R.None,{initialFocus:p,containers:E}),function(e,n){void 0===n&&(n=!0),y((function(){if(n&&e.current){var t=e.current;U.add(t);for(var r,o=s(j.keys());!(r=o()).done;){var u=r.value;u.contains(t)&&(B(u),j.delete(u))}return document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var n,t=s(U);!(n=t()).done;)if(e.contains(n.value))return;1===U.size&&(j.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),G(e))}})),function(){if(U.delete(t),U.size>0)document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!j.has(e)){for(var n,t=s(U);!(n=t()).done;)if(e.contains(n.value))return;j.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),G(e)}}));else for(var e,n=s(j.keys());!(e=n()).done;){var r=e.value;B(r),j.delete(r)}}}}),[n])}(O,!!W&&K),A("mousedown",(function(e){var n;P===re.Open&&(W||(null==(n=O.current)?void 0:n.contains(e.target))||M())})),n.useEffect((function(){if(P===re.Open&&!q){var e=document.documentElement.style.overflow,n=document.documentElement.style.paddingRight,t=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=t+"px",function(){document.documentElement.style.overflow=e,document.documentElement.style.paddingRight=n}}}),[P,q]),n.useEffect((function(){if(P===re.Open&&O.current){var e=new IntersectionObserver((function(e){for(var n,t=s(e);!(n=t()).done;){var r=n.value;0===r.boundingClientRect.x&&0===r.boundingClientRect.y&&0===r.boundingClientRect.width&&0===r.boundingClientRect.height&&M()}}));return e.observe(O.current),function(){return e.disconnect()}}}),[P,O,M]);var _=z(),Y=_[0],J=_[1],X="headlessui-dialog-"+x(),ee=n.useMemo((function(){return[{dialogState:P,close:M,setTitleId:H},F]}),[P,F,M,H]),te=n.useMemo((function(){return{open:P===re.Open}}),[P]),ue={ref:I,id:X,role:"dialog","aria-modal":P===re.Open||void 0,"aria-labelledby":F.titleId,"aria-describedby":Y,onClick:function(e){e.stopPropagation()},onKeyDown:function(e){e.key===u.Escape&&P===re.Open&&(W||(e.preventDefault(),e.stopPropagation(),M()))}},ie=v;return a.createElement(ae,{type:"Dialog",element:O,onUpdate:n.useCallback((function(e,n,t){var r;"Dialog"===n&&d(e,((r={})[ne.Add]=function(){E.current.add(t),h((function(e){return e+1}))},r[ne.Remove]=function(){E.current.add(t),h((function(e){return e-1}))},r))}),[])},a.createElement(V,{force:!0},a.createElement(Q,null,a.createElement(le.Provider,{value:ee},a.createElement(Q.Group,{target:O},a.createElement(V,{force:!1},a.createElement(J,{slot:te,name:"Dialog.Description"},f({props:i({},ie,ue),slot:te,defaultTag:"div",features:ve,visible:T,name:"Dialog"}))))))))})),{Overlay:v((function e(t,r){var o=ce([me.displayName,e.name].join("."))[0],u=o.dialogState,a=o.close,l=b(r),c="headlessui-dialog-overlay-"+x(),s=n.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),a()}),[a]),d=n.useMemo((function(){return{open:u===re.Open}}),[u]);return f({props:i({},t,{ref:l,id:c,"aria-hidden":!0,onClick:s}),slot:d,defaultTag:"div",name:"Dialog.Overlay"})})),Title:function e(t){var r=ce([me.displayName,e.name].join("."))[0],o=r.dialogState,u=r.setTitleId,a="headlessui-dialog-title-"+x();n.useEffect((function(){return u(a),function(){return u(null)}}),[a,u]);var l=n.useMemo((function(){return{open:o===re.Open}}),[o]);return f({props:i({},t,{id:a}),slot:l,defaultTag:"h2",name:"Dialog.Title"})},Description:J});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(fe||(fe={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.SetButtonId=1]="SetButtonId",e[e.SetPanelId=2]="SetPanelId",e[e.LinkPanel=3]="LinkPanel",e[e.UnlinkPanel=4]="UnlinkPanel"}(pe||(pe={}));var be=((de={})[pe.ToggleDisclosure]=function(e){var n;return i({},e,{disclosureState:d(e.disclosureState,(n={},n[fe.Open]=fe.Closed,n[fe.Closed]=fe.Open,n))})},de[pe.LinkPanel]=function(e){return!0===e.linkedPanel?e:i({},e,{linkedPanel:!0})},de[pe.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:i({},e,{linkedPanel:!1})},de[pe.SetButtonId]=function(e,n){return e.buttonId===n.buttonId?e:i({},e,{buttonId:n.buttonId})},de[pe.SetPanelId]=function(e,n){return e.panelId===n.panelId?e:i({},e,{panelId:n.panelId})},de),ge=n.createContext(null);function ye(e){var t=n.useContext(ge);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+Ce.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,ye),r}return t}function he(e,n){return d(n.type,be,e,n)}ge.displayName="DisclosureContext";var Se=n.Fragment;function Ce(e){var t,r=e.defaultOpen,o=void 0!==r&&r,u=l(e,["defaultOpen"]),i="headlessui-disclosure-button-"+x(),c="headlessui-disclosure-panel-"+x(),s=n.useReducer(he,{disclosureState:o?fe.Open:fe.Closed,linkedPanel:!1,buttonId:i,panelId:c}),p=s[0].disclosureState,v=s[1];n.useEffect((function(){return v({type:pe.SetButtonId,buttonId:i})}),[i,v]),n.useEffect((function(){return v({type:pe.SetPanelId,panelId:c})}),[c,v]);var m=n.useMemo((function(){return{open:p===fe.Open}}),[p]);return a.createElement(ge.Provider,{value:s},a.createElement(ee,{value:d(p,(t={},t[fe.Open]=$.Open,t[fe.Closed]=$.Closed,t))},f({props:u,slot:m,defaultTag:Se,name:"Disclosure"})))}var Ee,xe,Oe,Ie,we=v((function e(t,r){var o=ye([Ce.name,e.name].join(".")),a=o[0],l=o[1],c=b(r),s=n.useCallback((function(e){switch(e.key){case u.Space:case u.Enter:e.preventDefault(),e.stopPropagation(),l({type:pe.ToggleDisclosure})}}),[l]),d=n.useCallback((function(e){switch(e.key){case u.Space:e.preventDefault()}}),[]),p=n.useCallback((function(e){g(e.currentTarget)||t.disabled||l({type:pe.ToggleDisclosure})}),[l,t.disabled]),v=n.useMemo((function(){return{open:a.disclosureState===fe.Open}}),[a]);return f({props:i({},t,{ref:c,id:a.buttonId,type:"button","aria-expanded":a.disclosureState===fe.Open||void 0,"aria-controls":a.linkedPanel?a.panelId:void 0,onKeyDown:s,onKeyUp:d,onClick:p}),slot:v,defaultTag:"button",name:"Disclosure.Button"})})),ke=r.RenderStrategy|r.Static,Re=v((function e(t,r){var o=ye([Ce.name,e.name].join(".")),u=o[0],a=o[1],l=b(r,(function(){u.linkedPanel||a({type:pe.LinkPanel})})),c=Z(),s=null!==c?c===$.Open:u.disclosureState===fe.Open;n.useEffect((function(){return function(){return a({type:pe.UnlinkPanel})}}),[a]),n.useEffect((function(){var e;u.disclosureState!==fe.Closed||null!=(e=t.unmount)&&!e||a({type:pe.UnlinkPanel})}),[u.disclosureState,t.unmount,a]);var d=n.useMemo((function(){return{open:u.disclosureState===fe.Open}}),[u]);return f({props:i({},t,{ref:l,id:u.panelId}),slot:d,defaultTag:"div",features:ke,visible:s,name:"Disclosure.Panel"})}));function Pe(){var e=[],n={requestAnimationFrame:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=requestAnimationFrame.apply(void 0,arguments);n.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];n.requestAnimationFrame((function(){n.requestAnimationFrame.apply(n,t)}))},setTimeout:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=setTimeout.apply(void 0,arguments);n.add((function(){return clearTimeout(e)}))})),add:function(n){e.push(n)},dispose:function(){for(var n,t=s(e.splice(0));!(n=t()).done;)(0,n.value)()}};return n}function Te(){var e=n.useState(Pe)[0];return n.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function De(e,t){var r=n.useState(e),o=r[0],u=r[1],a=n.useRef(e);return y((function(){a.current=e}),[e]),y((function(){return u(a.current)}),[a,u].concat(t)),o}function Fe(e,n){var t=n.resolveItems();if(t.length<=0)return null;var r=n.resolveActiveIndex(),o=null!=r?r:-1,u=function(){switch(e.focus){case Ee.First:return t.findIndex((function(e){return!n.resolveDisabled(e)}));case Ee.Previous:var r=t.slice().reverse().findIndex((function(e,t,r){return!(-1!==o&&r.length-t-1>=o||n.resolveDisabled(e))}));return-1===r?r:t.length-1-r;case Ee.Next:return t.findIndex((function(e,t){return!(t<=o||n.resolveDisabled(e))}));case Ee.Last:var u=t.slice().reverse().findIndex((function(e){return!n.resolveDisabled(e)}));return-1===u?u:t.length-1-u;case Ee.Specific:return t.findIndex((function(t){return n.resolveId(t)===e.id}));case Ee.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?r:u}Ce.Button=we,Ce.Panel=Re,function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(Ee||(Ee={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Oe||(Oe={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(Ie||(Ie={}));var Le=((xe={})[Ie.CloseListbox]=function(e){return e.disabled||e.listboxState===Oe.Closed?e:i({},e,{activeOptionIndex:null,listboxState:Oe.Closed})},xe[Ie.OpenListbox]=function(e){return e.disabled||e.listboxState===Oe.Open?e:i({},e,{listboxState:Oe.Open})},xe[Ie.SetDisabled]=function(e,n){return e.disabled===n.disabled?e:i({},e,{disabled:n.disabled})},xe[Ie.GoToOption]=function(e,n){if(e.disabled)return e;if(e.listboxState===Oe.Closed)return e;var t=Fe(n,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===t?e:i({},e,{searchQuery:"",activeOptionIndex:t})},xe[Ie.Search]=function(e,n){if(e.disabled)return e;if(e.listboxState===Oe.Closed)return e;var t=e.searchQuery+n.value.toLowerCase(),r=e.options.findIndex((function(e){var n;return!e.dataRef.current.disabled&&(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(t))}));return i({},e,-1===r||r===e.activeOptionIndex?{searchQuery:t}:{searchQuery:t,activeOptionIndex:r})},xe[Ie.ClearSearch]=function(e){return e.disabled||e.listboxState===Oe.Closed||""===e.searchQuery?e:i({},e,{searchQuery:""})},xe[Ie.RegisterOption]=function(e,n){return i({},e,{options:[].concat(e.options,[{id:n.id,dataRef:n.dataRef}])})},xe[Ie.UnregisterOption]=function(e,n){var t=e.options.slice(),r=null!==e.activeOptionIndex?t[e.activeOptionIndex]:null,o=t.findIndex((function(e){return e.id===n.id}));return-1!==o&&t.splice(o,1),i({},e,{options:t,activeOptionIndex:o===e.activeOptionIndex||null===r?null:t.indexOf(r)})},xe),Ae=n.createContext(null);function Me(e){var t=n.useContext(Ae);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+je.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Me),r}return t}function Ne(e,n){return d(n.type,Le,e,n)}Ae.displayName="ListboxContext";var Ue=n.Fragment;function je(e){var t,r=e.value,o=e.onChange,u=e.disabled,i=void 0!==u&&u,c=l(e,["value","onChange","disabled"]),s=n.useReducer(Ne,{listboxState:Oe.Closed,propsRef:{current:{value:r,onChange:o}},labelRef:n.createRef(),buttonRef:n.createRef(),optionsRef:n.createRef(),disabled:i,options:[],searchQuery:"",activeOptionIndex:null}),p=s[0],v=p.listboxState,m=p.propsRef,b=p.optionsRef,g=p.buttonRef,h=s[1];y((function(){m.current.value=r}),[r,m]),y((function(){m.current.onChange=o}),[o,m]),y((function(){return h({type:Ie.SetDisabled,disabled:i})}),[i]),A("mousedown",(function(e){var n,t,r,o=e.target;v===Oe.Open&&((null==(n=g.current)?void 0:n.contains(o))||(null==(t=b.current)?void 0:t.contains(o))||(h({type:Ie.CloseListbox}),D(o,k.Loose)||(e.preventDefault(),null==(r=g.current)||r.focus())))}));var S=n.useMemo((function(){return{open:v===Oe.Open,disabled:i}}),[v,i]);return a.createElement(Ae.Provider,{value:s},a.createElement(ee,{value:d(v,(t={},t[Oe.Open]=$.Open,t[Oe.Closed]=$.Closed,t))},f({props:c,slot:S,defaultTag:Ue,name:"Listbox"})))}var Ge,Be,He,Ve=v((function e(t,r){var o,a=Me([je.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.buttonRef,r),d="headlessui-listbox-button-"+x(),p=Te(),v=n.useCallback((function(e){switch(e.key){case u.Space:case u.Enter:case u.ArrowDown:e.preventDefault(),c({type:Ie.OpenListbox}),p.nextFrame((function(){l.propsRef.current.value||c({type:Ie.GoToOption,focus:Ee.First})}));break;case u.ArrowUp:e.preventDefault(),c({type:Ie.OpenListbox}),p.nextFrame((function(){l.propsRef.current.value||c({type:Ie.GoToOption,focus:Ee.Last})}))}}),[c,l,p]),m=n.useCallback((function(e){switch(e.key){case u.Space:e.preventDefault()}}),[]),y=n.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();l.listboxState===Oe.Open?(c({type:Ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),c({type:Ie.OpenListbox}))}),[c,p,l]),h=De((function(){if(l.labelRef.current)return[l.labelRef.current.id,d].join(" ")}),[l.labelRef.current,d]),S=n.useMemo((function(){return{open:l.listboxState===Oe.Open,disabled:l.disabled}}),[l]);return f({props:i({},t,{ref:s,id:d,type:"button","aria-haspopup":!0,"aria-controls":null==(o=l.optionsRef.current)?void 0:o.id,"aria-expanded":l.listboxState===Oe.Open||void 0,"aria-labelledby":h,disabled:l.disabled,onKeyDown:v,onKeyUp:m,onClick:y}),slot:S,defaultTag:"button",name:"Listbox.Button"})})),Ke=r.RenderStrategy|r.Static,Qe=v((function e(t,r){var o,a=Me([je.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.optionsRef,r),d="headlessui-listbox-options-"+x(),p=Te(),v=Te(),m=Z(),g=null!==m?m===$.Open:l.listboxState===Oe.Open;y((function(){var e=l.optionsRef.current;e&&l.listboxState===Oe.Open&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[l.listboxState,l.optionsRef]);var h=n.useCallback((function(e){switch(v.dispose(),e.key){case u.Space:if(""!==l.searchQuery)return e.preventDefault(),e.stopPropagation(),c({type:Ie.Search,value:e.key});case u.Enter:e.preventDefault(),e.stopPropagation(),c({type:Ie.CloseListbox}),null!==l.activeOptionIndex&&l.propsRef.current.onChange(l.options[l.activeOptionIndex].dataRef.current.value),Pe().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case u.ArrowDown:return e.preventDefault(),e.stopPropagation(),c({type:Ie.GoToOption,focus:Ee.Next});case u.ArrowUp:return e.preventDefault(),e.stopPropagation(),c({type:Ie.GoToOption,focus:Ee.Previous});case u.Home:case u.PageUp:return e.preventDefault(),e.stopPropagation(),c({type:Ie.GoToOption,focus:Ee.First});case u.End:case u.PageDown:return e.preventDefault(),e.stopPropagation(),c({type:Ie.GoToOption,focus:Ee.Last});case u.Escape:return e.preventDefault(),e.stopPropagation(),c({type:Ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case u.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(c({type:Ie.Search,value:e.key}),v.setTimeout((function(){return c({type:Ie.ClearSearch})}),350))}}),[p,c,v,l]),S=De((function(){var e,n,t;return null!=(e=null==(n=l.labelRef.current)?void 0:n.id)?e:null==(t=l.buttonRef.current)?void 0:t.id}),[l.labelRef.current,l.buttonRef.current]),C=n.useMemo((function(){return{open:l.listboxState===Oe.Open}}),[l]);return f({props:i({},t,{"aria-activedescendant":null===l.activeOptionIndex||null==(o=l.options[l.activeOptionIndex])?void 0:o.id,"aria-labelledby":S,id:d,onKeyDown:h,role:"listbox",tabIndex:0,ref:s}),slot:C,defaultTag:"ul",features:Ke,visible:g,name:"Listbox.Options"})}));function We(e){var t=e.container,r=e.accept,o=e.walk,u=e.enabled,a=void 0===u||u,i=n.useRef(r),l=n.useRef(o);n.useEffect((function(){i.current=r,l.current=o}),[r,o]),y((function(){if(t&&a)for(var e=i.current,n=l.current,r=Object.assign((function(n){return e(n)}),{acceptNode:e}),o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,r,!1);o.nextNode();)n(o.currentNode)}),[t,a,i,l])}je.Button=Ve,je.Label=function e(t){var r=Me([je.name,e.name].join("."))[0],o="headlessui-listbox-label-"+x(),u=n.useCallback((function(){var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[r.buttonRef]),a=n.useMemo((function(){return{open:r.listboxState===Oe.Open,disabled:r.disabled}}),[r]);return f({props:i({},t,{ref:r.labelRef,id:o,onClick:u}),slot:a,defaultTag:"label",name:"Listbox.Label"})},je.Options=Qe,je.Option=function e(t){var r=t.disabled,o=void 0!==r&&r,u=t.value,a=l(t,["disabled","value"]),c=Me([je.name,e.name].join(".")),s=c[0],d=c[1],p="headlessui-listbox-option-"+x(),v=null!==s.activeOptionIndex&&s.options[s.activeOptionIndex].id===p,m=s.propsRef.current.value===u,b=n.useRef({disabled:o,value:u});y((function(){b.current.disabled=o}),[b,o]),y((function(){b.current.value=u}),[b,u]),y((function(){var e,n;b.current.textValue=null==(e=document.getElementById(p))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[b,p]);var g=n.useCallback((function(){return s.propsRef.current.onChange(u)}),[s.propsRef,u]);y((function(){return d({type:Ie.RegisterOption,id:p,dataRef:b}),function(){return d({type:Ie.UnregisterOption,id:p})}}),[b,p]),y((function(){var e;s.listboxState===Oe.Open&&m&&(d({type:Ie.GoToOption,focus:Ee.Specific,id:p}),null==(e=document.getElementById(p))||null==e.focus||e.focus())}),[s.listboxState]),y((function(){if(s.listboxState===Oe.Open&&v){var e=Pe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(p))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[p,v,s.listboxState]);var h=n.useCallback((function(e){if(o)return e.preventDefault();g(),d({type:Ie.CloseListbox}),Pe().nextFrame((function(){var e;return null==(e=s.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[d,s.buttonRef,o,g]),S=n.useCallback((function(){if(o)return d({type:Ie.GoToOption,focus:Ee.Nothing});d({type:Ie.GoToOption,focus:Ee.Specific,id:p})}),[o,p,d]),C=n.useCallback((function(){o||v||d({type:Ie.GoToOption,focus:Ee.Specific,id:p})}),[o,v,p,d]),E=n.useCallback((function(){o||v&&d({type:Ie.GoToOption,focus:Ee.Nothing})}),[o,v,d]),O=n.useMemo((function(){return{active:v,selected:m,disabled:o}}),[v,m,o]);return f({props:i({},a,{id:p,role:"option",tabIndex:!0===o?void 0:-1,"aria-disabled":!0===o||void 0,"aria-selected":!0===m||void 0,disabled:void 0,onClick:h,onFocus:S,onPointerMove:C,onMouseMove:C,onPointerLeave:E,onMouseLeave:E}),slot:O,defaultTag:"li",name:"Listbox.Option"})},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Be||(Be={})),function(e){e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem"}(He||(He={}));var qe=((Ge={})[He.CloseMenu]=function(e){return e.menuState===Be.Closed?e:i({},e,{activeItemIndex:null,menuState:Be.Closed})},Ge[He.OpenMenu]=function(e){return e.menuState===Be.Open?e:i({},e,{menuState:Be.Open})},Ge[He.GoToItem]=function(e,n){var t=Fe(n,{resolveItems:function(){return e.items},resolveActiveIndex:function(){return e.activeItemIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeItemIndex===t?e:i({},e,{searchQuery:"",activeItemIndex:t})},Ge[He.Search]=function(e,n){var t=e.searchQuery+n.value.toLowerCase(),r=e.items.findIndex((function(e){var n;return(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(t))&&!e.dataRef.current.disabled}));return i({},e,-1===r||r===e.activeItemIndex?{searchQuery:t}:{searchQuery:t,activeItemIndex:r})},Ge[He.ClearSearch]=function(e){return""===e.searchQuery?e:i({},e,{searchQuery:""})},Ge[He.RegisterItem]=function(e,n){return i({},e,{items:[].concat(e.items,[{id:n.id,dataRef:n.dataRef}])})},Ge[He.UnregisterItem]=function(e,n){var t=e.items.slice(),r=null!==e.activeItemIndex?t[e.activeItemIndex]:null,o=t.findIndex((function(e){return e.id===n.id}));return-1!==o&&t.splice(o,1),i({},e,{items:t,activeItemIndex:o===e.activeItemIndex||null===r?null:t.indexOf(r)})},Ge),_e=n.createContext(null);function Ye(e){var t=n.useContext(_e);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+$e.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Ye),r}return t}function ze(e,n){return d(n.type,qe,e,n)}_e.displayName="MenuContext";var Je=n.Fragment;function $e(e){var t,r=n.useReducer(ze,{menuState:Be.Closed,buttonRef:n.createRef(),itemsRef:n.createRef(),items:[],searchQuery:"",activeItemIndex:null}),o=r[0],u=o.menuState,i=o.itemsRef,l=o.buttonRef,c=r[1];A("mousedown",(function(e){var n,t,r,o=e.target;u===Be.Open&&((null==(n=l.current)?void 0:n.contains(o))||(null==(t=i.current)?void 0:t.contains(o))||(c({type:He.CloseMenu}),D(o,k.Loose)||(e.preventDefault(),null==(r=l.current)||r.focus())))}));var s=n.useMemo((function(){return{open:u===Be.Open}}),[u]);return a.createElement(_e.Provider,{value:r},a.createElement(ee,{value:d(u,(t={},t[Be.Open]=$.Open,t[Be.Closed]=$.Closed,t))},f({props:e,slot:s,defaultTag:Je,name:"Menu"})))}var Xe,Ze,en,nn=v((function e(t,r){var o,a=Ye([$e.name,e.name].join(".")),l=a[0],c=a[1],s=b(l.buttonRef,r),d="headlessui-menu-button-"+x(),p=Te(),v=n.useCallback((function(e){switch(e.key){case u.Space:case u.Enter:case u.ArrowDown:e.preventDefault(),e.stopPropagation(),c({type:He.OpenMenu}),p.nextFrame((function(){return c({type:He.GoToItem,focus:Ee.First})}));break;case u.ArrowUp:e.preventDefault(),e.stopPropagation(),c({type:He.OpenMenu}),p.nextFrame((function(){return c({type:He.GoToItem,focus:Ee.Last})}))}}),[c,p]),m=n.useCallback((function(e){switch(e.key){case u.Space:e.preventDefault()}}),[]),y=n.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();t.disabled||(l.menuState===Be.Open?(c({type:He.CloseMenu}),p.nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),e.stopPropagation(),c({type:He.OpenMenu})))}),[c,p,l,t.disabled]),h=n.useMemo((function(){return{open:l.menuState===Be.Open}}),[l]);return f({props:i({},t,{ref:s,id:d,type:"button","aria-haspopup":!0,"aria-controls":null==(o=l.itemsRef.current)?void 0:o.id,"aria-expanded":l.menuState===Be.Open||void 0,onKeyDown:v,onKeyUp:m,onClick:y}),slot:h,defaultTag:"button",name:"Menu.Button"})})),tn=r.RenderStrategy|r.Static,rn=v((function e(t,r){var o,a,l=Ye([$e.name,e.name].join(".")),c=l[0],s=l[1],d=b(c.itemsRef,r),p="headlessui-menu-items-"+x(),v=Te(),m=Z(),g=null!==m?m===$.Open:c.menuState===Be.Open;n.useEffect((function(){var e=c.itemsRef.current;e&&c.menuState===Be.Open&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[c.menuState,c.itemsRef]),We({container:c.itemsRef.current,enabled:c.menuState===Be.Open,accept:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk:function(e){e.setAttribute("role","none")}});var y=n.useCallback((function(e){switch(v.dispose(),e.key){case u.Space:if(""!==c.searchQuery)return e.preventDefault(),e.stopPropagation(),s({type:He.Search,value:e.key});case u.Enter:var n;e.preventDefault(),e.stopPropagation(),s({type:He.CloseMenu}),null!==c.activeItemIndex&&(null==(n=document.getElementById(c.items[c.activeItemIndex].id))||n.click()),Pe().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case u.ArrowDown:return e.preventDefault(),e.stopPropagation(),s({type:He.GoToItem,focus:Ee.Next});case u.ArrowUp:return e.preventDefault(),e.stopPropagation(),s({type:He.GoToItem,focus:Ee.Previous});case u.Home:case u.PageUp:return e.preventDefault(),e.stopPropagation(),s({type:He.GoToItem,focus:Ee.First});case u.End:case u.PageDown:return e.preventDefault(),e.stopPropagation(),s({type:He.GoToItem,focus:Ee.Last});case u.Escape:e.preventDefault(),e.stopPropagation(),s({type:He.CloseMenu}),Pe().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case u.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(s({type:He.Search,value:e.key}),v.setTimeout((function(){return s({type:He.ClearSearch})}),350))}}),[s,v,c]),h=n.useCallback((function(e){switch(e.key){case u.Space:e.preventDefault()}}),[]),S=n.useMemo((function(){return{open:c.menuState===Be.Open}}),[c]);return f({props:i({},t,{"aria-activedescendant":null===c.activeItemIndex||null==(o=c.items[c.activeItemIndex])?void 0:o.id,"aria-labelledby":null==(a=c.buttonRef.current)?void 0:a.id,id:p,onKeyDown:y,onKeyUp:h,role:"menu",tabIndex:0,ref:d}),slot:S,defaultTag:"div",features:tn,visible:g,name:"Menu.Items"})})),on=n.Fragment;$e.Button=nn,$e.Items=rn,$e.Item=function e(t){var r=t.disabled,o=void 0!==r&&r,u=t.onClick,a=l(t,["disabled","onClick"]),c=Ye([$e.name,e.name].join(".")),s=c[0],d=c[1],p="headlessui-menu-item-"+x(),v=null!==s.activeItemIndex&&s.items[s.activeItemIndex].id===p;y((function(){if(s.menuState===Be.Open&&v){var e=Pe();return e.nextFrame((function(){var e;return null==(e=document.getElementById(p))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[p,v,s.menuState]);var m=n.useRef({disabled:o});y((function(){m.current.disabled=o}),[m,o]),y((function(){var e,n;m.current.textValue=null==(e=document.getElementById(p))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[m,p]),y((function(){return d({type:He.RegisterItem,id:p,dataRef:m}),function(){return d({type:He.UnregisterItem,id:p})}}),[m,p]);var b=n.useCallback((function(e){return o?e.preventDefault():(d({type:He.CloseMenu}),Pe().nextFrame((function(){var e;return null==(e=s.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[d,s.buttonRef,o,u]),g=n.useCallback((function(){if(o)return d({type:He.GoToItem,focus:Ee.Nothing});d({type:He.GoToItem,focus:Ee.Specific,id:p})}),[o,p,d]),h=n.useCallback((function(){o||v||d({type:He.GoToItem,focus:Ee.Specific,id:p})}),[o,v,p,d]),S=n.useCallback((function(){o||v&&d({type:He.GoToItem,focus:Ee.Nothing})}),[o,v,d]),C=n.useMemo((function(){return{active:v,disabled:o}}),[v,o]);return f({props:i({},a,{id:p,role:"menuitem",tabIndex:!0===o?void 0:-1,"aria-disabled":!0===o||void 0,disabled:void 0,onClick:b,onFocus:g,onPointerMove:h,onMouseMove:h,onPointerLeave:S,onMouseLeave:S}),slot:C,defaultTag:on,name:"Menu.Item"})},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Ze||(Ze={})),function(e){e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId"}(en||(en={}));var un=((Xe={})[en.TogglePopover]=function(e){var n;return i({},e,{popoverState:d(e.popoverState,(n={},n[Ze.Open]=Ze.Closed,n[Ze.Closed]=Ze.Open,n))})},Xe[en.ClosePopover]=function(e){return e.popoverState===Ze.Closed?e:i({},e,{popoverState:Ze.Closed})},Xe[en.SetButton]=function(e,n){return e.button===n.button?e:i({},e,{button:n.button})},Xe[en.SetButtonId]=function(e,n){return e.buttonId===n.buttonId?e:i({},e,{buttonId:n.buttonId})},Xe[en.SetPanel]=function(e,n){return e.panel===n.panel?e:i({},e,{panel:n.panel})},Xe[en.SetPanelId]=function(e,n){return e.panelId===n.panelId?e:i({},e,{panelId:n.panelId})},Xe),an=n.createContext(null);function ln(e){var t=n.useContext(an);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+pn.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,ln),r}return t}an.displayName="PopoverContext";var cn=n.createContext(null);function sn(){return n.useContext(cn)}cn.displayName="PopoverGroupContext";var dn=n.createContext(null);function fn(e,n){return d(n.type,un,e,n)}function pn(e){var t,r="headlessui-popover-button-"+x(),o="headlessui-popover-panel-"+x(),u=n.useReducer(fn,{popoverState:Ze.Closed,button:null,buttonId:r,panel:null,panelId:o}),i=u[0],l=i.popoverState,c=i.button,s=i.panel,p=u[1];n.useEffect((function(){return p({type:en.SetButtonId,buttonId:r})}),[r,p]),n.useEffect((function(){return p({type:en.SetPanelId,panelId:o})}),[o,p]);var v=n.useMemo((function(){return{buttonId:r,panelId:o,close:function(){return p({type:en.ClosePopover})}}}),[r,o,p]),m=sn(),b=null==m?void 0:m.registerPopover,g=n.useCallback((function(){var e;return null!=(e=null==m?void 0:m.isFocusWithinPopoverGroup())?e:(null==c?void 0:c.contains(document.activeElement))||(null==s?void 0:s.contains(document.activeElement))}),[m,c,s]);n.useEffect((function(){return null==b?void 0:b(v)}),[b,v]),A("focus",(function(){l===Ze.Open&&(g()||c&&s&&p({type:en.ClosePopover}))}),!0),A("mousedown",(function(e){var n=e.target;l===Ze.Open&&((null==c?void 0:c.contains(n))||(null==s?void 0:s.contains(n))||(p({type:en.ClosePopover}),D(n,k.Loose)||(e.preventDefault(),null==c||c.focus())))}));var y=n.useMemo((function(){return{open:l===Ze.Open}}),[l]);return a.createElement(an.Provider,{value:u},a.createElement(ee,{value:d(l,(t={},t[Ze.Open]=$.Open,t[Ze.Closed]=$.Closed,t))},f({props:e,slot:y,defaultTag:"div",name:"Popover"})))}dn.displayName="PopoverPanelContext";var vn=v((function e(t,r){var o=ln([pn.name,e.name].join(".")),a=o[0],l=o[1],c=n.useRef(null),s=sn(),d=null==s?void 0:s.closeOthers,p=n.useContext(dn),v=null!==p&&p===a.panelId,m=b(c,r,v?null:function(e){return l({type:en.SetButton,button:e})}),y=n.useRef(null),h=n.useRef("undefined"==typeof window?null:document.activeElement);A("focus",(function(){h.current=y.current,y.current=document.activeElement}),!0);var S=n.useCallback((function(e){var n;if(v){if(a.popoverState===Ze.Closed)return;switch(e.key){case u.Space:case u.Enter:e.preventDefault(),e.stopPropagation(),l({type:en.ClosePopover}),null==(n=a.button)||n.focus()}}else switch(e.key){case u.Space:case u.Enter:e.preventDefault(),e.stopPropagation(),a.popoverState===Ze.Closed&&(null==d||d(a.buttonId)),l({type:en.TogglePopover});break;case u.Escape:if(a.popoverState!==Ze.Open)return null==d?void 0:d(a.buttonId);if(!c.current)return;if(!c.current.contains(document.activeElement))return;l({type:en.ClosePopover});break;case u.Tab:if(a.popoverState!==Ze.Open)return;if(!a.panel)return;if(!a.button)return;if(e.shiftKey){var t;if(!h.current)return;if(null==(t=a.button)?void 0:t.contains(h.current))return;if(a.panel.contains(h.current))return;var r=T(),o=r.indexOf(h.current);if(r.indexOf(a.button)>o)return;e.preventDefault(),e.stopPropagation(),L(a.panel,O.Last)}else e.preventDefault(),e.stopPropagation(),L(a.panel,O.First)}}),[l,a.popoverState,a.buttonId,a.button,a.panel,c,d,v]),C=n.useCallback((function(e){var n;if(!v&&(e.key===u.Space&&e.preventDefault(),a.popoverState===Ze.Open&&a.panel&&a.button))switch(e.key){case u.Tab:if(!h.current)return;if(null==(n=a.button)?void 0:n.contains(h.current))return;if(a.panel.contains(h.current))return;var t=T(),r=t.indexOf(h.current);if(t.indexOf(a.button)>r)return;e.preventDefault(),e.stopPropagation(),L(a.panel,O.Last)}}),[a.popoverState,a.panel,a.button,v]),E=n.useCallback((function(e){var n,r;g(e.currentTarget)||t.disabled||(v?(l({type:en.ClosePopover}),null==(n=a.button)||n.focus()):(a.popoverState===Ze.Closed&&(null==d||d(a.buttonId)),null==(r=a.button)||r.focus(),l({type:en.TogglePopover})))}),[l,a.button,a.popoverState,a.buttonId,t.disabled,d,v]),x=n.useMemo((function(){return{open:a.popoverState===Ze.Open}}),[a]);return f({props:i({},t,v?{type:"button",onKeyDown:S,onClick:E}:{ref:m,id:a.buttonId,type:"button","aria-expanded":a.popoverState===Ze.Open||void 0,"aria-controls":a.panel?a.panelId:void 0,onKeyDown:S,onKeyUp:C,onClick:E}),slot:x,defaultTag:"button",name:"Popover.Button"})})),mn=r.RenderStrategy|r.Static,bn=v((function e(t,r){var o=ln([pn.name,e.name].join(".")),u=o[0].popoverState,a=o[1],l=b(r),c="headlessui-popover-overlay-"+x(),s=Z(),d=null!==s?s===$.Open:u===Ze.Open,p=n.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();a({type:en.ClosePopover})}),[a]),v=n.useMemo((function(){return{open:u===Ze.Open}}),[u]);return f({props:i({},t,{ref:l,id:c,"aria-hidden":!0,onClick:p}),slot:v,defaultTag:"div",features:mn,visible:d,name:"Popover.Overlay"})})),gn=r.RenderStrategy|r.Static,yn=v((function e(t,r){var o=t.focus,c=void 0!==o&&o,s=l(t,["focus"]),d=ln([pn.name,e.name].join(".")),p=d[0],v=d[1],m=n.useRef(null),g=b(m,r,(function(e){v({type:en.SetPanel,panel:e})})),y=Z(),h=null!==y?y===$.Open:p.popoverState===Ze.Open,S=n.useCallback((function(e){var n;switch(e.key){case u.Escape:if(p.popoverState!==Ze.Open)return;if(!m.current)return;if(!m.current.contains(document.activeElement))return;e.preventDefault(),v({type:en.ClosePopover}),null==(n=p.button)||n.focus()}}),[p,m,v]);n.useEffect((function(){return function(){return v({type:en.SetPanel,panel:null})}}),[v]),n.useEffect((function(){var e;p.popoverState!==Ze.Closed||null!=(e=t.unmount)&&!e||v({type:en.SetPanel,panel:null})}),[p.popoverState,t.unmount,v]),n.useEffect((function(){if(c&&p.popoverState===Ze.Open&&m.current){var e=document.activeElement;m.current.contains(e)||L(m.current,O.First)}}),[c,m,p.popoverState]),A("keydown",(function(e){if(p.popoverState===Ze.Open&&m.current&&e.key===u.Tab&&document.activeElement&&m.current&&m.current.contains(document.activeElement)){e.preventDefault();var n,t=L(m.current,e.shiftKey?O.Previous:O.Next);if(t===I.Underflow)return null==(n=p.button)?void 0:n.focus();if(t===I.Overflow){if(!p.button)return;var r=T(),o=r.indexOf(p.button);L(r.splice(o+1).filter((function(e){var n;return!(null==(n=m.current)?void 0:n.contains(e))})),O.First)===I.Error&&L(document.body,O.First)}}})),A("focus",(function(){var e;c&&p.popoverState===Ze.Open&&m.current&&((null==(e=m.current)?void 0:e.contains(document.activeElement))||v({type:en.ClosePopover}))}),!0);var C=n.useMemo((function(){return{open:p.popoverState===Ze.Open}}),[p]);return a.createElement(dn.Provider,{value:p.panelId},f({props:i({},s,{ref:g,id:p.panelId,onKeyDown:S}),slot:C,defaultTag:"div",features:gn,visible:h,name:"Popover.Panel"}))}));pn.Button=vn,pn.Overlay=bn,pn.Panel=yn,pn.Group=function(e){var t=n.useRef(null),r=n.useState([]),o=r[0],u=r[1],l=n.useCallback((function(e){u((function(n){var t=n.indexOf(e);if(-1!==t){var r=n.slice();return r.splice(t,1),r}return n}))}),[u]),c=n.useCallback((function(e){return u((function(n){return[].concat(n,[e])})),function(){return l(e)}}),[u,l]),d=n.useCallback((function(){var e,n=document.activeElement;return!!(null==(e=t.current)?void 0:e.contains(n))||o.some((function(e){var t,r;return(null==(t=document.getElementById(e.buttonId))?void 0:t.contains(n))||(null==(r=document.getElementById(e.panelId))?void 0:r.contains(n))}))}),[t,o]),p=n.useCallback((function(e){for(var n,t=s(o);!(n=t()).done;){var r=n.value;r.buttonId!==e&&r.close()}}),[o]),v=n.useMemo((function(){return{registerPopover:c,unregisterPopover:l,isFocusWithinPopoverGroup:d,closeOthers:p}}),[c,l,d,p]),m=n.useMemo((function(){return{}}),[]);return a.createElement(cn.Provider,{value:v},f({props:i({},e,{ref:t}),slot:m,defaultTag:"div",name:"Popover.Group"}))};var hn,Sn,Cn=n.createContext(null);function En(){var e=n.useContext(Cn);if(null===e){var t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,En),t}return e}function xn(){var e=n.useState([]),t=e[0],r=e[1];return[t.length>0?t.join(" "):void 0,n.useMemo((function(){return function(e){var t=n.useCallback((function(e){return r((function(n){return[].concat(n,[e])})),function(){return r((function(n){var t=n.slice(),r=t.indexOf(e);return-1!==r&&t.splice(r,1),t}))}}),[]),o=n.useMemo((function(){return{register:t,slot:e.slot,name:e.name,props:e.props}}),[t,e.slot,e.name,e.props]);return a.createElement(Cn.Provider,{value:o},e.children)}}),[r])]}function On(e){var n=e.passive,t=void 0!==n&&n,r=l(e,["passive"]),o=En(),u="headlessui-label-"+x();y((function(){return o.register(u)}),[u,o.register]);var a=i({},o.props,{id:u}),c=i({},r,a);return t&&delete c.onClick,f({props:c,slot:o.slot||{},defaultTag:"label",name:o.name||"Label"})}!function(e){e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption"}(Sn||(Sn={}));var In,wn=((hn={})[Sn.RegisterOption]=function(e,n){return i({},e,{options:[].concat(e.options,[{id:n.id,element:n.element,propsRef:n.propsRef}])})},hn[Sn.UnregisterOption]=function(e,n){var t=e.options.slice(),r=e.options.findIndex((function(e){return e.id===n.id}));return-1===r?e:(t.splice(r,1),i({},e,{options:t}))},hn),kn=n.createContext(null);function Rn(e){var t=n.useContext(kn);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+Tn.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Rn),r}return t}function Pn(e,n){return d(n.type,wn,e,n)}function Tn(e){var t=e.value,r=e.onChange,o=e.disabled,c=void 0!==o&&o,s=l(e,["value","onChange","disabled"]),d=n.useReducer(Pn,{options:[]}),p=d[0].options,v=d[1],m=xn(),b=m[0],g=m[1],y=z(),h=y[0],S=y[1],C="headlessui-radiogroup-"+x(),E=n.useRef(null),w=n.useMemo((function(){return p.find((function(e){return!e.propsRef.current.disabled}))}),[p]),k=n.useMemo((function(){return p.some((function(e){return e.propsRef.current.value===t}))}),[p,t]),R=n.useCallback((function(e){var n;if(c)return!1;if(e===t)return!1;var o=null==(n=p.find((function(n){return n.propsRef.current.value===e})))?void 0:n.propsRef.current;return!(null==o?void 0:o.disabled)&&(r(e),!0)}),[r,t,c,p]);We({container:E.current,accept:function(e){return"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk:function(e){e.setAttribute("role","none")}});var P=n.useCallback((function(e){if(E.current){var n=p.filter((function(e){return!1===e.propsRef.current.disabled})).map((function(e){return e.element.current}));switch(e.key){case u.ArrowLeft:case u.ArrowUp:if(e.preventDefault(),e.stopPropagation(),L(n,O.Previous|O.WrapAround)===I.Success){var t=p.find((function(e){return e.element.current===document.activeElement}));t&&R(t.propsRef.current.value)}break;case u.ArrowRight:case u.ArrowDown:if(e.preventDefault(),e.stopPropagation(),L(n,O.Next|O.WrapAround)===I.Success){var r=p.find((function(e){return e.element.current===document.activeElement}));r&&R(r.propsRef.current.value)}break;case u.Space:e.preventDefault(),e.stopPropagation();var o=p.find((function(e){return e.element.current===document.activeElement}));o&&R(o.propsRef.current.value)}}}),[E,p,R]),T=n.useCallback((function(e){return v(i({type:Sn.RegisterOption},e)),function(){return v({type:Sn.UnregisterOption,id:e.id})}}),[v]),D=n.useMemo((function(){return{registerOption:T,firstOption:w,containsCheckedOption:k,change:R,disabled:c,value:t}}),[T,w,k,R,c,t]);return a.createElement(S,{name:"RadioGroup.Description"},a.createElement(g,{name:"RadioGroup.Label"},a.createElement(kn.Provider,{value:D},f({props:i({},s,{ref:E,id:C,role:"radiogroup","aria-labelledby":b,"aria-describedby":h,onKeyDown:P}),defaultTag:"div",name:"RadioGroup"}))))}kn.displayName="RadioGroupContext",function(e){e[e.Empty=1]="Empty",e[e.Active=2]="Active"}(In||(In={})),Tn.Option=function e(t){var r=n.useRef(null),o="headlessui-radiogroup-option-"+x(),u=xn(),c=u[0],s=u[1],d=z(),p=d[0],v=d[1],m=function(e){void 0===e&&(e=0);var t=n.useState(e),r=t[0],o=t[1];return{addFlag:n.useCallback((function(e){return o((function(n){return n|e}))}),[o]),hasFlag:n.useCallback((function(e){return Boolean(r&e)}),[r]),removeFlag:n.useCallback((function(e){return o((function(n){return n&~e}))}),[o]),toggleFlag:n.useCallback((function(e){return o((function(n){return n^e}))}),[o])}}(In.Empty),b=m.addFlag,g=m.removeFlag,h=m.hasFlag,S=t.value,C=t.disabled,E=void 0!==C&&C,O=l(t,["value","disabled"]),I=n.useRef({value:S,disabled:E});y((function(){I.current.value=S}),[S,I]),y((function(){I.current.disabled=E}),[E,I]);var w=Rn([Tn.name,e.name].join(".")),k=w.registerOption,R=w.disabled,P=w.change,T=w.firstOption,D=w.containsCheckedOption,F=w.value;y((function(){return k({id:o,element:r,propsRef:I})}),[o,k,r,t]);var L=n.useCallback((function(){var e;P(S)&&(b(In.Active),null==(e=r.current)||e.focus())}),[b,P,S]),A=n.useCallback((function(){return b(In.Active)}),[b]),M=n.useCallback((function(){return g(In.Active)}),[g]),N=R||E,U=F===S,j={ref:r,id:o,role:"radio","aria-checked":U?"true":"false","aria-labelledby":c,"aria-describedby":p,tabIndex:N?-1:U||!D&&(null==T?void 0:T.id)===o?0:-1,onClick:N?void 0:L,onFocus:N?void 0:A,onBlur:N?void 0:M},G=n.useMemo((function(){return{checked:U,disabled:N,active:h(In.Active)}}),[U,N,h]);return a.createElement(v,{name:"RadioGroup.Description"},a.createElement(s,{name:"RadioGroup.Label"},f({props:i({},O,j),slot:G,defaultTag:"div",name:"RadioGroup.Option"})))},Tn.Label=On,Tn.Description=J;var Dn=n.createContext(null);Dn.displayName="GroupContext";var Fn,Ln=n.Fragment;function An(e){var t=e.checked,r=e.onChange,o=l(e,["checked","onChange"]),a="headlessui-switch-"+x(),c=n.useContext(Dn),s=n.useCallback((function(){return r(!t)}),[r,t]),d=n.useCallback((function(e){if(g(e.currentTarget))return e.preventDefault();e.preventDefault(),s()}),[s]),p=n.useCallback((function(e){e.key!==u.Tab&&e.preventDefault(),e.key===u.Space&&s()}),[s]),v=n.useCallback((function(e){return e.preventDefault()}),[]),m=n.useMemo((function(){return{checked:t}}),[t]),b={id:a,ref:null===c?void 0:c.setSwitch,role:"switch",tabIndex:0,"aria-checked":t,"aria-labelledby":null==c?void 0:c.labelledby,"aria-describedby":null==c?void 0:c.describedby,onClick:d,onKeyUp:p,onKeyPress:v};return"button"===o.as&&Object.assign(b,{type:"button"}),f({props:i({},o,b),slot:m,defaultTag:"button",name:"Switch"})}function Mn(){var e=n.useRef(!0);return n.useEffect((function(){e.current=!1}),[]),e.current}function Nn(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).add.apply(n,r)}function Un(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).remove.apply(n,r)}function jn(e,n,t,r,o,u){var a=Pe(),i=void 0!==u?function(e){var n={called:!1};return function(){if(!n.called)return n.called=!0,e.apply(void 0,arguments)}}(u):function(){};return Un.apply(void 0,[e].concat(o)),Nn.apply(void 0,[e].concat(n,t)),a.nextFrame((function(){Un.apply(void 0,[e].concat(t)),Nn.apply(void 0,[e].concat(r)),a.add(function(e,n){var t=Pe();if(!e)return t.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var n=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,n){return n-e}))[0];return void 0===n?0:n})),u=o[0];return 0!==u?t.setTimeout((function(){n(Fn.Finished)}),u+o[1]):n(Fn.Finished),t.add((function(){return n(Fn.Cancelled)})),t.dispose}(e,(function(t){return Un.apply(void 0,[e].concat(r,n)),Nn.apply(void 0,[e].concat(o)),i(t)})))})),a.add((function(){return Un.apply(void 0,[e].concat(n,t,r,o))})),a.add((function(){return i(Fn.Cancelled)})),a.dispose}function Gn(e){return void 0===e&&(e=""),n.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}An.Group=function(e){var t=n.useState(null),r=t[0],o=t[1],u=xn(),i=u[0],l=u[1],c=z(),s=c[0],d=c[1],p=n.useMemo((function(){return{switch:r,setSwitch:o,labelledby:i,describedby:s}}),[r,o,i,s]);return a.createElement(d,{name:"Switch.Description"},a.createElement(l,{name:"Switch.Label",props:{onClick:function(){r&&(r.click(),r.focus({preventScroll:!0}))}}},a.createElement(Dn.Provider,{value:p},f({props:e,defaultTag:Ln,name:"Switch.Group"}))))},An.Label=On,An.Description=J,function(e){e.Finished="finished",e.Cancelled="cancelled"}(Fn||(Fn={}));var Bn,Hn=n.createContext(null);Hn.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Bn||(Bn={}));var Vn=n.createContext(null);function Kn(e){return"children"in e?Kn(e.children):e.current.filter((function(e){return e.state===Bn.Visible})).length>0}function Qn(e){var t=n.useRef(e),r=n.useRef([]),u=M();n.useEffect((function(){t.current=e}),[e]);var a=n.useCallback((function(e,n){var a;void 0===n&&(n=o.Hidden);var i=r.current.findIndex((function(n){return n.id===e}));-1!==i&&(d(n,((a={})[o.Unmount]=function(){r.current.splice(i,1)},a[o.Hidden]=function(){r.current[i].state=Bn.Hidden},a)),!Kn(r)&&u.current&&(null==t.current||t.current()))}),[t,u,r]),i=n.useCallback((function(e){var n=r.current.find((function(n){return n.id===e}));return n?n.state!==Bn.Visible&&(n.state=Bn.Visible):r.current.push({id:e,state:Bn.Visible}),function(){return a(e,o.Unmount)}}),[r,a]);return n.useMemo((function(){return{children:r,register:i,unregister:a}}),[i,a,r])}function Wn(){}Vn.displayName="NestingContext";var qn=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function _n(e){for(var n,t={},r=s(qn);!(n=r()).done;){var o,u=n.value;t[u]=null!=(o=e[u])?o:Wn}return t}var Yn=r.RenderStrategy;function zn(e){var t,r=e.beforeEnter,u=e.afterEnter,c=e.beforeLeave,s=e.afterLeave,p=e.enter,v=e.enterFrom,m=e.enterTo,b=e.entered,g=e.leave,h=e.leaveFrom,C=e.leaveTo,E=l(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"]),O=n.useRef(null),I=n.useState(Bn.Visible),w=I[0],k=I[1],R=E.unmount?o.Unmount:o.Hidden,P=function(){var e=n.useContext(Hn);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),T=P.show,D=P.appear,F=function(){var e=n.useContext(Vn);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),L=F.register,A=F.unregister,M=Mn(),N=x(),U=n.useRef(!1),j=Qn((function(){U.current||(k(Bn.Hidden),A(N),q.current.afterLeave())}));y((function(){if(N)return L(N)}),[L,N]),y((function(){var e;R===o.Hidden&&N&&(T&&w!==Bn.Visible?k(Bn.Visible):d(w,((e={})[Bn.Hidden]=function(){return A(N)},e[Bn.Visible]=function(){return L(N)},e)))}),[w,N,L,A,T,R]);var G=Gn(p),B=Gn(v),H=Gn(m),V=Gn(b),K=Gn(g),Q=Gn(h),W=Gn(C),q=function(e){var t=n.useRef(_n(e));return n.useEffect((function(){t.current=_n(e)}),[e]),t}({beforeEnter:r,afterEnter:u,beforeLeave:c,afterLeave:s}),_=S();n.useEffect((function(){if(_&&w===Bn.Visible&&null===O.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[O,w,_]);var Y=M&&!D;y((function(){var e=O.current;if(e&&!Y)return U.current=!0,T&&q.current.beforeEnter(),T||q.current.beforeLeave(),T?jn(e,G,B,H,V,(function(e){U.current=!1,e===Fn.Finished&&q.current.afterEnter()})):jn(e,K,Q,W,V,(function(e){U.current=!1,e===Fn.Finished&&(Kn(j)||(k(Bn.Hidden),A(N),q.current.afterLeave()))}))}),[q,N,U,A,j,O,Y,T,G,B,H,K,Q,W]);var z={ref:O},J=E;return a.createElement(Vn.Provider,{value:j},a.createElement(ee,{value:d(w,(t={},t[Bn.Visible]=$.Open,t[Bn.Hidden]=$.Closed,t))},f({props:i({},J,z),defaultTag:"div",features:Yn,visible:w===Bn.Visible,name:"Transition.Child"})))}function Jn(e){var t,r=e.show,o=e.appear,u=void 0!==o&&o,c=e.unmount,s=l(e,["show","appear","unmount"]),p=Z();if(void 0===r&&null!==p&&(r=d(p,((t={})[$.Open]=!0,t[$.Closed]=!1,t))),![!0,!1].includes(r))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var v=n.useState(r?Bn.Visible:Bn.Hidden),m=v[0],b=v[1],g=Qn((function(){b(Bn.Hidden)})),y=Mn(),h=n.useMemo((function(){return{show:r,appear:u||!y}}),[r,u,y]);n.useEffect((function(){r?b(Bn.Visible):Kn(g)||b(Bn.Hidden)}),[r,g]);var S={unmount:c};return a.createElement(Vn.Provider,{value:g},a.createElement(Hn.Provider,{value:h},f({props:i({},S,{as:n.Fragment,children:a.createElement(zn,Object.assign({},S,s))}),defaultTag:n.Fragment,features:Yn,visible:m===Bn.Visible,name:"Transition"})))}Jn.Child=function(e){var t=null!==n.useContext(Hn),r=null!==Z();return a.createElement(!t&&r?Jn:zn,Object.assign({},e))},Jn.Root=Jn,e.Dialog=me,e.Disclosure=Ce,e.FocusTrap=function(e){var t=n.useRef(null),r=e.initialFocus,o=l(e,["initialFocus"]);return N(t,S()?R.All:R.None,{initialFocus:r}),f({props:i({},o,{ref:t}),defaultTag:"div",name:"FocusTrap"})},e.Listbox=je,e.Menu=$e,e.Popover=pn,e.Portal=Q,e.RadioGroup=Tn,e.Switch=An,e.Transition=Jn,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=headlessui.umd.production.min.js.map |
import { MutableRefObject } from 'react'; | ||
export declare function useFocusTrap(containers: MutableRefObject<Set<HTMLElement>>, enabled?: boolean, options?: { | ||
export declare enum Features { | ||
/** No features enabled for the `useFocusTrap` hook. */ | ||
None = 1, | ||
/** Ensure that we move focus initially into the container. */ | ||
InitialFocus = 2, | ||
/** Ensure that pressing `Tab` and `Shift+Tab` is trapped within the container. */ | ||
TabLock = 4, | ||
/** Ensure that programmatically moving focus outside of the container is disallowed. */ | ||
FocusLock = 8, | ||
/** Ensure that we restore the focus when unmounting the component that uses this `useFocusTrap` hook. */ | ||
RestoreFocus = 16, | ||
/** Enable all features. */ | ||
All = 30 | ||
} | ||
export declare function useFocusTrap(container: MutableRefObject<HTMLElement | null>, features?: Features, { initialFocus, containers, }?: { | ||
initialFocus?: MutableRefObject<HTMLElement | null>; | ||
containers?: MutableRefObject<Set<MutableRefObject<HTMLElement | null>>>; | ||
}): void; |
@@ -1,13 +0,14 @@ | ||
import { ReactNode } from 'react'; | ||
declare type OnUpdate = (message: StackMessage, element: HTMLElement) => void; | ||
import { MutableRefObject, ReactNode } from 'react'; | ||
declare type OnUpdate = (message: StackMessage, type: string, element: MutableRefObject<HTMLElement | null>) => void; | ||
export declare enum StackMessage { | ||
AddElement = 0, | ||
RemoveElement = 1 | ||
Add = 0, | ||
Remove = 1 | ||
} | ||
export declare function useStackContext(): OnUpdate; | ||
export declare function useElementStack(element: HTMLElement | null): void; | ||
export declare function StackProvider({ children, onUpdate, }: { | ||
export declare function StackProvider({ children, onUpdate, type, element, }: { | ||
children: ReactNode; | ||
onUpdate?: OnUpdate; | ||
type: string; | ||
element: MutableRefObject<HTMLElement | null>; | ||
}): JSX.Element; | ||
export {}; |
@@ -132,2 +132,3 @@ export declare function getMenuButton(): HTMLElement | null; | ||
export declare function getDialogOverlay(): HTMLElement | null; | ||
export declare function getDialogOverlays(): HTMLElement[]; | ||
export declare enum DialogState { | ||
@@ -134,0 +135,0 @@ /** The dialog is visible to the user. */ |
@@ -16,5 +16,9 @@ export declare enum Focus { | ||
export declare enum FocusResult { | ||
/** Something went wrong while trying to focus. */ | ||
Error = 0, | ||
/** When `Focus.WrapAround` is enabled, going from position `N` to `N+1` where `N` is the last index in the array, then we overflow. */ | ||
Overflow = 1, | ||
/** Focus was successful. */ | ||
Success = 2, | ||
/** When `Focus.WrapAround` is enabled, going from position `N` to `N-1` where `N` is the first index in the array, then we underflow. */ | ||
Underflow = 3 | ||
@@ -21,0 +25,0 @@ } |
{ | ||
"name": "@headlessui/react", | ||
"version": "1.1.1", | ||
"version": "1.2.0-2279cd9", | ||
"description": "A set of completely unstyled, fully accessible UI components for React, designed to integrate beautifully with Tailwind CSS.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2074665
59
14550
4
224