@headlessui/react
Advanced tools
Comparing version 0.3.1-854cc83 to 0.3.1-a94cc79
@@ -146,3 +146,7 @@ import React, { ElementType, Ref, MutableRefObject } from 'react'; | ||
}), ref: Ref<HTMLDivElement>) => JSX.Element) & { | ||
Overlay: <TTag_1 extends React.ElementType<any> = "div">(props: Props<TTag_1, OverlayRenderPropArg, OverlayPropsWeControl>, ref: Ref<HTMLDivElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
displayName: string; | ||
} & { | ||
Overlay: (<TTag_1 extends React.ElementType<any> = "div">(props: Props<TTag_1, OverlayRenderPropArg, OverlayPropsWeControl>, ref: Ref<HTMLDivElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null) & { | ||
displayName: string; | ||
}; | ||
Title: typeof Title; | ||
@@ -149,0 +153,0 @@ Description: typeof Description; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n,r,o=require("react"),i=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,u=require("react-dom");function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);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(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){if(e in t){for(var n=t[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,o):n}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(e,r,o,i,u){if(void 0===u&&(u=!0),u)return p(e,r,o);var l=null!=i?i:t.None;if(l&t.Static){var s=e.static,d=void 0!==s&&s,v=c(e,["static"]);if(d)return p(v,r,o)}if(l&t.RenderStrategy){var m,b=e.unmount,h=void 0===b||b,y=c(e,["unmount"]);return f(h?n.Unmount:n.Hidden,((m={})[n.Unmount]=function(){return null},m[n.Hidden]=function(){return p(a({},y,{hidden:!0,style:{display:"none"}}),r,o)},m))}return p(e,r,o)}function p(e,t,n){var r,i=m(e,["unmount","static"]),u=i.as,a=void 0===u?n:u,l=i.children,f=i.refName,d=void 0===f?"ref":f,v=c(i,["as","children","refName"]),b=void 0!==e.ref?((r={})[d]=e.ref,r):{},h="function"==typeof l?l(t):l;if(a===o.Fragment&&Object.keys(v).length>0){if(Array.isArray(h)&&h.length>1){var y=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(y,p),y}if(!o.isValidElement(h)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,p),g}return o.cloneElement(h,Object.assign({},function(e,t,n){for(var r,o=Object.assign({},e),i=function(){var n,i=r.value;void 0!==e[i]&&void 0!==t[i]&&Object.assign(o,((n={})[i]=function(n){n.defaultPrevented||e[i](n),n.defaultPrevented||t[i](n)},n))},u=s(["onClick"]);!(r=u()).done;)i();return o}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(m(v,["ref"])),h.props),b))}return o.createElement(a,Object.assign({},m(v,["ref"]),a!==o.Fragment&&b),h)}function v(e){return Object.assign(o.forwardRef(e),{name:e.name})}function m(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),o=s(t);!(n=o()).done;){var i=n.value;i in r&&delete r[i]}return r}function b(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=o.useRef(t);return o.useEffect((function(){r.current=t}),[t]),o.useCallback((function(e){for(var t,n=s(r.current);!(t=n()).done;){var o=t.value;null!=o&&("function"==typeof o?o(e):o.current=e)}}),[r])}function h(e){for(var t,n,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var i=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!i||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(o))&&i}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(t||(t={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(n||(n={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(r||(r={}));var y="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,g={serverHandoffComplete:!1},w=0;function S(){return++w}function E(){var e=o.useState(g.serverHandoffComplete?S:null),t=e[0],n=e[1];return y((function(){null===t&&n(S())}),[t]),o.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=t?""+t:void 0}var x,C,I,O=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function k(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(O))}function R(e){return e.matches(O)}function L(e){null==e||e.focus({preventScroll:!0})}function P(e,t){var n=Array.isArray(e)?e:k(e),r=document.activeElement,o=function(){if(t&(x.First|x.Next))return I.Next;if(t&(x.Previous|x.Last))return I.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),i=function(){if(t&x.First)return 0;if(t&x.Previous)return Math.max(0,n.indexOf(r))-1;if(t&x.Next)return Math.max(0,n.indexOf(r))+1;if(t&x.Last)return n.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),u=t&x.NoScroll?{preventScroll:!0}:{},a=0,c=n.length,l=void 0;do{var s;if(a>=c||a+c<=0)return C.Error;var f=i+a;if(t&x.WrapAround)f=(f+c)%c;else{if(f<0)return C.Underflow;if(f>=c)return C.Overflow}null==(s=l=n[f])||s.focus(u),a+=o}while(l!==document.activeElement);return C.Success}function T(e,t,n){void 0===t&&(t=!0),void 0===n&&(n={});var i=o.useRef("undefined"!=typeof window?document.activeElement:null),u=o.useRef(null),a=o.useRef(!1);y((function(){var r,o;if(t&&e.current){a.current=!0;var c,l=document.activeElement;if(null==(r=n.initialFocus)?void 0:r.current){if((null==(c=n.initialFocus)?void 0:c.current)===l)return}else if(e.current.contains(l))return;if(i.current=l,null==(o=n.initialFocus)?void 0:o.current)L(n.initialFocus.current);else if(P(e.current,x.First)===C.Error)throw new Error("There are no focusable elements inside the <FocusTrap />");return u.current=document.activeElement,function(){a.current=!1,L(i.current),i.current=null,u.current=null}}}),[t,e,a,n.initialFocus]),y((function(){if(t)return window.addEventListener("keydown",n),function(){return window.removeEventListener("keydown",n)};function n(t){t.key===r.Tab&&document.activeElement&&e.current&&(t.preventDefault(),P(e.current,(t.shiftKey?x.Previous:x.Next)|x.WrapAround)===C.Success&&(u.current=document.activeElement))}}),[t]),y((function(){if(t&&e.current){var n=e.current;return window.addEventListener("focus",r,!0),function(){return window.removeEventListener("focus",r,!0)}}function r(e){var t=u.current;if(t&&a.current){var r=e.target;r&&r instanceof HTMLElement?n.contains(r)?(u.current=r,L(r)):(e.preventDefault(),e.stopPropagation(),L(t)):L(u.current)}}}),[t,a,e])}function D(e,t){return e(t={exports:{}},t.exports),t.exports}!function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"}(x||(x={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(C||(C={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(I||(I={}));var F=D((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new x(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=w(u,n);if(a){if(a===s)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function d(){}function p(){}var v={};v[o]=function(){return this};var m=Object.getPrototypeOf,b=m&&m(m(C([])));b&&b!==t&&n.call(b,o)&&(v=b);var h=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(o,i){function u(){return new t((function(r,u){!function r(o,i,u,a){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return d.prototype=h.constructor=p,p.constructor=d,d.displayName=a(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,u,"GeneratorFunction")),e.prototype=Object.create(h),e},e.awrap=function(e){return{__await:e}},y(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},y(h),a(h,u,"Generator"),h[o]=function(){return this},h.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return u.type="throw",u.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),M=F.mark(N);function N(e){var t;return F.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.parentElement){n.next=2;break}return n.abrupt("return");case 2:t=e.parentElement.firstChild;case 3:if(!t){n.next=10;break}if(!(t!==e&&t instanceof HTMLElement)){n.next=7;break}return n.next=7,t;case 7:t=t.nextSibling,n.next=3;break;case 10:case"end":return n.stop()}}),M)}var A,j,G,U=o.Fragment;function H(e){var t=o.useState((function(){if("undefined"==typeof window)return null;var e=document.getElementById("headlessui-portal-root");if(e)return e;var t=document.createElement("div");return t.setAttribute("id","headlessui-portal-root"),document.body.appendChild(t)}))[0],n=o.useState((function(){return"undefined"==typeof window?null:document.createElement("div")}))[0];return y((function(){if(t&&n)return t.appendChild(n),function(){t&&n&&(t.removeChild(n),t.childNodes.length<=0&&document.body.removeChild(t))}}),[t]),t&&n?u.createPortal(d(e,{},U),n):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(j||(j={})),function(e){e[e.SetTitleElement=0]="SetTitleElement",e[e.SetDescriptionElement=1]="SetDescriptionElement"}(G||(G={}));var B=((A={})[G.SetTitleElement]=function(e,t){return e.titleElement===t.element?e:a({},e,{titleElement:t.element})},A[G.SetDescriptionElement]=function(e,t){return e.descriptionElement===t.element?e:a({},e,{descriptionElement:t.element})},A),V=o.createContext(null);function _(e){var t=o.useContext(V);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+J.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,_),n}return t}function Q(e,t){return f(t.type,B,e,t)}V.displayName="DialogContext";var K,W,Y,q=t.RenderStrategy|t.Static,J=Object.assign(v((function(e,t){var n,u,l=e.open,f=e.onClose,p=e.initialFocus,v=c(e,["open","onClose","initialFocus"]),m=o.useRef(null),h=b(m,t),g=e.hasOwnProperty("open"),w=e.hasOwnProperty("onClose");if(!g&&!w)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!g)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!w)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof l)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+l);if("function"!=typeof f)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+f);var S=l?j.Open:j.Closed,x=o.useReducer(Q,{titleElement:null,descriptionElement:null}),C=x[0],I=x[1],O=o.useCallback((function(){return f(!1)}),[f]),k=o.useCallback((function(e){return I({type:G.SetTitleElement,element:e})}),[I]),R=o.useCallback((function(e){return I({type:G.SetDescriptionElement,element:e})}),[I]);o.useEffect((function(){function e(e){var t;S===j.Open&&((null==(t=m.current)?void 0:t.contains(e.target))||O())}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[S,m,O]),o.useEffect((function(){function e(e){e.key===r.Escape&&S===j.Open&&O()}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[O,S]),o.useEffect((function(){if(S===j.Open){var e=document.documentElement.style.overflow,t=document.documentElement.style.paddingRight,n=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=n+"px",function(){document.documentElement.style.overflow=e,document.documentElement.style.paddingRight=t}}}),[S]),o.useEffect((function(){if(S===j.Open&&m.current){var e=new IntersectionObserver((function(e){for(var t,n=s(e);!(t=n()).done;){var r=t.value;0===r.boundingClientRect.x&&0===r.boundingClientRect.y&&0===r.boundingClientRect.width&&0===r.boundingClientRect.height&&O()}}));return e.observe(m.current),function(){return e.disconnect()}}}),[S,m,O]);var L=!!e.static||S===j.Open;T(m,L,{initialFocus:p}),function(e,t){void 0===t&&(t=!0),y((function(){if(t&&e.current){for(var n,r=e.current,o=new Map,i=s(N(r));!(n=i()).done;){var u=n.value;o.set(u,{"aria-hidden":u.getAttribute("aria-hidden"),inert:u.inert})}document.querySelectorAll("body > *").forEach((function(e){e!==r&&e instanceof HTMLElement&&(e.contains(r)||o.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}))}));for(var a,c=s(o.keys());!(a=c()).done;){var l=a.value;l.setAttribute("aria-hidden","true"),l.inert=!0}return function(){for(var e,t=s(o.entries());!(e=t()).done;){var n=e.value,r=n[0],i=n[1];null!==r&&(null===i["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",i["aria-hidden"]),r.inert=i.inert)}o.clear()}}}),[t])}(m,L);var P="headlessui-dialog-"+E(),D=o.useMemo((function(){return[{dialogState:S,close:O,setTitle:k,setDescription:R},C]}),[S,C,O,k,R]),F=o.useMemo((function(){return{open:S===j.Open}}),[S]),M={ref:h,id:P,role:"dialog","aria-modal":S===j.Open||void 0,"aria-labelledby":null==(n=C.titleElement)?void 0:n.id,"aria-describedby":null==(u=C.descriptionElement)?void 0:u.id};return i.createElement(H,null,i.createElement(V.Provider,{value:D},d(a({},v,M),F,"div",q,S===j.Open)))})),{Overlay:v((function e(t,n){var r=_([J.name,e.name].join("."))[0],i=r.dialogState,u=r.close,c=b(n),l="headlessui-dialog-overlay-"+E(),s=o.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();u()}),[u]),f=o.useMemo((function(){return{open:i===j.Open}}),[i]);return d(a({},t,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")})),Title:function e(t){var n=_([J.name,e.name].join("."))[0],r=n.dialogState,i=n.setTitle,u="headlessui-dialog-title-"+E(),c=o.useMemo((function(){return{open:r===j.Open}}),[r]);return d(a({},t,{ref:i,id:u}),c,"h2")},Description:function e(t){var n=_([J.name,e.name].join("."))[0],r=n.dialogState,i=n.setDescription,u="headlessui-dialog-description-"+E(),c=o.useMemo((function(){return{open:r===j.Open}}),[r]);return d(a({},t,{ref:i,id:u}),c,"p")}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(W||(W={})),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 $=((K={})[Y.ToggleDisclosure]=function(e){var t;return a({},e,{disclosureState:f(e.disclosureState,(t={},t[W.Open]=W.Closed,t[W.Closed]=W.Open,t))})},K[Y.LinkPanel]=function(e){return!0===e.linkedPanel?e:a({},e,{linkedPanel:!0})},K[Y.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:a({},e,{linkedPanel:!1})},K[Y.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:a({},e,{buttonId:t.buttonId})},K[Y.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:a({},e,{panelId:t.panelId})},K),z=o.createContext(null);function X(e){var t=o.useContext(z);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+te.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,X),n}return t}function Z(e,t){return f(t.type,$,e,t)}z.displayName="DisclosureContext";var ee=o.Fragment;function te(e){var t="headlessui-disclosure-button-"+E(),n="headlessui-disclosure-panel-"+E(),r=o.useReducer(Z,{disclosureState:W.Closed,linkedPanel:!1,buttonId:t,panelId:n}),u=r[0].disclosureState,a=r[1];o.useEffect((function(){return a({type:Y.SetButtonId,buttonId:t})}),[t,a]),o.useEffect((function(){return a({type:Y.SetPanelId,panelId:n})}),[n,a]);var c=o.useMemo((function(){return{open:u===W.Open}}),[u]);return i.createElement(z.Provider,{value:r},d(e,c,ee))}var ne,re,oe,ie,ue=v((function e(t,n){var i=X([te.name,e.name].join(".")),u=i[0],c=i[1],l=b(n),s=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:e.preventDefault(),c({type:Y.ToggleDisclosure})}}),[c]),f=o.useCallback((function(e){h(e.currentTarget)||t.disabled||c({type:Y.ToggleDisclosure})}),[c,t.disabled]),p=o.useMemo((function(){return{open:u.disclosureState===W.Open}}),[u]);return d(a({},t,{ref:l,id:u.buttonId,type:"button","aria-expanded":u.disclosureState===W.Open||void 0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:s,onClick:f}),p,"button")})),ae=t.RenderStrategy|t.Static,ce=v((function e(t,n){var r=X([te.name,e.name].join(".")),i=r[0],u=r[1],c=b(n,(function(){i.linkedPanel||u({type:Y.LinkPanel})}));o.useEffect((function(){return function(){return u({type:Y.UnlinkPanel})}}),[u]),o.useEffect((function(){var e;i.disclosureState!==W.Closed||null!=(e=t.unmount)&&!e||u({type:Y.UnlinkPanel})}),[i.disclosureState,t.unmount,u]);var l=o.useMemo((function(){return{open:i.disclosureState===W.Open}}),[i]);return d(a({},t,{ref:c,id:i.panelId}),l,"div",ae,i.disclosureState===W.Open)}));function le(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=s(e.splice(0));!(t=n()).done;)(0,t.value)()}};return t}function se(){var e=o.useState(le)[0];return o.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function fe(e,t){var n=o.useState(e),r=n[0],i=n[1],u=o.useRef(e);return y((function(){u.current=e}),[e]),y((function(){return i(u.current)}),[u,i].concat(t)),r}function de(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),o=null!=r?r:-1,i=function(){switch(e.focus){case ne.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case ne.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==o&&r.length-n-1>=o||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case ne.Next:return n.findIndex((function(e,n){return!(n<=o||t.resolveDisabled(e))}));case ne.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case ne.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case ne.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?r:i}function pe(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}te.Button=ue,te.Panel=ce,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"}(ne||(ne={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(oe||(oe={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(ie||(ie={}));var ve=((re={})[ie.CloseListbox]=function(e){return e.disabled||e.listboxState===oe.Closed?e:a({},e,{activeOptionIndex:null,listboxState:oe.Closed})},re[ie.OpenListbox]=function(e){return e.disabled||e.listboxState===oe.Open?e:a({},e,{listboxState:oe.Open})},re[ie.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:a({},e,{disabled:t.disabled})},re[ie.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===oe.Closed)return e;var n=de(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===n?e:a({},e,{searchQuery:"",activeOptionIndex:n})},re[ie.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===oe.Closed)return e;var n=e.searchQuery+t.value,r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return a({},e,-1===r||r===e.activeOptionIndex?{searchQuery:n}:{searchQuery:n,activeOptionIndex:r})},re[ie.ClearSearch]=function(e){return e.disabled||e.listboxState===oe.Closed||""===e.searchQuery?e:a({},e,{searchQuery:""})},re[ie.RegisterOption]=function(e,t){return a({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},re[ie.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{options:n,activeOptionIndex:o===e.activeOptionIndex||null===r?null:n.indexOf(r)})},re),me=o.createContext(null);function be(e){var t=o.useContext(me);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+ge.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,be),n}return t}function he(e,t){return f(t.type,ve,e,t)}me.displayName="ListboxContext";var ye=o.Fragment;function ge(e){var t=e.value,n=e.onChange,r=e.disabled,u=void 0!==r&&r,a=c(e,["value","onChange","disabled"]),l=o.useReducer(he,{listboxState:oe.Closed,propsRef:{current:{value:t,onChange:n}},labelRef:o.createRef(),buttonRef:o.createRef(),optionsRef:o.createRef(),disabled:u,options:[],searchQuery:"",activeOptionIndex:null}),s=l[0],f=s.listboxState,p=s.propsRef,v=s.optionsRef,m=s.buttonRef,b=l[1];y((function(){p.current.value=t}),[t,p]),y((function(){p.current.onChange=n}),[n,p]),y((function(){return b({type:ie.SetDisabled,disabled:u})}),[u]),o.useEffect((function(){function e(e){var t,n,r,o=e.target;f===oe.Open&&((null==(t=m.current)?void 0:t.contains(o))||(null==(n=v.current)?void 0:n.contains(o))||(b({type:ie.CloseListbox}),R(o)||(e.preventDefault(),null==(r=m.current)||r.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[f,m,v,b]);var h=o.useMemo((function(){return{open:f===oe.Open,disabled:u}}),[f,u]);return i.createElement(me.Provider,{value:l},d(a,h,ye))}var we,Se,Ee,xe=v((function e(t,n){var i,u=be([ge.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.buttonRef,n),f="headlessui-listbox-button-"+E(),p=se(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ie.GoToOption,focus:ne.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ie.GoToOption,focus:ne.Last})}))}}),[l,c,p]),m=o.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();c.listboxState===oe.Open?(l({type:ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})})))}),[l,p,c]),y=fe((function(){if(c.labelRef.current)return[c.labelRef.current.id,f].join(" ")}),[c.labelRef.current,f]),g=o.useMemo((function(){return{open:c.listboxState===oe.Open,disabled:c.disabled}}),[c]);return d(a({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(i=c.optionsRef.current)?void 0:i.id,"aria-expanded":c.listboxState===oe.Open||void 0,"aria-labelledby":y,disabled:c.disabled,onKeyDown:v,onClick:m}),g,"button")})),Ce=t.RenderStrategy|t.Static,Ie=v((function e(t,n){var i,u=be([ge.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.optionsRef,n),f="headlessui-listbox-options-"+E(),p=se(),v=se(),m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:ie.Search,value:e.key});case r.Enter:e.preventDefault(),l({type:ie.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),le().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Next});case r.ArrowUp:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Previous});case r.Home:case r.PageUp:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.First});case r.End:case r.PageDown:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Last});case r.Escape:return e.preventDefault(),l({type:ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case r.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:ie.Search,value:e.key}),v.setTimeout((function(){return l({type:ie.ClearSearch})}),350))}}),[p,l,v,c]),h=fe((function(){var e,t,n;return null!=(e=null==(t=c.labelRef.current)?void 0:t.id)?e:null==(n=c.buttonRef.current)?void 0:n.id}),[c.labelRef.current,c.buttonRef.current]),y=o.useMemo((function(){return{open:c.listboxState===oe.Open}}),[c]);return d(a({},t,{"aria-activedescendant":null===c.activeOptionIndex||null==(i=c.options[c.activeOptionIndex])?void 0:i.id,"aria-labelledby":h,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),y,"ul",Ce,c.listboxState===oe.Open)}));ge.Button=xe,ge.Label=function e(t){var n=be([ge.name,e.name].join("."))[0],r="headlessui-listbox-label-"+E(),i=o.useCallback((function(){var e;return null==(e=n.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[n.buttonRef]),u=o.useMemo((function(){return{open:n.listboxState===oe.Open,disabled:n.disabled}}),[n]);return d(a({},t,{ref:n.labelRef,id:r,onClick:i}),u,"label")},ge.Options=Ie,ge.Option=function e(t){var n=t.disabled,r=void 0!==n&&n,i=t.value,u=t.className,l=c(t,["disabled","value","className"]),s=be([ge.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-listbox-option-"+E(),m=null!==f.activeOptionIndex&&f.options[f.activeOptionIndex].id===v,b=f.propsRef.current.value===i,h=o.useRef({disabled:r,value:i});y((function(){h.current.disabled=r}),[h,r]),y((function(){h.current.value=i}),[h,i]),y((function(){var e,t;h.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[h,v]);var g=o.useCallback((function(){return f.propsRef.current.onChange(i)}),[f.propsRef,i]);y((function(){return p({type:ie.RegisterOption,id:v,dataRef:h}),function(){return p({type:ie.UnregisterOption,id:v})}}),[h,v]),y((function(){var e;f.listboxState===oe.Open&&b&&(p({type:ie.GoToOption,focus:ne.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[f.listboxState]),y((function(){if(f.listboxState===oe.Open&&m){var e=le();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.listboxState]);var w=o.useCallback((function(e){if(r)return e.preventDefault();g(),p({type:ie.CloseListbox}),le().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,f.buttonRef,r,g]),S=o.useCallback((function(){if(r)return p({type:ie.GoToOption,focus:ne.Nothing});p({type:ie.GoToOption,focus:ne.Specific,id:v})}),[r,v,p]),x=o.useCallback((function(){r||m||p({type:ie.GoToOption,focus:ne.Specific,id:v})}),[r,m,v,p]),C=o.useCallback((function(){r||m&&p({type:ie.GoToOption,focus:ne.Nothing})}),[r,m,p]),I=o.useMemo((function(){return{active:m,selected:b,disabled:r}}),[m,b,r]);return d(a({},l,{id:v,role:"option",tabIndex:-1,className:pe(u,I),"aria-disabled":!0===r||void 0,"aria-selected":!0===b||void 0,onClick:w,onFocus:S,onPointerMove:x,onMouseMove:x,onPointerLeave:C,onMouseLeave:C}),I,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Se||(Se={})),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"}(Ee||(Ee={}));var Oe=((we={})[Ee.CloseMenu]=function(e){return e.menuState===Se.Closed?e:a({},e,{activeItemIndex:null,menuState:Se.Closed})},we[Ee.OpenMenu]=function(e){return e.menuState===Se.Open?e:a({},e,{menuState:Se.Open})},we[Ee.GoToItem]=function(e,t){var n=de(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===n?e:a({},e,{searchQuery:"",activeItemIndex:n})},we[Ee.Search]=function(e,t){var n=e.searchQuery+t.value,r=e.items.findIndex((function(e){var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))&&!e.dataRef.current.disabled}));return a({},e,-1===r||r===e.activeItemIndex?{searchQuery:n}:{searchQuery:n,activeItemIndex:r})},we[Ee.ClearSearch]=function(e){return""===e.searchQuery?e:a({},e,{searchQuery:""})},we[Ee.RegisterItem]=function(e,t){return a({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},we[Ee.UnregisterItem]=function(e,t){var n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{items:n,activeItemIndex:o===e.activeItemIndex||null===r?null:n.indexOf(r)})},we),ke=o.createContext(null);function Re(e){var t=o.useContext(ke);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+Te.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Re),n}return t}function Le(e,t){return f(t.type,Oe,e,t)}ke.displayName="MenuContext";var Pe=o.Fragment;function Te(e){var t=o.useReducer(Le,{menuState:Se.Closed,buttonRef:o.createRef(),itemsRef:o.createRef(),items:[],searchQuery:"",activeItemIndex:null}),n=t[0],r=n.menuState,u=n.itemsRef,a=n.buttonRef,c=t[1];o.useEffect((function(){function e(e){var t,n,o,i=e.target;r===Se.Open&&((null==(t=a.current)?void 0:t.contains(i))||(null==(n=u.current)?void 0:n.contains(i))||(c({type:Ee.CloseMenu}),R(i)||(e.preventDefault(),null==(o=a.current)||o.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[r,a,u,c]);var l=o.useMemo((function(){return{open:r===Se.Open}}),[r]);return i.createElement(ke.Provider,{value:t},d(e,l,Pe))}var De,Fe,Me,Ne=v((function e(t,n){var i,u=Re([Te.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.buttonRef,n),f="headlessui-menu-button-"+E(),p=se(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:Ee.GoToItem,focus:ne.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:Ee.GoToItem,focus:ne.Last})}))}}),[l,c,p]),m=o.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();t.disabled||(c.menuState===Se.Open?(l({type:Ee.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,t.disabled]),y=o.useMemo((function(){return{open:c.menuState===Se.Open}}),[c]);return d(a({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(i=c.itemsRef.current)?void 0:i.id,"aria-expanded":c.menuState===Se.Open||void 0,onKeyDown:v,onClick:m}),y,"button")})),Ae=t.RenderStrategy|t.Static,je=v((function e(t,n){var i,u,c=Re([Te.name,e.name].join(".")),l=c[0],s=c[1],f=b(l.itemsRef,n),p="headlessui-menu-items-"+E(),v=se();y((function(){var e=l.itemsRef.current;if(e&&l.menuState===Se.Open)for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});t.nextNode();)t.currentNode.setAttribute("role","none")}));var m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:Ee.Search,value:e.key});case r.Enter:var t;e.preventDefault(),s({type:Ee.CloseMenu}),null!==l.activeItemIndex&&(null==(t=document.getElementById(l.items[l.activeItemIndex].id))||t.click()),le().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Next});case r.ArrowUp:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Previous});case r.Home:case r.PageUp:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.First});case r.End:case r.PageDown:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Last});case r.Escape:e.preventDefault(),s({type:Ee.CloseMenu}),le().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:Ee.Search,value:e.key}),v.setTimeout((function(){return s({type:Ee.ClearSearch})}),350))}}),[s,v,l]),h=o.useMemo((function(){return{open:l.menuState===Se.Open}}),[l]);return d(a({},t,{"aria-activedescendant":null===l.activeItemIndex||null==(i=l.items[l.activeItemIndex])?void 0:i.id,"aria-labelledby":null==(u=l.buttonRef.current)?void 0:u.id,id:p,onKeyDown:m,role:"menu",tabIndex:0,ref:f}),h,"div",Ae,l.menuState===Se.Open)})),Ge=o.Fragment;Te.Button=Ne,Te.Items=je,Te.Item=function e(t){var n=t.disabled,r=void 0!==n&&n,i=t.className,u=t.onClick,l=c(t,["disabled","className","onClick"]),s=Re([Te.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-menu-item-"+E(),m=null!==f.activeItemIndex&&f.items[f.activeItemIndex].id===v;y((function(){if(f.menuState===Se.Open&&m){var e=le();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.menuState]);var b=o.useRef({disabled:r});y((function(){b.current.disabled=r}),[b,r]),y((function(){var e,t;b.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[b,v]),y((function(){return p({type:Ee.RegisterItem,id:v,dataRef:b}),function(){return p({type:Ee.UnregisterItem,id:v})}}),[b,v]);var h=o.useCallback((function(e){return r?e.preventDefault():(p({type:Ee.CloseMenu}),le().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[p,f.buttonRef,r,u]),g=o.useCallback((function(){if(r)return p({type:Ee.GoToItem,focus:ne.Nothing});p({type:Ee.GoToItem,focus:ne.Specific,id:v})}),[r,v,p]),w=o.useCallback((function(){r||m||p({type:Ee.GoToItem,focus:ne.Specific,id:v})}),[r,m,v,p]),S=o.useCallback((function(){r||m&&p({type:Ee.GoToItem,focus:ne.Nothing})}),[r,m,p]),x=o.useMemo((function(){return{active:m,disabled:r}}),[m,r]);return d(a({},l,{id:v,role:"menuitem",tabIndex:-1,className:pe(i,x),"aria-disabled":!0===r||void 0,onClick:h,onFocus:g,onPointerMove:w,onMouseMove:w,onPointerLeave:S,onMouseLeave:S}),x,Ge)},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Fe||(Fe={})),function(e){e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId"}(Me||(Me={}));var Ue=((De={})[Me.TogglePopover]=function(e){var t;return a({},e,{popoverState:f(e.popoverState,(t={},t[Fe.Open]=Fe.Closed,t[Fe.Closed]=Fe.Open,t))})},De[Me.ClosePopover]=function(e){return e.popoverState===Fe.Closed?e:a({},e,{popoverState:Fe.Closed})},De[Me.SetButton]=function(e,t){return e.button===t.button?e:a({},e,{button:t.button})},De[Me.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:a({},e,{buttonId:t.buttonId})},De[Me.SetPanel]=function(e,t){return e.panel===t.panel?e:a({},e,{panel:t.panel})},De[Me.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:a({},e,{panelId:t.panelId})},De),He=o.createContext(null);function Be(e){var t=o.useContext(He);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+We.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Be),n}return t}He.displayName="PopoverContext";var Ve=o.createContext(null);function _e(){return o.useContext(Ve)}Ve.displayName="PopoverGroupContext";var Qe=o.createContext(null);function Ke(e,t){return f(t.type,Ue,e,t)}function We(e){var t="headlessui-popover-button-"+E(),n="headlessui-popover-panel-"+E(),r=o.useReducer(Ke,{popoverState:Fe.Closed,linkedPanel:!1,button:null,buttonId:t,panel:null,panelId:n}),u=r[0],a=u.popoverState,c=u.button,l=u.panel,s=r[1];o.useEffect((function(){return s({type:Me.SetButtonId,buttonId:t})}),[t,s]),o.useEffect((function(){return s({type:Me.SetPanelId,panelId:n})}),[n,s]);var f=o.useMemo((function(){return{buttonId:t,panelId:n,close:function(){return s({type:Me.ClosePopover})}}}),[t,n,s]),p=_e(),v=null==p?void 0:p.registerPopover,m=o.useCallback((function(){var e;return null!=(e=null==p?void 0:p.isFocusWithinPopoverGroup())?e:(null==c?void 0:c.contains(document.activeElement))||(null==l?void 0:l.contains(document.activeElement))}),[p,c,l]);o.useEffect((function(){return null==v?void 0:v(f)}),[v,f]),o.useEffect((function(){if(a===Fe.Open)return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)};function e(){m()||c&&l&&s({type:Me.ClosePopover})}}),[a,m,p,c,l,s]),o.useEffect((function(){function e(e){var t=e.target;a===Fe.Open&&((null==c?void 0:c.contains(t))||(null==l?void 0:l.contains(t))||(s({type:Me.ClosePopover}),R(t)||(e.preventDefault(),null==c||c.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[a,c,l,s]);var b=o.useMemo((function(){return{open:a===Fe.Open}}),[a]);return i.createElement(He.Provider,{value:r},d(e,b,"div"))}Qe.displayName="PopoverPanelContext";var Ye=v((function e(t,n){var i=Be([We.name,e.name].join(".")),u=i[0],c=i[1],l=o.useRef(null),s=_e(),f=null==s?void 0:s.closeOthers,p=o.useContext(Qe),v=null!==p&&p===u.panelId,m=b(l,n,v?null:function(e){return c({type:Me.SetButton,button:e})}),y=o.useRef(null),g=o.useRef("undefined"==typeof window?null:document.activeElement);o.useEffect((function(){function e(){g.current=y.current,y.current=document.activeElement}return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)}}),[g,y]);var w=o.useCallback((function(e){var t;if(v){if(u.popoverState===Fe.Closed)return;switch(e.key){case r.Space:case r.Enter:e.preventDefault(),c({type:Me.ClosePopover}),null==(t=u.button)||t.focus()}}else switch(e.key){case r.Space:case r.Enter:e.preventDefault(),u.popoverState===Fe.Closed&&(null==f||f(u.buttonId)),c({type:Me.TogglePopover});break;case r.Escape:if(u.popoverState!==Fe.Open)return null==f?void 0:f(u.buttonId);if(!l.current)return;if(!l.current.contains(document.activeElement))return;c({type:Me.ClosePopover});break;case r.Tab:if(u.popoverState!==Fe.Open)return;if(!u.panel)return;if(!u.button)return;if(e.shiftKey){var n;if(!g.current)return;if(null==(n=u.button)?void 0:n.contains(g.current))return;if(u.panel.contains(g.current))return;var o=k(),i=o.indexOf(g.current);if(o.indexOf(u.button)>i)return;e.preventDefault(),e.stopPropagation(),P(u.panel,x.Last)}else e.preventDefault(),e.stopPropagation(),P(u.panel,x.First)}}),[c,u.popoverState,u.buttonId,u.button,u.panel,l,f,v]),S=o.useCallback((function(e){var t;if(!v&&u.popoverState===Fe.Open&&u.panel&&u.button)switch(e.key){case r.Tab:if(!g.current)return;if(null==(t=u.button)?void 0:t.contains(g.current))return;if(u.panel.contains(g.current))return;var n=k(),o=n.indexOf(g.current);if(n.indexOf(u.button)>o)return;e.preventDefault(),P(u.panel,x.Last)}}),[u.popoverState,u.panel,u.button,v]),E=o.useCallback((function(e){var n;h(e.currentTarget)||t.disabled||(v?(c({type:Me.ClosePopover}),null==(n=u.button)||n.focus()):(u.popoverState===Fe.Closed&&(null==f||f(u.buttonId)),c({type:Me.TogglePopover})))}),[c,u.button,u.popoverState,u.buttonId,t.disabled,f,v]),C=o.useMemo((function(){return{open:u.popoverState===Fe.Open}}),[u]);return d(a({},t,v?{type:"button",onKeyDown:w,onClick:E}:{ref:m,id:u.buttonId,type:"button","aria-expanded":u.popoverState===Fe.Open||void 0,"aria-controls":u.panel?u.panelId:void 0,onKeyDown:w,onKeyUp:S,onClick:E}),C,"button")})),qe=v((function e(t,n){var r=Be([We.name,e.name].join(".")),i=r[0].popoverState,u=r[1],c=b(n),l="headlessui-popover-overlay-"+E(),s=o.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();u({type:Me.ClosePopover})}),[u]),f=o.useMemo((function(){return{open:i===Fe.Open}}),[i]);return d(a({},t,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")})),Je=t.RenderStrategy|t.Static,$e=v((function e(t,n){var u=t.focus,l=void 0!==u&&u,s=c(t,["focus"]),f=Be([We.name,e.name].join(".")),p=f[0],v=f[1],m=o.useRef(null),h=b(m,n,(function(e){v({type:Me.SetPanel,panel:e})})),y=o.useCallback((function(e){var t;switch(e.key){case r.Escape:if(p.popoverState!==Fe.Open)return;if(!m.current)return;if(!m.current.contains(document.activeElement))return;e.preventDefault(),v({type:Me.ClosePopover}),null==(t=p.button)||t.focus()}}),[p,m,v]);o.useEffect((function(){return function(){return v({type:Me.SetPanel,panel:null})}}),[v]),o.useEffect((function(){var e;p.popoverState!==Fe.Closed||null!=(e=t.unmount)&&!e||v({type:Me.SetPanel,panel:null})}),[p.popoverState,t.unmount,v]),o.useEffect((function(){if(l&&p.popoverState===Fe.Open&&m.current){var e=document.activeElement;m.current.contains(e)||P(m.current,x.First)}}),[l,m,p.popoverState]),o.useEffect((function(){if(p.popoverState===Fe.Open&&m.current)return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)};function e(e){if(e.key===r.Tab&&document.activeElement&&m.current&&m.current.contains(document.activeElement)){e.preventDefault();var t,n=P(m.current,e.shiftKey?x.Previous:x.Next);if(n===C.Underflow)return null==(t=p.button)?void 0:t.focus();if(n===C.Overflow){if(!p.button)return;var o=k(),i=o.indexOf(p.button);P(o.splice(i+1).filter((function(e){var t;return!(null==(t=m.current)?void 0:t.contains(e))})),x.First)===C.Error&&P(document.body,x.First)}}}}),[l,m,p.popoverState,p.button]),o.useEffect((function(){if(l&&p.popoverState===Fe.Open&&m.current)return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)};function e(){var e;(null==(e=m.current)?void 0:e.contains(document.activeElement))||v({type:Me.ClosePopover})}}),[l,p.popoverState,v]);var g=o.useMemo((function(){return{open:p.popoverState===Fe.Open}}),[p]);return i.createElement(Qe.Provider,{value:p.panelId},d(a({},s,{ref:h,id:p.panelId,onKeyDown:y}),g,"div",Je,p.popoverState===Fe.Open))}));We.Button=Ye,We.Overlay=qe,We.Panel=$e,We.Group=function(e){var t=o.useRef(null),n=o.useState([]),r=n[0],u=n[1],c=o.useCallback((function(e){u((function(t){var n=t.indexOf(e);if(-1!==n){var r=t.slice();return r.splice(n,1),r}return t}))}),[u]),l=o.useCallback((function(e){return u((function(t){return[].concat(t,[e])})),function(){return c(e)}}),[u,c]),f=o.useCallback((function(){var e,n=document.activeElement;return!!(null==(e=t.current)?void 0:e.contains(n))||r.some((function(e){var t,r;return(null==(t=document.getElementById(e.buttonId))?void 0:t.contains(n))||(null==(r=document.getElementById(e.panelId))?void 0:r.contains(n))}))}),[t,r]),p=o.useCallback((function(e){for(var t,n=s(r);!(t=n()).done;){var o=t.value;o.buttonId!==e&&o.close()}}),[r]),v=o.useMemo((function(){return{registerPopover:l,unregisterPopover:c,isFocusWithinPopoverGroup:f,closeOthers:p}}),[l,c,f,p]),m=o.useMemo((function(){return{}}),[]);return i.createElement(Ve.Provider,{value:v},d(a({},e,{ref:t}),m,"div"))};var ze=o.createContext(null);function Xe(e){var t=o.useContext(ze);if(null===t){var n=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Xe),n}return t}ze.displayName="GroupContext";var Ze,et=o.Fragment;function tt(e){var t,n,i=e.checked,u=e.onChange,l=e.className,s=c(e,["checked","onChange","className"]),f="headlessui-switch-"+E(),p=o.useContext(ze),v=o.useCallback((function(){return u(!i)}),[u,i]),m=o.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),b=o.useCallback((function(e){e.key!==r.Tab&&e.preventDefault(),e.key===r.Space&&v()}),[v]),y=o.useCallback((function(e){return e.preventDefault()}),[]),g=o.useMemo((function(){return{checked:i}}),[i]),w={id:f,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:pe(l,g),"aria-checked":i,"aria-labelledby":null==p||null==(t=p.label)?void 0:t.id,"aria-describedby":null==p||null==(n=p.description)?void 0:n.id,onClick:m,onKeyUp:b,onKeyPress:y};return"button"===s.as&&Object.assign(w,{type:"button"}),d(a({},s,w),g,"button")}function nt(){var e=o.useRef(!0);return o.useEffect((function(){e.current=!1}),[]),e.current}function rt(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function ot(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function it(e,t,n,r,o){var i=le(),u=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return rt.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){ot.apply(void 0,[e].concat(n)),rt.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=le();if(!e)return n.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),i=o[0];return 0!==i?n.setTimeout((function(){t(Ze.Finished)}),i+o[1]):t(Ze.Finished),n.add((function(){return t(Ze.Cancelled)})),n.dispose}(e,(function(n){return ot.apply(void 0,[e].concat(r,t)),u(n)})))})),i.add((function(){return ot.apply(void 0,[e].concat(t,n,r))})),i.add((function(){return u(Ze.Cancelled)})),i.dispose}function ut(e){return void 0===e&&(e=""),o.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}tt.Group=function(e){var t=o.useState(null),n=t[0],r=t[1],u=o.useState(null),a=u[0],c=u[1],l=o.useState(null),s=l[0],f=l[1],p=o.useMemo((function(){return{switch:n,setSwitch:r,label:a,setLabel:c,description:s,setDescription:f}}),[n,r,a,c,s,f]);return i.createElement(ze.Provider,{value:p},d(e,{},et))},tt.Label=function e(t){var n=Xe([tt.name,e.name].join(".")),r="headlessui-switch-label-"+E(),i=o.useCallback((function(){n.switch&&(n.switch.click(),n.switch.focus({preventScroll:!0}))}),[n.switch]);return d(a({},t,{ref:n.setLabel,id:r,onClick:i}),{},"label")},tt.Description=function e(t){var n=Xe([tt.name,e.name].join(".")),r="headlessui-switch-description-"+E();return d(a({},t,{ref:n.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Ze||(Ze={}));var at,ct=o.createContext(null);ct.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(at||(at={}));var lt=o.createContext(null);function st(e){return"children"in e?st(e.children):e.current.filter((function(e){return e.state===at.Visible})).length>0}function ft(e){var t=o.useRef(e),r=o.useRef([]),i=function(){var e=o.useRef(!0);return o.useEffect((function(){return function(){e.current=!1}}),[]),e}();o.useEffect((function(){t.current=e}),[e]);var u=o.useCallback((function(e,o){var u;void 0===o&&(o=n.Hidden);var a=r.current.findIndex((function(t){return t.id===e}));-1!==a&&(f(o,((u={})[n.Unmount]=function(){r.current.splice(a,1)},u[n.Hidden]=function(){r.current[a].state=at.Hidden},u)),!st(r)&&i.current&&(null==t.current||t.current()))}),[t,i,r]),a=o.useCallback((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==at.Visible&&(t.state=at.Visible):r.current.push({id:e,state:at.Visible}),function(){return u(e,n.Unmount)}}),[r,u]);return o.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function dt(){}lt.displayName="NestingContext";var pt=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function vt(e){for(var t,n={},r=s(pt);!(t=r()).done;){var o,i=t.value;n[i]=null!=(o=e[i])?o:dt}return n}var mt=t.RenderStrategy;function bt(e){var t=e.beforeEnter,r=e.afterEnter,u=e.beforeLeave,l=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,b=e.leaveFrom,h=e.leaveTo,g=c(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),w=o.useRef(null),S=o.useState(at.Visible),x=S[0],C=S[1],I=g.unmount?n.Unmount:n.Hidden,O=function(){var e=o.useContext(ct);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),k=O.show,R=O.appear,L=function(){var e=o.useContext(lt);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),P=L.register,T=L.unregister,D=nt(),F=E(),M=o.useRef(!1),N=ft((function(){M.current||(C(at.Hidden),T(F),V.current.afterLeave())}));y((function(){if(F)return P(F)}),[P,F]),y((function(){var e;I===n.Hidden&&F&&(k&&x!==at.Visible?C(at.Visible):f(x,((e={})[at.Hidden]=function(){return T(F)},e[at.Visible]=function(){return P(F)},e)))}),[x,F,P,T,k,I]);var A=ut(s),j=ut(p),G=ut(v),U=ut(m),H=ut(b),B=ut(h),V=function(e){var t=o.useRef(vt(e));return o.useEffect((function(){t.current=vt(e)}),[e]),t}({beforeEnter:t,afterEnter:r,beforeLeave:u,afterLeave:l});o.useEffect((function(){if(x===at.Visible&&null===w.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[w,x]);var _=D&&!R;return y((function(){var e=w.current;if(e&&!_)return M.current=!0,k&&V.current.beforeEnter(),k||V.current.beforeLeave(),k?it(e,A,j,G,(function(e){M.current=!1,e===Ze.Finished&&V.current.afterEnter()})):it(e,U,H,B,(function(e){M.current=!1,e===Ze.Finished&&(st(N)||(C(at.Hidden),T(F),V.current.afterLeave()))}))}),[V,F,M,T,N,w,_,k,A,j,G,U,H,B]),i.createElement(lt.Provider,{value:N},d(a({},g,{ref:w}),{},"div",mt,x===at.Visible))}function ht(e){var t=e.show,n=e.appear,r=void 0!==n&&n,u=e.unmount,l=c(e,["show","appear","unmount"]);if(![!0,!1].includes(t))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=o.useState(t?at.Visible:at.Hidden),f=s[0],p=s[1],v=ft((function(){p(at.Hidden)})),m=nt(),b=o.useMemo((function(){return{show:t,appear:r||!m}}),[t,r,m]);o.useEffect((function(){t?p(at.Visible):st(v)||p(at.Hidden)}),[t,v]);var h={unmount:u};return i.createElement(lt.Provider,{value:v},i.createElement(ct.Provider,{value:b},d(a({},h,{as:o.Fragment,children:i.createElement(bt,Object.assign({},h,l))}),{},o.Fragment,mt,f===at.Visible)))}ht.Child=bt,exports.Dialog=J,exports.Disclosure=te,exports.FocusTrap=function(e){var t=o.useRef(null),n=e.initialFocus,r=c(e,["initialFocus"]);return T(t,!0,{initialFocus:n}),d(a({},r,{ref:t}),{},"div")},exports.Listbox=ge,exports.Menu=Te,exports.Popover=We,exports.Portal=H,exports.Switch=tt,exports.Transition=ht; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n,r,o=require("react"),i=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,u=require("react-dom");function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);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(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){if(e in t){for(var n=t[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,o):n}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(e,r,o,i,u){if(void 0===u&&(u=!0),u)return p(e,r,o);var l=null!=i?i:t.None;if(l&t.Static){var s=e.static,d=void 0!==s&&s,v=c(e,["static"]);if(d)return p(v,r,o)}if(l&t.RenderStrategy){var m,b=e.unmount,h=void 0===b||b,y=c(e,["unmount"]);return f(h?n.Unmount:n.Hidden,((m={})[n.Unmount]=function(){return null},m[n.Hidden]=function(){return p(a({},y,{hidden:!0,style:{display:"none"}}),r,o)},m))}return p(e,r,o)}function p(e,t,n){var r,i=m(e,["unmount","static"]),u=i.as,a=void 0===u?n:u,l=i.children,f=i.refName,d=void 0===f?"ref":f,v=c(i,["as","children","refName"]),b=void 0!==e.ref?((r={})[d]=e.ref,r):{},h="function"==typeof l?l(t):l;if(a===o.Fragment&&Object.keys(v).length>0){if(Array.isArray(h)&&h.length>1){var y=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(y,p),y}if(!o.isValidElement(h)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,p),g}return o.cloneElement(h,Object.assign({},function(e,t,n){for(var r,o=Object.assign({},e),i=function(){var n,i=r.value;void 0!==e[i]&&void 0!==t[i]&&Object.assign(o,((n={})[i]=function(n){n.defaultPrevented||e[i](n),n.defaultPrevented||t[i](n)},n))},u=s(["onClick"]);!(r=u()).done;)i();return o}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(m(v,["ref"])),h.props),b))}return o.createElement(a,Object.assign({},m(v,["ref"]),a!==o.Fragment&&b),h)}function v(e){var t;return Object.assign(o.forwardRef(e),{displayName:null!=(t=e.displayName)?t:e.name})}function m(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),o=s(t);!(n=o()).done;){var i=n.value;i in r&&delete r[i]}return r}function b(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=o.useRef(t);return o.useEffect((function(){r.current=t}),[t]),o.useCallback((function(e){for(var t,n=s(r.current);!(t=n()).done;){var o=t.value;null!=o&&("function"==typeof o?o(e):o.current=e)}}),[r])}function h(e){for(var t,n,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var i=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!i||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(o))&&i}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(t||(t={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(n||(n={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(r||(r={}));var y="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,g={serverHandoffComplete:!1},w=0;function S(){return++w}function E(){var e=o.useState(g.serverHandoffComplete?S:null),t=e[0],n=e[1];return y((function(){null===t&&n(S())}),[t]),o.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=t?""+t:void 0}var x,C,I,O=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function k(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(O))}function R(e){return e.matches(O)}function L(e){null==e||e.focus({preventScroll:!0})}function P(e,t){var n=Array.isArray(e)?e:k(e),r=document.activeElement,o=function(){if(t&(x.First|x.Next))return I.Next;if(t&(x.Previous|x.Last))return I.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),i=function(){if(t&x.First)return 0;if(t&x.Previous)return Math.max(0,n.indexOf(r))-1;if(t&x.Next)return Math.max(0,n.indexOf(r))+1;if(t&x.Last)return n.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),u=t&x.NoScroll?{preventScroll:!0}:{},a=0,c=n.length,l=void 0;do{var s;if(a>=c||a+c<=0)return C.Error;var f=i+a;if(t&x.WrapAround)f=(f+c)%c;else{if(f<0)return C.Underflow;if(f>=c)return C.Overflow}null==(s=l=n[f])||s.focus(u),a+=o}while(l!==document.activeElement);return C.Success}function T(e,t,n){void 0===t&&(t=!0),void 0===n&&(n={});var i=o.useRef("undefined"!=typeof window?document.activeElement:null),u=o.useRef(null),a=o.useRef(!1);y((function(){var r,o;if(t&&e.current){a.current=!0;var c,l=document.activeElement;if(null==(r=n.initialFocus)?void 0:r.current){if((null==(c=n.initialFocus)?void 0:c.current)===l)return}else if(e.current.contains(l))return;if(i.current=l,null==(o=n.initialFocus)?void 0:o.current)L(n.initialFocus.current);else if(P(e.current,x.First)===C.Error)throw new Error("There are no focusable elements inside the <FocusTrap />");return u.current=document.activeElement,function(){a.current=!1,L(i.current),i.current=null,u.current=null}}}),[t,e,a,n.initialFocus]),y((function(){if(t)return window.addEventListener("keydown",n),function(){return window.removeEventListener("keydown",n)};function n(t){t.key===r.Tab&&document.activeElement&&e.current&&(t.preventDefault(),P(e.current,(t.shiftKey?x.Previous:x.Next)|x.WrapAround)===C.Success&&(u.current=document.activeElement))}}),[t]),y((function(){if(t&&e.current){var n=e.current;return window.addEventListener("focus",r,!0),function(){return window.removeEventListener("focus",r,!0)}}function r(e){var t=u.current;if(t&&a.current){var r=e.target;r&&r instanceof HTMLElement?n.contains(r)?(u.current=r,L(r)):(e.preventDefault(),e.stopPropagation(),L(t)):L(u.current)}}}),[t,a,e])}function D(e,t){return e(t={exports:{}},t.exports),t.exports}!function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"}(x||(x={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(C||(C={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(I||(I={}));var F=D((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new x(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=w(u,n);if(a){if(a===s)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function d(){}function p(){}var v={};v[o]=function(){return this};var m=Object.getPrototypeOf,b=m&&m(m(C([])));b&&b!==t&&n.call(b,o)&&(v=b);var h=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(o,i){function u(){return new t((function(r,u){!function r(o,i,u,a){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return d.prototype=h.constructor=p,p.constructor=d,d.displayName=a(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,u,"GeneratorFunction")),e.prototype=Object.create(h),e},e.awrap=function(e){return{__await:e}},y(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},y(h),a(h,u,"Generator"),h[o]=function(){return this},h.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return u.type="throw",u.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),N=F.mark(M);function M(e){var t;return F.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.parentElement){n.next=2;break}return n.abrupt("return");case 2:t=e.parentElement.firstChild;case 3:if(!t){n.next=10;break}if(!(t!==e&&t instanceof HTMLElement)){n.next=7;break}return n.next=7,t;case 7:t=t.nextSibling,n.next=3;break;case 10:case"end":return n.stop()}}),N)}var A,j,G,U=o.Fragment;function H(e){var t=o.useState((function(){if("undefined"==typeof window)return null;var e=document.getElementById("headlessui-portal-root");if(e)return e;var t=document.createElement("div");return t.setAttribute("id","headlessui-portal-root"),document.body.appendChild(t)}))[0],n=o.useState((function(){return"undefined"==typeof window?null:document.createElement("div")}))[0];return y((function(){if(t&&n)return t.appendChild(n),function(){t&&n&&(t.removeChild(n),t.childNodes.length<=0&&document.body.removeChild(t))}}),[t]),t&&n?u.createPortal(d(e,{},U),n):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(j||(j={})),function(e){e[e.SetTitleElement=0]="SetTitleElement",e[e.SetDescriptionElement=1]="SetDescriptionElement"}(G||(G={}));var B=((A={})[G.SetTitleElement]=function(e,t){return e.titleElement===t.element?e:a({},e,{titleElement:t.element})},A[G.SetDescriptionElement]=function(e,t){return e.descriptionElement===t.element?e:a({},e,{descriptionElement:t.element})},A),V=o.createContext(null);function _(e){var t=o.useContext(V);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+J.displayName+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,_),n}return t}function Q(e,t){return f(t.type,B,e,t)}V.displayName="DialogContext";var K,W,Y,q=t.RenderStrategy|t.Static,J=Object.assign(v((function(e,t){var n,u,l=e.open,f=e.onClose,p=e.initialFocus,v=c(e,["open","onClose","initialFocus"]),m=o.useRef(null),h=b(m,t),g=e.hasOwnProperty("open"),w=e.hasOwnProperty("onClose");if(!g&&!w)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!g)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!w)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof l)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+l);if("function"!=typeof f)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+f);var S=l?j.Open:j.Closed,x=o.useReducer(Q,{titleElement:null,descriptionElement:null}),C=x[0],I=x[1],O=o.useCallback((function(){return f(!1)}),[f]),k=o.useCallback((function(e){return I({type:G.SetTitleElement,element:e})}),[I]),R=o.useCallback((function(e){return I({type:G.SetDescriptionElement,element:e})}),[I]);o.useEffect((function(){function e(e){var t;S===j.Open&&((null==(t=m.current)?void 0:t.contains(e.target))||O())}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[S,m,O]),o.useEffect((function(){function e(e){e.key===r.Escape&&S===j.Open&&O()}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[O,S]),o.useEffect((function(){if(S===j.Open){var e=document.documentElement.style.overflow,t=document.documentElement.style.paddingRight,n=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=n+"px",function(){document.documentElement.style.overflow=e,document.documentElement.style.paddingRight=t}}}),[S]),o.useEffect((function(){if(S===j.Open&&m.current){var e=new IntersectionObserver((function(e){for(var t,n=s(e);!(t=n()).done;){var r=t.value;0===r.boundingClientRect.x&&0===r.boundingClientRect.y&&0===r.boundingClientRect.width&&0===r.boundingClientRect.height&&O()}}));return e.observe(m.current),function(){return e.disconnect()}}}),[S,m,O]);var L=!!e.static||S===j.Open;T(m,L,{initialFocus:p}),function(e,t){void 0===t&&(t=!0),y((function(){if(t&&e.current){for(var n,r=e.current,o=new Map,i=s(M(r));!(n=i()).done;){var u=n.value;o.set(u,{"aria-hidden":u.getAttribute("aria-hidden"),inert:u.inert})}document.querySelectorAll("body > *").forEach((function(e){e!==r&&e instanceof HTMLElement&&(e.contains(r)||o.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}))}));for(var a,c=s(o.keys());!(a=c()).done;){var l=a.value;l.setAttribute("aria-hidden","true"),l.inert=!0}return function(){for(var e,t=s(o.entries());!(e=t()).done;){var n=e.value,r=n[0],i=n[1];null!==r&&(null===i["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",i["aria-hidden"]),r.inert=i.inert)}o.clear()}}}),[t])}(m,L);var P="headlessui-dialog-"+E(),D=o.useMemo((function(){return[{dialogState:S,close:O,setTitle:k,setDescription:R},C]}),[S,C,O,k,R]),F=o.useMemo((function(){return{open:S===j.Open}}),[S]),N={ref:h,id:P,role:"dialog","aria-modal":S===j.Open||void 0,"aria-labelledby":null==(n=C.titleElement)?void 0:n.id,"aria-describedby":null==(u=C.descriptionElement)?void 0:u.id};return i.createElement(H,null,i.createElement(V.Provider,{value:D},d(a({},v,N),F,"div",q,S===j.Open)))})),{Overlay:v((function e(t,n){var r=_([J.displayName,e.name].join("."))[0],i=r.dialogState,u=r.close,c=b(n),l="headlessui-dialog-overlay-"+E(),s=o.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();u()}),[u]),f=o.useMemo((function(){return{open:i===j.Open}}),[i]);return d(a({},t,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")})),Title:function e(t){var n=_([J.displayName,e.name].join("."))[0],r=n.dialogState,i=n.setTitle,u="headlessui-dialog-title-"+E(),c=o.useMemo((function(){return{open:r===j.Open}}),[r]);return d(a({},t,{ref:i,id:u}),c,"h2")},Description:function e(t){var n=_([J.displayName,e.name].join("."))[0],r=n.dialogState,i=n.setDescription,u="headlessui-dialog-description-"+E(),c=o.useMemo((function(){return{open:r===j.Open}}),[r]);return d(a({},t,{ref:i,id:u}),c,"p")}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(W||(W={})),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 $=((K={})[Y.ToggleDisclosure]=function(e){var t;return a({},e,{disclosureState:f(e.disclosureState,(t={},t[W.Open]=W.Closed,t[W.Closed]=W.Open,t))})},K[Y.LinkPanel]=function(e){return!0===e.linkedPanel?e:a({},e,{linkedPanel:!0})},K[Y.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:a({},e,{linkedPanel:!1})},K[Y.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:a({},e,{buttonId:t.buttonId})},K[Y.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:a({},e,{panelId:t.panelId})},K),z=o.createContext(null);function X(e){var t=o.useContext(z);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+te.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,X),n}return t}function Z(e,t){return f(t.type,$,e,t)}z.displayName="DisclosureContext";var ee=o.Fragment;function te(e){var t="headlessui-disclosure-button-"+E(),n="headlessui-disclosure-panel-"+E(),r=o.useReducer(Z,{disclosureState:W.Closed,linkedPanel:!1,buttonId:t,panelId:n}),u=r[0].disclosureState,a=r[1];o.useEffect((function(){return a({type:Y.SetButtonId,buttonId:t})}),[t,a]),o.useEffect((function(){return a({type:Y.SetPanelId,panelId:n})}),[n,a]);var c=o.useMemo((function(){return{open:u===W.Open}}),[u]);return i.createElement(z.Provider,{value:r},d(e,c,ee))}var ne,re,oe,ie,ue=v((function e(t,n){var i=X([te.name,e.name].join(".")),u=i[0],c=i[1],l=b(n),s=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:e.preventDefault(),c({type:Y.ToggleDisclosure})}}),[c]),f=o.useCallback((function(e){h(e.currentTarget)||t.disabled||c({type:Y.ToggleDisclosure})}),[c,t.disabled]),p=o.useMemo((function(){return{open:u.disclosureState===W.Open}}),[u]);return d(a({},t,{ref:l,id:u.buttonId,type:"button","aria-expanded":u.disclosureState===W.Open||void 0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:s,onClick:f}),p,"button")})),ae=t.RenderStrategy|t.Static,ce=v((function e(t,n){var r=X([te.name,e.name].join(".")),i=r[0],u=r[1],c=b(n,(function(){i.linkedPanel||u({type:Y.LinkPanel})}));o.useEffect((function(){return function(){return u({type:Y.UnlinkPanel})}}),[u]),o.useEffect((function(){var e;i.disclosureState!==W.Closed||null!=(e=t.unmount)&&!e||u({type:Y.UnlinkPanel})}),[i.disclosureState,t.unmount,u]);var l=o.useMemo((function(){return{open:i.disclosureState===W.Open}}),[i]);return d(a({},t,{ref:c,id:i.panelId}),l,"div",ae,i.disclosureState===W.Open)}));function le(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=s(e.splice(0));!(t=n()).done;)(0,t.value)()}};return t}function se(){var e=o.useState(le)[0];return o.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function fe(e,t){var n=o.useState(e),r=n[0],i=n[1],u=o.useRef(e);return y((function(){u.current=e}),[e]),y((function(){return i(u.current)}),[u,i].concat(t)),r}function de(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),o=null!=r?r:-1,i=function(){switch(e.focus){case ne.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case ne.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==o&&r.length-n-1>=o||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case ne.Next:return n.findIndex((function(e,n){return!(n<=o||t.resolveDisabled(e))}));case ne.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case ne.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case ne.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?r:i}function pe(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}te.Button=ue,te.Panel=ce,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"}(ne||(ne={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(oe||(oe={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(ie||(ie={}));var ve=((re={})[ie.CloseListbox]=function(e){return e.disabled||e.listboxState===oe.Closed?e:a({},e,{activeOptionIndex:null,listboxState:oe.Closed})},re[ie.OpenListbox]=function(e){return e.disabled||e.listboxState===oe.Open?e:a({},e,{listboxState:oe.Open})},re[ie.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:a({},e,{disabled:t.disabled})},re[ie.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===oe.Closed)return e;var n=de(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===n?e:a({},e,{searchQuery:"",activeOptionIndex:n})},re[ie.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===oe.Closed)return e;var n=e.searchQuery+t.value,r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return a({},e,-1===r||r===e.activeOptionIndex?{searchQuery:n}:{searchQuery:n,activeOptionIndex:r})},re[ie.ClearSearch]=function(e){return e.disabled||e.listboxState===oe.Closed||""===e.searchQuery?e:a({},e,{searchQuery:""})},re[ie.RegisterOption]=function(e,t){return a({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},re[ie.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{options:n,activeOptionIndex:o===e.activeOptionIndex||null===r?null:n.indexOf(r)})},re),me=o.createContext(null);function be(e){var t=o.useContext(me);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+ge.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,be),n}return t}function he(e,t){return f(t.type,ve,e,t)}me.displayName="ListboxContext";var ye=o.Fragment;function ge(e){var t=e.value,n=e.onChange,r=e.disabled,u=void 0!==r&&r,a=c(e,["value","onChange","disabled"]),l=o.useReducer(he,{listboxState:oe.Closed,propsRef:{current:{value:t,onChange:n}},labelRef:o.createRef(),buttonRef:o.createRef(),optionsRef:o.createRef(),disabled:u,options:[],searchQuery:"",activeOptionIndex:null}),s=l[0],f=s.listboxState,p=s.propsRef,v=s.optionsRef,m=s.buttonRef,b=l[1];y((function(){p.current.value=t}),[t,p]),y((function(){p.current.onChange=n}),[n,p]),y((function(){return b({type:ie.SetDisabled,disabled:u})}),[u]),o.useEffect((function(){function e(e){var t,n,r,o=e.target;f===oe.Open&&((null==(t=m.current)?void 0:t.contains(o))||(null==(n=v.current)?void 0:n.contains(o))||(b({type:ie.CloseListbox}),R(o)||(e.preventDefault(),null==(r=m.current)||r.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[f,m,v,b]);var h=o.useMemo((function(){return{open:f===oe.Open,disabled:u}}),[f,u]);return i.createElement(me.Provider,{value:l},d(a,h,ye))}var we,Se,Ee,xe=v((function e(t,n){var i,u=be([ge.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.buttonRef,n),f="headlessui-listbox-button-"+E(),p=se(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ie.GoToOption,focus:ne.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ie.GoToOption,focus:ne.Last})}))}}),[l,c,p]),m=o.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();c.listboxState===oe.Open?(l({type:ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})})))}),[l,p,c]),y=fe((function(){if(c.labelRef.current)return[c.labelRef.current.id,f].join(" ")}),[c.labelRef.current,f]),g=o.useMemo((function(){return{open:c.listboxState===oe.Open,disabled:c.disabled}}),[c]);return d(a({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(i=c.optionsRef.current)?void 0:i.id,"aria-expanded":c.listboxState===oe.Open||void 0,"aria-labelledby":y,disabled:c.disabled,onKeyDown:v,onClick:m}),g,"button")})),Ce=t.RenderStrategy|t.Static,Ie=v((function e(t,n){var i,u=be([ge.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.optionsRef,n),f="headlessui-listbox-options-"+E(),p=se(),v=se(),m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:ie.Search,value:e.key});case r.Enter:e.preventDefault(),l({type:ie.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),le().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Next});case r.ArrowUp:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Previous});case r.Home:case r.PageUp:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.First});case r.End:case r.PageDown:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Last});case r.Escape:return e.preventDefault(),l({type:ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case r.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:ie.Search,value:e.key}),v.setTimeout((function(){return l({type:ie.ClearSearch})}),350))}}),[p,l,v,c]),h=fe((function(){var e,t,n;return null!=(e=null==(t=c.labelRef.current)?void 0:t.id)?e:null==(n=c.buttonRef.current)?void 0:n.id}),[c.labelRef.current,c.buttonRef.current]),y=o.useMemo((function(){return{open:c.listboxState===oe.Open}}),[c]);return d(a({},t,{"aria-activedescendant":null===c.activeOptionIndex||null==(i=c.options[c.activeOptionIndex])?void 0:i.id,"aria-labelledby":h,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),y,"ul",Ce,c.listboxState===oe.Open)}));ge.Button=xe,ge.Label=function e(t){var n=be([ge.name,e.name].join("."))[0],r="headlessui-listbox-label-"+E(),i=o.useCallback((function(){var e;return null==(e=n.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[n.buttonRef]),u=o.useMemo((function(){return{open:n.listboxState===oe.Open,disabled:n.disabled}}),[n]);return d(a({},t,{ref:n.labelRef,id:r,onClick:i}),u,"label")},ge.Options=Ie,ge.Option=function e(t){var n=t.disabled,r=void 0!==n&&n,i=t.value,u=t.className,l=c(t,["disabled","value","className"]),s=be([ge.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-listbox-option-"+E(),m=null!==f.activeOptionIndex&&f.options[f.activeOptionIndex].id===v,b=f.propsRef.current.value===i,h=o.useRef({disabled:r,value:i});y((function(){h.current.disabled=r}),[h,r]),y((function(){h.current.value=i}),[h,i]),y((function(){var e,t;h.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[h,v]);var g=o.useCallback((function(){return f.propsRef.current.onChange(i)}),[f.propsRef,i]);y((function(){return p({type:ie.RegisterOption,id:v,dataRef:h}),function(){return p({type:ie.UnregisterOption,id:v})}}),[h,v]),y((function(){var e;f.listboxState===oe.Open&&b&&(p({type:ie.GoToOption,focus:ne.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[f.listboxState]),y((function(){if(f.listboxState===oe.Open&&m){var e=le();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.listboxState]);var w=o.useCallback((function(e){if(r)return e.preventDefault();g(),p({type:ie.CloseListbox}),le().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,f.buttonRef,r,g]),S=o.useCallback((function(){if(r)return p({type:ie.GoToOption,focus:ne.Nothing});p({type:ie.GoToOption,focus:ne.Specific,id:v})}),[r,v,p]),x=o.useCallback((function(){r||m||p({type:ie.GoToOption,focus:ne.Specific,id:v})}),[r,m,v,p]),C=o.useCallback((function(){r||m&&p({type:ie.GoToOption,focus:ne.Nothing})}),[r,m,p]),I=o.useMemo((function(){return{active:m,selected:b,disabled:r}}),[m,b,r]);return d(a({},l,{id:v,role:"option",tabIndex:-1,className:pe(u,I),"aria-disabled":!0===r||void 0,"aria-selected":!0===b||void 0,onClick:w,onFocus:S,onPointerMove:x,onMouseMove:x,onPointerLeave:C,onMouseLeave:C}),I,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Se||(Se={})),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"}(Ee||(Ee={}));var Oe=((we={})[Ee.CloseMenu]=function(e){return e.menuState===Se.Closed?e:a({},e,{activeItemIndex:null,menuState:Se.Closed})},we[Ee.OpenMenu]=function(e){return e.menuState===Se.Open?e:a({},e,{menuState:Se.Open})},we[Ee.GoToItem]=function(e,t){var n=de(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===n?e:a({},e,{searchQuery:"",activeItemIndex:n})},we[Ee.Search]=function(e,t){var n=e.searchQuery+t.value,r=e.items.findIndex((function(e){var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))&&!e.dataRef.current.disabled}));return a({},e,-1===r||r===e.activeItemIndex?{searchQuery:n}:{searchQuery:n,activeItemIndex:r})},we[Ee.ClearSearch]=function(e){return""===e.searchQuery?e:a({},e,{searchQuery:""})},we[Ee.RegisterItem]=function(e,t){return a({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},we[Ee.UnregisterItem]=function(e,t){var n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{items:n,activeItemIndex:o===e.activeItemIndex||null===r?null:n.indexOf(r)})},we),ke=o.createContext(null);function Re(e){var t=o.useContext(ke);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+Te.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Re),n}return t}function Le(e,t){return f(t.type,Oe,e,t)}ke.displayName="MenuContext";var Pe=o.Fragment;function Te(e){var t=o.useReducer(Le,{menuState:Se.Closed,buttonRef:o.createRef(),itemsRef:o.createRef(),items:[],searchQuery:"",activeItemIndex:null}),n=t[0],r=n.menuState,u=n.itemsRef,a=n.buttonRef,c=t[1];o.useEffect((function(){function e(e){var t,n,o,i=e.target;r===Se.Open&&((null==(t=a.current)?void 0:t.contains(i))||(null==(n=u.current)?void 0:n.contains(i))||(c({type:Ee.CloseMenu}),R(i)||(e.preventDefault(),null==(o=a.current)||o.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[r,a,u,c]);var l=o.useMemo((function(){return{open:r===Se.Open}}),[r]);return i.createElement(ke.Provider,{value:t},d(e,l,Pe))}var De,Fe,Ne,Me=v((function e(t,n){var i,u=Re([Te.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.buttonRef,n),f="headlessui-menu-button-"+E(),p=se(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:Ee.GoToItem,focus:ne.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:Ee.GoToItem,focus:ne.Last})}))}}),[l,c,p]),m=o.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();t.disabled||(c.menuState===Se.Open?(l({type:Ee.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,t.disabled]),y=o.useMemo((function(){return{open:c.menuState===Se.Open}}),[c]);return d(a({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(i=c.itemsRef.current)?void 0:i.id,"aria-expanded":c.menuState===Se.Open||void 0,onKeyDown:v,onClick:m}),y,"button")})),Ae=t.RenderStrategy|t.Static,je=v((function e(t,n){var i,u,c=Re([Te.name,e.name].join(".")),l=c[0],s=c[1],f=b(l.itemsRef,n),p="headlessui-menu-items-"+E(),v=se();y((function(){var e=l.itemsRef.current;if(e&&l.menuState===Se.Open)for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});t.nextNode();)t.currentNode.setAttribute("role","none")}));var m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:Ee.Search,value:e.key});case r.Enter:var t;e.preventDefault(),s({type:Ee.CloseMenu}),null!==l.activeItemIndex&&(null==(t=document.getElementById(l.items[l.activeItemIndex].id))||t.click()),le().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Next});case r.ArrowUp:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Previous});case r.Home:case r.PageUp:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.First});case r.End:case r.PageDown:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Last});case r.Escape:e.preventDefault(),s({type:Ee.CloseMenu}),le().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:Ee.Search,value:e.key}),v.setTimeout((function(){return s({type:Ee.ClearSearch})}),350))}}),[s,v,l]),h=o.useMemo((function(){return{open:l.menuState===Se.Open}}),[l]);return d(a({},t,{"aria-activedescendant":null===l.activeItemIndex||null==(i=l.items[l.activeItemIndex])?void 0:i.id,"aria-labelledby":null==(u=l.buttonRef.current)?void 0:u.id,id:p,onKeyDown:m,role:"menu",tabIndex:0,ref:f}),h,"div",Ae,l.menuState===Se.Open)})),Ge=o.Fragment;Te.Button=Me,Te.Items=je,Te.Item=function e(t){var n=t.disabled,r=void 0!==n&&n,i=t.className,u=t.onClick,l=c(t,["disabled","className","onClick"]),s=Re([Te.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-menu-item-"+E(),m=null!==f.activeItemIndex&&f.items[f.activeItemIndex].id===v;y((function(){if(f.menuState===Se.Open&&m){var e=le();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.menuState]);var b=o.useRef({disabled:r});y((function(){b.current.disabled=r}),[b,r]),y((function(){var e,t;b.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[b,v]),y((function(){return p({type:Ee.RegisterItem,id:v,dataRef:b}),function(){return p({type:Ee.UnregisterItem,id:v})}}),[b,v]);var h=o.useCallback((function(e){return r?e.preventDefault():(p({type:Ee.CloseMenu}),le().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[p,f.buttonRef,r,u]),g=o.useCallback((function(){if(r)return p({type:Ee.GoToItem,focus:ne.Nothing});p({type:Ee.GoToItem,focus:ne.Specific,id:v})}),[r,v,p]),w=o.useCallback((function(){r||m||p({type:Ee.GoToItem,focus:ne.Specific,id:v})}),[r,m,v,p]),S=o.useCallback((function(){r||m&&p({type:Ee.GoToItem,focus:ne.Nothing})}),[r,m,p]),x=o.useMemo((function(){return{active:m,disabled:r}}),[m,r]);return d(a({},l,{id:v,role:"menuitem",tabIndex:-1,className:pe(i,x),"aria-disabled":!0===r||void 0,onClick:h,onFocus:g,onPointerMove:w,onMouseMove:w,onPointerLeave:S,onMouseLeave:S}),x,Ge)},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Fe||(Fe={})),function(e){e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId"}(Ne||(Ne={}));var Ue=((De={})[Ne.TogglePopover]=function(e){var t;return a({},e,{popoverState:f(e.popoverState,(t={},t[Fe.Open]=Fe.Closed,t[Fe.Closed]=Fe.Open,t))})},De[Ne.ClosePopover]=function(e){return e.popoverState===Fe.Closed?e:a({},e,{popoverState:Fe.Closed})},De[Ne.SetButton]=function(e,t){return e.button===t.button?e:a({},e,{button:t.button})},De[Ne.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:a({},e,{buttonId:t.buttonId})},De[Ne.SetPanel]=function(e,t){return e.panel===t.panel?e:a({},e,{panel:t.panel})},De[Ne.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:a({},e,{panelId:t.panelId})},De),He=o.createContext(null);function Be(e){var t=o.useContext(He);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+We.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Be),n}return t}He.displayName="PopoverContext";var Ve=o.createContext(null);function _e(){return o.useContext(Ve)}Ve.displayName="PopoverGroupContext";var Qe=o.createContext(null);function Ke(e,t){return f(t.type,Ue,e,t)}function We(e){var t="headlessui-popover-button-"+E(),n="headlessui-popover-panel-"+E(),r=o.useReducer(Ke,{popoverState:Fe.Closed,linkedPanel:!1,button:null,buttonId:t,panel:null,panelId:n}),u=r[0],a=u.popoverState,c=u.button,l=u.panel,s=r[1];o.useEffect((function(){return s({type:Ne.SetButtonId,buttonId:t})}),[t,s]),o.useEffect((function(){return s({type:Ne.SetPanelId,panelId:n})}),[n,s]);var f=o.useMemo((function(){return{buttonId:t,panelId:n,close:function(){return s({type:Ne.ClosePopover})}}}),[t,n,s]),p=_e(),v=null==p?void 0:p.registerPopover,m=o.useCallback((function(){var e;return null!=(e=null==p?void 0:p.isFocusWithinPopoverGroup())?e:(null==c?void 0:c.contains(document.activeElement))||(null==l?void 0:l.contains(document.activeElement))}),[p,c,l]);o.useEffect((function(){return null==v?void 0:v(f)}),[v,f]),o.useEffect((function(){if(a===Fe.Open)return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)};function e(){m()||c&&l&&s({type:Ne.ClosePopover})}}),[a,m,p,c,l,s]),o.useEffect((function(){function e(e){var t=e.target;a===Fe.Open&&((null==c?void 0:c.contains(t))||(null==l?void 0:l.contains(t))||(s({type:Ne.ClosePopover}),R(t)||(e.preventDefault(),null==c||c.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[a,c,l,s]);var b=o.useMemo((function(){return{open:a===Fe.Open}}),[a]);return i.createElement(He.Provider,{value:r},d(e,b,"div"))}Qe.displayName="PopoverPanelContext";var Ye=v((function e(t,n){var i=Be([We.name,e.name].join(".")),u=i[0],c=i[1],l=o.useRef(null),s=_e(),f=null==s?void 0:s.closeOthers,p=o.useContext(Qe),v=null!==p&&p===u.panelId,m=b(l,n,v?null:function(e){return c({type:Ne.SetButton,button:e})}),y=o.useRef(null),g=o.useRef("undefined"==typeof window?null:document.activeElement);o.useEffect((function(){function e(){g.current=y.current,y.current=document.activeElement}return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)}}),[g,y]);var w=o.useCallback((function(e){var t;if(v){if(u.popoverState===Fe.Closed)return;switch(e.key){case r.Space:case r.Enter:e.preventDefault(),c({type:Ne.ClosePopover}),null==(t=u.button)||t.focus()}}else switch(e.key){case r.Space:case r.Enter:e.preventDefault(),u.popoverState===Fe.Closed&&(null==f||f(u.buttonId)),c({type:Ne.TogglePopover});break;case r.Escape:if(u.popoverState!==Fe.Open)return null==f?void 0:f(u.buttonId);if(!l.current)return;if(!l.current.contains(document.activeElement))return;c({type:Ne.ClosePopover});break;case r.Tab:if(u.popoverState!==Fe.Open)return;if(!u.panel)return;if(!u.button)return;if(e.shiftKey){var n;if(!g.current)return;if(null==(n=u.button)?void 0:n.contains(g.current))return;if(u.panel.contains(g.current))return;var o=k(),i=o.indexOf(g.current);if(o.indexOf(u.button)>i)return;e.preventDefault(),e.stopPropagation(),P(u.panel,x.Last)}else e.preventDefault(),e.stopPropagation(),P(u.panel,x.First)}}),[c,u.popoverState,u.buttonId,u.button,u.panel,l,f,v]),S=o.useCallback((function(e){var t;if(!v&&u.popoverState===Fe.Open&&u.panel&&u.button)switch(e.key){case r.Tab:if(!g.current)return;if(null==(t=u.button)?void 0:t.contains(g.current))return;if(u.panel.contains(g.current))return;var n=k(),o=n.indexOf(g.current);if(n.indexOf(u.button)>o)return;e.preventDefault(),P(u.panel,x.Last)}}),[u.popoverState,u.panel,u.button,v]),E=o.useCallback((function(e){var n;h(e.currentTarget)||t.disabled||(v?(c({type:Ne.ClosePopover}),null==(n=u.button)||n.focus()):(u.popoverState===Fe.Closed&&(null==f||f(u.buttonId)),c({type:Ne.TogglePopover})))}),[c,u.button,u.popoverState,u.buttonId,t.disabled,f,v]),C=o.useMemo((function(){return{open:u.popoverState===Fe.Open}}),[u]);return d(a({},t,v?{type:"button",onKeyDown:w,onClick:E}:{ref:m,id:u.buttonId,type:"button","aria-expanded":u.popoverState===Fe.Open||void 0,"aria-controls":u.panel?u.panelId:void 0,onKeyDown:w,onKeyUp:S,onClick:E}),C,"button")})),qe=v((function e(t,n){var r=Be([We.name,e.name].join(".")),i=r[0].popoverState,u=r[1],c=b(n),l="headlessui-popover-overlay-"+E(),s=o.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();u({type:Ne.ClosePopover})}),[u]),f=o.useMemo((function(){return{open:i===Fe.Open}}),[i]);return d(a({},t,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")})),Je=t.RenderStrategy|t.Static,$e=v((function e(t,n){var u=t.focus,l=void 0!==u&&u,s=c(t,["focus"]),f=Be([We.name,e.name].join(".")),p=f[0],v=f[1],m=o.useRef(null),h=b(m,n,(function(e){v({type:Ne.SetPanel,panel:e})})),y=o.useCallback((function(e){var t;switch(e.key){case r.Escape:if(p.popoverState!==Fe.Open)return;if(!m.current)return;if(!m.current.contains(document.activeElement))return;e.preventDefault(),v({type:Ne.ClosePopover}),null==(t=p.button)||t.focus()}}),[p,m,v]);o.useEffect((function(){return function(){return v({type:Ne.SetPanel,panel:null})}}),[v]),o.useEffect((function(){var e;p.popoverState!==Fe.Closed||null!=(e=t.unmount)&&!e||v({type:Ne.SetPanel,panel:null})}),[p.popoverState,t.unmount,v]),o.useEffect((function(){if(l&&p.popoverState===Fe.Open&&m.current){var e=document.activeElement;m.current.contains(e)||P(m.current,x.First)}}),[l,m,p.popoverState]),o.useEffect((function(){if(p.popoverState===Fe.Open&&m.current)return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)};function e(e){if(e.key===r.Tab&&document.activeElement&&m.current&&m.current.contains(document.activeElement)){e.preventDefault();var t,n=P(m.current,e.shiftKey?x.Previous:x.Next);if(n===C.Underflow)return null==(t=p.button)?void 0:t.focus();if(n===C.Overflow){if(!p.button)return;var o=k(),i=o.indexOf(p.button);P(o.splice(i+1).filter((function(e){var t;return!(null==(t=m.current)?void 0:t.contains(e))})),x.First)===C.Error&&P(document.body,x.First)}}}}),[l,m,p.popoverState,p.button]),o.useEffect((function(){if(l&&p.popoverState===Fe.Open&&m.current)return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)};function e(){var e;(null==(e=m.current)?void 0:e.contains(document.activeElement))||v({type:Ne.ClosePopover})}}),[l,p.popoverState,v]);var g=o.useMemo((function(){return{open:p.popoverState===Fe.Open}}),[p]);return i.createElement(Qe.Provider,{value:p.panelId},d(a({},s,{ref:h,id:p.panelId,onKeyDown:y}),g,"div",Je,p.popoverState===Fe.Open))}));We.Button=Ye,We.Overlay=qe,We.Panel=$e,We.Group=function(e){var t=o.useRef(null),n=o.useState([]),r=n[0],u=n[1],c=o.useCallback((function(e){u((function(t){var n=t.indexOf(e);if(-1!==n){var r=t.slice();return r.splice(n,1),r}return t}))}),[u]),l=o.useCallback((function(e){return u((function(t){return[].concat(t,[e])})),function(){return c(e)}}),[u,c]),f=o.useCallback((function(){var e,n=document.activeElement;return!!(null==(e=t.current)?void 0:e.contains(n))||r.some((function(e){var t,r;return(null==(t=document.getElementById(e.buttonId))?void 0:t.contains(n))||(null==(r=document.getElementById(e.panelId))?void 0:r.contains(n))}))}),[t,r]),p=o.useCallback((function(e){for(var t,n=s(r);!(t=n()).done;){var o=t.value;o.buttonId!==e&&o.close()}}),[r]),v=o.useMemo((function(){return{registerPopover:l,unregisterPopover:c,isFocusWithinPopoverGroup:f,closeOthers:p}}),[l,c,f,p]),m=o.useMemo((function(){return{}}),[]);return i.createElement(Ve.Provider,{value:v},d(a({},e,{ref:t}),m,"div"))};var ze=o.createContext(null);function Xe(e){var t=o.useContext(ze);if(null===t){var n=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Xe),n}return t}ze.displayName="GroupContext";var Ze,et=o.Fragment;function tt(e){var t,n,i=e.checked,u=e.onChange,l=e.className,s=c(e,["checked","onChange","className"]),f="headlessui-switch-"+E(),p=o.useContext(ze),v=o.useCallback((function(){return u(!i)}),[u,i]),m=o.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),b=o.useCallback((function(e){e.key!==r.Tab&&e.preventDefault(),e.key===r.Space&&v()}),[v]),y=o.useCallback((function(e){return e.preventDefault()}),[]),g=o.useMemo((function(){return{checked:i}}),[i]),w={id:f,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:pe(l,g),"aria-checked":i,"aria-labelledby":null==p||null==(t=p.label)?void 0:t.id,"aria-describedby":null==p||null==(n=p.description)?void 0:n.id,onClick:m,onKeyUp:b,onKeyPress:y};return"button"===s.as&&Object.assign(w,{type:"button"}),d(a({},s,w),g,"button")}function nt(){var e=o.useRef(!0);return o.useEffect((function(){e.current=!1}),[]),e.current}function rt(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function ot(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function it(e,t,n,r,o){var i=le(),u=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return rt.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){ot.apply(void 0,[e].concat(n)),rt.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=le();if(!e)return n.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),i=o[0];return 0!==i?n.setTimeout((function(){t(Ze.Finished)}),i+o[1]):t(Ze.Finished),n.add((function(){return t(Ze.Cancelled)})),n.dispose}(e,(function(n){return ot.apply(void 0,[e].concat(r,t)),u(n)})))})),i.add((function(){return ot.apply(void 0,[e].concat(t,n,r))})),i.add((function(){return u(Ze.Cancelled)})),i.dispose}function ut(e){return void 0===e&&(e=""),o.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}tt.Group=function(e){var t=o.useState(null),n=t[0],r=t[1],u=o.useState(null),a=u[0],c=u[1],l=o.useState(null),s=l[0],f=l[1],p=o.useMemo((function(){return{switch:n,setSwitch:r,label:a,setLabel:c,description:s,setDescription:f}}),[n,r,a,c,s,f]);return i.createElement(ze.Provider,{value:p},d(e,{},et))},tt.Label=function e(t){var n=Xe([tt.name,e.name].join(".")),r="headlessui-switch-label-"+E(),i=o.useCallback((function(){n.switch&&(n.switch.click(),n.switch.focus({preventScroll:!0}))}),[n.switch]);return d(a({},t,{ref:n.setLabel,id:r,onClick:i}),{},"label")},tt.Description=function e(t){var n=Xe([tt.name,e.name].join(".")),r="headlessui-switch-description-"+E();return d(a({},t,{ref:n.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Ze||(Ze={}));var at,ct=o.createContext(null);ct.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(at||(at={}));var lt=o.createContext(null);function st(e){return"children"in e?st(e.children):e.current.filter((function(e){return e.state===at.Visible})).length>0}function ft(e){var t=o.useRef(e),r=o.useRef([]),i=function(){var e=o.useRef(!0);return o.useEffect((function(){return function(){e.current=!1}}),[]),e}();o.useEffect((function(){t.current=e}),[e]);var u=o.useCallback((function(e,o){var u;void 0===o&&(o=n.Hidden);var a=r.current.findIndex((function(t){return t.id===e}));-1!==a&&(f(o,((u={})[n.Unmount]=function(){r.current.splice(a,1)},u[n.Hidden]=function(){r.current[a].state=at.Hidden},u)),!st(r)&&i.current&&(null==t.current||t.current()))}),[t,i,r]),a=o.useCallback((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==at.Visible&&(t.state=at.Visible):r.current.push({id:e,state:at.Visible}),function(){return u(e,n.Unmount)}}),[r,u]);return o.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function dt(){}lt.displayName="NestingContext";var pt=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function vt(e){for(var t,n={},r=s(pt);!(t=r()).done;){var o,i=t.value;n[i]=null!=(o=e[i])?o:dt}return n}var mt=t.RenderStrategy;function bt(e){var t=e.beforeEnter,r=e.afterEnter,u=e.beforeLeave,l=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,b=e.leaveFrom,h=e.leaveTo,g=c(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),w=o.useRef(null),S=o.useState(at.Visible),x=S[0],C=S[1],I=g.unmount?n.Unmount:n.Hidden,O=function(){var e=o.useContext(ct);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),k=O.show,R=O.appear,L=function(){var e=o.useContext(lt);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),P=L.register,T=L.unregister,D=nt(),F=E(),N=o.useRef(!1),M=ft((function(){N.current||(C(at.Hidden),T(F),V.current.afterLeave())}));y((function(){if(F)return P(F)}),[P,F]),y((function(){var e;I===n.Hidden&&F&&(k&&x!==at.Visible?C(at.Visible):f(x,((e={})[at.Hidden]=function(){return T(F)},e[at.Visible]=function(){return P(F)},e)))}),[x,F,P,T,k,I]);var A=ut(s),j=ut(p),G=ut(v),U=ut(m),H=ut(b),B=ut(h),V=function(e){var t=o.useRef(vt(e));return o.useEffect((function(){t.current=vt(e)}),[e]),t}({beforeEnter:t,afterEnter:r,beforeLeave:u,afterLeave:l});o.useEffect((function(){if(x===at.Visible&&null===w.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[w,x]);var _=D&&!R;return y((function(){var e=w.current;if(e&&!_)return N.current=!0,k&&V.current.beforeEnter(),k||V.current.beforeLeave(),k?it(e,A,j,G,(function(e){N.current=!1,e===Ze.Finished&&V.current.afterEnter()})):it(e,U,H,B,(function(e){N.current=!1,e===Ze.Finished&&(st(M)||(C(at.Hidden),T(F),V.current.afterLeave()))}))}),[V,F,N,T,M,w,_,k,A,j,G,U,H,B]),i.createElement(lt.Provider,{value:M},d(a({},g,{ref:w}),{},"div",mt,x===at.Visible))}function ht(e){var t=e.show,n=e.appear,r=void 0!==n&&n,u=e.unmount,l=c(e,["show","appear","unmount"]);if(![!0,!1].includes(t))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=o.useState(t?at.Visible:at.Hidden),f=s[0],p=s[1],v=ft((function(){p(at.Hidden)})),m=nt(),b=o.useMemo((function(){return{show:t,appear:r||!m}}),[t,r,m]);o.useEffect((function(){t?p(at.Visible):st(v)||p(at.Hidden)}),[t,v]);var h={unmount:u};return i.createElement(lt.Provider,{value:v},i.createElement(ct.Provider,{value:b},d(a({},h,{as:o.Fragment,children:i.createElement(bt,Object.assign({},h,l))}),{},o.Fragment,mt,f===at.Visible)))}ht.Child=bt,exports.Dialog=J,exports.Disclosure=te,exports.FocusTrap=function(e){var t=o.useRef(null),n=e.initialFocus,r=c(e,["initialFocus"]);return T(t,!0,{initialFocus:n}),d(a({},r,{ref:t}),{},"div")},exports.Listbox=ge,exports.Menu=Te,exports.Popover=We,exports.Portal=H,exports.Switch=tt,exports.Transition=ht; | ||
//# sourceMappingURL=headlessui.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e=e||self).headlessui={},e.React,e.reactDom)}(this,(function(e,t,n){"use strict";var r,o,i,u="default"in t?t.default:t;function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);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(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){if(e in t){for(var n=t[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,o):n}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(e,t,n,i,u){if(void 0===u&&(u=!0),u)return p(e,t,n);var l=null!=i?i:r.None;if(l&r.Static){var s=e.static,d=void 0!==s&&s,v=c(e,["static"]);if(d)return p(v,t,n)}if(l&r.RenderStrategy){var m,b=e.unmount,h=void 0===b||b,y=c(e,["unmount"]);return f(h?o.Unmount:o.Hidden,((m={})[o.Unmount]=function(){return null},m[o.Hidden]=function(){return p(a({},y,{hidden:!0,style:{display:"none"}}),t,n)},m))}return p(e,t,n)}function p(e,n,r){var o,i=m(e,["unmount","static"]),u=i.as,a=void 0===u?r:u,l=i.children,f=i.refName,d=void 0===f?"ref":f,v=c(i,["as","children","refName"]),b=void 0!==e.ref?((o={})[d]=e.ref,o):{},h="function"==typeof l?l(n):l;if(a===t.Fragment&&Object.keys(v).length>0){if(Array.isArray(h)&&h.length>1){var y=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(y,p),y}if(!t.isValidElement(h)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,p),g}return t.cloneElement(h,Object.assign({},function(e,t,n){for(var r,o=Object.assign({},e),i=function(){var n,i=r.value;void 0!==e[i]&&void 0!==t[i]&&Object.assign(o,((n={})[i]=function(n){n.defaultPrevented||e[i](n),n.defaultPrevented||t[i](n)},n))},u=s(["onClick"]);!(r=u()).done;)i();return o}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(m(v,["ref"])),h.props),b))}return t.createElement(a,Object.assign({},m(v,["ref"]),a!==t.Fragment&&b),h)}function v(e){return Object.assign(t.forwardRef(e),{name:e.name})}function m(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),o=s(t);!(n=o()).done;){var i=n.value;i in r&&delete r[i]}return r}function b(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=t.useRef(n);return t.useEffect((function(){o.current=n}),[n]),t.useCallback((function(e){for(var t,n=s(o.current);!(t=n()).done;){var r=t.value;null!=r&&("function"==typeof r?r(e):r.current=e)}}),[o])}function h(e){for(var t,n,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var i=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!i||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(o))&&i}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(r||(r={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(o||(o={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(i||(i={}));var y="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,g={serverHandoffComplete:!1},w=0;function S(){return++w}function E(){var e=t.useState(g.serverHandoffComplete?S:null),n=e[0],r=e[1];return y((function(){null===n&&r(S())}),[n]),t.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=n?""+n:void 0}var x,C,I,O=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function k(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(O))}function R(e){return e.matches(O)}function L(e){null==e||e.focus({preventScroll:!0})}function P(e,t){var n=Array.isArray(e)?e:k(e),r=document.activeElement,o=function(){if(t&(x.First|x.Next))return I.Next;if(t&(x.Previous|x.Last))return I.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),i=function(){if(t&x.First)return 0;if(t&x.Previous)return Math.max(0,n.indexOf(r))-1;if(t&x.Next)return Math.max(0,n.indexOf(r))+1;if(t&x.Last)return n.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),u=t&x.NoScroll?{preventScroll:!0}:{},a=0,c=n.length,l=void 0;do{var s;if(a>=c||a+c<=0)return C.Error;var f=i+a;if(t&x.WrapAround)f=(f+c)%c;else{if(f<0)return C.Underflow;if(f>=c)return C.Overflow}null==(s=l=n[f])||s.focus(u),a+=o}while(l!==document.activeElement);return C.Success}function T(e,n,r){void 0===n&&(n=!0),void 0===r&&(r={});var o=t.useRef("undefined"!=typeof window?document.activeElement:null),u=t.useRef(null),a=t.useRef(!1);y((function(){var t,i;if(n&&e.current){a.current=!0;var c,l=document.activeElement;if(null==(t=r.initialFocus)?void 0:t.current){if((null==(c=r.initialFocus)?void 0:c.current)===l)return}else if(e.current.contains(l))return;if(o.current=l,null==(i=r.initialFocus)?void 0:i.current)L(r.initialFocus.current);else if(P(e.current,x.First)===C.Error)throw new Error("There are no focusable elements inside the <FocusTrap />");return u.current=document.activeElement,function(){a.current=!1,L(o.current),o.current=null,u.current=null}}}),[n,e,a,r.initialFocus]),y((function(){if(n)return window.addEventListener("keydown",t),function(){return window.removeEventListener("keydown",t)};function t(t){t.key===i.Tab&&document.activeElement&&e.current&&(t.preventDefault(),P(e.current,(t.shiftKey?x.Previous:x.Next)|x.WrapAround)===C.Success&&(u.current=document.activeElement))}}),[n]),y((function(){if(n&&e.current){var t=e.current;return window.addEventListener("focus",r,!0),function(){return window.removeEventListener("focus",r,!0)}}function r(e){var n=u.current;if(n&&a.current){var r=e.target;r&&r instanceof HTMLElement?t.contains(r)?(u.current=r,L(r)):(e.preventDefault(),e.stopPropagation(),L(n)):L(u.current)}}}),[n,a,e])}function D(e,t){return e(t={exports:{}},t.exports),t.exports}!function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"}(x||(x={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(C||(C={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(I||(I={}));var F=D((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new x(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=w(u,n);if(a){if(a===s)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function d(){}function p(){}var v={};v[o]=function(){return this};var m=Object.getPrototypeOf,b=m&&m(m(C([])));b&&b!==t&&n.call(b,o)&&(v=b);var h=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(o,i){function u(){return new t((function(r,u){!function r(o,i,u,a){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return d.prototype=h.constructor=p,p.constructor=d,d.displayName=a(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,u,"GeneratorFunction")),e.prototype=Object.create(h),e},e.awrap=function(e){return{__await:e}},y(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},y(h),a(h,u,"Generator"),h[o]=function(){return this},h.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return u.type="throw",u.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),M=F.mark(N);function N(e){var t;return F.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.parentElement){n.next=2;break}return n.abrupt("return");case 2:t=e.parentElement.firstChild;case 3:if(!t){n.next=10;break}if(!(t!==e&&t instanceof HTMLElement)){n.next=7;break}return n.next=7,t;case 7:t=t.nextSibling,n.next=3;break;case 10:case"end":return n.stop()}}),M)}var A,j,G,U=t.Fragment;function H(e){var r=t.useState((function(){if("undefined"==typeof window)return null;var e=document.getElementById("headlessui-portal-root");if(e)return e;var t=document.createElement("div");return t.setAttribute("id","headlessui-portal-root"),document.body.appendChild(t)}))[0],o=t.useState((function(){return"undefined"==typeof window?null:document.createElement("div")}))[0];return y((function(){if(r&&o)return r.appendChild(o),function(){r&&o&&(r.removeChild(o),r.childNodes.length<=0&&document.body.removeChild(r))}}),[r]),r&&o?n.createPortal(d(e,{},U),o):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(j||(j={})),function(e){e[e.SetTitleElement=0]="SetTitleElement",e[e.SetDescriptionElement=1]="SetDescriptionElement"}(G||(G={}));var B=((A={})[G.SetTitleElement]=function(e,t){return e.titleElement===t.element?e:a({},e,{titleElement:t.element})},A[G.SetDescriptionElement]=function(e,t){return e.descriptionElement===t.element?e:a({},e,{descriptionElement:t.element})},A),V=t.createContext(null);function _(e){var n=t.useContext(V);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+J.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,_),r}return n}function Q(e,t){return f(t.type,B,e,t)}V.displayName="DialogContext";var K,W,Y,q=r.RenderStrategy|r.Static,J=Object.assign(v((function(e,n){var r,o,l=e.open,f=e.onClose,p=e.initialFocus,v=c(e,["open","onClose","initialFocus"]),m=t.useRef(null),h=b(m,n),g=e.hasOwnProperty("open"),w=e.hasOwnProperty("onClose");if(!g&&!w)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!g)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!w)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof l)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+l);if("function"!=typeof f)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+f);var S=l?j.Open:j.Closed,x=t.useReducer(Q,{titleElement:null,descriptionElement:null}),C=x[0],I=x[1],O=t.useCallback((function(){return f(!1)}),[f]),k=t.useCallback((function(e){return I({type:G.SetTitleElement,element:e})}),[I]),R=t.useCallback((function(e){return I({type:G.SetDescriptionElement,element:e})}),[I]);t.useEffect((function(){function e(e){var t;S===j.Open&&((null==(t=m.current)?void 0:t.contains(e.target))||O())}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[S,m,O]),t.useEffect((function(){function e(e){e.key===i.Escape&&S===j.Open&&O()}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[O,S]),t.useEffect((function(){if(S===j.Open){var e=document.documentElement.style.overflow,t=document.documentElement.style.paddingRight,n=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=n+"px",function(){document.documentElement.style.overflow=e,document.documentElement.style.paddingRight=t}}}),[S]),t.useEffect((function(){if(S===j.Open&&m.current){var e=new IntersectionObserver((function(e){for(var t,n=s(e);!(t=n()).done;){var r=t.value;0===r.boundingClientRect.x&&0===r.boundingClientRect.y&&0===r.boundingClientRect.width&&0===r.boundingClientRect.height&&O()}}));return e.observe(m.current),function(){return e.disconnect()}}}),[S,m,O]);var L=!!e.static||S===j.Open;T(m,L,{initialFocus:p}),function(e,t){void 0===t&&(t=!0),y((function(){if(t&&e.current){for(var n,r=e.current,o=new Map,i=s(N(r));!(n=i()).done;){var u=n.value;o.set(u,{"aria-hidden":u.getAttribute("aria-hidden"),inert:u.inert})}document.querySelectorAll("body > *").forEach((function(e){e!==r&&e instanceof HTMLElement&&(e.contains(r)||o.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}))}));for(var a,c=s(o.keys());!(a=c()).done;){var l=a.value;l.setAttribute("aria-hidden","true"),l.inert=!0}return function(){for(var e,t=s(o.entries());!(e=t()).done;){var n=e.value,r=n[0],i=n[1];null!==r&&(null===i["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",i["aria-hidden"]),r.inert=i.inert)}o.clear()}}}),[t])}(m,L);var P="headlessui-dialog-"+E(),D=t.useMemo((function(){return[{dialogState:S,close:O,setTitle:k,setDescription:R},C]}),[S,C,O,k,R]),F=t.useMemo((function(){return{open:S===j.Open}}),[S]),M={ref:h,id:P,role:"dialog","aria-modal":S===j.Open||void 0,"aria-labelledby":null==(r=C.titleElement)?void 0:r.id,"aria-describedby":null==(o=C.descriptionElement)?void 0:o.id};return u.createElement(H,null,u.createElement(V.Provider,{value:D},d(a({},v,M),F,"div",q,S===j.Open)))})),{Overlay:v((function e(n,r){var o=_([J.name,e.name].join("."))[0],i=o.dialogState,u=o.close,c=b(r),l="headlessui-dialog-overlay-"+E(),s=t.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();u()}),[u]),f=t.useMemo((function(){return{open:i===j.Open}}),[i]);return d(a({},n,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")})),Title:function e(n){var r=_([J.name,e.name].join("."))[0],o=r.dialogState,i=r.setTitle,u="headlessui-dialog-title-"+E(),c=t.useMemo((function(){return{open:o===j.Open}}),[o]);return d(a({},n,{ref:i,id:u}),c,"h2")},Description:function e(n){var r=_([J.name,e.name].join("."))[0],o=r.dialogState,i=r.setDescription,u="headlessui-dialog-description-"+E(),c=t.useMemo((function(){return{open:o===j.Open}}),[o]);return d(a({},n,{ref:i,id:u}),c,"p")}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(W||(W={})),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 $=((K={})[Y.ToggleDisclosure]=function(e){var t;return a({},e,{disclosureState:f(e.disclosureState,(t={},t[W.Open]=W.Closed,t[W.Closed]=W.Open,t))})},K[Y.LinkPanel]=function(e){return!0===e.linkedPanel?e:a({},e,{linkedPanel:!0})},K[Y.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:a({},e,{linkedPanel:!1})},K[Y.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:a({},e,{buttonId:t.buttonId})},K[Y.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:a({},e,{panelId:t.panelId})},K),z=t.createContext(null);function X(e){var n=t.useContext(z);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+te.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,X),r}return n}function Z(e,t){return f(t.type,$,e,t)}z.displayName="DisclosureContext";var ee=t.Fragment;function te(e){var n="headlessui-disclosure-button-"+E(),r="headlessui-disclosure-panel-"+E(),o=t.useReducer(Z,{disclosureState:W.Closed,linkedPanel:!1,buttonId:n,panelId:r}),i=o[0].disclosureState,a=o[1];t.useEffect((function(){return a({type:Y.SetButtonId,buttonId:n})}),[n,a]),t.useEffect((function(){return a({type:Y.SetPanelId,panelId:r})}),[r,a]);var c=t.useMemo((function(){return{open:i===W.Open}}),[i]);return u.createElement(z.Provider,{value:o},d(e,c,ee))}var ne,re,oe,ie,ue=v((function e(n,r){var o=X([te.name,e.name].join(".")),u=o[0],c=o[1],l=b(r),s=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:e.preventDefault(),c({type:Y.ToggleDisclosure})}}),[c]),f=t.useCallback((function(e){h(e.currentTarget)||n.disabled||c({type:Y.ToggleDisclosure})}),[c,n.disabled]),p=t.useMemo((function(){return{open:u.disclosureState===W.Open}}),[u]);return d(a({},n,{ref:l,id:u.buttonId,type:"button","aria-expanded":u.disclosureState===W.Open||void 0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:s,onClick:f}),p,"button")})),ae=r.RenderStrategy|r.Static,ce=v((function e(n,r){var o=X([te.name,e.name].join(".")),i=o[0],u=o[1],c=b(r,(function(){i.linkedPanel||u({type:Y.LinkPanel})}));t.useEffect((function(){return function(){return u({type:Y.UnlinkPanel})}}),[u]),t.useEffect((function(){var e;i.disclosureState!==W.Closed||null!=(e=n.unmount)&&!e||u({type:Y.UnlinkPanel})}),[i.disclosureState,n.unmount,u]);var l=t.useMemo((function(){return{open:i.disclosureState===W.Open}}),[i]);return d(a({},n,{ref:c,id:i.panelId}),l,"div",ae,i.disclosureState===W.Open)}));function le(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=s(e.splice(0));!(t=n()).done;)(0,t.value)()}};return t}function se(){var e=t.useState(le)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function fe(e,n){var r=t.useState(e),o=r[0],i=r[1],u=t.useRef(e);return y((function(){u.current=e}),[e]),y((function(){return i(u.current)}),[u,i].concat(n)),o}function de(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),o=null!=r?r:-1,i=function(){switch(e.focus){case ne.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case ne.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==o&&r.length-n-1>=o||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case ne.Next:return n.findIndex((function(e,n){return!(n<=o||t.resolveDisabled(e))}));case ne.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case ne.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case ne.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?r:i}function pe(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}te.Button=ue,te.Panel=ce,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"}(ne||(ne={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(oe||(oe={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(ie||(ie={}));var ve=((re={})[ie.CloseListbox]=function(e){return e.disabled||e.listboxState===oe.Closed?e:a({},e,{activeOptionIndex:null,listboxState:oe.Closed})},re[ie.OpenListbox]=function(e){return e.disabled||e.listboxState===oe.Open?e:a({},e,{listboxState:oe.Open})},re[ie.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:a({},e,{disabled:t.disabled})},re[ie.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===oe.Closed)return e;var n=de(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===n?e:a({},e,{searchQuery:"",activeOptionIndex:n})},re[ie.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===oe.Closed)return e;var n=e.searchQuery+t.value,r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return a({},e,-1===r||r===e.activeOptionIndex?{searchQuery:n}:{searchQuery:n,activeOptionIndex:r})},re[ie.ClearSearch]=function(e){return e.disabled||e.listboxState===oe.Closed||""===e.searchQuery?e:a({},e,{searchQuery:""})},re[ie.RegisterOption]=function(e,t){return a({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},re[ie.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{options:n,activeOptionIndex:o===e.activeOptionIndex||null===r?null:n.indexOf(r)})},re),me=t.createContext(null);function be(e){var n=t.useContext(me);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+ge.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,be),r}return n}function he(e,t){return f(t.type,ve,e,t)}me.displayName="ListboxContext";var ye=t.Fragment;function ge(e){var n=e.value,r=e.onChange,o=e.disabled,i=void 0!==o&&o,a=c(e,["value","onChange","disabled"]),l=t.useReducer(he,{listboxState:oe.Closed,propsRef:{current:{value:n,onChange:r}},labelRef:t.createRef(),buttonRef:t.createRef(),optionsRef:t.createRef(),disabled:i,options:[],searchQuery:"",activeOptionIndex:null}),s=l[0],f=s.listboxState,p=s.propsRef,v=s.optionsRef,m=s.buttonRef,b=l[1];y((function(){p.current.value=n}),[n,p]),y((function(){p.current.onChange=r}),[r,p]),y((function(){return b({type:ie.SetDisabled,disabled:i})}),[i]),t.useEffect((function(){function e(e){var t,n,r,o=e.target;f===oe.Open&&((null==(t=m.current)?void 0:t.contains(o))||(null==(n=v.current)?void 0:n.contains(o))||(b({type:ie.CloseListbox}),R(o)||(e.preventDefault(),null==(r=m.current)||r.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[f,m,v,b]);var h=t.useMemo((function(){return{open:f===oe.Open,disabled:i}}),[f,i]);return u.createElement(me.Provider,{value:l},d(a,h,ye))}var we,Se,Ee,xe=v((function e(n,r){var o,u=be([ge.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.buttonRef,r),f="headlessui-listbox-button-"+E(),p=se(),v=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:case i.ArrowDown:e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ie.GoToOption,focus:ne.First})}));break;case i.ArrowUp:e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ie.GoToOption,focus:ne.Last})}))}}),[l,c,p]),m=t.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();c.listboxState===oe.Open?(l({type:ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})})))}),[l,p,c]),y=fe((function(){if(c.labelRef.current)return[c.labelRef.current.id,f].join(" ")}),[c.labelRef.current,f]),g=t.useMemo((function(){return{open:c.listboxState===oe.Open,disabled:c.disabled}}),[c]);return d(a({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=c.optionsRef.current)?void 0:o.id,"aria-expanded":c.listboxState===oe.Open||void 0,"aria-labelledby":y,disabled:c.disabled,onKeyDown:v,onClick:m}),g,"button")})),Ce=r.RenderStrategy|r.Static,Ie=v((function e(n,r){var o,u=be([ge.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.optionsRef,r),f="headlessui-listbox-options-"+E(),p=se(),v=se(),m=t.useCallback((function(e){switch(v.dispose(),e.key){case i.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:ie.Search,value:e.key});case i.Enter:e.preventDefault(),l({type:ie.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),le().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.ArrowDown:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Next});case i.ArrowUp:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Previous});case i.Home:case i.PageUp:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.First});case i.End:case i.PageDown:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Last});case i.Escape:return e.preventDefault(),l({type:ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case i.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:ie.Search,value:e.key}),v.setTimeout((function(){return l({type:ie.ClearSearch})}),350))}}),[p,l,v,c]),h=fe((function(){var e,t,n;return null!=(e=null==(t=c.labelRef.current)?void 0:t.id)?e:null==(n=c.buttonRef.current)?void 0:n.id}),[c.labelRef.current,c.buttonRef.current]),y=t.useMemo((function(){return{open:c.listboxState===oe.Open}}),[c]);return d(a({},n,{"aria-activedescendant":null===c.activeOptionIndex||null==(o=c.options[c.activeOptionIndex])?void 0:o.id,"aria-labelledby":h,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),y,"ul",Ce,c.listboxState===oe.Open)}));ge.Button=xe,ge.Label=function e(n){var r=be([ge.name,e.name].join("."))[0],o="headlessui-listbox-label-"+E(),i=t.useCallback((function(){var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[r.buttonRef]),u=t.useMemo((function(){return{open:r.listboxState===oe.Open,disabled:r.disabled}}),[r]);return d(a({},n,{ref:r.labelRef,id:o,onClick:i}),u,"label")},ge.Options=Ie,ge.Option=function e(n){var r=n.disabled,o=void 0!==r&&r,i=n.value,u=n.className,l=c(n,["disabled","value","className"]),s=be([ge.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-listbox-option-"+E(),m=null!==f.activeOptionIndex&&f.options[f.activeOptionIndex].id===v,b=f.propsRef.current.value===i,h=t.useRef({disabled:o,value:i});y((function(){h.current.disabled=o}),[h,o]),y((function(){h.current.value=i}),[h,i]),y((function(){var e,t;h.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[h,v]);var g=t.useCallback((function(){return f.propsRef.current.onChange(i)}),[f.propsRef,i]);y((function(){return p({type:ie.RegisterOption,id:v,dataRef:h}),function(){return p({type:ie.UnregisterOption,id:v})}}),[h,v]),y((function(){var e;f.listboxState===oe.Open&&b&&(p({type:ie.GoToOption,focus:ne.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[f.listboxState]),y((function(){if(f.listboxState===oe.Open&&m){var e=le();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.listboxState]);var w=t.useCallback((function(e){if(o)return e.preventDefault();g(),p({type:ie.CloseListbox}),le().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,f.buttonRef,o,g]),S=t.useCallback((function(){if(o)return p({type:ie.GoToOption,focus:ne.Nothing});p({type:ie.GoToOption,focus:ne.Specific,id:v})}),[o,v,p]),x=t.useCallback((function(){o||m||p({type:ie.GoToOption,focus:ne.Specific,id:v})}),[o,m,v,p]),C=t.useCallback((function(){o||m&&p({type:ie.GoToOption,focus:ne.Nothing})}),[o,m,p]),I=t.useMemo((function(){return{active:m,selected:b,disabled:o}}),[m,b,o]);return d(a({},l,{id:v,role:"option",tabIndex:-1,className:pe(u,I),"aria-disabled":!0===o||void 0,"aria-selected":!0===b||void 0,onClick:w,onFocus:S,onPointerMove:x,onMouseMove:x,onPointerLeave:C,onMouseLeave:C}),I,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Se||(Se={})),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"}(Ee||(Ee={}));var Oe=((we={})[Ee.CloseMenu]=function(e){return e.menuState===Se.Closed?e:a({},e,{activeItemIndex:null,menuState:Se.Closed})},we[Ee.OpenMenu]=function(e){return e.menuState===Se.Open?e:a({},e,{menuState:Se.Open})},we[Ee.GoToItem]=function(e,t){var n=de(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===n?e:a({},e,{searchQuery:"",activeItemIndex:n})},we[Ee.Search]=function(e,t){var n=e.searchQuery+t.value,r=e.items.findIndex((function(e){var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))&&!e.dataRef.current.disabled}));return a({},e,-1===r||r===e.activeItemIndex?{searchQuery:n}:{searchQuery:n,activeItemIndex:r})},we[Ee.ClearSearch]=function(e){return""===e.searchQuery?e:a({},e,{searchQuery:""})},we[Ee.RegisterItem]=function(e,t){return a({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},we[Ee.UnregisterItem]=function(e,t){var n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{items:n,activeItemIndex:o===e.activeItemIndex||null===r?null:n.indexOf(r)})},we),ke=t.createContext(null);function Re(e){var n=t.useContext(ke);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+Te.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Re),r}return n}function Le(e,t){return f(t.type,Oe,e,t)}ke.displayName="MenuContext";var Pe=t.Fragment;function Te(e){var n=t.useReducer(Le,{menuState:Se.Closed,buttonRef:t.createRef(),itemsRef:t.createRef(),items:[],searchQuery:"",activeItemIndex:null}),r=n[0],o=r.menuState,i=r.itemsRef,a=r.buttonRef,c=n[1];t.useEffect((function(){function e(e){var t,n,r,u=e.target;o===Se.Open&&((null==(t=a.current)?void 0:t.contains(u))||(null==(n=i.current)?void 0:n.contains(u))||(c({type:Ee.CloseMenu}),R(u)||(e.preventDefault(),null==(r=a.current)||r.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[o,a,i,c]);var l=t.useMemo((function(){return{open:o===Se.Open}}),[o]);return u.createElement(ke.Provider,{value:n},d(e,l,Pe))}var De,Fe,Me,Ne=v((function e(n,r){var o,u=Re([Te.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.buttonRef,r),f="headlessui-menu-button-"+E(),p=se(),v=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:case i.ArrowDown:e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:Ee.GoToItem,focus:ne.First})}));break;case i.ArrowUp:e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:Ee.GoToItem,focus:ne.Last})}))}}),[l,c,p]),m=t.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();n.disabled||(c.menuState===Se.Open?(l({type:Ee.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,n.disabled]),y=t.useMemo((function(){return{open:c.menuState===Se.Open}}),[c]);return d(a({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=c.itemsRef.current)?void 0:o.id,"aria-expanded":c.menuState===Se.Open||void 0,onKeyDown:v,onClick:m}),y,"button")})),Ae=r.RenderStrategy|r.Static,je=v((function e(n,r){var o,u,c=Re([Te.name,e.name].join(".")),l=c[0],s=c[1],f=b(l.itemsRef,r),p="headlessui-menu-items-"+E(),v=se();y((function(){var e=l.itemsRef.current;if(e&&l.menuState===Se.Open)for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});t.nextNode();)t.currentNode.setAttribute("role","none")}));var m=t.useCallback((function(e){switch(v.dispose(),e.key){case i.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:Ee.Search,value:e.key});case i.Enter:var t;e.preventDefault(),s({type:Ee.CloseMenu}),null!==l.activeItemIndex&&(null==(t=document.getElementById(l.items[l.activeItemIndex].id))||t.click()),le().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.ArrowDown:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Next});case i.ArrowUp:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Previous});case i.Home:case i.PageUp:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.First});case i.End:case i.PageDown:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Last});case i.Escape:e.preventDefault(),s({type:Ee.CloseMenu}),le().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:Ee.Search,value:e.key}),v.setTimeout((function(){return s({type:Ee.ClearSearch})}),350))}}),[s,v,l]),h=t.useMemo((function(){return{open:l.menuState===Se.Open}}),[l]);return d(a({},n,{"aria-activedescendant":null===l.activeItemIndex||null==(o=l.items[l.activeItemIndex])?void 0:o.id,"aria-labelledby":null==(u=l.buttonRef.current)?void 0:u.id,id:p,onKeyDown:m,role:"menu",tabIndex:0,ref:f}),h,"div",Ae,l.menuState===Se.Open)})),Ge=t.Fragment;Te.Button=Ne,Te.Items=je,Te.Item=function e(n){var r=n.disabled,o=void 0!==r&&r,i=n.className,u=n.onClick,l=c(n,["disabled","className","onClick"]),s=Re([Te.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-menu-item-"+E(),m=null!==f.activeItemIndex&&f.items[f.activeItemIndex].id===v;y((function(){if(f.menuState===Se.Open&&m){var e=le();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.menuState]);var b=t.useRef({disabled:o});y((function(){b.current.disabled=o}),[b,o]),y((function(){var e,t;b.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[b,v]),y((function(){return p({type:Ee.RegisterItem,id:v,dataRef:b}),function(){return p({type:Ee.UnregisterItem,id:v})}}),[b,v]);var h=t.useCallback((function(e){return o?e.preventDefault():(p({type:Ee.CloseMenu}),le().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[p,f.buttonRef,o,u]),g=t.useCallback((function(){if(o)return p({type:Ee.GoToItem,focus:ne.Nothing});p({type:Ee.GoToItem,focus:ne.Specific,id:v})}),[o,v,p]),w=t.useCallback((function(){o||m||p({type:Ee.GoToItem,focus:ne.Specific,id:v})}),[o,m,v,p]),S=t.useCallback((function(){o||m&&p({type:Ee.GoToItem,focus:ne.Nothing})}),[o,m,p]),x=t.useMemo((function(){return{active:m,disabled:o}}),[m,o]);return d(a({},l,{id:v,role:"menuitem",tabIndex:-1,className:pe(i,x),"aria-disabled":!0===o||void 0,onClick:h,onFocus:g,onPointerMove:w,onMouseMove:w,onPointerLeave:S,onMouseLeave:S}),x,Ge)},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Fe||(Fe={})),function(e){e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId"}(Me||(Me={}));var Ue=((De={})[Me.TogglePopover]=function(e){var t;return a({},e,{popoverState:f(e.popoverState,(t={},t[Fe.Open]=Fe.Closed,t[Fe.Closed]=Fe.Open,t))})},De[Me.ClosePopover]=function(e){return e.popoverState===Fe.Closed?e:a({},e,{popoverState:Fe.Closed})},De[Me.SetButton]=function(e,t){return e.button===t.button?e:a({},e,{button:t.button})},De[Me.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:a({},e,{buttonId:t.buttonId})},De[Me.SetPanel]=function(e,t){return e.panel===t.panel?e:a({},e,{panel:t.panel})},De[Me.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:a({},e,{panelId:t.panelId})},De),He=t.createContext(null);function Be(e){var n=t.useContext(He);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+We.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Be),r}return n}He.displayName="PopoverContext";var Ve=t.createContext(null);function _e(){return t.useContext(Ve)}Ve.displayName="PopoverGroupContext";var Qe=t.createContext(null);function Ke(e,t){return f(t.type,Ue,e,t)}function We(e){var n="headlessui-popover-button-"+E(),r="headlessui-popover-panel-"+E(),o=t.useReducer(Ke,{popoverState:Fe.Closed,linkedPanel:!1,button:null,buttonId:n,panel:null,panelId:r}),i=o[0],a=i.popoverState,c=i.button,l=i.panel,s=o[1];t.useEffect((function(){return s({type:Me.SetButtonId,buttonId:n})}),[n,s]),t.useEffect((function(){return s({type:Me.SetPanelId,panelId:r})}),[r,s]);var f=t.useMemo((function(){return{buttonId:n,panelId:r,close:function(){return s({type:Me.ClosePopover})}}}),[n,r,s]),p=_e(),v=null==p?void 0:p.registerPopover,m=t.useCallback((function(){var e;return null!=(e=null==p?void 0:p.isFocusWithinPopoverGroup())?e:(null==c?void 0:c.contains(document.activeElement))||(null==l?void 0:l.contains(document.activeElement))}),[p,c,l]);t.useEffect((function(){return null==v?void 0:v(f)}),[v,f]),t.useEffect((function(){if(a===Fe.Open)return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)};function e(){m()||c&&l&&s({type:Me.ClosePopover})}}),[a,m,p,c,l,s]),t.useEffect((function(){function e(e){var t=e.target;a===Fe.Open&&((null==c?void 0:c.contains(t))||(null==l?void 0:l.contains(t))||(s({type:Me.ClosePopover}),R(t)||(e.preventDefault(),null==c||c.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[a,c,l,s]);var b=t.useMemo((function(){return{open:a===Fe.Open}}),[a]);return u.createElement(He.Provider,{value:o},d(e,b,"div"))}Qe.displayName="PopoverPanelContext";var Ye=v((function e(n,r){var o=Be([We.name,e.name].join(".")),u=o[0],c=o[1],l=t.useRef(null),s=_e(),f=null==s?void 0:s.closeOthers,p=t.useContext(Qe),v=null!==p&&p===u.panelId,m=b(l,r,v?null:function(e){return c({type:Me.SetButton,button:e})}),y=t.useRef(null),g=t.useRef("undefined"==typeof window?null:document.activeElement);t.useEffect((function(){function e(){g.current=y.current,y.current=document.activeElement}return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)}}),[g,y]);var w=t.useCallback((function(e){var t;if(v){if(u.popoverState===Fe.Closed)return;switch(e.key){case i.Space:case i.Enter:e.preventDefault(),c({type:Me.ClosePopover}),null==(t=u.button)||t.focus()}}else switch(e.key){case i.Space:case i.Enter:e.preventDefault(),u.popoverState===Fe.Closed&&(null==f||f(u.buttonId)),c({type:Me.TogglePopover});break;case i.Escape:if(u.popoverState!==Fe.Open)return null==f?void 0:f(u.buttonId);if(!l.current)return;if(!l.current.contains(document.activeElement))return;c({type:Me.ClosePopover});break;case i.Tab:if(u.popoverState!==Fe.Open)return;if(!u.panel)return;if(!u.button)return;if(e.shiftKey){var n;if(!g.current)return;if(null==(n=u.button)?void 0:n.contains(g.current))return;if(u.panel.contains(g.current))return;var r=k(),o=r.indexOf(g.current);if(r.indexOf(u.button)>o)return;e.preventDefault(),e.stopPropagation(),P(u.panel,x.Last)}else e.preventDefault(),e.stopPropagation(),P(u.panel,x.First)}}),[c,u.popoverState,u.buttonId,u.button,u.panel,l,f,v]),S=t.useCallback((function(e){var t;if(!v&&u.popoverState===Fe.Open&&u.panel&&u.button)switch(e.key){case i.Tab:if(!g.current)return;if(null==(t=u.button)?void 0:t.contains(g.current))return;if(u.panel.contains(g.current))return;var n=k(),r=n.indexOf(g.current);if(n.indexOf(u.button)>r)return;e.preventDefault(),P(u.panel,x.Last)}}),[u.popoverState,u.panel,u.button,v]),E=t.useCallback((function(e){var t;h(e.currentTarget)||n.disabled||(v?(c({type:Me.ClosePopover}),null==(t=u.button)||t.focus()):(u.popoverState===Fe.Closed&&(null==f||f(u.buttonId)),c({type:Me.TogglePopover})))}),[c,u.button,u.popoverState,u.buttonId,n.disabled,f,v]),C=t.useMemo((function(){return{open:u.popoverState===Fe.Open}}),[u]);return d(a({},n,v?{type:"button",onKeyDown:w,onClick:E}:{ref:m,id:u.buttonId,type:"button","aria-expanded":u.popoverState===Fe.Open||void 0,"aria-controls":u.panel?u.panelId:void 0,onKeyDown:w,onKeyUp:S,onClick:E}),C,"button")})),qe=v((function e(n,r){var o=Be([We.name,e.name].join(".")),i=o[0].popoverState,u=o[1],c=b(r),l="headlessui-popover-overlay-"+E(),s=t.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();u({type:Me.ClosePopover})}),[u]),f=t.useMemo((function(){return{open:i===Fe.Open}}),[i]);return d(a({},n,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")})),Je=r.RenderStrategy|r.Static,$e=v((function e(n,r){var o=n.focus,l=void 0!==o&&o,s=c(n,["focus"]),f=Be([We.name,e.name].join(".")),p=f[0],v=f[1],m=t.useRef(null),h=b(m,r,(function(e){v({type:Me.SetPanel,panel:e})})),y=t.useCallback((function(e){var t;switch(e.key){case i.Escape:if(p.popoverState!==Fe.Open)return;if(!m.current)return;if(!m.current.contains(document.activeElement))return;e.preventDefault(),v({type:Me.ClosePopover}),null==(t=p.button)||t.focus()}}),[p,m,v]);t.useEffect((function(){return function(){return v({type:Me.SetPanel,panel:null})}}),[v]),t.useEffect((function(){var e;p.popoverState!==Fe.Closed||null!=(e=n.unmount)&&!e||v({type:Me.SetPanel,panel:null})}),[p.popoverState,n.unmount,v]),t.useEffect((function(){if(l&&p.popoverState===Fe.Open&&m.current){var e=document.activeElement;m.current.contains(e)||P(m.current,x.First)}}),[l,m,p.popoverState]),t.useEffect((function(){if(p.popoverState===Fe.Open&&m.current)return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)};function e(e){if(e.key===i.Tab&&document.activeElement&&m.current&&m.current.contains(document.activeElement)){e.preventDefault();var t,n=P(m.current,e.shiftKey?x.Previous:x.Next);if(n===C.Underflow)return null==(t=p.button)?void 0:t.focus();if(n===C.Overflow){if(!p.button)return;var r=k(),o=r.indexOf(p.button);P(r.splice(o+1).filter((function(e){var t;return!(null==(t=m.current)?void 0:t.contains(e))})),x.First)===C.Error&&P(document.body,x.First)}}}}),[l,m,p.popoverState,p.button]),t.useEffect((function(){if(l&&p.popoverState===Fe.Open&&m.current)return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)};function e(){var e;(null==(e=m.current)?void 0:e.contains(document.activeElement))||v({type:Me.ClosePopover})}}),[l,p.popoverState,v]);var g=t.useMemo((function(){return{open:p.popoverState===Fe.Open}}),[p]);return u.createElement(Qe.Provider,{value:p.panelId},d(a({},s,{ref:h,id:p.panelId,onKeyDown:y}),g,"div",Je,p.popoverState===Fe.Open))}));We.Button=Ye,We.Overlay=qe,We.Panel=$e,We.Group=function(e){var n=t.useRef(null),r=t.useState([]),o=r[0],i=r[1],c=t.useCallback((function(e){i((function(t){var n=t.indexOf(e);if(-1!==n){var r=t.slice();return r.splice(n,1),r}return t}))}),[i]),l=t.useCallback((function(e){return i((function(t){return[].concat(t,[e])})),function(){return c(e)}}),[i,c]),f=t.useCallback((function(){var e,t=document.activeElement;return!!(null==(e=n.current)?void 0:e.contains(t))||o.some((function(e){var n,r;return(null==(n=document.getElementById(e.buttonId))?void 0:n.contains(t))||(null==(r=document.getElementById(e.panelId))?void 0:r.contains(t))}))}),[n,o]),p=t.useCallback((function(e){for(var t,n=s(o);!(t=n()).done;){var r=t.value;r.buttonId!==e&&r.close()}}),[o]),v=t.useMemo((function(){return{registerPopover:l,unregisterPopover:c,isFocusWithinPopoverGroup:f,closeOthers:p}}),[l,c,f,p]),m=t.useMemo((function(){return{}}),[]);return u.createElement(Ve.Provider,{value:v},d(a({},e,{ref:n}),m,"div"))};var ze=t.createContext(null);function Xe(e){var n=t.useContext(ze);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Xe),r}return n}ze.displayName="GroupContext";var Ze,et=t.Fragment;function tt(e){var n,r,o=e.checked,u=e.onChange,l=e.className,s=c(e,["checked","onChange","className"]),f="headlessui-switch-"+E(),p=t.useContext(ze),v=t.useCallback((function(){return u(!o)}),[u,o]),m=t.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),b=t.useCallback((function(e){e.key!==i.Tab&&e.preventDefault(),e.key===i.Space&&v()}),[v]),y=t.useCallback((function(e){return e.preventDefault()}),[]),g=t.useMemo((function(){return{checked:o}}),[o]),w={id:f,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:pe(l,g),"aria-checked":o,"aria-labelledby":null==p||null==(n=p.label)?void 0:n.id,"aria-describedby":null==p||null==(r=p.description)?void 0:r.id,onClick:m,onKeyUp:b,onKeyPress:y};return"button"===s.as&&Object.assign(w,{type:"button"}),d(a({},s,w),g,"button")}function nt(){var e=t.useRef(!0);return t.useEffect((function(){e.current=!1}),[]),e.current}function rt(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function ot(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function it(e,t,n,r,o){var i=le(),u=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return rt.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){ot.apply(void 0,[e].concat(n)),rt.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=le();if(!e)return n.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),i=o[0];return 0!==i?n.setTimeout((function(){t(Ze.Finished)}),i+o[1]):t(Ze.Finished),n.add((function(){return t(Ze.Cancelled)})),n.dispose}(e,(function(n){return ot.apply(void 0,[e].concat(r,t)),u(n)})))})),i.add((function(){return ot.apply(void 0,[e].concat(t,n,r))})),i.add((function(){return u(Ze.Cancelled)})),i.dispose}function ut(e){return void 0===e&&(e=""),t.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}tt.Group=function(e){var n=t.useState(null),r=n[0],o=n[1],i=t.useState(null),a=i[0],c=i[1],l=t.useState(null),s=l[0],f=l[1],p=t.useMemo((function(){return{switch:r,setSwitch:o,label:a,setLabel:c,description:s,setDescription:f}}),[r,o,a,c,s,f]);return u.createElement(ze.Provider,{value:p},d(e,{},et))},tt.Label=function e(n){var r=Xe([tt.name,e.name].join(".")),o="headlessui-switch-label-"+E(),i=t.useCallback((function(){r.switch&&(r.switch.click(),r.switch.focus({preventScroll:!0}))}),[r.switch]);return d(a({},n,{ref:r.setLabel,id:o,onClick:i}),{},"label")},tt.Description=function e(t){var n=Xe([tt.name,e.name].join(".")),r="headlessui-switch-description-"+E();return d(a({},t,{ref:n.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Ze||(Ze={}));var at,ct=t.createContext(null);ct.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(at||(at={}));var lt=t.createContext(null);function st(e){return"children"in e?st(e.children):e.current.filter((function(e){return e.state===at.Visible})).length>0}function ft(e){var n=t.useRef(e),r=t.useRef([]),i=function(){var e=t.useRef(!0);return t.useEffect((function(){return function(){e.current=!1}}),[]),e}();t.useEffect((function(){n.current=e}),[e]);var u=t.useCallback((function(e,t){var u;void 0===t&&(t=o.Hidden);var a=r.current.findIndex((function(t){return t.id===e}));-1!==a&&(f(t,((u={})[o.Unmount]=function(){r.current.splice(a,1)},u[o.Hidden]=function(){r.current[a].state=at.Hidden},u)),!st(r)&&i.current&&(null==n.current||n.current()))}),[n,i,r]),a=t.useCallback((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==at.Visible&&(t.state=at.Visible):r.current.push({id:e,state:at.Visible}),function(){return u(e,o.Unmount)}}),[r,u]);return t.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function dt(){}lt.displayName="NestingContext";var pt=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function vt(e){for(var t,n={},r=s(pt);!(t=r()).done;){var o,i=t.value;n[i]=null!=(o=e[i])?o:dt}return n}var mt=r.RenderStrategy;function bt(e){var n=e.beforeEnter,r=e.afterEnter,i=e.beforeLeave,l=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,b=e.leaveFrom,h=e.leaveTo,g=c(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),w=t.useRef(null),S=t.useState(at.Visible),x=S[0],C=S[1],I=g.unmount?o.Unmount:o.Hidden,O=function(){var e=t.useContext(ct);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),k=O.show,R=O.appear,L=function(){var e=t.useContext(lt);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),P=L.register,T=L.unregister,D=nt(),F=E(),M=t.useRef(!1),N=ft((function(){M.current||(C(at.Hidden),T(F),V.current.afterLeave())}));y((function(){if(F)return P(F)}),[P,F]),y((function(){var e;I===o.Hidden&&F&&(k&&x!==at.Visible?C(at.Visible):f(x,((e={})[at.Hidden]=function(){return T(F)},e[at.Visible]=function(){return P(F)},e)))}),[x,F,P,T,k,I]);var A=ut(s),j=ut(p),G=ut(v),U=ut(m),H=ut(b),B=ut(h),V=function(e){var n=t.useRef(vt(e));return t.useEffect((function(){n.current=vt(e)}),[e]),n}({beforeEnter:n,afterEnter:r,beforeLeave:i,afterLeave:l});t.useEffect((function(){if(x===at.Visible&&null===w.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[w,x]);var _=D&&!R;return y((function(){var e=w.current;if(e&&!_)return M.current=!0,k&&V.current.beforeEnter(),k||V.current.beforeLeave(),k?it(e,A,j,G,(function(e){M.current=!1,e===Ze.Finished&&V.current.afterEnter()})):it(e,U,H,B,(function(e){M.current=!1,e===Ze.Finished&&(st(N)||(C(at.Hidden),T(F),V.current.afterLeave()))}))}),[V,F,M,T,N,w,_,k,A,j,G,U,H,B]),u.createElement(lt.Provider,{value:N},d(a({},g,{ref:w}),{},"div",mt,x===at.Visible))}function ht(e){var n=e.show,r=e.appear,o=void 0!==r&&r,i=e.unmount,l=c(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?at.Visible:at.Hidden),f=s[0],p=s[1],v=ft((function(){p(at.Hidden)})),m=nt(),b=t.useMemo((function(){return{show:n,appear:o||!m}}),[n,o,m]);t.useEffect((function(){n?p(at.Visible):st(v)||p(at.Hidden)}),[n,v]);var h={unmount:i};return u.createElement(lt.Provider,{value:v},u.createElement(ct.Provider,{value:b},d(a({},h,{as:t.Fragment,children:u.createElement(bt,Object.assign({},h,l))}),{},t.Fragment,mt,f===at.Visible)))}ht.Child=bt,e.Dialog=J,e.Disclosure=te,e.FocusTrap=function(e){var n=t.useRef(null),r=e.initialFocus,o=c(e,["initialFocus"]);return T(n,!0,{initialFocus:r}),d(a({},o,{ref:n}),{},"div")},e.Listbox=ge,e.Menu=Te,e.Popover=We,e.Portal=H,e.Switch=tt,e.Transition=ht,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e=e||self).headlessui={},e.React,e.reactDom)}(this,(function(e,t,n){"use strict";var r,o,i,u="default"in t?t.default:t;function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);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(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){if(e in t){for(var n=t[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,o):n}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(e,t,n,i,u){if(void 0===u&&(u=!0),u)return p(e,t,n);var l=null!=i?i:r.None;if(l&r.Static){var s=e.static,d=void 0!==s&&s,v=c(e,["static"]);if(d)return p(v,t,n)}if(l&r.RenderStrategy){var m,b=e.unmount,h=void 0===b||b,y=c(e,["unmount"]);return f(h?o.Unmount:o.Hidden,((m={})[o.Unmount]=function(){return null},m[o.Hidden]=function(){return p(a({},y,{hidden:!0,style:{display:"none"}}),t,n)},m))}return p(e,t,n)}function p(e,n,r){var o,i=m(e,["unmount","static"]),u=i.as,a=void 0===u?r:u,l=i.children,f=i.refName,d=void 0===f?"ref":f,v=c(i,["as","children","refName"]),b=void 0!==e.ref?((o={})[d]=e.ref,o):{},h="function"==typeof l?l(n):l;if(a===t.Fragment&&Object.keys(v).length>0){if(Array.isArray(h)&&h.length>1){var y=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(y,p),y}if(!t.isValidElement(h)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,p),g}return t.cloneElement(h,Object.assign({},function(e,t,n){for(var r,o=Object.assign({},e),i=function(){var n,i=r.value;void 0!==e[i]&&void 0!==t[i]&&Object.assign(o,((n={})[i]=function(n){n.defaultPrevented||e[i](n),n.defaultPrevented||t[i](n)},n))},u=s(["onClick"]);!(r=u()).done;)i();return o}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(m(v,["ref"])),h.props),b))}return t.createElement(a,Object.assign({},m(v,["ref"]),a!==t.Fragment&&b),h)}function v(e){var n;return Object.assign(t.forwardRef(e),{displayName:null!=(n=e.displayName)?n:e.name})}function m(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),o=s(t);!(n=o()).done;){var i=n.value;i in r&&delete r[i]}return r}function b(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=t.useRef(n);return t.useEffect((function(){o.current=n}),[n]),t.useCallback((function(e){for(var t,n=s(o.current);!(t=n()).done;){var r=t.value;null!=r&&("function"==typeof r?r(e):r.current=e)}}),[o])}function h(e){for(var t,n,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var i=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!i||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(o))&&i}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(r||(r={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(o||(o={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(i||(i={}));var y="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,g={serverHandoffComplete:!1},w=0;function S(){return++w}function E(){var e=t.useState(g.serverHandoffComplete?S:null),n=e[0],r=e[1];return y((function(){null===n&&r(S())}),[n]),t.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=n?""+n:void 0}var x,C,I,O=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function k(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(O))}function R(e){return e.matches(O)}function L(e){null==e||e.focus({preventScroll:!0})}function P(e,t){var n=Array.isArray(e)?e:k(e),r=document.activeElement,o=function(){if(t&(x.First|x.Next))return I.Next;if(t&(x.Previous|x.Last))return I.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),i=function(){if(t&x.First)return 0;if(t&x.Previous)return Math.max(0,n.indexOf(r))-1;if(t&x.Next)return Math.max(0,n.indexOf(r))+1;if(t&x.Last)return n.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),u=t&x.NoScroll?{preventScroll:!0}:{},a=0,c=n.length,l=void 0;do{var s;if(a>=c||a+c<=0)return C.Error;var f=i+a;if(t&x.WrapAround)f=(f+c)%c;else{if(f<0)return C.Underflow;if(f>=c)return C.Overflow}null==(s=l=n[f])||s.focus(u),a+=o}while(l!==document.activeElement);return C.Success}function T(e,n,r){void 0===n&&(n=!0),void 0===r&&(r={});var o=t.useRef("undefined"!=typeof window?document.activeElement:null),u=t.useRef(null),a=t.useRef(!1);y((function(){var t,i;if(n&&e.current){a.current=!0;var c,l=document.activeElement;if(null==(t=r.initialFocus)?void 0:t.current){if((null==(c=r.initialFocus)?void 0:c.current)===l)return}else if(e.current.contains(l))return;if(o.current=l,null==(i=r.initialFocus)?void 0:i.current)L(r.initialFocus.current);else if(P(e.current,x.First)===C.Error)throw new Error("There are no focusable elements inside the <FocusTrap />");return u.current=document.activeElement,function(){a.current=!1,L(o.current),o.current=null,u.current=null}}}),[n,e,a,r.initialFocus]),y((function(){if(n)return window.addEventListener("keydown",t),function(){return window.removeEventListener("keydown",t)};function t(t){t.key===i.Tab&&document.activeElement&&e.current&&(t.preventDefault(),P(e.current,(t.shiftKey?x.Previous:x.Next)|x.WrapAround)===C.Success&&(u.current=document.activeElement))}}),[n]),y((function(){if(n&&e.current){var t=e.current;return window.addEventListener("focus",r,!0),function(){return window.removeEventListener("focus",r,!0)}}function r(e){var n=u.current;if(n&&a.current){var r=e.target;r&&r instanceof HTMLElement?t.contains(r)?(u.current=r,L(r)):(e.preventDefault(),e.stopPropagation(),L(n)):L(u.current)}}}),[n,a,e])}function D(e,t){return e(t={exports:{}},t.exports),t.exports}!function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"}(x||(x={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(C||(C={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(I||(I={}));var F=D((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new x(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=w(u,n);if(a){if(a===s)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function d(){}function p(){}var v={};v[o]=function(){return this};var m=Object.getPrototypeOf,b=m&&m(m(C([])));b&&b!==t&&n.call(b,o)&&(v=b);var h=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(o,i){function u(){return new t((function(r,u){!function r(o,i,u,a){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return d.prototype=h.constructor=p,p.constructor=d,d.displayName=a(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,u,"GeneratorFunction")),e.prototype=Object.create(h),e},e.awrap=function(e){return{__await:e}},y(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},y(h),a(h,u,"Generator"),h[o]=function(){return this},h.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return u.type="throw",u.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),N=F.mark(M);function M(e){var t;return F.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.parentElement){n.next=2;break}return n.abrupt("return");case 2:t=e.parentElement.firstChild;case 3:if(!t){n.next=10;break}if(!(t!==e&&t instanceof HTMLElement)){n.next=7;break}return n.next=7,t;case 7:t=t.nextSibling,n.next=3;break;case 10:case"end":return n.stop()}}),N)}var A,j,G,U=t.Fragment;function H(e){var r=t.useState((function(){if("undefined"==typeof window)return null;var e=document.getElementById("headlessui-portal-root");if(e)return e;var t=document.createElement("div");return t.setAttribute("id","headlessui-portal-root"),document.body.appendChild(t)}))[0],o=t.useState((function(){return"undefined"==typeof window?null:document.createElement("div")}))[0];return y((function(){if(r&&o)return r.appendChild(o),function(){r&&o&&(r.removeChild(o),r.childNodes.length<=0&&document.body.removeChild(r))}}),[r]),r&&o?n.createPortal(d(e,{},U),o):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(j||(j={})),function(e){e[e.SetTitleElement=0]="SetTitleElement",e[e.SetDescriptionElement=1]="SetDescriptionElement"}(G||(G={}));var B=((A={})[G.SetTitleElement]=function(e,t){return e.titleElement===t.element?e:a({},e,{titleElement:t.element})},A[G.SetDescriptionElement]=function(e,t){return e.descriptionElement===t.element?e:a({},e,{descriptionElement:t.element})},A),V=t.createContext(null);function _(e){var n=t.useContext(V);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+J.displayName+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,_),r}return n}function Q(e,t){return f(t.type,B,e,t)}V.displayName="DialogContext";var K,W,Y,q=r.RenderStrategy|r.Static,J=Object.assign(v((function(e,n){var r,o,l=e.open,f=e.onClose,p=e.initialFocus,v=c(e,["open","onClose","initialFocus"]),m=t.useRef(null),h=b(m,n),g=e.hasOwnProperty("open"),w=e.hasOwnProperty("onClose");if(!g&&!w)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!g)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!w)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof l)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+l);if("function"!=typeof f)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+f);var S=l?j.Open:j.Closed,x=t.useReducer(Q,{titleElement:null,descriptionElement:null}),C=x[0],I=x[1],O=t.useCallback((function(){return f(!1)}),[f]),k=t.useCallback((function(e){return I({type:G.SetTitleElement,element:e})}),[I]),R=t.useCallback((function(e){return I({type:G.SetDescriptionElement,element:e})}),[I]);t.useEffect((function(){function e(e){var t;S===j.Open&&((null==(t=m.current)?void 0:t.contains(e.target))||O())}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[S,m,O]),t.useEffect((function(){function e(e){e.key===i.Escape&&S===j.Open&&O()}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[O,S]),t.useEffect((function(){if(S===j.Open){var e=document.documentElement.style.overflow,t=document.documentElement.style.paddingRight,n=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=n+"px",function(){document.documentElement.style.overflow=e,document.documentElement.style.paddingRight=t}}}),[S]),t.useEffect((function(){if(S===j.Open&&m.current){var e=new IntersectionObserver((function(e){for(var t,n=s(e);!(t=n()).done;){var r=t.value;0===r.boundingClientRect.x&&0===r.boundingClientRect.y&&0===r.boundingClientRect.width&&0===r.boundingClientRect.height&&O()}}));return e.observe(m.current),function(){return e.disconnect()}}}),[S,m,O]);var L=!!e.static||S===j.Open;T(m,L,{initialFocus:p}),function(e,t){void 0===t&&(t=!0),y((function(){if(t&&e.current){for(var n,r=e.current,o=new Map,i=s(M(r));!(n=i()).done;){var u=n.value;o.set(u,{"aria-hidden":u.getAttribute("aria-hidden"),inert:u.inert})}document.querySelectorAll("body > *").forEach((function(e){e!==r&&e instanceof HTMLElement&&(e.contains(r)||o.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}))}));for(var a,c=s(o.keys());!(a=c()).done;){var l=a.value;l.setAttribute("aria-hidden","true"),l.inert=!0}return function(){for(var e,t=s(o.entries());!(e=t()).done;){var n=e.value,r=n[0],i=n[1];null!==r&&(null===i["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",i["aria-hidden"]),r.inert=i.inert)}o.clear()}}}),[t])}(m,L);var P="headlessui-dialog-"+E(),D=t.useMemo((function(){return[{dialogState:S,close:O,setTitle:k,setDescription:R},C]}),[S,C,O,k,R]),F=t.useMemo((function(){return{open:S===j.Open}}),[S]),N={ref:h,id:P,role:"dialog","aria-modal":S===j.Open||void 0,"aria-labelledby":null==(r=C.titleElement)?void 0:r.id,"aria-describedby":null==(o=C.descriptionElement)?void 0:o.id};return u.createElement(H,null,u.createElement(V.Provider,{value:D},d(a({},v,N),F,"div",q,S===j.Open)))})),{Overlay:v((function e(n,r){var o=_([J.displayName,e.name].join("."))[0],i=o.dialogState,u=o.close,c=b(r),l="headlessui-dialog-overlay-"+E(),s=t.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();u()}),[u]),f=t.useMemo((function(){return{open:i===j.Open}}),[i]);return d(a({},n,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")})),Title:function e(n){var r=_([J.displayName,e.name].join("."))[0],o=r.dialogState,i=r.setTitle,u="headlessui-dialog-title-"+E(),c=t.useMemo((function(){return{open:o===j.Open}}),[o]);return d(a({},n,{ref:i,id:u}),c,"h2")},Description:function e(n){var r=_([J.displayName,e.name].join("."))[0],o=r.dialogState,i=r.setDescription,u="headlessui-dialog-description-"+E(),c=t.useMemo((function(){return{open:o===j.Open}}),[o]);return d(a({},n,{ref:i,id:u}),c,"p")}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(W||(W={})),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 $=((K={})[Y.ToggleDisclosure]=function(e){var t;return a({},e,{disclosureState:f(e.disclosureState,(t={},t[W.Open]=W.Closed,t[W.Closed]=W.Open,t))})},K[Y.LinkPanel]=function(e){return!0===e.linkedPanel?e:a({},e,{linkedPanel:!0})},K[Y.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:a({},e,{linkedPanel:!1})},K[Y.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:a({},e,{buttonId:t.buttonId})},K[Y.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:a({},e,{panelId:t.panelId})},K),z=t.createContext(null);function X(e){var n=t.useContext(z);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+te.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,X),r}return n}function Z(e,t){return f(t.type,$,e,t)}z.displayName="DisclosureContext";var ee=t.Fragment;function te(e){var n="headlessui-disclosure-button-"+E(),r="headlessui-disclosure-panel-"+E(),o=t.useReducer(Z,{disclosureState:W.Closed,linkedPanel:!1,buttonId:n,panelId:r}),i=o[0].disclosureState,a=o[1];t.useEffect((function(){return a({type:Y.SetButtonId,buttonId:n})}),[n,a]),t.useEffect((function(){return a({type:Y.SetPanelId,panelId:r})}),[r,a]);var c=t.useMemo((function(){return{open:i===W.Open}}),[i]);return u.createElement(z.Provider,{value:o},d(e,c,ee))}var ne,re,oe,ie,ue=v((function e(n,r){var o=X([te.name,e.name].join(".")),u=o[0],c=o[1],l=b(r),s=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:e.preventDefault(),c({type:Y.ToggleDisclosure})}}),[c]),f=t.useCallback((function(e){h(e.currentTarget)||n.disabled||c({type:Y.ToggleDisclosure})}),[c,n.disabled]),p=t.useMemo((function(){return{open:u.disclosureState===W.Open}}),[u]);return d(a({},n,{ref:l,id:u.buttonId,type:"button","aria-expanded":u.disclosureState===W.Open||void 0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:s,onClick:f}),p,"button")})),ae=r.RenderStrategy|r.Static,ce=v((function e(n,r){var o=X([te.name,e.name].join(".")),i=o[0],u=o[1],c=b(r,(function(){i.linkedPanel||u({type:Y.LinkPanel})}));t.useEffect((function(){return function(){return u({type:Y.UnlinkPanel})}}),[u]),t.useEffect((function(){var e;i.disclosureState!==W.Closed||null!=(e=n.unmount)&&!e||u({type:Y.UnlinkPanel})}),[i.disclosureState,n.unmount,u]);var l=t.useMemo((function(){return{open:i.disclosureState===W.Open}}),[i]);return d(a({},n,{ref:c,id:i.panelId}),l,"div",ae,i.disclosureState===W.Open)}));function le(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=s(e.splice(0));!(t=n()).done;)(0,t.value)()}};return t}function se(){var e=t.useState(le)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function fe(e,n){var r=t.useState(e),o=r[0],i=r[1],u=t.useRef(e);return y((function(){u.current=e}),[e]),y((function(){return i(u.current)}),[u,i].concat(n)),o}function de(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),o=null!=r?r:-1,i=function(){switch(e.focus){case ne.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case ne.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==o&&r.length-n-1>=o||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case ne.Next:return n.findIndex((function(e,n){return!(n<=o||t.resolveDisabled(e))}));case ne.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case ne.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case ne.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?r:i}function pe(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}te.Button=ue,te.Panel=ce,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"}(ne||(ne={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(oe||(oe={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(ie||(ie={}));var ve=((re={})[ie.CloseListbox]=function(e){return e.disabled||e.listboxState===oe.Closed?e:a({},e,{activeOptionIndex:null,listboxState:oe.Closed})},re[ie.OpenListbox]=function(e){return e.disabled||e.listboxState===oe.Open?e:a({},e,{listboxState:oe.Open})},re[ie.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:a({},e,{disabled:t.disabled})},re[ie.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===oe.Closed)return e;var n=de(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===n?e:a({},e,{searchQuery:"",activeOptionIndex:n})},re[ie.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===oe.Closed)return e;var n=e.searchQuery+t.value,r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return a({},e,-1===r||r===e.activeOptionIndex?{searchQuery:n}:{searchQuery:n,activeOptionIndex:r})},re[ie.ClearSearch]=function(e){return e.disabled||e.listboxState===oe.Closed||""===e.searchQuery?e:a({},e,{searchQuery:""})},re[ie.RegisterOption]=function(e,t){return a({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},re[ie.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{options:n,activeOptionIndex:o===e.activeOptionIndex||null===r?null:n.indexOf(r)})},re),me=t.createContext(null);function be(e){var n=t.useContext(me);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+ge.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,be),r}return n}function he(e,t){return f(t.type,ve,e,t)}me.displayName="ListboxContext";var ye=t.Fragment;function ge(e){var n=e.value,r=e.onChange,o=e.disabled,i=void 0!==o&&o,a=c(e,["value","onChange","disabled"]),l=t.useReducer(he,{listboxState:oe.Closed,propsRef:{current:{value:n,onChange:r}},labelRef:t.createRef(),buttonRef:t.createRef(),optionsRef:t.createRef(),disabled:i,options:[],searchQuery:"",activeOptionIndex:null}),s=l[0],f=s.listboxState,p=s.propsRef,v=s.optionsRef,m=s.buttonRef,b=l[1];y((function(){p.current.value=n}),[n,p]),y((function(){p.current.onChange=r}),[r,p]),y((function(){return b({type:ie.SetDisabled,disabled:i})}),[i]),t.useEffect((function(){function e(e){var t,n,r,o=e.target;f===oe.Open&&((null==(t=m.current)?void 0:t.contains(o))||(null==(n=v.current)?void 0:n.contains(o))||(b({type:ie.CloseListbox}),R(o)||(e.preventDefault(),null==(r=m.current)||r.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[f,m,v,b]);var h=t.useMemo((function(){return{open:f===oe.Open,disabled:i}}),[f,i]);return u.createElement(me.Provider,{value:l},d(a,h,ye))}var we,Se,Ee,xe=v((function e(n,r){var o,u=be([ge.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.buttonRef,r),f="headlessui-listbox-button-"+E(),p=se(),v=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:case i.ArrowDown:e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ie.GoToOption,focus:ne.First})}));break;case i.ArrowUp:e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:ie.GoToOption,focus:ne.Last})}))}}),[l,c,p]),m=t.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();c.listboxState===oe.Open?(l({type:ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:ie.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})})))}),[l,p,c]),y=fe((function(){if(c.labelRef.current)return[c.labelRef.current.id,f].join(" ")}),[c.labelRef.current,f]),g=t.useMemo((function(){return{open:c.listboxState===oe.Open,disabled:c.disabled}}),[c]);return d(a({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=c.optionsRef.current)?void 0:o.id,"aria-expanded":c.listboxState===oe.Open||void 0,"aria-labelledby":y,disabled:c.disabled,onKeyDown:v,onClick:m}),g,"button")})),Ce=r.RenderStrategy|r.Static,Ie=v((function e(n,r){var o,u=be([ge.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.optionsRef,r),f="headlessui-listbox-options-"+E(),p=se(),v=se(),m=t.useCallback((function(e){switch(v.dispose(),e.key){case i.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:ie.Search,value:e.key});case i.Enter:e.preventDefault(),l({type:ie.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),le().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.ArrowDown:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Next});case i.ArrowUp:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Previous});case i.Home:case i.PageUp:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.First});case i.End:case i.PageDown:return e.preventDefault(),l({type:ie.GoToOption,focus:ne.Last});case i.Escape:return e.preventDefault(),l({type:ie.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case i.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:ie.Search,value:e.key}),v.setTimeout((function(){return l({type:ie.ClearSearch})}),350))}}),[p,l,v,c]),h=fe((function(){var e,t,n;return null!=(e=null==(t=c.labelRef.current)?void 0:t.id)?e:null==(n=c.buttonRef.current)?void 0:n.id}),[c.labelRef.current,c.buttonRef.current]),y=t.useMemo((function(){return{open:c.listboxState===oe.Open}}),[c]);return d(a({},n,{"aria-activedescendant":null===c.activeOptionIndex||null==(o=c.options[c.activeOptionIndex])?void 0:o.id,"aria-labelledby":h,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),y,"ul",Ce,c.listboxState===oe.Open)}));ge.Button=xe,ge.Label=function e(n){var r=be([ge.name,e.name].join("."))[0],o="headlessui-listbox-label-"+E(),i=t.useCallback((function(){var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[r.buttonRef]),u=t.useMemo((function(){return{open:r.listboxState===oe.Open,disabled:r.disabled}}),[r]);return d(a({},n,{ref:r.labelRef,id:o,onClick:i}),u,"label")},ge.Options=Ie,ge.Option=function e(n){var r=n.disabled,o=void 0!==r&&r,i=n.value,u=n.className,l=c(n,["disabled","value","className"]),s=be([ge.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-listbox-option-"+E(),m=null!==f.activeOptionIndex&&f.options[f.activeOptionIndex].id===v,b=f.propsRef.current.value===i,h=t.useRef({disabled:o,value:i});y((function(){h.current.disabled=o}),[h,o]),y((function(){h.current.value=i}),[h,i]),y((function(){var e,t;h.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[h,v]);var g=t.useCallback((function(){return f.propsRef.current.onChange(i)}),[f.propsRef,i]);y((function(){return p({type:ie.RegisterOption,id:v,dataRef:h}),function(){return p({type:ie.UnregisterOption,id:v})}}),[h,v]),y((function(){var e;f.listboxState===oe.Open&&b&&(p({type:ie.GoToOption,focus:ne.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[f.listboxState]),y((function(){if(f.listboxState===oe.Open&&m){var e=le();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.listboxState]);var w=t.useCallback((function(e){if(o)return e.preventDefault();g(),p({type:ie.CloseListbox}),le().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,f.buttonRef,o,g]),S=t.useCallback((function(){if(o)return p({type:ie.GoToOption,focus:ne.Nothing});p({type:ie.GoToOption,focus:ne.Specific,id:v})}),[o,v,p]),x=t.useCallback((function(){o||m||p({type:ie.GoToOption,focus:ne.Specific,id:v})}),[o,m,v,p]),C=t.useCallback((function(){o||m&&p({type:ie.GoToOption,focus:ne.Nothing})}),[o,m,p]),I=t.useMemo((function(){return{active:m,selected:b,disabled:o}}),[m,b,o]);return d(a({},l,{id:v,role:"option",tabIndex:-1,className:pe(u,I),"aria-disabled":!0===o||void 0,"aria-selected":!0===b||void 0,onClick:w,onFocus:S,onPointerMove:x,onMouseMove:x,onPointerLeave:C,onMouseLeave:C}),I,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Se||(Se={})),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"}(Ee||(Ee={}));var Oe=((we={})[Ee.CloseMenu]=function(e){return e.menuState===Se.Closed?e:a({},e,{activeItemIndex:null,menuState:Se.Closed})},we[Ee.OpenMenu]=function(e){return e.menuState===Se.Open?e:a({},e,{menuState:Se.Open})},we[Ee.GoToItem]=function(e,t){var n=de(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===n?e:a({},e,{searchQuery:"",activeItemIndex:n})},we[Ee.Search]=function(e,t){var n=e.searchQuery+t.value,r=e.items.findIndex((function(e){var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))&&!e.dataRef.current.disabled}));return a({},e,-1===r||r===e.activeItemIndex?{searchQuery:n}:{searchQuery:n,activeItemIndex:r})},we[Ee.ClearSearch]=function(e){return""===e.searchQuery?e:a({},e,{searchQuery:""})},we[Ee.RegisterItem]=function(e,t){return a({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},we[Ee.UnregisterItem]=function(e,t){var n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{items:n,activeItemIndex:o===e.activeItemIndex||null===r?null:n.indexOf(r)})},we),ke=t.createContext(null);function Re(e){var n=t.useContext(ke);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+Te.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Re),r}return n}function Le(e,t){return f(t.type,Oe,e,t)}ke.displayName="MenuContext";var Pe=t.Fragment;function Te(e){var n=t.useReducer(Le,{menuState:Se.Closed,buttonRef:t.createRef(),itemsRef:t.createRef(),items:[],searchQuery:"",activeItemIndex:null}),r=n[0],o=r.menuState,i=r.itemsRef,a=r.buttonRef,c=n[1];t.useEffect((function(){function e(e){var t,n,r,u=e.target;o===Se.Open&&((null==(t=a.current)?void 0:t.contains(u))||(null==(n=i.current)?void 0:n.contains(u))||(c({type:Ee.CloseMenu}),R(u)||(e.preventDefault(),null==(r=a.current)||r.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[o,a,i,c]);var l=t.useMemo((function(){return{open:o===Se.Open}}),[o]);return u.createElement(ke.Provider,{value:n},d(e,l,Pe))}var De,Fe,Ne,Me=v((function e(n,r){var o,u=Re([Te.name,e.name].join(".")),c=u[0],l=u[1],s=b(c.buttonRef,r),f="headlessui-menu-button-"+E(),p=se(),v=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:case i.ArrowDown:e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:Ee.GoToItem,focus:ne.First})}));break;case i.ArrowUp:e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:Ee.GoToItem,focus:ne.Last})}))}}),[l,c,p]),m=t.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();n.disabled||(c.menuState===Se.Open?(l({type:Ee.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:Ee.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,n.disabled]),y=t.useMemo((function(){return{open:c.menuState===Se.Open}}),[c]);return d(a({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=c.itemsRef.current)?void 0:o.id,"aria-expanded":c.menuState===Se.Open||void 0,onKeyDown:v,onClick:m}),y,"button")})),Ae=r.RenderStrategy|r.Static,je=v((function e(n,r){var o,u,c=Re([Te.name,e.name].join(".")),l=c[0],s=c[1],f=b(l.itemsRef,r),p="headlessui-menu-items-"+E(),v=se();y((function(){var e=l.itemsRef.current;if(e&&l.menuState===Se.Open)for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});t.nextNode();)t.currentNode.setAttribute("role","none")}));var m=t.useCallback((function(e){switch(v.dispose(),e.key){case i.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:Ee.Search,value:e.key});case i.Enter:var t;e.preventDefault(),s({type:Ee.CloseMenu}),null!==l.activeItemIndex&&(null==(t=document.getElementById(l.items[l.activeItemIndex].id))||t.click()),le().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.ArrowDown:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Next});case i.ArrowUp:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Previous});case i.Home:case i.PageUp:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.First});case i.End:case i.PageDown:return e.preventDefault(),s({type:Ee.GoToItem,focus:ne.Last});case i.Escape:e.preventDefault(),s({type:Ee.CloseMenu}),le().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:Ee.Search,value:e.key}),v.setTimeout((function(){return s({type:Ee.ClearSearch})}),350))}}),[s,v,l]),h=t.useMemo((function(){return{open:l.menuState===Se.Open}}),[l]);return d(a({},n,{"aria-activedescendant":null===l.activeItemIndex||null==(o=l.items[l.activeItemIndex])?void 0:o.id,"aria-labelledby":null==(u=l.buttonRef.current)?void 0:u.id,id:p,onKeyDown:m,role:"menu",tabIndex:0,ref:f}),h,"div",Ae,l.menuState===Se.Open)})),Ge=t.Fragment;Te.Button=Me,Te.Items=je,Te.Item=function e(n){var r=n.disabled,o=void 0!==r&&r,i=n.className,u=n.onClick,l=c(n,["disabled","className","onClick"]),s=Re([Te.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-menu-item-"+E(),m=null!==f.activeItemIndex&&f.items[f.activeItemIndex].id===v;y((function(){if(f.menuState===Se.Open&&m){var e=le();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.menuState]);var b=t.useRef({disabled:o});y((function(){b.current.disabled=o}),[b,o]),y((function(){var e,t;b.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[b,v]),y((function(){return p({type:Ee.RegisterItem,id:v,dataRef:b}),function(){return p({type:Ee.UnregisterItem,id:v})}}),[b,v]);var h=t.useCallback((function(e){return o?e.preventDefault():(p({type:Ee.CloseMenu}),le().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[p,f.buttonRef,o,u]),g=t.useCallback((function(){if(o)return p({type:Ee.GoToItem,focus:ne.Nothing});p({type:Ee.GoToItem,focus:ne.Specific,id:v})}),[o,v,p]),w=t.useCallback((function(){o||m||p({type:Ee.GoToItem,focus:ne.Specific,id:v})}),[o,m,v,p]),S=t.useCallback((function(){o||m&&p({type:Ee.GoToItem,focus:ne.Nothing})}),[o,m,p]),x=t.useMemo((function(){return{active:m,disabled:o}}),[m,o]);return d(a({},l,{id:v,role:"menuitem",tabIndex:-1,className:pe(i,x),"aria-disabled":!0===o||void 0,onClick:h,onFocus:g,onPointerMove:w,onMouseMove:w,onPointerLeave:S,onMouseLeave:S}),x,Ge)},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Fe||(Fe={})),function(e){e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId"}(Ne||(Ne={}));var Ue=((De={})[Ne.TogglePopover]=function(e){var t;return a({},e,{popoverState:f(e.popoverState,(t={},t[Fe.Open]=Fe.Closed,t[Fe.Closed]=Fe.Open,t))})},De[Ne.ClosePopover]=function(e){return e.popoverState===Fe.Closed?e:a({},e,{popoverState:Fe.Closed})},De[Ne.SetButton]=function(e,t){return e.button===t.button?e:a({},e,{button:t.button})},De[Ne.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:a({},e,{buttonId:t.buttonId})},De[Ne.SetPanel]=function(e,t){return e.panel===t.panel?e:a({},e,{panel:t.panel})},De[Ne.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:a({},e,{panelId:t.panelId})},De),He=t.createContext(null);function Be(e){var n=t.useContext(He);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+We.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Be),r}return n}He.displayName="PopoverContext";var Ve=t.createContext(null);function _e(){return t.useContext(Ve)}Ve.displayName="PopoverGroupContext";var Qe=t.createContext(null);function Ke(e,t){return f(t.type,Ue,e,t)}function We(e){var n="headlessui-popover-button-"+E(),r="headlessui-popover-panel-"+E(),o=t.useReducer(Ke,{popoverState:Fe.Closed,linkedPanel:!1,button:null,buttonId:n,panel:null,panelId:r}),i=o[0],a=i.popoverState,c=i.button,l=i.panel,s=o[1];t.useEffect((function(){return s({type:Ne.SetButtonId,buttonId:n})}),[n,s]),t.useEffect((function(){return s({type:Ne.SetPanelId,panelId:r})}),[r,s]);var f=t.useMemo((function(){return{buttonId:n,panelId:r,close:function(){return s({type:Ne.ClosePopover})}}}),[n,r,s]),p=_e(),v=null==p?void 0:p.registerPopover,m=t.useCallback((function(){var e;return null!=(e=null==p?void 0:p.isFocusWithinPopoverGroup())?e:(null==c?void 0:c.contains(document.activeElement))||(null==l?void 0:l.contains(document.activeElement))}),[p,c,l]);t.useEffect((function(){return null==v?void 0:v(f)}),[v,f]),t.useEffect((function(){if(a===Fe.Open)return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)};function e(){m()||c&&l&&s({type:Ne.ClosePopover})}}),[a,m,p,c,l,s]),t.useEffect((function(){function e(e){var t=e.target;a===Fe.Open&&((null==c?void 0:c.contains(t))||(null==l?void 0:l.contains(t))||(s({type:Ne.ClosePopover}),R(t)||(e.preventDefault(),null==c||c.focus())))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[a,c,l,s]);var b=t.useMemo((function(){return{open:a===Fe.Open}}),[a]);return u.createElement(He.Provider,{value:o},d(e,b,"div"))}Qe.displayName="PopoverPanelContext";var Ye=v((function e(n,r){var o=Be([We.name,e.name].join(".")),u=o[0],c=o[1],l=t.useRef(null),s=_e(),f=null==s?void 0:s.closeOthers,p=t.useContext(Qe),v=null!==p&&p===u.panelId,m=b(l,r,v?null:function(e){return c({type:Ne.SetButton,button:e})}),y=t.useRef(null),g=t.useRef("undefined"==typeof window?null:document.activeElement);t.useEffect((function(){function e(){g.current=y.current,y.current=document.activeElement}return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)}}),[g,y]);var w=t.useCallback((function(e){var t;if(v){if(u.popoverState===Fe.Closed)return;switch(e.key){case i.Space:case i.Enter:e.preventDefault(),c({type:Ne.ClosePopover}),null==(t=u.button)||t.focus()}}else switch(e.key){case i.Space:case i.Enter:e.preventDefault(),u.popoverState===Fe.Closed&&(null==f||f(u.buttonId)),c({type:Ne.TogglePopover});break;case i.Escape:if(u.popoverState!==Fe.Open)return null==f?void 0:f(u.buttonId);if(!l.current)return;if(!l.current.contains(document.activeElement))return;c({type:Ne.ClosePopover});break;case i.Tab:if(u.popoverState!==Fe.Open)return;if(!u.panel)return;if(!u.button)return;if(e.shiftKey){var n;if(!g.current)return;if(null==(n=u.button)?void 0:n.contains(g.current))return;if(u.panel.contains(g.current))return;var r=k(),o=r.indexOf(g.current);if(r.indexOf(u.button)>o)return;e.preventDefault(),e.stopPropagation(),P(u.panel,x.Last)}else e.preventDefault(),e.stopPropagation(),P(u.panel,x.First)}}),[c,u.popoverState,u.buttonId,u.button,u.panel,l,f,v]),S=t.useCallback((function(e){var t;if(!v&&u.popoverState===Fe.Open&&u.panel&&u.button)switch(e.key){case i.Tab:if(!g.current)return;if(null==(t=u.button)?void 0:t.contains(g.current))return;if(u.panel.contains(g.current))return;var n=k(),r=n.indexOf(g.current);if(n.indexOf(u.button)>r)return;e.preventDefault(),P(u.panel,x.Last)}}),[u.popoverState,u.panel,u.button,v]),E=t.useCallback((function(e){var t;h(e.currentTarget)||n.disabled||(v?(c({type:Ne.ClosePopover}),null==(t=u.button)||t.focus()):(u.popoverState===Fe.Closed&&(null==f||f(u.buttonId)),c({type:Ne.TogglePopover})))}),[c,u.button,u.popoverState,u.buttonId,n.disabled,f,v]),C=t.useMemo((function(){return{open:u.popoverState===Fe.Open}}),[u]);return d(a({},n,v?{type:"button",onKeyDown:w,onClick:E}:{ref:m,id:u.buttonId,type:"button","aria-expanded":u.popoverState===Fe.Open||void 0,"aria-controls":u.panel?u.panelId:void 0,onKeyDown:w,onKeyUp:S,onClick:E}),C,"button")})),qe=v((function e(n,r){var o=Be([We.name,e.name].join(".")),i=o[0].popoverState,u=o[1],c=b(r),l="headlessui-popover-overlay-"+E(),s=t.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();u({type:Ne.ClosePopover})}),[u]),f=t.useMemo((function(){return{open:i===Fe.Open}}),[i]);return d(a({},n,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")})),Je=r.RenderStrategy|r.Static,$e=v((function e(n,r){var o=n.focus,l=void 0!==o&&o,s=c(n,["focus"]),f=Be([We.name,e.name].join(".")),p=f[0],v=f[1],m=t.useRef(null),h=b(m,r,(function(e){v({type:Ne.SetPanel,panel:e})})),y=t.useCallback((function(e){var t;switch(e.key){case i.Escape:if(p.popoverState!==Fe.Open)return;if(!m.current)return;if(!m.current.contains(document.activeElement))return;e.preventDefault(),v({type:Ne.ClosePopover}),null==(t=p.button)||t.focus()}}),[p,m,v]);t.useEffect((function(){return function(){return v({type:Ne.SetPanel,panel:null})}}),[v]),t.useEffect((function(){var e;p.popoverState!==Fe.Closed||null!=(e=n.unmount)&&!e||v({type:Ne.SetPanel,panel:null})}),[p.popoverState,n.unmount,v]),t.useEffect((function(){if(l&&p.popoverState===Fe.Open&&m.current){var e=document.activeElement;m.current.contains(e)||P(m.current,x.First)}}),[l,m,p.popoverState]),t.useEffect((function(){if(p.popoverState===Fe.Open&&m.current)return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)};function e(e){if(e.key===i.Tab&&document.activeElement&&m.current&&m.current.contains(document.activeElement)){e.preventDefault();var t,n=P(m.current,e.shiftKey?x.Previous:x.Next);if(n===C.Underflow)return null==(t=p.button)?void 0:t.focus();if(n===C.Overflow){if(!p.button)return;var r=k(),o=r.indexOf(p.button);P(r.splice(o+1).filter((function(e){var t;return!(null==(t=m.current)?void 0:t.contains(e))})),x.First)===C.Error&&P(document.body,x.First)}}}}),[l,m,p.popoverState,p.button]),t.useEffect((function(){if(l&&p.popoverState===Fe.Open&&m.current)return window.addEventListener("focus",e,!0),function(){return window.removeEventListener("focus",e,!0)};function e(){var e;(null==(e=m.current)?void 0:e.contains(document.activeElement))||v({type:Ne.ClosePopover})}}),[l,p.popoverState,v]);var g=t.useMemo((function(){return{open:p.popoverState===Fe.Open}}),[p]);return u.createElement(Qe.Provider,{value:p.panelId},d(a({},s,{ref:h,id:p.panelId,onKeyDown:y}),g,"div",Je,p.popoverState===Fe.Open))}));We.Button=Ye,We.Overlay=qe,We.Panel=$e,We.Group=function(e){var n=t.useRef(null),r=t.useState([]),o=r[0],i=r[1],c=t.useCallback((function(e){i((function(t){var n=t.indexOf(e);if(-1!==n){var r=t.slice();return r.splice(n,1),r}return t}))}),[i]),l=t.useCallback((function(e){return i((function(t){return[].concat(t,[e])})),function(){return c(e)}}),[i,c]),f=t.useCallback((function(){var e,t=document.activeElement;return!!(null==(e=n.current)?void 0:e.contains(t))||o.some((function(e){var n,r;return(null==(n=document.getElementById(e.buttonId))?void 0:n.contains(t))||(null==(r=document.getElementById(e.panelId))?void 0:r.contains(t))}))}),[n,o]),p=t.useCallback((function(e){for(var t,n=s(o);!(t=n()).done;){var r=t.value;r.buttonId!==e&&r.close()}}),[o]),v=t.useMemo((function(){return{registerPopover:l,unregisterPopover:c,isFocusWithinPopoverGroup:f,closeOthers:p}}),[l,c,f,p]),m=t.useMemo((function(){return{}}),[]);return u.createElement(Ve.Provider,{value:v},d(a({},e,{ref:n}),m,"div"))};var ze=t.createContext(null);function Xe(e){var n=t.useContext(ze);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Xe),r}return n}ze.displayName="GroupContext";var Ze,et=t.Fragment;function tt(e){var n,r,o=e.checked,u=e.onChange,l=e.className,s=c(e,["checked","onChange","className"]),f="headlessui-switch-"+E(),p=t.useContext(ze),v=t.useCallback((function(){return u(!o)}),[u,o]),m=t.useCallback((function(e){if(h(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),b=t.useCallback((function(e){e.key!==i.Tab&&e.preventDefault(),e.key===i.Space&&v()}),[v]),y=t.useCallback((function(e){return e.preventDefault()}),[]),g=t.useMemo((function(){return{checked:o}}),[o]),w={id:f,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:pe(l,g),"aria-checked":o,"aria-labelledby":null==p||null==(n=p.label)?void 0:n.id,"aria-describedby":null==p||null==(r=p.description)?void 0:r.id,onClick:m,onKeyUp:b,onKeyPress:y};return"button"===s.as&&Object.assign(w,{type:"button"}),d(a({},s,w),g,"button")}function nt(){var e=t.useRef(!0);return t.useEffect((function(){e.current=!1}),[]),e.current}function rt(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function ot(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function it(e,t,n,r,o){var i=le(),u=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return rt.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){ot.apply(void 0,[e].concat(n)),rt.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=le();if(!e)return n.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),i=o[0];return 0!==i?n.setTimeout((function(){t(Ze.Finished)}),i+o[1]):t(Ze.Finished),n.add((function(){return t(Ze.Cancelled)})),n.dispose}(e,(function(n){return ot.apply(void 0,[e].concat(r,t)),u(n)})))})),i.add((function(){return ot.apply(void 0,[e].concat(t,n,r))})),i.add((function(){return u(Ze.Cancelled)})),i.dispose}function ut(e){return void 0===e&&(e=""),t.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}tt.Group=function(e){var n=t.useState(null),r=n[0],o=n[1],i=t.useState(null),a=i[0],c=i[1],l=t.useState(null),s=l[0],f=l[1],p=t.useMemo((function(){return{switch:r,setSwitch:o,label:a,setLabel:c,description:s,setDescription:f}}),[r,o,a,c,s,f]);return u.createElement(ze.Provider,{value:p},d(e,{},et))},tt.Label=function e(n){var r=Xe([tt.name,e.name].join(".")),o="headlessui-switch-label-"+E(),i=t.useCallback((function(){r.switch&&(r.switch.click(),r.switch.focus({preventScroll:!0}))}),[r.switch]);return d(a({},n,{ref:r.setLabel,id:o,onClick:i}),{},"label")},tt.Description=function e(t){var n=Xe([tt.name,e.name].join(".")),r="headlessui-switch-description-"+E();return d(a({},t,{ref:n.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Ze||(Ze={}));var at,ct=t.createContext(null);ct.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(at||(at={}));var lt=t.createContext(null);function st(e){return"children"in e?st(e.children):e.current.filter((function(e){return e.state===at.Visible})).length>0}function ft(e){var n=t.useRef(e),r=t.useRef([]),i=function(){var e=t.useRef(!0);return t.useEffect((function(){return function(){e.current=!1}}),[]),e}();t.useEffect((function(){n.current=e}),[e]);var u=t.useCallback((function(e,t){var u;void 0===t&&(t=o.Hidden);var a=r.current.findIndex((function(t){return t.id===e}));-1!==a&&(f(t,((u={})[o.Unmount]=function(){r.current.splice(a,1)},u[o.Hidden]=function(){r.current[a].state=at.Hidden},u)),!st(r)&&i.current&&(null==n.current||n.current()))}),[n,i,r]),a=t.useCallback((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==at.Visible&&(t.state=at.Visible):r.current.push({id:e,state:at.Visible}),function(){return u(e,o.Unmount)}}),[r,u]);return t.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function dt(){}lt.displayName="NestingContext";var pt=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function vt(e){for(var t,n={},r=s(pt);!(t=r()).done;){var o,i=t.value;n[i]=null!=(o=e[i])?o:dt}return n}var mt=r.RenderStrategy;function bt(e){var n=e.beforeEnter,r=e.afterEnter,i=e.beforeLeave,l=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,b=e.leaveFrom,h=e.leaveTo,g=c(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),w=t.useRef(null),S=t.useState(at.Visible),x=S[0],C=S[1],I=g.unmount?o.Unmount:o.Hidden,O=function(){var e=t.useContext(ct);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),k=O.show,R=O.appear,L=function(){var e=t.useContext(lt);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),P=L.register,T=L.unregister,D=nt(),F=E(),N=t.useRef(!1),M=ft((function(){N.current||(C(at.Hidden),T(F),V.current.afterLeave())}));y((function(){if(F)return P(F)}),[P,F]),y((function(){var e;I===o.Hidden&&F&&(k&&x!==at.Visible?C(at.Visible):f(x,((e={})[at.Hidden]=function(){return T(F)},e[at.Visible]=function(){return P(F)},e)))}),[x,F,P,T,k,I]);var A=ut(s),j=ut(p),G=ut(v),U=ut(m),H=ut(b),B=ut(h),V=function(e){var n=t.useRef(vt(e));return t.useEffect((function(){n.current=vt(e)}),[e]),n}({beforeEnter:n,afterEnter:r,beforeLeave:i,afterLeave:l});t.useEffect((function(){if(x===at.Visible&&null===w.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[w,x]);var _=D&&!R;return y((function(){var e=w.current;if(e&&!_)return N.current=!0,k&&V.current.beforeEnter(),k||V.current.beforeLeave(),k?it(e,A,j,G,(function(e){N.current=!1,e===Ze.Finished&&V.current.afterEnter()})):it(e,U,H,B,(function(e){N.current=!1,e===Ze.Finished&&(st(M)||(C(at.Hidden),T(F),V.current.afterLeave()))}))}),[V,F,N,T,M,w,_,k,A,j,G,U,H,B]),u.createElement(lt.Provider,{value:M},d(a({},g,{ref:w}),{},"div",mt,x===at.Visible))}function ht(e){var n=e.show,r=e.appear,o=void 0!==r&&r,i=e.unmount,l=c(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?at.Visible:at.Hidden),f=s[0],p=s[1],v=ft((function(){p(at.Hidden)})),m=nt(),b=t.useMemo((function(){return{show:n,appear:o||!m}}),[n,o,m]);t.useEffect((function(){n?p(at.Visible):st(v)||p(at.Hidden)}),[n,v]);var h={unmount:i};return u.createElement(lt.Provider,{value:v},u.createElement(ct.Provider,{value:b},d(a({},h,{as:t.Fragment,children:u.createElement(bt,Object.assign({},h,l))}),{},t.Fragment,mt,f===at.Visible)))}ht.Child=bt,e.Dialog=J,e.Disclosure=te,e.FocusTrap=function(e){var n=t.useRef(null),r=e.initialFocus,o=c(e,["initialFocus"]);return T(n,!0,{initialFocus:r}),d(a({},o,{ref:n}),{},"div")},e.Listbox=ge,e.Menu=Te,e.Popover=We,e.Portal=H,e.Switch=tt,e.Transition=ht,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=headlessui.umd.production.min.js.map |
@@ -39,3 +39,6 @@ import { ElementType, ReactElement } from 'react'; | ||
name: string; | ||
}>(component: T): T; | ||
displayName?: string; | ||
}>(component: T): T & { | ||
displayName: string; | ||
}; | ||
export {}; |
{ | ||
"name": "@headlessui/react", | ||
"version": "0.3.1-854cc83", | ||
"version": "0.3.1-a94cc79", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
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
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2008468
13109