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-80402e7

28

dist/components/listbox/listbox.d.ts

@@ -173,2 +173,26 @@ import * as React from 'react';

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">> & {

@@ -191,4 +215,4 @@ disabled?: boolean | undefined;

};
declare type ButtonPropsWeControl = 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'aria-labelledby' | 'onKeyDown' | 'onPointerUp';
declare type LabelPropsWeControl = 'id' | 'ref' | 'onPointerUp';
declare type ButtonPropsWeControl = 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'aria-labelledby' | 'onKeyDown' | 'onClick';
declare type LabelPropsWeControl = 'id' | 'ref' | 'onClick';
declare type LabelRenderPropArg = {

@@ -195,0 +219,0 @@ open: boolean;

@@ -165,2 +165,32 @@ import * as React from 'react';

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">> & {

@@ -187,3 +217,3 @@ disabled?: boolean | undefined;

};
declare type ButtonPropsWeControl = 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'onKeyDown' | 'onPointerUp';
declare type ButtonPropsWeControl = 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'onKeyDown' | 'onClick';
declare type ItemsRenderPropArg = {

@@ -190,0 +220,0 @@ open: boolean;

2

dist/components/switch/switch.d.ts

@@ -20,3 +20,3 @@ import * as React from 'react';

declare type LabelRenderPropArg = {};
declare type LabelPropsWeControl = 'id' | 'ref' | 'onPointerUp';
declare type LabelPropsWeControl = 'id' | 'ref' | 'onClick';
export {};

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

@@ -1,5 +0,4 @@

export * from './components/disclosure/disclosure';
export * from './components/transitions/transition';
export * from './components/menu/menu';
export * from './components/listbox/listbox';
export * from './components/menu/menu';
export * from './components/switch/switch';
export * from './components/transitions/transition';

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

}, switchElement?: HTMLElement | null): void;
export declare function getDisclosureButton(): HTMLElement | null;
export declare function getDisclosurePanel(): HTMLElement | null;
export declare enum DisclosureState {
/** The menu 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. */
InvisibleHidden = 1,
/** The menu is **not** visible to the user. It's not in the DOM, it is unmounted. */
InvisibleUnmounted = 2
}
export declare function assertDisclosureButton(options: {
attributes?: Record<string, string | null>;
textContent?: string;
state: DisclosureState;
}, button?: HTMLElement | null): void;
export declare function assertDisclosurePanel(options: {
attributes?: Record<string, string | null>;
textContent?: string;
state: DisclosureState;
}, panel?: HTMLElement | null): void;
export declare function assertLabelValue(element: HTMLElement | null, value: string): void;

@@ -105,0 +85,0 @@ export declare function assertActiveElement(element: HTMLElement | null): void;

@@ -49,3 +49,7 @@ export declare const Keys: Record<string, Partial<KeyboardEvent>>;

export declare function press(event: Partial<KeyboardEvent>): Promise<void>;
export declare function click(element: Document | Element | Window | Node | 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>;

{
"name": "@headlessui/react",
"version": "0.2.0-3597d07",
"version": "0.2.0-80402e7",
"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