@headlessui/vue
Advanced tools
Comparing version 0.3.0-4648332 to 0.3.0-6dd6636
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n=require("vue");function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function r(e,t){if(null==e)return{};var n,o,r={},l=Object.keys(e);for(o=0;o<l.length;o++)t.indexOf(n=l[o])>=0||(r[n]=e[n]);return r}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function i(e,t){if(e in t){for(var n=t[e],o=arguments.length,r=new Array(o>2?o-2:0),l=2;l<o;l++)r[l-2]=arguments[l];return"function"==typeof n?n.apply(void 0,r):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,i),u}function u(n){var l,u,s=n.visible,c=void 0===s||s,d=n.features,p=void 0===d?e.None:d,f=r(n,["visible","features"]);return c||p&e.Static&&f.props.static?a(f):p&e.RenderStrategy?i(null==(l=f.props.unmount)||l?t.Unmount:t.Hidden,((u={})[t.Unmount]=function(){return null},u[t.Hidden]=function(){return a(o({},f,{props:o({},f.props,{hidden:!0,style:{display:"none"}})}))},u)):a(f)}function a(e){var t=e.attrs,o=e.slots,i=e.slot,u=function(e,t){void 0===t&&(t=[]);for(var n,o=Object.assign({},e),r=function(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))){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(t);!(n=r()).done;){var i=n.value;i in o&&delete o[i]}return o}(e.props,["unmount","static"]),a=u.as,s=r(u,["as"]),c=null==o.default?void 0:o.default(i);if("template"===a){if(Object.keys(s).length>0||"class"in t){var d=null!=c?c:[],p=d[0];if(d.slice(1).length>0)throw new Error('You should only render 1 child or use the `as="..."` prop');return n.cloneVNode(p,s)}return c}return n.h(a,s,c)}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(e||(e={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(t||(t={}));var s,c,d,p=0;function f(){return++p}function v(e,t){var n=t.resolveItems();if(n.length<=0)return null;var o=t.resolveActiveIndex(),r=null!=o?o:-1,l=function(){switch(e.focus){case c.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case c.Previous:var o=n.slice().reverse().findIndex((function(e,n,o){return!(-1!==r&&o.length-n-1>=r||t.resolveDisabled(e))}));return-1===o?o:n.length-1-o;case c.Next:return n.findIndex((function(e,n){return!(n<=r||t.resolveDisabled(e))}));case c.Last:var l=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===l?l:n.length-1-l;case c.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case c.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===l?o:l}function b(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}function m(e){var t;return null==e||null==e.value?null:null!=(t=e.value.$el)?t:e.value}!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"}(s||(s={})),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"}(c||(c={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(d||(d={}));var h=Symbol("MenuContext");function x(e){var t=n.inject(h,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <Menu /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,x),o}return t}var y,S=n.defineComponent({props:{as:{type:[Object,String],default:"template"}},setup:function(e,t){var o=t.slots,r=t.attrs,l=n.ref(d.Closed),i=n.ref(null),a=n.ref(null),s=n.ref([]),p=n.ref(""),f=n.ref(null),b={menuState:l,buttonRef:i,itemsRef:a,items:s,searchQuery:p,activeItemIndex:f,closeMenu:function(){l.value=d.Closed,f.value=null},openMenu:function(){return l.value=d.Open},goToItem:function(e,t){var n=v(e===c.Specific?{focus:c.Specific,id:t}:{focus:e},{resolveItems:function(){return s.value},resolveActiveIndex:function(){return f.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===p.value&&f.value===n||(p.value="",f.value=n)},search:function(e){p.value+=e;var t=s.value.findIndex((function(e){return e.dataRef.textValue.startsWith(p.value)&&!e.dataRef.disabled}));-1!==t&&t!==f.value&&(f.value=t)},clearSearch:function(){p.value=""},registerItem:function(e,t){s.value.push({id:e,dataRef:t})},unregisterItem:function(e){var t=s.value.slice(),n=null!==f.value?t[f.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),s.value=t,f.value=o===f.value||null===n?null:t.indexOf(n)}};return n.onMounted((function(){function e(e){var t,n,o,r=e.target,u=document.activeElement;l.value===d.Open&&((null==(t=m(i))?void 0:t.contains(r))||((null==(n=m(a))?void 0:n.contains(r))||b.closeMenu(),u!==document.body&&(null==u?void 0:u.contains(r))||e.defaultPrevented||null==(o=m(i))||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),n.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),n.provide(h,b),function(){return u({props:e,slot:{open:l.value===d.Open},slots:o,attrs:r})}}}),g=n.defineComponent({props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=x("MenuButton"),n={open:t.menuState.value===d.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=m(t.itemsRef))?void 0:e.id,"aria-expanded":t.menuState.value===d.Open||void 0,onKeydown:this.handleKeyDown,onClick:this.handleClick};return u({props:o({},this.$props,r),slot:n,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var t=x("MenuButton");return{id:"headlessui-menu-button-"+f(),el:t.buttonRef,handleKeyDown:function(e){switch(e.key){case s.Space:case s.Enter:case s.ArrowDown:e.preventDefault(),t.openMenu(),n.nextTick((function(){var e;null==(e=m(t.itemsRef))||e.focus({preventScroll:!0}),t.goToItem(c.First)}));break;case s.ArrowUp:e.preventDefault(),t.openMenu(),n.nextTick((function(){var e;null==(e=m(t.itemsRef))||e.focus({preventScroll:!0}),t.goToItem(c.Last)}))}},handleClick:function(o){var r;e.disabled||(t.menuState.value===d.Open?(t.closeMenu(),n.nextTick((function(){var e;return null==(e=m(t.buttonRef))?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),t.openMenu(),r=function(){var e;return null==(e=m(t.itemsRef))?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),w=n.defineComponent({props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var t,n,r=x("MenuItems"),l={open:r.menuState.value===d.Open},i={"aria-activedescendant":null===r.activeItemIndex.value||null==(t=r.items.value[r.activeItemIndex.value])?void 0:t.id,"aria-labelledby":null==(n=m(r.buttonRef))?void 0:n.id,id:this.id,onKeydown:this.handleKeyDown,role:"menu",tabIndex:0,ref:"el"};return u({props:o({},this.$props,i),slot:l,attrs:this.$attrs,slots:this.$slots,features:e.RenderStrategy|e.Static,visible:l.open})},setup:function(){var e=x("MenuItems"),t="headlessui-menu-items-"+f(),o=n.ref(null);return n.watchEffect((function(){var t=m(e.itemsRef);if(t&&e.menuState.value===d.Open)for(var n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});n.nextNode();)n.currentNode.setAttribute("role","none")})),{id:t,el:e.itemsRef,handleKeyDown:function(t){switch(o.value&&clearTimeout(o.value),t.key){case s.Space:if(""!==e.searchQuery.value)return t.preventDefault(),e.search(t.key);case s.Enter:var r;t.preventDefault(),null!==e.activeItemIndex.value&&(null==(r=document.getElementById(e.items.value[e.activeItemIndex.value].id))||r.click()),e.closeMenu(),n.nextTick((function(){var t;return null==(t=m(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case s.ArrowDown:return t.preventDefault(),e.goToItem(c.Next);case s.ArrowUp:return t.preventDefault(),e.goToItem(c.Previous);case s.Home:case s.PageUp:return t.preventDefault(),e.goToItem(c.First);case s.End:case s.PageDown:return t.preventDefault(),e.goToItem(c.Last);case s.Escape:t.preventDefault(),e.closeMenu(),n.nextTick((function(){var t;return null==(t=m(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case s.Tab:return t.preventDefault();default:1===t.key.length&&(e.search(t.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),O=n.defineComponent({props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,t){var r=t.slots,l=t.attrs,i=x("MenuItem"),a="headlessui-menu-item-"+f(),s=e.disabled,p=e.className,v=void 0===p?e.class:p,h=n.computed((function(){return null!==i.activeItemIndex.value&&i.items.value[i.activeItemIndex.value].id===a})),y=n.ref({disabled:s,textValue:""});function S(e){if(s)return e.preventDefault();i.closeMenu(),n.nextTick((function(){var e;return null==(e=m(i.buttonRef))?void 0:e.focus({preventScroll:!0})}))}function g(){if(s)return i.goToItem(c.Nothing);i.goToItem(c.Specific,a)}function w(){s||h.value||i.goToItem(c.Specific,a)}function O(){s||h.value&&i.goToItem(c.Nothing)}return n.onMounted((function(){var e,t,n=null==(e=document.getElementById(a))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(y.value.textValue=n)})),n.onMounted((function(){return i.registerItem(a,y)})),n.onUnmounted((function(){return i.unregisterItem(a)})),n.watchEffect((function(){i.menuState.value===d.Open&&h.value&&n.nextTick((function(){var e;return null==(e=document.getElementById(a))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:h.value,disabled:s},n={id:a,role:"menuitem",tabIndex:-1,class:b(v,t),"aria-disabled":!0===s||void 0,onClick:S,onFocus:g,onPointermove:w,onMousemove:w,onPointerleave:O,onMouseleave:O};return u({props:o({},e,n),slot:t,attrs:l,slots:r})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(y||(y={}));var I=Symbol("ListboxContext");function k(e){var t=n.inject(I,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <Listbox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,k),o}return t}var R=n.defineComponent({name:"Listbox",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},modelValue:{type:[Object,String,Number,Boolean],default:null}},setup:function(e,t){var o=t.slots,l=t.attrs,i=t.emit,a=e.disabled,s=r(e,["modelValue","disabled"]),d=n.ref(y.Closed),p=n.ref(null),f=n.ref(null),b=n.ref(null),h=n.ref([]),x=n.ref(""),S=n.ref(null),g=n.computed((function(){return e.modelValue})),w={listboxState:d,value:g,labelRef:p,buttonRef:f,optionsRef:b,disabled:a,options:h,searchQuery:x,activeOptionIndex:S,closeListbox:function(){a||d.value!==y.Closed&&(d.value=y.Closed,S.value=null)},openListbox:function(){a||d.value!==y.Open&&(d.value=y.Open)},goToOption:function(e,t){if(!a&&d.value!==y.Closed){var n=v(e===c.Specific?{focus:c.Specific,id:t}:{focus:e},{resolveItems:function(){return h.value},resolveActiveIndex:function(){return S.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===x.value&&S.value===n||(x.value="",S.value=n)}},search:function(e){if(!a&&d.value!==y.Closed){x.value+=e;var t=h.value.findIndex((function(e){return!e.dataRef.disabled&&e.dataRef.textValue.startsWith(x.value)}));-1!==t&&t!==S.value&&(S.value=t)}},clearSearch:function(){a||d.value!==y.Closed&&""!==x.value&&(x.value="")},registerOption:function(e,t){h.value.push({id:e,dataRef:t})},unregisterOption:function(e){var t=h.value.slice(),n=null!==S.value?t[S.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),h.value=t,S.value=o===S.value||null===n?null:t.indexOf(n)},select:function(e){a||i("update:modelValue",e)}};return n.onMounted((function(){function e(e){var t,n,o,r=e.target,l=document.activeElement;d.value===y.Open&&((null==(t=m(f))?void 0:t.contains(r))||((null==(n=m(b))?void 0:n.contains(r))||w.closeListbox(),l!==document.body&&(null==l?void 0:l.contains(r))||e.defaultPrevented||null==(o=m(f))||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),n.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),n.provide(I,w),function(){return u({props:s,slot:{open:d.value===y.Open,disabled:a},slots:o,attrs:l})}}}),T=n.defineComponent({name:"ListboxLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){var e=k("ListboxLabel"),t={open:e.listboxState.value===y.Open,disabled:e.disabled};return u({props:o({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:t,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=k("ListboxLabel");return{id:"headlessui-listbox-label-"+f(),el:e.labelRef,handleClick:function(){var t;null==(t=m(e.buttonRef))||t.focus({preventScroll:!0})}}}}),D=n.defineComponent({name:"ListboxButton",props:{as:{type:[Object,String],default:"button"}},render:function(){var e,t,n=k("ListboxButton"),r={open:n.listboxState.value===y.Open,disabled:n.disabled},l={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=m(n.optionsRef))?void 0:e.id,"aria-expanded":n.listboxState.value===y.Open||void 0,"aria-labelledby":n.labelRef.value?[null==(t=m(n.labelRef))?void 0:t.id,this.id].join(" "):void 0,disabled:n.disabled,onKeydown:this.handleKeyDown,onClick:this.handleClick};return u({props:o({},this.$props,l),slot:r,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=k("ListboxButton");return{id:"headlessui-listbox-button-"+f(),el:e.buttonRef,handleKeyDown:function(t){switch(t.key){case s.Space:case s.Enter:case s.ArrowDown:t.preventDefault(),e.openListbox(),n.nextTick((function(){var t;null==(t=m(e.optionsRef))||t.focus({preventScroll:!0}),e.value.value||e.goToOption(c.First)}));break;case s.ArrowUp:t.preventDefault(),e.openListbox(),n.nextTick((function(){var t;null==(t=m(e.optionsRef))||t.focus({preventScroll:!0}),e.value.value||e.goToOption(c.Last)}))}},handleClick:function(t){var o;e.disabled||(e.listboxState.value===y.Open?(e.closeListbox(),n.nextTick((function(){var t;return null==(t=m(e.buttonRef))?void 0:t.focus({preventScroll:!0})}))):(t.preventDefault(),e.openListbox(),o=function(){var t;return null==(t=m(e.optionsRef))?void 0:t.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(o)}))))}}}}),C=n.defineComponent({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var t,n,r,l,i=k("ListboxOptions"),a={open:i.listboxState.value===y.Open},s={"aria-activedescendant":null===i.activeOptionIndex.value||null==(t=i.options.value[i.activeOptionIndex.value])?void 0:t.id,"aria-labelledby":null!=(n=null==(r=m(i.labelRef))?void 0:r.id)?n:null==(l=m(i.buttonRef))?void 0:l.id,id:this.id,onKeydown:this.handleKeyDown,role:"listbox",tabIndex:0,ref:"el"};return u({props:o({},this.$props,s),slot:a,attrs:this.$attrs,slots:this.$slots,features:e.RenderStrategy|e.Static,visible:a.open})},setup:function(){var e=k("ListboxOptions"),t="headlessui-listbox-options-"+f(),o=n.ref(null);return{id:t,el:e.optionsRef,handleKeyDown:function(t){switch(o.value&&clearTimeout(o.value),t.key){case s.Space:if(""!==e.searchQuery.value)return t.preventDefault(),e.search(t.key);case s.Enter:t.preventDefault(),null!==e.activeOptionIndex.value&&e.select(e.options.value[e.activeOptionIndex.value].dataRef.value),e.closeListbox(),n.nextTick((function(){var t;return null==(t=m(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case s.ArrowDown:return t.preventDefault(),e.goToOption(c.Next);case s.ArrowUp:return t.preventDefault(),e.goToOption(c.Previous);case s.Home:case s.PageUp:return t.preventDefault(),e.goToOption(c.First);case s.End:case s.PageDown:return t.preventDefault(),e.goToOption(c.Last);case s.Escape:t.preventDefault(),e.closeListbox(),n.nextTick((function(){var t;return null==(t=m(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case s.Tab:return t.preventDefault();default:1===t.key.length&&(e.search(t.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),E=n.defineComponent({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String],default:null},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,t){var r=t.slots,l=t.attrs,i=k("ListboxOption"),a="headlessui-listbox-option-"+f(),s=e.disabled,d=e.className,p=void 0===d?e.class:d,v=e.value,h=n.computed((function(){return null!==i.activeOptionIndex.value&&i.options.value[i.activeOptionIndex.value].id===a})),x=n.computed((function(){return n.toRaw(i.value.value)===n.toRaw(v)})),S=n.ref({disabled:s,value:v,textValue:""});function g(e){if(s)return e.preventDefault();i.select(v),i.closeListbox(),n.nextTick((function(){var e;return null==(e=m(i.buttonRef))?void 0:e.focus({preventScroll:!0})}))}function w(){if(s)return i.goToOption(c.Nothing);i.goToOption(c.Specific,a)}function O(){s||h.value||i.goToOption(c.Specific,a)}function I(){s||h.value&&i.goToOption(c.Nothing)}return n.onMounted((function(){var e,t,n=null==(e=document.getElementById(a))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(S.value.textValue=n)})),n.onMounted((function(){return i.registerOption(a,S)})),n.onUnmounted((function(){return i.unregisterOption(a)})),n.onMounted((function(){n.watch([i.listboxState,x],(function(){var e;i.listboxState.value===y.Open&&x.value&&(i.goToOption(c.Specific,a),null==(e=document.getElementById(a))||null==e.focus||e.focus())}),{immediate:!0})})),n.watchEffect((function(){i.listboxState.value===y.Open&&h.value&&n.nextTick((function(){var e;return null==(e=document.getElementById(a))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:h.value,selected:x.value,disabled:s},n={id:a,role:"option",tabIndex:-1,class:b(p,t),"aria-disabled":!0===s||void 0,"aria-selected":!0===x.value?x.value:void 0,onClick:g,onFocus:w,onPointermove:O,onMousemove:O,onPointerleave:I,onMouseleave:I};return u({props:o({},e,n),slot:t,attrs:l,slots:r})}}}),L=Symbol("GroupContext");function j(e){var t=n.inject(L,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <SwitchGroup /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,j),o}return t}var M=n.defineComponent({name:"SwitchGroup",props:{as:{type:[Object,String],default:"template"}},setup:function(e,t){var o=t.slots,r=t.attrs,l=n.ref(null),i=n.ref(null),a=n.ref(null);return n.provide(L,{switchRef:l,labelRef:i,descriptionRef:a}),function(){return u({props:e,slot:{},slots:o,attrs:r})}}}),N=n.defineComponent({name:"Switch",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"button"},modelValue:{type:[Object,Boolean],default:null},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},render:function(){var e=n.inject(L,null),t=this.$props,r=t.className,l=void 0===r?t.class:r,i=n.computed((function(){var t;return null==(t=m(null==e?void 0:e.labelRef))?void 0:t.id})),a=n.computed((function(){var t;return null==(t=m(null==e?void 0:e.descriptionRef))?void 0:t.id})),s={checked:this.$props.modelValue},c={id:this.id,ref:null===e?void 0:e.switchRef,role:"switch",tabIndex:0,class:b(l,s),"aria-checked":this.$props.modelValue,"aria-labelledby":i.value,"aria-describedby":a.value,onClick:this.handleClick,onKeyup:this.handleKeyUp,onKeypress:this.handleKeyPress};return"button"===this.$props.as&&Object.assign(c,{type:"button"}),u({props:o({},this.$props,c),slot:s,attrs:this.$attrs,slots:this.$slots})},setup:function(e,t){var o=t.emit,r=n.inject(L,null);function l(){o("update:modelValue",!e.modelValue)}return{id:"headlessui-switch-"+f(),el:null==r?void 0:r.switchRef,handleClick:function(e){e.preventDefault(),l()},handleKeyUp:function(e){e.key!==s.Tab&&e.preventDefault(),e.key===s.Space&&l()},handleKeyPress:function(e){e.preventDefault()}}}}),A=n.defineComponent({name:"SwitchLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){return u({props:o({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=j("SwitchLabel");return{id:"headlessui-switch-label-"+f(),el:e.labelRef,handleClick:function(){var t=m(e.switchRef);null==t||t.click(),null==t||t.focus({preventScroll:!0})}}}}),$=n.defineComponent({name:"SwitchDescription",props:{as:{type:[Object,String],default:"p"}},render:function(){return u({props:o({},this.$props,{id:this.id,ref:"el"}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=j("SwitchDescription");return{id:"headlessui-switch-description-"+f(),el:e.descriptionRef}}});exports.Listbox=R,exports.ListboxButton=D,exports.ListboxLabel=T,exports.ListboxOption=E,exports.ListboxOptions=C,exports.Menu=S,exports.MenuButton=g,exports.MenuItem=O,exports.MenuItems=w,exports.Switch=N,exports.SwitchDescription=$,exports.SwitchGroup=M,exports.SwitchLabel=A; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n=require("vue");function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function r(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function l(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 i(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)?i(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function a(e,t){if(e in t){for(var n=t[e],o=arguments.length,r=new Array(o>2?o-2:0),i=2;i<o;i++)r[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,r):n}var l=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(l,a),l}function u(n){var i,l,u=n.visible,c=void 0===u||u,d=n.features,p=void 0===d?e.None:d,v=r(n,["visible","features"]);return c||p&e.Static&&v.props.static?s(v):p&e.RenderStrategy?a(null==(i=v.props.unmount)||i?t.Unmount:t.Hidden,((l={})[t.Unmount]=function(){return null},l[t.Hidden]=function(){return s(o({},v,{props:o({},v.props,{hidden:!0,style:{display:"none"}})}))},l)):s(v)}function s(e){var t=e.attrs,o=e.slots,i=e.slot,a=function(e,t){void 0===t&&(t=[]);for(var n,o=Object.assign({},e),r=l(t);!(n=r()).done;){var i=n.value;i in o&&delete o[i]}return o}(e.props,["unmount","static"]),u=a.as,s=r(a,["as"]),c=null==o.default?void 0:o.default(i);if("template"===u){if(Object.keys(s).length>0||"class"in t){var d=null!=c?c:[],p=d[0];if(d.slice(1).length>0)throw new Error('You should only render 1 child or use the `as="..."` prop');return n.cloneVNode(p,s)}return c}return n.h(u,s,c)}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(e||(e={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(t||(t={}));var c,d=n.defineComponent({name:"Alert",props:{as:{type:[Object,String],default:"div"},importance:{type:String,default:"polite"}},setup:function(e,t){var n=t.slots,i=t.attrs,l=e.importance,s=void 0===l?"polite":l,c=r(e,["importance"]),d={importance:s},p=a(s,{polite:function(){return{role:"status"}},assertive:function(){return{role:"alert"}}});return function(){return u({props:o({},c,p),slot:d,slots:n,attrs:i})}}});!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"}(c||(c={}));var p=0;function v(){return++p}var f,m,h,b,y=["[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 g(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(y))}function S(e){null==e||e.focus({preventScroll:!0})}function w(e,t){var n=Array.isArray(e)?e:g(e),o=document.activeElement,r=function(){if(t&(f.First|f.Next))return h.Next;if(t&(f.Previous|f.Last))return h.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),i=function(){if(t&f.First)return 0;if(t&f.Previous)return Math.max(0,n.indexOf(o))-1;if(t&f.Next)return Math.max(0,n.indexOf(o))+1;if(t&f.Last)return n.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),l=t&f.NoScroll?{preventScroll:!0}:{},a=0,u=n.length,s=void 0;do{var c;if(a>=u||a+u<=0)return m.Error;var d=i+a;if(t&f.WrapAround)d=(d+u)%u;else{if(d<0)return m.Underflow;if(d>=u)return m.Overflow}null==(c=s=n[d])||c.focus(l),a+=r}while(s!==document.activeElement);return m.Success}function x(e,t,o){window.addEventListener(e,t,o),n.onUnmounted((function(){return window.removeEventListener(e,t,o)}))}function O(e,t){for(var n,o=l(e);!(n=o()).done;)if(n.value.contains(t))return!0;return!1}function C(e,t,o){void 0===t&&(t=!0),void 0===o&&(o={});var r=n.ref("undefined"!=typeof window?document.activeElement:null),i=n.ref(null);n.watchEffect((function(n){var a,u;if(t&&1===e.value.size){var s,c=document.activeElement;if(null==(a=o.initialFocus)?void 0:a.value){if((null==(s=o.initialFocus)?void 0:s.value)===c)return}else if(O(e.value,c))return;if(r.value=c,null==(u=o.initialFocus)?void 0:u.value)S(o.initialFocus.value);else{for(var d,p=!1,v=l(e.value);!(d=v()).done;)if(w(d.value,f.First)===m.Success){p=!0;break}if(!p)throw new Error("There are no focusable elements inside the <FocusTrap />")}i.value=document.activeElement,n((function(){S(r.value),r.value=null,i.value=null}))}})),x("keydown",(function(n){if(t&&n.key===c.Tab&&document.activeElement&&1===e.value.size){n.preventDefault();for(var o,r=l(e.value);!(o=r()).done;)if(w(o.value,(n.shiftKey?f.Previous:f.Next)|f.WrapAround)===m.Success){i.value=document.activeElement;break}}})),x("focus",(function(n){if(t&&1===e.value.size){var o=i.value;if(o){var r=n.target;r&&r instanceof HTMLElement?O(e.value,r)?(i.value=r,S(r)):(n.preventDefault(),n.stopPropagation(),S(o)):S(i.value)}}}))}!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"}(f||(f={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(m||(m={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(h||(h={})),function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"}(b||(b={}));var E=new Set,D=new Map;function I(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function k(e){var t=D.get(e);t&&(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}var P,T=n.defineComponent({name:"Portal",props:{as:{type:[Object,String],default:"template"}},setup:function(e,t){var o=t.slots,r=t.attrs,i=n.inject(R,null),l=n.ref(null===i?function(){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)}():i.resolveTarget());return n.watchEffect((function(){null!==i&&(l.value=i.resolveTarget())})),n.onUnmounted((function(){var e,t=l.value;t&&t!==(null==i?void 0:i.resolveTarget())&&t.children.length<=0&&(null==(e=t.parentElement)||e.removeChild(t))})),function(){return null===l.value?null:n.h(n.Teleport,{to:l.value},[u({props:e,slot:{},attrs:r,slots:o})])}}}),R=Symbol("PortalGroupContext"),L=n.defineComponent({name:"PortalGroup",props:{as:{type:[Object,String],default:"template"},target:{type:Object,default:null}},setup:function(e,t){var o=t.attrs,i=t.slots,l=n.reactive({resolveTarget:function(){return e.target}});return n.provide(R,l),function(){return u({props:r(e,["target"]),slot:{},attrs:o,slots:i})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(P||(P={}));var F=Symbol("DialogContext");function $(e){var t=n.inject(F,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <Dialog /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,$),o}return t}var j,A="DC8F892D-2EBD-447C-A4C8-A03058436FF4",B=n.defineComponent({name:"Dialog",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},open:{type:Boolean,default:A},onClose:{type:Function,default:A},initialFocus:{type:Object,default:null}},render:function(){var t=this,i={ref:"el",id:this.id,role:"dialog","aria-modal":this.dialogState===P.Open||void 0,"aria-labelledby":this.titleId,"aria-describedby":this.descriptionId},l=this.$props,a=l.open,s=r(l,["open","onClose","initialFocus"]);return n.h(T,{},(function(){return[n.h(L,{target:t.dialogRef},(function(){return[u({props:o({},s,i),slot:{open:t.dialogState===P.Open},attrs:t.$attrs,slots:t.$slots,visible:a,features:e.RenderStrategy|e.Static})]}))]}))},setup:function(e){var t=n.ref(new Set),o=e.open!==A,r=e.onClose!==A;if(!o&&!r)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!o)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!r)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof e.open)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+(e.open===A?void 0:e.open));if("function"!=typeof e.onClose)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+(e.onClose===A?void 0:e.onClose));var i=n.computed((function(){return e.open?P.Open:P.Closed})),a=n.ref(null),u=n.computed((function(){return!!e.static||i.value===P.Open})),s="headlessui-dialog-"+v();C(t,u.value,{initialFocus:e.initialFocus}),function(e,t){void 0===t&&(t=n.ref(!0)),n.watchEffect((function(){if(t.value&&e.value){var n=e.value;E.add(n);for(var o,r=l(D.keys());!(o=r()).done;){var i=o.value;i.contains(n)&&(k(i),D.delete(i))}return document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var t,n=l(E);!(t=n()).done;)if(e.contains(t.value))return;1===E.size&&(D.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),I(e))}})),function(){if(E.delete(n),E.size>0)document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!D.has(e)){for(var t,n=l(E);!(t=n()).done;)if(e.contains(t.value))return;D.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),I(e)}}));else for(var e,t=l(D.keys());!(e=t()).done;){var o=e.value;k(o),D.delete(o)}}}}))}(a,u);var d=n.ref(null),p=n.ref(null),f={titleId:d,descriptionId:p,setTitleId:function(e){d.value!==e&&(d.value=e)},setDescriptionId:function(e){p.value!==e&&(p.value=e)},close:function(){e.onClose(!1)}};return n.provide(F,f),x("mousedown",(function(e){i.value===P.Open&&1===t.value.size&&(O(t.value,e.target)||f.close())})),x("keydown",(function(e){e.key===c.Escape&&i.value===P.Open&&(t.value.size>1||f.close())})),n.watchEffect((function(e){if(i.value===P.Open){var t=document.documentElement.style.overflow,n=document.documentElement.style.paddingRight,o=window.innerWidth-document.documentElement.clientWidth;document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=o+"px",e((function(){document.documentElement.style.overflow=t,document.documentElement.style.paddingRight=n}))}})),n.watchEffect((function(e){if(i.value===P.Open&&a.value){var t=new IntersectionObserver((function(e){for(var t,n=l(e);!(t=n()).done;){var o=t.value;0===o.boundingClientRect.x&&0===o.boundingClientRect.y&&0===o.boundingClientRect.width&&0===o.boundingClientRect.height&&close()}}));t.observe(a.value),e((function(){return t.disconnect()}))}})),{id:s,el:a,dialogRef:a,dialogState:i,titleId:d,descriptionId:p}}}),M=n.defineComponent({name:"DialogOverlay",props:{as:{type:[Object,String],default:"div"}},render:function(){var e=$("DialogOverlay");return u({props:o({},this.$props,{ref:"el",id:this.id,"aria-hidden":!0,onClick:this.handleClick}),slot:{open:e.dialogState.value===P.Open},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=$("DialogOverlay");return{id:"headlessui-dialog-overlay-"+v(),handleClick:function(){e.close()}}}}),N=n.defineComponent({name:"DialogTitle",props:{as:{type:[Object,String],default:"h2"}},render:function(){var e=$("DialogTitle");return u({props:o({},this.$props,{id:this.id}),slot:{open:e.dialogState.value===P.Open},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=$("DialogTitle"),t="headlessui-dialog-title-"+v();return n.onMounted((function(){e.setTitleId(t),n.onUnmounted((function(){return e.setTitleId(null)}))})),{id:t}}}),K=n.defineComponent({name:"DialogDescription",props:{as:{type:[Object,String],default:"p"}},render:function(){var e=$("DialogDescription");return u({props:o({},this.$props,{id:this.id}),slot:{open:e.dialogState.value===P.Open},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=$("DialogDescription"),t="headlessui-dialog-description-"+v();return n.onMounted((function(){e.setDescriptionId(t),n.onUnmounted((function(){return e.setDescriptionId(null)}))})),{id:t}}});function U(e){var t;return null==e||null==e.value?null:null!=(t=e.value.$el)?t:e.value}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(j||(j={}));var V=Symbol("DisclosureContext");function q(e){var t=n.inject(V,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <Disclosure /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,q),o}return t}var W,G,H=n.defineComponent({name:"Disclosure",props:{as:{type:[Object,String],default:"template"}},setup:function(e,t){var r=t.slots,i=t.attrs,l=o({},e),s=n.ref(j.Closed),c=n.ref(null);return n.provide(V,{disclosureState:s,panelRef:c,toggleDisclosure:function(){var e;s.value=a(s.value,((e={})[j.Open]=j.Closed,e[j.Closed]=j.Open,e))}}),function(){return u({props:l,slot:{open:s.value===j.Open},slots:r,attrs:i})}}}),z=n.defineComponent({name:"DisclosureButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1}},render:function(){var e=q("DisclosureButton"),t={open:e.disclosureState.value===j.Open};return u({props:o({},this.$props,{id:this.id,type:"button","aria-expanded":e.disclosureState.value===j.Open||void 0,"aria-controls":this.ariaControls,onClick:this.handleClick,onKeydown:this.handleKeyDown}),slot:t,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var t=q("DisclosureButton");return{id:"headlessui-disclosure-button-"+v(),ariaControls:n.computed((function(){var e,n;return null!=(e=null==(n=U(t.panelRef))?void 0:n.id)?e:void 0})),handleClick:function(){e.disabled||t.toggleDisclosure()},handleKeyDown:function(n){if(!e.disabled)switch(n.key){case c.Space:case c.Enter:n.preventDefault(),t.toggleDisclosure()}}}}}),Y=n.defineComponent({name:"DisclosurePanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var t={open:q("DisclosurePanel").disclosureState.value===j.Open};return u({props:o({},this.$props,{id:this.id,ref:"el"}),slot:t,attrs:this.$attrs,slots:this.$slots,features:e.RenderStrategy|e.Static,visible:t.open})},setup:function(){var e=q("DisclosurePanel");return{id:"headlessui-disclosure-panel-"+v(),el:e.panelRef}}}),_=n.defineComponent({name:"FocusTrap",props:{as:{type:[Object,String],default:"div"},initialFocus:{type:Object,default:null}},render:function(){return u({props:o({},r(this.$props,["initialFocus"]),{ref:"el"}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(e){var t=n.ref(new Set),o=n.ref(null);return n.onMounted((function(){o.value&&(t.value.add(o.value),C(t,!0,{initialFocus:e.initialFocus}))})),{el:o}}});function Q(e,t){var n=t.resolveItems();if(n.length<=0)return null;var o=t.resolveActiveIndex(),r=null!=o?o:-1,i=function(){switch(e.focus){case W.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case W.Previous:var o=n.slice().reverse().findIndex((function(e,n,o){return!(-1!==r&&o.length-n-1>=r||t.resolveDisabled(e))}));return-1===o?o:n.length-1-o;case W.Next:return n.findIndex((function(e,n){return!(n<=r||t.resolveDisabled(e))}));case W.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case W.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case W.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?o:i}function J(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}!function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(W||(W={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(G||(G={}));var X=Symbol("ListboxContext");function Z(e){var t=n.inject(X,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <Listbox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,Z),o}return t}var ee,te=n.defineComponent({name:"Listbox",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},modelValue:{type:[Object,String,Number,Boolean],default:null}},setup:function(e,t){var o=t.slots,i=t.attrs,l=t.emit,a=e.disabled,s=r(e,["modelValue","disabled"]),c=n.ref(G.Closed),d=n.ref(null),p=n.ref(null),v=n.ref(null),f=n.ref([]),m=n.ref(""),h=n.ref(null),b=n.computed((function(){return e.modelValue})),y={listboxState:c,value:b,labelRef:d,buttonRef:p,optionsRef:v,disabled:a,options:f,searchQuery:m,activeOptionIndex:h,closeListbox:function(){a||c.value!==G.Closed&&(c.value=G.Closed,h.value=null)},openListbox:function(){a||c.value!==G.Open&&(c.value=G.Open)},goToOption:function(e,t){if(!a&&c.value!==G.Closed){var n=Q(e===W.Specific?{focus:W.Specific,id:t}:{focus:e},{resolveItems:function(){return f.value},resolveActiveIndex:function(){return h.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===m.value&&h.value===n||(m.value="",h.value=n)}},search:function(e){if(!a&&c.value!==G.Closed){m.value+=e;var t=f.value.findIndex((function(e){return!e.dataRef.disabled&&e.dataRef.textValue.startsWith(m.value)}));-1!==t&&t!==h.value&&(h.value=t)}},clearSearch:function(){a||c.value!==G.Closed&&""!==m.value&&(m.value="")},registerOption:function(e,t){f.value.push({id:e,dataRef:t})},unregisterOption:function(e){var t=f.value.slice(),n=null!==h.value?t[h.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),f.value=t,h.value=o===h.value||null===n?null:t.indexOf(n)},select:function(e){a||l("update:modelValue",e)}};return n.onMounted((function(){function e(e){var t,n,o,r=e.target,i=document.activeElement;c.value===G.Open&&((null==(t=U(p))?void 0:t.contains(r))||((null==(n=U(v))?void 0:n.contains(r))||y.closeListbox(),i!==document.body&&(null==i?void 0:i.contains(r))||e.defaultPrevented||null==(o=U(p))||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),n.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),n.provide(X,y),function(){return u({props:s,slot:{open:c.value===G.Open,disabled:a},slots:o,attrs:i})}}}),ne=n.defineComponent({name:"ListboxLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){var e=Z("ListboxLabel"),t={open:e.listboxState.value===G.Open,disabled:e.disabled};return u({props:o({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:t,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=Z("ListboxLabel");return{id:"headlessui-listbox-label-"+v(),el:e.labelRef,handleClick:function(){var t;null==(t=U(e.buttonRef))||t.focus({preventScroll:!0})}}}}),oe=n.defineComponent({name:"ListboxButton",props:{as:{type:[Object,String],default:"button"}},render:function(){var e,t,n=Z("ListboxButton"),r={open:n.listboxState.value===G.Open,disabled:n.disabled},i={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=U(n.optionsRef))?void 0:e.id,"aria-expanded":n.listboxState.value===G.Open||void 0,"aria-labelledby":n.labelRef.value?[null==(t=U(n.labelRef))?void 0:t.id,this.id].join(" "):void 0,disabled:n.disabled,onKeydown:this.handleKeyDown,onClick:this.handleClick};return u({props:o({},this.$props,i),slot:r,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=Z("ListboxButton");return{id:"headlessui-listbox-button-"+v(),el:e.buttonRef,handleKeyDown:function(t){switch(t.key){case c.Space:case c.Enter:case c.ArrowDown:t.preventDefault(),e.openListbox(),n.nextTick((function(){var t;null==(t=U(e.optionsRef))||t.focus({preventScroll:!0}),e.value.value||e.goToOption(W.First)}));break;case c.ArrowUp:t.preventDefault(),e.openListbox(),n.nextTick((function(){var t;null==(t=U(e.optionsRef))||t.focus({preventScroll:!0}),e.value.value||e.goToOption(W.Last)}))}},handleClick:function(t){var o;e.disabled||(e.listboxState.value===G.Open?(e.closeListbox(),n.nextTick((function(){var t;return null==(t=U(e.buttonRef))?void 0:t.focus({preventScroll:!0})}))):(t.preventDefault(),e.openListbox(),o=function(){var t;return null==(t=U(e.optionsRef))?void 0:t.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(o)}))))}}}}),re=n.defineComponent({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var t,n,r,i,l=Z("ListboxOptions"),a={open:l.listboxState.value===G.Open},s={"aria-activedescendant":null===l.activeOptionIndex.value||null==(t=l.options.value[l.activeOptionIndex.value])?void 0:t.id,"aria-labelledby":null!=(n=null==(r=U(l.labelRef))?void 0:r.id)?n:null==(i=U(l.buttonRef))?void 0:i.id,id:this.id,onKeydown:this.handleKeyDown,role:"listbox",tabIndex:0,ref:"el"};return u({props:o({},this.$props,s),slot:a,attrs:this.$attrs,slots:this.$slots,features:e.RenderStrategy|e.Static,visible:a.open})},setup:function(){var e=Z("ListboxOptions"),t="headlessui-listbox-options-"+v(),o=n.ref(null);return{id:t,el:e.optionsRef,handleKeyDown:function(t){switch(o.value&&clearTimeout(o.value),t.key){case c.Space:if(""!==e.searchQuery.value)return t.preventDefault(),e.search(t.key);case c.Enter:t.preventDefault(),null!==e.activeOptionIndex.value&&e.select(e.options.value[e.activeOptionIndex.value].dataRef.value),e.closeListbox(),n.nextTick((function(){var t;return null==(t=U(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case c.ArrowDown:return t.preventDefault(),e.goToOption(W.Next);case c.ArrowUp:return t.preventDefault(),e.goToOption(W.Previous);case c.Home:case c.PageUp:return t.preventDefault(),e.goToOption(W.First);case c.End:case c.PageDown:return t.preventDefault(),e.goToOption(W.Last);case c.Escape:t.preventDefault(),e.closeListbox(),n.nextTick((function(){var t;return null==(t=U(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case c.Tab:return t.preventDefault();default:1===t.key.length&&(e.search(t.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),ie=n.defineComponent({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String],default:null},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,t){var r=t.slots,i=t.attrs,l=Z("ListboxOption"),a="headlessui-listbox-option-"+v(),s=e.disabled,c=e.className,d=void 0===c?e.class:c,p=e.value,f=n.computed((function(){return null!==l.activeOptionIndex.value&&l.options.value[l.activeOptionIndex.value].id===a})),m=n.computed((function(){return n.toRaw(l.value.value)===n.toRaw(p)})),h=n.ref({disabled:s,value:p,textValue:""});function b(e){if(s)return e.preventDefault();l.select(p),l.closeListbox(),n.nextTick((function(){var e;return null==(e=U(l.buttonRef))?void 0:e.focus({preventScroll:!0})}))}function y(){if(s)return l.goToOption(W.Nothing);l.goToOption(W.Specific,a)}function g(){s||f.value||l.goToOption(W.Specific,a)}function S(){s||f.value&&l.goToOption(W.Nothing)}return n.onMounted((function(){var e,t,n=null==(e=document.getElementById(a))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(h.value.textValue=n)})),n.onMounted((function(){return l.registerOption(a,h)})),n.onUnmounted((function(){return l.unregisterOption(a)})),n.onMounted((function(){n.watch([l.listboxState,m],(function(){var e;l.listboxState.value===G.Open&&m.value&&(l.goToOption(W.Specific,a),null==(e=document.getElementById(a))||null==e.focus||e.focus())}),{immediate:!0})})),n.watchEffect((function(){l.listboxState.value===G.Open&&f.value&&n.nextTick((function(){var e;return null==(e=document.getElementById(a))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:f.value,selected:m.value,disabled:s},n={id:a,role:"option",tabIndex:-1,class:J(d,t),"aria-disabled":!0===s||void 0,"aria-selected":!0===m.value?m.value:void 0,onClick:b,onFocus:y,onPointermove:g,onMousemove:g,onPointerleave:S,onMouseleave:S};return u({props:o({},e,n),slot:t,attrs:i,slots:r})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(ee||(ee={}));var le=Symbol("MenuContext");function ae(e){var t=n.inject(le,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <Menu /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,ae),o}return t}var ue,se=n.defineComponent({props:{as:{type:[Object,String],default:"template"}},setup:function(e,t){var o=t.slots,r=t.attrs,i=n.ref(ee.Closed),l=n.ref(null),a=n.ref(null),s=n.ref([]),c=n.ref(""),d=n.ref(null),p={menuState:i,buttonRef:l,itemsRef:a,items:s,searchQuery:c,activeItemIndex:d,closeMenu:function(){i.value=ee.Closed,d.value=null},openMenu:function(){return i.value=ee.Open},goToItem:function(e,t){var n=Q(e===W.Specific?{focus:W.Specific,id:t}:{focus:e},{resolveItems:function(){return s.value},resolveActiveIndex:function(){return d.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===c.value&&d.value===n||(c.value="",d.value=n)},search:function(e){c.value+=e;var t=s.value.findIndex((function(e){return e.dataRef.textValue.startsWith(c.value)&&!e.dataRef.disabled}));-1!==t&&t!==d.value&&(d.value=t)},clearSearch:function(){c.value=""},registerItem:function(e,t){s.value.push({id:e,dataRef:t})},unregisterItem:function(e){var t=s.value.slice(),n=null!==d.value?t[d.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),s.value=t,d.value=o===d.value||null===n?null:t.indexOf(n)}};return n.onMounted((function(){function e(e){var t,n,o,r=e.target,u=document.activeElement;i.value===ee.Open&&((null==(t=U(l))?void 0:t.contains(r))||((null==(n=U(a))?void 0:n.contains(r))||p.closeMenu(),u!==document.body&&(null==u?void 0:u.contains(r))||e.defaultPrevented||null==(o=U(l))||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),n.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),n.provide(le,p),function(){return u({props:e,slot:{open:i.value===ee.Open},slots:o,attrs:r})}}}),ce=n.defineComponent({props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=ae("MenuButton"),n={open:t.menuState.value===ee.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=U(t.itemsRef))?void 0:e.id,"aria-expanded":t.menuState.value===ee.Open||void 0,onKeydown:this.handleKeyDown,onClick:this.handleClick};return u({props:o({},this.$props,r),slot:n,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var t=ae("MenuButton");return{id:"headlessui-menu-button-"+v(),el:t.buttonRef,handleKeyDown:function(e){switch(e.key){case c.Space:case c.Enter:case c.ArrowDown:e.preventDefault(),t.openMenu(),n.nextTick((function(){var e;null==(e=U(t.itemsRef))||e.focus({preventScroll:!0}),t.goToItem(W.First)}));break;case c.ArrowUp:e.preventDefault(),t.openMenu(),n.nextTick((function(){var e;null==(e=U(t.itemsRef))||e.focus({preventScroll:!0}),t.goToItem(W.Last)}))}},handleClick:function(o){var r;e.disabled||(t.menuState.value===ee.Open?(t.closeMenu(),n.nextTick((function(){var e;return null==(e=U(t.buttonRef))?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),t.openMenu(),r=function(){var e;return null==(e=U(t.itemsRef))?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),de=n.defineComponent({props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var t,n,r=ae("MenuItems"),i={open:r.menuState.value===ee.Open},l={"aria-activedescendant":null===r.activeItemIndex.value||null==(t=r.items.value[r.activeItemIndex.value])?void 0:t.id,"aria-labelledby":null==(n=U(r.buttonRef))?void 0:n.id,id:this.id,onKeydown:this.handleKeyDown,role:"menu",tabIndex:0,ref:"el"};return u({props:o({},this.$props,l),slot:i,attrs:this.$attrs,slots:this.$slots,features:e.RenderStrategy|e.Static,visible:i.open})},setup:function(){var e=ae("MenuItems"),t="headlessui-menu-items-"+v(),o=n.ref(null);return n.watchEffect((function(){var t=U(e.itemsRef);if(t&&e.menuState.value===ee.Open)for(var n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});n.nextNode();)n.currentNode.setAttribute("role","none")})),{id:t,el:e.itemsRef,handleKeyDown:function(t){switch(o.value&&clearTimeout(o.value),t.key){case c.Space:if(""!==e.searchQuery.value)return t.preventDefault(),e.search(t.key);case c.Enter:var r;t.preventDefault(),null!==e.activeItemIndex.value&&(null==(r=document.getElementById(e.items.value[e.activeItemIndex.value].id))||r.click()),e.closeMenu(),n.nextTick((function(){var t;return null==(t=U(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case c.ArrowDown:return t.preventDefault(),e.goToItem(W.Next);case c.ArrowUp:return t.preventDefault(),e.goToItem(W.Previous);case c.Home:case c.PageUp:return t.preventDefault(),e.goToItem(W.First);case c.End:case c.PageDown:return t.preventDefault(),e.goToItem(W.Last);case c.Escape:t.preventDefault(),e.closeMenu(),n.nextTick((function(){var t;return null==(t=U(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case c.Tab:return t.preventDefault();default:1===t.key.length&&(e.search(t.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),pe=n.defineComponent({props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,t){var r=t.slots,i=t.attrs,l=ae("MenuItem"),a="headlessui-menu-item-"+v(),s=e.disabled,c=e.className,d=void 0===c?e.class:c,p=n.computed((function(){return null!==l.activeItemIndex.value&&l.items.value[l.activeItemIndex.value].id===a})),f=n.ref({disabled:s,textValue:""});function m(e){if(s)return e.preventDefault();l.closeMenu(),n.nextTick((function(){var e;return null==(e=U(l.buttonRef))?void 0:e.focus({preventScroll:!0})}))}function h(){if(s)return l.goToItem(W.Nothing);l.goToItem(W.Specific,a)}function b(){s||p.value||l.goToItem(W.Specific,a)}function y(){s||p.value&&l.goToItem(W.Nothing)}return n.onMounted((function(){var e,t,n=null==(e=document.getElementById(a))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(f.value.textValue=n)})),n.onMounted((function(){return l.registerItem(a,f)})),n.onUnmounted((function(){return l.unregisterItem(a)})),n.watchEffect((function(){l.menuState.value===ee.Open&&p.value&&n.nextTick((function(){var e;return null==(e=document.getElementById(a))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:p.value,disabled:s},n={id:a,role:"menuitem",tabIndex:-1,class:J(d,t),"aria-disabled":!0===s||void 0,onClick:m,onFocus:h,onPointermove:b,onMousemove:b,onPointerleave:y,onMouseleave:y};return u({props:o({},e,n),slot:t,attrs:i,slots:r})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(ue||(ue={}));var ve=Symbol("PopoverContext");function fe(e){var t=n.inject(ve,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <"+ye.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,fe),o}return t}var me=Symbol("PopoverGroupContext");function he(){return n.inject(me,null)}var be=Symbol("PopoverPanelContext"),ye=n.defineComponent({name:"Popover",props:{as:{type:[Object,String],default:"div"}},setup:function(e,t){var r=t.slots,i=t.attrs,l=o({},e),s="headlessui-popover-button-"+v(),c="headlessui-popover-panel-"+v(),d=n.ref(ue.Closed),p=n.ref(null),f=n.ref(null),m={popoverState:d,buttonId:s,panelId:c,panel:f,button:p,togglePopover:function(){var e;d.value=a(d.value,((e={})[ue.Open]=ue.Closed,e[ue.Closed]=ue.Open,e))},closePopover:function(){d.value!==ue.Closed&&(d.value=ue.Closed)}};n.provide(ve,m);var h={buttonId:s,panelId:c,close:function(){m.closePopover()}},g=he(),S=null==g?void 0:g.registerPopover;return n.watchEffect((function(){return null==S?void 0:S(h)})),x("focus",(function(){var e,t,n;d.value===ue.Open&&((null!=(e=null==g?void 0:g.isFocusWithinPopoverGroup())?e:(null==(t=U(p))?void 0:t.contains(document.activeElement))||(null==(n=U(f))?void 0:n.contains(document.activeElement)))||p&&f&&m.closePopover())}),!0),x("mousedown",(function(e){var t,n,o,r,i,l,u=e.target;d.value===ue.Open&&((null==(t=U(p))?void 0:t.contains(u))||(null==(n=U(f))?void 0:n.contains(u))||(m.closePopover(),void 0===(i=b.Loose)&&(i=b.Strict),(r=u)!==document.body&&a(i,((l={})[b.Strict]=function(){return r.matches(y)},l[b.Loose]=function(){for(var e=r;null!==e;){if(e.matches(y))return!0;e=e.parentElement}return!1},l))||(e.preventDefault(),null==(o=U(p))||o.focus())))})),function(){return u({props:l,slot:{open:d.value===ue.Open},slots:r,attrs:i})}}}),ge=n.defineComponent({name:"PopoverButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1}},render:function(){var e=fe("PopoverButton"),t={open:e.popoverState.value===ue.Open},n=this.isWithinPanel?{type:"button",onKeydown:this.handleKeyDown,onClick:this.handleClick}:{ref:"el",id:e.buttonId,type:"button","aria-expanded":e.popoverState.value===ue.Open||void 0,"aria-controls":U(e.panel)?e.panelId:void 0,onKeydown:this.handleKeyDown,onKeyup:this.handleKeyUp,onClick:this.handleClick};return u({props:o({},this.$props,n),slot:t,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var t=fe("PopoverButton"),o=he(),r=null==o?void 0:o.closeOthers,i=n.inject(be,null),l=null!==i&&i===t.panelId,a=n.ref(null),u=n.ref("undefined"==typeof window?null:document.activeElement);return x("focus",(function(){u.value=a.value,a.value=document.activeElement}),!0),{isWithinPanel:l,el:l?null:t.button,handleKeyDown:function(e){var n,o;if(l){if(t.popoverState.value===ue.Closed)return;switch(e.key){case c.Space:case c.Enter:e.preventDefault(),e.stopPropagation(),t.closePopover(),null==(n=U(t.button))||n.focus()}}else switch(e.key){case c.Space:case c.Enter:e.preventDefault(),e.stopPropagation(),t.popoverState.value===ue.Closed&&(null==r||r(t.buttonId)),t.togglePopover();break;case c.Escape:if(t.popoverState.value!==ue.Open)return null==r?void 0:r(t.buttonId);if(!U(t.button))return;if(!(null==(o=U(t.button))?void 0:o.contains(document.activeElement)))return;t.closePopover();break;case c.Tab:if(t.popoverState.value!==ue.Open)return;if(!t.panel)return;if(!t.button)return;if(e.shiftKey){var i,a;if(!u.value)return;if(null==(i=U(t.button))?void 0:i.contains(u.value))return;if(null==(a=U(t.panel))?void 0:a.contains(u.value))return;var s=g(),d=s.indexOf(u.value);if(s.indexOf(U(t.button))>d)return;e.preventDefault(),e.stopPropagation(),w(U(t.panel),f.Last)}else e.preventDefault(),e.stopPropagation(),w(U(t.panel),f.First)}},handleKeyUp:function(e){var n,o;if(!l&&t.popoverState.value===ue.Open&&t.panel&&t.button)switch(e.key){case c.Tab:if(!u.value)return;if(null==(n=U(t.button))?void 0:n.contains(u.value))return;if(null==(o=U(t.panel))?void 0:o.contains(u.value))return;var r=g(),i=r.indexOf(u.value);if(r.indexOf(U(t.button))>i)return;e.preventDefault(),e.stopPropagation(),w(U(t.panel),f.Last)}},handleClick:function(){var n;e.disabled||(l?(t.closePopover(),null==(n=U(t.button))||n.focus()):(t.popoverState.value===ue.Closed&&(null==r||r(t.buttonId)),t.togglePopover()))},handleFocus:function(){}}}}),Se=n.defineComponent({name:"PopoverOverlay",props:{as:{type:[Object,String],default:"div"}},render:function(){var e={open:fe("PopoverOverlay").popoverState.value===ue.Open};return u({props:o({},this.$props,{id:this.id,ref:"el","aria-hidden":!0,onClick:this.handleClick}),slot:e,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=fe("PopoverOverlay");return{id:"headlessui-popover-overlay-"+v(),handleClick:function(){e.closePopover()}}}}),we=n.defineComponent({name:"PopoverPanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},focus:{type:Boolean,default:!1}},render:function(){var t={open:fe("PopoverPanel").popoverState.value===ue.Open};return u({props:o({},this.$props,{ref:"el",id:this.id,onKeydown:this.handleKeyDown}),slot:t,attrs:this.$attrs,slots:this.$slots,features:e.RenderStrategy|e.Static,visible:t.open})},setup:function(e){var t=e.focus,o=fe("PopoverPanel");return n.provide(be,o.panelId),n.onUnmounted((function(){o.panel.value=null})),n.watchEffect((function(){var e;if(t&&o.popoverState.value===ue.Open&&o.panel){var n=document.activeElement;(null==(e=U(o.panel))?void 0:e.contains(n))||w(U(o.panel),f.First)}})),x("keydown",(function(e){var t;if(o.popoverState.value===ue.Open&&U(o.panel)&&e.key===c.Tab&&document.activeElement&&(null==(t=U(o.panel))?void 0:t.contains(document.activeElement))){e.preventDefault();var n,r=w(U(o.panel),e.shiftKey?f.Previous:f.Next);if(r===m.Underflow)return null==(n=U(o.button))?void 0:n.focus();if(r===m.Overflow){if(!U(o.button))return;var i=g(),l=i.indexOf(U(o.button));w(i.splice(l+1).filter((function(e){var t;return!(null==(t=U(o.panel))?void 0:t.contains(e))})),f.First)===m.Error&&w(document.body,f.First)}}})),x("focus",(function(){var e;t&&o.popoverState.value===ue.Open&&U(o.panel)&&((null==(e=U(o.panel))?void 0:e.contains(document.activeElement))||o.closePopover())}),!0),{id:o.panelId,el:o.panel,handleKeyDown:function(e){var t,n;switch(e.key){case c.Escape:if(o.popoverState.value!==ue.Open)return;if(!U(o.panel))return;if(!(null==(t=U(o.panel))?void 0:t.contains(document.activeElement)))return;e.preventDefault(),o.closePopover(),null==(n=U(o.button))||n.focus()}}}}}),xe=n.defineComponent({name:"PopoverGroup",props:{as:{type:[Object,String],default:"div"}},render:function(){return u({props:o({},this.$props,{ref:"el"}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=n.ref(null),t=n.ref([]);function o(e){var n=t.value.indexOf(e);-1!==n&&t.value.splice(n,1)}return n.provide(me,{registerPopover:function(e){return t.value.push(e),function(){o(e)}},unregisterPopover:o,isFocusWithinPopoverGroup:function(){var n,o=document.activeElement;return!!(null==(n=U(e))?void 0:n.contains(o))||t.value.some((function(e){var t,n;return(null==(t=document.getElementById(e.buttonId))?void 0:t.contains(o))||(null==(n=document.getElementById(e.panelId))?void 0:n.contains(o))}))},closeOthers:function(e){for(var n,o=l(t.value);!(n=o()).done;){var r=n.value;r.buttonId!==e&&r.close()}}}),{el:e}}}),Oe=Symbol("GroupContext");function Ce(e){var t=n.inject(Oe,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <SwitchGroup /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,Ce),o}return t}var Ee=n.defineComponent({name:"SwitchGroup",props:{as:{type:[Object,String],default:"template"}},setup:function(e,t){var o=t.slots,r=t.attrs,i=n.ref(null),l=n.ref(null),a=n.ref(null);return n.provide(Oe,{switchRef:i,labelRef:l,descriptionRef:a}),function(){return u({props:e,slot:{},slots:o,attrs:r})}}}),De=n.defineComponent({name:"Switch",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"button"},modelValue:{type:[Object,Boolean],default:null},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},render:function(){var e=n.inject(Oe,null),t=this.$props,r=t.className,i=void 0===r?t.class:r,l=n.computed((function(){var t;return null==(t=U(null==e?void 0:e.labelRef))?void 0:t.id})),a=n.computed((function(){var t;return null==(t=U(null==e?void 0:e.descriptionRef))?void 0:t.id})),s={checked:this.$props.modelValue},c={id:this.id,ref:null===e?void 0:e.switchRef,role:"switch",tabIndex:0,class:J(i,s),"aria-checked":this.$props.modelValue,"aria-labelledby":l.value,"aria-describedby":a.value,onClick:this.handleClick,onKeyup:this.handleKeyUp,onKeypress:this.handleKeyPress};return"button"===this.$props.as&&Object.assign(c,{type:"button"}),u({props:o({},this.$props,c),slot:s,attrs:this.$attrs,slots:this.$slots})},setup:function(e,t){var o=t.emit,r=n.inject(Oe,null);function i(){o("update:modelValue",!e.modelValue)}return{id:"headlessui-switch-"+v(),el:null==r?void 0:r.switchRef,handleClick:function(e){e.preventDefault(),i()},handleKeyUp:function(e){e.key!==c.Tab&&e.preventDefault(),e.key===c.Space&&i()},handleKeyPress:function(e){e.preventDefault()}}}}),Ie=n.defineComponent({name:"SwitchLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){return u({props:o({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=Ce("SwitchLabel");return{id:"headlessui-switch-label-"+v(),el:e.labelRef,handleClick:function(){var t=U(e.switchRef);null==t||t.click(),null==t||t.focus({preventScroll:!0})}}}}),ke=n.defineComponent({name:"SwitchDescription",props:{as:{type:[Object,String],default:"p"}},render:function(){return u({props:o({},this.$props,{id:this.id,ref:"el"}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=Ce("SwitchDescription");return{id:"headlessui-switch-description-"+v(),el:e.descriptionRef}}});exports.Alert=d,exports.Dialog=B,exports.DialogDescription=K,exports.DialogOverlay=M,exports.DialogTitle=N,exports.Disclosure=H,exports.DisclosureButton=z,exports.DisclosurePanel=Y,exports.FocusTrap=_,exports.Listbox=te,exports.ListboxButton=oe,exports.ListboxLabel=ne,exports.ListboxOption=ie,exports.ListboxOptions=re,exports.Menu=se,exports.MenuButton=ce,exports.MenuItem=pe,exports.MenuItems=de,exports.Popover=ye,exports.PopoverButton=ge,exports.PopoverGroup=xe,exports.PopoverOverlay=Se,exports.PopoverPanel=we,exports.Portal=T,exports.PortalGroup=L,exports.Switch=De,exports.SwitchDescription=ke,exports.SwitchGroup=Ee,exports.SwitchLabel=Ie; | ||
//# sourceMappingURL=headlessui.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=e||self).headlessui={},e.Vue)}(this,(function(e,t){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function o(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function i(e,t){if(e in t){for(var n=t[e],o=arguments.length,r=new Array(o>2?o-2:0),l=2;l<o;l++)r[l-2]=arguments[l];return"function"==typeof n?n.apply(void 0,r):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,i),u}var l,u;function a(e){var t,r,a=e.visible,c=void 0===a||a,d=e.features,f=void 0===d?l.None:d,p=o(e,["visible","features"]);return c||f&l.Static&&p.props.static?s(p):f&l.RenderStrategy?i(null==(t=p.props.unmount)||t?u.Unmount:u.Hidden,((r={})[u.Unmount]=function(){return null},r[u.Hidden]=function(){return s(n({},p,{props:n({},p.props,{hidden:!0,style:{display:"none"}})}))},r)):s(p)}function s(e){var n=e.attrs,i=e.slots,l=e.slot,u=function(e,t){void 0===t&&(t=[]);for(var n,o=Object.assign({},e),i=function(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 r(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)?r(e,void 0):void 0}}(e))){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(t);!(n=i()).done;){var l=n.value;l in o&&delete o[l]}return o}(e.props,["unmount","static"]),a=u.as,s=o(u,["as"]),c=null==i.default?void 0:i.default(l);if("template"===a){if(Object.keys(s).length>0||"class"in n){var d=null!=c?c:[],f=d[0];if(d.slice(1).length>0)throw new Error('You should only render 1 child or use the `as="..."` prop');return t.cloneVNode(f,s)}return c}return t.h(a,s,c)}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(l||(l={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(u||(u={}));var c,d,f,p=0;function v(){return++p}function b(e,t){var n=t.resolveItems();if(n.length<=0)return null;var o=t.resolveActiveIndex(),r=null!=o?o:-1,i=function(){switch(e.focus){case d.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case d.Previous:var o=n.slice().reverse().findIndex((function(e,n,o){return!(-1!==r&&o.length-n-1>=r||t.resolveDisabled(e))}));return-1===o?o:n.length-1-o;case d.Next:return n.findIndex((function(e,n){return!(n<=r||t.resolveDisabled(e))}));case d.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case d.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case d.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?o:i}function m(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}function h(e){var t;return null==e||null==e.value?null:null!=(t=e.value.$el)?t:e.value}!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"}(c||(c={})),function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(d||(d={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(f||(f={}));var y=Symbol("MenuContext");function S(e){var n=t.inject(y,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <Menu /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,S),o}return n}var x,g=t.defineComponent({props:{as:{type:[Object,String],default:"template"}},setup:function(e,n){var o=n.slots,r=n.attrs,i=t.ref(f.Closed),l=t.ref(null),u=t.ref(null),s=t.ref([]),c=t.ref(""),p=t.ref(null),v={menuState:i,buttonRef:l,itemsRef:u,items:s,searchQuery:c,activeItemIndex:p,closeMenu:function(){i.value=f.Closed,p.value=null},openMenu:function(){return i.value=f.Open},goToItem:function(e,t){var n=b(e===d.Specific?{focus:d.Specific,id:t}:{focus:e},{resolveItems:function(){return s.value},resolveActiveIndex:function(){return p.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===c.value&&p.value===n||(c.value="",p.value=n)},search:function(e){c.value+=e;var t=s.value.findIndex((function(e){return e.dataRef.textValue.startsWith(c.value)&&!e.dataRef.disabled}));-1!==t&&t!==p.value&&(p.value=t)},clearSearch:function(){c.value=""},registerItem:function(e,t){s.value.push({id:e,dataRef:t})},unregisterItem:function(e){var t=s.value.slice(),n=null!==p.value?t[p.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),s.value=t,p.value=o===p.value||null===n?null:t.indexOf(n)}};return t.onMounted((function(){function e(e){var t,n,o,r=e.target,a=document.activeElement;i.value===f.Open&&((null==(t=h(l))?void 0:t.contains(r))||((null==(n=h(u))?void 0:n.contains(r))||v.closeMenu(),a!==document.body&&(null==a?void 0:a.contains(r))||e.defaultPrevented||null==(o=h(l))||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),t.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),t.provide(y,v),function(){return a({props:e,slot:{open:i.value===f.Open},slots:o,attrs:r})}}}),w=t.defineComponent({props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=S("MenuButton"),o={open:t.menuState.value===f.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=h(t.itemsRef))?void 0:e.id,"aria-expanded":t.menuState.value===f.Open||void 0,onKeydown:this.handleKeyDown,onClick:this.handleClick};return a({props:n({},this.$props,r),slot:o,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var n=S("MenuButton");return{id:"headlessui-menu-button-"+v(),el:n.buttonRef,handleKeyDown:function(e){switch(e.key){case c.Space:case c.Enter:case c.ArrowDown:e.preventDefault(),n.openMenu(),t.nextTick((function(){var e;null==(e=h(n.itemsRef))||e.focus({preventScroll:!0}),n.goToItem(d.First)}));break;case c.ArrowUp:e.preventDefault(),n.openMenu(),t.nextTick((function(){var e;null==(e=h(n.itemsRef))||e.focus({preventScroll:!0}),n.goToItem(d.Last)}))}},handleClick:function(o){var r;e.disabled||(n.menuState.value===f.Open?(n.closeMenu(),t.nextTick((function(){var e;return null==(e=h(n.buttonRef))?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),n.openMenu(),r=function(){var e;return null==(e=h(n.itemsRef))?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),O=t.defineComponent({props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var e,t,o=S("MenuItems"),r={open:o.menuState.value===f.Open},i={"aria-activedescendant":null===o.activeItemIndex.value||null==(e=o.items.value[o.activeItemIndex.value])?void 0:e.id,"aria-labelledby":null==(t=h(o.buttonRef))?void 0:t.id,id:this.id,onKeydown:this.handleKeyDown,role:"menu",tabIndex:0,ref:"el"};return a({props:n({},this.$props,i),slot:r,attrs:this.$attrs,slots:this.$slots,features:l.RenderStrategy|l.Static,visible:r.open})},setup:function(){var e=S("MenuItems"),n="headlessui-menu-items-"+v(),o=t.ref(null);return t.watchEffect((function(){var t=h(e.itemsRef);if(t&&e.menuState.value===f.Open)for(var n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});n.nextNode();)n.currentNode.setAttribute("role","none")})),{id:n,el:e.itemsRef,handleKeyDown:function(n){switch(o.value&&clearTimeout(o.value),n.key){case c.Space:if(""!==e.searchQuery.value)return n.preventDefault(),e.search(n.key);case c.Enter:var r;n.preventDefault(),null!==e.activeItemIndex.value&&(null==(r=document.getElementById(e.items.value[e.activeItemIndex.value].id))||r.click()),e.closeMenu(),t.nextTick((function(){var t;return null==(t=h(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case c.ArrowDown:return n.preventDefault(),e.goToItem(d.Next);case c.ArrowUp:return n.preventDefault(),e.goToItem(d.Previous);case c.Home:case c.PageUp:return n.preventDefault(),e.goToItem(d.First);case c.End:case c.PageDown:return n.preventDefault(),e.goToItem(d.Last);case c.Escape:n.preventDefault(),e.closeMenu(),t.nextTick((function(){var t;return null==(t=h(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case c.Tab:return n.preventDefault();default:1===n.key.length&&(e.search(n.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),I=t.defineComponent({props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,o){var r=o.slots,i=o.attrs,l=S("MenuItem"),u="headlessui-menu-item-"+v(),s=e.disabled,c=e.className,p=void 0===c?e.class:c,b=t.computed((function(){return null!==l.activeItemIndex.value&&l.items.value[l.activeItemIndex.value].id===u})),y=t.ref({disabled:s,textValue:""});function x(e){if(s)return e.preventDefault();l.closeMenu(),t.nextTick((function(){var e;return null==(e=h(l.buttonRef))?void 0:e.focus({preventScroll:!0})}))}function g(){if(s)return l.goToItem(d.Nothing);l.goToItem(d.Specific,u)}function w(){s||b.value||l.goToItem(d.Specific,u)}function O(){s||b.value&&l.goToItem(d.Nothing)}return t.onMounted((function(){var e,t,n=null==(e=document.getElementById(u))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(y.value.textValue=n)})),t.onMounted((function(){return l.registerItem(u,y)})),t.onUnmounted((function(){return l.unregisterItem(u)})),t.watchEffect((function(){l.menuState.value===f.Open&&b.value&&t.nextTick((function(){var e;return null==(e=document.getElementById(u))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:b.value,disabled:s},o={id:u,role:"menuitem",tabIndex:-1,class:m(p,t),"aria-disabled":!0===s||void 0,onClick:x,onFocus:g,onPointermove:w,onMousemove:w,onPointerleave:O,onMouseleave:O};return a({props:n({},e,o),slot:t,attrs:i,slots:r})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(x||(x={}));var k=Symbol("ListboxContext");function R(e){var n=t.inject(k,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <Listbox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,R),o}return n}var T=t.defineComponent({name:"Listbox",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},modelValue:{type:[Object,String,Number,Boolean],default:null}},setup:function(e,n){var r=n.slots,i=n.attrs,l=n.emit,u=e.disabled,s=o(e,["modelValue","disabled"]),c=t.ref(x.Closed),f=t.ref(null),p=t.ref(null),v=t.ref(null),m=t.ref([]),y=t.ref(""),S=t.ref(null),g=t.computed((function(){return e.modelValue})),w={listboxState:c,value:g,labelRef:f,buttonRef:p,optionsRef:v,disabled:u,options:m,searchQuery:y,activeOptionIndex:S,closeListbox:function(){u||c.value!==x.Closed&&(c.value=x.Closed,S.value=null)},openListbox:function(){u||c.value!==x.Open&&(c.value=x.Open)},goToOption:function(e,t){if(!u&&c.value!==x.Closed){var n=b(e===d.Specific?{focus:d.Specific,id:t}:{focus:e},{resolveItems:function(){return m.value},resolveActiveIndex:function(){return S.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===y.value&&S.value===n||(y.value="",S.value=n)}},search:function(e){if(!u&&c.value!==x.Closed){y.value+=e;var t=m.value.findIndex((function(e){return!e.dataRef.disabled&&e.dataRef.textValue.startsWith(y.value)}));-1!==t&&t!==S.value&&(S.value=t)}},clearSearch:function(){u||c.value!==x.Closed&&""!==y.value&&(y.value="")},registerOption:function(e,t){m.value.push({id:e,dataRef:t})},unregisterOption:function(e){var t=m.value.slice(),n=null!==S.value?t[S.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),m.value=t,S.value=o===S.value||null===n?null:t.indexOf(n)},select:function(e){u||l("update:modelValue",e)}};return t.onMounted((function(){function e(e){var t,n,o,r=e.target,i=document.activeElement;c.value===x.Open&&((null==(t=h(p))?void 0:t.contains(r))||((null==(n=h(v))?void 0:n.contains(r))||w.closeListbox(),i!==document.body&&(null==i?void 0:i.contains(r))||e.defaultPrevented||null==(o=h(p))||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),t.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),t.provide(k,w),function(){return a({props:s,slot:{open:c.value===x.Open,disabled:u},slots:r,attrs:i})}}}),D=t.defineComponent({name:"ListboxLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){var e=R("ListboxLabel"),t={open:e.listboxState.value===x.Open,disabled:e.disabled};return a({props:n({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:t,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=R("ListboxLabel");return{id:"headlessui-listbox-label-"+v(),el:e.labelRef,handleClick:function(){var t;null==(t=h(e.buttonRef))||t.focus({preventScroll:!0})}}}}),C=t.defineComponent({name:"ListboxButton",props:{as:{type:[Object,String],default:"button"}},render:function(){var e,t,o=R("ListboxButton"),r={open:o.listboxState.value===x.Open,disabled:o.disabled},i={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=h(o.optionsRef))?void 0:e.id,"aria-expanded":o.listboxState.value===x.Open||void 0,"aria-labelledby":o.labelRef.value?[null==(t=h(o.labelRef))?void 0:t.id,this.id].join(" "):void 0,disabled:o.disabled,onKeydown:this.handleKeyDown,onClick:this.handleClick};return a({props:n({},this.$props,i),slot:r,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=R("ListboxButton");return{id:"headlessui-listbox-button-"+v(),el:e.buttonRef,handleKeyDown:function(n){switch(n.key){case c.Space:case c.Enter:case c.ArrowDown:n.preventDefault(),e.openListbox(),t.nextTick((function(){var t;null==(t=h(e.optionsRef))||t.focus({preventScroll:!0}),e.value.value||e.goToOption(d.First)}));break;case c.ArrowUp:n.preventDefault(),e.openListbox(),t.nextTick((function(){var t;null==(t=h(e.optionsRef))||t.focus({preventScroll:!0}),e.value.value||e.goToOption(d.Last)}))}},handleClick:function(n){var o;e.disabled||(e.listboxState.value===x.Open?(e.closeListbox(),t.nextTick((function(){var t;return null==(t=h(e.buttonRef))?void 0:t.focus({preventScroll:!0})}))):(n.preventDefault(),e.openListbox(),o=function(){var t;return null==(t=h(e.optionsRef))?void 0:t.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(o)}))))}}}}),E=t.defineComponent({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var e,t,o,r,i=R("ListboxOptions"),u={open:i.listboxState.value===x.Open},s={"aria-activedescendant":null===i.activeOptionIndex.value||null==(e=i.options.value[i.activeOptionIndex.value])?void 0:e.id,"aria-labelledby":null!=(t=null==(o=h(i.labelRef))?void 0:o.id)?t:null==(r=h(i.buttonRef))?void 0:r.id,id:this.id,onKeydown:this.handleKeyDown,role:"listbox",tabIndex:0,ref:"el"};return a({props:n({},this.$props,s),slot:u,attrs:this.$attrs,slots:this.$slots,features:l.RenderStrategy|l.Static,visible:u.open})},setup:function(){var e=R("ListboxOptions"),n="headlessui-listbox-options-"+v(),o=t.ref(null);return{id:n,el:e.optionsRef,handleKeyDown:function(n){switch(o.value&&clearTimeout(o.value),n.key){case c.Space:if(""!==e.searchQuery.value)return n.preventDefault(),e.search(n.key);case c.Enter:n.preventDefault(),null!==e.activeOptionIndex.value&&e.select(e.options.value[e.activeOptionIndex.value].dataRef.value),e.closeListbox(),t.nextTick((function(){var t;return null==(t=h(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case c.ArrowDown:return n.preventDefault(),e.goToOption(d.Next);case c.ArrowUp:return n.preventDefault(),e.goToOption(d.Previous);case c.Home:case c.PageUp:return n.preventDefault(),e.goToOption(d.First);case c.End:case c.PageDown:return n.preventDefault(),e.goToOption(d.Last);case c.Escape:n.preventDefault(),e.closeListbox(),t.nextTick((function(){var t;return null==(t=h(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case c.Tab:return n.preventDefault();default:1===n.key.length&&(e.search(n.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),L=t.defineComponent({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String],default:null},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,o){var r=o.slots,i=o.attrs,l=R("ListboxOption"),u="headlessui-listbox-option-"+v(),s=e.disabled,c=e.className,f=void 0===c?e.class:c,p=e.value,b=t.computed((function(){return null!==l.activeOptionIndex.value&&l.options.value[l.activeOptionIndex.value].id===u})),y=t.computed((function(){return t.toRaw(l.value.value)===t.toRaw(p)})),S=t.ref({disabled:s,value:p,textValue:""});function g(e){if(s)return e.preventDefault();l.select(p),l.closeListbox(),t.nextTick((function(){var e;return null==(e=h(l.buttonRef))?void 0:e.focus({preventScroll:!0})}))}function w(){if(s)return l.goToOption(d.Nothing);l.goToOption(d.Specific,u)}function O(){s||b.value||l.goToOption(d.Specific,u)}function I(){s||b.value&&l.goToOption(d.Nothing)}return t.onMounted((function(){var e,t,n=null==(e=document.getElementById(u))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(S.value.textValue=n)})),t.onMounted((function(){return l.registerOption(u,S)})),t.onUnmounted((function(){return l.unregisterOption(u)})),t.onMounted((function(){t.watch([l.listboxState,y],(function(){var e;l.listboxState.value===x.Open&&y.value&&(l.goToOption(d.Specific,u),null==(e=document.getElementById(u))||null==e.focus||e.focus())}),{immediate:!0})})),t.watchEffect((function(){l.listboxState.value===x.Open&&b.value&&t.nextTick((function(){var e;return null==(e=document.getElementById(u))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:b.value,selected:y.value,disabled:s},o={id:u,role:"option",tabIndex:-1,class:m(f,t),"aria-disabled":!0===s||void 0,"aria-selected":!0===y.value?y.value:void 0,onClick:g,onFocus:w,onPointermove:O,onMousemove:O,onPointerleave:I,onMouseleave:I};return a({props:n({},e,o),slot:t,attrs:i,slots:r})}}}),j=Symbol("GroupContext");function M(e){var n=t.inject(j,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <SwitchGroup /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,M),o}return n}var N=t.defineComponent({name:"SwitchGroup",props:{as:{type:[Object,String],default:"template"}},setup:function(e,n){var o=n.slots,r=n.attrs,i=t.ref(null),l=t.ref(null),u=t.ref(null);return t.provide(j,{switchRef:i,labelRef:l,descriptionRef:u}),function(){return a({props:e,slot:{},slots:o,attrs:r})}}}),A=t.defineComponent({name:"Switch",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"button"},modelValue:{type:[Object,Boolean],default:null},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},render:function(){var e=t.inject(j,null),o=this.$props,r=o.className,i=void 0===r?o.class:r,l=t.computed((function(){var t;return null==(t=h(null==e?void 0:e.labelRef))?void 0:t.id})),u=t.computed((function(){var t;return null==(t=h(null==e?void 0:e.descriptionRef))?void 0:t.id})),s={checked:this.$props.modelValue},c={id:this.id,ref:null===e?void 0:e.switchRef,role:"switch",tabIndex:0,class:m(i,s),"aria-checked":this.$props.modelValue,"aria-labelledby":l.value,"aria-describedby":u.value,onClick:this.handleClick,onKeyup:this.handleKeyUp,onKeypress:this.handleKeyPress};return"button"===this.$props.as&&Object.assign(c,{type:"button"}),a({props:n({},this.$props,c),slot:s,attrs:this.$attrs,slots:this.$slots})},setup:function(e,n){var o=n.emit,r=t.inject(j,null);function i(){o("update:modelValue",!e.modelValue)}return{id:"headlessui-switch-"+v(),el:null==r?void 0:r.switchRef,handleClick:function(e){e.preventDefault(),i()},handleKeyUp:function(e){e.key!==c.Tab&&e.preventDefault(),e.key===c.Space&&i()},handleKeyPress:function(e){e.preventDefault()}}}}),$=t.defineComponent({name:"SwitchLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){return a({props:n({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=M("SwitchLabel");return{id:"headlessui-switch-label-"+v(),el:e.labelRef,handleClick:function(){var t=h(e.switchRef);null==t||t.click(),null==t||t.focus({preventScroll:!0})}}}}),F=t.defineComponent({name:"SwitchDescription",props:{as:{type:[Object,String],default:"p"}},render:function(){return a({props:n({},this.$props,{id:this.id,ref:"el"}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=M("SwitchDescription");return{id:"headlessui-switch-description-"+v(),el:e.descriptionRef}}});e.Listbox=T,e.ListboxButton=C,e.ListboxLabel=D,e.ListboxOption=L,e.ListboxOptions=E,e.Menu=g,e.MenuButton=w,e.MenuItem=I,e.MenuItems=O,e.Switch=A,e.SwitchDescription=F,e.SwitchGroup=N,e.SwitchLabel=$,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=e||self).headlessui={},e.Vue)}(this,(function(e,t){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function o(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function i(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 r(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)?r(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function l(e,t){if(e in t){for(var n=t[e],o=arguments.length,r=new Array(o>2?o-2:0),i=2;i<o;i++)r[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,r):n}var a=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(a,l),a}var a,u;function s(e){var t,r,i=e.visible,s=void 0===i||i,d=e.features,p=void 0===d?a.None:d,v=o(e,["visible","features"]);return s||p&a.Static&&v.props.static?c(v):p&a.RenderStrategy?l(null==(t=v.props.unmount)||t?u.Unmount:u.Hidden,((r={})[u.Unmount]=function(){return null},r[u.Hidden]=function(){return c(n({},v,{props:n({},v.props,{hidden:!0,style:{display:"none"}})}))},r)):c(v)}function c(e){var n=e.attrs,r=e.slots,l=e.slot,a=function(e,t){void 0===t&&(t=[]);for(var n,o=Object.assign({},e),r=i(t);!(n=r()).done;){var l=n.value;l in o&&delete o[l]}return o}(e.props,["unmount","static"]),u=a.as,s=o(a,["as"]),c=null==r.default?void 0:r.default(l);if("template"===u){if(Object.keys(s).length>0||"class"in n){var d=null!=c?c:[],p=d[0];if(d.slice(1).length>0)throw new Error('You should only render 1 child or use the `as="..."` prop');return t.cloneVNode(p,s)}return c}return t.h(u,s,c)}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(a||(a={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(u||(u={}));var d,p=t.defineComponent({name:"Alert",props:{as:{type:[Object,String],default:"div"},importance:{type:String,default:"polite"}},setup:function(e,t){var r=t.slots,i=t.attrs,a=e.importance,u=void 0===a?"polite":a,c=o(e,["importance"]),d={importance:u},p=l(u,{polite:function(){return{role:"status"}},assertive:function(){return{role:"alert"}}});return function(){return s({props:n({},c,p),slot:d,slots:r,attrs:i})}}});!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"}(d||(d={}));var v=0;function f(){return++v}var m,h,b,y,g=["[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 S(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(g))}function w(e){null==e||e.focus({preventScroll:!0})}function O(e,t){var n=Array.isArray(e)?e:S(e),o=document.activeElement,r=function(){if(t&(m.First|m.Next))return b.Next;if(t&(m.Previous|m.Last))return b.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),i=function(){if(t&m.First)return 0;if(t&m.Previous)return Math.max(0,n.indexOf(o))-1;if(t&m.Next)return Math.max(0,n.indexOf(o))+1;if(t&m.Last)return n.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),l=t&m.NoScroll?{preventScroll:!0}:{},a=0,u=n.length,s=void 0;do{var c;if(a>=u||a+u<=0)return h.Error;var d=i+a;if(t&m.WrapAround)d=(d+u)%u;else{if(d<0)return h.Underflow;if(d>=u)return h.Overflow}null==(c=s=n[d])||c.focus(l),a+=r}while(s!==document.activeElement);return h.Success}function x(e,n,o){window.addEventListener(e,n,o),t.onUnmounted((function(){return window.removeEventListener(e,n,o)}))}function C(e,t){for(var n,o=i(e);!(n=o()).done;)if(n.value.contains(t))return!0;return!1}function E(e,n,o){void 0===n&&(n=!0),void 0===o&&(o={});var r=t.ref("undefined"!=typeof window?document.activeElement:null),l=t.ref(null);t.watchEffect((function(t){var a,u;if(n&&1===e.value.size){var s,c=document.activeElement;if(null==(a=o.initialFocus)?void 0:a.value){if((null==(s=o.initialFocus)?void 0:s.value)===c)return}else if(C(e.value,c))return;if(r.value=c,null==(u=o.initialFocus)?void 0:u.value)w(o.initialFocus.value);else{for(var d,p=!1,v=i(e.value);!(d=v()).done;)if(O(d.value,m.First)===h.Success){p=!0;break}if(!p)throw new Error("There are no focusable elements inside the <FocusTrap />")}l.value=document.activeElement,t((function(){w(r.value),r.value=null,l.value=null}))}})),x("keydown",(function(t){if(n&&t.key===d.Tab&&document.activeElement&&1===e.value.size){t.preventDefault();for(var o,r=i(e.value);!(o=r()).done;)if(O(o.value,(t.shiftKey?m.Previous:m.Next)|m.WrapAround)===h.Success){l.value=document.activeElement;break}}})),x("focus",(function(t){if(n&&1===e.value.size){var o=l.value;if(o){var r=t.target;r&&r instanceof HTMLElement?C(e.value,r)?(l.value=r,w(r)):(t.preventDefault(),t.stopPropagation(),w(o)):w(l.value)}}}))}!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"}(m||(m={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(h||(h={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(b||(b={})),function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"}(y||(y={}));var D=new Set,I=new Map;function k(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function P(e){var t=I.get(e);t&&(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}var T,R=t.defineComponent({name:"Portal",props:{as:{type:[Object,String],default:"template"}},setup:function(e,n){var o=n.slots,r=n.attrs,i=t.inject(L,null),l=t.ref(null===i?function(){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)}():i.resolveTarget());return t.watchEffect((function(){null!==i&&(l.value=i.resolveTarget())})),t.onUnmounted((function(){var e,t=l.value;t&&t!==(null==i?void 0:i.resolveTarget())&&t.children.length<=0&&(null==(e=t.parentElement)||e.removeChild(t))})),function(){return null===l.value?null:t.h(t.Teleport,{to:l.value},[s({props:e,slot:{},attrs:r,slots:o})])}}}),L=Symbol("PortalGroupContext"),F=t.defineComponent({name:"PortalGroup",props:{as:{type:[Object,String],default:"template"},target:{type:Object,default:null}},setup:function(e,n){var r=n.attrs,i=n.slots,l=t.reactive({resolveTarget:function(){return e.target}});return t.provide(L,l),function(){return s({props:o(e,["target"]),slot:{},attrs:r,slots:i})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(T||(T={}));var $=Symbol("DialogContext");function j(e){var n=t.inject($,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <Dialog /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,j),o}return n}var A,B="DC8F892D-2EBD-447C-A4C8-A03058436FF4",M=t.defineComponent({name:"Dialog",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},open:{type:Boolean,default:B},onClose:{type:Function,default:B},initialFocus:{type:Object,default:null}},render:function(){var e=this,r={ref:"el",id:this.id,role:"dialog","aria-modal":this.dialogState===T.Open||void 0,"aria-labelledby":this.titleId,"aria-describedby":this.descriptionId},i=this.$props,l=i.open,u=o(i,["open","onClose","initialFocus"]);return t.h(R,{},(function(){return[t.h(F,{target:e.dialogRef},(function(){return[s({props:n({},u,r),slot:{open:e.dialogState===T.Open},attrs:e.$attrs,slots:e.$slots,visible:l,features:a.RenderStrategy|a.Static})]}))]}))},setup:function(e){var n=t.ref(new Set),o=e.open!==B,r=e.onClose!==B;if(!o&&!r)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!o)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!r)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof e.open)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+(e.open===B?void 0:e.open));if("function"!=typeof e.onClose)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+(e.onClose===B?void 0:e.onClose));var l=t.computed((function(){return e.open?T.Open:T.Closed})),a=t.ref(null),u=t.computed((function(){return!!e.static||l.value===T.Open})),s="headlessui-dialog-"+f();E(n,u.value,{initialFocus:e.initialFocus}),function(e,n){void 0===n&&(n=t.ref(!0)),t.watchEffect((function(){if(n.value&&e.value){var t=e.value;D.add(t);for(var o,r=i(I.keys());!(o=r()).done;){var l=o.value;l.contains(t)&&(P(l),I.delete(l))}return document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var t,n=i(D);!(t=n()).done;)if(e.contains(t.value))return;1===D.size&&(I.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),k(e))}})),function(){if(D.delete(t),D.size>0)document.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!I.has(e)){for(var t,n=i(D);!(t=n()).done;)if(e.contains(t.value))return;I.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),k(e)}}));else for(var e,n=i(I.keys());!(e=n()).done;){var o=e.value;P(o),I.delete(o)}}}}))}(a,u);var c=t.ref(null),p=t.ref(null),v={titleId:c,descriptionId:p,setTitleId:function(e){c.value!==e&&(c.value=e)},setDescriptionId:function(e){p.value!==e&&(p.value=e)},close:function(){e.onClose(!1)}};return t.provide($,v),x("mousedown",(function(e){l.value===T.Open&&1===n.value.size&&(C(n.value,e.target)||v.close())})),x("keydown",(function(e){e.key===d.Escape&&l.value===T.Open&&(n.value.size>1||v.close())})),t.watchEffect((function(e){if(l.value===T.Open){var t=document.documentElement.style.overflow,n=document.documentElement.style.paddingRight,o=window.innerWidth-document.documentElement.clientWidth;document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=o+"px",e((function(){document.documentElement.style.overflow=t,document.documentElement.style.paddingRight=n}))}})),t.watchEffect((function(e){if(l.value===T.Open&&a.value){var t=new IntersectionObserver((function(e){for(var t,n=i(e);!(t=n()).done;){var o=t.value;0===o.boundingClientRect.x&&0===o.boundingClientRect.y&&0===o.boundingClientRect.width&&0===o.boundingClientRect.height&&close()}}));t.observe(a.value),e((function(){return t.disconnect()}))}})),{id:s,el:a,dialogRef:a,dialogState:l,titleId:c,descriptionId:p}}}),N=t.defineComponent({name:"DialogOverlay",props:{as:{type:[Object,String],default:"div"}},render:function(){var e=j("DialogOverlay");return s({props:n({},this.$props,{ref:"el",id:this.id,"aria-hidden":!0,onClick:this.handleClick}),slot:{open:e.dialogState.value===T.Open},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=j("DialogOverlay");return{id:"headlessui-dialog-overlay-"+f(),handleClick:function(){e.close()}}}}),K=t.defineComponent({name:"DialogTitle",props:{as:{type:[Object,String],default:"h2"}},render:function(){var e=j("DialogTitle");return s({props:n({},this.$props,{id:this.id}),slot:{open:e.dialogState.value===T.Open},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=j("DialogTitle"),n="headlessui-dialog-title-"+f();return t.onMounted((function(){e.setTitleId(n),t.onUnmounted((function(){return e.setTitleId(null)}))})),{id:n}}}),U=t.defineComponent({name:"DialogDescription",props:{as:{type:[Object,String],default:"p"}},render:function(){var e=j("DialogDescription");return s({props:n({},this.$props,{id:this.id}),slot:{open:e.dialogState.value===T.Open},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=j("DialogDescription"),n="headlessui-dialog-description-"+f();return t.onMounted((function(){e.setDescriptionId(n),t.onUnmounted((function(){return e.setDescriptionId(null)}))})),{id:n}}});function V(e){var t;return null==e||null==e.value?null:null!=(t=e.value.$el)?t:e.value}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(A||(A={}));var q=Symbol("DisclosureContext");function W(e){var n=t.inject(q,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <Disclosure /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,W),o}return n}var G,H,z=t.defineComponent({name:"Disclosure",props:{as:{type:[Object,String],default:"template"}},setup:function(e,o){var r=o.slots,i=o.attrs,a=n({},e),u=t.ref(A.Closed),c=t.ref(null);return t.provide(q,{disclosureState:u,panelRef:c,toggleDisclosure:function(){var e;u.value=l(u.value,((e={})[A.Open]=A.Closed,e[A.Closed]=A.Open,e))}}),function(){return s({props:a,slot:{open:u.value===A.Open},slots:r,attrs:i})}}}),Y=t.defineComponent({name:"DisclosureButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1}},render:function(){var e=W("DisclosureButton"),t={open:e.disclosureState.value===A.Open};return s({props:n({},this.$props,{id:this.id,type:"button","aria-expanded":e.disclosureState.value===A.Open||void 0,"aria-controls":this.ariaControls,onClick:this.handleClick,onKeydown:this.handleKeyDown}),slot:t,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var n=W("DisclosureButton");return{id:"headlessui-disclosure-button-"+f(),ariaControls:t.computed((function(){var e,t;return null!=(e=null==(t=V(n.panelRef))?void 0:t.id)?e:void 0})),handleClick:function(){e.disabled||n.toggleDisclosure()},handleKeyDown:function(t){if(!e.disabled)switch(t.key){case d.Space:case d.Enter:t.preventDefault(),n.toggleDisclosure()}}}}}),_=t.defineComponent({name:"DisclosurePanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var e={open:W("DisclosurePanel").disclosureState.value===A.Open};return s({props:n({},this.$props,{id:this.id,ref:"el"}),slot:e,attrs:this.$attrs,slots:this.$slots,features:a.RenderStrategy|a.Static,visible:e.open})},setup:function(){var e=W("DisclosurePanel");return{id:"headlessui-disclosure-panel-"+f(),el:e.panelRef}}}),Q=t.defineComponent({name:"FocusTrap",props:{as:{type:[Object,String],default:"div"},initialFocus:{type:Object,default:null}},render:function(){return s({props:n({},o(this.$props,["initialFocus"]),{ref:"el"}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(e){var n=t.ref(new Set),o=t.ref(null);return t.onMounted((function(){o.value&&(n.value.add(o.value),E(n,!0,{initialFocus:e.initialFocus}))})),{el:o}}});function J(e,t){var n=t.resolveItems();if(n.length<=0)return null;var o=t.resolveActiveIndex(),r=null!=o?o:-1,i=function(){switch(e.focus){case G.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case G.Previous:var o=n.slice().reverse().findIndex((function(e,n,o){return!(-1!==r&&o.length-n-1>=r||t.resolveDisabled(e))}));return-1===o?o:n.length-1-o;case G.Next:return n.findIndex((function(e,n){return!(n<=r||t.resolveDisabled(e))}));case G.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case G.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case G.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?o:i}function X(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}!function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(G||(G={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(H||(H={}));var Z=Symbol("ListboxContext");function ee(e){var n=t.inject(Z,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <Listbox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,ee),o}return n}var te,ne=t.defineComponent({name:"Listbox",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},modelValue:{type:[Object,String,Number,Boolean],default:null}},setup:function(e,n){var r=n.slots,i=n.attrs,l=n.emit,a=e.disabled,u=o(e,["modelValue","disabled"]),c=t.ref(H.Closed),d=t.ref(null),p=t.ref(null),v=t.ref(null),f=t.ref([]),m=t.ref(""),h=t.ref(null),b=t.computed((function(){return e.modelValue})),y={listboxState:c,value:b,labelRef:d,buttonRef:p,optionsRef:v,disabled:a,options:f,searchQuery:m,activeOptionIndex:h,closeListbox:function(){a||c.value!==H.Closed&&(c.value=H.Closed,h.value=null)},openListbox:function(){a||c.value!==H.Open&&(c.value=H.Open)},goToOption:function(e,t){if(!a&&c.value!==H.Closed){var n=J(e===G.Specific?{focus:G.Specific,id:t}:{focus:e},{resolveItems:function(){return f.value},resolveActiveIndex:function(){return h.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===m.value&&h.value===n||(m.value="",h.value=n)}},search:function(e){if(!a&&c.value!==H.Closed){m.value+=e;var t=f.value.findIndex((function(e){return!e.dataRef.disabled&&e.dataRef.textValue.startsWith(m.value)}));-1!==t&&t!==h.value&&(h.value=t)}},clearSearch:function(){a||c.value!==H.Closed&&""!==m.value&&(m.value="")},registerOption:function(e,t){f.value.push({id:e,dataRef:t})},unregisterOption:function(e){var t=f.value.slice(),n=null!==h.value?t[h.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),f.value=t,h.value=o===h.value||null===n?null:t.indexOf(n)},select:function(e){a||l("update:modelValue",e)}};return t.onMounted((function(){function e(e){var t,n,o,r=e.target,i=document.activeElement;c.value===H.Open&&((null==(t=V(p))?void 0:t.contains(r))||((null==(n=V(v))?void 0:n.contains(r))||y.closeListbox(),i!==document.body&&(null==i?void 0:i.contains(r))||e.defaultPrevented||null==(o=V(p))||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),t.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),t.provide(Z,y),function(){return s({props:u,slot:{open:c.value===H.Open,disabled:a},slots:r,attrs:i})}}}),oe=t.defineComponent({name:"ListboxLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){var e=ee("ListboxLabel"),t={open:e.listboxState.value===H.Open,disabled:e.disabled};return s({props:n({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:t,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=ee("ListboxLabel");return{id:"headlessui-listbox-label-"+f(),el:e.labelRef,handleClick:function(){var t;null==(t=V(e.buttonRef))||t.focus({preventScroll:!0})}}}}),re=t.defineComponent({name:"ListboxButton",props:{as:{type:[Object,String],default:"button"}},render:function(){var e,t,o=ee("ListboxButton"),r={open:o.listboxState.value===H.Open,disabled:o.disabled},i={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=V(o.optionsRef))?void 0:e.id,"aria-expanded":o.listboxState.value===H.Open||void 0,"aria-labelledby":o.labelRef.value?[null==(t=V(o.labelRef))?void 0:t.id,this.id].join(" "):void 0,disabled:o.disabled,onKeydown:this.handleKeyDown,onClick:this.handleClick};return s({props:n({},this.$props,i),slot:r,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=ee("ListboxButton");return{id:"headlessui-listbox-button-"+f(),el:e.buttonRef,handleKeyDown:function(n){switch(n.key){case d.Space:case d.Enter:case d.ArrowDown:n.preventDefault(),e.openListbox(),t.nextTick((function(){var t;null==(t=V(e.optionsRef))||t.focus({preventScroll:!0}),e.value.value||e.goToOption(G.First)}));break;case d.ArrowUp:n.preventDefault(),e.openListbox(),t.nextTick((function(){var t;null==(t=V(e.optionsRef))||t.focus({preventScroll:!0}),e.value.value||e.goToOption(G.Last)}))}},handleClick:function(n){var o;e.disabled||(e.listboxState.value===H.Open?(e.closeListbox(),t.nextTick((function(){var t;return null==(t=V(e.buttonRef))?void 0:t.focus({preventScroll:!0})}))):(n.preventDefault(),e.openListbox(),o=function(){var t;return null==(t=V(e.optionsRef))?void 0:t.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(o)}))))}}}}),ie=t.defineComponent({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var e,t,o,r,i=ee("ListboxOptions"),l={open:i.listboxState.value===H.Open},u={"aria-activedescendant":null===i.activeOptionIndex.value||null==(e=i.options.value[i.activeOptionIndex.value])?void 0:e.id,"aria-labelledby":null!=(t=null==(o=V(i.labelRef))?void 0:o.id)?t:null==(r=V(i.buttonRef))?void 0:r.id,id:this.id,onKeydown:this.handleKeyDown,role:"listbox",tabIndex:0,ref:"el"};return s({props:n({},this.$props,u),slot:l,attrs:this.$attrs,slots:this.$slots,features:a.RenderStrategy|a.Static,visible:l.open})},setup:function(){var e=ee("ListboxOptions"),n="headlessui-listbox-options-"+f(),o=t.ref(null);return{id:n,el:e.optionsRef,handleKeyDown:function(n){switch(o.value&&clearTimeout(o.value),n.key){case d.Space:if(""!==e.searchQuery.value)return n.preventDefault(),e.search(n.key);case d.Enter:n.preventDefault(),null!==e.activeOptionIndex.value&&e.select(e.options.value[e.activeOptionIndex.value].dataRef.value),e.closeListbox(),t.nextTick((function(){var t;return null==(t=V(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case d.ArrowDown:return n.preventDefault(),e.goToOption(G.Next);case d.ArrowUp:return n.preventDefault(),e.goToOption(G.Previous);case d.Home:case d.PageUp:return n.preventDefault(),e.goToOption(G.First);case d.End:case d.PageDown:return n.preventDefault(),e.goToOption(G.Last);case d.Escape:n.preventDefault(),e.closeListbox(),t.nextTick((function(){var t;return null==(t=V(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case d.Tab:return n.preventDefault();default:1===n.key.length&&(e.search(n.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),le=t.defineComponent({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String],default:null},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,o){var r=o.slots,i=o.attrs,l=ee("ListboxOption"),a="headlessui-listbox-option-"+f(),u=e.disabled,c=e.className,d=void 0===c?e.class:c,p=e.value,v=t.computed((function(){return null!==l.activeOptionIndex.value&&l.options.value[l.activeOptionIndex.value].id===a})),m=t.computed((function(){return t.toRaw(l.value.value)===t.toRaw(p)})),h=t.ref({disabled:u,value:p,textValue:""});function b(e){if(u)return e.preventDefault();l.select(p),l.closeListbox(),t.nextTick((function(){var e;return null==(e=V(l.buttonRef))?void 0:e.focus({preventScroll:!0})}))}function y(){if(u)return l.goToOption(G.Nothing);l.goToOption(G.Specific,a)}function g(){u||v.value||l.goToOption(G.Specific,a)}function S(){u||v.value&&l.goToOption(G.Nothing)}return t.onMounted((function(){var e,t,n=null==(e=document.getElementById(a))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(h.value.textValue=n)})),t.onMounted((function(){return l.registerOption(a,h)})),t.onUnmounted((function(){return l.unregisterOption(a)})),t.onMounted((function(){t.watch([l.listboxState,m],(function(){var e;l.listboxState.value===H.Open&&m.value&&(l.goToOption(G.Specific,a),null==(e=document.getElementById(a))||null==e.focus||e.focus())}),{immediate:!0})})),t.watchEffect((function(){l.listboxState.value===H.Open&&v.value&&t.nextTick((function(){var e;return null==(e=document.getElementById(a))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:v.value,selected:m.value,disabled:u},o={id:a,role:"option",tabIndex:-1,class:X(d,t),"aria-disabled":!0===u||void 0,"aria-selected":!0===m.value?m.value:void 0,onClick:b,onFocus:y,onPointermove:g,onMousemove:g,onPointerleave:S,onMouseleave:S};return s({props:n({},e,o),slot:t,attrs:i,slots:r})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(te||(te={}));var ae=Symbol("MenuContext");function ue(e){var n=t.inject(ae,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <Menu /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,ue),o}return n}var se,ce=t.defineComponent({props:{as:{type:[Object,String],default:"template"}},setup:function(e,n){var o=n.slots,r=n.attrs,i=t.ref(te.Closed),l=t.ref(null),a=t.ref(null),u=t.ref([]),c=t.ref(""),d=t.ref(null),p={menuState:i,buttonRef:l,itemsRef:a,items:u,searchQuery:c,activeItemIndex:d,closeMenu:function(){i.value=te.Closed,d.value=null},openMenu:function(){return i.value=te.Open},goToItem:function(e,t){var n=J(e===G.Specific?{focus:G.Specific,id:t}:{focus:e},{resolveItems:function(){return u.value},resolveActiveIndex:function(){return d.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===c.value&&d.value===n||(c.value="",d.value=n)},search:function(e){c.value+=e;var t=u.value.findIndex((function(e){return e.dataRef.textValue.startsWith(c.value)&&!e.dataRef.disabled}));-1!==t&&t!==d.value&&(d.value=t)},clearSearch:function(){c.value=""},registerItem:function(e,t){u.value.push({id:e,dataRef:t})},unregisterItem:function(e){var t=u.value.slice(),n=null!==d.value?t[d.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),u.value=t,d.value=o===d.value||null===n?null:t.indexOf(n)}};return t.onMounted((function(){function e(e){var t,n,o,r=e.target,u=document.activeElement;i.value===te.Open&&((null==(t=V(l))?void 0:t.contains(r))||((null==(n=V(a))?void 0:n.contains(r))||p.closeMenu(),u!==document.body&&(null==u?void 0:u.contains(r))||e.defaultPrevented||null==(o=V(l))||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),t.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),t.provide(ae,p),function(){return s({props:e,slot:{open:i.value===te.Open},slots:o,attrs:r})}}}),de=t.defineComponent({props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=ue("MenuButton"),o={open:t.menuState.value===te.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=V(t.itemsRef))?void 0:e.id,"aria-expanded":t.menuState.value===te.Open||void 0,onKeydown:this.handleKeyDown,onClick:this.handleClick};return s({props:n({},this.$props,r),slot:o,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var n=ue("MenuButton");return{id:"headlessui-menu-button-"+f(),el:n.buttonRef,handleKeyDown:function(e){switch(e.key){case d.Space:case d.Enter:case d.ArrowDown:e.preventDefault(),n.openMenu(),t.nextTick((function(){var e;null==(e=V(n.itemsRef))||e.focus({preventScroll:!0}),n.goToItem(G.First)}));break;case d.ArrowUp:e.preventDefault(),n.openMenu(),t.nextTick((function(){var e;null==(e=V(n.itemsRef))||e.focus({preventScroll:!0}),n.goToItem(G.Last)}))}},handleClick:function(o){var r;e.disabled||(n.menuState.value===te.Open?(n.closeMenu(),t.nextTick((function(){var e;return null==(e=V(n.buttonRef))?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),n.openMenu(),r=function(){var e;return null==(e=V(n.itemsRef))?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),pe=t.defineComponent({props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var e,t,o=ue("MenuItems"),r={open:o.menuState.value===te.Open},i={"aria-activedescendant":null===o.activeItemIndex.value||null==(e=o.items.value[o.activeItemIndex.value])?void 0:e.id,"aria-labelledby":null==(t=V(o.buttonRef))?void 0:t.id,id:this.id,onKeydown:this.handleKeyDown,role:"menu",tabIndex:0,ref:"el"};return s({props:n({},this.$props,i),slot:r,attrs:this.$attrs,slots:this.$slots,features:a.RenderStrategy|a.Static,visible:r.open})},setup:function(){var e=ue("MenuItems"),n="headlessui-menu-items-"+f(),o=t.ref(null);return t.watchEffect((function(){var t=V(e.itemsRef);if(t&&e.menuState.value===te.Open)for(var n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});n.nextNode();)n.currentNode.setAttribute("role","none")})),{id:n,el:e.itemsRef,handleKeyDown:function(n){switch(o.value&&clearTimeout(o.value),n.key){case d.Space:if(""!==e.searchQuery.value)return n.preventDefault(),e.search(n.key);case d.Enter:var r;n.preventDefault(),null!==e.activeItemIndex.value&&(null==(r=document.getElementById(e.items.value[e.activeItemIndex.value].id))||r.click()),e.closeMenu(),t.nextTick((function(){var t;return null==(t=V(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case d.ArrowDown:return n.preventDefault(),e.goToItem(G.Next);case d.ArrowUp:return n.preventDefault(),e.goToItem(G.Previous);case d.Home:case d.PageUp:return n.preventDefault(),e.goToItem(G.First);case d.End:case d.PageDown:return n.preventDefault(),e.goToItem(G.Last);case d.Escape:n.preventDefault(),e.closeMenu(),t.nextTick((function(){var t;return null==(t=V(e.buttonRef))?void 0:t.focus({preventScroll:!0})}));break;case d.Tab:return n.preventDefault();default:1===n.key.length&&(e.search(n.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),ve=t.defineComponent({props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,o){var r=o.slots,i=o.attrs,l=ue("MenuItem"),a="headlessui-menu-item-"+f(),u=e.disabled,c=e.className,d=void 0===c?e.class:c,p=t.computed((function(){return null!==l.activeItemIndex.value&&l.items.value[l.activeItemIndex.value].id===a})),v=t.ref({disabled:u,textValue:""});function m(e){if(u)return e.preventDefault();l.closeMenu(),t.nextTick((function(){var e;return null==(e=V(l.buttonRef))?void 0:e.focus({preventScroll:!0})}))}function h(){if(u)return l.goToItem(G.Nothing);l.goToItem(G.Specific,a)}function b(){u||p.value||l.goToItem(G.Specific,a)}function y(){u||p.value&&l.goToItem(G.Nothing)}return t.onMounted((function(){var e,t,n=null==(e=document.getElementById(a))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(v.value.textValue=n)})),t.onMounted((function(){return l.registerItem(a,v)})),t.onUnmounted((function(){return l.unregisterItem(a)})),t.watchEffect((function(){l.menuState.value===te.Open&&p.value&&t.nextTick((function(){var e;return null==(e=document.getElementById(a))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:p.value,disabled:u},o={id:a,role:"menuitem",tabIndex:-1,class:X(d,t),"aria-disabled":!0===u||void 0,onClick:m,onFocus:h,onPointermove:b,onMousemove:b,onPointerleave:y,onMouseleave:y};return s({props:n({},e,o),slot:t,attrs:i,slots:r})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(se||(se={}));var fe=Symbol("PopoverContext");function me(e){var n=t.inject(fe,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <"+ge.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,me),o}return n}var he=Symbol("PopoverGroupContext");function be(){return t.inject(he,null)}var ye=Symbol("PopoverPanelContext"),ge=t.defineComponent({name:"Popover",props:{as:{type:[Object,String],default:"div"}},setup:function(e,o){var r=o.slots,i=o.attrs,a=n({},e),u="headlessui-popover-button-"+f(),c="headlessui-popover-panel-"+f(),d=t.ref(se.Closed),p=t.ref(null),v=t.ref(null),m={popoverState:d,buttonId:u,panelId:c,panel:v,button:p,togglePopover:function(){var e;d.value=l(d.value,((e={})[se.Open]=se.Closed,e[se.Closed]=se.Open,e))},closePopover:function(){d.value!==se.Closed&&(d.value=se.Closed)}};t.provide(fe,m);var h={buttonId:u,panelId:c,close:function(){m.closePopover()}},b=be(),S=null==b?void 0:b.registerPopover;return t.watchEffect((function(){return null==S?void 0:S(h)})),x("focus",(function(){var e,t,n;d.value===se.Open&&((null!=(e=null==b?void 0:b.isFocusWithinPopoverGroup())?e:(null==(t=V(p))?void 0:t.contains(document.activeElement))||(null==(n=V(v))?void 0:n.contains(document.activeElement)))||p&&v&&m.closePopover())}),!0),x("mousedown",(function(e){var t,n,o,r,i,a,u=e.target;d.value===se.Open&&((null==(t=V(p))?void 0:t.contains(u))||(null==(n=V(v))?void 0:n.contains(u))||(m.closePopover(),void 0===(i=y.Loose)&&(i=y.Strict),(r=u)!==document.body&&l(i,((a={})[y.Strict]=function(){return r.matches(g)},a[y.Loose]=function(){for(var e=r;null!==e;){if(e.matches(g))return!0;e=e.parentElement}return!1},a))||(e.preventDefault(),null==(o=V(p))||o.focus())))})),function(){return s({props:a,slot:{open:d.value===se.Open},slots:r,attrs:i})}}}),Se=t.defineComponent({name:"PopoverButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1}},render:function(){var e=me("PopoverButton"),t={open:e.popoverState.value===se.Open},o=this.isWithinPanel?{type:"button",onKeydown:this.handleKeyDown,onClick:this.handleClick}:{ref:"el",id:e.buttonId,type:"button","aria-expanded":e.popoverState.value===se.Open||void 0,"aria-controls":V(e.panel)?e.panelId:void 0,onKeydown:this.handleKeyDown,onKeyup:this.handleKeyUp,onClick:this.handleClick};return s({props:n({},this.$props,o),slot:t,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var n=me("PopoverButton"),o=be(),r=null==o?void 0:o.closeOthers,i=t.inject(ye,null),l=null!==i&&i===n.panelId,a=t.ref(null),u=t.ref("undefined"==typeof window?null:document.activeElement);return x("focus",(function(){u.value=a.value,a.value=document.activeElement}),!0),{isWithinPanel:l,el:l?null:n.button,handleKeyDown:function(e){var t,o;if(l){if(n.popoverState.value===se.Closed)return;switch(e.key){case d.Space:case d.Enter:e.preventDefault(),e.stopPropagation(),n.closePopover(),null==(t=V(n.button))||t.focus()}}else switch(e.key){case d.Space:case d.Enter:e.preventDefault(),e.stopPropagation(),n.popoverState.value===se.Closed&&(null==r||r(n.buttonId)),n.togglePopover();break;case d.Escape:if(n.popoverState.value!==se.Open)return null==r?void 0:r(n.buttonId);if(!V(n.button))return;if(!(null==(o=V(n.button))?void 0:o.contains(document.activeElement)))return;n.closePopover();break;case d.Tab:if(n.popoverState.value!==se.Open)return;if(!n.panel)return;if(!n.button)return;if(e.shiftKey){var i,a;if(!u.value)return;if(null==(i=V(n.button))?void 0:i.contains(u.value))return;if(null==(a=V(n.panel))?void 0:a.contains(u.value))return;var s=S(),c=s.indexOf(u.value);if(s.indexOf(V(n.button))>c)return;e.preventDefault(),e.stopPropagation(),O(V(n.panel),m.Last)}else e.preventDefault(),e.stopPropagation(),O(V(n.panel),m.First)}},handleKeyUp:function(e){var t,o;if(!l&&n.popoverState.value===se.Open&&n.panel&&n.button)switch(e.key){case d.Tab:if(!u.value)return;if(null==(t=V(n.button))?void 0:t.contains(u.value))return;if(null==(o=V(n.panel))?void 0:o.contains(u.value))return;var r=S(),i=r.indexOf(u.value);if(r.indexOf(V(n.button))>i)return;e.preventDefault(),e.stopPropagation(),O(V(n.panel),m.Last)}},handleClick:function(){var t;e.disabled||(l?(n.closePopover(),null==(t=V(n.button))||t.focus()):(n.popoverState.value===se.Closed&&(null==r||r(n.buttonId)),n.togglePopover()))},handleFocus:function(){}}}}),we=t.defineComponent({name:"PopoverOverlay",props:{as:{type:[Object,String],default:"div"}},render:function(){var e={open:me("PopoverOverlay").popoverState.value===se.Open};return s({props:n({},this.$props,{id:this.id,ref:"el","aria-hidden":!0,onClick:this.handleClick}),slot:e,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=me("PopoverOverlay");return{id:"headlessui-popover-overlay-"+f(),handleClick:function(){e.closePopover()}}}}),Oe=t.defineComponent({name:"PopoverPanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},focus:{type:Boolean,default:!1}},render:function(){var e={open:me("PopoverPanel").popoverState.value===se.Open};return s({props:n({},this.$props,{ref:"el",id:this.id,onKeydown:this.handleKeyDown}),slot:e,attrs:this.$attrs,slots:this.$slots,features:a.RenderStrategy|a.Static,visible:e.open})},setup:function(e){var n=e.focus,o=me("PopoverPanel");return t.provide(ye,o.panelId),t.onUnmounted((function(){o.panel.value=null})),t.watchEffect((function(){var e;if(n&&o.popoverState.value===se.Open&&o.panel){var t=document.activeElement;(null==(e=V(o.panel))?void 0:e.contains(t))||O(V(o.panel),m.First)}})),x("keydown",(function(e){var t;if(o.popoverState.value===se.Open&&V(o.panel)&&e.key===d.Tab&&document.activeElement&&(null==(t=V(o.panel))?void 0:t.contains(document.activeElement))){e.preventDefault();var n,r=O(V(o.panel),e.shiftKey?m.Previous:m.Next);if(r===h.Underflow)return null==(n=V(o.button))?void 0:n.focus();if(r===h.Overflow){if(!V(o.button))return;var i=S(),l=i.indexOf(V(o.button));O(i.splice(l+1).filter((function(e){var t;return!(null==(t=V(o.panel))?void 0:t.contains(e))})),m.First)===h.Error&&O(document.body,m.First)}}})),x("focus",(function(){var e;n&&o.popoverState.value===se.Open&&V(o.panel)&&((null==(e=V(o.panel))?void 0:e.contains(document.activeElement))||o.closePopover())}),!0),{id:o.panelId,el:o.panel,handleKeyDown:function(e){var t,n;switch(e.key){case d.Escape:if(o.popoverState.value!==se.Open)return;if(!V(o.panel))return;if(!(null==(t=V(o.panel))?void 0:t.contains(document.activeElement)))return;e.preventDefault(),o.closePopover(),null==(n=V(o.button))||n.focus()}}}}}),xe=t.defineComponent({name:"PopoverGroup",props:{as:{type:[Object,String],default:"div"}},render:function(){return s({props:n({},this.$props,{ref:"el"}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=t.ref(null),n=t.ref([]);function o(e){var t=n.value.indexOf(e);-1!==t&&n.value.splice(t,1)}return t.provide(he,{registerPopover:function(e){return n.value.push(e),function(){o(e)}},unregisterPopover:o,isFocusWithinPopoverGroup:function(){var t,o=document.activeElement;return!!(null==(t=V(e))?void 0:t.contains(o))||n.value.some((function(e){var t,n;return(null==(t=document.getElementById(e.buttonId))?void 0:t.contains(o))||(null==(n=document.getElementById(e.panelId))?void 0:n.contains(o))}))},closeOthers:function(e){for(var t,o=i(n.value);!(t=o()).done;){var r=t.value;r.buttonId!==e&&r.close()}}}),{el:e}}}),Ce=Symbol("GroupContext");function Ee(e){var n=t.inject(Ce,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <SwitchGroup /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,Ee),o}return n}var De=t.defineComponent({name:"SwitchGroup",props:{as:{type:[Object,String],default:"template"}},setup:function(e,n){var o=n.slots,r=n.attrs,i=t.ref(null),l=t.ref(null),a=t.ref(null);return t.provide(Ce,{switchRef:i,labelRef:l,descriptionRef:a}),function(){return s({props:e,slot:{},slots:o,attrs:r})}}}),Ie=t.defineComponent({name:"Switch",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"button"},modelValue:{type:[Object,Boolean],default:null},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},render:function(){var e=t.inject(Ce,null),o=this.$props,r=o.className,i=void 0===r?o.class:r,l=t.computed((function(){var t;return null==(t=V(null==e?void 0:e.labelRef))?void 0:t.id})),a=t.computed((function(){var t;return null==(t=V(null==e?void 0:e.descriptionRef))?void 0:t.id})),u={checked:this.$props.modelValue},c={id:this.id,ref:null===e?void 0:e.switchRef,role:"switch",tabIndex:0,class:X(i,u),"aria-checked":this.$props.modelValue,"aria-labelledby":l.value,"aria-describedby":a.value,onClick:this.handleClick,onKeyup:this.handleKeyUp,onKeypress:this.handleKeyPress};return"button"===this.$props.as&&Object.assign(c,{type:"button"}),s({props:n({},this.$props,c),slot:u,attrs:this.$attrs,slots:this.$slots})},setup:function(e,n){var o=n.emit,r=t.inject(Ce,null);function i(){o("update:modelValue",!e.modelValue)}return{id:"headlessui-switch-"+f(),el:null==r?void 0:r.switchRef,handleClick:function(e){e.preventDefault(),i()},handleKeyUp:function(e){e.key!==d.Tab&&e.preventDefault(),e.key===d.Space&&i()},handleKeyPress:function(e){e.preventDefault()}}}}),ke=t.defineComponent({name:"SwitchLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){return s({props:n({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=Ee("SwitchLabel");return{id:"headlessui-switch-label-"+f(),el:e.labelRef,handleClick:function(){var t=V(e.switchRef);null==t||t.click(),null==t||t.focus({preventScroll:!0})}}}}),Pe=t.defineComponent({name:"SwitchDescription",props:{as:{type:[Object,String],default:"p"}},render:function(){return s({props:n({},this.$props,{id:this.id,ref:"el"}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=Ee("SwitchDescription");return{id:"headlessui-switch-description-"+f(),el:e.descriptionRef}}});e.Alert=p,e.Dialog=M,e.DialogDescription=U,e.DialogOverlay=N,e.DialogTitle=K,e.Disclosure=z,e.DisclosureButton=Y,e.DisclosurePanel=_,e.FocusTrap=Q,e.Listbox=ne,e.ListboxButton=re,e.ListboxLabel=oe,e.ListboxOption=le,e.ListboxOptions=ie,e.Menu=ce,e.MenuButton=de,e.MenuItem=ve,e.MenuItems=pe,e.Popover=ge,e.PopoverButton=Se,e.PopoverGroup=xe,e.PopoverOverlay=we,e.PopoverPanel=Oe,e.Portal=R,e.PortalGroup=F,e.Switch=Ie,e.SwitchDescription=Pe,e.SwitchGroup=De,e.SwitchLabel=ke,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=headlessui.umd.production.min.js.map |
@@ -0,3 +1,9 @@ | ||
export * from './components/alert/alert'; | ||
export * from './components/dialog/dialog'; | ||
export * from './components/disclosure/disclosure'; | ||
export * from './components/focus-trap/focus-trap'; | ||
export * from './components/listbox/listbox'; | ||
export * from './components/menu/menu'; | ||
export * from './components/listbox/listbox'; | ||
export * from './components/popover/popover'; | ||
export * from './components/portal/portal'; | ||
export * from './components/switch/switch'; |
@@ -84,6 +84,81 @@ export declare function getMenuButton(): HTMLElement | null; | ||
}, switchElement?: HTMLElement | null): void; | ||
export declare function getDisclosureButton(): HTMLElement | null; | ||
export declare function getDisclosurePanel(): HTMLElement | null; | ||
export declare enum DisclosureState { | ||
/** The disclosure is visible to the user. */ | ||
Visible = 0, | ||
/** The disclosure is **not** visible to the user. It's still in the DOM, but it is hidden. */ | ||
InvisibleHidden = 1, | ||
/** The disclosure is **not** visible to the user. It's not in the DOM, it is unmounted. */ | ||
InvisibleUnmounted = 2 | ||
} | ||
export declare function assertDisclosureButton(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DisclosureState; | ||
}, button?: HTMLElement | null): void; | ||
export declare function assertDisclosurePanel(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DisclosureState; | ||
}, panel?: HTMLElement | null): void; | ||
export declare function getPopoverButton(): HTMLElement | null; | ||
export declare function getPopoverPanel(): HTMLElement | null; | ||
export declare function getPopoverOverlay(): HTMLElement | null; | ||
export declare enum PopoverState { | ||
/** The popover is visible to the user. */ | ||
Visible = 0, | ||
/** The popover is **not** visible to the user. It's still in the DOM, but it is hidden. */ | ||
InvisibleHidden = 1, | ||
/** The popover is **not** visible to the user. It's not in the DOM, it is unmounted. */ | ||
InvisibleUnmounted = 2 | ||
} | ||
export declare function assertPopoverButton(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: PopoverState; | ||
}, button?: HTMLElement | null): void; | ||
export declare function assertPopoverPanel(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: PopoverState; | ||
}, panel?: HTMLElement | null): void; | ||
export declare function assertLabelValue(element: HTMLElement | null, value: string): void; | ||
export declare function assertDescriptionValue(element: HTMLElement | null, value: string): void; | ||
export declare function getDialog(): HTMLElement | null; | ||
export declare function getDialogTitle(): HTMLElement | null; | ||
export declare function getDialogDescription(): HTMLElement | null; | ||
export declare function getDialogOverlay(): HTMLElement | null; | ||
export declare enum DialogState { | ||
/** The dialog is visible to the user. */ | ||
Visible = 0, | ||
/** The dialog is **not** visible to the user. It's still in the DOM, but it is hidden. */ | ||
InvisibleHidden = 1, | ||
/** The dialog is **not** visible to the user. It's not in the DOM, it is unmounted. */ | ||
InvisibleUnmounted = 2 | ||
} | ||
export declare function assertDialog(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DialogState; | ||
}, dialog?: HTMLElement | null): void; | ||
export declare function assertDialogTitle(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DialogState; | ||
}, title?: HTMLElement | null, dialog?: HTMLElement | null): void; | ||
export declare function assertDialogDescription(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DialogState; | ||
}, description?: HTMLElement | null, dialog?: HTMLElement | null): void; | ||
export declare function assertDialogOverlay(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DialogState; | ||
}, overlay?: HTMLElement | null): void; | ||
export declare function assertActiveElement(element: HTMLElement | null): void; | ||
export declare function assertContainsActiveElement(element: HTMLElement | null): void; | ||
export declare function assertHidden(element: HTMLElement | null): void; | ||
export declare function assertVisible(element: HTMLElement | null): void; | ||
export declare function getByText(text: string): HTMLElement | null; |
import { mount } from '@vue/test-utils'; | ||
import { fireEvent } from '@testing-library/dom'; | ||
export declare function render(TestComponent: any, options?: Omit<Parameters<typeof mount>[1], 'attachTo'>): { | ||
debug(): void; | ||
export declare function render(TestComponent: any, options?: Parameters<typeof mount>[1] | undefined): { | ||
debug(element?: Element): void; | ||
}; | ||
export { fireEvent }; |
{ | ||
"name": "@headlessui/vue", | ||
"version": "0.3.0-4648332", | ||
"version": "0.3.0-6dd6636", | ||
"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
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
1242956
304442
43
9995
13
2