import{L as j,u as T,l as O,H as C,I as H,a2 as D,aB as N,af as U,N as L}from"./D8M1QwiK.js";var v;let $=Symbol("headlessui.useid"),R=0;const q=(v=T)!=null?v:function(){return O($,()=>`${++R}`)()};function z(e){j($,e)}function b(e){var t;if(e==null||e.value==null)return null;let n=(t=e.value.$el)!=null?t:e.value;return n instanceof Node?n:null}function E(e,t,...n){if(e in t){let a=t[e];return typeof a=="function"?a(...n):a}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(a=>`"${a}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,E),r}function w(e,t){if(e)return e;let n=t??"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function G(e,t){let n=C(w(e.value.type,e.value.as));return H(()=>{n.value=w(e.value.type,e.value.as)}),D(()=>{var r;n.value||b(t)&&b(t)instanceof HTMLButtonElement&&!((r=b(t))!=null&&r.hasAttribute("type"))&&(n.value="button")}),n}var B=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(B||{}),x=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(x||{});function J({visible:e=!0,features:t=0,ourProps:n,theirProps:r,...a}){var u;let s=k(r,n),i=Object.assign(a,{props:s});if(e||t&2&&s.static)return m(i);if(t&1){let p=(u=s.unmount)==null||u?0:1;return E(p,{0(){return null},1(){return m({...a,props:{...s,hidden:!0,style:{display:"none"}}})}})}return m(i)}function m({props:e,attrs:t,slots:n,slot:r,name:a}){var u,s;let{as:i,...p}=M(e,["unmount","static"]),l=(u=n.default)==null?void 0:u.call(n,r),g={};if(r){let c=!1,h=[];for(let[d,f]of Object.entries(r))typeof f=="boolean"&&(c=!0),f===!0&&h.push(d);c&&(g["data-headlessui-state"]=h.join(" "))}if(i==="template"){if(l=A(l??[]),Object.keys(p).length>0||Object.keys(t).length>0){let[c,...h]=l??[];if(!I(c)||h.length>0)throw new Error(['Passing props on "template"!',"",`The current component <${a} /> is rendering a "template".`,"However we need to passthrough the following props:",Object.keys(p).concat(Object.keys(t)).map(o=>o.trim()).filter((o,y,P)=>P.indexOf(o)===y).sort((o,y)=>o.localeCompare(y)).map(o=>`  - ${o}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".',"Render a single element as the child so that we can forward the props onto that element."].map(o=>`  - ${o}`).join(`
`)].join(`
`));let d=k((s=c.props)!=null?s:{},p,g),f=N(c,d,!0);for(let o in d)o.startsWith("on")&&(f.props||(f.props={}),f.props[o]=d[o]);return f}return Array.isArray(l)&&l.length===1?l[0]:l}return U(i,Object.assign({},p,g),{default:()=>l})}function A(e){return e.flatMap(t=>t.type===L?A(t.children):[t])}function k(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let a in r)a.startsWith("on")&&typeof r[a]=="function"?(n[a]!=null||(n[a]=[]),n[a].push(r[a])):t[a]=r[a];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](a,...u){let s=n[r];for(let i of s){if(a instanceof Event&&a.defaultPrevented)return;i(a,...u)}}});return t}function M(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function I(e){return e==null?!1:typeof e.type=="string"||typeof e.type=="object"||typeof e.type=="function"}let S=Symbol("Context");var W=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(W||{});function K(){return F()!==null}function F(){return O(S,null)}function Q(e){j(S,e)}var V=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(V||{});export{J as A,B as N,x as S,M as T,W as a,V as b,z as c,K as d,q as i,F as l,b as o,G as s,Q as t,E as u};
