Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@headlessui/react

Package Overview
Dependencies
Maintainers
2
Versions
727
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@headlessui/react - npm Package Compare versions

Comparing version 0.2.0-3597d07 to 0.2.0-3dd74c1

dist/components/dialog/dialog.d.ts

11

dist/components/disclosure/disclosure.d.ts

@@ -1,3 +0,4 @@

import * as React from 'react';
import { ElementType, Ref } from 'react';
import { Props } from '../../types';
import React from 'react';
declare let DEFAULT_DISCLOSURE_TAG: React.ExoticComponent<{

@@ -9,6 +10,6 @@ children?: React.ReactNode;

}
export declare function Disclosure<TTag extends React.ElementType = typeof DEFAULT_DISCLOSURE_TAG>(props: Props<TTag, DisclosureRenderPropArg>): JSX.Element;
export declare function Disclosure<TTag extends ElementType = typeof DEFAULT_DISCLOSURE_TAG>(props: Props<TTag, DisclosureRenderPropArg>): JSX.Element;
export declare namespace Disclosure {
var Button: <TTag extends React.ElementType<any> = string>(props: Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl>, ref: React.Ref<HTMLButtonElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
var Panel: <TTag extends React.ElementType<any> = string>(props: ({
var Button: <TTag extends ElementType<any> = "button">(props: Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl>, ref: Ref<HTMLButtonElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
var Panel: <TTag extends ElementType<any> = "div">(props: ({
as?: TTag | undefined;

@@ -29,3 +30,3 @@ children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: PanelRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined;

static?: boolean | undefined;
}), ref: React.Ref<HTMLDivElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
}), ref: Ref<HTMLDivElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
}

@@ -32,0 +33,0 @@ interface ButtonRenderPropArg {

@@ -1,10 +0,10 @@

import * as React from 'react';
import React, { ElementType } from 'react';
import { Props } from '../../types';
declare const DEFAULT_LISTBOX_TAG: React.ExoticComponent<{
declare let DEFAULT_LISTBOX_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
declare type ListboxRenderPropArg = {
interface ListboxRenderPropArg {
open: boolean;
};
export declare function Listbox<TTag extends React.ElementType = typeof DEFAULT_LISTBOX_TAG, TType = string>(props: Props<TTag, ListboxRenderPropArg, 'value' | 'onChange'> & {
}
export declare function Listbox<TTag extends ElementType = typeof DEFAULT_LISTBOX_TAG, TType = string>(props: Props<TTag, ListboxRenderPropArg, 'value' | 'onChange'> & {
value: TType;

@@ -173,2 +173,26 @@ onChange(value: TType): void;

refName?: string | undefined;
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onMouseLeave">> & {
disabled?: boolean | undefined;
value: TType;
className?: string | ((bag: OptionRenderPropArg) => string) | undefined;
}) | ({
as?: TTag | undefined;
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined;
refName?: string | undefined;
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onPointerMove">> & {
disabled?: boolean | undefined;
value: TType;
className?: string | ((bag: OptionRenderPropArg) => string) | undefined;
}) | ({
as?: TTag | undefined;
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined;
refName?: string | undefined;
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onMouseMove">> & {
disabled?: boolean | undefined;
value: TType;
className?: string | ((bag: OptionRenderPropArg) => string) | undefined;
}) | ({
as?: TTag | undefined;
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined;
refName?: string | undefined;
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onFocus">> & {

@@ -188,18 +212,18 @@ disabled?: boolean | undefined;

}
declare type ButtonRenderPropArg = {
interface ButtonRenderPropArg {
open: boolean;
};
declare type ButtonPropsWeControl = 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'aria-labelledby' | 'onKeyDown' | 'onPointerUp';
declare type LabelPropsWeControl = 'id' | 'ref' | 'onPointerUp';
declare type LabelRenderPropArg = {
}
declare type ButtonPropsWeControl = 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'aria-labelledby' | 'onKeyDown' | 'onClick';
interface LabelRenderPropArg {
open: boolean;
};
declare type OptionsRenderPropArg = {
}
declare type LabelPropsWeControl = 'id' | 'ref' | 'onClick';
interface OptionsRenderPropArg {
open: boolean;
};
declare type OptionRenderPropArg = {
}
interface OptionRenderPropArg {
active: boolean;
selected: boolean;
disabled: boolean;
};
}
export {};

@@ -1,10 +0,10 @@

import * as React from 'react';
import React, { ElementType } from 'react';
import { Props } from '../../types';
declare const DEFAULT_MENU_TAG: React.ExoticComponent<{
declare let DEFAULT_MENU_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
declare type MenuRenderPropArg = {
interface MenuRenderPropArg {
open: boolean;
};
export declare function Menu<TTag extends React.ElementType = typeof DEFAULT_MENU_TAG>(props: Props<TTag, MenuRenderPropArg>): JSX.Element;
}
export declare function Menu<TTag extends ElementType = typeof DEFAULT_MENU_TAG>(props: Props<TTag, MenuRenderPropArg>): JSX.Element;
export declare namespace Menu {

@@ -165,2 +165,32 @@ var Button: <TTag extends React.ElementType<any> = "button">(props: Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl>, ref: React.Ref<HTMLButtonElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;

refName?: string | undefined;
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onPointerMove">> & {
disabled?: boolean | undefined;
onClick?: ((event: {
preventDefault: Function;
}) => void) | undefined;
className?: string | ((bag: ItemRenderPropArg) => string) | undefined;
}) | ({
as?: TTag | undefined;
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined;
refName?: string | undefined;
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onMouseLeave">> & {
disabled?: boolean | undefined;
onClick?: ((event: {
preventDefault: Function;
}) => void) | undefined;
className?: string | ((bag: ItemRenderPropArg) => string) | undefined;
}) | ({
as?: TTag | undefined;
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined;
refName?: string | undefined;
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onMouseMove">> & {
disabled?: boolean | undefined;
onClick?: ((event: {
preventDefault: Function;
}) => void) | undefined;
className?: string | ((bag: ItemRenderPropArg) => string) | undefined;
}) | ({
as?: TTag | undefined;
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined;
refName?: string | undefined;
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onFocus">> & {

@@ -184,13 +214,13 @@ disabled?: boolean | undefined;

}
declare type ButtonRenderPropArg = {
interface ButtonRenderPropArg {
open: boolean;
};
declare type ButtonPropsWeControl = 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'onKeyDown' | 'onPointerUp';
declare type ItemsRenderPropArg = {
}
declare type ButtonPropsWeControl = 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'onKeyDown' | 'onClick';
interface ItemsRenderPropArg {
open: boolean;
};
declare type ItemRenderPropArg = {
}
interface ItemRenderPropArg {
active: boolean;
disabled: boolean;
};
}
export {};

@@ -1,9 +0,9 @@

import * as React from 'react';
import React, { ElementType } from 'react';
import { Props } from '../../types';
declare const DEFAULT_SWITCH_TAG = "button";
declare type SwitchRenderPropArg = {
declare let DEFAULT_SWITCH_TAG: "button";
interface SwitchRenderPropArg {
checked: boolean;
};
declare type SwitchPropsWeControl = 'id' | 'role' | 'tabIndex' | 'aria-checked' | 'onClick' | 'onKeyUp' | 'onKeyPress';
export declare function Switch<TTag extends React.ElementType = typeof DEFAULT_SWITCH_TAG>(props: Props<TTag, SwitchRenderPropArg, SwitchPropsWeControl | 'checked' | 'onChange' | 'className'> & {
}
declare type SwitchPropsWeControl = 'id' | 'role' | 'tabIndex' | 'aria-checked' | 'aria-labelledby' | 'aria-describedby' | 'onClick' | 'onKeyUp' | 'onKeyPress';
export declare function Switch<TTag extends ElementType = typeof DEFAULT_SWITCH_TAG>(props: Props<TTag, SwitchRenderPropArg, SwitchPropsWeControl | 'checked' | 'onChange' | 'className'> & {
checked: boolean;

@@ -18,5 +18,10 @@ onChange(checked: boolean): void;

var Label: <TTag extends React.ElementType<any> = "label">(props: Props<TTag, LabelRenderPropArg, LabelPropsWeControl>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
var Description: <TTag extends React.ElementType<any> = "label">(props: Props<TTag, DescriptionRenderPropArg, DescriptionPropsWeControl>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
}
declare type LabelRenderPropArg = {};
declare type LabelPropsWeControl = 'id' | 'ref' | 'onPointerUp';
interface LabelRenderPropArg {
}
declare type LabelPropsWeControl = 'id' | 'ref' | 'onClick';
interface DescriptionRenderPropArg {
}
declare type DescriptionPropsWeControl = 'id' | 'ref';
export {};

@@ -1,26 +0,26 @@

import * as React from 'react';
import { ElementType, MutableRefObject } from 'react';
import { Props } from 'types';
import { Features, PropsForFeatures } from '../../utils/render';
export declare type TransitionClasses = Partial<{
enter: string;
enterFrom: string;
enterTo: string;
leave: string;
leaveFrom: string;
leaveTo: string;
}>;
export declare type TransitionEvents = Partial<{
beforeEnter(): void;
afterEnter(): void;
beforeLeave(): void;
afterLeave(): void;
}>;
declare type TransitionChildProps<TTag> = Props<TTag, TransitionChildRenderPropArg> & PropsForFeatures<typeof TransitionChildRenderFeatures> & Partial<{
appear: boolean;
} & TransitionClasses & TransitionEvents>;
declare const DEFAULT_TRANSITION_CHILD_TAG = "div";
declare type TransitionChildRenderPropArg = React.MutableRefObject<HTMLDivElement>;
declare const TransitionChildRenderFeatures = Features.RenderStrategy;
declare function TransitionChild<TTag extends React.ElementType = typeof DEFAULT_TRANSITION_CHILD_TAG>(props: TransitionChildProps<TTag>): JSX.Element;
export declare function Transition<TTag extends React.ElementType = typeof DEFAULT_TRANSITION_CHILD_TAG>(props: TransitionChildProps<TTag> & {
export interface TransitionClasses {
enter?: string;
enterFrom?: string;
enterTo?: string;
leave?: string;
leaveFrom?: string;
leaveTo?: string;
}
export interface TransitionEvents {
beforeEnter?: () => void;
afterEnter?: () => void;
beforeLeave?: () => void;
afterLeave?: () => void;
}
declare type TransitionChildProps<TTag> = Props<TTag, TransitionChildRenderPropArg> & PropsForFeatures<typeof TransitionChildRenderFeatures> & TransitionClasses & TransitionEvents & {
appear?: boolean;
};
declare let DEFAULT_TRANSITION_CHILD_TAG: "div";
declare type TransitionChildRenderPropArg = MutableRefObject<HTMLDivElement>;
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;

@@ -27,0 +27,0 @@ appear?: boolean;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n,t=require("react");function r(){return(r=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 o(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 u(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 i(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 u(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)?u(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 a(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 i=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(i,a),i}function c(t,u,i,c,s){if(void 0===s&&(s=!0),s)return l(t,u,i);var f=null!=c?c:e.None;if(f&e.Static){var d=t.static,p=void 0!==d&&d,v=o(t,["static"]);if(p)return l(v,u,i)}if(f&e.RenderStrategy){var m,b=t.unmount,y=void 0===b||b,h=o(t,["unmount"]);return a(y?n.Unmount:n.Hidden,((m={})[n.Unmount]=function(){return null},m[n.Hidden]=function(){return l(r({},h,{hidden:!0,style:{display:"none"}}),u,i)},m))}return l(t,u,i)}function l(e,n,r){var u,a=f(e,["unmount","static"]),c=a.as,s=void 0===c?r:c,d=a.children,p=a.refName,v=void 0===p?"ref":p,m=o(a,["as","children","refName"]),b=void 0!==e.ref?((u={})[v]=e.ref,u):{},y="function"==typeof d?d(n):d;if(s===t.Fragment&&Object.keys(m).length>0){if(Array.isArray(y)&&y.length>1){var h=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(h,l),h}if(!t.isValidElement(y)){var x=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(x,l),x}return t.cloneElement(y,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=i(["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}(f(m,["ref"])),y.props),b))}return t.createElement(s,Object.assign({},f(m,["ref"]),s!==t.Fragment&&b),y)}function s(e){return t.forwardRef(e)}function f(e,n){void 0===n&&(n=[]);for(var t,r=Object.assign({},e),o=i(n);!(t=o()).done;){var u=t.value;u in r&&delete r[u]}return r}function d(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.useCallback((function(e){n.forEach((function(n){if(null!==n)return"function"==typeof n?n(e):void(n.current=e)}))}),[n])}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(e||(e={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(n||(n={}));var p,v,m,b,y="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,h={serverHandoffComplete:!1},x=0;function S(){return++x}function g(){var e=t.useState(h.serverHandoffComplete?S:null),n=e[0],r=e[1];return y((function(){null===n&&r(S())}),[n]),t.useEffect((function(){!1===h.serverHandoffComplete&&(h.serverHandoffComplete=!0)}),[]),null!=n?""+n:void 0}function I(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.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(p||(p={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(m||(m={})),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"}(b||(b={}));var C=((v={})[b.ToggleDisclosure]=function(e){var n;return r({},e,{disclosureState:a(e.disclosureState,(n={},n[m.Open]=m.Closed,n[m.Closed]=m.Open,n))})},v[b.LinkPanel]=function(e){return r({},e,{linkedPanel:!0})},v[b.UnlinkPanel]=function(e){return r({},e,{linkedPanel:!1})},v[b.SetButtonId]=function(e,n){return r({},e,{buttonId:n.buttonId})},v[b.SetPanelId]=function(e,n){return r({},e,{panelId:n.panelId})},v),O=t.createContext(null);function E(e){var n=t.useContext(O);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+k.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,E),r}return n}function w(e,n){return a(n.type,C,e,n)}O.displayName="DisclosureContext";var R=t.Fragment;function k(e){var n="headlessui-disclosure-button-"+g(),r="headlessui-disclosure-panel-"+g(),o=t.useReducer(w,{disclosureState:m.Closed,linkedPanel:!1,buttonId:n,panelId:r}),u=o[0].disclosureState,i=o[1];t.useEffect((function(){return i({type:b.SetButtonId,buttonId:n})}),[n]),t.useEffect((function(){return i({type:b.SetPanelId,panelId:r})}),[r]);var a=t.useMemo((function(){return{open:u===m.Open}}),[u]);return t.createElement(O.Provider,{value:o},c(e,a,R))}var T,D,L,P,F=s((function e(n,o){var u=E([k.name,e.name].join(".")),i=u[0],a=u[1],l=d(o),s=t.useCallback((function(e){switch(e.key){case p.Space:case p.Enter:e.preventDefault(),a({type:b.ToggleDisclosure})}}),[a]),f=t.useCallback((function(e){I(e.currentTarget)||n.disabled||a({type:b.ToggleDisclosure})}),[a,n.disabled]),v=t.useMemo((function(){return{open:i.disclosureState===m.Open}}),[i]);return c(r({},n,{ref:l,id:i.buttonId,type:"button","aria-expanded":i.disclosureState===m.Open||void 0,"aria-controls":i.linkedPanel?i.panelId:void 0,onKeyDown:s,onClick:f}),v,"button")})),M=e.RenderStrategy|e.Static,A=s((function e(n,o){var u=E([k.name,e.name].join(".")),i=u[0],a=u[1],l=d(o,(function(){i.linkedPanel||a({type:b.LinkPanel})}));t.useEffect((function(){return function(){return a({type:b.UnlinkPanel})}}),[]),t.useEffect((function(){var e;i.disclosureState!==m.Closed||null!=(e=n.unmount)&&!e||a({type:b.UnlinkPanel})}),[i.disclosureState,n.unmount]);var s=t.useMemo((function(){return{open:i.disclosureState===m.Open}}),[i]);return c(r({},n,{ref:l,id:i.panelId}),s,"div",M,i.disclosureState===m.Open)}));function U(){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(){e.splice(0).forEach((function(e){return e()}))}};return n}function N(){var e=t.useState(U)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function j(e,n){var r=t.useState(e),o=r[0],u=r[1],i=t.useRef(e);return y((function(){i.current=e}),[e]),y((function(){return u(i.current)}),[i,u].concat(n)),o}function G(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 T.First:return t.findIndex((function(e){return!n.resolveDisabled(e)}));case T.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 T.Next:return t.findIndex((function(e,t){return!(t<=o||n.resolveDisabled(e))}));case T.Last:var u=t.slice().reverse().findIndex((function(e){return!n.resolveDisabled(e)}));return-1===u?u:t.length-1-u;case T.Specific:return t.findIndex((function(t){return n.resolveId(t)===e.id}));case T.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?r:u}function H(e,n){if(void 0!==e)return"function"==typeof e?e(n):e}k.Button=F,k.Panel=A,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"}(T||(T={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(L||(L={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption"}(P||(P={}));var V=((D={})[P.CloseListbox]=function(e){return r({},e,{activeOptionIndex:null,listboxState:L.Closed})},D[P.OpenListbox]=function(e){return r({},e,{listboxState:L.Open})},D[P.GoToOption]=function(e,n){var t=G(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:r({},e,{searchQuery:"",activeOptionIndex:t})},D[P.Search]=function(e,n){var t=e.searchQuery+n.value,o=e.options.findIndex((function(e){var n;return!e.dataRef.current.disabled&&(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(t))}));return r({},e,-1===o||o===e.activeOptionIndex?{searchQuery:t}:{searchQuery:t,activeOptionIndex:o})},D[P.ClearSearch]=function(e){return r({},e,{searchQuery:""})},D[P.RegisterOption]=function(e,n){return r({},e,{options:[].concat(e.options,[{id:n.id,dataRef:n.dataRef}])})},D[P.UnregisterOption]=function(e,n){var t=e.options.slice(),o=null!==e.activeOptionIndex?t[e.activeOptionIndex]:null,u=t.findIndex((function(e){return e.id===n.id}));return-1!==u&&t.splice(u,1),r({},e,{options:t,activeOptionIndex:u===e.activeOptionIndex||null===o?null:t.indexOf(o)})},D),Q=t.createContext(null);function B(e){var n=t.useContext(Q);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+W.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,B),r}return n}function K(e,n){return a(n.type,V,e,n)}Q.displayName="ListboxContext";var q=t.Fragment;function W(e){var n=e.value,r=e.onChange,u=o(e,["value","onChange"]),i=N(),a=t.useReducer(K,{listboxState:L.Closed,propsRef:{current:{value:n,onChange:r}},labelRef:t.createRef(),buttonRef:t.createRef(),optionsRef:t.createRef(),options:[],searchQuery:"",activeOptionIndex:null}),l=a[0],s=l.listboxState,f=l.propsRef,d=l.optionsRef,p=l.buttonRef,v=a[1];y((function(){f.current.value=n}),[n,f]),y((function(){f.current.onChange=r}),[r,f]),t.useEffect((function(){function e(e){var n,t,r,o=e.target,u=document.activeElement;s===L.Open&&((null==(n=p.current)?void 0:n.contains(o))||((null==(t=d.current)?void 0:t.contains(o))||v({type:P.CloseListbox}),u!==document.body&&(null==u?void 0:u.contains(o))||e.defaultPrevented||null==(r=p.current)||r.focus({preventScroll:!0})))}return window.addEventListener("click",e),function(){return window.removeEventListener("click",e)}}),[s,d,p,i,v]);var m=t.useMemo((function(){return{open:s===L.Open}}),[s]);return t.createElement(Q.Provider,{value:a},c(u,m,q))}var Y,_,$,z=s((function e(n,o){var u,i=B([W.name,e.name].join(".")),a=i[0],l=i[1],s=d(a.buttonRef,o),f="headlessui-listbox-button-"+g(),v=N(),m=t.useCallback((function(e){switch(e.key){case p.Space:case p.Enter:case p.ArrowDown:e.preventDefault(),l({type:P.OpenListbox}),v.nextFrame((function(){var e;null==(e=a.optionsRef.current)||e.focus({preventScroll:!0}),a.propsRef.current.value||l({type:P.GoToOption,focus:T.First})}));break;case p.ArrowUp:e.preventDefault(),l({type:P.OpenListbox}),v.nextFrame((function(){var e;null==(e=a.optionsRef.current)||e.focus({preventScroll:!0}),a.propsRef.current.value||l({type:P.GoToOption,focus:T.Last})}))}}),[l,a,v]),b=t.useCallback((function(e){n.disabled||(a.listboxState===L.Open?(l({type:P.CloseListbox}),v.nextFrame((function(){var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:P.OpenListbox}),v.nextFrame((function(){var e;return null==(e=a.optionsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,v,a,n.disabled]),y=j((function(){if(a.labelRef.current)return[a.labelRef.current.id,f].join(" ")}),[a.labelRef.current,f]),h=t.useMemo((function(){return{open:a.listboxState===L.Open}}),[a]);return c(r({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(u=a.optionsRef.current)?void 0:u.id,"aria-expanded":a.listboxState===L.Open||void 0,"aria-labelledby":y,onKeyDown:m,onPointerUp:b}),h,"button")})),J=e.RenderStrategy|e.Static,X=s((function e(n,o){var u,i=B([W.name,e.name].join(".")),a=i[0],l=i[1],s=d(a.optionsRef,o),f="headlessui-listbox-options-"+g(),v=N(),m=N(),b=t.useCallback((function(e){switch(m.dispose(),e.key){case p.Space:if(""!==a.searchQuery)return e.preventDefault(),l({type:P.Search,value:e.key});case p.Enter:e.preventDefault(),l({type:P.CloseListbox}),null!==a.activeOptionIndex&&a.propsRef.current.onChange(a.options[a.activeOptionIndex].dataRef.current.value),U().nextFrame((function(){var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case p.ArrowDown:return e.preventDefault(),l({type:P.GoToOption,focus:T.Next});case p.ArrowUp:return e.preventDefault(),l({type:P.GoToOption,focus:T.Previous});case p.Home:case p.PageUp:return e.preventDefault(),l({type:P.GoToOption,focus:T.First});case p.End:case p.PageDown:return e.preventDefault(),l({type:P.GoToOption,focus:T.Last});case p.Escape:return e.preventDefault(),l({type:P.CloseListbox}),v.nextFrame((function(){var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case p.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:P.Search,value:e.key}),m.setTimeout((function(){return l({type:P.ClearSearch})}),350))}}),[v,l,m,a]),y=j((function(){var e,n,t;return null!=(e=null==(n=a.labelRef.current)?void 0:n.id)?e:null==(t=a.buttonRef.current)?void 0:t.id}),[a.labelRef.current,a.buttonRef.current]),h=t.useMemo((function(){return{open:a.listboxState===L.Open}}),[a]);return c(r({},n,{"aria-activedescendant":null===a.activeOptionIndex||null==(u=a.options[a.activeOptionIndex])?void 0:u.id,"aria-labelledby":y,id:f,onKeyDown:b,role:"listbox",tabIndex:0,ref:s}),h,"ul",J,a.listboxState===L.Open)}));W.Button=z,W.Label=function e(n){var o=B([W.name,e.name].join("."))[0],u="headlessui-listbox-label-"+g(),i=t.useCallback((function(){var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[o.buttonRef]),a=t.useMemo((function(){return{open:o.listboxState===L.Open}}),[o]);return c(r({},n,{ref:o.labelRef,id:u,onPointerUp:i}),a,"label")},W.Options=X,W.Option=function e(n){var u=n.disabled,i=void 0!==u&&u,a=n.value,l=n.className,s=o(n,["disabled","value","className"]),f=B([W.name,e.name].join(".")),d=f[0],p=f[1],v="headlessui-listbox-option-"+g(),m=null!==d.activeOptionIndex&&d.options[d.activeOptionIndex].id===v,b=d.propsRef.current.value===a,h=t.useRef({disabled:i,value:a});y((function(){h.current.disabled=i}),[h,i]),y((function(){h.current.value=a}),[h,a]),y((function(){var e,n;h.current.textValue=null==(e=document.getElementById(v))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[h,v]);var x=t.useCallback((function(){return d.propsRef.current.onChange(a)}),[d.propsRef,a]);y((function(){return p({type:P.RegisterOption,id:v,dataRef:h}),function(){return p({type:P.UnregisterOption,id:v})}}),[h,v]),y((function(){var e;d.listboxState===L.Open&&b&&(p({type:P.GoToOption,focus:T.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[d.listboxState]),y((function(){if(d.listboxState===L.Open&&m){var e=U();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[m,d.listboxState]);var S=t.useCallback((function(e){if(i)return e.preventDefault();x(),p({type:P.CloseListbox}),U().nextFrame((function(){var e;return null==(e=d.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,d.buttonRef,i,x]),I=t.useCallback((function(){if(i)return p({type:P.GoToOption,focus:T.Nothing});p({type:P.GoToOption,focus:T.Specific,id:v})}),[i,v,p]),C=t.useCallback((function(){i||m||p({type:P.GoToOption,focus:T.Specific,id:v})}),[i,m,v,p]),O=t.useCallback((function(){i||m&&p({type:P.GoToOption,focus:T.Nothing})}),[i,m,p]),E=t.useMemo((function(){return{active:m,selected:b,disabled:i}}),[m,b,i]);return c(r({},s,{id:v,role:"option",tabIndex:-1,className:H(l,E),"aria-disabled":!0===i||void 0,"aria-selected":!0===b||void 0,onClick:S,onFocus:I,onPointerMove:C,onPointerLeave:O}),E,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(_||(_={})),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"}($||($={}));var Z=((Y={})[$.CloseMenu]=function(e){return r({},e,{activeItemIndex:null,menuState:_.Closed})},Y[$.OpenMenu]=function(e){return r({},e,{menuState:_.Open})},Y[$.GoToItem]=function(e,n){var t=G(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:r({},e,{searchQuery:"",activeItemIndex:t})},Y[$.Search]=function(e,n){var t=e.searchQuery+n.value,o=e.items.findIndex((function(e){var n;return(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(t))&&!e.dataRef.current.disabled}));return r({},e,-1===o||o===e.activeItemIndex?{searchQuery:t}:{searchQuery:t,activeItemIndex:o})},Y[$.ClearSearch]=function(e){return r({},e,{searchQuery:""})},Y[$.RegisterItem]=function(e,n){return r({},e,{items:[].concat(e.items,[{id:n.id,dataRef:n.dataRef}])})},Y[$.UnregisterItem]=function(e,n){var t=e.items.slice(),o=null!==e.activeItemIndex?t[e.activeItemIndex]:null,u=t.findIndex((function(e){return e.id===n.id}));return-1!==u&&t.splice(u,1),r({},e,{items:t,activeItemIndex:u===e.activeItemIndex||null===o?null:t.indexOf(o)})},Y),ee=t.createContext(null);function ne(e){var n=t.useContext(ee);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+oe.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,ne),r}return n}function te(e,n){return a(n.type,Z,e,n)}ee.displayName="MenuContext";var re=t.Fragment;function oe(e){var n=t.useReducer(te,{menuState:_.Closed,buttonRef:t.createRef(),itemsRef:t.createRef(),items:[],searchQuery:"",activeItemIndex:null}),r=n[0],o=r.menuState,u=r.itemsRef,i=r.buttonRef,a=n[1];t.useEffect((function(){function e(e){var n,t,r,c=e.target,l=document.activeElement;o===_.Open&&((null==(n=i.current)?void 0:n.contains(c))||((null==(t=u.current)?void 0:t.contains(c))||a({type:$.CloseMenu}),l!==document.body&&(null==l?void 0:l.contains(c))||e.defaultPrevented||null==(r=i.current)||r.focus({preventScroll:!0})))}return window.addEventListener("click",e),function(){return window.removeEventListener("click",e)}}),[o,u,i,a]);var l=t.useMemo((function(){return{open:o===_.Open}}),[o]);return t.createElement(ee.Provider,{value:n},c(e,l,re))}var ue=s((function e(n,o){var u,i=ne([oe.name,e.name].join(".")),a=i[0],l=i[1],s=d(a.buttonRef,o),f="headlessui-menu-button-"+g(),v=N(),m=t.useCallback((function(e){switch(e.key){case p.Space:case p.Enter:case p.ArrowDown:e.preventDefault(),l({type:$.OpenMenu}),v.nextFrame((function(){var e;null==(e=a.itemsRef.current)||e.focus({preventScroll:!0}),l({type:$.GoToItem,focus:T.First})}));break;case p.ArrowUp:e.preventDefault(),l({type:$.OpenMenu}),v.nextFrame((function(){var e;null==(e=a.itemsRef.current)||e.focus({preventScroll:!0}),l({type:$.GoToItem,focus:T.Last})}))}}),[l,a,v]),b=t.useCallback((function(e){n.disabled||(a.menuState===_.Open?(l({type:$.CloseMenu}),v.nextFrame((function(){var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:$.OpenMenu}),v.nextFrame((function(){var e;return null==(e=a.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,v,a,n.disabled]),y=t.useMemo((function(){return{open:a.menuState===_.Open}}),[a]);return c(r({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(u=a.itemsRef.current)?void 0:u.id,"aria-expanded":a.menuState===_.Open||void 0,onKeyDown:m,onPointerUp:b}),y,"button")})),ie=e.RenderStrategy|e.Static,ae=s((function e(n,o){var u,i,a=ne([oe.name,e.name].join(".")),l=a[0],s=a[1],f=d(l.itemsRef,o),v="headlessui-menu-items-"+g(),m=N(),b=t.useCallback((function(e){switch(m.dispose(),e.key){case p.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:$.Search,value:e.key});case p.Enter:var n;e.preventDefault(),s({type:$.CloseMenu}),null!==l.activeItemIndex&&(null==(n=document.getElementById(l.items[l.activeItemIndex].id))||n.click()),U().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case p.ArrowDown:return e.preventDefault(),s({type:$.GoToItem,focus:T.Next});case p.ArrowUp:return e.preventDefault(),s({type:$.GoToItem,focus:T.Previous});case p.Home:case p.PageUp:return e.preventDefault(),s({type:$.GoToItem,focus:T.First});case p.End:case p.PageDown:return e.preventDefault(),s({type:$.GoToItem,focus:T.Last});case p.Escape:e.preventDefault(),s({type:$.CloseMenu}),U().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case p.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:$.Search,value:e.key}),m.setTimeout((function(){return s({type:$.ClearSearch})}),350))}}),[s,m,l]),y=t.useMemo((function(){return{open:l.menuState===_.Open}}),[l]);return c(r({},n,{"aria-activedescendant":null===l.activeItemIndex||null==(u=l.items[l.activeItemIndex])?void 0:u.id,"aria-labelledby":null==(i=l.buttonRef.current)?void 0:i.id,id:v,onKeyDown:b,role:"menu",tabIndex:0,ref:f}),y,"div",ie,l.menuState===_.Open)})),ce=t.Fragment;oe.Button=ue,oe.Items=ae,oe.Item=function e(n){var u=n.disabled,i=void 0!==u&&u,a=n.className,l=n.onClick,s=o(n,["disabled","className","onClick"]),f=ne([oe.name,e.name].join(".")),d=f[0],p=f[1],v="headlessui-menu-item-"+g(),m=null!==d.activeItemIndex&&d.items[d.activeItemIndex].id===v,b=t.useRef({disabled:i});y((function(){b.current.disabled=i}),[b,i]),y((function(){var e,n;b.current.textValue=null==(e=document.getElementById(v))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[b,v]),y((function(){return p({type:$.RegisterItem,id:v,dataRef:b}),function(){return p({type:$.UnregisterItem,id:v})}}),[b,v]);var h=t.useCallback((function(e){return I(e.currentTarget)||i?e.preventDefault():(p({type:$.CloseMenu}),U().nextFrame((function(){var e;return null==(e=d.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),l?l(e):void 0)}),[p,d.buttonRef,i,l]),x=t.useCallback((function(){if(i)return p({type:$.GoToItem,focus:T.Nothing});p({type:$.GoToItem,focus:T.Specific,id:v})}),[i,v,p]),S=t.useCallback((function(){i||m||p({type:$.GoToItem,focus:T.Specific,id:v})}),[i,m,v,p]),C=t.useCallback((function(){i||m&&p({type:$.GoToItem,focus:T.Nothing})}),[i,m,p]),O=t.useMemo((function(){return{active:m,disabled:i}}),[m,i]);return c(r({},s,{id:v,role:"menuitem",tabIndex:-1,className:H(a,O),"aria-disabled":!0===i||void 0,onClick:h,onFocus:x,onPointerMove:S,onPointerLeave:C}),O,ce)};var le=t.createContext(null);function se(e){var n=t.useContext(le);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,se),r}return n}le.displayName="GroupContext";var fe,de=t.Fragment;function pe(e){var n,u=e.checked,i=e.onChange,a=e.className,l=o(e,["checked","onChange","className"]),s="headlessui-switch-"+g(),f=t.useContext(le),d=t.useCallback((function(){return i(!u)}),[i,u]),v=t.useCallback((function(e){if(I(e.currentTarget))return e.preventDefault();e.preventDefault(),d()}),[d]),m=t.useCallback((function(e){e.key!==p.Tab&&e.preventDefault(),e.key===p.Space&&d()}),[d]),b=t.useCallback((function(e){return e.preventDefault()}),[]),y=t.useMemo((function(){return{checked:u}}),[u]),h={id:s,ref:null===f?void 0:f.setSwitch,role:"switch",tabIndex:0,className:H(a,y),"aria-checked":u,"aria-labelledby":null==f||null==(n=f.label)?void 0:n.id,onClick:v,onKeyUp:m,onKeyPress:b};return"button"===l.as&&Object.assign(h,{type:"button"}),c(r({},l,h),y,"button")}function ve(){var e=t.useRef(!0);return t.useEffect((function(){e.current=!1}),[]),e.current}function me(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 be(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 ye(e,n,t,r,o){var u=U(),i=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 me.apply(void 0,[e].concat(n,t)),u.nextFrame((function(){be.apply(void 0,[e].concat(t)),me.apply(void 0,[e].concat(r)),u.add(function(e,n){var t=U();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(fe.Finished)}),u+o[1]):n(fe.Finished),t.add((function(){return n(fe.Cancelled)})),t.dispose}(e,(function(t){return be.apply(void 0,[e].concat(r,n)),i(t)})))})),u.add((function(){return be.apply(void 0,[e].concat(n,t,r))})),u.add((function(){return i(fe.Cancelled)})),u.dispose}function he(e){return void 0===e&&(e=""),t.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}pe.Group=function(e){var n=t.useState(null),r=n[0],o=n[1],u=t.useState(null),i=u[0],a=u[1],l=t.useMemo((function(){return{switch:r,label:i,setSwitch:o,setLabel:a}}),[r,o,i,a]);return t.createElement(le.Provider,{value:l},c(e,{},de))},pe.Label=function e(n){var o=se([pe.name,e.name].join(".")),u="headlessui-switch-label-"+g(),i=t.useCallback((function(){o.switch&&(o.switch.click(),o.switch.focus({preventScroll:!0}))}),[o.switch]);return c(r({},n,{ref:o.setLabel,id:u,onPointerUp:i}),{},"label")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(fe||(fe={}));var xe,Se=t.createContext(null);Se.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(xe||(xe={}));var ge=t.createContext(null);function Ie(e){return"children"in e?Ie(e.children):e.current.filter((function(e){return e.state===xe.Visible})).length>0}function Ce(e){var r=t.useRef(e),o=t.useRef([]),u=function(){var e=t.useRef(!0);return t.useEffect((function(){return function(){e.current=!1}}),[]),e}();t.useEffect((function(){r.current=e}),[e]);var i=t.useCallback((function(e,t){var i;void 0===t&&(t=n.Hidden);var c=o.current.findIndex((function(n){return n.id===e}));-1!==c&&(a(t,((i={})[n.Unmount]=function(){o.current.splice(c,1)},i[n.Hidden]=function(){o.current[c].state=xe.Hidden},i)),!Ie(o)&&u.current&&(null==r.current||r.current()))}),[r,u,o]),c=t.useCallback((function(e){var t=o.current.find((function(n){return n.id===e}));return t?t.state!==xe.Visible&&(t.state=xe.Visible):o.current.push({id:e,state:xe.Visible}),function(){return i(e,n.Unmount)}}),[o,i]);return t.useMemo((function(){return{children:o,register:c,unregister:i}}),[c,i,o])}function Oe(){}ge.displayName="NestingContext";var Ee=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function we(e){return Ee.reduce((function(n,t){return n[t]=e[t]||Oe,n}),{})}var Re=e.RenderStrategy;function ke(e){var u=e.beforeEnter,i=e.afterEnter,l=e.beforeLeave,s=e.afterLeave,f=e.enter,d=e.enterFrom,p=e.enterTo,v=e.leave,m=e.leaveFrom,b=e.leaveTo,h=o(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),x=t.useRef(null),S=t.useState(xe.Visible),I=S[0],C=S[1],O=h.unmount?n.Unmount:n.Hidden,E=function(){var e=t.useContext(Se);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),w=E.show,R=E.appear,k=function(){var e=t.useContext(ge);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),T=k.register,D=k.unregister,L=ve(),P=g(),F=t.useRef(!1),M=Ce((function(){F.current||(C(xe.Hidden),D(P),V.current.afterLeave())}));y((function(){if(P)return T(P)}),[T,P]),y((function(){var e;O===n.Hidden&&P&&(w&&I!==xe.Visible?C(xe.Visible):a(I,((e={})[xe.Hidden]=function(){return D(P)},e[xe.Visible]=function(){return T(P)},e)))}),[I,P,T,D,w,O]);var A=he(f),U=he(d),N=he(p),j=he(v),G=he(m),H=he(b),V=function(e){var n=t.useRef(we(e));return t.useEffect((function(){n.current=we(e)}),[e]),n}({beforeEnter:u,afterEnter:i,beforeLeave:l,afterLeave:s});t.useEffect((function(){if(I===xe.Visible&&null===x.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[x,I]);var Q=L&&!R;return y((function(){var e=x.current;if(e&&!Q)return F.current=!0,w&&V.current.beforeEnter(),w||V.current.beforeLeave(),w?ye(e,A,U,N,(function(e){F.current=!1,e===fe.Finished&&V.current.afterEnter()})):ye(e,j,G,H,(function(e){F.current=!1,e===fe.Finished&&(Ie(M)||(C(xe.Hidden),D(P),V.current.afterLeave()))}))}),[V,P,F,D,M,x,Q,w,A,U,N,j,G,H]),t.createElement(ge.Provider,{value:M},c(r({},h,{ref:x}),{},"div",Re,I===xe.Visible))}function Te(e){var n=e.show,u=e.appear,i=void 0!==u&&u,a=e.unmount,l=o(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=t.useState(n?xe.Visible:xe.Hidden),f=s[0],d=s[1],p=Ce((function(){d(xe.Hidden)})),v=ve(),m=t.useMemo((function(){return{show:n,appear:i||!v}}),[n,i,v]);t.useEffect((function(){n?d(xe.Visible):Ie(p)||d(xe.Hidden)}),[n,p]);var b={unmount:a};return t.createElement(ge.Provider,{value:p},t.createElement(Se.Provider,{value:m},c(r({},b,{as:t.Fragment,children:t.createElement(ke,Object.assign({},b,l))}),{},t.Fragment,Re,f===xe.Visible)))}Te.Child=ke,exports.Disclosure=k,exports.Listbox=W,exports.Menu=oe,exports.Switch=pe,exports.Transition=Te;
"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;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 a(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 l(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 s(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 i=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(i,s),i}function f(e,r,o,u,c){if(void 0===c&&(c=!0),c)return d(e,r,o);var l=null!=u?u:n.None;if(l&n.Static){var f=e.static,p=void 0!==f&&f,v=a(e,["static"]);if(p)return d(v,r,o)}if(l&n.RenderStrategy){var m,b=e.unmount,y=void 0===b||b,g=a(e,["unmount"]);return s(y?t.Unmount:t.Hidden,((m={})[t.Unmount]=function(){return null},m[t.Hidden]=function(){return d(i({},g,{hidden:!0,style:{display:"none"}}),r,o)},m))}return d(e,r,o)}function d(e,n,t){var r,u=v(e,["unmount","static"]),i=u.as,c=void 0===i?t:i,s=u.children,f=u.refName,p=void 0===f?"ref":f,m=a(u,["as","children","refName"]),b=void 0!==e.ref?((r={})[p]=e.ref,r):{},y="function"==typeof s?s(n):s;if(c===o.Fragment&&Object.keys(m).length>0){if(Array.isArray(y)&&y.length>1){var g=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(g,d),g}if(!o.isValidElement(y)){var h=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(h,d),h}return o.cloneElement(y,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))},i=l(["onClick"]);!(r=i()).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}(v(m,["ref"])),y.props),b))}return o.createElement(c,Object.assign({},v(m,["ref"]),c!==o.Fragment&&b),y)}function p(e){return o.forwardRef(e)}function v(e,n){void 0===n&&(n=[]);for(var t,r=Object.assign({},e),o=l(n);!(t=o()).done;){var u=t.value;u in r&&delete r[u]}return r}function m(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return o.useCallback((function(e){n.forEach((function(n){if(null!==n)return"function"==typeof n?n(e):void(n.current=e)}))}),[n])}function b(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.ArrowUp="ArrowUp",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,g={serverHandoffComplete:!1},h=0;function S(){return++h}function x(){var e=o.useState(g.serverHandoffComplete?S:null),n=e[0],t=e[1];return y((function(){null===n&&t(S())}),[n]),o.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=n?""+n:void 0}var C,I,w,O=["[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 k(e){e&&e.focus({preventScroll:!0})}function E(e,n){void 0===n&&(n=!0);var t=o.useRef(null),u=o.useCallback((function(){return e.current?Array.from(e.current.querySelectorAll(O)):[]}),[e]);y((function(){if(n){t.current=document.activeElement;var e=u();if(e.length<=0)throw new Error("There are no focusable elements inside the <FocusTrap />");return k(e[0]),function(){return k(t.current)}}}),[n]);var i=o.useCallback((function(e){if(n&&e.key===r.Tab&&document.activeElement){e.preventDefault();var t=e.shiftKey?-1:1,o=u(),i=o.length;!function e(n){void 0===n&&(n=0);var r=o.indexOf(document.activeElement),u=o[(r+i+t+n)%i];k(u),u!==document.activeElement&&e(n+t)}()}}),[u,n]);return o.useMemo((function(){return{handleKeyDown:i}}),[i])}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(I||(I={})),function(e){e[e.ToggleDialog=0]="ToggleDialog",e[e.CloseDialog=1]="CloseDialog"}(w||(w={}));var R=((C={})[w.ToggleDialog]=function(e){var n;return i({},e,{dialogState:s(e.dialogState,(n={},n[I.Open]=I.Closed,n[I.Closed]=I.Open,n))})},C[w.CloseDialog]=function(e){return i({},e,{dialogState:I.Closed})},C),D=o.createContext(null);function T(e){var n=o.useContext(D);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+M.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,T),t}return n}function L(e,n){return s(n.type,R,e,n)}D.displayName="DialogContext";var F=o.Fragment;function M(e){var n=o.useReducer(L,{dialogState:I.Closed}),t=n[0].dialogState,i=n[1];o.useEffect((function(){function e(e){e.key===r.Escape&&t===I.Open&&i({type:w.CloseDialog})}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[i,t]);var a=o.useMemo((function(){return{open:t===I.Open}}),[t]);return u.createElement(D.Provider,{value:n},f(e,a,F))}var P,A,j,N=p((function e(n,t){var u=T([M.name,e.name].join(".")),a=u[0],c=u[1],l=m(t),s="headlessui-dialog-button-"+x(),d=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();if(!n.disabled)switch(e.key){case r.Space:case r.Enter:e.preventDefault(),c({type:w.ToggleDialog})}}),[c,n.disabled]),p=o.useCallback((function(e){b(e.currentTarget)||n.disabled||c({type:w.ToggleDialog})}),[c,n.disabled]),v=o.useMemo((function(){return{open:a.dialogState===I.Open}}),[a]);return f(i({},n,{ref:l,id:s,type:"button",onKeyDown:d,onClick:p}),v,"button")})),U=n.RenderStrategy|n.Static,G=p((function e(n,t){var u=T([M.name,e.name].join(".")),a=u[0],c=u[1],l=o.useRef(null),s=m(l,t),d=E(l,!!n.static||a.dialogState===I.Open).handleKeyDown,p="headlessui-dialog-panel-"+x(),v=o.useCallback((function(){return c({type:w.CloseDialog})}),[c]),b=o.useCallback((function(e){switch(e.key){case r.Escape:e.preventDefault(),c({type:w.CloseDialog});break;default:d(e)}}),[c,d]),y=o.useMemo((function(){return{open:a.dialogState===I.Open,close:v}}),[a,v]);return f(i({},n,{ref:s,id:p,role:"dialog","aria-modal":!0,onKeyDown:b}),y,"div",U,a.dialogState===I.Open)})),H=n.RenderStrategy|n.Static,V=p((function e(n,t){var r=T([M.name,e.name].join(".")),u=r[0],a=r[1],c=m(t),l="headlessui-dialog-overlay-"+x(),s=o.useCallback((function(){return a({type:w.CloseDialog})}),[a]),d=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();a({type:w.CloseDialog})}),[a]),p=o.useMemo((function(){return{open:u.dialogState===I.Open,close:s}}),[u,s]);return f(i({},n,{ref:c,id:l,onClick:d}),p,"button",H,u.dialogState===I.Open)}));M.Button=N,M.Panel=G,M.Overlay=V,function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(A||(A={})),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"}(j||(j={}));var B=((P={})[j.ToggleDisclosure]=function(e){var n;return i({},e,{disclosureState:s(e.disclosureState,(n={},n[A.Open]=A.Closed,n[A.Closed]=A.Open,n))})},P[j.LinkPanel]=function(e){return i({},e,{linkedPanel:!0})},P[j.UnlinkPanel]=function(e){return i({},e,{linkedPanel:!1})},P[j.SetButtonId]=function(e,n){return i({},e,{buttonId:n.buttonId})},P[j.SetPanelId]=function(e,n){return i({},e,{panelId:n.panelId})},P),Q=o.createContext(null);function K(e){var n=o.useContext(Q);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+Y.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,K),t}return n}function q(e,n){return s(n.type,B,e,n)}Q.displayName="DisclosureContext";var W=o.Fragment;function Y(e){var n="headlessui-disclosure-button-"+x(),t="headlessui-disclosure-panel-"+x(),r=o.useReducer(q,{disclosureState:A.Closed,linkedPanel:!1,buttonId:n,panelId:t}),i=r[0].disclosureState,a=r[1];o.useEffect((function(){return a({type:j.SetButtonId,buttonId:n})}),[n,a]),o.useEffect((function(){return a({type:j.SetPanelId,panelId:t})}),[t,a]);var c=o.useMemo((function(){return{open:i===A.Open}}),[i]);return u.createElement(Q.Provider,{value:r},f(e,c,W))}var _=p((function e(n,t){var u=K([Y.name,e.name].join(".")),a=u[0],c=u[1],l=m(t),s=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:e.preventDefault(),c({type:j.ToggleDisclosure})}}),[c]),d=o.useCallback((function(e){b(e.currentTarget)||n.disabled||c({type:j.ToggleDisclosure})}),[c,n.disabled]),p=o.useMemo((function(){return{open:a.disclosureState===A.Open}}),[a]);return f(i({},n,{ref:l,id:a.buttonId,type:"button","aria-expanded":a.disclosureState===A.Open||void 0,"aria-controls":a.linkedPanel?a.panelId:void 0,onKeyDown:s,onClick:d}),p,"button")})),$=n.RenderStrategy|n.Static,z=p((function e(n,t){var r=K([Y.name,e.name].join(".")),a=r[0],c=r[1],l=m(t,(function(){a.linkedPanel||c({type:j.LinkPanel})}));o.useEffect((function(){return function(){return c({type:j.UnlinkPanel})}}),[c]),u.useEffect((function(){var e;a.disclosureState!==A.Closed||null!=(e=n.unmount)&&!e||c({type:j.UnlinkPanel})}),[a.disclosureState,n.unmount,c]);var s=u.useMemo((function(){return{open:a.disclosureState===A.Open}}),[a]);return f(i({},n,{ref:l,id:a.panelId}),s,"div",$,a.disclosureState===A.Open)}));Y.Button=_,Y.Panel=z;var J,X,Z,ee,ne=p((function(e,n){var t=o.useRef(null),r=m(t,n),u=E(t).handleKeyDown,a=o.useMemo((function(){return{}}),[]);return f(i({},e,{ref:r,onKeyDown:u}),a,"div")}));function te(){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=l(e.splice(0));!(n=t()).done;)(0,n.value)()}};return n}function re(){var e=o.useState(te)[0];return o.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function oe(e,n){var t=o.useState(e),r=t[0],u=t[1],i=o.useRef(e);return y((function(){i.current=e}),[e]),y((function(){return u(i.current)}),[i,u].concat(n)),r}function ue(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 J.First:return t.findIndex((function(e){return!n.resolveDisabled(e)}));case J.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 J.Next:return t.findIndex((function(e,t){return!(t<=o||n.resolveDisabled(e))}));case J.Last:var u=t.slice().reverse().findIndex((function(e){return!n.resolveDisabled(e)}));return-1===u?u:t.length-1-u;case J.Specific:return t.findIndex((function(t){return n.resolveId(t)===e.id}));case J.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?r:u}function ie(e,n){if(void 0!==e)return"function"==typeof e?e(n):e}!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"}(J||(J={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Z||(Z={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption"}(ee||(ee={}));var ae=((X={})[ee.CloseListbox]=function(e){return i({},e,{activeOptionIndex:null,listboxState:Z.Closed})},X[ee.OpenListbox]=function(e){return i({},e,{listboxState:Z.Open})},X[ee.GoToOption]=function(e,n){var t=ue(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})},X[ee.Search]=function(e,n){var t=e.searchQuery+n.value,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})},X[ee.ClearSearch]=function(e){return i({},e,{searchQuery:""})},X[ee.RegisterOption]=function(e,n){return i({},e,{options:[].concat(e.options,[{id:n.id,dataRef:n.dataRef}])})},X[ee.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)})},X),ce=o.createContext(null);function le(e){var n=o.useContext(ce);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+de.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,le),t}return n}function se(e,n){return s(n.type,ae,e,n)}ce.displayName="ListboxContext";var fe=o.Fragment;function de(e){var n=e.value,t=e.onChange,r=a(e,["value","onChange"]),i=re(),c=o.useReducer(se,{listboxState:Z.Closed,propsRef:{current:{value:n,onChange:t}},labelRef:o.createRef(),buttonRef:o.createRef(),optionsRef:o.createRef(),options:[],searchQuery:"",activeOptionIndex:null}),l=c[0],s=l.listboxState,d=l.propsRef,p=l.optionsRef,v=l.buttonRef,m=c[1];y((function(){d.current.value=n}),[n,d]),y((function(){d.current.onChange=t}),[t,d]),o.useEffect((function(){function e(e){var n,t,r,o=e.target,u=document.activeElement;s===Z.Open&&((null==(n=v.current)?void 0:n.contains(o))||((null==(t=p.current)?void 0:t.contains(o))||m({type:ee.CloseListbox}),u!==document.body&&(null==u?void 0:u.contains(o))||e.defaultPrevented||null==(r=v.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[s,p,v,i,m]);var b=o.useMemo((function(){return{open:s===Z.Open}}),[s]);return u.createElement(ce.Provider,{value:c},f(r,b,fe))}var pe,ve,me,be=p((function e(n,t){var u,a=le([de.name,e.name].join(".")),c=a[0],l=a[1],s=m(c.buttonRef,t),d="headlessui-listbox-button-"+x(),p=re(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:J.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:J.Last})}))}}),[l,c,p]),y=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();n.disabled||(c.listboxState===Z.Open?(l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,n.disabled]),g=oe((function(){if(c.labelRef.current)return[c.labelRef.current.id,d].join(" ")}),[c.labelRef.current,d]),h=o.useMemo((function(){return{open:c.listboxState===Z.Open}}),[c]);return f(i({},n,{ref:s,id:d,type:"button","aria-haspopup":!0,"aria-controls":null==(u=c.optionsRef.current)?void 0:u.id,"aria-expanded":c.listboxState===Z.Open||void 0,"aria-labelledby":g,onKeyDown:v,onClick:y}),h,"button")})),ye=n.RenderStrategy|n.Static,ge=p((function e(n,t){var u,a=le([de.name,e.name].join(".")),c=a[0],l=a[1],s=m(c.optionsRef,t),d="headlessui-listbox-options-"+x(),p=re(),v=re(),b=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:ee.Search,value:e.key});case r.Enter:e.preventDefault(),l({type:ee.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),te().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),l({type:ee.GoToOption,focus:J.Next});case r.ArrowUp:return e.preventDefault(),l({type:ee.GoToOption,focus:J.Previous});case r.Home:case r.PageUp:return e.preventDefault(),l({type:ee.GoToOption,focus:J.First});case r.End:case r.PageDown:return e.preventDefault(),l({type:ee.GoToOption,focus:J.Last});case r.Escape:return e.preventDefault(),l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case r.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:ee.Search,value:e.key}),v.setTimeout((function(){return l({type:ee.ClearSearch})}),350))}}),[p,l,v,c]),y=oe((function(){var e,n,t;return null!=(e=null==(n=c.labelRef.current)?void 0:n.id)?e:null==(t=c.buttonRef.current)?void 0:t.id}),[c.labelRef.current,c.buttonRef.current]),g=o.useMemo((function(){return{open:c.listboxState===Z.Open}}),[c]);return f(i({},n,{"aria-activedescendant":null===c.activeOptionIndex||null==(u=c.options[c.activeOptionIndex])?void 0:u.id,"aria-labelledby":y,id:d,onKeyDown:b,role:"listbox",tabIndex:0,ref:s}),g,"ul",ye,c.listboxState===Z.Open)}));de.Button=be,de.Label=function e(n){var t=le([de.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===Z.Open}}),[t]);return f(i({},n,{ref:t.labelRef,id:r,onClick:u}),a,"label")},de.Options=ge,de.Option=function e(n){var t=n.disabled,r=void 0!==t&&t,u=n.value,c=n.className,l=a(n,["disabled","value","className"]),s=le([de.name,e.name].join(".")),d=s[0],p=s[1],v="headlessui-listbox-option-"+x(),m=null!==d.activeOptionIndex&&d.options[d.activeOptionIndex].id===v,b=d.propsRef.current.value===u,g=o.useRef({disabled:r,value:u});y((function(){g.current.disabled=r}),[g,r]),y((function(){g.current.value=u}),[g,u]),y((function(){var e,n;g.current.textValue=null==(e=document.getElementById(v))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[g,v]);var h=o.useCallback((function(){return d.propsRef.current.onChange(u)}),[d.propsRef,u]);y((function(){return p({type:ee.RegisterOption,id:v,dataRef:g}),function(){return p({type:ee.UnregisterOption,id:v})}}),[g,v]),y((function(){var e;d.listboxState===Z.Open&&b&&(p({type:ee.GoToOption,focus:J.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[d.listboxState]),y((function(){if(d.listboxState===Z.Open&&m){var e=te();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[m,d.listboxState]);var S=o.useCallback((function(e){if(r)return e.preventDefault();h(),p({type:ee.CloseListbox}),te().nextFrame((function(){var e;return null==(e=d.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,d.buttonRef,r,h]),C=o.useCallback((function(){if(r)return p({type:ee.GoToOption,focus:J.Nothing});p({type:ee.GoToOption,focus:J.Specific,id:v})}),[r,v,p]),I=o.useCallback((function(){r||m||p({type:ee.GoToOption,focus:J.Specific,id:v})}),[r,m,v,p]),w=o.useCallback((function(){r||m&&p({type:ee.GoToOption,focus:J.Nothing})}),[r,m,p]),O=o.useMemo((function(){return{active:m,selected:b,disabled:r}}),[m,b,r]);return f(i({},l,{id:v,role:"option",tabIndex:-1,className:ie(c,O),"aria-disabled":!0===r||void 0,"aria-selected":!0===b||void 0,onClick:S,onFocus:C,onPointerMove:I,onMouseMove:I,onPointerLeave:w,onMouseLeave:w}),O,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(ve||(ve={})),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"}(me||(me={}));var he=((pe={})[me.CloseMenu]=function(e){return i({},e,{activeItemIndex:null,menuState:ve.Closed})},pe[me.OpenMenu]=function(e){return i({},e,{menuState:ve.Open})},pe[me.GoToItem]=function(e,n){var t=ue(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})},pe[me.Search]=function(e,n){var t=e.searchQuery+n.value,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})},pe[me.ClearSearch]=function(e){return i({},e,{searchQuery:""})},pe[me.RegisterItem]=function(e,n){return i({},e,{items:[].concat(e.items,[{id:n.id,dataRef:n.dataRef}])})},pe[me.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)})},pe),Se=o.createContext(null);function xe(e){var n=o.useContext(Se);if(null===n){var t=new Error("<"+e+" /> is missing a parent <"+we.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,xe),t}return n}function Ce(e,n){return s(n.type,he,e,n)}Se.displayName="MenuContext";var Ie=o.Fragment;function we(e){var n=o.useReducer(Ce,{menuState:ve.Closed,buttonRef:o.createRef(),itemsRef:o.createRef(),items:[],searchQuery:"",activeItemIndex:null}),t=n[0],r=t.menuState,i=t.itemsRef,a=t.buttonRef,c=n[1];o.useEffect((function(){function e(e){var n,t,o,u=e.target,l=document.activeElement;r===ve.Open&&((null==(n=a.current)?void 0:n.contains(u))||((null==(t=i.current)?void 0:t.contains(u))||c({type:me.CloseMenu}),l!==document.body&&(null==l?void 0:l.contains(u))||e.defaultPrevented||null==(o=a.current)||o.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[r,i,a,c]);var l=o.useMemo((function(){return{open:r===ve.Open}}),[r]);return u.createElement(Se.Provider,{value:n},f(e,l,Ie))}var Oe=p((function e(n,t){var u,a=xe([we.name,e.name].join(".")),c=a[0],l=a[1],s=m(c.buttonRef,t),d="headlessui-menu-button-"+x(),p=re(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:me.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:me.GoToItem,focus:J.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:me.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:me.GoToItem,focus:J.Last})}))}}),[l,c,p]),y=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();n.disabled||(c.menuState===ve.Open?(l({type:me.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:me.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,n.disabled]),g=o.useMemo((function(){return{open:c.menuState===ve.Open}}),[c]);return f(i({},n,{ref:s,id:d,type:"button","aria-haspopup":!0,"aria-controls":null==(u=c.itemsRef.current)?void 0:u.id,"aria-expanded":c.menuState===ve.Open||void 0,onKeyDown:v,onClick:y}),g,"button")})),ke=n.RenderStrategy|n.Static,Ee=p((function e(n,t){var u,a,c=xe([we.name,e.name].join(".")),l=c[0],s=c[1],d=m(l.itemsRef,t),p="headlessui-menu-items-"+x(),v=re(),b=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:me.Search,value:e.key});case r.Enter:var n;e.preventDefault(),s({type:me.CloseMenu}),null!==l.activeItemIndex&&(null==(n=document.getElementById(l.items[l.activeItemIndex].id))||n.click()),te().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),s({type:me.GoToItem,focus:J.Next});case r.ArrowUp:return e.preventDefault(),s({type:me.GoToItem,focus:J.Previous});case r.Home:case r.PageUp:return e.preventDefault(),s({type:me.GoToItem,focus:J.First});case r.End:case r.PageDown:return e.preventDefault(),s({type:me.GoToItem,focus:J.Last});case r.Escape:e.preventDefault(),s({type:me.CloseMenu}),te().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:me.Search,value:e.key}),v.setTimeout((function(){return s({type:me.ClearSearch})}),350))}}),[s,v,l]),y=o.useMemo((function(){return{open:l.menuState===ve.Open}}),[l]);return f(i({},n,{"aria-activedescendant":null===l.activeItemIndex||null==(u=l.items[l.activeItemIndex])?void 0:u.id,"aria-labelledby":null==(a=l.buttonRef.current)?void 0:a.id,id:p,onKeyDown:b,role:"menu",tabIndex:0,ref:d}),y,"div",ke,l.menuState===ve.Open)})),Re=o.Fragment;we.Button=Oe,we.Items=Ee,we.Item=function e(n){var t=n.disabled,r=void 0!==t&&t,u=n.className,c=n.onClick,l=a(n,["disabled","className","onClick"]),s=xe([we.name,e.name].join(".")),d=s[0],p=s[1],v="headlessui-menu-item-"+x(),m=null!==d.activeItemIndex&&d.items[d.activeItemIndex].id===v,b=o.useRef({disabled:r});y((function(){b.current.disabled=r}),[b,r]),y((function(){var e,n;b.current.textValue=null==(e=document.getElementById(v))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[b,v]),y((function(){return p({type:me.RegisterItem,id:v,dataRef:b}),function(){return p({type:me.UnregisterItem,id:v})}}),[b,v]);var g=o.useCallback((function(e){return r?e.preventDefault():(p({type:me.CloseMenu}),te().nextFrame((function(){var e;return null==(e=d.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),c?c(e):void 0)}),[p,d.buttonRef,r,c]),h=o.useCallback((function(){if(r)return p({type:me.GoToItem,focus:J.Nothing});p({type:me.GoToItem,focus:J.Specific,id:v})}),[r,v,p]),S=o.useCallback((function(){r||m||p({type:me.GoToItem,focus:J.Specific,id:v})}),[r,m,v,p]),C=o.useCallback((function(){r||m&&p({type:me.GoToItem,focus:J.Nothing})}),[r,m,p]),I=o.useMemo((function(){return{active:m,disabled:r}}),[m,r]);return f(i({},l,{id:v,role:"menuitem",tabIndex:-1,className:ie(u,I),"aria-disabled":!0===r||void 0,onClick:g,onFocus:h,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C}),I,Re)};var De=o.createContext(null);function Te(e){var n=o.useContext(De);if(null===n){var t=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Te),t}return n}De.displayName="GroupContext";var Le,Fe=o.Fragment;function Me(e){var n,t,u=e.checked,c=e.onChange,l=e.className,s=a(e,["checked","onChange","className"]),d="headlessui-switch-"+x(),p=o.useContext(De),v=o.useCallback((function(){return c(!u)}),[c,u]),m=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),y=o.useCallback((function(e){e.key!==r.Tab&&e.preventDefault(),e.key===r.Space&&v()}),[v]),g=o.useCallback((function(e){return e.preventDefault()}),[]),h=o.useMemo((function(){return{checked:u}}),[u]),S={id:d,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:ie(l,h),"aria-checked":u,"aria-labelledby":null==p||null==(n=p.label)?void 0:n.id,"aria-describedby":null==p||null==(t=p.description)?void 0:t.id,onClick:m,onKeyUp:y,onKeyPress:g};return"button"===s.as&&Object.assign(S,{type:"button"}),f(i({},s,S),h,"button")}function Pe(){var e=o.useRef(!0);return o.useEffect((function(){e.current=!1}),[]),e.current}function Ae(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 je(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 Ne(e,n,t,r,o){var u=te(),i=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 Ae.apply(void 0,[e].concat(n,t)),u.nextFrame((function(){je.apply(void 0,[e].concat(t)),Ae.apply(void 0,[e].concat(r)),u.add(function(e,n){var t=te();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(Le.Finished)}),u+o[1]):n(Le.Finished),t.add((function(){return n(Le.Cancelled)})),t.dispose}(e,(function(t){return je.apply(void 0,[e].concat(r,n)),i(t)})))})),u.add((function(){return je.apply(void 0,[e].concat(n,t,r))})),u.add((function(){return i(Le.Cancelled)})),u.dispose}function Ue(e){return void 0===e&&(e=""),o.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Me.Group=function(e){var n=o.useState(null),t=n[0],r=n[1],i=o.useState(null),a=i[0],c=i[1],l=o.useState(null),s=l[0],d=l[1],p=o.useMemo((function(){return{switch:t,setSwitch:r,label:a,setLabel:c,description:s,setDescription:d}}),[t,r,a,c,s,d]);return u.createElement(De.Provider,{value:p},f(e,{},Fe))},Me.Label=function e(n){var t=Te([Me.name,e.name].join(".")),r="headlessui-switch-label-"+x(),u=o.useCallback((function(){t.switch&&(t.switch.click(),t.switch.focus({preventScroll:!0}))}),[t.switch]);return f(i({},n,{ref:t.setLabel,id:r,onClick:u}),{},"label")},Me.Description=function e(n){var t=Te([Me.name,e.name].join(".")),r="headlessui-switch-description-"+x();return f(i({},n,{ref:t.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Le||(Le={}));var Ge,He=o.createContext(null);He.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Ge||(Ge={}));var Ve=o.createContext(null);function Be(e){return"children"in e?Be(e.children):e.current.filter((function(e){return e.state===Ge.Visible})).length>0}function Qe(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 i=o.useCallback((function(e,o){var i;void 0===o&&(o=t.Hidden);var a=r.current.findIndex((function(n){return n.id===e}));-1!==a&&(s(o,((i={})[t.Unmount]=function(){r.current.splice(a,1)},i[t.Hidden]=function(){r.current[a].state=Ge.Hidden},i)),!Be(r)&&u.current&&(null==n.current||n.current()))}),[n,u,r]),a=o.useCallback((function(e){var n=r.current.find((function(n){return n.id===e}));return n?n.state!==Ge.Visible&&(n.state=Ge.Visible):r.current.push({id:e,state:Ge.Visible}),function(){return i(e,t.Unmount)}}),[r,i]);return o.useMemo((function(){return{children:r,register:a,unregister:i}}),[a,i,r])}function Ke(){}Ve.displayName="NestingContext";var qe=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function We(e){for(var n,t={},r=l(qe);!(n=r()).done;){var o,u=n.value;t[u]=null!=(o=e[u])?o:Ke}return t}var Ye=n.RenderStrategy;function _e(e){var n=e.beforeEnter,r=e.afterEnter,c=e.beforeLeave,l=e.afterLeave,d=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,b=e.leaveFrom,g=e.leaveTo,h=a(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),S=o.useRef(null),C=o.useState(Ge.Visible),I=C[0],w=C[1],O=h.unmount?t.Unmount:t.Hidden,k=function(){var e=o.useContext(He);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),E=k.show,R=k.appear,D=function(){var e=o.useContext(Ve);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),T=D.register,L=D.unregister,F=Pe(),M=x(),P=o.useRef(!1),A=Qe((function(){P.current||(w(Ge.Hidden),L(M),B.current.afterLeave())}));y((function(){if(M)return T(M)}),[T,M]),y((function(){var e;O===t.Hidden&&M&&(E&&I!==Ge.Visible?w(Ge.Visible):s(I,((e={})[Ge.Hidden]=function(){return L(M)},e[Ge.Visible]=function(){return T(M)},e)))}),[I,M,T,L,E,O]);var j=Ue(d),N=Ue(p),U=Ue(v),G=Ue(m),H=Ue(b),V=Ue(g),B=function(e){var n=o.useRef(We(e));return o.useEffect((function(){n.current=We(e)}),[e]),n}({beforeEnter:n,afterEnter:r,beforeLeave:c,afterLeave:l});o.useEffect((function(){if(I===Ge.Visible&&null===S.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[S,I]);var Q=F&&!R;return y((function(){var e=S.current;if(e&&!Q)return P.current=!0,E&&B.current.beforeEnter(),E||B.current.beforeLeave(),E?Ne(e,j,N,U,(function(e){P.current=!1,e===Le.Finished&&B.current.afterEnter()})):Ne(e,G,H,V,(function(e){P.current=!1,e===Le.Finished&&(Be(A)||(w(Ge.Hidden),L(M),B.current.afterLeave()))}))}),[B,M,P,L,A,S,Q,E,j,N,U,G,H,V]),u.createElement(Ve.Provider,{value:A},f(i({},h,{ref:S}),{},"div",Ye,I===Ge.Visible))}function $e(e){var n=e.show,t=e.appear,r=void 0!==t&&t,c=e.unmount,l=a(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?Ge.Visible:Ge.Hidden),d=s[0],p=s[1],v=Qe((function(){p(Ge.Hidden)})),m=Pe(),b=o.useMemo((function(){return{show:n,appear:r||!m}}),[n,r,m]);o.useEffect((function(){n?p(Ge.Visible):Be(v)||p(Ge.Hidden)}),[n,v]);var y={unmount:c};return u.createElement(Ve.Provider,{value:v},u.createElement(He.Provider,{value:b},f(i({},y,{as:o.Fragment,children:u.createElement(_e,Object.assign({},y,l))}),{},o.Fragment,Ye,d===Ge.Visible)))}$e.Child=_e,exports.Dialog=M,exports.Disclosure=Y,exports.FocusTrap=ne,exports.Listbox=de,exports.Menu=we,exports.Switch=Me,exports.Transition=$e;
//# sourceMappingURL=headlessui.cjs.production.min.js.map

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).headlessui={},e.React)}(this,(function(e,n){"use strict";function t(){return(t=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 r(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 o(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 u(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 o(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)?o(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 i(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,i),a}var a,c;function l(e,n,o,u,l){if(void 0===l&&(l=!0),l)return s(e,n,o);var f=null!=u?u:a.None;if(f&a.Static){var d=e.static,p=void 0!==d&&d,v=r(e,["static"]);if(p)return s(v,n,o)}if(f&a.RenderStrategy){var m,b=e.unmount,y=void 0===b||b,h=r(e,["unmount"]);return i(y?c.Unmount:c.Hidden,((m={})[c.Unmount]=function(){return null},m[c.Hidden]=function(){return s(t({},h,{hidden:!0,style:{display:"none"}}),n,o)},m))}return s(e,n,o)}function s(e,t,o){var i,a=d(e,["unmount","static"]),c=a.as,l=void 0===c?o:c,f=a.children,p=a.refName,v=void 0===p?"ref":p,m=r(a,["as","children","refName"]),b=void 0!==e.ref?((i={})[v]=e.ref,i):{},y="function"==typeof f?f(t):f;if(l===n.Fragment&&Object.keys(m).length>0){if(Array.isArray(y)&&y.length>1){var h=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(h,s),h}if(!n.isValidElement(y)){var x=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(x,s),x}return n.cloneElement(y,Object.assign({},function(e,n,t){for(var r,o=Object.assign({},e),i=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=u(["onClick"]);!(r=a()).done;)i();return o}(function(e){var n=Object.assign({},e);for(var t in n)void 0===n[t]&&delete n[t];return n}(d(m,["ref"])),y.props),b))}return n.createElement(l,Object.assign({},d(m,["ref"]),l!==n.Fragment&&b),y)}function f(e){return n.forwardRef(e)}function d(e,n){void 0===n&&(n=[]);for(var t,r=Object.assign({},e),o=u(n);!(t=o()).done;){var i=t.value;i in r&&delete r[i]}return r}function p(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useCallback((function(e){t.forEach((function(n){if(null!==n)return"function"==typeof n?n(e):void(n.current=e)}))}),[t])}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(a||(a={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(c||(c={}));var v,m,b,y,h="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,x={serverHandoffComplete:!1},S=0;function g(){return++S}function I(){var e=n.useState(x.serverHandoffComplete?g:null),t=e[0],r=e[1];return h((function(){null===t&&r(g())}),[t]),n.useEffect((function(){!1===x.serverHandoffComplete&&(x.serverHandoffComplete=!0)}),[]),null!=t?""+t:void 0}function C(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.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(v||(v={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(b||(b={})),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"}(y||(y={}));var O=((m={})[y.ToggleDisclosure]=function(e){var n;return t({},e,{disclosureState:i(e.disclosureState,(n={},n[b.Open]=b.Closed,n[b.Closed]=b.Open,n))})},m[y.LinkPanel]=function(e){return t({},e,{linkedPanel:!0})},m[y.UnlinkPanel]=function(e){return t({},e,{linkedPanel:!1})},m[y.SetButtonId]=function(e,n){return t({},e,{buttonId:n.buttonId})},m[y.SetPanelId]=function(e,n){return t({},e,{panelId:n.panelId})},m),E=n.createContext(null);function w(e){var t=n.useContext(E);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+T.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,w),r}return t}function R(e,n){return i(n.type,O,e,n)}E.displayName="DisclosureContext";var k=n.Fragment;function T(e){var t="headlessui-disclosure-button-"+I(),r="headlessui-disclosure-panel-"+I(),o=n.useReducer(R,{disclosureState:b.Closed,linkedPanel:!1,buttonId:t,panelId:r}),u=o[0].disclosureState,i=o[1];n.useEffect((function(){return i({type:y.SetButtonId,buttonId:t})}),[t]),n.useEffect((function(){return i({type:y.SetPanelId,panelId:r})}),[r]);var a=n.useMemo((function(){return{open:u===b.Open}}),[u]);return n.createElement(E.Provider,{value:o},l(e,a,k))}var D,L,P,F,M=f((function e(r,o){var u=w([T.name,e.name].join(".")),i=u[0],a=u[1],c=p(o),s=n.useCallback((function(e){switch(e.key){case v.Space:case v.Enter:e.preventDefault(),a({type:y.ToggleDisclosure})}}),[a]),f=n.useCallback((function(e){C(e.currentTarget)||r.disabled||a({type:y.ToggleDisclosure})}),[a,r.disabled]),d=n.useMemo((function(){return{open:i.disclosureState===b.Open}}),[i]);return l(t({},r,{ref:c,id:i.buttonId,type:"button","aria-expanded":i.disclosureState===b.Open||void 0,"aria-controls":i.linkedPanel?i.panelId:void 0,onKeyDown:s,onClick:f}),d,"button")})),A=a.RenderStrategy|a.Static,U=f((function e(r,o){var u=w([T.name,e.name].join(".")),i=u[0],a=u[1],c=p(o,(function(){i.linkedPanel||a({type:y.LinkPanel})}));n.useEffect((function(){return function(){return a({type:y.UnlinkPanel})}}),[]),n.useEffect((function(){var e;i.disclosureState!==b.Closed||null!=(e=r.unmount)&&!e||a({type:y.UnlinkPanel})}),[i.disclosureState,r.unmount]);var s=n.useMemo((function(){return{open:i.disclosureState===b.Open}}),[i]);return l(t({},r,{ref:c,id:i.panelId}),s,"div",A,i.disclosureState===b.Open)}));function N(){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(){e.splice(0).forEach((function(e){return e()}))}};return n}function j(){var e=n.useState(N)[0];return n.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function G(e,t){var r=n.useState(e),o=r[0],u=r[1],i=n.useRef(e);return h((function(){i.current=e}),[e]),h((function(){return u(i.current)}),[i,u].concat(t)),o}function H(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 D.First:return t.findIndex((function(e){return!n.resolveDisabled(e)}));case D.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 D.Next:return t.findIndex((function(e,t){return!(t<=o||n.resolveDisabled(e))}));case D.Last:var u=t.slice().reverse().findIndex((function(e){return!n.resolveDisabled(e)}));return-1===u?u:t.length-1-u;case D.Specific:return t.findIndex((function(t){return n.resolveId(t)===e.id}));case D.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?r:u}function V(e,n){if(void 0!==e)return"function"==typeof e?e(n):e}T.Button=M,T.Panel=U,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"}(D||(D={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(P||(P={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption"}(F||(F={}));var Q=((L={})[F.CloseListbox]=function(e){return t({},e,{activeOptionIndex:null,listboxState:P.Closed})},L[F.OpenListbox]=function(e){return t({},e,{listboxState:P.Open})},L[F.GoToOption]=function(e,n){var r=H(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===r?e:t({},e,{searchQuery:"",activeOptionIndex:r})},L[F.Search]=function(e,n){var r=e.searchQuery+n.value,o=e.options.findIndex((function(e){var n;return!e.dataRef.current.disabled&&(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(r))}));return t({},e,-1===o||o===e.activeOptionIndex?{searchQuery:r}:{searchQuery:r,activeOptionIndex:o})},L[F.ClearSearch]=function(e){return t({},e,{searchQuery:""})},L[F.RegisterOption]=function(e,n){return t({},e,{options:[].concat(e.options,[{id:n.id,dataRef:n.dataRef}])})},L[F.UnregisterOption]=function(e,n){var r=e.options.slice(),o=null!==e.activeOptionIndex?r[e.activeOptionIndex]:null,u=r.findIndex((function(e){return e.id===n.id}));return-1!==u&&r.splice(u,1),t({},e,{options:r,activeOptionIndex:u===e.activeOptionIndex||null===o?null:r.indexOf(o)})},L),B=n.createContext(null);function K(e){var t=n.useContext(B);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+Y.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,K),r}return t}function q(e,n){return i(n.type,Q,e,n)}B.displayName="ListboxContext";var W=n.Fragment;function Y(e){var t=e.value,o=e.onChange,u=r(e,["value","onChange"]),i=j(),a=n.useReducer(q,{listboxState:P.Closed,propsRef:{current:{value:t,onChange:o}},labelRef:n.createRef(),buttonRef:n.createRef(),optionsRef:n.createRef(),options:[],searchQuery:"",activeOptionIndex:null}),c=a[0],s=c.listboxState,f=c.propsRef,d=c.optionsRef,p=c.buttonRef,v=a[1];h((function(){f.current.value=t}),[t,f]),h((function(){f.current.onChange=o}),[o,f]),n.useEffect((function(){function e(e){var n,t,r,o=e.target,u=document.activeElement;s===P.Open&&((null==(n=p.current)?void 0:n.contains(o))||((null==(t=d.current)?void 0:t.contains(o))||v({type:F.CloseListbox}),u!==document.body&&(null==u?void 0:u.contains(o))||e.defaultPrevented||null==(r=p.current)||r.focus({preventScroll:!0})))}return window.addEventListener("click",e),function(){return window.removeEventListener("click",e)}}),[s,d,p,i,v]);var m=n.useMemo((function(){return{open:s===P.Open}}),[s]);return n.createElement(B.Provider,{value:a},l(u,m,W))}var _,$,z,J=f((function e(r,o){var u,i=K([Y.name,e.name].join(".")),a=i[0],c=i[1],s=p(a.buttonRef,o),f="headlessui-listbox-button-"+I(),d=j(),m=n.useCallback((function(e){switch(e.key){case v.Space:case v.Enter:case v.ArrowDown:e.preventDefault(),c({type:F.OpenListbox}),d.nextFrame((function(){var e;null==(e=a.optionsRef.current)||e.focus({preventScroll:!0}),a.propsRef.current.value||c({type:F.GoToOption,focus:D.First})}));break;case v.ArrowUp:e.preventDefault(),c({type:F.OpenListbox}),d.nextFrame((function(){var e;null==(e=a.optionsRef.current)||e.focus({preventScroll:!0}),a.propsRef.current.value||c({type:F.GoToOption,focus:D.Last})}))}}),[c,a,d]),b=n.useCallback((function(e){r.disabled||(a.listboxState===P.Open?(c({type:F.CloseListbox}),d.nextFrame((function(){var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),c({type:F.OpenListbox}),d.nextFrame((function(){var e;return null==(e=a.optionsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[c,d,a,r.disabled]),y=G((function(){if(a.labelRef.current)return[a.labelRef.current.id,f].join(" ")}),[a.labelRef.current,f]),h=n.useMemo((function(){return{open:a.listboxState===P.Open}}),[a]);return l(t({},r,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(u=a.optionsRef.current)?void 0:u.id,"aria-expanded":a.listboxState===P.Open||void 0,"aria-labelledby":y,onKeyDown:m,onPointerUp:b}),h,"button")})),X=a.RenderStrategy|a.Static,Z=f((function e(r,o){var u,i=K([Y.name,e.name].join(".")),a=i[0],c=i[1],s=p(a.optionsRef,o),f="headlessui-listbox-options-"+I(),d=j(),m=j(),b=n.useCallback((function(e){switch(m.dispose(),e.key){case v.Space:if(""!==a.searchQuery)return e.preventDefault(),c({type:F.Search,value:e.key});case v.Enter:e.preventDefault(),c({type:F.CloseListbox}),null!==a.activeOptionIndex&&a.propsRef.current.onChange(a.options[a.activeOptionIndex].dataRef.current.value),N().nextFrame((function(){var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case v.ArrowDown:return e.preventDefault(),c({type:F.GoToOption,focus:D.Next});case v.ArrowUp:return e.preventDefault(),c({type:F.GoToOption,focus:D.Previous});case v.Home:case v.PageUp:return e.preventDefault(),c({type:F.GoToOption,focus:D.First});case v.End:case v.PageDown:return e.preventDefault(),c({type:F.GoToOption,focus:D.Last});case v.Escape:return e.preventDefault(),c({type:F.CloseListbox}),d.nextFrame((function(){var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case v.Tab:return e.preventDefault();default:1===e.key.length&&(c({type:F.Search,value:e.key}),m.setTimeout((function(){return c({type:F.ClearSearch})}),350))}}),[d,c,m,a]),y=G((function(){var e,n,t;return null!=(e=null==(n=a.labelRef.current)?void 0:n.id)?e:null==(t=a.buttonRef.current)?void 0:t.id}),[a.labelRef.current,a.buttonRef.current]),h=n.useMemo((function(){return{open:a.listboxState===P.Open}}),[a]);return l(t({},r,{"aria-activedescendant":null===a.activeOptionIndex||null==(u=a.options[a.activeOptionIndex])?void 0:u.id,"aria-labelledby":y,id:f,onKeyDown:b,role:"listbox",tabIndex:0,ref:s}),h,"ul",X,a.listboxState===P.Open)}));Y.Button=J,Y.Label=function e(r){var o=K([Y.name,e.name].join("."))[0],u="headlessui-listbox-label-"+I(),i=n.useCallback((function(){var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[o.buttonRef]),a=n.useMemo((function(){return{open:o.listboxState===P.Open}}),[o]);return l(t({},r,{ref:o.labelRef,id:u,onPointerUp:i}),a,"label")},Y.Options=Z,Y.Option=function e(o){var u=o.disabled,i=void 0!==u&&u,a=o.value,c=o.className,s=r(o,["disabled","value","className"]),f=K([Y.name,e.name].join(".")),d=f[0],p=f[1],v="headlessui-listbox-option-"+I(),m=null!==d.activeOptionIndex&&d.options[d.activeOptionIndex].id===v,b=d.propsRef.current.value===a,y=n.useRef({disabled:i,value:a});h((function(){y.current.disabled=i}),[y,i]),h((function(){y.current.value=a}),[y,a]),h((function(){var e,n;y.current.textValue=null==(e=document.getElementById(v))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[y,v]);var x=n.useCallback((function(){return d.propsRef.current.onChange(a)}),[d.propsRef,a]);h((function(){return p({type:F.RegisterOption,id:v,dataRef:y}),function(){return p({type:F.UnregisterOption,id:v})}}),[y,v]),h((function(){var e;d.listboxState===P.Open&&b&&(p({type:F.GoToOption,focus:D.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[d.listboxState]),h((function(){if(d.listboxState===P.Open&&m){var e=N();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[m,d.listboxState]);var S=n.useCallback((function(e){if(i)return e.preventDefault();x(),p({type:F.CloseListbox}),N().nextFrame((function(){var e;return null==(e=d.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,d.buttonRef,i,x]),g=n.useCallback((function(){if(i)return p({type:F.GoToOption,focus:D.Nothing});p({type:F.GoToOption,focus:D.Specific,id:v})}),[i,v,p]),C=n.useCallback((function(){i||m||p({type:F.GoToOption,focus:D.Specific,id:v})}),[i,m,v,p]),O=n.useCallback((function(){i||m&&p({type:F.GoToOption,focus:D.Nothing})}),[i,m,p]),E=n.useMemo((function(){return{active:m,selected:b,disabled:i}}),[m,b,i]);return l(t({},s,{id:v,role:"option",tabIndex:-1,className:V(c,E),"aria-disabled":!0===i||void 0,"aria-selected":!0===b||void 0,onClick:S,onFocus:g,onPointerMove:C,onPointerLeave:O}),E,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}($||($={})),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"}(z||(z={}));var ee=((_={})[z.CloseMenu]=function(e){return t({},e,{activeItemIndex:null,menuState:$.Closed})},_[z.OpenMenu]=function(e){return t({},e,{menuState:$.Open})},_[z.GoToItem]=function(e,n){var r=H(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===r?e:t({},e,{searchQuery:"",activeItemIndex:r})},_[z.Search]=function(e,n){var r=e.searchQuery+n.value,o=e.items.findIndex((function(e){var n;return(null==(n=e.dataRef.current.textValue)?void 0:n.startsWith(r))&&!e.dataRef.current.disabled}));return t({},e,-1===o||o===e.activeItemIndex?{searchQuery:r}:{searchQuery:r,activeItemIndex:o})},_[z.ClearSearch]=function(e){return t({},e,{searchQuery:""})},_[z.RegisterItem]=function(e,n){return t({},e,{items:[].concat(e.items,[{id:n.id,dataRef:n.dataRef}])})},_[z.UnregisterItem]=function(e,n){var r=e.items.slice(),o=null!==e.activeItemIndex?r[e.activeItemIndex]:null,u=r.findIndex((function(e){return e.id===n.id}));return-1!==u&&r.splice(u,1),t({},e,{items:r,activeItemIndex:u===e.activeItemIndex||null===o?null:r.indexOf(o)})},_),ne=n.createContext(null);function te(e){var t=n.useContext(ne);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+ue.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,te),r}return t}function re(e,n){return i(n.type,ee,e,n)}ne.displayName="MenuContext";var oe=n.Fragment;function ue(e){var t=n.useReducer(re,{menuState:$.Closed,buttonRef:n.createRef(),itemsRef:n.createRef(),items:[],searchQuery:"",activeItemIndex:null}),r=t[0],o=r.menuState,u=r.itemsRef,i=r.buttonRef,a=t[1];n.useEffect((function(){function e(e){var n,t,r,c=e.target,l=document.activeElement;o===$.Open&&((null==(n=i.current)?void 0:n.contains(c))||((null==(t=u.current)?void 0:t.contains(c))||a({type:z.CloseMenu}),l!==document.body&&(null==l?void 0:l.contains(c))||e.defaultPrevented||null==(r=i.current)||r.focus({preventScroll:!0})))}return window.addEventListener("click",e),function(){return window.removeEventListener("click",e)}}),[o,u,i,a]);var c=n.useMemo((function(){return{open:o===$.Open}}),[o]);return n.createElement(ne.Provider,{value:t},l(e,c,oe))}var ie=f((function e(r,o){var u,i=te([ue.name,e.name].join(".")),a=i[0],c=i[1],s=p(a.buttonRef,o),f="headlessui-menu-button-"+I(),d=j(),m=n.useCallback((function(e){switch(e.key){case v.Space:case v.Enter:case v.ArrowDown:e.preventDefault(),c({type:z.OpenMenu}),d.nextFrame((function(){var e;null==(e=a.itemsRef.current)||e.focus({preventScroll:!0}),c({type:z.GoToItem,focus:D.First})}));break;case v.ArrowUp:e.preventDefault(),c({type:z.OpenMenu}),d.nextFrame((function(){var e;null==(e=a.itemsRef.current)||e.focus({preventScroll:!0}),c({type:z.GoToItem,focus:D.Last})}))}}),[c,a,d]),b=n.useCallback((function(e){r.disabled||(a.menuState===$.Open?(c({type:z.CloseMenu}),d.nextFrame((function(){var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),c({type:z.OpenMenu}),d.nextFrame((function(){var e;return null==(e=a.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[c,d,a,r.disabled]),y=n.useMemo((function(){return{open:a.menuState===$.Open}}),[a]);return l(t({},r,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(u=a.itemsRef.current)?void 0:u.id,"aria-expanded":a.menuState===$.Open||void 0,onKeyDown:m,onPointerUp:b}),y,"button")})),ae=a.RenderStrategy|a.Static,ce=f((function e(r,o){var u,i,a=te([ue.name,e.name].join(".")),c=a[0],s=a[1],f=p(c.itemsRef,o),d="headlessui-menu-items-"+I(),m=j(),b=n.useCallback((function(e){switch(m.dispose(),e.key){case v.Space:if(""!==c.searchQuery)return e.preventDefault(),s({type:z.Search,value:e.key});case v.Enter:var n;e.preventDefault(),s({type:z.CloseMenu}),null!==c.activeItemIndex&&(null==(n=document.getElementById(c.items[c.activeItemIndex].id))||n.click()),N().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case v.ArrowDown:return e.preventDefault(),s({type:z.GoToItem,focus:D.Next});case v.ArrowUp:return e.preventDefault(),s({type:z.GoToItem,focus:D.Previous});case v.Home:case v.PageUp:return e.preventDefault(),s({type:z.GoToItem,focus:D.First});case v.End:case v.PageDown:return e.preventDefault(),s({type:z.GoToItem,focus:D.Last});case v.Escape:e.preventDefault(),s({type:z.CloseMenu}),N().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case v.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:z.Search,value:e.key}),m.setTimeout((function(){return s({type:z.ClearSearch})}),350))}}),[s,m,c]),y=n.useMemo((function(){return{open:c.menuState===$.Open}}),[c]);return l(t({},r,{"aria-activedescendant":null===c.activeItemIndex||null==(u=c.items[c.activeItemIndex])?void 0:u.id,"aria-labelledby":null==(i=c.buttonRef.current)?void 0:i.id,id:d,onKeyDown:b,role:"menu",tabIndex:0,ref:f}),y,"div",ae,c.menuState===$.Open)})),le=n.Fragment;ue.Button=ie,ue.Items=ce,ue.Item=function e(o){var u=o.disabled,i=void 0!==u&&u,a=o.className,c=o.onClick,s=r(o,["disabled","className","onClick"]),f=te([ue.name,e.name].join(".")),d=f[0],p=f[1],v="headlessui-menu-item-"+I(),m=null!==d.activeItemIndex&&d.items[d.activeItemIndex].id===v,b=n.useRef({disabled:i});h((function(){b.current.disabled=i}),[b,i]),h((function(){var e,n;b.current.textValue=null==(e=document.getElementById(v))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[b,v]),h((function(){return p({type:z.RegisterItem,id:v,dataRef:b}),function(){return p({type:z.UnregisterItem,id:v})}}),[b,v]);var y=n.useCallback((function(e){return C(e.currentTarget)||i?e.preventDefault():(p({type:z.CloseMenu}),N().nextFrame((function(){var e;return null==(e=d.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),c?c(e):void 0)}),[p,d.buttonRef,i,c]),x=n.useCallback((function(){if(i)return p({type:z.GoToItem,focus:D.Nothing});p({type:z.GoToItem,focus:D.Specific,id:v})}),[i,v,p]),S=n.useCallback((function(){i||m||p({type:z.GoToItem,focus:D.Specific,id:v})}),[i,m,v,p]),g=n.useCallback((function(){i||m&&p({type:z.GoToItem,focus:D.Nothing})}),[i,m,p]),O=n.useMemo((function(){return{active:m,disabled:i}}),[m,i]);return l(t({},s,{id:v,role:"menuitem",tabIndex:-1,className:V(a,O),"aria-disabled":!0===i||void 0,onClick:y,onFocus:x,onPointerMove:S,onPointerLeave:g}),O,le)};var se=n.createContext(null);function fe(e){var t=n.useContext(se);if(null===t){var r=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,fe),r}return t}se.displayName="GroupContext";var de,pe=n.Fragment;function ve(e){var o,u=e.checked,i=e.onChange,a=e.className,c=r(e,["checked","onChange","className"]),s="headlessui-switch-"+I(),f=n.useContext(se),d=n.useCallback((function(){return i(!u)}),[i,u]),p=n.useCallback((function(e){if(C(e.currentTarget))return e.preventDefault();e.preventDefault(),d()}),[d]),m=n.useCallback((function(e){e.key!==v.Tab&&e.preventDefault(),e.key===v.Space&&d()}),[d]),b=n.useCallback((function(e){return e.preventDefault()}),[]),y=n.useMemo((function(){return{checked:u}}),[u]),h={id:s,ref:null===f?void 0:f.setSwitch,role:"switch",tabIndex:0,className:V(a,y),"aria-checked":u,"aria-labelledby":null==f||null==(o=f.label)?void 0:o.id,onClick:p,onKeyUp:m,onKeyPress:b};return"button"===c.as&&Object.assign(h,{type:"button"}),l(t({},c,h),y,"button")}function me(){var e=n.useRef(!0);return n.useEffect((function(){e.current=!1}),[]),e.current}function be(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 ye(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 he(e,n,t,r,o){var u=N(),i=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 be.apply(void 0,[e].concat(n,t)),u.nextFrame((function(){ye.apply(void 0,[e].concat(t)),be.apply(void 0,[e].concat(r)),u.add(function(e,n){var t=N();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(de.Finished)}),u+o[1]):n(de.Finished),t.add((function(){return n(de.Cancelled)})),t.dispose}(e,(function(t){return ye.apply(void 0,[e].concat(r,n)),i(t)})))})),u.add((function(){return ye.apply(void 0,[e].concat(n,t,r))})),u.add((function(){return i(de.Cancelled)})),u.dispose}function xe(e){return void 0===e&&(e=""),n.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}ve.Group=function(e){var t=n.useState(null),r=t[0],o=t[1],u=n.useState(null),i=u[0],a=u[1],c=n.useMemo((function(){return{switch:r,label:i,setSwitch:o,setLabel:a}}),[r,o,i,a]);return n.createElement(se.Provider,{value:c},l(e,{},pe))},ve.Label=function e(r){var o=fe([ve.name,e.name].join(".")),u="headlessui-switch-label-"+I(),i=n.useCallback((function(){o.switch&&(o.switch.click(),o.switch.focus({preventScroll:!0}))}),[o.switch]);return l(t({},r,{ref:o.setLabel,id:u,onPointerUp:i}),{},"label")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(de||(de={}));var Se,ge=n.createContext(null);ge.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Se||(Se={}));var Ie=n.createContext(null);function Ce(e){return"children"in e?Ce(e.children):e.current.filter((function(e){return e.state===Se.Visible})).length>0}function Oe(e){var t=n.useRef(e),r=n.useRef([]),o=function(){var e=n.useRef(!0);return n.useEffect((function(){return function(){e.current=!1}}),[]),e}();n.useEffect((function(){t.current=e}),[e]);var u=n.useCallback((function(e,n){var u;void 0===n&&(n=c.Hidden);var a=r.current.findIndex((function(n){return n.id===e}));-1!==a&&(i(n,((u={})[c.Unmount]=function(){r.current.splice(a,1)},u[c.Hidden]=function(){r.current[a].state=Se.Hidden},u)),!Ce(r)&&o.current&&(null==t.current||t.current()))}),[t,o,r]),a=n.useCallback((function(e){var n=r.current.find((function(n){return n.id===e}));return n?n.state!==Se.Visible&&(n.state=Se.Visible):r.current.push({id:e,state:Se.Visible}),function(){return u(e,c.Unmount)}}),[r,u]);return n.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function Ee(){}Ie.displayName="NestingContext";var we=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Re(e){return we.reduce((function(n,t){return n[t]=e[t]||Ee,n}),{})}var ke=a.RenderStrategy;function Te(e){var o=e.beforeEnter,u=e.afterEnter,a=e.beforeLeave,s=e.afterLeave,f=e.enter,d=e.enterFrom,p=e.enterTo,v=e.leave,m=e.leaveFrom,b=e.leaveTo,y=r(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),x=n.useRef(null),S=n.useState(Se.Visible),g=S[0],C=S[1],O=y.unmount?c.Unmount:c.Hidden,E=function(){var e=n.useContext(ge);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),w=E.show,R=E.appear,k=function(){var e=n.useContext(Ie);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),T=k.register,D=k.unregister,L=me(),P=I(),F=n.useRef(!1),M=Oe((function(){F.current||(C(Se.Hidden),D(P),V.current.afterLeave())}));h((function(){if(P)return T(P)}),[T,P]),h((function(){var e;O===c.Hidden&&P&&(w&&g!==Se.Visible?C(Se.Visible):i(g,((e={})[Se.Hidden]=function(){return D(P)},e[Se.Visible]=function(){return T(P)},e)))}),[g,P,T,D,w,O]);var A=xe(f),U=xe(d),N=xe(p),j=xe(v),G=xe(m),H=xe(b),V=function(e){var t=n.useRef(Re(e));return n.useEffect((function(){t.current=Re(e)}),[e]),t}({beforeEnter:o,afterEnter:u,beforeLeave:a,afterLeave:s});n.useEffect((function(){if(g===Se.Visible&&null===x.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[x,g]);var Q=L&&!R;return h((function(){var e=x.current;if(e&&!Q)return F.current=!0,w&&V.current.beforeEnter(),w||V.current.beforeLeave(),w?he(e,A,U,N,(function(e){F.current=!1,e===de.Finished&&V.current.afterEnter()})):he(e,j,G,H,(function(e){F.current=!1,e===de.Finished&&(Ce(M)||(C(Se.Hidden),D(P),V.current.afterLeave()))}))}),[V,P,F,D,M,x,Q,w,A,U,N,j,G,H]),n.createElement(Ie.Provider,{value:M},l(t({},y,{ref:x}),{},"div",ke,g===Se.Visible))}function De(e){var o=e.show,u=e.appear,i=void 0!==u&&u,a=e.unmount,c=r(e,["show","appear","unmount"]);if(![!0,!1].includes(o))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=n.useState(o?Se.Visible:Se.Hidden),f=s[0],d=s[1],p=Oe((function(){d(Se.Hidden)})),v=me(),m=n.useMemo((function(){return{show:o,appear:i||!v}}),[o,i,v]);n.useEffect((function(){o?d(Se.Visible):Ce(p)||d(Se.Hidden)}),[o,p]);var b={unmount:a};return n.createElement(Ie.Provider,{value:p},n.createElement(ge.Provider,{value:m},l(t({},b,{as:n.Fragment,children:n.createElement(Te,Object.assign({},b,c))}),{},n.Fragment,ke,f===Se.Visible)))}De.Child=Te,e.Disclosure=T,e.Listbox=Y,e.Menu=ue,e.Switch=ve,e.Transition=De,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).headlessui={},e.React)}(this,(function(e,n){"use strict";var t,r,o,u="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 a(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 l(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 s(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 i=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(i,s),i}function f(e,n,o,u,c){if(void 0===c&&(c=!0),c)return d(e,n,o);var l=null!=u?u:t.None;if(l&t.Static){var f=e.static,p=void 0!==f&&f,v=a(e,["static"]);if(p)return d(v,n,o)}if(l&t.RenderStrategy){var m,b=e.unmount,y=void 0===b||b,h=a(e,["unmount"]);return s(y?r.Unmount:r.Hidden,((m={})[r.Unmount]=function(){return null},m[r.Hidden]=function(){return d(i({},h,{hidden:!0,style:{display:"none"}}),n,o)},m))}return d(e,n,o)}function d(e,t,r){var o,u=v(e,["unmount","static"]),i=u.as,c=void 0===i?r:i,s=u.children,f=u.refName,p=void 0===f?"ref":f,m=a(u,["as","children","refName"]),b=void 0!==e.ref?((o={})[p]=e.ref,o):{},y="function"==typeof s?s(t):s;if(c===n.Fragment&&Object.keys(m).length>0){if(Array.isArray(y)&&y.length>1){var h=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(h,d),h}if(!n.isValidElement(y)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,d),g}return n.cloneElement(y,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))},i=l(["onClick"]);!(r=i()).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}(v(m,["ref"])),y.props),b))}return n.createElement(c,Object.assign({},v(m,["ref"]),c!==n.Fragment&&b),y)}function p(e){return n.forwardRef(e)}function v(e,n){void 0===n&&(n=[]);for(var t,r=Object.assign({},e),o=l(n);!(t=o()).done;){var u=t.value;u in r&&delete r[u]}return r}function m(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useCallback((function(e){t.forEach((function(n){if(null!==n)return"function"==typeof n?n(e):void(n.current=e)}))}),[t])}function b(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"}(t||(t={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(r||(r={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(o||(o={}));var y="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,h={serverHandoffComplete:!1},g=0;function S(){return++g}function x(){var e=n.useState(h.serverHandoffComplete?S:null),t=e[0],r=e[1];return y((function(){null===t&&r(S())}),[t]),n.useEffect((function(){!1===h.serverHandoffComplete&&(h.serverHandoffComplete=!0)}),[]),null!=t?""+t:void 0}var C,I,w,O=["[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 k(e){e&&e.focus({preventScroll:!0})}function E(e,t){void 0===t&&(t=!0);var r=n.useRef(null),u=n.useCallback((function(){return e.current?Array.from(e.current.querySelectorAll(O)):[]}),[e]);y((function(){if(t){r.current=document.activeElement;var e=u();if(e.length<=0)throw new Error("There are no focusable elements inside the <FocusTrap />");return k(e[0]),function(){return k(r.current)}}}),[t]);var i=n.useCallback((function(e){if(t&&e.key===o.Tab&&document.activeElement){e.preventDefault();var n=e.shiftKey?-1:1,r=u(),i=r.length;!function e(t){void 0===t&&(t=0);var o=r.indexOf(document.activeElement),u=r[(o+i+n+t)%i];k(u),u!==document.activeElement&&e(t+n)}()}}),[u,t]);return n.useMemo((function(){return{handleKeyDown:i}}),[i])}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(I||(I={})),function(e){e[e.ToggleDialog=0]="ToggleDialog",e[e.CloseDialog=1]="CloseDialog"}(w||(w={}));var R=((C={})[w.ToggleDialog]=function(e){var n;return i({},e,{dialogState:s(e.dialogState,(n={},n[I.Open]=I.Closed,n[I.Closed]=I.Open,n))})},C[w.CloseDialog]=function(e){return i({},e,{dialogState:I.Closed})},C),D=n.createContext(null);function T(e){var t=n.useContext(D);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+M.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,T),r}return t}function L(e,n){return s(n.type,R,e,n)}D.displayName="DialogContext";var F=n.Fragment;function M(e){var t=n.useReducer(L,{dialogState:I.Closed}),r=t[0].dialogState,i=t[1];n.useEffect((function(){function e(e){e.key===o.Escape&&r===I.Open&&i({type:w.CloseDialog})}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[i,r]);var a=n.useMemo((function(){return{open:r===I.Open}}),[r]);return u.createElement(D.Provider,{value:t},f(e,a,F))}var P,A,j,N=p((function e(t,r){var u=T([M.name,e.name].join(".")),a=u[0],c=u[1],l=m(r),s="headlessui-dialog-button-"+x(),d=n.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();if(!t.disabled)switch(e.key){case o.Space:case o.Enter:e.preventDefault(),c({type:w.ToggleDialog})}}),[c,t.disabled]),p=n.useCallback((function(e){b(e.currentTarget)||t.disabled||c({type:w.ToggleDialog})}),[c,t.disabled]),v=n.useMemo((function(){return{open:a.dialogState===I.Open}}),[a]);return f(i({},t,{ref:l,id:s,type:"button",onKeyDown:d,onClick:p}),v,"button")})),U=t.RenderStrategy|t.Static,G=p((function e(t,r){var u=T([M.name,e.name].join(".")),a=u[0],c=u[1],l=n.useRef(null),s=m(l,r),d=E(l,!!t.static||a.dialogState===I.Open).handleKeyDown,p="headlessui-dialog-panel-"+x(),v=n.useCallback((function(){return c({type:w.CloseDialog})}),[c]),b=n.useCallback((function(e){switch(e.key){case o.Escape:e.preventDefault(),c({type:w.CloseDialog});break;default:d(e)}}),[c,d]),y=n.useMemo((function(){return{open:a.dialogState===I.Open,close:v}}),[a,v]);return f(i({},t,{ref:s,id:p,role:"dialog","aria-modal":!0,onKeyDown:b}),y,"div",U,a.dialogState===I.Open)})),H=t.RenderStrategy|t.Static,V=p((function e(t,r){var o=T([M.name,e.name].join(".")),u=o[0],a=o[1],c=m(r),l="headlessui-dialog-overlay-"+x(),s=n.useCallback((function(){return a({type:w.CloseDialog})}),[a]),d=n.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();a({type:w.CloseDialog})}),[a]),p=n.useMemo((function(){return{open:u.dialogState===I.Open,close:s}}),[u,s]);return f(i({},t,{ref:c,id:l,onClick:d}),p,"button",H,u.dialogState===I.Open)}));M.Button=N,M.Panel=G,M.Overlay=V,function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(A||(A={})),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"}(j||(j={}));var B=((P={})[j.ToggleDisclosure]=function(e){var n;return i({},e,{disclosureState:s(e.disclosureState,(n={},n[A.Open]=A.Closed,n[A.Closed]=A.Open,n))})},P[j.LinkPanel]=function(e){return i({},e,{linkedPanel:!0})},P[j.UnlinkPanel]=function(e){return i({},e,{linkedPanel:!1})},P[j.SetButtonId]=function(e,n){return i({},e,{buttonId:n.buttonId})},P[j.SetPanelId]=function(e,n){return i({},e,{panelId:n.panelId})},P),Q=n.createContext(null);function K(e){var t=n.useContext(Q);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+Y.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,K),r}return t}function q(e,n){return s(n.type,B,e,n)}Q.displayName="DisclosureContext";var W=n.Fragment;function Y(e){var t="headlessui-disclosure-button-"+x(),r="headlessui-disclosure-panel-"+x(),o=n.useReducer(q,{disclosureState:A.Closed,linkedPanel:!1,buttonId:t,panelId:r}),i=o[0].disclosureState,a=o[1];n.useEffect((function(){return a({type:j.SetButtonId,buttonId:t})}),[t,a]),n.useEffect((function(){return a({type:j.SetPanelId,panelId:r})}),[r,a]);var c=n.useMemo((function(){return{open:i===A.Open}}),[i]);return u.createElement(Q.Provider,{value:o},f(e,c,W))}var _=p((function e(t,r){var u=K([Y.name,e.name].join(".")),a=u[0],c=u[1],l=m(r),s=n.useCallback((function(e){switch(e.key){case o.Space:case o.Enter:e.preventDefault(),c({type:j.ToggleDisclosure})}}),[c]),d=n.useCallback((function(e){b(e.currentTarget)||t.disabled||c({type:j.ToggleDisclosure})}),[c,t.disabled]),p=n.useMemo((function(){return{open:a.disclosureState===A.Open}}),[a]);return f(i({},t,{ref:l,id:a.buttonId,type:"button","aria-expanded":a.disclosureState===A.Open||void 0,"aria-controls":a.linkedPanel?a.panelId:void 0,onKeyDown:s,onClick:d}),p,"button")})),$=t.RenderStrategy|t.Static,z=p((function e(t,r){var o=K([Y.name,e.name].join(".")),a=o[0],c=o[1],l=m(r,(function(){a.linkedPanel||c({type:j.LinkPanel})}));n.useEffect((function(){return function(){return c({type:j.UnlinkPanel})}}),[c]),u.useEffect((function(){var e;a.disclosureState!==A.Closed||null!=(e=t.unmount)&&!e||c({type:j.UnlinkPanel})}),[a.disclosureState,t.unmount,c]);var s=u.useMemo((function(){return{open:a.disclosureState===A.Open}}),[a]);return f(i({},t,{ref:l,id:a.panelId}),s,"div",$,a.disclosureState===A.Open)}));Y.Button=_,Y.Panel=z;var J,X,Z,ee,ne=p((function(e,t){var r=n.useRef(null),o=m(r,t),u=E(r).handleKeyDown,a=n.useMemo((function(){return{}}),[]);return f(i({},e,{ref:o,onKeyDown:u}),a,"div")}));function te(){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=l(e.splice(0));!(n=t()).done;)(0,n.value)()}};return n}function re(){var e=n.useState(te)[0];return n.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function oe(e,t){var r=n.useState(e),o=r[0],u=r[1],i=n.useRef(e);return y((function(){i.current=e}),[e]),y((function(){return u(i.current)}),[i,u].concat(t)),o}function ue(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 J.First:return t.findIndex((function(e){return!n.resolveDisabled(e)}));case J.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 J.Next:return t.findIndex((function(e,t){return!(t<=o||n.resolveDisabled(e))}));case J.Last:var u=t.slice().reverse().findIndex((function(e){return!n.resolveDisabled(e)}));return-1===u?u:t.length-1-u;case J.Specific:return t.findIndex((function(t){return n.resolveId(t)===e.id}));case J.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?r:u}function ie(e,n){if(void 0!==e)return"function"==typeof e?e(n):e}!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"}(J||(J={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Z||(Z={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption"}(ee||(ee={}));var ae=((X={})[ee.CloseListbox]=function(e){return i({},e,{activeOptionIndex:null,listboxState:Z.Closed})},X[ee.OpenListbox]=function(e){return i({},e,{listboxState:Z.Open})},X[ee.GoToOption]=function(e,n){var t=ue(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})},X[ee.Search]=function(e,n){var t=e.searchQuery+n.value,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})},X[ee.ClearSearch]=function(e){return i({},e,{searchQuery:""})},X[ee.RegisterOption]=function(e,n){return i({},e,{options:[].concat(e.options,[{id:n.id,dataRef:n.dataRef}])})},X[ee.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)})},X),ce=n.createContext(null);function le(e){var t=n.useContext(ce);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+de.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,le),r}return t}function se(e,n){return s(n.type,ae,e,n)}ce.displayName="ListboxContext";var fe=n.Fragment;function de(e){var t=e.value,r=e.onChange,o=a(e,["value","onChange"]),i=re(),c=n.useReducer(se,{listboxState:Z.Closed,propsRef:{current:{value:t,onChange:r}},labelRef:n.createRef(),buttonRef:n.createRef(),optionsRef:n.createRef(),options:[],searchQuery:"",activeOptionIndex:null}),l=c[0],s=l.listboxState,d=l.propsRef,p=l.optionsRef,v=l.buttonRef,m=c[1];y((function(){d.current.value=t}),[t,d]),y((function(){d.current.onChange=r}),[r,d]),n.useEffect((function(){function e(e){var n,t,r,o=e.target,u=document.activeElement;s===Z.Open&&((null==(n=v.current)?void 0:n.contains(o))||((null==(t=p.current)?void 0:t.contains(o))||m({type:ee.CloseListbox}),u!==document.body&&(null==u?void 0:u.contains(o))||e.defaultPrevented||null==(r=v.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[s,p,v,i,m]);var b=n.useMemo((function(){return{open:s===Z.Open}}),[s]);return u.createElement(ce.Provider,{value:c},f(o,b,fe))}var pe,ve,me,be=p((function e(t,r){var u,a=le([de.name,e.name].join(".")),c=a[0],l=a[1],s=m(c.buttonRef,r),d="headlessui-listbox-button-"+x(),p=re(),v=n.useCallback((function(e){switch(e.key){case o.Space:case o.Enter:case o.ArrowDown:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:J.First})}));break;case o.ArrowUp:e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ee.GoToOption,focus:J.Last})}))}}),[l,c,p]),y=n.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();t.disabled||(c.listboxState===Z.Open?(l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:ee.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,t.disabled]),h=oe((function(){if(c.labelRef.current)return[c.labelRef.current.id,d].join(" ")}),[c.labelRef.current,d]),g=n.useMemo((function(){return{open:c.listboxState===Z.Open}}),[c]);return f(i({},t,{ref:s,id:d,type:"button","aria-haspopup":!0,"aria-controls":null==(u=c.optionsRef.current)?void 0:u.id,"aria-expanded":c.listboxState===Z.Open||void 0,"aria-labelledby":h,onKeyDown:v,onClick:y}),g,"button")})),ye=t.RenderStrategy|t.Static,he=p((function e(t,r){var u,a=le([de.name,e.name].join(".")),c=a[0],l=a[1],s=m(c.optionsRef,r),d="headlessui-listbox-options-"+x(),p=re(),v=re(),b=n.useCallback((function(e){switch(v.dispose(),e.key){case o.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:ee.Search,value:e.key});case o.Enter:e.preventDefault(),l({type:ee.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),te().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case o.ArrowDown:return e.preventDefault(),l({type:ee.GoToOption,focus:J.Next});case o.ArrowUp:return e.preventDefault(),l({type:ee.GoToOption,focus:J.Previous});case o.Home:case o.PageUp:return e.preventDefault(),l({type:ee.GoToOption,focus:J.First});case o.End:case o.PageDown:return e.preventDefault(),l({type:ee.GoToOption,focus:J.Last});case o.Escape:return e.preventDefault(),l({type:ee.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case o.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:ee.Search,value:e.key}),v.setTimeout((function(){return l({type:ee.ClearSearch})}),350))}}),[p,l,v,c]),y=oe((function(){var e,n,t;return null!=(e=null==(n=c.labelRef.current)?void 0:n.id)?e:null==(t=c.buttonRef.current)?void 0:t.id}),[c.labelRef.current,c.buttonRef.current]),h=n.useMemo((function(){return{open:c.listboxState===Z.Open}}),[c]);return f(i({},t,{"aria-activedescendant":null===c.activeOptionIndex||null==(u=c.options[c.activeOptionIndex])?void 0:u.id,"aria-labelledby":y,id:d,onKeyDown:b,role:"listbox",tabIndex:0,ref:s}),h,"ul",ye,c.listboxState===Z.Open)}));de.Button=be,de.Label=function e(t){var r=le([de.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===Z.Open}}),[r]);return f(i({},t,{ref:r.labelRef,id:o,onClick:u}),a,"label")},de.Options=he,de.Option=function e(t){var r=t.disabled,o=void 0!==r&&r,u=t.value,c=t.className,l=a(t,["disabled","value","className"]),s=le([de.name,e.name].join(".")),d=s[0],p=s[1],v="headlessui-listbox-option-"+x(),m=null!==d.activeOptionIndex&&d.options[d.activeOptionIndex].id===v,b=d.propsRef.current.value===u,h=n.useRef({disabled:o,value:u});y((function(){h.current.disabled=o}),[h,o]),y((function(){h.current.value=u}),[h,u]),y((function(){var e,n;h.current.textValue=null==(e=document.getElementById(v))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[h,v]);var g=n.useCallback((function(){return d.propsRef.current.onChange(u)}),[d.propsRef,u]);y((function(){return p({type:ee.RegisterOption,id:v,dataRef:h}),function(){return p({type:ee.UnregisterOption,id:v})}}),[h,v]),y((function(){var e;d.listboxState===Z.Open&&b&&(p({type:ee.GoToOption,focus:J.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[d.listboxState]),y((function(){if(d.listboxState===Z.Open&&m){var e=te();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[m,d.listboxState]);var S=n.useCallback((function(e){if(o)return e.preventDefault();g(),p({type:ee.CloseListbox}),te().nextFrame((function(){var e;return null==(e=d.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,d.buttonRef,o,g]),C=n.useCallback((function(){if(o)return p({type:ee.GoToOption,focus:J.Nothing});p({type:ee.GoToOption,focus:J.Specific,id:v})}),[o,v,p]),I=n.useCallback((function(){o||m||p({type:ee.GoToOption,focus:J.Specific,id:v})}),[o,m,v,p]),w=n.useCallback((function(){o||m&&p({type:ee.GoToOption,focus:J.Nothing})}),[o,m,p]),O=n.useMemo((function(){return{active:m,selected:b,disabled:o}}),[m,b,o]);return f(i({},l,{id:v,role:"option",tabIndex:-1,className:ie(c,O),"aria-disabled":!0===o||void 0,"aria-selected":!0===b||void 0,onClick:S,onFocus:C,onPointerMove:I,onMouseMove:I,onPointerLeave:w,onMouseLeave:w}),O,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(ve||(ve={})),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"}(me||(me={}));var ge=((pe={})[me.CloseMenu]=function(e){return i({},e,{activeItemIndex:null,menuState:ve.Closed})},pe[me.OpenMenu]=function(e){return i({},e,{menuState:ve.Open})},pe[me.GoToItem]=function(e,n){var t=ue(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})},pe[me.Search]=function(e,n){var t=e.searchQuery+n.value,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})},pe[me.ClearSearch]=function(e){return i({},e,{searchQuery:""})},pe[me.RegisterItem]=function(e,n){return i({},e,{items:[].concat(e.items,[{id:n.id,dataRef:n.dataRef}])})},pe[me.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)})},pe),Se=n.createContext(null);function xe(e){var t=n.useContext(Se);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+we.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,xe),r}return t}function Ce(e,n){return s(n.type,ge,e,n)}Se.displayName="MenuContext";var Ie=n.Fragment;function we(e){var t=n.useReducer(Ce,{menuState:ve.Closed,buttonRef:n.createRef(),itemsRef:n.createRef(),items:[],searchQuery:"",activeItemIndex:null}),r=t[0],o=r.menuState,i=r.itemsRef,a=r.buttonRef,c=t[1];n.useEffect((function(){function e(e){var n,t,r,u=e.target,l=document.activeElement;o===ve.Open&&((null==(n=a.current)?void 0:n.contains(u))||((null==(t=i.current)?void 0:t.contains(u))||c({type:me.CloseMenu}),l!==document.body&&(null==l?void 0:l.contains(u))||e.defaultPrevented||null==(r=a.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[o,i,a,c]);var l=n.useMemo((function(){return{open:o===ve.Open}}),[o]);return u.createElement(Se.Provider,{value:t},f(e,l,Ie))}var Oe=p((function e(t,r){var u,a=xe([we.name,e.name].join(".")),c=a[0],l=a[1],s=m(c.buttonRef,r),d="headlessui-menu-button-"+x(),p=re(),v=n.useCallback((function(e){switch(e.key){case o.Space:case o.Enter:case o.ArrowDown:e.preventDefault(),l({type:me.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:me.GoToItem,focus:J.First})}));break;case o.ArrowUp:e.preventDefault(),l({type:me.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:me.GoToItem,focus:J.Last})}))}}),[l,c,p]),y=n.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();t.disabled||(c.menuState===ve.Open?(l({type:me.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:me.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,t.disabled]),h=n.useMemo((function(){return{open:c.menuState===ve.Open}}),[c]);return f(i({},t,{ref:s,id:d,type:"button","aria-haspopup":!0,"aria-controls":null==(u=c.itemsRef.current)?void 0:u.id,"aria-expanded":c.menuState===ve.Open||void 0,onKeyDown:v,onClick:y}),h,"button")})),ke=t.RenderStrategy|t.Static,Ee=p((function e(t,r){var u,a,c=xe([we.name,e.name].join(".")),l=c[0],s=c[1],d=m(l.itemsRef,r),p="headlessui-menu-items-"+x(),v=re(),b=n.useCallback((function(e){switch(v.dispose(),e.key){case o.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:me.Search,value:e.key});case o.Enter:var n;e.preventDefault(),s({type:me.CloseMenu}),null!==l.activeItemIndex&&(null==(n=document.getElementById(l.items[l.activeItemIndex].id))||n.click()),te().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case o.ArrowDown:return e.preventDefault(),s({type:me.GoToItem,focus:J.Next});case o.ArrowUp:return e.preventDefault(),s({type:me.GoToItem,focus:J.Previous});case o.Home:case o.PageUp:return e.preventDefault(),s({type:me.GoToItem,focus:J.First});case o.End:case o.PageDown:return e.preventDefault(),s({type:me.GoToItem,focus:J.Last});case o.Escape:e.preventDefault(),s({type:me.CloseMenu}),te().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case o.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:me.Search,value:e.key}),v.setTimeout((function(){return s({type:me.ClearSearch})}),350))}}),[s,v,l]),y=n.useMemo((function(){return{open:l.menuState===ve.Open}}),[l]);return f(i({},t,{"aria-activedescendant":null===l.activeItemIndex||null==(u=l.items[l.activeItemIndex])?void 0:u.id,"aria-labelledby":null==(a=l.buttonRef.current)?void 0:a.id,id:p,onKeyDown:b,role:"menu",tabIndex:0,ref:d}),y,"div",ke,l.menuState===ve.Open)})),Re=n.Fragment;we.Button=Oe,we.Items=Ee,we.Item=function e(t){var r=t.disabled,o=void 0!==r&&r,u=t.className,c=t.onClick,l=a(t,["disabled","className","onClick"]),s=xe([we.name,e.name].join(".")),d=s[0],p=s[1],v="headlessui-menu-item-"+x(),m=null!==d.activeItemIndex&&d.items[d.activeItemIndex].id===v,b=n.useRef({disabled:o});y((function(){b.current.disabled=o}),[b,o]),y((function(){var e,n;b.current.textValue=null==(e=document.getElementById(v))||null==(n=e.textContent)?void 0:n.toLowerCase()}),[b,v]),y((function(){return p({type:me.RegisterItem,id:v,dataRef:b}),function(){return p({type:me.UnregisterItem,id:v})}}),[b,v]);var h=n.useCallback((function(e){return o?e.preventDefault():(p({type:me.CloseMenu}),te().nextFrame((function(){var e;return null==(e=d.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),c?c(e):void 0)}),[p,d.buttonRef,o,c]),g=n.useCallback((function(){if(o)return p({type:me.GoToItem,focus:J.Nothing});p({type:me.GoToItem,focus:J.Specific,id:v})}),[o,v,p]),S=n.useCallback((function(){o||m||p({type:me.GoToItem,focus:J.Specific,id:v})}),[o,m,v,p]),C=n.useCallback((function(){o||m&&p({type:me.GoToItem,focus:J.Nothing})}),[o,m,p]),I=n.useMemo((function(){return{active:m,disabled:o}}),[m,o]);return f(i({},l,{id:v,role:"menuitem",tabIndex:-1,className:ie(u,I),"aria-disabled":!0===o||void 0,onClick:h,onFocus:g,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C}),I,Re)};var De=n.createContext(null);function Te(e){var t=n.useContext(De);if(null===t){var r=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Te),r}return t}De.displayName="GroupContext";var Le,Fe=n.Fragment;function Me(e){var t,r,u=e.checked,c=e.onChange,l=e.className,s=a(e,["checked","onChange","className"]),d="headlessui-switch-"+x(),p=n.useContext(De),v=n.useCallback((function(){return c(!u)}),[c,u]),m=n.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),y=n.useCallback((function(e){e.key!==o.Tab&&e.preventDefault(),e.key===o.Space&&v()}),[v]),h=n.useCallback((function(e){return e.preventDefault()}),[]),g=n.useMemo((function(){return{checked:u}}),[u]),S={id:d,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:ie(l,g),"aria-checked":u,"aria-labelledby":null==p||null==(t=p.label)?void 0:t.id,"aria-describedby":null==p||null==(r=p.description)?void 0:r.id,onClick:m,onKeyUp:y,onKeyPress:h};return"button"===s.as&&Object.assign(S,{type:"button"}),f(i({},s,S),g,"button")}function Pe(){var e=n.useRef(!0);return n.useEffect((function(){e.current=!1}),[]),e.current}function Ae(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 je(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 Ne(e,n,t,r,o){var u=te(),i=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 Ae.apply(void 0,[e].concat(n,t)),u.nextFrame((function(){je.apply(void 0,[e].concat(t)),Ae.apply(void 0,[e].concat(r)),u.add(function(e,n){var t=te();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(Le.Finished)}),u+o[1]):n(Le.Finished),t.add((function(){return n(Le.Cancelled)})),t.dispose}(e,(function(t){return je.apply(void 0,[e].concat(r,n)),i(t)})))})),u.add((function(){return je.apply(void 0,[e].concat(n,t,r))})),u.add((function(){return i(Le.Cancelled)})),u.dispose}function Ue(e){return void 0===e&&(e=""),n.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Me.Group=function(e){var t=n.useState(null),r=t[0],o=t[1],i=n.useState(null),a=i[0],c=i[1],l=n.useState(null),s=l[0],d=l[1],p=n.useMemo((function(){return{switch:r,setSwitch:o,label:a,setLabel:c,description:s,setDescription:d}}),[r,o,a,c,s,d]);return u.createElement(De.Provider,{value:p},f(e,{},Fe))},Me.Label=function e(t){var r=Te([Me.name,e.name].join(".")),o="headlessui-switch-label-"+x(),u=n.useCallback((function(){r.switch&&(r.switch.click(),r.switch.focus({preventScroll:!0}))}),[r.switch]);return f(i({},t,{ref:r.setLabel,id:o,onClick:u}),{},"label")},Me.Description=function e(n){var t=Te([Me.name,e.name].join(".")),r="headlessui-switch-description-"+x();return f(i({},n,{ref:t.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Le||(Le={}));var Ge,He=n.createContext(null);He.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Ge||(Ge={}));var Ve=n.createContext(null);function Be(e){return"children"in e?Be(e.children):e.current.filter((function(e){return e.state===Ge.Visible})).length>0}function Qe(e){var t=n.useRef(e),o=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 i=n.useCallback((function(e,n){var i;void 0===n&&(n=r.Hidden);var a=o.current.findIndex((function(n){return n.id===e}));-1!==a&&(s(n,((i={})[r.Unmount]=function(){o.current.splice(a,1)},i[r.Hidden]=function(){o.current[a].state=Ge.Hidden},i)),!Be(o)&&u.current&&(null==t.current||t.current()))}),[t,u,o]),a=n.useCallback((function(e){var n=o.current.find((function(n){return n.id===e}));return n?n.state!==Ge.Visible&&(n.state=Ge.Visible):o.current.push({id:e,state:Ge.Visible}),function(){return i(e,r.Unmount)}}),[o,i]);return n.useMemo((function(){return{children:o,register:a,unregister:i}}),[a,i,o])}function Ke(){}Ve.displayName="NestingContext";var qe=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function We(e){for(var n,t={},r=l(qe);!(n=r()).done;){var o,u=n.value;t[u]=null!=(o=e[u])?o:Ke}return t}var Ye=t.RenderStrategy;function _e(e){var t=e.beforeEnter,o=e.afterEnter,c=e.beforeLeave,l=e.afterLeave,d=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,b=e.leaveFrom,h=e.leaveTo,g=a(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),S=n.useRef(null),C=n.useState(Ge.Visible),I=C[0],w=C[1],O=g.unmount?r.Unmount:r.Hidden,k=function(){var e=n.useContext(He);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),E=k.show,R=k.appear,D=function(){var e=n.useContext(Ve);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),T=D.register,L=D.unregister,F=Pe(),M=x(),P=n.useRef(!1),A=Qe((function(){P.current||(w(Ge.Hidden),L(M),B.current.afterLeave())}));y((function(){if(M)return T(M)}),[T,M]),y((function(){var e;O===r.Hidden&&M&&(E&&I!==Ge.Visible?w(Ge.Visible):s(I,((e={})[Ge.Hidden]=function(){return L(M)},e[Ge.Visible]=function(){return T(M)},e)))}),[I,M,T,L,E,O]);var j=Ue(d),N=Ue(p),U=Ue(v),G=Ue(m),H=Ue(b),V=Ue(h),B=function(e){var t=n.useRef(We(e));return n.useEffect((function(){t.current=We(e)}),[e]),t}({beforeEnter:t,afterEnter:o,beforeLeave:c,afterLeave:l});n.useEffect((function(){if(I===Ge.Visible&&null===S.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[S,I]);var Q=F&&!R;return y((function(){var e=S.current;if(e&&!Q)return P.current=!0,E&&B.current.beforeEnter(),E||B.current.beforeLeave(),E?Ne(e,j,N,U,(function(e){P.current=!1,e===Le.Finished&&B.current.afterEnter()})):Ne(e,G,H,V,(function(e){P.current=!1,e===Le.Finished&&(Be(A)||(w(Ge.Hidden),L(M),B.current.afterLeave()))}))}),[B,M,P,L,A,S,Q,E,j,N,U,G,H,V]),u.createElement(Ve.Provider,{value:A},f(i({},g,{ref:S}),{},"div",Ye,I===Ge.Visible))}function $e(e){var t=e.show,r=e.appear,o=void 0!==r&&r,c=e.unmount,l=a(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?Ge.Visible:Ge.Hidden),d=s[0],p=s[1],v=Qe((function(){p(Ge.Hidden)})),m=Pe(),b=n.useMemo((function(){return{show:t,appear:o||!m}}),[t,o,m]);n.useEffect((function(){t?p(Ge.Visible):Be(v)||p(Ge.Hidden)}),[t,v]);var y={unmount:c};return u.createElement(Ve.Provider,{value:v},u.createElement(He.Provider,{value:b},f(i({},y,{as:n.Fragment,children:u.createElement(_e,Object.assign({},y,l))}),{},n.Fragment,Ye,d===Ge.Visible)))}$e.Child=_e,e.Dialog=M,e.Disclosure=Y,e.FocusTrap=ne,e.Listbox=de,e.Menu=we,e.Switch=Me,e.Transition=$e,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=headlessui.umd.production.min.js.map

@@ -1,2 +0,2 @@

import * as React from 'react';
/// <reference types="react" />
export declare function useComputed<T>(cb: () => T, dependencies: React.DependencyList): T;

@@ -1,2 +0,2 @@

import * as React from 'react';
export declare function useIsMounted(): React.MutableRefObject<boolean>;
/// <reference types="react" />
export declare function useIsMounted(): import("react").MutableRefObject<boolean>;

@@ -1,2 +0,2 @@

import * as React from 'react';
export declare const useIsoMorphicEffect: typeof React.useLayoutEffect;
import { useLayoutEffect } from 'react';
export declare const useIsoMorphicEffect: typeof useLayoutEffect;

@@ -1,2 +0,2 @@

import * as React from 'react';
/// <reference types="react" />
export declare function useSyncRefs<TType>(...refs: (React.MutableRefObject<TType> | ((instance: TType) => void) | null)[]): (value: TType) => void;

@@ -0,2 +1,4 @@

export * from './components/dialog/dialog';
export * from './components/disclosure/disclosure';
export * from './components/focus-trap/focus-trap';
export * from './components/listbox/listbox';

@@ -3,0 +5,0 @@ export * from './components/menu/menu';

@@ -82,2 +82,3 @@ export declare function getMenuButton(): HTMLElement | null;

label?: string;
description?: string;
}, switchElement?: HTMLElement | null): void;

@@ -87,7 +88,7 @@ export declare function getDisclosureButton(): HTMLElement | null;

export declare enum DisclosureState {
/** The menu is visible to the user. */
/** The disclosure is visible to the user. */
Visible = 0,
/** The menu is **not** visible to the user. It's still in the DOM, but it is hidden. */
/** The disclosure is **not** visible to the user. It's still in the DOM, but it is hidden. */
InvisibleHidden = 1,
/** The menu is **not** visible to the user. It's not in the DOM, it is unmounted. */
/** The disclosure is **not** visible to the user. It's not in the DOM, it is unmounted. */
InvisibleUnmounted = 2

@@ -106,4 +107,31 @@ }

export declare function assertLabelValue(element: HTMLElement | null, value: string): void;
export declare function assertDescriptionValue(element: HTMLElement | null, value: string): void;
export declare function getDialogButton(): HTMLElement | null;
export declare function getDialogPanel(): HTMLElement | null;
export declare function getDialogOverlay(): HTMLElement | null;
export declare enum DialogState {
/** The dialog is visible to the user. */
Visible = 0,
/** The dialog is **not** visible to the user. It's still in the DOM, but it is hidden. */
InvisibleHidden = 1,
/** The dialog is **not** visible to the user. It's not in the DOM, it is unmounted. */
InvisibleUnmounted = 2
}
export declare function assertDialogButton(options: {
attributes?: Record<string, string | null>;
textContent?: string;
state: DialogState;
}, button?: HTMLElement | null): void;
export declare function assertDialogPanel(options: {
attributes?: Record<string, string | null>;
textContent?: string;
state: DialogState;
}, panel?: HTMLElement | null): void;
export declare function assertDialogOverlay(options: {
attributes?: Record<string, string | null>;
textContent?: string;
state: DialogState;
}, panel?: HTMLElement | null): void;
export declare function assertActiveElement(element: HTMLElement | null): void;
export declare function assertHidden(element: HTMLElement | null): void;
export declare function assertVisible(element: HTMLElement | null): void;

@@ -1,2 +0,2 @@

export declare const Keys: Record<string, Partial<KeyboardEvent>>;
export declare let Keys: Record<string, Partial<KeyboardEvent>>;
export declare function shift(event: Partial<KeyboardEvent>): {

@@ -48,4 +48,8 @@ shiftKey: boolean;

export declare function type(events: Partial<KeyboardEvent>[], element?: Element | null): Promise<void>;
export declare function press(event: Partial<KeyboardEvent>): Promise<void>;
export declare function click(element: Document | Element | Window | Node | null): Promise<void>;
export declare function press(event: Partial<KeyboardEvent>, element?: Element | null): Promise<void>;
export declare enum MouseButton {
Left = 0,
Right = 2
}
export declare function click(element: Document | Element | Window | Node | null, button?: MouseButton): Promise<void>;
export declare function focus(element: Document | Element | Window | Node | null): Promise<void>;

@@ -52,0 +56,0 @@ export declare function mouseEnter(element: Document | Element | Window | null): Promise<void>;

/// <reference types="react" />
declare const __: unique symbol;
export declare type __ = typeof __;
export declare type Expand<T> = T extends infer O ? {
[K in keyof O]: O[K];
} : never;
export declare type PropsOf<TTag = any> = TTag extends React.ElementType ? React.ComponentProps<TTag> : never;

@@ -5,0 +8,0 @@ export declare type Props<TTag, TSlot = {}, TOmitableProps extends keyof any = __> = {

@@ -1,3 +0,3 @@

import * as React from 'react';
import { Props, XOR, __ } from '../types';
import { ElementType, ReactElement } from 'react';
import { Props, XOR, __, Expand } from '../types';
export declare enum Features {

@@ -32,3 +32,3 @@ /** No features at all */

}>>;
export declare function render<TFeature extends Features, TTag extends React.ElementType, TBag>(props: Props<TTag, TBag, any> & PropsForFeatures<TFeature>, propsBag: TBag, defaultTag: React.ElementType, features?: TFeature, visible?: boolean): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
export declare function render<TFeature extends Features, TTag extends ElementType, TBag>(props: Expand<Props<TTag, TBag, any> & PropsForFeatures<TFeature>>, propsBag: TBag, defaultTag: ElementType, features?: TFeature, visible?: boolean): ReactElement<any, string | ((props: any) => ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)> | null;
/**

@@ -35,0 +35,0 @@ * This is a hack, but basically we want to keep the full 'API' of the component, but we do want to

{
"name": "@headlessui/react",
"version": "0.2.0-3597d07",
"version": "0.2.0-3dd74c1",
"main": "dist/index.js",

@@ -34,8 +34,8 @@ "typings": "dist/index.d.ts",

"devDependencies": {
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@popperjs/core": "^2.5.3",
"@testing-library/react": "^11.1.0",
"framer-motion": "^2.9.3",
"next": "9.5.5",
"@types/react": "^16.14.2",
"@types/react-dom": "^16.9.10",
"@popperjs/core": "^2.6.0",
"@testing-library/react": "^11.2.3",
"framer-motion": "^2.9.5",
"next": "10.0.5",
"react": "^16.14.0",

@@ -42,0 +42,0 @@ "react-dom": "^16.14.0",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc