99AI/public/chat/assets/menu-1a8ade33.js
2024-07-31 14:12:56 +08:00

5 lines
25 KiB
JavaScript

import{I as j}from"./index-08cceacb.js";import{X as c,a as R,n as I,y as E,r as L,e as M,f as q,B as re,l as ie,F as ae,p as X,d as P,G as ue}from"./vue-cf46d111.js";const Ve=j("announcement",!0,function(e){return c("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[c("rect",{x:"4",y:"15",width:"40",height:"26",rx:"2",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M24 7L16 15H32L24 7Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M12 24H30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M12 32H20",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Ze=j("calendar",!1,function(e){return c("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[c("path",{d:"M5 19H43V40C43 41.1046 42.1046 42 41 42H7C5.89543 42 5 41.1046 5 40V19Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M5 9C5 7.89543 5.89543 7 7 7H41C42.1046 7 43 7.89543 43 9V19H5V9Z",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M16 4V12",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M32 4V12",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M28 34H34",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M14 34H20",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M28 26H34",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M14 26H20",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),_e=j("check-one",!0,function(e){return c("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[c("path",{d:"M24 44C29.5228 44 34.5228 41.7614 38.1421 38.1421C41.7614 34.5228 44 29.5228 44 24C44 18.4772 41.7614 13.4772 38.1421 9.85786C34.5228 6.23858 29.5228 4 24 4C18.4772 4 13.4772 6.23858 9.85786 9.85786C6.23858 13.4772 4 18.4772 4 24C4 29.5228 6.23858 34.5228 9.85786 38.1421C13.4772 41.7614 18.4772 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M16 24L22 30L34 18",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Ke=j("close",!1,function(e){return c("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[c("path",{d:"M8 8L40 40",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M8 40L40 8",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Ge=j("commodity",!1,function(e){return c("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[c("path",{d:"M9.78101 9.75193C9.90612 8.75107 10.7569 8 11.7656 8H36.2344C37.2431 8 38.0939 8.75107 38.219 9.75193L41.719 37.7519C41.8682 38.9456 40.9374 40 39.7344 40H8.26556C7.06257 40 6.1318 38.9456 6.28101 37.7519L9.78101 9.75193Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M15 18C15 18 17 22 24 22C31 22 33 18 33 18",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),qe=j("delete-themes",!0,function(e){return c("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[c("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 15H40L37 44H11L8 15Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M20.002 25.0024V35.0026",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap},null),c("path",{d:"M28.0024 24.9995V34.9972",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap},null),c("path",{d:"M12 14.9999L28.3242 3L36 15",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Xe=j("logout",!0,function(e){return c("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[c("path",{d:"M23.9917 6H6V42H24",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M33 33L42 24L33 15",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M16 23.9917H42",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Qe=j("sun-one",!1,function(e){return c("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[c("path",{d:"M24 37C31.1797 37 37 31.1797 37 24C37 16.8203 31.1797 11 24 11C16.8203 11 11 16.8203 11 24C11 31.1797 16.8203 37 24 37Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M24 6C25.3807 6 26.5 4.88071 26.5 3.5C26.5 2.11929 25.3807 1 24 1C22.6193 1 21.5 2.11929 21.5 3.5C21.5 4.88071 22.6193 6 24 6Z",fill:e.colors[0]},null),c("path",{d:"M38.5 12C39.8807 12 41 10.8807 41 9.5C41 8.11929 39.8807 7 38.5 7C37.1193 7 36 8.11929 36 9.5C36 10.8807 37.1193 12 38.5 12Z",fill:e.colors[0]},null),c("path",{d:"M44.5 26.5C45.8807 26.5 47 25.3807 47 24C47 22.6193 45.8807 21.5 44.5 21.5C43.1193 21.5 42 22.6193 42 24C42 25.3807 43.1193 26.5 44.5 26.5Z",fill:e.colors[0]},null),c("path",{d:"M38.5 41C39.8807 41 41 39.8807 41 38.5C41 37.1193 39.8807 36 38.5 36C37.1193 36 36 37.1193 36 38.5C36 39.8807 37.1193 41 38.5 41Z",fill:e.colors[0]},null),c("path",{d:"M24 47C25.3807 47 26.5 45.8807 26.5 44.5C26.5 43.1193 25.3807 42 24 42C22.6193 42 21.5 43.1193 21.5 44.5C21.5 45.8807 22.6193 47 24 47Z",fill:e.colors[0]},null),c("path",{d:"M9.5 41C10.8807 41 12 39.8807 12 38.5C12 37.1193 10.8807 36 9.5 36C8.11929 36 7 37.1193 7 38.5C7 39.8807 8.11929 41 9.5 41Z",fill:e.colors[0]},null),c("path",{d:"M3.5 26.5C4.88071 26.5 6 25.3807 6 24C6 22.6193 4.88071 21.5 3.5 21.5C2.11929 21.5 1 22.6193 1 24C1 25.3807 2.11929 26.5 3.5 26.5Z",fill:e.colors[0]},null),c("path",{d:"M9.5 12C10.8807 12 12 10.8807 12 9.5C12 8.11929 10.8807 7 9.5 7C8.11929 7 7 8.11929 7 9.5C7 10.8807 8.11929 12 9.5 12Z",fill:e.colors[0]},null)])}),Ye=j("user",!1,function(e){return c("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[c("circle",{cx:"24",cy:"12",r:"8",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),c("path",{d:"M42 44C42 34.0589 33.9411 26 24 26C14.0589 26 6 34.0589 6 44",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])});let se=Symbol("headlessui.useid"),ce=0;function W(){return R(se,()=>`${++ce}`)()}function w(e){var t;if(e==null||e.value==null)return null;let l=(t=e.value.$el)!=null?t:e.value;return l instanceof Node?l:null}function O(e,t,...l){if(e in t){let a=t[e];return typeof a=="function"?a(...l):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,O),r}var de=Object.defineProperty,fe=(e,t,l)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,V=(e,t,l)=>(fe(e,typeof t!="symbol"?t+"":t,l),l);let ve=class{constructor(){V(this,"current",this.detect()),V(this,"currentId",0)}set(t){this.current!==t&&(this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}},H=new ve;function B(e){if(H.isServer)return null;if(e instanceof Node)return e.ownerDocument;if(e!=null&&e.hasOwnProperty("value")){let t=w(e);if(t)return t.ownerDocument}return document}let A=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var $=(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",e))($||{}),he=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(he||{}),ke=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(ke||{});function Q(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(A)).sort((t,l)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(l.tabIndex||Number.MAX_SAFE_INTEGER)))}var z=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(z||{});function U(e,t=0){var l;return e===((l=B(e))==null?void 0:l.body)?!1:O(t,{0(){return e.matches(A)},1(){let r=e;for(;r!==null;){if(r.matches(A))return!0;r=r.parentElement}return!1}})}function Y(e){let t=B(e);I(()=>{t&&!U(t.activeElement,0)&&ge(e)})}var me=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(me||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function ge(e){e==null||e.focus({preventScroll:!0})}let we=["textarea","input"].join(",");function be(e){var t,l;return(l=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,we))!=null?l:!1}function J(e,t=l=>l){return e.slice().sort((l,r)=>{let a=t(l),o=t(r);if(a===null||o===null)return 0;let n=a.compareDocumentPosition(o);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function ye(e,t){return Le(Q(),t,{relativeTo:e})}function Le(e,t,{sorted:l=!0,relativeTo:r=null,skipElements:a=[]}={}){var o;let n=(o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e==null?void 0:e.ownerDocument)!=null?o:document,u=Array.isArray(e)?l?J(e):e:Q(e);a.length>0&&u.length>1&&(u=u.filter(s=>!a.includes(s))),r=r??n.activeElement;let v=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),k=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,u.indexOf(r))-1;if(t&4)return Math.max(0,u.indexOf(r))+1;if(t&8)return u.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),m=t&32?{preventScroll:!0}:{},h=0,i=u.length,d;do{if(h>=i||h+i<=0)return 0;let s=k+h;if(t&16)s=(s+i)%i;else{if(s<0)return 3;if(s>=i)return 1}d=u[s],d==null||d.focus(m),h+=v}while(d!==n.activeElement);return t&6&&be(d)&&d.select(),2}function Ce(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Me(){return/Android/gi.test(window.navigator.userAgent)}function je(){return Ce()||Me()}function p(e,t,l){H.isServer||E(r=>{document.addEventListener(e,t,l),r(()=>document.removeEventListener(e,t,l))})}function Ie(e,t,l){H.isServer||E(r=>{window.addEventListener(e,t,l),r(()=>window.removeEventListener(e,t,l))})}function Se(e,t,l=M(()=>!0)){function r(o,n){if(!l.value||o.defaultPrevented)return;let u=n(o);if(u===null||!u.getRootNode().contains(u))return;let v=function k(m){return typeof m=="function"?k(m()):Array.isArray(m)||m instanceof Set?m:[m]}(e);for(let k of v){if(k===null)continue;let m=k instanceof HTMLElement?k:w(k);if(m!=null&&m.contains(u)||o.composed&&o.composedPath().includes(m))return}return!U(u,z.Loose)&&u.tabIndex!==-1&&o.preventDefault(),t(o,u)}let a=L(null);p("pointerdown",o=>{var n,u;l.value&&(a.value=((u=(n=o.composedPath)==null?void 0:n.call(o))==null?void 0:u[0])||o.target)},!0),p("mousedown",o=>{var n,u;l.value&&(a.value=((u=(n=o.composedPath)==null?void 0:n.call(o))==null?void 0:u[0])||o.target)},!0),p("click",o=>{je()||a.value&&(r(o,()=>a.value),a.value=null)},!0),p("touchend",o=>r(o,()=>o.target instanceof HTMLElement?o.target:null),!0),Ie("blur",o=>r(o,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Z(e,t){if(e)return e;let l=t??"button";if(typeof l=="string"&&l.toLowerCase()==="button")return"button"}function Ee(e,t){let l=L(Z(e.value.type,e.value.as));return q(()=>{l.value=Z(e.value.type,e.value.as)}),E(()=>{var r;l.value||w(t)&&w(t)instanceof HTMLButtonElement&&!((r=w(t))!=null&&r.hasAttribute("type"))&&(l.value="button")}),l}function _(e){return[e.screenX,e.screenY]}function xe(){let e=L([-1,-1]);return{wasMoved(t){let l=_(t);return e.value[0]===l[0]&&e.value[1]===l[1]?!1:(e.value=l,!0)},update(t){e.value=_(t)}}}function pe({container:e,accept:t,walk:l,enabled:r}){E(()=>{let a=e.value;if(!a||r!==void 0&&!r.value)return;let o=B(e);if(!o)return;let n=Object.assign(v=>t(v),{acceptNode:t}),u=o.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,n,!1);for(;u.nextNode();)l(u.currentNode)})}var N=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(N||{}),Pe=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Pe||{});function D({visible:e=!0,features:t=0,ourProps:l,theirProps:r,...a}){var o;let n=te(r,l),u=Object.assign(a,{props:n});if(e||t&2&&n.static)return F(u);if(t&1){let v=(o=n.unmount)==null||o?0:1;return O(v,{0(){return null},1(){return F({...a,props:{...n,hidden:!0,style:{display:"none"}}})}})}return F(u)}function F({props:e,attrs:t,slots:l,slot:r,name:a}){var o,n;let{as:u,...v}=Oe(e,["unmount","static"]),k=(o=l.default)==null?void 0:o.call(l,r),m={};if(r){let h=!1,i=[];for(let[d,s]of Object.entries(r))typeof s=="boolean"&&(h=!0),s===!0&&i.push(d);h&&(m["data-headlessui-state"]=i.join(" "))}if(u==="template"){if(k=ee(k??[]),Object.keys(v).length>0||Object.keys(t).length>0){let[h,...i]=k??[];if(!De(h)||i.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(v).concat(Object.keys(t)).map(f=>f.trim()).filter((f,b,g)=>g.indexOf(f)===b).sort((f,b)=>f.localeCompare(b)).map(f=>` - ${f}`).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(f=>` - ${f}`).join(`
`)].join(`
`));let d=te((n=h.props)!=null?n:{},v,m),s=re(h,d,!0);for(let f in d)f.startsWith("on")&&(s.props||(s.props={}),s.props[f]=d[f]);return s}return Array.isArray(k)&&k.length===1?k[0]:k}return ie(u,Object.assign({},v,m),{default:()=>k})}function ee(e){return e.flatMap(t=>t.type===ae?ee(t.children):[t])}function te(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},l={};for(let r of e)for(let a in r)a.startsWith("on")&&typeof r[a]=="function"?(l[a]!=null||(l[a]=[]),l[a].push(r[a])):t[a]=r[a];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(l).map(r=>[r,void 0])));for(let r in l)Object.assign(t,{[r](a,...o){let n=l[r];for(let u of n){if(a instanceof Event&&a.defaultPrevented)return;u(a,...o)}}});return t}function et(e){let t=Object.assign({},e);for(let l in t)t[l]===void 0&&delete t[l];return t}function Oe(e,t=[]){let l=Object.assign({},e);for(let r of t)r in l&&delete l[r];return l}function De(e){return e==null?!1:typeof e.type=="string"||typeof e.type=="object"||typeof e.type=="function"}let ne=Symbol("Context");var S=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(S||{});function Te(){return R(ne,null)}function Fe(e){X(ne,e)}var y=(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))(y||{});function Ae(e){throw new Error("Unexpected object: "+e)}var C=(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",e))(C||{});function $e(e,t){let l=t.resolveItems();if(l.length<=0)return null;let r=t.resolveActiveIndex(),a=r??-1;switch(e.focus){case 0:{for(let o=0;o<l.length;++o)if(!t.resolveDisabled(l[o],o,l))return o;return r}case 1:{a===-1&&(a=l.length);for(let o=a-1;o>=0;--o)if(!t.resolveDisabled(l[o],o,l))return o;return r}case 2:{for(let o=a+1;o<l.length;++o)if(!t.resolveDisabled(l[o],o,l))return o;return r}case 3:{for(let o=l.length-1;o>=0;--o)if(!t.resolveDisabled(l[o],o,l))return o;return r}case 4:{for(let o=0;o<l.length;++o)if(t.resolveId(l[o],o,l)===e.id)return o;return r}case 5:return null;default:Ae(e)}}let K=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function G(e){var t,l;let r=(t=e.innerText)!=null?t:"",a=e.cloneNode(!0);if(!(a instanceof HTMLElement))return r;let o=!1;for(let u of a.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))u.remove(),o=!0;let n=o?(l=a.innerText)!=null?l:"":r;return K.test(n)&&(n=n.replace(K,"")),n}function Ne(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let l=e.getAttribute("aria-labelledby");if(l){let r=l.split(" ").map(a=>{let o=document.getElementById(a);if(o){let n=o.getAttribute("aria-label");return typeof n=="string"?n.trim():G(o).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return G(e).trim()}function Re(e){let t=L(""),l=L("");return()=>{let r=w(e);if(!r)return"";let a=r.innerText;if(t.value===a)return l.value;let o=Ne(r).trim().toLowerCase();return t.value=a,l.value=o,o}}var We=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(We||{}),He=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(He||{});function Be(e){requestAnimationFrame(()=>requestAnimationFrame(e))}let le=Symbol("MenuContext");function T(e){let t=R(le,null);if(t===null){let l=new Error(`<${e} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,T),l}return t}let tt=P({name:"Menu",props:{as:{type:[Object,String],default:"template"}},setup(e,{slots:t,attrs:l}){let r=L(1),a=L(null),o=L(null),n=L([]),u=L(""),v=L(null),k=L(1);function m(i=d=>d){let d=v.value!==null?n.value[v.value]:null,s=J(i(n.value.slice()),b=>w(b.dataRef.domRef)),f=d?s.indexOf(d):null;return f===-1&&(f=null),{items:s,activeItemIndex:f}}let h={menuState:r,buttonRef:a,itemsRef:o,items:n,searchQuery:u,activeItemIndex:v,activationTrigger:k,closeMenu:()=>{r.value=1,v.value=null},openMenu:()=>r.value=0,goToItem(i,d,s){let f=m(),b=$e(i===C.Specific?{focus:C.Specific,id:d}:{focus:i},{resolveItems:()=>f.items,resolveActiveIndex:()=>f.activeItemIndex,resolveId:g=>g.id,resolveDisabled:g=>g.dataRef.disabled});u.value="",v.value=b,k.value=s??1,n.value=f.items},search(i){let d=u.value!==""?0:1;u.value+=i.toLowerCase();let s=(v.value!==null?n.value.slice(v.value+d).concat(n.value.slice(0,v.value+d)):n.value).find(b=>b.dataRef.textValue.startsWith(u.value)&&!b.dataRef.disabled),f=s?n.value.indexOf(s):-1;f===-1||f===v.value||(v.value=f,k.value=1)},clearSearch(){u.value=""},registerItem(i,d){let s=m(f=>[...f,{id:i,dataRef:d}]);n.value=s.items,v.value=s.activeItemIndex,k.value=1},unregisterItem(i){let d=m(s=>{let f=s.findIndex(b=>b.id===i);return f!==-1&&s.splice(f,1),s});n.value=d.items,v.value=d.activeItemIndex,k.value=1}};return Se([a,o],(i,d)=>{var s;h.closeMenu(),U(d,z.Loose)||(i.preventDefault(),(s=w(a))==null||s.focus())},M(()=>r.value===0)),X(le,h),Fe(M(()=>O(r.value,{0:S.Open,1:S.Closed}))),()=>{let i={open:r.value===0,close:h.closeMenu};return D({ourProps:{},theirProps:e,slot:i,slots:t,attrs:l,name:"Menu"})}}}),nt=P({name:"MenuButton",props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"},id:{type:String,default:null}},setup(e,{attrs:t,slots:l,expose:r}){var a;let o=(a=e.id)!=null?a:`headlessui-menu-button-${W()}`,n=T("MenuButton");r({el:n.buttonRef,$el:n.buttonRef});function u(h){switch(h.key){case y.Space:case y.Enter:case y.ArrowDown:h.preventDefault(),h.stopPropagation(),n.openMenu(),I(()=>{var i;(i=w(n.itemsRef))==null||i.focus({preventScroll:!0}),n.goToItem(C.First)});break;case y.ArrowUp:h.preventDefault(),h.stopPropagation(),n.openMenu(),I(()=>{var i;(i=w(n.itemsRef))==null||i.focus({preventScroll:!0}),n.goToItem(C.Last)});break}}function v(h){switch(h.key){case y.Space:h.preventDefault();break}}function k(h){e.disabled||(n.menuState.value===0?(n.closeMenu(),I(()=>{var i;return(i=w(n.buttonRef))==null?void 0:i.focus({preventScroll:!0})})):(h.preventDefault(),n.openMenu(),Be(()=>{var i;return(i=w(n.itemsRef))==null?void 0:i.focus({preventScroll:!0})})))}let m=Ee(M(()=>({as:e.as,type:t.type})),n.buttonRef);return()=>{var h;let i={open:n.menuState.value===0},{...d}=e,s={ref:n.buttonRef,id:o,type:m.value,"aria-haspopup":"menu","aria-controls":(h=w(n.itemsRef))==null?void 0:h.id,"aria-expanded":n.menuState.value===0,onKeydown:u,onKeyup:v,onClick:k};return D({ourProps:s,theirProps:d,slot:i,attrs:t,slots:l,name:"MenuButton"})}}}),lt=P({name:"MenuItems",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:null}},setup(e,{attrs:t,slots:l,expose:r}){var a;let o=(a=e.id)!=null?a:`headlessui-menu-items-${W()}`,n=T("MenuItems"),u=L(null);r({el:n.itemsRef,$el:n.itemsRef}),pe({container:M(()=>w(n.itemsRef)),enabled:M(()=>n.menuState.value===0),accept(i){return i.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:i.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(i){i.setAttribute("role","none")}});function v(i){var d;switch(u.value&&clearTimeout(u.value),i.key){case y.Space:if(n.searchQuery.value!=="")return i.preventDefault(),i.stopPropagation(),n.search(i.key);case y.Enter:if(i.preventDefault(),i.stopPropagation(),n.activeItemIndex.value!==null){let s=n.items.value[n.activeItemIndex.value];(d=w(s.dataRef.domRef))==null||d.click()}n.closeMenu(),Y(w(n.buttonRef));break;case y.ArrowDown:return i.preventDefault(),i.stopPropagation(),n.goToItem(C.Next);case y.ArrowUp:return i.preventDefault(),i.stopPropagation(),n.goToItem(C.Previous);case y.Home:case y.PageUp:return i.preventDefault(),i.stopPropagation(),n.goToItem(C.First);case y.End:case y.PageDown:return i.preventDefault(),i.stopPropagation(),n.goToItem(C.Last);case y.Escape:i.preventDefault(),i.stopPropagation(),n.closeMenu(),I(()=>{var s;return(s=w(n.buttonRef))==null?void 0:s.focus({preventScroll:!0})});break;case y.Tab:i.preventDefault(),i.stopPropagation(),n.closeMenu(),I(()=>ye(w(n.buttonRef),i.shiftKey?$.Previous:$.Next));break;default:i.key.length===1&&(n.search(i.key),u.value=setTimeout(()=>n.clearSearch(),350));break}}function k(i){switch(i.key){case y.Space:i.preventDefault();break}}let m=Te(),h=M(()=>m!==null?(m.value&S.Open)===S.Open:n.menuState.value===0);return()=>{var i,d;let s={open:n.menuState.value===0},{...f}=e,b={"aria-activedescendant":n.activeItemIndex.value===null||(i=n.items.value[n.activeItemIndex.value])==null?void 0:i.id,"aria-labelledby":(d=w(n.buttonRef))==null?void 0:d.id,id:o,onKeydown:v,onKeyup:k,role:"menu",tabIndex:0,ref:n.itemsRef};return D({ourProps:b,theirProps:f,slot:s,attrs:t,slots:l,features:N.RenderStrategy|N.Static,visible:h.value,name:"MenuItems"})}}}),ot=P({name:"MenuItem",inheritAttrs:!1,props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},id:{type:String,default:null}},setup(e,{slots:t,attrs:l,expose:r}){var a;let o=(a=e.id)!=null?a:`headlessui-menu-item-${W()}`,n=T("MenuItem"),u=L(null);r({el:u,$el:u});let v=M(()=>n.activeItemIndex.value!==null?n.items.value[n.activeItemIndex.value].id===o:!1),k=Re(u),m=M(()=>({disabled:e.disabled,get textValue(){return k()},domRef:u}));q(()=>n.registerItem(o,m)),ue(()=>n.unregisterItem(o)),E(()=>{n.menuState.value===0&&v.value&&n.activationTrigger.value!==0&&I(()=>{var g,x;return(x=(g=w(u))==null?void 0:g.scrollIntoView)==null?void 0:x.call(g,{block:"nearest"})})});function h(g){if(e.disabled)return g.preventDefault();n.closeMenu(),Y(w(n.buttonRef))}function i(){if(e.disabled)return n.goToItem(C.Nothing);n.goToItem(C.Specific,o)}let d=xe();function s(g){d.update(g)}function f(g){d.wasMoved(g)&&(e.disabled||v.value||n.goToItem(C.Specific,o,0))}function b(g){d.wasMoved(g)&&(e.disabled||v.value&&n.goToItem(C.Nothing))}return()=>{let{disabled:g,...x}=e,oe={active:v.value,disabled:g,close:n.closeMenu};return D({ourProps:{id:o,ref:u,role:"menuitem",tabIndex:g===!0?void 0:-1,"aria-disabled":g===!0?!0:void 0,onClick:h,onFocus:i,onPointerenter:s,onMouseenter:s,onPointermove:f,onMousemove:f,onPointerleave:b,onMouseleave:b},theirProps:{...l,...x},slot:oe,attrs:l,slots:t,name:"MenuItem"})}}});export{Ve as A,Ke as C,qe as D,et as E,W as I,Xe as L,lt as M,nt as S,Oe as T,Ye as U,_e as a,ot as b,Ge as c,Qe as d,Ze as e,D as f,tt as g,y as h,w as o,Ee as s};