import{_ as K,r as $,a as T,b as A,K as pe,F as ue,m as U,u as He,d as le,c as _,R as V}from"./dom.esm.2d7131b5.js";import{a3 as F,a4 as P,a5 as S,a6 as D,P as h,S as Y,d as j,T as Ne,a7 as Ve,_ as me,Q as x,R as q,$ as je,Y as We}from"./vendor.7e4e5e39.js";var he=Symbol("StackContext"),z;(function(e){e[e.AddElement=0]="AddElement",e[e.RemoveElement=1]="RemoveElement"})(z||(z={}));function ge(){return F(he,function(){})}function Ie(e){var t=ge();S(function(r){var n=e==null?void 0:e.value;!n||(t(z.AddElement,n),r(function(){return t(z.RemoveElement,n)}))})}function be(e){var t=ge();function r(){for(var n=arguments.length,a=new Array(n),i=0;i=u||o+u<=0)return R.Error;var d=i+o;if(t&g.WrapAround)d=(d+u)%u;else{if(d<0)return R.Underflow;if(d>=u)return R.Overflow}s=r[d],(f=s)==null||f.focus(l),o+=a}while(s!==document.activeElement);return s.hasAttribute("tabindex")||s.setAttribute("tabindex","0"),R.Success}function Ge(e,t,r){t===void 0&&(t=h(!0)),r===void 0&&(r=h({}));var n=h(typeof window!="undefined"?document.activeElement:null),a=h(null);function i(){if(!!t.value&&e.value.size===1){var o=r.value.initialFocus,u=document.activeElement;if(o){if(o===u)return}else if(se(e.value,u))return;if(n.value=u,o)Q(o);else{for(var s=!1,f=A(e.value),d;!(d=f()).done;){var E=d.value,y=Te(E,g.First);if(y===R.Success){s=!0;break}}s||console.warn("There are no focusable elements inside the ")}a.value=document.activeElement}}function l(){Q(n.value),n.value=null,a.value=null}S(i),me(function(){t.value?i():l()}),Y(l),ee("keydown",function(o){if(!!t.value&&o.key===pe.Tab&&!!document.activeElement&&e.value.size===1){o.preventDefault();for(var u=A(e.value),s;!(s=u()).done;){var f=s.value,d=Te(f,(o.shiftKey?g.Previous:g.Next)|g.WrapAround);if(d===R.Success){a.value=document.activeElement;break}}}}),ee("focus",function(o){if(!!t.value&&e.value.size===1){var u=a.value;if(!!u){var s=o.target;s&&s instanceof HTMLElement?se(e.value,s)?(a.value=s,Q(s)):(o.preventDefault(),o.stopPropagation(),Q(u)):Q(a.value)}}},!0)}var Oe="body > *",G=new Set,B=new Map;function Ae(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function xe(e){var t=B.get(e);!t||(t["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}function Ke(e,t){t===void 0&&(t=h(!0)),S(function(r){if(!!t.value&&!!e.value){var n=e.value;G.add(n);for(var a=A(B.keys()),i;!(i=a()).done;){var l=i.value;l.contains(n)&&(xe(l),B.delete(l))}document.querySelectorAll(Oe).forEach(function(o){if(o instanceof HTMLElement){for(var u=A(G),s;!(s=u()).done;){var f=s.value;if(o.contains(f))return}G.size===1&&(B.set(o,{"aria-hidden":o.getAttribute("aria-hidden"),inert:o.inert}),Ae(o))}}),r(function(){if(G.delete(n),G.size>0)document.querySelectorAll(Oe).forEach(function(f){if(f instanceof HTMLElement&&!B.has(f)){for(var d=A(G),E;!(E=d()).done;){var y=E.value;if(f.contains(y))return}B.set(f,{"aria-hidden":f.getAttribute("aria-hidden"),inert:f.inert}),Ae(f)}});else for(var o=A(B.keys()),u;!(u=o()).done;){var s=u.value;xe(s),B.delete(s)}})}})}var Le=Symbol("Context"),L;(function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"})(L||(L={}));function Ye(){return fe()!==null}function fe(){return F(Le,null)}function Qe(e){P(Le,e)}var b;(function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"})(b||(b={}));var $e=Symbol("DialogContext");function J(e){var t=F($e,null);if(t===null){var r=new Error("<"+e+" /> is missing a parent component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,J),r}return t}var re="DC8F892D-2EBD-447C-A4C8-A03058436FF4",it=D({name:"Dialog",inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},open:{type:[Boolean,String],default:re},initialFocus:{type:Object,default:null}},emits:{close:function(t){return!0}},render:function(){var t=this,r=T({},this.$attrs,{ref:"el",id:this.id,role:"dialog","aria-modal":this.dialogState===b.Open?!0:void 0,"aria-labelledby":this.titleId,"aria-describedby":this.describedby,onClick:this.handleClick}),n=this.$props,a=K(n,["open","initialFocus"]),i={open:this.dialogState===b.Open};return j(Ee,{force:!0},function(){return j(Me,function(){return j(Ue,{target:t.dialogRef},function(){return j(Ee,{force:!1},function(){return $({props:T({},a,r),slot:i,attrs:t.$attrs,slots:t.$slots,visible:t.visible,features:ue.RenderStrategy|ue.Static,name:"Dialog"})})})})})},setup:function(t,r){var n=r.emit,a=h(new Set),i=fe(),l=x(function(){if(t.open===re&&i!==null){var c;return U(i.value,(c={},c[L.Open]=!0,c[L.Closed]=!1,c))}return t.open}),o=t.open!==re||i!==null;if(!o)throw new Error("You forgot to provide an `open` prop to the `Dialog`.");if(typeof l.value!="boolean")throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+(l.value===re?void 0:t.open));var u=x(function(){return t.open?b.Open:b.Closed}),s=x(function(){return i!==null?i.value===L.Open:u.value===b.Open}),f=h(null),d=h(u.value===b.Open);me(function(){d.value=u.value===b.Open});var E="headlessui-dialog-"+_(),y=x(function(){return{initialFocus:t.initialFocus}});Ge(a,d,y),Ke(f,d),be(function(c,p){var C;return U(c,(C={},C[z.AddElement]=function(){a.value.add(p)},C[z.RemoveElement]=function(){a.value.delete(p)},C))});var w=He({name:"DialogDescription",slot:x(function(){return{open:l.value}})}),O=h(null),N={titleId:O,dialogState:u,setTitleId:function(p){O.value!==p&&(O.value=p)},close:function(){n("close",!1)}};return P($e,N),ee("mousedown",function(c){var p=c.target;u.value===b.Open&&a.value.size===1&&(se(a.value,p)||(N.close(),je(function(){return p==null?void 0:p.focus()})))}),ee("keydown",function(c){c.key===pe.Escape&&u.value===b.Open&&(a.value.size>1||(c.preventDefault(),c.stopPropagation(),N.close()))}),S(function(c){if(u.value===b.Open){var p=document.documentElement.style.overflow,C=document.documentElement.style.paddingRight,I=window.innerWidth-document.documentElement.clientWidth;document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=I+"px",c(function(){document.documentElement.style.overflow=p,document.documentElement.style.paddingRight=C})}}),S(function(c){if(u.value===b.Open){var p=le(f);if(!!p){var C=new IntersectionObserver(function(I){for(var ie=A(I),X;!(X=ie()).done;){var k=X.value;k.boundingClientRect.x===0&&k.boundingClientRect.y===0&&k.boundingClientRect.width===0&&k.boundingClientRect.height===0&&N.close()}});C.observe(p),c(function(){return C.disconnect()})}}}),{id:E,el:f,dialogRef:f,containers:a,dialogState:u,titleId:O,describedby:w,visible:s,open:l,handleClick:function(p){p.stopPropagation()}}}}),ot=D({name:"DialogOverlay",props:{as:{type:[Object,String],default:"div"}},render:function(){var t=J("DialogOverlay"),r={ref:"el",id:this.id,"aria-hidden":!0,onClick:this.handleClick},n=this.$props;return $({props:T({},n,r),slot:{open:t.dialogState.value===b.Open},attrs:this.$attrs,slots:this.$slots,name:"DialogOverlay"})},setup:function(){var t=J("DialogOverlay"),r="headlessui-dialog-overlay-"+_();return{id:r,handleClick:function(a){a.target===a.currentTarget&&(a.preventDefault(),a.stopPropagation(),t.close())}}}}),ut=D({name:"DialogTitle",props:{as:{type:[Object,String],default:"h2"}},render:function(){var t=J("DialogTitle"),r={id:this.id},n=this.$props;return $({props:T({},n,r),slot:{open:t.dialogState.value===b.Open},attrs:this.$attrs,slots:this.$slots,name:"DialogTitle"})},setup:function(){var t=J("DialogTitle"),r="headlessui-dialog-title-"+_();return q(function(){t.setTitleId(r),Y(function(){return t.setTitleId(null)})}),{id:r}}});function Je(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}function Fe(){var e=[],t={requestAnimationFrame:function(r){function n(){return r.apply(this,arguments)}return n.toString=function(){return r.toString()},n}(function(){var r=requestAnimationFrame.apply(void 0,arguments);t.add(function(){return cancelAnimationFrame(r)})}),nextFrame:function(){for(var n=arguments.length,a=new Array(n),i=0;i1?r-1:0),a=1;a0&&(t=e.classList).add.apply(t,n)}function ne(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),a=1;a0&&(t=e.classList).remove.apply(t,n)}var H;(function(e){e.Finished="finished",e.Cancelled="cancelled"})(H||(H={}));function Xe(e,t){var r=Fe();if(!e)return r.dispose;var n=getComputedStyle(e),a=n.transitionDuration,i=n.transitionDelay,l=[a,i].map(function(s){var f=s.split(",").filter(Boolean).map(function(y){return y.includes("ms")?parseFloat(y):parseFloat(y)*1e3}).sort(function(y,w){return w-y}),d=f[0],E=d===void 0?0:d;return E}),o=l[0],u=l[1];return o!==0?r.setTimeout(function(){return t(H.Finished)},o+u):t(H.Finished),r.add(function(){return t(H.Cancelled)}),r.dispose}function Pe(e,t,r,n,a,i){var l=Fe(),o=i!==void 0?Je(i):function(){};return ne.apply(void 0,[e].concat(a)),ve.apply(void 0,[e].concat(t,r)),l.nextFrame(function(){ne.apply(void 0,[e].concat(r)),ve.apply(void 0,[e].concat(n)),l.add(Xe(e,function(u){return ne.apply(void 0,[e].concat(n,t)),ve.apply(void 0,[e].concat(a)),o(u)}))}),l.add(function(){return ne.apply(void 0,[e].concat(t,r,n,a))}),l.add(function(){return o(H.Cancelled)}),l.dispose}function W(e){return e===void 0&&(e=""),e.split(" ").filter(function(t){return t.trim().length>1})}var de=Symbol("TransitionContext"),v;(function(e){e.Visible="visible",e.Hidden="hidden"})(v||(v={}));function Ze(){return F(de,null)!==null}function _e(){var e=F(de,null);if(e===null)throw new Error("A is used but it is missing a parent .");return e}function et(){var e=F(ce,null);if(e===null)throw new Error("A is used but it is missing a parent .");return e}var ce=Symbol("NestingContext");function ae(e){return"children"in e?ae(e.children):e.value.filter(function(t){var r=t.state;return r===v.Visible}).length>0}function De(e){var t=h([]),r=h(!1);q(function(){return r.value=!0}),Y(function(){return r.value=!1});function n(i,l){var o;l===void 0&&(l=V.Hidden);var u=t.value.findIndex(function(s){var f=s.id;return f===i});u!==-1&&(U(l,(o={},o[V.Unmount]=function(){t.value.splice(u,1)},o[V.Hidden]=function(){t.value[u].state=v.Hidden},o)),!ae(t)&&r.value&&(e==null||e()))}function a(i){var l=t.value.find(function(o){var u=o.id;return u===i});return l?l.state!==v.Visible&&(l.state=v.Visible):t.value.push({id:i,state:v.Visible}),function(){return n(i,V.Unmount)}}return{children:t,register:a,unregister:n}}var Re=ue.RenderStrategy,tt=D({props:{as:{type:[Object,String],default:"div"},show:{type:[Boolean],default:null},unmount:{type:[Boolean],default:!0},appear:{type:[Boolean],default:!1},enter:{type:[String],default:""},enterFrom:{type:[String],default:""},enterTo:{type:[String],default:""},entered:{type:[String],default:""},leave:{type:[String],default:""},leaveFrom:{type:[String],default:""},leaveTo:{type:[String],default:""}},emits:{beforeEnter:function(){return!0},afterEnter:function(){return!0},beforeLeave:function(){return!0},afterLeave:function(){return!0}},render:function(){var t=this;if(this.renderAsRoot)return j(rt,T({},this.$props,{onBeforeEnter:function(){return t.$emit("beforeEnter")},onAfterEnter:function(){return t.$emit("afterEnter")},onBeforeLeave:function(){return t.$emit("beforeLeave")},onAfterLeave:function(){return t.$emit("afterLeave")}}),this.$slots);var r=this.$props,n=K(r,["appear","show","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"]),a={ref:"el"},i=n;return $({props:T({},i,a),slot:{},slots:this.$slots,attrs:this.$attrs,features:Re,visible:this.state===v.Visible,name:"TransitionChild"})},setup:function(t,r){var n=r.emit;if(!Ze()&&Ye())return{renderAsRoot:!0};var a=h(null),i=h(v.Visible),l=x(function(){return t.unmount?V.Unmount:V.Hidden}),o=_e(),u=o.show,s=o.appear,f=et(),d=f.register,E=f.unregister,y={value:!0},w=_(),O={value:!1},N=De(function(){O.value||(i.value=v.Hidden,E(w),n("afterLeave"))});q(function(){var m=d(w);Y(m)}),S(function(){var m;if(l.value===V.Hidden&&!!w){if(u&&i.value!==v.Visible){i.value=v.Visible;return}U(i.value,(m={},m[v.Hidden]=function(){return E(w)},m[v.Visible]=function(){return d(w)},m))}});var c=W(t.enter),p=W(t.enterFrom),C=W(t.enterTo),I=W(t.entered),ie=W(t.leave),X=W(t.leaveFrom),k=W(t.leaveTo);q(function(){S(function(){if(i.value===v.Visible){var m=le(a),Z=m instanceof Comment&&m.data==="";if(Z)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}})});function Be(m){var Z=y.value&&!s.value,M=le(a);!M||!(M instanceof HTMLElement)||Z||(O.value=!0,u.value&&n("beforeEnter"),u.value||n("beforeLeave"),m(u.value?Pe(M,c,p,C,I,function(oe){O.value=!1,oe===H.Finished&&n("afterEnter")}):Pe(M,ie,X,k,I,function(oe){O.value=!1,oe===H.Finished&&(ae(N)||(i.value=v.Hidden,E(w),n("afterLeave")))})))}return q(function(){We([u,s],function(m,Z,M){Be(M),y.value=!1},{immediate:!0})}),P(ce,N),Qe(x(function(){var m;return U(i.value,(m={},m[v.Visible]=L.Open,m[v.Hidden]=L.Closed,m))})),{el:a,renderAsRoot:!1,state:i}}}),rt=D({inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"},show:{type:[Boolean],default:null},unmount:{type:[Boolean],default:!0},appear:{type:[Boolean],default:!1},enter:{type:[String],default:""},enterFrom:{type:[String],default:""},enterTo:{type:[String],default:""},entered:{type:[String],default:""},leave:{type:[String],default:""},leaveFrom:{type:[String],default:""},leaveTo:{type:[String],default:""}},emits:{beforeEnter:function(){return!0},afterEnter:function(){return!0},beforeLeave:function(){return!0},afterLeave:function(){return!0}},render:function(){var t=this,r=this.$props,n=r.unmount,a=K(r,["show","appear","unmount"]),i={unmount:n};return $({props:T({},i,{as:"template"}),slot:{},slots:T({},this.$slots,{default:function(){return[j(tt,T({onBeforeEnter:function(){return t.$emit("beforeEnter")},onAfterEnter:function(){return t.$emit("afterEnter")},onBeforeLeave:function(){return t.$emit("beforeLeave")},onAfterLeave:function(){return t.$emit("afterLeave")}},t.$attrs,i,a),t.$slots.default)]}}),attrs:{},features:Re,visible:this.state===v.Visible,name:"Transition"})},setup:function(t){var r=fe(),n=x(function(){if(t.show===null&&r!==null){var u;return U(r.value,(u={},u[L.Open]=!0,u[L.Closed]=!1,u))}return t.show});S(function(){if(![!0,!1].includes(n.value))throw new Error('A is used but it is missing a `:show="true | false"` prop.')});var a=h(n.value?v.Visible:v.Hidden),i=De(function(){a.value=v.Hidden}),l={value:!0},o={show:n,appear:x(function(){return t.appear||!l.value})};return q(function(){S(function(){l.value=!1,n.value?a.value=v.Visible:ae(i)||(a.value=v.Hidden)})}),P(ce,i),P(de,o),{state:a,show:n}}});export{it as D,L as S,tt as T,ot as a,ut as b,rt as c,ee as d,Qe as e,fe as u};