UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

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