openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 109 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Wo as t}from"./_4____________________________.js";import{Sy as n,Tb as r,ZM as i,ay as a,eN as o,oy as s,wb as c}from"./_2_____________________________.js";var l,u,d;function f(){return(f=e((()=>{l=(e,t=[])=>({parts:(...n)=>{if(d(t))return l(e,n);throw Error(`createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?`)},extendWith:(...n)=>l(e,[...t,...n]),omit:(...n)=>l(e,t.filter(e=>!n.includes(e))),rename:e=>l(e,t),keys:()=>t,build:()=>[...new Set(t)].reduce((t,n)=>{let r=`data-${u(e)}-${u(n)}`;return Object.assign(t,{[n]:{selector:[`&[${r}]`,`& [${r}]`].join(`, `),attr:r,attrs:(e=``)=>({[r]:e})}})},{})}),u=e=>e.replace(/([A-Z])([A-Z])/g,`$1-$2`).replace(/([a-z])([A-Z])/g,`$1-$2`).replace(/[\s_]+/g,`-`).toLowerCase(),d=e=>e.length===0})))()}var p,m;function h(){return(h=e((()=>{f(),p=l(`menu`).parts(`arrow`,`arrowTip`,`content`,`contextTrigger`,`indicator`,`item`,`itemGroup`,`itemGroupLabel`,`itemIndicator`,`itemText`,`positioner`,`separator`,`trigger`,`triggerItem`),m=p.build()})))()}function g(e){return e==null?[]:Array.isArray(e)?e:[e]}function _(e,t,n={}){let{step:r=1,loop:i=!0}=n,a=t+r,o=e.length,s=o-1;return t===-1?r>0?0:s:a<0?i?s:0:a>=o?i?0:t>o?o:t:a}function v(e,t,n={}){return e[_(e,t,n)]}function y(e,t,n={}){let{step:r=1,loop:i=!0}=n;return _(e,t,{step:-r,loop:i})}function b(e,t,n={}){return e[y(e,t,n)]}var x,S;function C(){return(C=e((()=>{x=e=>e[0],S=e=>e[e.length-1]})))()}var w,T;function E(){return(E=e((()=>{w=Object.prototype.hasOwnProperty,T=(e,t)=>{if(Object.is(e,t))return!0;if(e==null||t==null)return!1;if(typeof e.isEqual==`function`&&typeof t.isEqual==`function`)return e.isEqual(t);if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!T(e[n],t[n]))return!1;return!0}if(typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(t);if(Object.keys(e).length!==n.length)return!1;for(let r=0;r<n.length;r++){let i=n[r];if(!w.call(e,i)||!T(e[i],t[i]))return!1}return!0}})))()}var ee,te,D,O,ne,re,ie,ae,oe,se,ce,le,ue;function k(){return(k=e((()=>{ee=()=>!1,te=e=>typeof e==`object`&&!!e,D=e=>typeof e==`string`,O=e=>typeof e==`function`,ne=e=>e==null,re=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ie=e=>Object.prototype.toString.call(e),ae=Function.prototype.toString,oe=ae.call(Object),se=e=>{if(!te(e)||ie(e)!=`[object Object]`||ue(e))return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let n=re(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&ae.call(n)==oe},ce=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&`props`in e,le=e=>typeof e==`object`&&!!e&&`__v_isVNode`in e,ue=e=>ce(e)||le(e)})))()}var de,fe,pe,me,he;function ge(){return(ge=e((()=>{de=(e,...t)=>(typeof e==`function`?e(...t):e)??void 0,fe=e=>e,pe=e=>e(),me=()=>{},he=(...e)=>(...t)=>{e.forEach(function(e){e?.(...t)})}})))()}function _e(e){if(!se(e)||e===void 0)return e;let t=Reflect.ownKeys(e).filter(e=>typeof e==`string`),n={};for(let r of t){let t=e[r];t!==void 0&&(n[r]=_e(t))}return n}function ve(){return(ve=e((()=>{k()})))()}function ye(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function be(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function xe(e,t){if(e==null)throw Error(t())}function Se(...e){let t={};for(let n of e){if(!n)continue;for(let e in t)t[e]=e.startsWith(`on`)&&typeof t[e]==`function`&&typeof n[e]==`function`?he(n[e],t[e]):e===`className`||e===`class`?Ce(t[e],n[e]):e===`style`?De(t[e],n[e]):e===`data-ownedby`?we(t[e],n[e]):n[e]===void 0?t[e]:n[e];for(let e in n)t[e]===void 0&&(t[e]=n[e]);let e=Object.getOwnPropertySymbols(n);for(let r of e)t[r]=n[r]}return t}var Ce,we,Te,Ee,De;function Oe(){return(Oe=e((()=>{ge(),k(),Ce=(...e)=>e.map(e=>e?.trim?.()).filter(Boolean).join(` `),we=(...e)=>Array.from(new Set(Ce(...e).split(/\s+/).filter(Boolean))).join(` `),Te=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,Ee=e=>{let t={},n;for(;n=Te.exec(e);)t[n[1]]=n[2];return t},De=(e,t)=>{if(D(e)){if(D(t))return`${e};${t}`;e=Ee(e)}else D(t)&&(t=Ee(t));return Object.assign({},e??{},t??{})}})))()}function ke(){let e=new Map;return{claim(t){let n=Symbol(t);return e.set(t,n),n},isReplaced(t,n){return e.get(t)!==n}}}function Ae(e){return e.join(A)}function je(e){return e.includes(A)}function Me(e){return e.startsWith(Xe)}function Ne(e){return e.startsWith(A)}function Pe(e){return Me(e)?e.slice(Xe.length):e}function Fe(e,t){return e?`${e}${A}${t}`:t}function Ie(e){let t=new Map,n=new Map,r=(e,i)=>{t.set(e,i);let a=i.id;a&&(n.has(a)&&be(`[zag-js] Duplicate state id: "${a}"`),n.set(a,e));let o=i.states;if(o){xe(i.initial,()=>`[zag-js] Compound state "${e}" has child states but no "initial" property`),i.initial in o||be(`[zag-js] Compound state "${e}" has initial "${String(i.initial)}" which is not a child state`);for(let[t,n]of Object.entries(o)){if(!n)continue;let i=Fe(e,t);r(i,n)}}};for(let[t,n]of Object.entries(e.states))n&&r(t,n);return{index:t,idIndex:n}}function Le(e){let t=Qe.get(e);if(t)return t;let{index:n,idIndex:r}=Ie(e);return Qe.set(e,n),$e.set(e,r),n}function Re(e,t){return Le(e),$e.get(e)?.get(t)}function ze(e){return e?String(e).split(A).filter(Boolean):[]}function Be(e,t){let n=Le(e),r=ze(t),i=[],a=[];for(let e of r){a.push(e);let t=Ae(a),r=n.get(t);if(!r)break;i.push({path:t,state:r})}return ee()&&Object.freeze(i),i}function Ve(e,t){if(!t)return Ze;let n=et.get(e);n||et.set(e,n=new Map);let r=n.get(t);return r||(r=Be(e,t),n.set(t,r)),r}function He(e,t){let n=Le(e),r=ze(t);if(!r.length)return t;let i=[];for(let e of r){i.push(e);let r=Ae(i);if(!n.has(r))return t}let a=Ae(i),o=n.get(a);for(;o?.initial;){let e=`${a}${A}${o.initial}`,t=n.get(e);if(!t)break;a=e,o=t}return a}function Ue(e,t){return Le(e).has(t)}function We(e,t,n){let r=String(t);if(Me(r)){let t=Pe(r),n=Re(e,t);return xe(n,()=>`[zag-js] Unknown state id: "${t}"`),He(e,n)}if(Ne(r)&&n)return He(e,Fe(n,r.slice(1)));if(!je(r)&&n){let t=ze(n);for(let n=t.length-1;n>=1;n--){let i=Fe(t.slice(0,n).join(A),r);if(Ue(e,i))return He(e,i)}if(Ue(e,r))return He(e,r)}return He(e,r)}function Ge(e,t,n){let r=Ve(e,t);for(let e=r.length-1;e>=0;e--){let t=r[e]?.state.on?.[n];if(t)return{transitions:t,source:r[e]?.path}}return{transitions:e.on?.[n],source:void 0}}function Ke(e,t,n,r){let i=t?Ve(e,t):[],a=Ve(e,n),o=0;for(;o<i.length&&o<a.length&&i[o]?.path===a[o]?.path;)o+=1;let s=i.slice(o).reverse(),c=a.slice(o),l=i[i.length-1]?.path===a[a.length-1]?.path;return r&&l&&(s=i.slice().reverse(),c=a.slice()),{exiting:s,entering:c}}function qe(e,t){return e?e===t||e.startsWith(`${t}${A}`):!1}function Je(e,t){let n=tt.get(e);n||tt.set(e,n=new Map);let r=n.get(t);if(!r){let i=new Set;for(let n of Ve(e,t)){let e=n.state.tags;if(e)for(let t of e)i.add(t)}r=i,n.set(t,r)}return r}function Ye(e,t,n){return Je(e,t).has(n)}var A,Xe,Ze,Qe,$e,et,tt;function nt(){return(nt=e((()=>{k(),A=`.`,Xe=`#`,Ze=[],Object.freeze(Ze),Qe=new WeakMap,$e=new WeakMap,et=new WeakMap,tt=new WeakMap})))()}function rt(){return{and:(...e)=>function(t){return e.every(e=>t.guard(e))},or:(...e)=>function(t){return e.some(e=>t.guard(e))},not:e=>function(t){return!t.guard(e)}}}function it(e){return Le(e),e}function at(){return(at=e((()=>{nt()})))()}var ot,st;function ct(){return(ct=e((()=>{ot=(e=>(e.NotStarted=`Not Started`,e.Started=`Started`,e.Stopped=`Stopped`,e))(ot||{}),st=`__init__`})))()}var lt,ut,dt;function ft(){return(ft=e((()=>{lt=Object.defineProperty,ut=(e,t,n)=>t in e?lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dt=(e,t,n)=>ut(e,typeof t==`symbol`?t:t+``,n)})))()}var pt,mt,ht,j,gt;function _t(){return(_t=e((()=>{pt=(e,t)=>e.map((n,r)=>e[(Math.max(t,0)+r)%e.length]),mt=()=>void 0,ht=e=>typeof e==`object`&&!!e,j=e=>e?``:void 0,gt=e=>e?`true`:void 0})))()}function vt(e){return[`html`,`body`,`#document`].includes(jt(e))}function yt(e){return e?Ct(e.getRootNode())===e:!1}function bt(e){if(e==null||!P(e))return!1;try{return Pt(e)&&e.selectionStart!=null||Lt.test(e.localName)||e.isContentEditable||e.getAttribute(`contenteditable`)===`true`||e.getAttribute(`contenteditable`)===``}catch{return!1}}function xt(e,t){if(!e||!t||!P(e)||!Mt(t))return!1;if(P(t)&&e===t||e.contains(t))return!0;let n=t.getRootNode?.();if(n&&Nt(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function M(e){return kt(e)?e:At(e)?e.document:e?.ownerDocument??document}function St(e){return M(e).documentElement}function N(e){return Nt(e)?N(e.host):kt(e)?e.defaultView??window:P(e)?e.ownerDocument?.defaultView??window:window}function Ct(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(!e||e===t)break;t=e}return t}function wt(e){if(jt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Nt(e)&&e.host||St(e);return Nt(t)?t.host:t}function Tt(e){let t;try{if(t=e.getRootNode({composed:!0}),kt(t)||Nt(t))return t}catch{}return e.ownerDocument??document}var Et,Dt,Ot,P,kt,At,jt,Mt,Nt,Pt,Ft,It,Lt;function F(){return(F=e((()=>{_t(),Et=1,Dt=9,Ot=11,P=e=>ht(e)&&e.nodeType===Et&&typeof e.nodeName==`string`,kt=e=>ht(e)&&e.nodeType===Dt,At=e=>ht(e)&&e===e.window,jt=e=>P(e)?e.localName||``:`#document`,Mt=e=>ht(e)&&e.nodeType!==void 0,Nt=e=>Mt(e)&&e.nodeType===Ot&&`host`in e,Pt=e=>P(e)&&e.localName===`input`,Ft=e=>!!e?.matches(`a[href]`),It=e=>P(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1,Lt=/(textarea|select)/})))()}function Rt(e){return zt.has(e)||zt.set(e,N(e).getComputedStyle(e)),zt.get(e)}var zt;function Bt(){return(Bt=e((()=>{F(),zt=new WeakMap})))()}function Vt(){return navigator.userAgentData?.platform??navigator.platform}function Ht(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}var Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt;function $t(){return($t=e((()=>{Ut=()=>typeof document<`u`,Wt=e=>Ut()&&e.test(Vt()),Gt=e=>Ut()&&e.test(Ht()),Kt=/^Mac/i,qt=/Firefox/i,Jt=/Android/i,Yt=()=>Ut()&&!!navigator.maxTouchPoints,Xt=()=>Wt(Kt),Zt=()=>Gt(qt),Qt=()=>Gt(Jt)})))()}function en(e,t){let n=new Set,r=Tt(e),i=e=>{let a=e.querySelectorAll(`[aria-controls]`);for(let e of a){if(e.getAttribute(`aria-expanded`)!==`true`)continue;let a=rn(e);for(let e of a){if(!e||n.has(e))continue;n.add(e);let a=r.getElementById(e);if(a){let e=a.getAttribute(`role`),n=a.getAttribute(`aria-modal`)===`true`;if(e&&nn(e)&&!n&&(a===t||a.contains(t)||i(a)))return!0}}}return!1};return i(e)}var tn,nn,rn;function an(){return(an=e((()=>{F(),tn=new Set([`menu`,`listbox`,`dialog`,`grid`,`tree`,`region`,`application`]),nn=e=>tn.has(e),rn=e=>e.getAttribute(`aria-controls`)?.split(` `)||[]})))()}function on(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function I(e){return on(e)?.[0]??e.target}function sn(e){let t=e.currentTarget;if(!t||!t.matches(`a[href], button[type='submit'], input[type='submit']`))return!1;let n=e.button===1,r=ln(e);return n||r}function cn(e){let t=e.currentTarget;if(!t)return!1;let n=t.localName;return e.altKey?n===`a`||n===`button`&&t.type===`submit`||n===`input`&&t.type===`submit`:!1}function ln(e){return Xt()?e.metaKey:e.ctrlKey}function un(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}function dn(e){return e.pointerType===``&&e.isTrusted?!0:Qt()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function fn(e,t={}){let{dir:n=`ltr`,orientation:r=`horizontal`}=t,i=e.key;return i=_n[i]??i,n===`rtl`&&r===`horizontal`&&i in vn&&(i=vn[i]),i}function pn(e,t=`client`){let n=gn(e)?e.touches[0]||e.changedTouches[0]:e;return{x:n[`${t}X`],y:n[`${t}Y`]}}var mn,hn,gn,_n,vn,yn;function bn(){return(bn=e((()=>{$t(),mn=e=>e.button===2||Xt()&&e.ctrlKey&&e.button===0,hn=e=>e.ctrlKey||e.altKey||e.metaKey,gn=e=>`touches`in e&&e.touches.length>0,_n={Up:`ArrowUp`,Down:`ArrowDown`,Esc:`Escape`," ":`Space`,",":`Comma`,Left:`ArrowLeft`,Right:`ArrowRight`},vn={ArrowLeft:`ArrowRight`,ArrowRight:`ArrowLeft`},yn=(e,t,n,r)=>{let i=typeof e==`function`?e():e;return i?.addEventListener(t,n,r),()=>{i?.removeEventListener(t,n,r)}}})))()}function L(e){let t=Cn.create();return t.request(e),t.cleanup}function xn(e){let t=new Set;function n(e){let n=globalThis.requestAnimationFrame(e);t.add(()=>globalThis.cancelAnimationFrame(n))}return n(()=>n(e)),function(){t.forEach(e=>e())}}function Sn(e,t,n){let r=L(()=>{e.removeEventListener(t,i,!0),n()}),i=()=>{r(),n()};return e.addEventListener(t,i,{once:!0,capture:!0}),r}var Cn;function wn(){return(wn=e((()=>{ft(),Cn=class e{constructor(){dt(this,`id`,null),dt(this,`fn_cleanup`),dt(this,`cleanup`,()=>{this.cancel()})}static create(){return new e}request(e){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=e?.()})}cancel(){this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),this.fn_cleanup?.(),this.fn_cleanup=void 0}isActive(){return this.id!==null}}})))()}function Tn(e){let t=e.getAttribute(`tabindex`);return t?parseInt(t,10):NaN}function En(e){return Pt(e)&&e.type===`radio`}function Dn(e){if(!En(e)||!e.name||e.checked)return!0;let t=`input[type="radio"][name="${CSS.escape(e.name)}"]`,n=e.form??e.ownerDocument,r=Array.from(n.querySelectorAll(t)).filter(t=>t.form===e.form&&An(t)),i=r.find(e=>e.checked);return i?i===e:r[0]===e}function On(e,t){if(!t)return null;if(t===!0)return e.shadowRoot||null;let n=t(e);return(n===!0?e.shadowRoot:n)||null}function kn(e,t,n){let r=[...e],i=[...e],a=new Set,o=new Map;e.forEach((e,t)=>o.set(e,t));let s=0;for(;s<i.length;){let e=i[s++];if(!e||a.has(e))continue;a.add(e);let c=On(e,t);if(c){let t=Array.from(c.querySelectorAll(In)).filter(n),a=o.get(e);if(a!==void 0){let e=a+1;r.splice(e,0,...t),t.forEach((t,n)=>{o.set(t,e+n)});for(let n=e+t.length;n<r.length;n++)o.set(r[n],n)}else{let e=r.length;r.push(...t),t.forEach((t,n)=>{o.set(t,e+n)})}i.push(...t)}}return r}function An(e){return!P(e)||e.closest(`[inert]`)?!1:e.matches(In)&&It(e)}function jn(e,t={}){if(!e)return[];let{includeContainer:n,getShadowRoot:r}=t,i=Array.from(e.querySelectorAll(In));n&&Mn(e)&&i.unshift(e);let a=[];for(let e of i)if(Mn(e)){if(Pn(e)&&e.contentDocument){let t=e.contentDocument.body;a.push(...jn(t,{getShadowRoot:r}))}else a.push(e)}if(r){let e=kn(a,r,Mn);return!e.length&&n?i:e}return!a.length&&n?i:a}function Mn(e){return P(e)&&e.tabIndex>0?!0:!An(e)||Fn(e)?!1:Dn(e)}function Nn(e,t={}){let n=jn(e,t);return[n[0]||null,n[n.length-1]||null]}var Pn,Fn,In;function Ln(){return(Ln=e((()=>{F(),Pn=e=>P(e)&&e.tagName===`IFRAME`,Fn=e=>Tn(e)<0,In=`input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type`})))()}function Rn(e){let{root:t,getInitialEl:n,filter:r,enabled:i=!0}=e;if(!i)return;let a=typeof n==`function`?n():n;return a||=t?.querySelector(`[data-autofocus],[autofocus]`),a||=jn(t).filter(e=>!r||r(e)).find(e=>!e.hasAttribute(`data-no-autofocus`)),a||t||void 0}function zn(e){let t=e.currentTarget;if(!t)return!1;let[n,r]=Nn(t);return!(yt(n)&&e.shiftKey||yt(r)&&!e.shiftKey||!n&&!r)}function Bn(){return(Bn=e((()=>{F(),Ln()})))()}function Vn(e,t){if(!e)return;let{attributes:n,callback:r}=t,i=new(e.ownerDocument.defaultView||window).MutationObserver(e=>{for(let t of e)t.type===`attributes`&&t.attributeName&&n.includes(t.attributeName)&&r(t)});return i.observe(e,{attributes:!0,attributeFilter:n}),()=>i.disconnect()}function Hn(e,t){let{defer:n}=t,r=n?L:e=>e(),i=[];return i.push(r(()=>{let n=typeof e==`function`?e():e;i.push(Vn(n,t))})),()=>{i.forEach(e=>e?.())}}function Un(){return(Un=e((()=>{wn()})))()}function Wn(e){let t=()=>{let t=N(e);e.dispatchEvent(new t.MouseEvent(`click`))};Zt()?Sn(e,`keyup`,t):queueMicrotask(t)}function Gn(){return(Gn=e((()=>{F(),$t(),wn()})))()}function Kn(e){let t=wt(e);return vt(t)?M(t).body:P(t)&&qn(t)?t:Kn(t)}function qn(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=N(e).getComputedStyle(e);return Jn.test(t+r+n)&&!Yn.has(i)}var Jn,Yn;function Xn(){return(Xn=e((()=>{F(),Jn=/auto|scroll|overlay|hidden|clip/,Yn=new Set([`inline`,`contents`])})))()}function Zn(e,t,n=$n){return e.find(e=>n(e)===t)}function Qn(e,t,n=$n){let r=Zn(e,t,n);return r?e.indexOf(r):-1}var $n;function er(){return(er=e((()=>{$n=e=>e.id})))()}function tr(e){return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth}function nr(e,t){let{rootEl:n,...r}=t||{};e&&n&&qn(n)&&tr(n)&&e.scrollIntoView(r)}function rr(){return(rr=e((()=>{Xn()})))()}function ir(e,t,n,r=$n){let i=n?Qn(e,n,r):-1,a=n?pt(e,i):e;return t.length===1&&(a=a.filter(e=>r(e)!==n)),a.find(e=>sr(or(e),t))}var ar,or,sr;function cr(){return(cr=e((()=>{er(),_t(),ar=e=>e.split(``).map(e=>{let t=e.charCodeAt(0);return t>0&&t<128?e:t>=128&&t<=255?`/x${t.toString(16)}`.replace(`/`,`\\`):``}).join(``).trim(),or=e=>ar(e.dataset?.valuetext??e.textContent??``),sr=(e,t)=>e.trim().toLowerCase().startsWith(t.toLowerCase())})))()}function lr(e,t){if(!e)return mt;let n=Object.keys(t).reduce((t,n)=>(t[n]=e.style.getPropertyValue(n),t),{});return ur(n,t)?mt:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute(`style`)})}function ur(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function dr(){return(dr=e((()=>{_t()})))()}function fr(e,t){let{state:n,activeId:r,key:i,timeout:a=350,itemToId:o}=t,s=n.keysSoFar+i,c=s.length>1&&Array.from(s).every(e=>e===s[0])?s[0]:s,l=ir(e.slice(),c,r,o);function u(){clearTimeout(n.timer),n.timer=-1}function d(e){n.keysSoFar=e,u(),e!==``&&(n.timer=+setTimeout(()=>{d(``),u()},a))}return d(s),l}function pr(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var mr;function hr(){return(hr=e((()=>{cr(),mr=Object.assign(fr,{defaultOptions:{keysSoFar:``,timer:-1},isValidEvent:pr})})))()}function gr(e,t,n){let{signal:r}=t;return[new Promise((t,i)=>{let a=setTimeout(()=>{i(Error(`Timeout of ${n}ms exceeded`))},n);r.addEventListener(`abort`,()=>{clearTimeout(a),i(new DOMException(`Promise aborted`,`AbortError`))}),e.then(e=>{r.aborted||(clearTimeout(a),t(e))}).catch(e=>{r.aborted||(clearTimeout(a),i(e))})}),()=>t.abort()]}function _r(e,t){let{timeout:n,rootNode:r}=t,i=N(r),a=M(r),o=new i.AbortController;return gr(new Promise(t=>{let n=e();if(n){t(n);return}let r=new i.MutationObserver(()=>{let n=e();n&&n.isConnected&&(r.disconnect(),t(n))});r.observe(a.body,{childList:!0,subtree:!0})}),o,n)}function vr(){return(vr=e((()=>{F()})))()}function yr(e,t,n={}){let{defer:r,onMissing:i}=n,a=()=>typeof e==`function`?e():e,o=[],s=e=>{if(!e)return i?.();o.push(t(e))};if(!r)s(a());else{let e=!1;o.push(()=>{e=!0}),queueMicrotask(()=>{if(e)return;let t=a();t?s(t):o.push(L(()=>{e||s(a())}))})}return(...e)=>{o.forEach(t=>t?.(...e))}}function br(){return(br=e((()=>{wn()})))()}function xr(e){let t=()=>e.getRootNode?.()??document,n=()=>M(t()),r=()=>n().defaultView??window,i=()=>Ct(t()),a=e=>t().getElementById(e),o=e=>t().querySelector(e)??null,s=e=>Array.from(t().querySelectorAll(e)),c=t=>`[${t.attr}="${e.id}"]`;return{...e,getRootNode:t,getDoc:n,getWin:r,getActiveElement:i,isActiveElement:yt,getById:a,query:o,queryAll:s,selector:c}}function Sr(){return(Sr=e((()=>{F()})))()}function Cr(e,t){return{[Tr]:!0,deps:e,setup:t}}function wr(e){return typeof e==`object`&&!!e&&Tr in e}var Tr;function Er(){return(Er=e((()=>{Tr=Symbol.for(`zag.watchEffect`)})))()}function Dr(e){let t={each(t){for(let n=0;n<e.frames?.length;n+=1){let r=e.frames[n];r&&t(r)}},addEventListener(e,n,r){return t.each(t=>{try{t.document.addEventListener(e,n,r)}catch{}}),()=>{try{t.removeEventListener(e,n,r)}catch{}}},removeEventListener(e,n,r){t.each(t=>{try{t.document.removeEventListener(e,n,r)}catch{}})}};return t}function Or(e){let t=e.frameElement==null?null:e.parent;return{addEventListener:(e,n,r)=>{try{t?.addEventListener(e,n,r)}catch{}return()=>{try{t?.removeEventListener(e,n,r)}catch{}}},removeEventListener:(e,n,r)=>{try{t?.removeEventListener(e,n,r)}catch{}}}}function kr(e){for(let t of e)if(P(t)&&An(t))return!0;return!1}function Ar(e,t){if(!Rr(t)||!e)return!1;let n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function jr(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Mr(e,t){if(!t||!Rr(e))return!1;let n=t.scrollHeight>t.clientHeight,r=n&&e.clientX>t.offsetLeft+t.clientWidth,i=t.scrollWidth>t.clientWidth,a=i&&e.clientY>t.offsetTop+t.clientHeight;return jr({x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(i?16:0)},{x:e.clientX,y:e.clientY})?r||a:!1}function Nr(e,t){let{exclude:n,onFocusOutside:r,onPointerDownOutside:i,onInteractOutside:a,defer:o,followControlledElements:s=!0}=t;if(!e)return;let c=M(e),l=N(e),u=Dr(l),d=Or(l);function f(t,r){if(!P(r)||!r.isConnected||xt(e,r)||Ar(e,t)||s&&en(e,r))return!1;let i=c.querySelector(`[aria-controls~="${e.id}"]`);return i&&Mr(t,Kn(i))||Mr(t,Kn(e))?!1:!n?.(r)}let p=new Set,m=Nt(e?.getRootNode()),h=!1;function g(t){h=!0;let n=()=>{h=!1};c.addEventListener(`pointerup`,n,{once:!0}),l.addEventListener(`pointerup`,n,{once:!0});function r(n){let r=o&&!Yt()?L:e=>e(),s=n??t,c=s?.composedPath?.()??[s?.target];r(()=>{let n=m?c[0]:I(t);if(e&&f(t,n)){if(i||a){let t=he(i,a);e.addEventListener(Ir,t,{once:!0})}Fr(e,Ir,{bubbles:!1,cancelable:!0,detail:{originalEvent:s,contextmenu:mn(s),focusable:kr(c),target:n}})}})}t.pointerType===`touch`?(p.forEach(e=>e()),p.add(yn(c,`click`,r,{once:!0})),p.add(d.addEventListener(`click`,r,{once:!0})),p.add(u.addEventListener(`click`,r,{once:!0}))):r()}let _=new Set,v=setTimeout(()=>{_.add(yn(c,`pointerdown`,g,!0)),_.add(d.addEventListener(`pointerdown`,g,!0)),_.add(u.addEventListener(`pointerdown`,g,!0))},0);function y(t){h||(o?L:e=>e())(()=>{let n=t?.composedPath?.()??[t?.target],i=m?n[0]:I(t);if(e&&f(t,i)){if(r||a){let t=he(r,a);e.addEventListener(Lr,t,{once:!0})}Fr(e,Lr,{bubbles:!1,cancelable:!0,detail:{originalEvent:t,contextmenu:!1,focusable:An(i),target:i}})}})}return Yt()||(_.add(yn(c,`focusin`,y,!0)),_.add(d.addEventListener(`focusin`,y,!0)),_.add(u.addEventListener(`focusin`,y,!0))),()=>{clearTimeout(v),p.forEach(e=>e()),_.forEach(e=>e())}}function Pr(e,t){let{defer:n}=t,r=n?L:e=>e(),i=[];return i.push(r(()=>{let n=typeof e==`function`?e():e;i.push(Nr(n,t))})),()=>{i.forEach(e=>e?.())}}function Fr(e,t,n){let r=new(e.ownerDocument.defaultView||window).CustomEvent(t,n);return e.dispatchEvent(r)}var Ir,Lr,Rr;function zr(){return(zr=e((()=>{bn(),F(),$t(),Xn(),an(),Ln(),wn(),ge(),Ir=`pointerdown.outside`,Lr=`focus.outside`,Rr=e=>`clientY`in e})))()}function Br(e,t){return yn(M(e),`keydown`,e=>{e.key===`Escape`&&(e.isComposing||t?.(e))},{capture:!0})}function Vr(){return(Vr=e((()=>{bn(),F()})))()}function Hr(e){let t=e.pointerBlocking;return typeof t==`function`?t():!!t}function Ur(e,t){e.snapshot=t,e.onLayerChange?.(t)}function Wr(e,t,n){let r=new(e.ownerDocument.defaultView||window).CustomEvent(t,{cancelable:!0,bubbles:!0,detail:n});return e.dispatchEvent(r)}function Gr(e,t,n){e.addEventListener(t,n,{once:!0})}var Kr,qr,R;function Jr(){return(Jr=e((()=>{F(),wn(),E(),Kr=`layer:request-dismiss`,qr=0,R={layers:[],branches:[],recentlyRemoved:new Set,pendingReattach:new Map,count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(Hr)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){return this.indexOf(e)<(this.topMostPointerBlockingLayer()?this.indexOf(this.topMostPointerBlockingLayer()?.node):-1)},isTopMost(e){return this.layers[this.count()-1]?.node===e},layerFor(e){return this.layers.find(t=>t.node===e)},peerFor(e){for(let t=this.count()-1;t>=0;t--)if(this.layers[t].group===e)return this.layers[t]},isDescendantOf(e,t){if(!t)return!1;let n=new Set,r=e.parentId;for(;r&&!n.has(r);){if(r===t)return!0;n.add(r),r=this.layers.find(e=>e.id===r)?.parentId}return!1},depthOf(e){let t=new Set,n=0,r=e.parentId;for(;r&&!t.has(r);)n++,t.add(r),r=this.layers.find(e=>e.id===r)?.parentId;return n},getNestedLayers(e){let t=this.layerFor(e)?.id;return t?this.layers.filter(e=>this.isDescendantOf(e,t)).sort((e,t)=>this.depthOf(e)-this.depthOf(t)):[]},getLayersByType(e){return this.layers.filter(t=>t.type===e)},getNestedLayersByType(e,t){return this.getNestedLayers(e).filter(e=>e.type===t)},getParentLayerOfType(e,t){let n=new Set,r=this.layerFor(e)?.parentId;for(;r&&!n.has(r);){let e=this.layers.find(e=>e.id===r);if(!e)return;if(e.type===t)return e;n.add(r),r=e.parentId}},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return!!(this.getNestedLayers(e).some(e=>xt(e.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>xt(t,e))},add(e){let t=this.indexOf(e.node),n=t===-1?void 0:this.layers[t],r=this.pendingReattach.get(e.node);if(n)e.id??=n.id,e.parentId=n.parentId;else if(r)e.id??=r.id,e.parentId=r.parentId;else{e.id??=`layer-${++qr}`;let t=e.group?this.peerFor(e.group):void 0;e.parentId=t?t.parentId:e.parentId??this.layers[this.count()-1]?.id}t!==-1&&this.layers.splice(t,1),r?(this.pendingReattach.delete(e.node),this.layers.splice(Math.min(r.index,this.count()),0,e)):this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e,t){let n=this.indexOf(e);if(n<0)return;let r=this.layers[n];t?.reattach?this.pendingReattach.set(e,{id:r.id,parentId:r.parentId,index:n}):(this.recentlyRemoved.add(e),xn(()=>this.recentlyRemoved.delete(e)),this.getNestedLayers(e).forEach(t=>R.dismiss(t.node,e))),this.layers.splice(n,1),r.snapshot&&Ur(r,{...r.snapshot,active:!1,blocked:!1}),this.syncLayers()},removeBranch(e){let t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},syncLayers(){this.layers.forEach((e,t)=>{let n=R.getParentLayerOfType(e.node,e.type),r=R.countNestedLayersOfType(e.node,e.type),i={active:!0,type:e.type,index:t,nested:n!=null,hasNested:r>0,nestedCount:r,blocked:R.isBelowPointerBlockingLayer(e.node)};T(e.snapshot,i)||Ur(e,i)})},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e,t){let n=this.indexOf(e);if(n===-1)return;let r=this.layers[n];Gr(e,Kr,e=>{r.requestDismiss?.(e),e.defaultPrevented||r?.dismiss()}),Wr(e,Kr,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}}})))()}function Yr(e){let t=e.body;if(!t)return;let n=R.hasPointerBlockingLayer();n!==t.hasAttribute(`data-inert`)&&(n?(Zr.set(t,t.style.pointerEvents),queueMicrotask(()=>{R.hasPointerBlockingLayer()&&(t.style.pointerEvents=`none`,t.setAttribute(`data-inert`,``))})):queueMicrotask(()=>{if(R.hasPointerBlockingLayer())return;let e=Zr.get(t);e!==void 0&&(t.style.pointerEvents=e,Zr.delete(t)),t.removeAttribute(`data-inert`),t.style.length===0&&t.removeAttribute(`style`)}))}function Xr(e,t){let n=M(e),r=[];return Yr(n),t?.forEach(e=>{let[t,n]=_r(()=>{let t=e();return P(t)?t:null},{timeout:1e3});t.then(e=>r.push(lr(e,{pointerEvents:`auto`}))),r.push(n)}),()=>{Yr(n),r.forEach(e=>e())}}var Zr;function Qr(){return(Qr=e((()=>{F(),dr(),vr(),Jr(),Zr=new WeakMap})))()}function $r(e,t){let{onDismiss:n,onRequestDismiss:r,pointerBlocking:i,exclude:a,debug:o,type:s=`dialog`,group:c,onLayerChange:l}=t,u={dismiss:n,node:e,type:s,group:c,pointerBlocking:i,requestDismiss:r,onLayerChange:l};R.add(u);function d(r){let i=I(r.detail.originalEvent);R.isBelowPointerBlockingLayer(e)||R.isInBranch(i)||(t.onPointerDownOutside?.(r),t.onInteractOutside?.(r),!r.defaultPrevented&&(o&&console.log(`onPointerDownOutside:`,r.detail.originalEvent),n?.()))}function f(e){let r=I(e.detail.originalEvent);R.isInBranch(r)||(t.onFocusOutside?.(e),t.onInteractOutside?.(e),!e.defaultPrevented&&(o&&console.log(`onFocusOutside:`,e.detail.originalEvent),n?.()))}function p(r){R.isTopMost(e)&&(t.onEscapeKeyDown?.(r),!r.defaultPrevented&&n&&(r.preventDefault(),n()))}function m(n){let r=typeof a==`function`?a():a,i=Array.isArray(r)?r:[r],o=t.persistentElements?.map(e=>e()).filter(P);return o&&i.push(...o),i.some(e=>xt(e,n))||R.isInNestedLayer(e,n)}let h=[Hr(u)?Xr(e,t.persistentElements):void 0,Br(e,p),Pr(e,{exclude:m,onFocusOutside:f,onPointerDownOutside:d,defer:t.defer})];return t=>{R.remove(e,{reattach:t===`restart`}),h.forEach(e=>e?.())}}function ei(e,t){let{warnOnMissingNode:n=!0}=t;return yr(e,e=>$r(e,t),{defer:t.defer,onMissing:n?()=>ye("[@zag-js/dismissable] node is `null` or `undefined`"):void 0})}function ti(){return(ti=e((()=>{F(),bn(),br(),zr(),Vr(),Jr(),Qr()})))()}function ni(e){return{"data-nested":e?.active&&e.nested?e.type:void 0,"data-has-nested":e?.active&&e.hasNested?e.type:void 0}}function ri(e,t={}){let n=e?.active===!0,r={"--layer-index":n?`${e.index}`:void 0,"--nested-layer-count":n?`${e.nestedCount}`:void 0,"--z-index":t.zIndex&&n?`var(--layer-index)`:void 0};return t.pointerEvents&&(r.pointerEvents=n?e.blocked?`none`:`auto`:void 0),r}function ii(e){return!(e.metaKey||!Xt()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function ai(e,t,n){let r=n?I(n):null,i=M(r),a=N(r),o=Ct(i);return e=e||o instanceof a.HTMLInputElement&&!gi.has(o?.type)||o instanceof a.HTMLTextAreaElement||o instanceof a.HTMLElement&&o.isContentEditable,!(e&&t===`keyboard`&&n instanceof a.KeyboardEvent&&!Reflect.has(Ci,n.key))}function oi(e,t){for(let n of vi)n(e,t)}function si(e){V=null,bi=!0,ii(e)&&(B=`keyboard`,oi(`keyboard`,e))}function z(e){(e.type!==`pointermove`&&e.type!==`mousemove`||!e.isTrusted||Si?.x!==e.clientX||Si?.y!==e.clientY)&&(Si={x:e.clientX,y:e.clientY},B=`pointer`,(e.type===`mousedown`||e.type===`pointerdown`)&&(V=null,bi=!0,oi(`pointer`,e)))}function ci(e){if(dn(e)){V=null,bi=!0,B=`virtual`;return}V=null;let t=I(e),n=t?.closest(`label`),r=n?.control;if(!n||!r||r.matches(`:disabled`))return;let i=t?.closest(_i);i&&n.contains(i)&&i!==r||r!==Ct(n.ownerDocument)&&(V=r)}function li(e){let t=I(e),n=t===V;At(t)?xi=!0:!kt(t)&&e.isTrusted&&(!bi&&!n&&!xi&&(B=`virtual`,oi(`virtual`,e)),bi=!1,V=null,xi=!1)}function ui(){bi=!1,V=null,xi=!0}function di(e){if(typeof window>`u`||yi.get(N(e)))return;let t=N(e),n=M(e),r=t.HTMLElement.prototype.focus;function i(){bi=!0,r.apply(this,arguments)}try{Object.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,value:i})}catch{}n.addEventListener(`keydown`,si,!0),n.addEventListener(`keyup`,si,!0),n.addEventListener(`click`,ci,!0),t.addEventListener(`focus`,li,!0),t.addEventListener(`blur`,ui,!1),t.PointerEvent===void 0?(n.addEventListener(`mousedown`,z,!0),n.addEventListener(`mousemove`,z,!0),n.addEventListener(`mouseup`,z,!0)):(n.addEventListener(`pointerdown`,z,!0),n.addEventListener(`pointermove`,z,!0),n.addEventListener(`pointerup`,z,!0)),t.addEventListener(`beforeunload`,()=>{wi(e)},{once:!0}),yi.set(t,{focus:r})}function fi(){return B}function pi(e){B=e,oi(e,null)}function mi(){return B===`keyboard`||B===`virtual`}function hi(e={}){let{isTextInput:t,autoFocus:n,onChange:r,root:i}=e;di(i),r?.({isFocusVisible:n||mi(),modality:B});let a=(e,n)=>{ai(!!t,e,n)&&r?.({isFocusVisible:mi(),modality:e})};return vi.add(a),()=>{vi.delete(a)}}var gi,_i,B,vi,yi,bi,V,xi,Si,Ci,wi;function Ti(){return(Ti=e((()=>{F(),bn(),$t(),gi=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]),_i=[`a[href]`,`audio[controls]`,`button`,`details`,`embed`,`iframe`,`img[controls]`,`img[usemap]`,`input`,`select`,`textarea`,`video[controls]`].join(`,`),B=null,vi=new Set,yi=new Map,bi=!1,V=null,xi=!1,Si=null,Ci={Tab:!0,Escape:!0},wi=(e,t)=>{let n=N(e),r=M(e);t&&r.removeEventListener(`DOMContentLoaded`,t);let i=yi.get(n);if(i){try{Object.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,value:i.focus})}catch{}r.removeEventListener(`keydown`,si,!0),r.removeEventListener(`keyup`,si,!0),r.removeEventListener(`click`,ci,!0),n.removeEventListener(`focus`,li,!0),n.removeEventListener(`blur`,ui,!1),n.PointerEvent===void 0?(r.removeEventListener(`mousedown`,z,!0),r.removeEventListener(`mousemove`,z,!0),r.removeEventListener(`mouseup`,z,!0)):(r.removeEventListener(`pointerdown`,z,!0),r.removeEventListener(`pointermove`,z,!0),r.removeEventListener(`pointerup`,z,!0)),yi.delete(n)}}})))()}function Ei(e,t,n){return U(e,Ui(t,n))}function Di(e,t){return typeof e==`function`?e(t):e}function Oi(e){return e.split(`-`)[0]}function ki(e){return e.split(`-`)[1]}function Ai(e){return e===`x`?`y`:`x`}function ji(e){return e===`y`?`height`:`width`}function H(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Mi(e){return Ai(H(e))}function Ni(e,t,n){n===void 0&&(n=!1);let r=ki(e),i=Mi(e),a=ji(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ri(o)),[o,Ri(o)]}function Pi(e){let t=Ri(e);return[Fi(e),t,Fi(t)]}function Fi(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}function Ii(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ji:qi:t?qi:Ji;case`left`:case`right`:return t?Yi:Xi;default:return[]}}function Li(e,t,n,r){let i=ki(e),a=Ii(Oi(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Fi)))),a}function Ri(e){let t=Oi(e);return Ki[t]+e.slice(t.length)}function zi(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Bi(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:zi(e)}function Vi(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}var Hi,Ui,U,Wi,Gi,W,Ki,qi,Ji,Yi,Xi;function Zi(){return(Zi=e((()=>{Hi=[`top`,`right`,`bottom`,`left`],Ui=Math.min,U=Math.max,Wi=Math.round,Gi=Math.floor,W=e=>({x:e,y:e}),Ki={left:`right`,right:`left`,bottom:`top`,top:`bottom`},qi=[`left`,`right`],Ji=[`right`,`left`],Yi=[`top`,`bottom`],Xi=[`bottom`,`top`]})))()}function Qi(e,t,n){let{reference:r,floating:i}=e,a=H(t),o=Mi(t),s=ji(o),c=Oi(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=ki(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function $i(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Di(t,e),p=Bi(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Vi(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Vi(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}function ea(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ta(e){return Hi.some(t=>e[t]>=0)}async function na(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Oi(n),s=ki(n),c=H(n)===`y`,l=ca.has(o)?-1:1,u=a&&c?-1:1,d=Di(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ra,ia,aa,oa,sa,ca,la,ua,da,fa;function pa(){return(pa=e((()=>{Zi(),ra=50,ia=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:$i},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Qi(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ra&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Qi(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},aa=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Di(e,t)||{};if(l==null)return{};let d=Bi(u),f={x:n,y:r},p=Mi(i),m=ji(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Ui(d[_],T),ee=Ui(d[v],T),te=C-h[m]-ee,D=C/2-h[m]/2+w,O=Ei(E,D,te),ne=!c.arrow&&ki(i)!=null&&D!==O&&a.reference[m]/2-(D<E?E:ee)-h[m]/2<0,re=ne?D<E?D-E:D-te:0;return{[p]:f[p]+re,data:{[p]:O,centerOffset:D-O-re,...ne&&{alignmentOffset:re}},reset:ne}}}),oa=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Di(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Oi(r),_=H(o),v=Oi(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ri(o)]:Pi(o)),x=p!==`none`;!d&&x&&b.push(...Li(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ni(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===H(t)||T.every(e=>H(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=H(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},sa=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Di(e,t);switch(i){case`referenceHidden`:{let e=ea(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ta(e)}}}case`escaped`:{let e=ea(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ta(e)}}}default:return{}}}}},ca=new Set([`left`,`top`]),la=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await na(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ua=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Di(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=H(i),p=Ai(f),m=u[p],h=u[f],g=(e,t)=>Ei(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},da=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Di(e,t),u={x:n,y:r},d=H(i),f=Ai(d),p=u[f],m=u[d],h=Di(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=ca.has(Oi(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},fa=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Di(e,t),c=await i.detectOverflow(t,s),l=Oi(n),u=ki(n),d=H(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Ui(p-c[m],g),y=Ui(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*U(c.left,c.right):S=p-2*U(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}}})))()}function ma(){return typeof window<`u`}function ha(e){return _a(e)?(e.nodeName||``).toLowerCase():`#document`}function G(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ga(e){return((_a(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function _a(e){return ma()?e instanceof Node||e instanceof G(e).Node:!1}function K(e){return ma()?e instanceof Element||e instanceof G(e).Element:!1}function va(e){return ma()?e instanceof HTMLElement||e instanceof G(e).HTMLElement:!1}function ya(e){return!ma()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof G(e).ShadowRoot}function ba(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function xa(e){return/^(table|td|th)$/.test(ha(e))}function Sa(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}function Ca(e){let t=K(e)?q(e):e;return Pa(t.transform)||Pa(t.translate)||Pa(t.scale)||Pa(t.rotate)||Pa(t.perspective)||!Ta()&&(Pa(t.backdropFilter)||Pa(t.filter))||Ma.test(t.willChange||``)||Na.test(t.contain||``)}function wa(e){let t=Oa(e);for(;va(t)&&!Ea(t);){if(Ca(t))return t;if(Sa(t))return null;t=Oa(t)}return null}function Ta(){return Fa??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Fa}function Ea(e){return/^(html|body|#document)$/.test(ha(e))}function q(e){return G(e).getComputedStyle(e)}function Da(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Oa(e){if(ha(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ya(e)&&e.host||ga(e);return ya(t)?t.host:t}function ka(e){let t=Oa(e);return Ea(t)?(e.ownerDocument||e).body:va(t)&&ba(t)?t:ka(t)}function Aa(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ka(e),i=r===e.ownerDocument?.body,a=G(r);if(i){let e=ja(a);return t.concat(a,a.visualViewport||[],ba(r)?r:[],e&&n?Aa(e):[])}return t.concat(r,Aa(r,[],n))}function ja(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Ma,Na,Pa,Fa;function Ia(){return(Ia=e((()=>{Ma=/transform|translate|scale|rotate|perspective|filter/,Na=/paint|layout|strict|content/,Pa=e=>!!e&&e!==`none`})))()}function La(e){let t=q(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=va(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Wi(n)!==a||Wi(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ra(e){return K(e)?e:e.contextElement}function za(e){let t=Ra(e);if(!va(t))return W(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=La(t),o=(a?Wi(n.width):n.width)/r,s=(a?Wi(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}function Ba(e){let t=G(e);return!Ta()||!t.visualViewport?co:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Va(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===G(e)}function Ha(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ra(e),o=W(1);t&&(r?K(r)&&(o=za(r)):o=za(e));let s=Va(a,n,r)?Ba(a):W(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=G(a),t=K(r)?G(r):r,n=e,i=ja(n);for(;i&&t!==n;){let e=za(i),t=i.getBoundingClientRect(),r=q(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=G(i),i=ja(n)}}return Vi({width:u,height:d,x:c,y:l})}function Ua(e,t){let n=Da(e).scrollLeft;return t?t.left+n:Ha(ga(e)).left+n}function Wa(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ua(e,n),y:n.top+t.scrollTop}}function Ga(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ga(r),s=t?Sa(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=W(1),u=W(0),d=va(r);if((d||!a)&&((ha(r)!==`body`||ba(o))&&(c=Da(r)),d)){let e=Ha(r);l=za(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Wa(o,c):W(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ka(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function qa(e){let t=Da(e),n=e.ownerDocument.body,r=U(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=U(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Ua(e),o=-t.scrollTop;return q(n).direction===`rtl`&&(a+=U(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}function Ja(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=G(e),a=ga(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ta()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Ua(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=lo&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ya(e,t){let n=Ha(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=za(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Xa(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ja(e,n,t);else if(t===`document`)r=qa(ga(e));else if(K(t))r=Ya(t,n);else{let n=Ba(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Vi(r)}function Za(e,t){let n=t.get(e);if(n)return n;let r=Aa(e,[],!1).filter(e=>K(e)&&ha(e)!==`body`),i=null,a=q(e).position===`fixed`,o=a?Oa(e):e;for(;K(o)&&!Ea(o);){let e=q(o),t=Ca(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Oa(o)}return t.set(e,r),r}function Qa(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Sa(t)?[]:Za(t,this._c):[].concat(n),r],o=Xa(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Xa(t,a[e],i);s=U(n.top,s),c=Ui(n.right,c),l=Ui(n.bottom,l),u=U(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $a(e){let{width:t,height:n}=La(e);return{width:t,height:n}}function eo(e,t,n){let r=va(t),i=ga(t),a=n===`fixed`,o=Ha(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=W(0);if((r||!a)&&((ha(t)!==`body`||ba(i))&&(s=Da(t)),r)){let e=Ha(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Ua(i));let l=i&&!r&&!a?Wa(i,s):W(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function to(e){return q(e).position===`static`}function no(e,t){if(!va(e)||q(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ga(e)===n&&(n=n.ownerDocument.body),n}function ro(e,t){let n=G(e);if(Sa(e))return n;if(!va(e)){let t=Oa(e);for(;t&&!Ea(t);){if(K(t)&&!to(t))return t;t=Oa(t)}return n}let r=no(e,t);for(;r&&xa(r)&&to(r);)r=no(r,t);return r&&Ea(r)&&to(r)&&!Ca(r)?n:r||wa(e)||n}function io(e){return q(e).direction===`rtl`}function ao(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function oo(e,t,n){let r=null,i,a=ga(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Gi(d),h=Gi(a.clientWidth-(u+f)),g=Gi(a.clientHeight-(d+p)),_=Gi(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:U(0,Ui(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!ao(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=G(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function so(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ra(e),u=i||a?[...l?Aa(l):[],...t?Aa(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?oo(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ha(e):null;c&&g();function g(){let t=Ha(e);h&&!ao(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var co,lo,uo,fo,po,mo,ho,go,_o,vo,yo,bo;function xo(){return(xo=e((()=>{pa(),Zi(),Ia(),co=W(0),lo=25,uo=async function(e){let t=this.getOffsetParent||ro,n=this.getDimensions,r=await n(e.floating);return{reference:eo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},fo={convertOffsetParentRelativeRectToViewportRelativeRect:Ga,getDocumentElement:ga,getClippingRect:Qa,getOffsetParent:ro,getElementRects:uo,getClientRects:Ka,getDimensions:$a,getScale:za,isElement:K,isRTL:io},po=la,mo=ua,ho=oa,go=fa,_o=sa,vo=aa,yo=da,bo=(e,t,n)=>{let r=new Map,i=n??{},a={...fo,...i.platform,_c:r};return ia(e,t,{...i,platform:a})}})))()}function So(e=0,t=0,n=0,r=0){if(typeof DOMRect==`function`)return new DOMRect(e,t,n,r);let i={x:e,y:t,width:n,height:r,top:t,right:e+n,bottom:t+r,left:e};return{...i,toJSON:()=>i}}function Co(e){if(!e)return So();let{x:t,y:n,width:r,height:i}=e;return So(t,n,r,i)}function wo(e,t){let n=()=>{let n=e,r=t?.(n);return r||!n?Co(r):n.getBoundingClientRect()};return{contextElement:P(e)?e:e?.contextElement,getBoundingClientRect:n,getClientRects:()=>P(e)&&!t?e.getClientRects():[n()]}}function To(){return(To=e((()=>{F()})))()}function Eo(e,t){return{name:`transformOrigin`,fn(n){let{elements:r,middlewareData:i,placement:a,rects:o,y:s}=n,c=a.split(`-`)[0],l=Oo(c),u=i.arrow?.x||0,d=i.arrow?.y||0,f=t?.clientWidth||0,p=t?.clientHeight||0,m=u+f/2,h=d+p/2,g=Math.abs(i.shift?.y||0),_=o.reference.height/2,v=p/2,y=e.offset?.mainAxis??e.gutter,b=typeof y==`number`?y+v:y??v,x=g>b,S={top:`${m}px calc(100% + ${b}px)`,bottom:`${m}px ${-b}px`,left:`calc(100% + ${b}px) ${h}px`,right:`${-b}px ${h}px`}[c],C=`${m}px ${o.reference.y+_-s}px`,w=!!e.overlap&&l===`y`&&x;return r.floating.style.setProperty(J.transformOrigin.variable,w?C:S),{data:{transformOrigin:w?C:S}}}}}var Do,J,Oo,ko,Ao;function jo(){return(jo=e((()=>{Do=e=>({variable:e,reference:`var(${e})`}),J={arrowSize:Do(`--arrow-size`),arrowSizeHalf:Do(`--arrow-size-half`),arrowBg:Do(`--arrow-background`),transformOrigin:Do(`--transform-origin`),arrowOffset:Do(`--arrow-offset`)},Oo=e=>e===`top`||e===`bottom`?`y`:`x`,ko={name:`rects`,fn({rects:e}){return{data:e}}},Ao=e=>{if(e)return{name:`shiftArrow`,fn({placement:t,middlewareData:n}){if(!n.arrow)return{};let{x:r,y:i}=n.arrow,a=t.split(`-`)[0];return Object.assign(e.style,{left:r==null?``:`${r}px`,top:i==null?``:`${i}px`,[a]:`calc(100% + ${J.arrowOffset.reference})`}),{}}}}})))()}function Mo(e){let[t,n]=e.split(`-`);return{side:t,align:n,hasAlign:n!=null}}function No(e){return e.split(`-`)[0]}function Po(e,t){let n=e.devicePixelRatio||1;return Math.round(t*n)/n}function Fo(e,t){return e!=null&&Math.abs(e-t)<.5}function Io(e){return typeof e==`function`?e():e===`clipping-ancestors`?`clippingAncestors`:e}function Lo(e,t,n){let r=e||t.createElement(`div`);return vo({element:r,padding:n.arrowPadding})}function Ro(e,t){if(!ne(t.offset??t.gutter))return po(({placement:n})=>{let r=(e?.clientHeight||0)/2,i=t.offset?.mainAxis??t.gutter,a=typeof i==`number`?i+r:i??r,{hasAlign:o}=Mo(n),s=o?void 0:t.shift;return _e({crossAxis:t.offset?.crossAxis??s,mainAxis:a,alignmentAxis:t.shift})})}function zo(e){if(e.flip)return ho(()=>{let t=Io(e.boundary);return{...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}})}function Bo(e){if(e.slide||e.overlap)return mo(()=>{let t=Io(e.boundary);return{...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:yo()}})}function Vo(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,r,i;return go(()=>{let a=Io(e.boundary);return{padding:e.overflowPadding,...a?{boundary:a}:void 0,apply({elements:e,rects:a,availableHeight:o,availableWidth:s}){let c=e.floating,l=Math.round(a.reference.width),u=Math.round(a.reference.height);s=Math.floor(s),o=Math.floor(o),Fo(t,l)||(c.style.setProperty(`--reference-width`,`${l}px`),t=l),Fo(n,u)||(c.style.setProperty(`--reference-height`,`${u}px`),n=u),Fo(r,s)||(c.style.setProperty(`--available-width`,`${s}px`),r=s),Fo(i,o)||(c.style.setProperty(`--available-height`,`${o}px`),i=o)}}})}function Ho(e){if(e.hideWhenDetached)return _o(()=>({strategy:`referenceHidden`,boundary:Io(e.boundary)??`clippingAncestors`}))}function Uo(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}function Wo(e,t){if(!e)return me;let n=new Map(t.map(t=>[t,e.style.getPropertyValue(t)]));return()=>{n.forEach((t,n)=>{t?e.style.setProperty(n,t):e.style.removeProperty(n)}),e.style.length===0&&e.removeAttribute(`style`)}}function Go(e){return e==null?null:P(e)?e:typeof e==`object`&&e&&`contextElement`in e&&e.contextElement?e.contextElement:e}function Ko(e,t,n={}){let r=()=>(typeof t==`function`?t():t)??null,i=()=>{let t=typeof e==`function`?e():e;return n.getAnchorElement?.()??t},a=()=>{let e=i();return!e&&!n.getAnchorRect?null:wo(e,n.getAnchorRect)},o=Object.assign({},Jo,n),s=[],c=null,l=null,u,d;function f(e,t){u?.(),d?.(),c=e,l=t,u=o.restoreStyles?Wo(e,Yo):void 0,d=o.restoreStyles?Wo(t,Xo):void 0,s=[...o.middleware??[],Ro(t,o),zo(o),Bo(o),Lo(t,e.ownerDocument,o),Ao(t),Eo({gutter:o.gutter,offset:o.offset,overlap:o.overlap},t),Vo(o),Ho(o),ko]}let{placement:p,strategy:m,onComplete:h,onPositioned:g}=o,_,v,y=!1,b,x,S=me,C=Uo(o.listeners);function w(){if(!o.listeners)return;let e=i(),t=a(),n=r();t&&n&&(Go(e)!==Go(b)||n!==x)&&(S(),b=e,x=n,S=so(t,n,E,C))}async function T(){w();let e=r();if(!e)return;let t=o.getArrowElement?.()??null;(e!==c||t!==l)&&(f(e,t),y=!1);let n=a();if(!n)return;let i=await bo(n,e,{placement:p,middleware:s,strategy:m}),u=N(e),d=Po(u,i.x),g=Po(u,i.y);if(h?.({...i,x:d,y:g}),o.applyStyles!==!1&&(Fo(_,d)||(e.style.setProperty(`--x`,`${d}px`),_=d),Fo(v,g)||(e.style.setProperty(`--y`,`${g}px`),v=g),o.hideWhenDetached&&(i.middlewareData.hide?.referenceHidden?(e.style.setProperty(`visibility`,`hidden`),e.style.setProperty(`pointer-events`,`none`)):(e.style.removeProperty(`visibility`),e.style.removeProperty(`pointer-events`))),!y)){let t=e.firstElementChild;t&&(e.style.setProperty(`--z-index`,Rt(t).zIndex),y=!0)}}async function E(){n.updatePosition?(await n.updatePosition({updatePosition:T,floatingElement:r()}),g?.({placed:!0})):await T()}return E(),()=>{S(),d?.(),u?.(),g?.({placed:!1})}}function qo(e,t,n={}){let{defer:r,...i}=n,a=r?L:e=>e(),o=[];return o.push(a(()=>{o.push(Ko(e,t,i))})),()=>{o.forEach(e=>e?.())}}var Jo,Yo,Xo;function Zo(){return(Zo=e((()=>{xo(),Bt(),F(),wn(),ve(),k(),ge(),To(),jo(),Jo={strategy:`absolute`,placement:`bottom`,listeners:!0,restoreStyles:!1,applyStyles:!0,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4},Yo=[`transform`,`visibility`,`pointer-events`,`--x`,`--y`,`--z-index`,`--reference-width`,`--reference-height`,`--available-width`,`--available-height`,`--transform-origin`],Xo=[`top`,`right`,`bottom`,`left`]})))()}function Qo(e={}){let{placement:t,sameWidth:n,fitViewport:r,strategy:i=`absolute`}=e;return{arrow:{position:`absolute`,width:J.arrowSize.reference,height:J.arrowSize.reference,[J.arrowSizeHalf.variable]:`calc(${J.arrowSize.reference} / 2)`,[J.arrowOffset.variable]:`calc(${J.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?$o[t.split(`-`)[0]]:void 0,background:J.arrowBg.reference,top:`0`,left:`0`,width:`100%`,height:`100%`,position:`absolute`,zIndex:`inherit`},floating:{position:i,isolation:`isolate`,minWidth:n?void 0:`max-content`,width:n?`var(--reference-width)`:void 0,maxWidth:r?`var(--available-width)`:void 0,maxHeight:r?`var(--available-height)`:void 0,pointerEvents:t?void 0:`none`,top:`0px`,left:`0px`,transform:`translate3d(var(--x, 0px), var(--y, -100vh), 0)`,zIndex:`var(--z-index)`}}}var $o;function es(){return(es=e((()=>{jo(),$o={bottom:`rotate(45deg)`,left:`rotate(135deg)`,top:`rotate(225deg)`,right:`rotate(315deg)`}})))()}function ts(e,t){if(!e)return;let n=new(N(e)).CustomEvent(js,{detail:{value:t}});e.dispatchEvent(n)}function ns(e){let t=os(e);return Y(e)??e.getDoc().getElementById(t)}function rs(e,t){if(!P(e))return!1;for(let n in t){let r=t[n],i=ns(r.scope);if(i&&xt(i,e))return!0;let a=r.refs.get(`children`);if(Object.keys(a).length>0&&rs(e,a))return!0}return!1}var is,as,os,ss,cs,ls,us,Y,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js;function Ms(){return(Ms=e((()=>{F(),hr(),C(),k(),h(),is=(e,t)=>{let n=e.ids?.trigger;return n==null?t?`${e.id}:trigger:${t}`:`${e.id}:trigger`:O(n)?n(t):n},as=(e,t)=>{let n=e.ids?.contextTrigger;return n==null?t?`${e.id}:ctx-trigger:${t}`:`${e.id}:ctx-trigger`:O(n)?n(t):n},os=e=>e.ids?.content??`${e.id}:content`,ss=(e,t)=>e.ids?.group?.(t)??`${e.id}:group:${t}`,cs=(e,t)=>`${e.id}:${t}`,ls=e=>e?.dataset.value??null,us=(e,t)=>e.ids?.groupLabel?.(t)??`${e.id}:group-label:${t}`,Y=e=>e.query(e.selector(m.content)),ds=e=>e.query(e.selector(m.positioner)),fs=e=>e.query(e.selector(m.trigger)),ps=(e,t)=>t?e.getById(t):null,ms=(e,t,n)=>{let r=N(e);e.dispatchEvent(new r.CustomEvent(t,{detail:n}))},hs=(e,t)=>t?e.query(`${e.selector(m.item)}[data-value="${t}"]`):null,gs=e=>e.query(e.selector(m.arrow)),_s=e=>e.query(e.selector(m.contextTrigger)),vs=e=>e.queryAll(e.selector(m.trigger)),ys=e=>e.queryAll(e.selector(m.contextTrigger)),bs=e=>e.query(e.selector(m.triggerItem)),xs=(e,t)=>t==null?fs(e)??bs(e)??vs(e)[0]:e.query(`${e.selector(m.trigger)}[data-value="${t}"]`)??e.query(`${e.selector(m.triggerItem)}[data-value="${t}"]`),Ss=e=>{let t=`[data-menu-item="${CSS.escape(e.id)}"]:not([data-disabled])`,n=Y(e);return n?Array.from(n.querySelectorAll(t)):[]},Cs=e=>x(Ss(e)),ws=e=>S(Ss(e)),Ts=(e,t)=>t?e.id===t||e.dataset.value===t:!1,Es=(e,t)=>{let n=Ss(e);return v(n,n.findIndex(e=>Ts(e,t.value)),{loop:t.loop??t.loopFocus})},Ds=(e,t)=>{let n=Ss(e);return b(n,n.findIndex(e=>Ts(e,t.value)),{loop:t.loop??t.loopFocus})},Os=(e,t)=>{let n=Ss(e),r=n.find(e=>Ts(e,t.value));return mr(n,{state:t.typeaheadState,key:t.key,activeId:r?.id??null})},ks=e=>P(e)&&(e.dataset.disabled===``||e.hasAttribute(`disabled`)),As=e=>!!e?.getAttribute(`role`)?.startsWith(`menuitem`)&&!!e?.hasAttribute(`data-controls`),js=`menu:select`})))()}function Ns(e){let{x:t,y:n,width:r,height:i}=e,a=t+r/2,o=n+i/2;return{x:t,y:n,width:r,height:i,minX:t,minY:n,maxX:t+r,maxY:n+i,midX:a,midY:o,center:Fs(a,o)}}function Ps(e){return{top:Fs(e.minX,e.minY),right:Fs(e.maxX,e.minY),bottom:Fs(e.maxX,e.maxY),left:Fs(e.minX,e.maxY)}}var Fs;function Is(){return(Is=e((()=>{Object.freeze({x:0,y:0}),Fs=(e,t)=>({x:e,y:t})})))()}function Ls(e,t){let{top:n,right:r,left:i,bottom:a}=Ps(Ns(e)),[o]=t.split(`-`);return{top:[i,n,r,a],right:[n,r,a,i],bottom:[n,i,a,r],left:[r,n,i,a]}[o]}function Rs(e,t){let{x:n,y:r}=t,i=!1;for(let t=0,a=e.length-1;t<e.length;a=t++){let o=e[t].x,s=e[t].y,c=e[a].x,l=e[a].y;s>r!=l>r&&n<(c-o)*(r-s)/(l-s)+o&&(i=!i)}return i}function zs(){return(zs=e((()=>{Is()})))()}function Bs(e){let t=e.parent;for(;t&&t.context.get(`isSubmenu`);)t=t.refs.get(`parent`);t?.send({type:`CLOSE`})}function Vs(e){let t=e;for(;t.context.get(`isSubmenu`);){let e=t.refs.get(`parent`);if(!e)break;t=e}let n=t.prop(`menubar`);return{rootEl:ps(t.scope,n?.rootId),orientation:n?.orientation??`horizontal`}}function Hs(e,t){return e?Rs(e,t):!1}function Us(e,t,n){let r=Object.keys(e).length>0;if(!t)return null;if(!r)return cs(n,t);for(let n in e){let r=e[n],i=is(r.scope);if(i===t)return i}return cs(n,t)}function Ws(e,t){e&&(e.refs.set(`pointerRoutingLocked`,t),e.context.set(`pointerRoutingMode`,t?`locked`:`interactive`))}function Gs(e){let t=e.context.get(`highlightedValue`);if(!t)return!1;let n=e.refs.get(`children`);for(let e in n){let r=n[e];if(r.state.hasTag(`open`)&&is(r.scope)===t)return!0}return!1}function Ks(e,t){e&&(e.refs.get(`pointerRoutingLocked`)||t&&Gs(e)||Ws(e,!1))}function qs(e){e&&(Gs(e)||Ws(e,!1))}function Js(){return(Js=e((()=>{zs(),Ms()})))()}function Ys(e,t){let{context:n,send:r,state:i,computed:a,prop:o,scope:s}=e,c=n.get(`layer`),l=i.hasTag(`open`),u=n.get(`isSubmenu`),d=a(`isInMenubar`),f=n.get(`instant`),p=a(`menubarDisabled`),h=o(`menubar`)?.activeId,g=o(`menubar`)?.rootId,_=d&&o(`menubar`)?.orientation===`vertical`,v=a(`isTypingAhead`),y=o(`composite`),b=n.get(`currentPlacement`),x=b?No(b):void 0,S=n.get(`anchorPoint`),C=n.get(`highlightedValue`),w=n.get(`triggerValue`),T=Qo({...o(`positioning`),placement:b});function E(e){return{id:cs(s,e.value),disabled:!!e.disabled,highlighted:C===e.value}}function ee(e={}){let{value:t}=e,n=t!=null&&w===t;return{value:t,current:n,open:t==null?l:l&&n,disabled:!!p}}function te(){return{nested:!!c?.nested,hasNested:!!c?.hasNested}}function D(){return{open:l,nested:!!c?.nested,hasNested:!!c?.hasNested,placement:b,side:x}}function O(e){let t=e.valueText??e.value;return{...e,id:e.value,valueText:t}}function ne(e){return{...E(O(e)),checked:!!e.checked}}function ie(e){let{closeOnSelect:n,valueText:i,value:a}=e,o=E(e),c=cs(s,a);return t.element({...m.item.attrs(s.id),id:c,role:`menuitem`,"aria-disabled":gt(o.disabled),"data-disabled":j(o.disabled),"data-highlighted":j(o.highlighted),"data-value":a,"data-valuetext":i,onDragStart(e){e.currentTarget.matches(`a[href]`)&&e.preventDefault()},onPointerMove(e){if(o.disabled||e.pointerType!==`mouse`||fi()!==`pointer`)return;let t=e.currentTarget;if(o.highlighted)return;let i=pn(e);r({type:`ITEM_POINTERMOVE`,id:c,target:t,closeOnSelect:n,point:i})},onPointerLeave(e){if(o.disabled||e.pointerType!==`mouse`||fi()!==`pointer`)return;let t=e.currentTarget;r({type:`ITEM_POINTERLEAVE`,id:c,target:t,closeOnSelect:n})},onPointerDown(e){if(o.disabled)return;let t=e.currentTarget;r({type:`ITEM_POINTERDOWN`,target:t,id:c,closeOnSelect:n})},onClick(e){if(cn(e)||sn(e)||o.disabled)return;let t=e.currentTarget;r({type:`ITEM_CLICK`,target:t,id:c,value:a,closeOnSelect:n})}})}return{highlightedValue:C,open:l,setOpen(e){r({type:e?`OPEN`:`CLOSE`,replaces:`open`})},triggerValue:w,setTriggerValue(e){r({type:`TRIGGER_VALUE.SET`,value:e})},setHighlightedValue(e){r({type:`HIGHLIGHTED.SET`,value:e})},setParent(e){r({type:`PARENT.SET`,value:e,id:e.prop(`id`)})},setChild(e){r({type:`CHILD.SET`,value:e,id:e.prop(`id`)})},reposition(e={}){r({type:`POSITIONING.SET`,options:e})},addItemListener(e){let t=s.getById(e.id);if(!t)return;let n=()=>e.onSelect?.();return t.addEventListener(js,n),()=>t.removeEventListener(js,n)},getContextTriggerProps(e={}){let{value:n}=e,i=n!=null&&w===n,a=as(s,n);return t.element({...m.contextTrigger.attrs(s.id),dir:o(`dir`),id:a,"data-value":n,"data-current":j(i),"data-state":l?`open`:`closed`,onPointerDown(e){if(e.pointerType===`mouse`)return;let t=pn(e);r({type:`CONTEXT_MENU_START`,point:t,value:n})},onPointerCancel(e){e.pointerType!==`mouse`&&r({type:`CONTEXT_MENU_CANCEL`})},onPointerMove(e){e.pointerType!==`mouse`&&r({type:`CONTEXT_MENU_CANCEL`})},onPointerUp(e){e.pointerType!==`mouse`&&r({type:`CONTEXT_MENU_CANCEL`})},onContextMenu(e){let t=pn(e);r({type:l&&n!=null&&!i?`TRIGGER_VALUE.SET`:`CONTEXT_MENU`,point:t,value:n}),e.preventDefault()},style:{WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`}})},getTriggerItemProps(e){let t=e.getTriggerProps();return Se(ie({value:t.id}),t)},getTriggerState:ee,getTriggerProps(n={}){let{value:i}=n,a=ee(n),{current:c}=a,f=is(s,i);return t.button({...u?m.triggerItem.attrs(s.id):m.trigger.attrs(s.id),role:d?`menuitem`:void 0,tabIndex:d?h===f?0:-1:void 0,disabled:a.disabled||void 0,"aria-disabled":a.disabled||void 0,"data-disabled":a.disabled?``:void 0,"data-placement":b,"data-side":x,type:`button`,dir:o(`dir`),id:f,...i!=null&&{"data-value":i,"data-current":j(c)},"aria-haspopup":y?`menu`:`dialog`,"aria-controls":os(s),"data-controls":os(s),"aria-expanded":a.open,"data-state":l?`open`:`closed`,onPointerMove(e){if(e.pointerType!==`mouse`||ks(e.currentTarget)||!u)return;let t=pn(e);r({type:`TRIGGER_POINTERMOVE`,target:e.currentTarget,point:t})},onPointerLeave(t){if(ks(t.currentTarget)||t.pointerType!==`mouse`||!u)return;Ws(e.refs.get(`parent`),!0);let n=pn(t);r({type:`TRIGGER_POINTERLEAVE`,target:t.currentTarget,point:n})},onPointerDown(e){ks(e.currentTarget)||mn(e)||e.preventDefault()},onClick(e){e.defaultPrevented||ks(e.currentTarget)||r({type:l&&i!=null&&!c?`TRIGGER_VALUE.SET`:`TRIGGER_CLICK`,target:e.currentTarget,value:i})},onPointerEnter(e){e.pointerType===`mouse`&&d&&!l&&(ks(e.currentTarget)||ps(s,g)?.dataset.hasOpenMenu===`true`&&r({type:`OPEN`,instant:!0}))},onBlur(){r({type:`TRIGGER_BLUR`})},onFocus(){r({type:`TRIGGER_FOCUS`})},onKeyDown(e){if(e.defaultPrevented)return;let t={Enter(){r({type:`ARROW_DOWN`,src:`enter`,value:i})},Space(){r({type:`ARROW_DOWN`,src:`space`,value:i})}};_?t.ArrowRight=()=>r({type:`ARROW_DOWN`,value:i}):(t.ArrowDown=()=>r({type:`ARROW_DOWN`,value:i}),t.ArrowUp=()=>r({type:`ARROW_UP`,value:i}));let n=t[fn(e,{orientation:_?`horizontal`:`vertical`,dir:o(`dir`)})];n&&(e.preventDefault(),n(e))}})},getIndicatorProps(){return t.element({...m.indicator.attrs(s.id),dir:o(`dir`),"data-state":l?`open`:`closed`})},getPositionerState:te,getPositionerProps(){return t.element({...m.positioner.attrs(s.id),dir:o(`dir`),"data-instant":j(f),...ni(c),style:{...T.floating,...ri(c,{zIndex:!0})}})},getArrowProps(){return t.element({...m.arrow.attrs(s.id),dir:o(`dir`),style:T.arrow})},getArrowTipProps(){return t.element({...m.arrowTip.attrs(s.id),dir:o(`dir`),style:T.arrowTip})},getContentState:D,getContentProps(){let i=D();return t.element({...m.content.attrs(s.id),id:os(s),"aria-label":o(`aria-label`),hidden:!i.open,"data-state":i.open?`open`:`closed`,"data-instant":j(f),role:y?`menu`:`dialog`,tabIndex:0,dir:o(`dir`),"aria-activedescendant":a(`highlightedId`)||void 0,"aria-labelledby":S?as(s,w??void 0):is(s,w??void 0),"data-placement":i.placement,"data-side":i.side,...ni(c),style:{...ri(c,{pointerEvents:!0})},onPointerEnter(e){e.pointerType===`mouse`&&r({type:`MENU_POINTERENTER`})},onKeyDown(t){if(t.defaultPrevented||!xt(t.currentTarget,I(t)))return;let i=I(t);if(i?.closest(`[role=menu]`)!==t.currentTarget&&i!==t.currentTarget)return;if(t.key===`Tab`&&!zn(t)){t.preventDefault();return}let a={ArrowDown(){r({type:`ARROW_DOWN`})},ArrowUp(){r({type:`ARROW_UP`})},ArrowLeft(){let t=Vs(e);t.orientation===`vertical`?r({type:u?`ARROW_LEFT`:`CLOSE`}):d&&t.rootEl?(e.refs.set(`menubarCloseReason`,`list-navigation`),ms(t.rootEl,`menu:focus-prev`)):r({type:`ARROW_LEFT`})},ArrowRight(){let t=n.get(`highlightedValue`);if((t==null?null:hs(s,t))?.getAttribute(`aria-haspopup`)===`menu`){r({type:`ARROW_RIGHT`});return}let i=Vs(e);i.orientation===`horizontal`&&i.rootEl?(e.refs.set(`menubarCloseReason`,`list-navigation`),ms(i.rootEl,`menu:focus-next`)):r({type:`ARROW_RIGHT`})},Enter(){r({type:`ENTER`})},Space(e){v?r({type:`TYPEAHEAD`,key:e.key}):a.Enter?.(e)},Home(){r({type:`HOME`})},End(){r({type:`END`})}},c=a[fn(t,{dir:o(`dir`)})];c?(c(t),t.stopPropagation(),t.preventDefault()):o(`typeahead`)&&un(t)&&(hn(t)||bt(i)||(r({type:`TYPEAHEAD`,key:t.key}),t.preventDefault()))}})},getSeparatorProps(){return t.element({...m.separator.attrs(s.id),role:`separator`,dir:o(`dir`),"aria-orientation":`horizontal`})},getItemState:E,getItemProps:ie,getOptionItemState:ne,getOptionItemProps(e){let{type:n,disabled:i,closeOnSelect:a}=e,c=O(e),l=ne(e);return{...ie(c),...t.element({"data-type":n,...m.item.attrs(s.id),dir:o(`dir`),"data-value":c.value,role:`menuitem${n}`,"aria-checked":!!l.checked,"data-state":l.checked?`checked`:`unchecked`,onClick(e){if(i||cn(e)||sn(e))return;let t=e.currentTarget;r({type:`ITEM_CLICK`,target:t,option:c,value:c.value,closeOnSelect:a})}})}},getItemIndicatorProps(e){let n=ne(fe(e)),r=n.checked?`checked`:`unchecked`;return t.element({...m.itemIndicator.attrs(s.id),dir:o(`dir`),"data-disabled":j(n.disabled),"data-highlighted":j(n.highlighted),"data-state":re(e,`checked`)?r:void 0,hidden:re(e,`checked`)?!n.checked:void 0})},getItemTextProps(e){let n=ne(fe(e)),r=n.checked?`checked`:`unchecked`;return t.element({...m.itemText.attrs(s.id),dir:o(`dir`),"data-disabled":j(n.disabled),"data-highlighted":j(n.highlighted),"data-state":re(e,`checked`)?r:void 0})},getItemGroupLabelProps(e){return t.element({...m.itemGroupLabel.attrs(s.id),id:us(s,e.htmlFor),dir:o(`dir`)})},getItemGroupProps(e){return t.element({id:ss(s,e.id),...m.itemGroup.attrs(s.id),dir:o(`dir`),"aria-labelledby":us(s,e.id),role:`group`})}}}function Xs(){return(Xs=e((()=>{Oe(),_t(),bn(),F(),Bn(),Ti(),es(),ge(),k(),h(),Ms(),Js()})))()}var X,Zs,Qs,$s,ec,Z;function tc(){return(tc=e((()=>{at(),ti(),bn(),Gn(),F(),hr(),Bn(),Un(),wn(),rr(),Ti(),Zo(),zs(),E(),h(),Ms(),Js(),{not:X,and:Zs,or:Qs}=rt(),$s=[{guard:`isOpenControlled`,actions:[`setTriggerValue`,`invokeOnOpen`]},{target:`open`,actions:[`setTriggerValue`,`invokeOnOpen`]}],ec=[{guard:`isOpenControlled`,actions:[`invokeOnClose`,`releaseParentRoutingLock`]},{target:`closed`,actions:[`invokeOnClose`,`releaseParentRoutingLock`,`focusTrigger`]}],Z=it({props({props:e}){return{closeOnSelect:!0,typeahead:!0,composite:!0,loopFocus:!1,navigate(e){Wn(e.node)},...e,positioning:{placement:`bottom-start`,gutter:8,...e.positioning}}},initialState({prop:e}){return e(`open`)||e(`defaultOpen`)?`open`:`idle`},context({bindable:e,prop:t,scope:n}){return{layer:e(()=>({defaultValue:null})),highlightedValue:e(()=>({defaultValue:t(`defaultHighlightedValue`)||null,value:t(`highlightedValue`),onChange(e){t(`onHighlightChange`)?.({highlightedValue:e})}})),lastHighlightedValue:e(()=>({defaultValue:null})),currentPlacement:e(()=>({defaultValue:void 0})),intentPolygon:e(()=>({defaultValue:null})),anchorPoint:e(()=>({defaultValue:null,hash(e){return`x: ${e?.x}, y: ${e?.y}`}})),isSubmenu:e(()=>({defaultValue:!1})),triggerValue:e(()=>({defaultValue:t(`defaultTriggerValue`)??null,value:t(`triggerValue`),onChange(e){let r=t(`onTriggerValueChange`);r&&r({value:e,triggerElement:xs(n,e)})}})),pointerRoutingMode:e(()=>({defaultValue:`interactive`})),instant:e(()=>({defaultValue:!1}))}},refs(){return{parent:null,children:{},pointerRoutingLocked:!1,typeaheadState:{...mr.defaultOptions},positioningOverride:{},menubarCloseReason:null}},computed:{isRtl:({prop:e})=>e(`dir`)===`rtl`,isTypingAhead:({refs:e})=>e.get(`typeaheadState`).keysSoFar!==``,highlightedId:({context:e,scope:t,refs:n})=>Us(n.get(`children`),e.get(`highlightedValue`),t),isInMenubar:({prop:e})=>e(`menubar`)!=null,menubarDisabled:({prop:e})=>e(`menubar`)?.disabled??!1},effects:[`trackMenubarOpenRequest`],watch({track:e,action:t,context:n,prop:r}){e([()=>n.get(`isSubmenu`)],()=>{t([`setSubmenuPlacement`])}),e([()=>n.hash(`anchorPoint`)],()=>{n.get(`anchorPoint`)&&t([`reposition`])}),e([()=>r(`open`)],()=>{t([`toggleVisibility`])})},on:{"TRIGGER_VALUE.SET":{actions:[`setTriggerValue`,`setAnchorPoint`,`reposition`,`focusMenu`]},"PARENT.SET":{actions:[`setParentMenu`]},"CHILD.SET":{actions:[`setChildMenu`]},OPEN_AUTOFOCUS:[{guard:`isOpenControlled`,actions:[`setTriggerValue`,`invokeOnOpen`]},{target:`open`,actions:[`setTriggerValue`,`highlightFirstItem`,`invokeOnOpen`]}],"HIGHLIGHTED.RESTORE":{actions:[`restoreHighlightedItem`]},"HIGHLIGHTED.SET":{actions:[`setHighlightedItem`]},"HIGHLIGHTED.SUGGEST":{actions:[`suggestHighlightedItem`]}},states:{idle:{tags:[`closed`],on:{"CONTROLLED.OPEN":{target:`open`},"CONTROLLED.CLOSE":{target:`closed`},OPEN:$s,CONTEXT_MENU_START:{target:`opening:contextmenu`,actions:[`setAnchorPoint`,`setTriggerValue`]},CONTEXT_MENU:[{guard:`isOpenControlled`,actions:[`setAnchorPoint`,`setTriggerValue`,`invokeOnOpen`]},{target:`open`,actions:[`setAnchorPoint`,`setTriggerValue`,`invokeOnOpen`]}],TRIGGER_CLICK:[{guard:`isOpenControlled`,actions:[`invokeOnOpen`,`setTriggerValue`]},{target:`open`,actions:[`invokeOnOpen`,`setTriggerValue`]}],TRIGGER_FOCUS:{guard:X(`isSubmenu`),target:`closed`},TRIGGER_POINTERMOVE:{guard:`isSubmenu`,target:`opening`}}},"opening:contextmenu":{tags:[`closed`],effects:[`waitForLongPress`],on:{OPEN:$s,CLOSE:ec,"CONTROLLED.OPEN":{target:`open`,actions:[`reposition`]},"CONTROLLED.CLOSE":{target:`closed`,actions:[`focusTrigger`]},CONTEXT_MENU_CANCEL:[{guard:`isOpenControlled`,actions:[`invokeOnClose`,`releaseParentRoutingLock`]},{target:`closed`,actions:[`invokeOnClose`,`releaseParentRoutingLock`,`focusTrigger`]}],"LONG_PRESS.OPEN":[{guard:`isOpenControlled`,actions:[`setTriggerValue`,`invokeOnOpen`]},{target:`open`,actions:[`setTriggerValue`,`invokeOnOpen`,`reposition`]}]}},opening:{tags:[`closed`],effects:[`waitForOpenDelay`],on:{OPEN:$s,CLOSE:ec,"CONTROLLED.OPEN":{target:`open`},"CONTROLLED.CLOSE":{target:`closed`,actions:[`focusTrigger`]},BLUR:[{guard:`isOpenControlled`,actions:[`invokeOnClose`,`releaseParentRoutingLock`]},{target:`closed`,actions:[`invokeOnClose`,`releaseParentRoutingLock`,`focusTrigger`]}],TRIGGER_POINTERLEAVE:[{guard:`isOpenControlled`,actions:[`invokeOnClose`,`releaseParentRoutingLock`]},{target:`closed`,actions:[`invokeOnClose`,`releaseParentRoutingLock`,`focusTrigger`]}],"DELAY.OPEN":[{guard:`isOpenControlled`,actions:[`invokeOnOpen`]},{target:`open`,actions:[`invokeOnOpen`]}]}},closing:{tags:[`open`],effects:[`trackPointerMove`,`trackInteractOutside`,`waitForCloseDelay`],on:{OPEN:$s,CLOSE:ec,"CONTROLLED.OPEN":{target:`open`},"CONTROLLED.CLOSE":{target:`closed`,actions:[`focusParentMenu`,`restoreParentHighlightedItem`]},MENU_POINTERENTER:{target:`open`,actions:[`clearIntentPolygon`]},POINTER_MOVED_AWAY_FROM_SUBMENU:[{guard:`isOpenControlled`,actions:[`invokeOnClose`,`releaseParentRoutingLock`]},{target:`closed`,actions:[`focusParentMenu`,`restoreParentHighlightedItem`]}],"DELAY.CLOSE":[{guard:`isOpenControlled`,actions:[`invokeOnClose`,`releaseParentRoutingLock`]},{target:`closed`,actions:[`focusParentMenu`,`restoreParentHighlightedItem`,`invokeOnClose`,`releaseParentRoutingLock`]}]}},closed:{tags:[`closed`],entry:[`setInstant`,`clearHighlightedItem`,`unlockParentOnClose`,`clearAnchorPoint`,`dispatchMenubarClose`],on:{OPEN:$s,"CONTROLLED.OPEN":[{guard:Qs(`isOpenAutoFocusEvent`,`isArrowDownEvent`),target:`open`,actions:[`highlightFirstItem`]},{guard:`isArrowUpEvent`,target:`open`,actions:[`highlightLastItem`]},{target:`open`}],CONTEXT_MENU_START:{target:`opening:contextmenu`,actions:[`setAnchorPoint`,`setTriggerValue`]},CONTEXT_MENU:[{guard:`isOpenControlled`,actions:[`setAnchorPoint`,`setTriggerValue`,`invokeOnOpen`]},{target:`open`,actions:[`setAnchorPoint`,`setTriggerValue`,`invokeOnOpen`]}],TRIGGER_CLICK:[{guard:`isOpenControlled`,actions:[`invokeOnOpen`,`setTriggerValue`]},{target:`open`,actions:[`invokeOnOpen`,`setTriggerValue`]}],TRIGGER_POINTERMOVE:{guard:`isTriggerItem`,target:`opening`},TRIGGER_BLUR:{target:`idle`},ARROW_DOWN:[{guard:`isOpenControlled`,actions:[`setTriggerValue`,`invokeOnOpen`]},{target:`open`,actions:[`setTriggerValue`,`highlightFirstItem`,`invokeOnOpen`]}],ARROW_UP:[{guard:`isOpenControlled`,actions:[`setTriggerValue`,`invokeOnOpen`]},{target:`open`,actions:[`setTriggerValue`,`highlightLastItem`,`invokeOnOpen`]}]}},open:{tags:[`open`],effects:[`trackInteractOutside`,`trackFocusVisible`,`trackPositioning`,`scrollToHighlightedItem`,`trackMenubarSiblings`],entry:[`setInstant`,`focusMenu`,`unlockParentOnOpen`,`dispatchMenubarOpen`],on:{CLOSE:ec,"CONTROLLED.CLOSE":[{target:`closed`,guard:`isArrowLeftEvent`,actions:[`focusParentMenu`]},{target:`closed`,actions:[`focusTrigger`]}],TRIGGER_CLICK:[{guard:Zs(X(`isTriggerItem`),`isOpenControlled`),actions:[`invokeOnClose`,`releaseParentRoutingLock`]},{guard:X(`isTriggerItem`),target:`closed`,actions:[`invokeOnClose`,`releaseParentRoutingLock`,`focusTrigger`]}],CONTEXT_MENU:{actions:[`setAnchorPoint`,`setTriggerValue`,`focusMenu`]},ARROW_UP:{actions:[`highlightPrevItem`,`focusMenu`]},ARROW_DOWN:{actions:[`highlightNextItem`,`focusMenu`]},ARROW_LEFT:[{guard:Zs(`isSubmenu`,`isOpenControlled`),actions:[`invokeOnClose`,`releaseParentRoutingLock`]},{guard:`isSubmenu`,target:`closed`,actions:[`focusParentMenu`,`invokeOnClose`,`releaseParentRoutingLock`]}],HOME:{actions:[`highlightFirstItem`,`focusMenu`]},END:{actions:[`highlightLastItem`,`focusMenu`]},ARROW_RIGHT:{guard:`isTriggerItemHighlighted`,actions:[`openSubmenu`]},ENTER:[{guard:`isTriggerItemHighlighted`,actions:[`openSubmenu`]},{actions:[`clickHighlightedItem`]}],ITEM_POINTERMOVE:[{guard:X(`isPointerRoutingLocked`),actions:[`setHighlightedItem`,`focusMenu`,`closeSiblingMenus`]},{actions:[`setLastHighlightedItem`,`closeSiblingMenus`]}],ITEM_POINTERLEAVE:{guard:Zs(X(`isPointerRoutingLocked`),X(`isTriggerItem`)),actions:[`clearHighlightedItem`]},ITEM_CLICK:[{guard:Zs(X(`isTriggerItemHighlighted`),X(`isHighlightedItemEditable`),`closeOnSelect`,`isOpenControlled`),actions:[`invokeOnSelect`,`setOptionState`,`closeRootMenu`,`invokeOnClose`,`releaseParentRoutingLock`]},{guard:Zs(X(`isTriggerItemHighlighted`),X(`isHighlightedItemEditable`),`closeOnSelect`),target:`closed`,actions:[`invokeOnSelect`,`setOptionState`,`closeRootMenu`,`invokeOnClose`,`releaseParentRoutingLock`,`focusTrigger`]},{guard:Zs(X(`isTriggerItemHighlighted`),X(`isHighlightedItemEditable`)),actions:[`invokeOnSelect`,`setOptionState`]},{actions:[`setHighlightedItem`]}],TRIGGER_POINTERMOVE:{guard:`isTriggerItem`,actions:[`setIntentPolygon`]},TRIGGER_POINTERLEAVE:{target:`closing`,actions:[`setIntentPolygon`]},ITEM_POINTERDOWN:{actions:[`setHighlightedItem`]},TYPEAHEAD:{actions:[`highlightMatchedItem`]},FOCUS_MENU:{actions:[`focusMenu`]},"POSITIONING.SET":{actions:[`reposition`]}}}},implementations:{guards:{closeOnSelect:({prop:e,event:t})=>!!(t?.closeOnSelect??e(`closeOnSelect`)),isTriggerItem:({event:e,computed:t})=>!t(`isInMenubar`)&&As(e.target),isTriggerItemHighlighted:({event:e,scope:t,computed:n})=>!!(e.target??t.getById(n(`highlightedId`)))?.hasAttribute(`data-controls`),isSubmenu:({context:e})=>e.get(`isSubmenu`),isPointerRoutingLocked:({refs:e})=>e.get(`pointerRoutingLocked`),isHighlightedItemEditable:({scope:e,computed:t})=>bt(e.getById(t(`highlightedId`))),isOpenControlled:({prop:e})=>e(`open`)!==void 0,isArrowLeftEvent:({event:e})=>e.previousEvent?.type===`ARROW_LEFT`,isArrowUpEvent:({event:e})=>e.previousEvent?.type===`ARROW_UP`,isArrowDownEvent:({event:e})=>e.previousEvent?.type===`ARROW_DOWN`,isOpenAutoFocusEvent:({event:e})=>e.previousEvent?.type===`OPEN_AUTOFOCUS`},effects:{trackMenubarOpenRequest({scope:e,prop:t,send:n}){let r=ps(e,t(`menubar`)?.rootId);if(!r)return;let i=is(e);return yn(r,`menubar:open-request`,e=>{e.detail?.triggerId===i&&n({type:`OPEN`,instant:!0})})},trackMenubarSiblings({scope:e,prop:t,send:n,refs:r}){let i=ps(e,t(`menubar`)?.rootId);if(i)return yn(i,`menu:open`,t=>{t.detail?.menuId!==e.id&&(r.set(`menubarCloseReason`,`sibling-open`),n({type:`CLOSE`,src:`menubar-sibling-open`,restoreFocus:!1,instant:!0}))})},waitForOpenDelay({send:e}){let t=setTimeout(()=>{e({type:`DELAY.OPEN`})},200);return()=>clearTimeout(t)},waitForCloseDelay({send:e}){let t=setTimeout(()=>{e({type:`DELAY.CLOSE`})},100);return()=>clearTimeout(t)},waitForLongPress({send:e}){let t=setTimeout(()=>{e({type:`LONG_PRESS.OPEN`})},700);return()=>clearTimeout(t)},trackFocusVisible({scope:e}){return hi({root:e.getRootNode?.()})},trackPositioning({context:e,prop:t,scope:n,refs:r}){if(_s(n)||ys(n).length>0)return;let i={...t(`positioning`),...r.get(`positioningOverride`)};return e.set(`currentPlacement`,i.placement),qo(()=>xs(n,e.get(`triggerValue`)),()=>ds(n),{getArrowElement:()=>gs(n),...i,defer:!0,onComplete(t){e.set(`currentPlacement`,t.placement)}})},trackInteractOutside({refs:e,scope:t,prop:n,context:r,send:i}){let a=()=>Y(t),o=!0,s=e=>ys(t).some(t=>xt(t,e));return ei(a,{type:`menu`,group:n(`menubar`)?.rootId,onLayerChange(e){r.set(`layer`,e)},defer:!0,exclude:[fs(t),...vs(t)].filter(Boolean),onInteractOutside:n(`onInteractOutside`),onRequestDismiss:n(`onRequestDismiss`),onFocusOutside(t){n(`onFocusOutside`)?.(t);let r=I(t.detail.originalEvent);(s(r)||rs(r,e.get(`children`)))&&t.preventDefault()},onEscapeKeyDown(t){n(`onEscapeKeyDown`)?.(t),r.get(`isSubmenu`)&&t.preventDefault(),Bs({parent:e.get(`parent`)})},onPointerDownOutside(e){n(`onPointerDownOutside`)?.(e);let t=I(e.detail.originalEvent);s(t)&&e.detail.contextmenu?e.preventDefault():o=!e.detail.focusable},onDismiss(){i({type:`CLOSE`,src:`interact-outside`,restoreFocus:o})}})},trackPointerMove({context:e,scope:t,send:n,refs:r}){let i=r.get(`parent`);if(!i)return;Ws(i,!0);let a=t.getDoc();return yn(a,`pointermove`,t=>{Hs(e.get(`intentPolygon`),{x:t.clientX,y:t.clientY})||(n({type:`POINTER_MOVED_AWAY_FROM_SUBMENU`}),Ws(i,!1))})},scrollToHighlightedItem({scope:e,computed:t}){let n=()=>{fi()!==`pointer`&&nr(e.getById(t(`highlightedId`)),{rootEl:Y(e),block:`nearest`})};return L(()=>{pi(`virtual`),n()}),Hn(()=>Y(e),{defer:!0,attributes:[`aria-activedescendant`],callback:n})}},actions:{dispatchMenubarOpen({scope:e,prop:t}){let n=ps(e,t(`menubar`)?.rootId);if(!n)return;let r={menuId:e.id,triggerId:fs(e)?.id};ms(n,`menu:open`,r)},dispatchMenubarClose({scope:e,prop:t,refs:n}){let r=ps(e,t(`menubar`)?.rootId);if(!r)return;let i=n.get(`menubarCloseReason`)??`close`;n.set(`menubarCloseReason`,null),ms(r,`menu:close`,{menuId:e.id,reason:i})},setAnchorPoint({context:e,event:t}){e.set(`anchorPoint`,e=>T(e,t.point)?e:t.point)},setSubmenuPlacement({context:e,computed:t,refs:n}){if(!e.get(`isSubmenu`))return;let r=t(`isRtl`)?`left-start`:`right-start`;n.set(`positioningOverride`,{placement:r,gutter:0})},reposition({context:e,scope:t,prop:n,event:r,refs:i}){let a=()=>ds(t),o=r.point??e.get(`anchorPoint`),s=o?()=>({width:0,height:0,...o}):void 0,c={...n(`positioning`),...i.get(`positioningOverride`)},l=r.value??e.get(`triggerValue`);qo(()=>xs(t,l),a,{getArrowElement:()=>gs(t),...c,defer:!0,getAnchorRect:s,...r.options??{},listeners:!1,onComplete(t){e.set(`currentPlacement`,t.placement)}})},setOptionState({event:e}){if(!e.option)return;let{checked:t,onCheckedChange:n,type:r}=e.option;r===`radio`?n?.(!0):r===`checkbox`&&n?.(!t)},clickHighlightedItem({scope:e,computed:t,prop:n,context:r}){let i=e.getById(t(`highlightedId`));if(!i||i.dataset.disabled)return;let a=r.get(`highlightedValue`);Ft(i)?n(`navigate`)?.({value:a,node:i,href:i.href}):queueMicrotask(()=>i.click())},setIntentPolygon({context:e,scope:t,event:n}){let r=Y(t),i=e.get(`currentPlacement`);if(!r||!i)return;let a=Ls(r.getBoundingClientRect(),i);if(!a)return;let o=No(i)===`right`?-5:5;e.set(`intentPolygon`,[{...n.point,x:n.point.x+o},...a])},clearIntentPolygon({context:e}){e.set(`intentPolygon`,null)},clearAnchorPoint({context:e}){e.set(`anchorPoint`,null)},unlockParentOnOpen({refs:e,context:t,scope:n}){let r=e.get(`parent`);if(t.get(`isSubmenu`)){let e=is(n);r?.send({type:`HIGHLIGHTED.SUGGEST`,value:e})}Ws(r,!1)},unlockParentOnClose({refs:e,context:t}){Ks(e.get(`parent`),t.get(`isSubmenu`))},setHighlightedItem({context:e,event:t}){let n=t.value||ls(t.target);e.set(`highlightedValue`,n)},clearHighlightedItem({context:e}){e.set(`highlightedValue`,null)},focusMenu({scope:e}){L(()=>{let t=Y(e);Rn({root:t,enabled:!xt(t,e.getActiveElement()),filter(e){return!e.role?.startsWith(`menuitem`)}})?.focus({preventScroll:!0})})},highlightFirstItem({context:e,scope:t}){(Y(t)?queueMicrotask:L)(()=>{let n=Cs(t);n&&e.set(`highlightedValue`,ls(n))})},highlightLastItem({context:e,scope:t}){(Y(t)?queueMicrotask:L)(()=>{let n=ws(t);n&&e.set(`highlightedValue`,ls(n))})},highlightNextItem({context:e,scope:t,event:n,prop:r}){let i=Es(t,{loop:n.loop,value:e.get(`highlightedValue`),loopFocus:r(`loopFocus`)});e.set(`highlightedValue`,ls(i))},highlightPrevItem({context:e,scope:t,event:n,prop:r}){let i=Ds(t,{loop:n.loop,value:e.get(`highlightedValue`),loopFocus:r(`loopFocus`)});e.set(`highlightedValue`,ls(i))},invokeOnSelect({context:e,prop:t,scope:n,event:r}){let i=r.value||ls(r.target)||e.get(`highlightedValue`);i!=null&&(ts(hs(n,i),i),t(`onSelect`)?.({value:i}))},focusTrigger({scope:e,context:t,event:n}){t.get(`isSubmenu`)||t.get(`anchorPoint`)||n.restoreFocus===!1||queueMicrotask(()=>{xs(e,t.get(`triggerValue`))?.focus({preventScroll:!0})})},highlightMatchedItem({scope:e,context:t,event:n,refs:r}){let i=Os(e,{key:n.key,value:t.get(`highlightedValue`),typeaheadState:r.get(`typeaheadState`)});i&&t.set(`highlightedValue`,ls(i))},setParentMenu({refs:e,event:t,context:n}){e.set(`parent`,t.value),n.set(`isSubmenu`,!0)},setChildMenu({refs:e,event:t}){let n=e.get(`children`);n[t.id]=t.value,e.set(`children`,n)},closeSiblingMenus({refs:e,event:t,scope:n}){let r=t.target;if(!As(r))return;let i=r?.getAttribute(m.triggerItem.attr),a=e.get(`children`);for(let e in a){if(e===i)continue;let r=a[e],o=r.context.get(`intentPolygon`);o&&t.point&&Rs(o,t.point)||(Y(n)?.focus({preventScroll:!0}),r.send({type:`CLOSE`}))}},closeRootMenu({refs:e}){Bs({parent:e.get(`parent`)})},openSubmenu({refs:e,scope:t,computed:n}){let r=t.getById(n(`highlightedId`))?.getAttribute(m.triggerItem.attr),i=e.get(`children`);(r?i[r]:null)?.send({type:`OPEN_AUTOFOCUS`})},focusParentMenu({refs:e}){e.get(`parent`)?.send({type:`FOCUS_MENU`})},setLastHighlightedItem({context:e,event:t}){e.set(`lastHighlightedValue`,ls(t.target))},suggestHighlightedItem({context:e,event:t}){let n=t.value;n&&(e.get(`highlightedValue`)==null?e.set(`highlightedValue`,n):e.set(`lastHighlightedValue`,n))},restoreHighlightedItem({context:e}){let t=e.get(`lastHighlightedValue`);e.set(`lastHighlightedValue`,null),t&&e.set(`highlightedValue`,t)},restoreParentHighlightedItem({refs:e}){e.get(`parent`)?.send({type:`HIGHLIGHTED.RESTORE`})},invokeOnOpen({prop:e}){e(`onOpenChange`)?.({open:!0})},invokeOnClose({prop:e}){e(`onOpenChange`)?.({open:!1})},releaseParentRoutingLock({refs:e,context:t}){t.get(`isSubmenu`)&&qs(e.get(`parent`))},toggleVisibility({prop:e,event:t,send:n}){n({type:e(`open`)?`CONTROLLED.OPEN`:`CONTROLLED.CLOSE`,previousEvent:t})},setTriggerValue({context:e,event:t}){t.value!==void 0&&e.set(`triggerValue`,t.value)},setInstant({context:e,event:t}){e.set(`instant`,!!t.instant)}}}})})))()}function nc(e){return new Proxy({},{get(t,n){return n===`style`?t=>e({style:t}).style:e}})}var rc,ic,Q;function ac(){return(ac=e((()=>{rc=Object.defineProperty,ic=(e,t,n)=>t in e?rc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t,n)=>ic(e,typeof t==`symbol`?t:t+``,n)})))()}var oc,sc,cc;function lc(){return(lc=e((()=>{oc={onFocus:`onFocusin`,onBlur:`onFocusout`,onChange:`onInput`,onDoubleClick:`onDblclick`,htmlFor:`for`,className:`class`,defaultValue:`value`,defaultChecked:`checked`},sc=new Set([`viewBox`,`preserveAspectRatio`]),cc=nc(e=>Object.entries(e).reduce((e,[t,n])=>{if(n===void 0)return e;t in oc&&(t=oc[t]);let r=sc.has(t)?t:t.toLowerCase();return e[r]=n,e},{}))})))()}function uc(){if(typeof globalThis<`u`)return globalThis;if(typeof self<`u`)return self;if(typeof window<`u`)return window;if(typeof global<`u`)return global}function dc(e,t){let n=uc();return n?(n[e]||(n[e]=t()),n[e]):t()}var fc;function pc(){return(pc=e((()=>{fc=dc(`__zag__refSet`,()=>new WeakSet)})))()}var mc,hc,gc,_c,vc,yc,bc;function xc(){return(xc=e((()=>{pc(),mc=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&`props`in e,hc=e=>typeof e==`object`&&!!e&&`__v_isVNode`in e,gc=e=>typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeName==`string`,_c=e=>mc(e)||hc(e)||gc(e),vc=e=>typeof e==`object`&&!!e,yc=e=>vc(e)&&!fc.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!_c(e)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise)&&!(e instanceof File)&&!(e instanceof Blob)&&!(e instanceof AbortController),bc=()=>!1})))()}var Sc,Cc,wc,Tc,Ec,Dc;function Oc(){return(Oc=e((()=>{Sc=Symbol(),Cc=Object.getPrototypeOf,wc=new WeakMap,Tc=e=>e&&(wc.has(e)?wc.get(e):Cc(e)===Object.prototype||Cc(e)===Array.prototype),Ec=e=>Tc(e)&&e[Sc]||null,Dc=(e,t=!0)=>{wc.set(e,t)}})))()}function kc(e={}){return Pc(e)}function Ac(e,t,n){let r=Mc.get(e);bc()&&!r&&console.warn(`Please use proxy object`);let i,a=[],o=r[3],s=!1,c=o(e=>{a.push(e),n?t(a.splice(0)):i||=Promise.resolve().then(()=>{i=void 0,s&&t(a.splice(0))})});return s=!0,()=>{s=!1,c()}}function jc(e){let t=Mc.get(e);bc()&&!t&&console.warn(`Please use proxy object`);let[n,r,i]=t;return i(n,r())}var Mc,Nc,Pc;function Fc(){return(Fc=e((()=>{Oc(),pc(),xc(),Mc=dc(`__zag__proxyStateMap`,()=>new WeakMap),Nc=(e=Object.is,t=(e,t)=>new Proxy(e,t),n=new WeakMap,r=(e,t)=>{let r=n.get(e);if(r?.[0]===t)return r[1];let i=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return Dc(i,!0),n.set(e,[t,i]),Reflect.ownKeys(e).forEach(t=>{let n=Reflect.get(e,t);fc.has(n)?(Dc(n,!1),i[t]=n):Mc.has(n)?i[t]=jc(n):i[t]=n}),Object.freeze(i)},i=new WeakMap,a=[1,1],o=n=>{if(!vc(n))throw Error(`object required`);let o=i.get(n);if(o)return o;let s=a[0],c=new Set,l=(e,t=++a[0])=>{s!==t&&(s=t,c.forEach(n=>n(e,t)))},u=a[1],d=(e=++a[1])=>(u!==e&&!c.size&&(u=e,p.forEach(([t])=>{let n=t[1](e);n>s&&(s=n)})),s),f=e=>(t,n)=>{let r=[...t];r[1]=[e,...r[1]],l(r,n)},p=new Map,m=(e,t)=>{if(bc()&&p.has(e))throw Error(`prop listener already exists`);if(c.size){let n=t[3](f(e));p.set(e,[t,n])}else p.set(e,[t])},h=e=>{let t=p.get(e);t&&(p.delete(e),t[1]?.())},g=e=>(c.add(e),c.size===1&&p.forEach(([e,t],n)=>{if(bc()&&t)throw Error(`remove already exists`);let r=e[3](f(n));p.set(n,[e,r])}),()=>{c.delete(e),c.size===0&&p.forEach(([e,t],n)=>{t&&(t(),p.set(n,[e]))})}),_=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),v=t(_,{deleteProperty(e,t){let n=Reflect.get(e,t);h(t);let r=Reflect.deleteProperty(e,t);return r&&l([`delete`,[t],n]),r},set(t,n,r,a){let o=Reflect.has(t,n),s=Reflect.get(t,n,a);if(o&&(e(s,r)||i.has(r)&&e(s,i.get(r))))return!0;h(n),vc(r)&&(r=Ec(r)||r);let c=r;if(!Object.getOwnPropertyDescriptor(t,n)?.set){!Mc.has(r)&&yc(r)&&(c=kc(r));let e=!fc.has(c)&&Mc.get(c);e&&m(n,e)}return Reflect.set(t,n,c,a),l([`set`,[n],r,s]),!0}});i.set(n,v);let y=[_,d,r,g];return Mc.set(v,y),Reflect.ownKeys(n).forEach(e=>{let t=Object.getOwnPropertyDescriptor(n,e);t.get||t.set?Object.defineProperty(_,e,t):v[e]=n[e]}),v})=>[o,Mc,fc,e,t,yc,n,r,i,a],[Pc]=Nc()})))()}function Ic(e){let t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);let n=e().isEqual??Object.is,r=kc({value:t}),i=()=>e().value!==void 0;return{initial:t,ref:r,get(){return i()?e().value:r.value},set(t){let a=i()?e().value:r.value,o=O(t)?t(a):t;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:o,prev:a}),i()||(r.value=o),n(o,a)||e().onChange?.(o,a)},invoke(t,n){e().onChange?.(t,n)},hash(t){return e().hash?.(t)??String(t)}}}function Lc(){return(Lc=e((()=>{Fc(),k(),Ic.cleanup=e=>{},Ic.ref=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}}})))()}function Rc(e){let t={current:e};return{get(e){return t.current[e]},set(e,n){t.current[e]=n}}}function zc(e,t){if(!se(e)||!se(t))return t===void 0?e:t;let n={...e};for(let r of Object.keys(t)){let i=t[r],a=e[r];i!==void 0&&(n[r]=se(a)&&se(i)?zc(a,i):i)}return n}function Bc(){return(Bc=e((()=>{k()})))()}var Vc;function Hc(){return(Hc=e((()=>{ac(),Er(),Sr(),nt(),ct(),Fc(),ve(),ge(),E(),k(),C(),Lc(),Bc(),Vc=class{constructor(e,t={}){Q(this,`machine`,e),Q(this,`scope`),Q(this,`context`),Q(this,`prop`),Q(this,`state`),Q(this,`refs`),Q(this,`computed`),Q(this,`event`,{type:``}),Q(this,`previousEvent`,{type:``}),Q(this,`effects`,new Map),Q(this,`effectId`,0),Q(this,`replaceTracker`,ke()),Q(this,`transition`,null),Q(this,`cleanups`,[]),Q(this,`subscriptions`,[]),Q(this,`userPropsRef`),Q(this,`getEvent`,()=>({...this.event,current:()=>this.event,previous:()=>this.previousEvent})),Q(this,`getState`,()=>({...this.state,matches:(...e)=>e.some(e=>qe(this.state.get(),e)),hasTag:e=>Ye(this.machine,this.state.get(),e)})),Q(this,`debug`,(...e)=>{this.machine.debug&&console.log(...e)}),Q(this,`notify`,()=>{this.publish()}),Q(this,`send`,e=>{if(this.status!==ot.Started)return;let t=e?.replaces,n=t?this.replaceTracker.claim(t):void 0;queueMicrotask(()=>{if(!e||t&&n&&this.replaceTracker.isReplaced(t,n))return;this.previousEvent=this.event,this.event=e,this.debug(`send`,e);let r=this.state.get(),i=e.type,{transitions:a,source:o}=Ge(this.machine,r,i),s=this.choose(a);if(!s)return;this.transition=s;let c=We(this.machine,s.target??r,o);this.debug(`transition`,s),c===r?s.reenter?this.state.invoke(r,r):this.action(s.actions):this.state.set(c)})}),Q(this,`action`,e=>{let t=O(e)?e(this.getParams()):e;if(!t)return;let n=t.map(e=>{let t=this.machine.implementations?.actions?.[e];return t||ye(`[zag-js] No implementation found for action "${JSON.stringify(e)}"`),t});for(let e of n)e?.(this.getParams())}),Q(this,`guard`,e=>{if(O(e))return e(this.getParams());let t=this.machine.implementations?.guards?.[e];return t||ye(`[zag-js] No implementation found for guard "${JSON.stringify(e)}"`),t?.(this.getParams())}),Q(this,`startEffects`,(e,t)=>{let n=O(t)?t(this.getParams()):t;if(n)for(let t of n){let n=this.machine.implementations?.effects?.[t];if(!n){ye(`[zag-js] No implementation found for effect "${JSON.stringify(t)}"`);continue}let r=n({...this.getParams(),watchEffect:Cr}),i=++this.effectId,a={id:i,path:e,cleanup:void 0};if(wr(r)){a.deps=r.deps,a.setup=r.setup;let e=r.setup();a.cleanup=O(e)?e:void 0,a.values=r.deps.map(e=>e())}else O(r)&&(a.cleanup=r);this.effects.set(i,a)}}),Q(this,`stopEffects`,e=>{for(let[t,n]of this.effects)n.path===e&&(n.cleanup?.(`exit`),this.effects.delete(t))}),Q(this,`reconcileEffects`,()=>{for(let e of this.effects.values()){let t=e.deps;if(!t)continue;let n=t.map(e=>e());if(!n.some((t,n)=>!T(e.values[n],t)))continue;e.values=n,e.cleanup?.(`restart`);let r=e.setup();e.cleanup=O(r)?r:void 0}}),Q(this,`choose`,e=>g(e).find(e=>{let t=!e.guard;return D(e.guard)?t=!!this.guard(e.guard):O(e.guard)&&(t=e.guard(this.getParams())),t})),Q(this,`subscribe`,e=>(this.subscriptions.push(e),()=>{let t=this.subscriptions.indexOf(e);t>-1&&this.subscriptions.splice(t,1)})),Q(this,`status`,ot.NotStarted),Q(this,`publish`,()=>{this.callTrackers(),this.reconcileEffects(),this.subscriptions.forEach(e=>e(this.service))}),Q(this,`trackers`,[]),Q(this,`setupTrackers`,()=>{this.machine.watch?.(this.getParams())}),Q(this,`callTrackers`,()=>{this.trackers.forEach(({deps:e,fn:t})=>{let n=e.map(e=>e());T(t.prev,n)||(t(),t.prev=n)})}),Q(this,`getParams`,()=>({state:this.getState(),context:this.context,event:this.getEvent(),prop:this.prop,send:this.send,action:this.action,guard:this.guard,track:(e,t)=>{t.prev=e.map(e=>e()),this.trackers.push({deps:e,fn:t})},refs:this.refs,computed:this.computed,flush:pe,scope:this.scope,choose:this.choose})),this.userPropsRef={current:t};let{id:n,ids:r,getRootNode:i}=de(t);this.scope=xr({id:n,ids:r,getRootNode:i});let a=t=>{let n=de(this.userPropsRef.current);return(e.props?.({props:_e(n),scope:this.scope})??n)[t]};this.prop=a;let o=e.context?.({prop:a,bindable:Ic,scope:this.scope,flush(e){queueMicrotask(e)},getContext(){return s},getComputed(){return c},getRefs(){return l},getEvent:this.getEvent.bind(this)});o&&Object.values(o).forEach(e=>{let t=Ac(e.ref,()=>this.notify());this.cleanups.push(t)});let s={get(e){return o?.[e].get()},set(e,t){o?.[e].set(t)},initial(e){return o?.[e].initial},hash(e){let t=o?.[e].get();return o?.[e].hash(t)}};this.context=s;let c=t=>(xe(e.computed,()=>`[zag-js] No computed object found on machine`),e.computed[t]({context:s,event:this.getEvent(),prop:a,refs:this.refs,scope:this.scope,computed:c}));this.computed=c;let l=Rc(e.refs?.({prop:a,context:s})??{});this.refs=l;let u=Ic(()=>({defaultValue:We(e,e.initialState({prop:a})),onChange:(t,n)=>{let{exiting:r,entering:i}=Ke(this.machine,n,t,this.transition?.reenter);r.forEach(e=>{this.stopEffects(e.path)}),r.forEach(e=>{this.action(e.state?.exit)}),this.action(this.transition?.actions),i.forEach(e=>{this.startEffects(e.path,e.state?.effects)}),n===`__init__`&&(this.action(e.entry),this.startEffects(st,e.effects)),i.forEach(e=>{this.action(e.state?.entry)})}}));this.state=u,this.cleanups.push(Ac(this.state.ref,()=>this.notify()))}updateProps(e){let t=this.userPropsRef.current;this.userPropsRef.current=()=>zc(de(t),de(e)),this.notify()}start(){this.status=ot.Started,this.debug(`initializing...`),this.state.invoke(this.state.initial,st),this.setupTrackers()}stop(){this.effects.forEach(e=>e.cleanup?.(`exit`)),this.effects.clear(),this.transition=null,this.action(this.machine.exit),this.cleanups.forEach(e=>e()),this.cleanups=[],this.subscriptions=[],this.status=ot.Stopped,this.debug(`unmounting...`)}get service(){return{state:this.getState(),send:this.send,context:this.context,prop:this.prop,scope:this.scope,refs:this.refs,computed:this.computed,event:this.getEvent(),getStatus:()=>this.status}}}})))()}var $,Uc;function Wc(){return(Wc=e((()=>{lc(),$=e=>{let t={...e};for(let e of[`onFocus`,`onBlur`])e in t&&(t[e===`onFocus`?`onFocusIn`:`onFocusOut`]=t[e],delete t[e]);return t},Uc={element:$,button:e=>$({...e,onPointerDown(t){t.pointerType!==`touch`&&e.onPointerDown?.(t)}}),input:$,label:$,circle:$,img:$,output:$,path:$,select:$,svg:$,textarea:$,rect:$,style:cc.style}})))()}function Gc(e,r,o,s,l,u,d){let f,p,m=!1,h=!1,g=t=>![...e.children].some(e=>e.open&&i(e.surface,t))&&(s.surface===`listbox`?e.surface.contains(t):t.closest(`[role="menu"]`)===e.surface),_=t=>{if(!e.open||s.focus===`retain`&&(s.reveal===`caller`||s.virtualized?.()))return;let r=t.computed(`highlightedId`),o=l(!1),c=r?o.find(e=>e.id===r):void 0;c&&s.focus===`retain`&&!h&&n(e.surface,c);let u=t.scope.getActiveElement();if(m||!u?.matches(`input, textarea, select`)){if(s.focus!==`retain`)for(let e of o){let t=e===c?0:-1;e.tabIndex!==t&&(e.tabIndex=t)}c&&s.focus!==`retain`&&m&&![...e.children].some(e=>e.open&&i(e.surface,u))&&a(c)}},v=()=>s.surface===`listbox`&&s.virtualized?.()?s.items?.().filter(e=>!e.disabled):void 0,y=(t,n,r)=>{queueMicrotask(()=>{let i=v();e.open&&i&&r((n===(t?`END`:`HOME`)?void 0:i.find(e=>e.value===s.value?.()))?.value??(t?i.at(-1):i[0])?.value??null)})},b=Z.computed,x={...Z,watch({track:e,action:t,context:n}){e([()=>n.get(`isSubmenu`)],()=>t([`setSubmenuPlacement`])),e([()=>n.hash(`anchorPoint`)],()=>{n.get(`anchorPoint`)&&t([`reposition`])})},computed:{...b,highlightedId(e){let t=e.context.get(`highlightedValue`);return s.surface===`listbox`?t==null?null:`${e.scope.id}:${t}`:(t==null?null:l(!1).find(e=>e.dataset.value===t)?.id)??b.highlightedId(e)}},implementations:{...Z.implementations,effects:{...Z.implementations?.effects,trackPositioning(){},trackInteractOutside(){},scrollToHighlightedItem(){},waitForCloseDelay(e){let n=()=>Z.implementations.effects.waitForCloseDelay(e),r=n(),i=()=>{r(),r=n()},a=e.scope.getDoc(),o=t(a,`pointermove`,i);return()=>{o(),r()}}},actions:{...Z.implementations?.actions,highlightFirstItem(e){if(v())y(!1,e.event.type,t=>e.context.set(`highlightedValue`,t));else{if(s.surface!==`listbox`&&e.event.type!==`HOME`){let t=l().find(e=>e.hasAttribute(`data-initial-focus`)&&!e.matches(`:disabled`)&&e.getAttribute(`aria-disabled`)!==`true`);if(t){e.context.set(`highlightedValue`,t.getAttribute(`data-value`));return}}Z.implementations?.actions?.highlightFirstItem?.(e)}},highlightLastItem(e){v()?y(!0,e.event.type,t=>e.context.set(`highlightedValue`,t)):Z.implementations?.actions?.highlightLastItem?.(e)},setHighlightedItem(e){if(s.surface===`listbox`){let t=e.event.target;e.context.set(`highlightedValue`,e.event.value??(t instanceof HTMLElement?t.dataset.value:null)??null)}else Z.implementations?.actions?.setHighlightedItem?.(e)},highlightNextItem(e){let t=v();if(t){let n=e.context.get(`highlightedValue`),r=t.findIndex(e=>e.value===n),i=e.event.loop??e.prop(`loopFocus`),a=r<0||i&&r===t.length-1?0:Math.min(r+1,t.length-1);e.context.set(`highlightedValue`,t[a]?.value??null)}else s.surface===`listbox`&&e.context.get(`highlightedValue`)===``&&e.context.set(`highlightedValue`,`${e.scope.id}:`),Z.implementations?.actions?.highlightNextItem?.(e)},highlightPrevItem(e){let t=v();if(t){let n=e.context.get(`highlightedValue`),r=t.findIndex(e=>e.value===n),i=e.event.loop??e.prop(`loopFocus`),a=r<0||i&&r===0?t.length-1:Math.max(r-1,0);e.context.set(`highlightedValue`,t[a]?.value??null)}else s.surface===`listbox`&&e.context.get(`highlightedValue`)===``&&e.context.set(`highlightedValue`,`${e.scope.id}:`),Z.implementations?.actions?.highlightPrevItem?.(e)},highlightMatchedItem(e){let t=v();if(!t){Z.implementations?.actions?.highlightMatchedItem?.(e);return}let n=e.refs.get(`typeaheadState`),r=n.keysSoFar+e.event.key,i=r.length>1&&Array.from(r).every(e=>e===r[0])?r[0]:r,a=e.context.get(`highlightedValue`),o=t.findIndex(e=>e.value===a),s=(o<0?t:[...t.slice(o),...t.slice(0,o)]).find(e=>i.length===1&&e.value===a?!1:(e.label??e.value).split(``).map(e=>{let t=e.charCodeAt(0);return t>0&&t<128?e:t>=128&&t<=255?`\\x${t.toString(16)}`:``}).join(``).trim().toLowerCase().startsWith(i.toLowerCase()));clearTimeout(n.timer),n.keysSoFar=r,n.timer=window.setTimeout(()=>{n.keysSoFar=``,n.timer=-1},350),s&&e.context.set(`highlightedValue`,s.value)},clickHighlightedItem(e){let t=v();if(t){let n=e.context.get(`highlightedValue`);n!==null&&t.some(e=>e.value===n)&&d(n)}else Z.implementations?.actions?.clickHighlightedItem?.(e)},reposition(){},focusTrigger(){},focusMenu(){},focusParentMenu(){},closeSiblingMenus(){},setIntentPolygon(t){let n=e.trigger;if(!n)return;let r=e.surface.getBoundingClientRect(),i=n.getBoundingClientRect();t.context.set(`currentPlacement`,r.x<i.x?`left-start`:`right-start`),Z.implementations?.actions?.setIntentPolygon?.(t)}}}},S={id:e.id,ids:s.ids,getRootNode:()=>{let t=e.surface,n=t?.getRootNode();return n instanceof ShadowRoot?n:t?.ownerDocument??document},dir:`ltr`,open:!1,loopFocus:!0,closeOnSelect:!1,"aria-label":e.id,onOpenChange({open:t}){t&&e.open&&m&&_(C.service);let n=!t&&i(e.surface,C.scope.getActiveElement()),r=t&&[...e.parent?.children??[]].some(t=>t!==e&&t.containsFocus());e.request(t,t&&(m||r)?`first`:n?`return`:`none`)||C.send({type:e.open?`CONTROLLED.OPEN`:`CONTROLLED.CLOSE`})},navigate:({node:e})=>queueMicrotask(()=>e.click())},C=new Vc(x,()=>S),w=()=>Ys(C.service,Uc),T=()=>{S.dir=r();let t=C.subscribe(e=>{u(),_(e)}),n=e=>{if(S.dir=r(),S.open=e,C.send({type:e?`CONTROLLED.OPEN`:`CONTROLLED.CLOSE`,previousEvent:C.service.event}),e&&(h=!1),e&&s.items){let e=s.items().filter(e=>!e.disabled);C.send({type:`HIGHLIGHTED.SET`,value:e.find(e=>e.value===s.value?.())?.value??e[0]?.value??null})}},i=e.subscribe(n);return C.start(),n(e.open),o&&(w().setParent(o),Ys(o,Uc).setChild(C.service)),()=>{if(t(),i(),C.stop(),clearTimeout(C.service.refs.get(`typeaheadState`).timer),o){let t={...o.refs.get(`children`)};delete t[e.id],o.refs.set(`children`,t)}}},E=(e,t,n)=>{let r=w();if(S.dir!==e&&(S.dir=e,u()),!t)return;let i=t.filter(e=>!e.disabled);if(!i.some(e=>e.value===r.highlightedValue)){let e=i.find(e=>e.value===n)?.value??i[0]?.value??null;r.highlightedValue!==e&&(h=!1,C.service.context.set(`highlightedValue`,e))}s.focus===`retain`&&_(C.service)},ee=t=>{if(t.defaultPrevented||t.isComposing||!e.open)return;h=!1;let n=t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement,r=s.surface!==`listbox`&&t.target instanceof HTMLButtonElement&&t.target.matches(`:is(input, textarea, select, [data-form-control], button, a[href]):not([role^="menuitem"]):not([aria-haspopup="menu"]:not([data-form-control]))`)&&!t.target.closest(`[role^="menuitem"]`),i=t.key===`ArrowDown`?r?`HOME`:`ARROW_DOWN`:t.key===`ArrowUp`?r?`END`:`ARROW_UP`:t.key===`Home`?`HOME`:t.key===`End`?`END`:t.key===`Enter`?`ENTER`:void 0;if(i&&(!n||![`Home`,`End`].includes(t.key)))m=!0,C.send({type:i}),t.preventDefault(),t.stopPropagation();else if(!n&&t.key===`Backspace`){let e=C.service.refs.get(`typeaheadState`),n=e.keysSoFar.slice(0,-1);e.keysSoFar=``,n&&C.send({type:`TYPEAHEAD`,key:n}),t.preventDefault(),t.stopPropagation()}else!n&&t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&(m=!0,C.send({type:t.key===` `&&!C.service.refs.get(`typeaheadState`).keysSoFar?`ENTER`:`TYPEAHEAD`,key:t.key}),t.preventDefault(),t.stopPropagation())};return{service:C.service,read:w,start:T,updateInputs:E,keydown:ee,pointerDelta(e){let t=f===void 0?0:e-f;return f=e,t},item(e,t,n=!1,r,i=!1,a=t){let o=r?e.getOptionItemProps({value:t,valueText:a,type:r,checked:i,disabled:n,closeOnSelect:!1}):e.getItemProps({value:t,valueText:a,disabled:n,closeOnSelect:!1});return{...o,onPointerMove:e=>{(e.clientX!==f||e.clientY!==p)&&(m=!1,h=!0,o.onPointerMove?.(e))},tabIndex:s.focus!==`retain`&&e.highlightedValue===t?0:-1}},trigger(t,n=!1){let r=w(),i=t?t.read().getTriggerItemProps(r):r.getTriggerProps();return{...i,"aria-disabled":n?`true`:void 0,"data-disabled":n?``:void 0,onClick:a=>{n||(m=a.detail===0||s.pointerFocus?.()!==`trigger`,!m&&e.trigger&&c(e.trigger,{preventScroll:!0}),t&&!a.defaultPrevented?r.setOpen(!0):i.onClick?.(a))},onKeyDown:e=>{n||e.key===`Escape`||t&&[`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)||(m=!0,i.onKeyDown?.(e))},onPointerMove:r=>{let i=e.trigger;if(n||!t||!i||r.pointerType!==`mouse`)return;m=!1;let a=r.currentTarget,s={x:r.clientX,y:r.clientY},c=t.pointerDelta(s.x),l=o&&Object.values(o.refs.get(`children`)).some(t=>{let n=t.context.get(`intentPolygon`);return t.scope.id!==e.id&&t.state.hasTag(`open`)&&(t.context.get(`currentPlacement`)?.startsWith(`left`)?c<0:c>0)&&n&&Rs(n,s)});o&&!l&&(o.refs.set(`pointerRoutingLocked`,!1),o.context.set(`pointerRoutingMode`,`interactive`)),t.read().getItemProps({value:i.id}).onPointerMove?.(r),queueMicrotask(()=>{C.send({type:`TRIGGER_POINTERMOVE`,target:a,point:s})})}}},content(){let t=w().getContentProps(),{hidden:n,tabIndex:r,style:i,"aria-activedescendant":a,...o}=t;return{...o,tabIndex:-1,onPointerMove:e=>{f=e.clientX,p=e.clientY},onKeyDown:n=>{let r=n.target;if(n.defaultPrevented||n.isComposing||!(r instanceof HTMLElement)||!g(r))return;if(s.surface===`listbox`){ee(n);return}if(n.key===`Escape`){[...e.children].some(e=>e.open)||e.keydown(n);return}if(r.matches(`input[data-search]`)&&(n.key===`ArrowDown`||n.key===`Enter`)){let e=l().find(e=>!e.matches(`:disabled`)&&e.getAttribute(`aria-disabled`)!==`true`&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING));n.preventDefault(),e?.focus({preventScroll:!0});return}if(r instanceof HTMLButtonElement&&r.matches(`:is(input, textarea, select, [data-form-control], button, a[href]):not([role^="menuitem"]):not([aria-haspopup="menu"]:not([data-form-control]))`)&&(n.key===`ArrowDown`||n.key===`ArrowUp`)){ee(n);return}if(n.key===`Tab`||r.matches(`:is(input, textarea, select, [data-form-control], button, a[href]):not([role^="menuitem"]):not([aria-haspopup="menu"]:not([data-form-control]))`))return;m=!0,h=!1;let i=r.dataset.value;i&&i!==w().highlightedValue&&w().setHighlightedValue(i),t.onKeyDown?.(n),_(C.service)}}}}}function Kc(){return(Kc=e((()=>{tc(),Xs(),zs(),Hc(),r(),o(),s(),Wc()})))()}Kc();export{Gc as createMenuRuntime};