@kky42/pievo-server 2.4.5 → 2.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{MachinesModal-LxqWuI5Z.js → MachinesModal-zPwcC1mr.js} +1 -1
  3. package/.output/public/assets/{index-0VPwUcZS.js → index-BqiDqbyu.js} +3 -3
  4. package/.output/public/assets/{invite._token-rUfzvFd9.js → invite._token-C7wSLe5z.js} +1 -1
  5. package/.output/public/assets/{loops._loopId-BGXJzKUQ.js → loops._loopId-DEMMNA_5.js} +1 -1
  6. package/.output/public/assets/{loops._loopId_.runs._runId-BL2fgDqc.js → loops._loopId_.runs._runId-DgThODTl.js} +1 -1
  7. package/.output/public/assets/{routes-BfEn81Yx.js → routes-C581U2Ac.js} +1 -1
  8. package/.output/public/assets/{t._teamId-CBTSOgMp.js → t._teamId-D8prt2QZ.js} +1 -1
  9. package/.output/server/_ssr/{DashboardView-DCxO1HHu.mjs → DashboardView-CDGLNgi_.mjs} +2 -2
  10. package/.output/server/_ssr/{MachinesModal-CBpDG1jV.mjs → MachinesModal-BkHx2efW.mjs} +2 -17
  11. package/.output/server/_ssr/{artifactKind-CmNkee8I.mjs → artifactKind-DCMrrjl8.mjs} +2 -2
  12. package/.output/server/_ssr/{loops._loopId-3GFocAep.mjs → loops._loopId-Dx0u0aw-.mjs} +3 -3
  13. package/.output/server/_ssr/{router-CAxR0CJG.mjs → router-DvhSmRzV.mjs} +4 -4
  14. package/.output/server/_ssr/{routes-BhM8_kf0.mjs → routes-CKoFPECd.mjs} +3 -3
  15. package/.output/server/_ssr/{routes-DgjhPWRJ.mjs → routes-Dr2NUhk0.mjs} +3 -3
  16. package/.output/server/_ssr/ssr.mjs +2 -2
  17. package/.output/server/_ssr/{t._teamId-259lg_JB.mjs → t._teamId-94LkBNB8.mjs} +3 -3
  18. package/.output/server/_ssr/{t._teamId-B6d1UVPx.mjs → t._teamId-xSDQfJUD.mjs} +3 -3
  19. package/.output/server/{_tanstack-start-manifest_v-HOdB50PD.mjs → _tanstack-start-manifest_v-CjVWGjiv.mjs} +9 -9
  20. package/.output/server/index.mjs +61 -61
  21. package/package.json +1 -1
@@ -1 +1 @@
1
- import{E as e,M as t,O as n,P as r,S as i,T as a,_ as o,a as s,b as c,d as l,f as u,g as d,j as f,m as p,o as m,r as h,s as g,t as _,u as v,v as y,w as b,x,y as S}from"./ui-s5IMg6RF.js";import{D as C,Et as w,F as T,H as E,P as D,p as O}from"./preload-helper-Bs7oCAsw.js";import{i as k,n as A}from"./lifecycleUi-C0DaC6NM.js";var j=r(t(),1),M={};function N(e,t){let n=j.useRef(M);return n.current===M&&(n.current=e(t)),n}var P=r(w(),1),F=f(),I=T(),L=D(),ee=[],te=void 0;function ne(){return te}function re(e){ee.push(e)}function ie(e){let t=(t,n)=>{let r=N(ae).current,i;try{te=r;for(let e of ee)e.before(r);i=e(t,n);for(let e of ee)e.after(r);r.didInitialize=!0}finally{te=void 0}return i};return t.displayName=e.displayName||e.name,t}function R(e){return j.forwardRef(ie(e))}function ae(){return{didInitialize:!1}}var z=typeof document<`u`?j.useLayoutEffect:()=>{};function oe(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var B=oe(`https://base-ui.com/production-error`,`Base UI`),V=j.createContext(void 0);function se(e){let t=j.useContext(V);if(t===void 0&&!e)throw Error(B(72));return t}var ce=[];function le(e){j.useEffect(e,ce)}var ue=0,de=class e{static create(){return new e}currentId=ue;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=ue,t()},e)}isStarted(){return this.currentId!==ue}clear=()=>{this.currentId!==ue&&(clearTimeout(this.currentId),this.currentId=ue)};disposeEffect=()=>this.clear};function fe(){let e=N(de.create).current;return le(e.disposeEffect),e}function pe(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:me,platform:he,maxTouchPoints:ge}=pe(),_e=me.toLowerCase(),ve=he.toLowerCase(),ye=/^i(os$|p)/.test(ve)||ve===`macintel`&&ge>1,be=`android`,xe=ve===be||_e.includes(be),Se=!ye&&ve.startsWith(`mac`);ve.startsWith(`win`),!xe&&/^(linux|chrome os)/.test(ve);var Ce=Se||ye,we=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!we&&_e.includes(`firefox`),!we&&_e.includes(`chrom`);var Te=Ce,Ee=/jsdom|happydom/.test(_e);function De(e){e.preventDefault(),e.stopPropagation()}function Oe(e){return`nativeEvent`in e}function ke(e){return e.pointerType===``&&e.isTrusted?!0:xe&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Ae(e){return Ee?!1:!xe&&e.width===0&&e.height===0||xe&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function je(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Me(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function Ne(){return typeof window<`u`}function H(e){return Fe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pe(e){return((Fe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Fe(e){return Ne()?e instanceof Node||e instanceof U(e).Node:!1}function W(e){return Ne()?e instanceof Element||e instanceof U(e).Element:!1}function G(e){return Ne()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Ie(e){return!Ne()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Le(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Je(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Re(e){return/^(table|td|th)$/.test(H(e))}function ze(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Be=/transform|translate|scale|rotate|perspective|filter/,Ve=/paint|layout|strict|content/,He=e=>!!e&&e!==`none`,Ue;function We(e){let t=W(e)?Je(e):e;return He(t.transform)||He(t.translate)||He(t.scale)||He(t.rotate)||He(t.perspective)||!Ke()&&(He(t.backdropFilter)||He(t.filter))||Be.test(t.willChange||``)||Ve.test(t.contain||``)}function Ge(e){let t=Xe(e);for(;G(t)&&!qe(t);){if(We(t))return t;if(ze(t))return null;t=Xe(t)}return null}function Ke(){return Ue??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ue}function qe(e){return/^(html|body|#document)$/.test(H(e))}function Je(e){return U(e).getComputedStyle(e)}function Ye(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xe(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ie(e)&&e.host||Pe(e);return Ie(t)?t.host:t}function Ze(e){let t=Xe(e);return qe(t)?e.ownerDocument?e.ownerDocument.body:e.body:G(t)&&Le(t)?t:Ze(t)}function Qe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ze(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=$e(a);return t.concat(a,a.visualViewport||[],Le(r)?r:[],e&&n?Qe(e):[])}else return t.concat(r,Qe(r,[],n))}function $e(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var et=`data-base-ui-focusable`,tt=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`;function nt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function K(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Ie(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function rt(e){return`composedPath`in e?e.composedPath()[0]:e.target}function it(e,t){if(!W(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(K(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function at(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function ot(e){return e.matches(`html,body`)}function st(e){return G(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function ct(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${tt}`)!=null}function lt(e){return e?e.getAttribute(`role`)===`combobox`&&st(e):!1}function ut(e){if(!e||Ee)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function dt(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function ft(e,t){return t!=null&&!je(t)?0:typeof e==`function`?e():e}function pt(e,t,n){let r=ft(e,n);return typeof r==`number`?r:r?.[t]}function mt(e){return typeof e==`function`?e():e}function ht(e,t){return t||e===`click`||e===`mousedown`}function gt(e){return e?.includes(`mouse`)&&e!==`mousedown`}function _t(){}Object.freeze([]);var q=Object.freeze({}),vt=`none`,yt=`trigger-press`,bt=`trigger-hover`,xt=`trigger-focus`,St=`outside-press`,Ct=`close-press`,wt=`focus-out`,Tt=`escape-key`,Et=`disabled`,Dt=`imperative-action`;function J(e,t,n,r){let i=!1,a=!1,o=r??q;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var Ot=j.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new de,currentIdRef:{current:null},currentContextRef:{current:null}});function kt(e,t){e.current=t.current}function At(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=j.useRef(n),a=j.useRef(n),o=j.useRef(null),s=j.useRef(null),c=fe();return z(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:pt(i.current,`open`),close:pt(n,`close`)}},[n,o,i,a]),(0,F.jsx)(Ot.Provider,{value:j.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function jt(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=j.useContext(Ot),[f,p]=j.useState(!1),m=j.useRef(n),h=j.useRef(!1);return z(()=>{m.current=n},[n]),z(()=>()=>{h.current=!0},[]),z(()=>{function e(){h.current||p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),z(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:pt(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,J(vt))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),z(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,kt(o,c),d.clear()}},[l,a,o,i,c,d]),j.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function Y(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Mt(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Nt(e,t,n,r){let i=N(Ft).current;return It(i,e,t,n,r)&&Rt(i,[e,t,n,r]),i.callback}function Pt(e){let t=N(Ft).current;return Lt(t,e)&&Rt(t,e),t.callback}function Ft(){return{callback:null,cleanup:null,refs:[]}}function It(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Lt(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function Rt(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}function zt(e){let t=N(Bt,e).current;return t.next=e,z(t.effect),t}function Bt(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Vt={...j},Ht=Vt.useInsertionEffect,Ut=Ht&&Ht!==Vt.useLayoutEffect?Ht:e=>e();function X(e){let t=N(Wt).current;return t.next=e,Ut(t.effect),t.trampoline}function Wt(){let e={next:void 0,callback:Gt,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Gt(){}var Kt=null;globalThis.requestAnimationFrame;var qt=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},Jt=class e{static create(){return new e}static request(e){return qt.request(e)}static cancel(e){return qt.cancel(e)}currentId=Kt;request(e){this.cancel(),this.currentId=qt.request(()=>{this.currentId=Kt,e()})}cancel=()=>{this.currentId!==Kt&&(qt.cancel(this.currentId),this.currentId=Kt)};disposeEffect=()=>this.cancel};function Yt(){let e=N(Jt.create).current;return le(e.disposeEffect),e}function Z(e){return e?.ownerDocument||document}var Xt={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Zt={...Xt,position:`fixed`,top:0,left:0};({...Xt});var Qt=j.forwardRef(function(e,t){let[n,r]=j.useState();z(()=>{Te&&we&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,F.jsx)(`span`,{...e,ref:t,style:Zt,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),$t=[`top`,`right`,`bottom`,`left`],en=Math.min,tn=Math.max,nn=Math.round,rn=Math.floor,an=e=>({x:e,y:e}),on={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function sn(e,t,n){return tn(e,en(t,n))}function cn(e,t){return typeof e==`function`?e(t):e}function ln(e){return e.split(`-`)[0]}function un(e){return e.split(`-`)[1]}function dn(e){return e===`x`?`y`:`x`}function fn(e){return e===`y`?`height`:`width`}function pn(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function mn(e){return dn(pn(e))}function hn(e,t,n){n===void 0&&(n=!1);let r=un(e),i=mn(e),a=fn(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=wn(o)),[o,wn(o)]}function gn(e){let t=wn(e);return[_n(e),t,_n(t)]}function _n(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var vn=[`left`,`right`],yn=[`right`,`left`],bn=[`top`,`bottom`],xn=[`bottom`,`top`];function Sn(e,t,n){switch(e){case`top`:case`bottom`:return n?t?yn:vn:t?vn:yn;case`left`:case`right`:return t?bn:xn;default:return[]}}function Cn(e,t,n,r){let i=un(e),a=Sn(ln(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(_n)))),a}function wn(e){let t=ln(e);return on[t]+e.slice(t.length)}function Tn(e){return{top:0,right:0,bottom:0,left:0,...e}}function En(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Tn(e)}function Dn(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}}function On(e){return e.visibility===`hidden`||e.visibility===`collapse`}function kn(e,t=e?Je(e):null){return!e||!e.isConnected||!t||On(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var An=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function jn(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return Ie(n)?n.host:null}function Mn(e){for(let t of Array.from(e.children))if(H(t)===`summary`)return t;return null}function Nn(e,t){let n=Mn(t);return!!n&&(e===n||K(n,e))}function Pn(e){let t=e?H(e):``;return e!=null&&e.matches(An)&&(t!==`summary`||e.parentElement!=null&&H(e.parentElement)===`details`&&Mn(e.parentElement)===e)&&(t!==`details`||Mn(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Fn(e){if(!Pn(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=jn(t)){let n=t!==e,r=H(t)===`slot`;if(t.hasAttribute(`inert`)||n&&H(t)===`details`&&!t.open&&!Nn(e,t)||t.hasAttribute(`hidden`)||!r&&!In(t,n))return!1}return!0}function In(e,t){let n=Je(e);return t?n.display!==`none`:kn(e,n)}function Ln(e){let t=e.tabIndex;if(t<0){let t=H(e);if(t===`details`||t===`audio`||t===`video`||G(e)&&e.isContentEditable)return 0}return t}function Rn(e){if(H(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function zn(e,t){let n=Rn(e);if(!n)return!0;let r=t.find(e=>{let t=Rn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Rn(e);return t?.name===n.name&&t.form===n.form})===n}function Bn(e){if(G(e)&&H(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return G(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Vn(e,t){Bn(e).forEach(e=>{Pn(e)&&t.push(e),Vn(e,t)})}function Hn(e,t,n){Bn(e).forEach(e=>{G(e)&&e.matches(t)&&n.push(e),Hn(e,t,n)})}function Un(e){return Fn(e)&&Ln(e)>=0}function Wn(e){let t=[];return Vn(e,t),t.filter(Fn)}function Gn(e){let t=Wn(e);return t.filter(e=>Ln(e)>=0&&zn(e,t))}function Kn(e,t){let n=Gn(e),r=n.length;if(r===0)return;let i=nt(Z(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function qn(e){return Kn(Z(e).body,1)||e}function Jn(e){return Kn(Z(e).body,-1)||e}function Yn(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!K(n,r)}function Xn(e){Gn(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Zn(e){let t=[];Hn(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Qn(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Qn(e,t.id,n)])}function $n(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function er(e){return`data-base-ui-${e}`}var tr=0;function nr(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(tr);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),_t;let o=requestAnimationFrame(a);return tr=o,()=>{tr===o&&(cancelAnimationFrame(o),tr=0)}}var rr={inert:new WeakMap,"aria-hidden":new WeakMap},ir=`data-base-ui-inert`,ar={inert:new WeakSet,"aria-hidden":new WeakSet},or=new WeakMap,sr=0;function cr(e){return ar[e]}function lr(e){return e?Ie(e)?e.host:lr(e.parentNode):null}var ur=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=lr(t);return e.contains(n)?n:null}).filter(e=>e!=null),dr=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},fr=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{H(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function pr(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=ur(t,e),l=i?fr(t,dr(c),new Set(c)):[],u=[],d=[];if(a){let e=rr[a],n=cr(a);s=n,o=e;let r=ur(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);fr(t,dr(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(or.get(e)||0)+1;or.set(e,t),d.push(e),t===1&&e.setAttribute(ir,``)}),sr+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(or.get(e)||0)-1;or.set(e,t),t||e.removeAttribute(ir)}),--sr,sr||(rr.inert=new WeakMap,rr[`aria-hidden`]=new WeakMap,ar.inert=new WeakSet,ar[`aria-hidden`]=new WeakSet,or=new WeakMap)}}function mr(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=Z(e[0]).body;return pr(e,a,n,r,{mark:i})}var hr=0;function gr(e,t=`mui`){let[n,r]=j.useState(e),i=e||n;return j.useEffect(()=>{n??(hr+=1,r(`${t}-${hr}`))},[n,t]),i}var _r=Vt.useId;function vr(e,t){if(_r!==void 0){let n=_r();return e??(t?`${t}-${n}`:n)}return gr(e,t)}var yr=19;function br(e){return yr>=e}function xr(e){if(!j.isValidElement(e))return null;let t=e,n=t.props;return(br(19)?n?.ref:t.ref)??null}function Sr(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Cr(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function wr(e,t){return typeof e==`function`?e(t):e}function Tr(e,t){return typeof e==`function`?e(t):e}var Er={};function Dr(e,t,n,r,i){if(!n&&!r&&!i&&!e)return kr(t);let a=kr(e);return t&&(a=Ar(a,t)),n&&(a=Ar(a,n)),r&&(a=Ar(a,r)),i&&(a=Ar(a,i)),a}function Or(e){if(e.length===0)return Er;if(e.length===1)return kr(e[0]);let t=kr(e[0]);for(let n=1;n<e.length;n+=1)t=Ar(t,e[n]);return t}function kr(e){return Pr(e)?{...Fr(e,Er)}:jr(e)}function Ar(e,t){return Pr(t)?Fr(t,e):Mr(e,t)}function jr(e){let t={...e};for(let e in t){let n=t[e];Nr(e,n)&&(t[e]=Lr(n))}return t}function Mr(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Sr(e.style,r);break;case`className`:e[n]=zr(e.className,r);break;default:Nr(n,r)?e[n]=Ir(e[n],r):e[n]=r}}return e}function Nr(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function Pr(e){return typeof e==`function`}function Fr(e,t){return Pr(e)?e(t):e??Er}function Ir(e,t){return t?e?(...n)=>{let r=n[0];if(Br(r)){let i=r;Rr(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:Lr(t):e}function Lr(e){return e&&((...t)=>{let n=t[0];return Br(n)&&Rr(n),e(...t)})}function Rr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function zr(e,t){return t?e?t+` `+e:t:e}function Br(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function Vr(e,t,n={}){let r=t.render,i=Hr(t,n);return n.enabled===!1?null:Gr(e,r,i,n.state??q)}function Hr(e,t={}){let{className:n,style:r,render:i}=e,{state:a=q,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?wr(n,a):void 0,d=l?Tr(r,a):void 0,f=l?Cr(a,c):q,p=l&&s?Ur(s):void 0,m=l?Sr(f,p)??{}:q;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=Pt([m.ref,xr(i),...o]):m.ref=Nt(m.ref,xr(i),o):Nt(null,null)),l?(u!==void 0&&(m.className=zr(m.className,u)),d!==void 0&&(m.style=Sr(m.style,d)),m):q}function Ur(e){return Array.isArray(e)?Or(e):Dr(void 0,e)}var Wr=Symbol.for(`react.lazy`);function Gr(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Dr(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===Wr&&(i=j.Children.toArray(t)[0]),j.cloneElement(i,e)}if(e&&typeof e==`string`)return Kr(e,n);throw Error(B(8))}function Kr(e,t){return e===`button`?(0,j.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,j.createElement)(`img`,{alt:``,...t,key:t.key}):j.createElement(e,t)}var qr={style:{transition:`none`}},Jr={fallbackAxisSide:`end`},Yr={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Xr=j.createContext(null),Zr=()=>j.useContext(Xr),Qr=er(`portal`);function $r(e={}){let{ref:t,container:n,componentProps:r=q,elementProps:i}=e,a=vr(),o=Zr()?.portalNode,[s,c]=j.useState(null),[l,u]=j.useState(null),d=X(e=>{e!==null&&u(e)}),f=j.useRef(null);z(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(Fe(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=Vr(`div`,r,{ref:[t,d],props:[{id:a,[Qr]:``},i]});return{portalNode:l,portalSubtree:s&&p?P.createPortal(p,s):null}}var ei=j.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,renderGuards:s,...c}=e,{portalNode:l,portalSubtree:u}=$r({container:o,ref:t,componentProps:e,elementProps:c}),d=j.useRef(null),f=j.useRef(null),p=j.useRef(null),m=j.useRef(null),[h,g]=j.useState(null),_=j.useRef(!1),v=h?.modal,y=h?.open,b=typeof s==`boolean`?s:!!h&&!h.modal&&h.open&&!!l;j.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&Yn(e)&&(e.type===`focusin`?_.current&&=(Zn(l),!1):(Xn(l),_.current=!0))}return Mt(Y(l,`focusin`,e,!0),Y(l,`focusout`,e,!0))},[l,v]),z(()=>{!l||y!==!0||!_.current||(Zn(l),_.current=!1)},[y,l]);let x=j.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,F.jsxs)(j.Fragment,{children:[u,(0,F.jsxs)(Xr.Provider,{value:x,children:[b&&l&&(0,F.jsx)(Qt,{"data-type":`outside`,ref:d,onFocus:e=>{Yn(e,l)?p.current?.focus():Jn(h?h.domReference:null)?.focus()}}),b&&l&&(0,F.jsx)(`span`,{"aria-owns":l.id,style:Yr}),l&&P.createPortal(a,l),b&&l&&(0,F.jsx)(Qt,{"data-type":`outside`,ref:f,onFocus:e=>{Yn(e,l)?m.current?.focus():(qn(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,J(`focus-out`,e.nativeEvent)))}})]})]})});function ti(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var ni=j.createContext(null),ri=j.createContext(null),ii=()=>j.useContext(ni)?.id||null,ai=e=>{let t=j.useContext(ri);return e??t};function oi(e){return e==null?e:`current`in e?e.current:e}function si(e,t){let n=U(rt(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var ci=20,li=[];function ui(){li=li.filter(e=>e.deref()?.isConnected)}function di(e){ui(),e&&H(e)!==`body`&&(li.push(new WeakRef(e)),li.length>ci&&(li=li.slice(-20)))}function fi(){return ui(),li[li.length-1]?.deref()}function pi(e){return e?Un(e)?e:Gn(e)[0]||e:null}function mi(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Wn(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Un(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function hi(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=X(()=>b.current.floatingContext?.nodeId),S=i===!1,C=lt(_)&&S,w=zt(i),T=zt(a),E=zt(l),D=zt(g),O=ai(p),k=Zr(),A=j.useRef(!1),M=j.useRef(!1),N=j.useRef(!1),P=j.useRef(null),I=j.useRef(``),L=j.useRef(``),ee=j.useRef(null),te=j.useRef(null),ne=Nt(ee,f,k?.beforeInsideRef),re=Nt(te,k?.afterInsideRef),ie=fe(),R=fe(),ae=Yt(),oe=k!=null,B=dt(v),V=X((e=B)=>e?Gn(e):[]),se=X(()=>m?.().filter(e=>e!=null)??[]);j.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&K(B,nt(Z(B)))&&V().length===0&&!C&&De(e)}return Y(Z(B),`keydown`,e)},[r,B,s,C,V]),j.useEffect(()=>{if(r||!g)return;let e=Z(B);function t(){N.current=!1}function n(e){let t=rt(e),n=se();N.current=!(K(v,t)||K(_,t)||K(k?.portalNode,t)||n.some(e=>e===t||K(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(M.current=!0,R.start(0,()=>{M.current=!1}))}function i(){L.current=`keyboard`}return Mt(Y(e,`pointerdown`,n,!0),Y(e,`pointerup`,t,!0),Y(e,`pointercancel`,t,!0),Y(e,`keydown`,i,!0),t)},[r,v,_,B,g,k,R,se]),j.useEffect(()=>{if(r||!c)return;let e=Z(B);function t(){M.current=!0,R.start(0,()=>{M.current=!1})}function n(e){let t=rt(e);Un(t)&&(P.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=rt(t);s&&n==null&&i!=null&&K(v,i)&&di(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=se(),f=n?.hasAttribute(er(`focus-guard`))&&[ee.current,te.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,oi(d),oi(u)].includes(n),p=!(K(_,n)||K(v,n)||K(n,v)||K(k?.portalNode,n)||l.some(e=>e===n||K(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>K(e,n))||f||O&&(Qn(O.nodesRef.current,a).find(e=>K(e.context?.elements.floating,n)||K(e.context?.elements.domReference,n))||$n(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,dt(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&B&&mi(B),o&&r!==_&&!kn(i)&&nt(e)===e.body){if(G(B)&&(B.focus(),o===`popup`)){ae.request(()=>{B.focus()});return}let e=V(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||B;G(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!M.current&&(C||n!==fi())&&(A.current=!0,h.setOpen(!1,J(wt,t)))})}function a(){N.current||(b.current.insideReactTree=!0,ie.start(0,()=>{b.current.insideReactTree=!1}))}let l=G(_)?_:null;if(!(!v&&!l))return Mt(l&&Y(l,`focusout`,i),l&&Y(l,`pointerdown`,t),v&&Y(v,`focusin`,n),v&&Y(v,`focusout`,i),v&&k&&Y(v,`focusout`,a,!0))},[r,_,v,B,s,O,k,h,c,o,V,C,x,b,ie,R,ae,u,d,se]),j.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${er(`portal`)}]`)||[]),t=(O?$n(O.nodesRef.current,x()):[]).find(e=>lt(e.context?.elements.domReference||null))?.context?.elements.domReference,n=mr([v,...e,ee.current,te.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...se(),t,oi(d),oi(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=mr([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,se]),z(()=>{if(!g||r||!G(B))return;let e=Z(B),t=nt(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||K(B,t))return;let i=null,a=()=>(i??=V(B),i[0]||B),o;o=r===!0||r===null?a():oi(r),o||=a();let s=K(B,nt(e));nr(o,{preventScroll:o===B,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=nt(e);return!(t!==o&&K(B,t))}})})},[r,g,B,V,w,E,D]),z(()=>{if(r||!B)return;let e=Z(B),t=nt(e),n=E.current==null;di(t);function i(e){if(e.open||(I.current=si(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`)if(e.nested)A.current=!1;else if(ke(e.nativeEvent)||Ae(e.nativeEvent))A.current=!1;else{let e=!1;Z(B).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.current=!0}}y.on(`openchange`,i);function a(){let e=T.current,r=typeof e==`function`?e(I.current):e;if(r===void 0||r===!1)return null;r===null&&(r=!0);let i=_?.isConnected?_:null,a=t?.isConnected&&H(t)!==`body`?t:null,o=n?a||i:i||a;return o||=fi()||null,typeof r==`boolean`?o:oi(r)||o||null}return()=>{y.off(`openchange`,i);let t=nt(e),n=se(),r=K(v,t)||n.some(e=>e===t||K(e,t))||O&&Qn(O.nodesRef.current,x(),!1).some(e=>K(e.context?.elements.floating,t)),o=T.current,s=a();queueMicrotask(()=>{let n=pi(s),i=typeof o!=`boolean`;o&&!A.current&&G(n)&&(!(!i&&n!==t&&t!==e.body)||r)&&n.focus({preventScroll:!0}),A.current=!1})}},[r,v,B,T,E,y,O,_,x,se]),z(()=>{if(!we||g||!v)return;let e=nt(Z(v));!G(e)||!st(e)||K(v,e)&&e.blur()},[g,v]),z(()=>{if(!(r||!k))return k.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{k.setFocusManagerState(null)}},[r,k,s,g,h,c,_]),z(()=>{if(!(r||!B))return mi(B),()=>{queueMicrotask(ui)}},[r,B]);let ce=!r&&(s?!C:!0)&&(oe||s);return(0,F.jsxs)(j.Fragment,{children:[ce&&(0,F.jsx)(Qt,{"data-type":`inside`,ref:ne,onFocus:e=>{if(s){let e=V();nr(e[e.length-1])}else k?.portalNode&&(A.current=!1,Yn(e,k.portalNode)?qn(_)?.focus():oi(d??k.beforeOutsideRef)?.focus())}}),n,ce&&(0,F.jsx)(Qt,{"data-type":`inside`,ref:re,onFocus:e=>{s?nr(V()[0]):k?.portalNode&&(c&&(A.current=!0),Yn(e,k.portalNode)?Jn(_)?.focus():oi(u??k.afterOutsideRef)?.focus())}})]})}function gi(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function _i(e){return e!=null&&e.clientX!=null}function vi(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=j.useRef(!1),u=j.useRef(null),[d,f]=j.useState(),[p,m]=j.useState([]),h=X(e=>{i.set(`positionReference`,e)}),g=X((e,t,n)=>{l.current||c.current.openEvent&&!_i(c.current.openEvent)||i.set(`positionReference`,gi(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=X(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=je(d)?o:a;j.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=U(o);function r(t){K(o,rt(t))?e():g(t.clientX,t.clientY)}return!c.current.openEvent||_i(c.current.openEvent)?u.current=Y(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),j.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),j.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),j.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=j.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return j.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function yi(){return!1}function bi(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function xi(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=yi,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f}=l.context,p=ai(c),m=X(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=X(()=>a),{escapeKey:v,outsidePress:y}=bi(s),b=j.useRef(!1),x=j.useRef(!1),S=j.useRef(!1),C=j.useRef(!1),w=j.useRef(``),T=j.useRef(null),E=fe(),D=fe(),O=X(()=>{D.clear(),f.current.insideReactTree=!1}),k=X(e=>{let t=f.current.floatingContext?.nodeId;return(p?Qn(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),A=X(e=>at(e,l.select(`floatingElement`))||at(e,l.select(`domReferenceElement`))),M=X(e=>{o()&&l.setOpen(!1,J(yt,e.nativeEvent))}),N=X(e=>{if(!u||!n||!r||e.key!==`Escape`||C.current||!v&&k(`__escapeKeyBubbles`))return;let t=J(Tt,Oe(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!v&&!t.isPropagationAllowed&&e.stopPropagation()}),P=X(()=>{f.current.insideReactTree=!0,D.start(0,O)}),F=X(e=>{if(!u||!n||e.button!==0)return;let t=rt(e.nativeEvent);K(l.select(`floatingElement`),t)&&(b.current||(b.current=!0,x.current=!1))}),I=X(e=>{!u||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});j.useEffect(()=>{if(!u||!n)return;f.current.__escapeKeyBubbles=v,f.current.__outsidePressBubbles=y;let e=new de,t=new de;function i(){e.clear(),C.current=!0}function a(){e.start(we?5:0,()=>{C.current=!1})}function o(){S.current=!0,t.start(0,()=>{S.current=!1})}function s(){b.current=!1,x.current=!1}function c(){let e=w.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function D(e){let t=f.current.floatingContext?.nodeId,n=p&&Qn(p.nodesRef.current,t).some(t=>at(e,t.context?.elements.floating));return A(e)||n}function j(e){if(m(e)){e.type!==`click`&&!A(e)&&(t.clear(),S.current=!1),O();return}if(f.current.insideReactTree){O();return}let n=rt(e),r=`[${er(`inert`)}]`,i=W(n)?n.getRootNode():null,a=Array.from((Ie(i)?i:Z(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>K(e,n))))return;let s=W(n)?n:null;for(;s&&!qe(s);){let e=Xe(s);if(qe(e)||!W(e))break;s=e}if(!(a.length&&W(n)&&!ot(n)&&!K(n,l.select(`floatingElement`))&&a.every(e=>!K(s,e)))){if(G(n)&&!(`touches`in e)){let t=qe(n),r=Je(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!D(e)){if(c()===`intentional`&&S.current){t.clear(),S.current=!1;return}typeof h==`function`&&!h(e)||k(`__outsidePressBubbles`)||(l.setOpen(!1,J(St,e)),O())}}}function M(e){c()!==`sloppy`||e.pointerType===`touch`||!l.select(`open`)||!n||A(e)||j(e)}function P(e){if(c()!==`sloppy`||!l.select(`open`)||!n||A(e))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=rt(e);if(!n)return;let r=Y(n,e.type,()=>{t(e),r()})}function I(e){w.current=`touch`,F(e,P)}function L(e){E.clear(),e.type===`pointerdown`&&(w.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?M(e):j(e)})}function ee(e){if(!b.current)return;let n=x.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!D(e)){if(n){o();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,O())}}}function te(e){if(c()!==`sloppy`||!T.current||A(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-T.current.startX),r=Math.abs(t.clientY-T.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(T.current.dismissOnTouchEnd=!0),i>10&&(j(e),E.clear(),T.current=null)}function ne(e){F(e,te)}function re(e){c()!==`sloppy`||!T.current||A(e)||(T.current.dismissOnTouchEnd&&j(e),E.clear(),T.current=null)}function ie(e){F(e,re)}let R=Z(d),ae=Mt(r&&Mt(Y(R,`keydown`,N),Y(R,`compositionstart`,i),Y(R,`compositionend`,a)),g&&Mt(Y(R,`click`,L,!0),Y(R,`pointerdown`,L,!0),Y(R,`pointerup`,ee,!0),Y(R,`pointercancel`,ee,!0),Y(R,`mousedown`,L,!0),Y(R,`mouseup`,ee,!0),Y(R,`touchstart`,I,!0),Y(R,`touchmove`,ne,!0),Y(R,`touchend`,ie,!0)));return()=>{ae(),e.clear(),t.clear(),s(),S.current=!1}},[f,d,r,g,h,u,n,v,y,N,O,_,k,A,p,l,E]),j.useEffect(O,[h,O]);let L=j.useMemo(()=>({onKeyDown:N,onPointerDown:M,onClick:M}),[N,M]),ee=j.useMemo(()=>({onKeyDown:N,onPointerDown:I,onMouseDown:I,onClickCapture:P,onMouseDownCapture(e){P(),F(e)},onPointerDownCapture(e){P(),F(e)},onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[N,P,F,I]);return j.useMemo(()=>n?{reference:L,floating:ee,trigger:L}:{},[n,L,ee])}function Si(e,t,n){let{reference:r,floating:i}=e,a=pn(t),o=mn(t),s=fn(o),c=ln(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}}switch(un(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Ci(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}=cn(t,e),p=En(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Dn(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=Dn(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}}var wi=50,Ti=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ci},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Si(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<wi&&(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}=Si(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ei=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}=cn(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ln(r),_=pn(o),v=ln(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[wn(o)]:gn(o)),x=p!==`none`;!d&&x&&b.push(...Cn(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=hn(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`&&_!==pn(t))||T.every(e=>pn(e.placement)===_?e.overflows[0]>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=pn(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;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Di(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Oi(e){return $t.some(t=>e[t]>=0)}var ki=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=cn(e,t);switch(i){case`referenceHidden`:{let e=Di(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Oi(e)}}}case`escaped`:{let e=Di(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Oi(e)}}}default:return{}}}}},Ai=new Set([`left`,`top`]);async function ji(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ln(n),s=un(n),c=pn(n)===`y`,l=Ai.has(o)?-1:1,u=a&&c?-1:1,d=cn(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 Mi=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 ji(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}}}}},Ni=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}=cn(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=pn(ln(i)),p=dn(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=sn(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=sn(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Pi=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}=cn(e,t),u={x:n,y:r},d=pn(i),f=dn(d),p=u[f],m=u[d],h=cn(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};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=Ai.has(ln(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}}}},Fi=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=cn(e,t),u=await o.detectOverflow(t,l),d=ln(i),f=un(i),p=pn(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=en(h-u[g],v),x=en(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=tn(u.left,0),t=tn(u.right,0),n=tn(u.top,0),r=tn(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:tn(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:tn(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Ii(e){let t=Je(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=nn(n)!==a||nn(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Li(e){return W(e)?e:e.contextElement}function Ri(e){let t=Li(e);if(!G(t))return an(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ii(t),o=(a?nn(n.width):n.width)/r,s=(a?nn(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var zi=an(0);function Bi(e){let t=U(e);return!Ke()||!t.visualViewport?zi:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Vi(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==U(e)?!1:t}function Hi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Li(e),o=an(1);t&&(r?W(r)&&(o=Ri(r)):o=Ri(e));let s=Vi(a,n,r)?Bi(a):an(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){let e=U(a),t=r&&W(r)?U(r):r,n=e,i=$e(n);for(;i&&r&&t!==n;){let e=Ri(i),t=i.getBoundingClientRect(),r=Je(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=U(i),i=$e(n)}}return Dn({width:u,height:d,x:c,y:l})}function Ui(e,t){let n=Ye(e).scrollLeft;return t?t.left+n:Hi(Pe(e)).left+n}function Wi(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ui(e,n),y:n.top+t.scrollTop}}function Gi(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Pe(r),s=t?ze(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=an(1),u=an(0),d=G(r);if((d||!d&&!a)&&((H(r)!==`body`||Le(o))&&(c=Ye(r)),d)){let e=Hi(r);l=Ri(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Wi(o,c):an(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 Ki(e){return Array.from(e.getClientRects())}function qi(e){let t=Pe(e),n=Ye(e),r=e.ownerDocument.body,i=tn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=tn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ui(e),s=-n.scrollTop;return Je(r).direction===`rtl`&&(o+=tn(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Ji=25;function Yi(e,t){let n=U(e),r=Pe(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ke();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Ui(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Ji&&(a-=o)}else l<=Ji&&(a+=l);return{width:a,height:o,x:s,y:c}}function Xi(e,t){let n=Hi(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=G(e)?Ri(e):an(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Zi(e,t,n){let r;if(t===`viewport`)r=Yi(e,n);else if(t===`document`)r=qi(Pe(e));else if(W(t))r=Xi(t,n);else{let n=Bi(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Dn(r)}function Qi(e,t){let n=Xe(e);return n===t||!W(n)||qe(n)?!1:Je(n).position===`fixed`||Qi(n,t)}function $i(e,t){let n=t.get(e);if(n)return n;let r=Qe(e,[],!1).filter(e=>W(e)&&H(e)!==`body`),i=null,a=Je(e).position===`fixed`,o=a?Xe(e):e;for(;W(o)&&!qe(o);){let t=Je(o),n=We(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Le(o)&&!n&&Qi(e,o))?r=r.filter(e=>e!==o):i=t,o=Xe(o)}return t.set(e,r),r}function ea(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ze(t)?[]:$i(t,this._c):[].concat(n),r],o=Zi(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=Zi(t,a[e],i);s=tn(n.top,s),c=en(n.right,c),l=en(n.bottom,l),u=tn(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ta(e){let{width:t,height:n}=Ii(e);return{width:t,height:n}}function na(e,t,n){let r=G(t),i=Pe(t),a=n===`fixed`,o=Hi(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=an(0);function l(){c.x=Ui(i)}if(r||!r&&!a)if((H(t)!==`body`||Le(i))&&(s=Ye(t)),r){let e=Hi(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Wi(i,s):an(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function ra(e){return Je(e).position===`static`}function ia(e,t){if(!G(e)||Je(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Pe(e)===n&&(n=n.ownerDocument.body),n}function aa(e,t){let n=U(e);if(ze(e))return n;if(!G(e)){let t=Xe(e);for(;t&&!qe(t);){if(W(t)&&!ra(t))return t;t=Xe(t)}return n}let r=ia(e,t);for(;r&&Re(r)&&ra(r);)r=ia(r,t);return r&&qe(r)&&ra(r)&&!We(r)?n:r||Ge(e)||n}var oa=async function(e){let t=this.getOffsetParent||aa,n=this.getDimensions,r=await n(e.floating);return{reference:na(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sa(e){return Je(e).direction===`rtl`}var ca={convertOffsetParentRelativeRectToViewportRelativeRect:Gi,getDocumentElement:Pe,getClippingRect:ea,getOffsetParent:aa,getElementRects:oa,getClientRects:Ki,getDimensions:ta,getScale:Ri,isElement:W,isRTL:sa};function la(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ua(e,t){let n=null,r,i=Pe(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=rn(d),h=rn(i.clientWidth-(u+f)),g=rn(i.clientHeight-(d+p)),_=rn(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:tn(0,en(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!la(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function da(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=Li(e),u=i||a?[...l?Qe(l):[],...t?Qe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ua(l,n):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?Hi(e):null;c&&g();function g(){let t=Hi(e);h&&!la(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 fa=Mi,pa=Ni,ma=Ei,ha=Fi,ga=ki,_a=Pi,va=(e,t,n)=>{let r=new Map,i={platform:ca,...n},a={...i.platform,_c:r};return Ti(e,t,{...i,platform:a})},ya=typeof document<`u`?j.useLayoutEffect:function(){};function ba(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ba(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ba(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function xa(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Sa(e,t){let n=xa(e);return Math.round(t*n)/n}function Ca(e){let t=j.useRef(e);return ya(()=>{t.current=e}),t}function wa(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=j.useState(r);ba(f,r)||p(r);let[m,h]=j.useState(null),[g,_]=j.useState(null),v=j.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=j.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=j.useRef(null),C=j.useRef(null),w=j.useRef(u),T=c!=null,E=Ca(c),D=Ca(i),O=Ca(l),k=j.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),va(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!ba(w.current,t)&&(w.current=t,P.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);ya(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=j.useRef(!1);ya(()=>(A.current=!0,()=>{A.current=!1}),[]),ya(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let M=j.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),N=j.useMemo(()=>({reference:b,floating:x}),[b,x]),F=j.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Sa(N.floating,u.x),r=Sa(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...xa(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return j.useMemo(()=>({...u,update:k,refs:M,elements:N,floatingStyles:F}),[u,k,M,N,F])}var Ta=(e,t)=>{let n=fa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ea=(e,t)=>{let n=pa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Da=(e,t)=>({fn:_a(e).fn,options:[e,t]}),Oa=(e,t)=>{let n=ma(e);return{name:n.name,fn:n.fn,options:[e,t]}},ka=(e,t)=>{let n=ha(e);return{name:n.name,fn:n.fn,options:[e,t]}},Aa=(e,t)=>{let n=ga(e);return{name:n.name,fn:n.fn,options:[e,t]}};function ja(e){let t=j.useRef(!0);t.current&&(t.current=!1,e())}var Q=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(B(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},Ma=br(19)?Fa:Ia;function Na(e,t,n,r,i){return Ma(e,t,n,r,i)}function Pa(e,t,n,r,i){let a=j.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,I.useSyncExternalStore)(e.subscribe,a,a)}re({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,I.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Fa(e,t,n,r,i){let a=ne();if(!a)return Pa(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function Ia(e,t,n,r,i){return(0,L.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var La=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Na(this,e,t,n,r)}},Ra=class extends La{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){j.useDebugValue(e);let n=this;z(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;z(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;z(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){j.useDebugValue(e);let n=this,r=t!==void 0;z(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return j.useDebugValue(e),Na(this,this.selectors[e],t,n,r)}useContextCallback(e,t){j.useDebugValue(e);let n=X(t??_t);this.context[e]=n}useStateSetter(e){let t=j.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},za={open:Q(e=>e.open),transitionStatus:Q(e=>e.transitionStatus),domReferenceElement:Q(e=>e.domReferenceElement),referenceElement:Q(e=>e.positionReference??e.referenceElement),floatingElement:Q(e=>e.floatingElement),floatingId:Q(e=>e.floatingId)},Ba=class extends Ra{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:ti(),nested:n,triggerElements:i},za),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&Me(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function Va(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=j.useRef(null);r===void 0&&f.current===null&&(f.current=new Ba({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),z(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};W(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function Ha(e,t=!1,n=!1){let[r,i]=j.useState(e&&t?`idle`:void 0),[a,o]=j.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),z(()=>{if(!e&&a&&r!==`ending`&&n){let e=Jt.request(()=>{i(`ending`)});return()=>{Jt.cancel(e)}}},[e,a,r,n]),z(()=>{if(!e||t)return;let n=Jt.request(()=>{i(void 0)});return()=>{Jt.cancel(n)}},[t,e]),z(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=Jt.request(()=>{i(`idle`)});return()=>{Jt.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var Ua=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),Wa={[Ua.startingStyle]:``},Ga={[Ua.endingStyle]:``},Ka={transitionStatus(e){return e===`starting`?Wa:e===`ending`?Ga:null}};function qa(e,t=!1,n=!0){let r=Yt();return X((i,a=null)=>{r.cancel();let o=oi(e);if(o==null)return;let s=o,c=()=>{P.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=Ua.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Ja(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=X(i),o=qa(r,n,!1);j.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var Ya={tabIndex:-1,[et]:``};function Xa(e){return t=>t===`touch`?e.current:!0}function Za(e,t,n=!1){let r=vr(),i=ii()!=null,a=j.useRef(null);e===void 0&&a.current===null&&(a.current=t(r,i));let o=e??a.current;return Va({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:o.setOpen}),{store:o,internalStore:a.current}}function Qa(e,t){let n=j.useRef(null),r=j.useRef(null);return j.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function $a(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let i=n?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=n??null)}function eo(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function to(e,t,n,r={}){let i=n.reason,a=i===bt,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=eo(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i={...r.extraState,open:t};o?i.instantType=`focus`:s?i.instantType=`dismiss`:a&&(i.instantType=void 0),$a(i,t,n.trigger,c()),e.update(i)};a?P.flushSync(l):l()}function no(e,t,n,r){ja(()=>{t===void 0&&e.state.open===!1&&n&&(e.state={...e.state,open:!0,activeTriggerId:r,preventUnmountingOnClose:!1})})}function ro(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Qa(e,n),o=X(t=>{if(a(t),!t)return;let i=n.select(`open`),o=n.select(`activeTriggerId`);if(o===e){n.update({activeTriggerElement:t,...i?r:null});return}o==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return z(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function io(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState(`open`);z(()=>{if(!r){e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,i={};e.state.triggerCount!==t&&(i.triggerCount=t);let a=e.select(`activeTriggerId`),o=null;if(a){let t=e.context.triggerElements.getById(a);t?t!==e.state.activeTriggerElement&&(i.activeTriggerElement=t):o=a}if(!o&&!a&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;i.activeTriggerId=e,i.activeTriggerElement=n}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),o&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===o&&!e.context.triggerElements.getById(o)){let t=J(vt);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,e.useState(`triggerCount`),n])}function ao(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Ha(e),o=t.useState(`preventUnmountingOnClose`),s=e?!1:o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=X(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Ja({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function oo(e,t){e.useSyncedValues(t),z(()=>()=>{e.update({activeTriggerProps:q,inactiveTriggerProps:q,popupProps:q})},[e])}function so(e,t){z(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),z(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var co=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function lo(){return new Ba({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new co,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function uo(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:lo(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:q,inactiveTriggerProps:q,popupProps:q}}function fo(e,t,n=!1){return new Ba({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var po=Q(e=>e.triggerIdProp??e.activeTriggerId),mo=Q(e=>e.openProp??e.open),ho=Q(e=>(e.popupElement?.id??e.floatingId)||void 0);function go(e,t){return t!==void 0&&mo(e)&&po(e)===t}function _o(e,t){return go(e,t)?!0:t!==void 0&&mo(e)&&po(e)==null&&e.triggerCount===1}var vo={open:mo,mounted:Q(e=>e.mounted),transitionStatus:Q(e=>e.transitionStatus),floatingRootContext:Q(e=>e.floatingRootContext),triggerCount:Q(e=>e.triggerCount),preventUnmountingOnClose:Q(e=>e.preventUnmountingOnClose),payload:Q(e=>e.payload),activeTriggerId:po,activeTriggerElement:Q(e=>e.mounted?e.activeTriggerElement:null),popupId:ho,isTriggerActive:Q((e,t)=>t!==void 0&&po(e)===t),isOpenedByTrigger:Q((e,t)=>go(e,t)),isMountedByTrigger:Q((e,t)=>t!==void 0&&po(e)===t&&e.mounted),triggerProps:Q((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:Q((e,t)=>_o(e,t)?ho(e):void 0),popupProps:Q(e=>e.popupProps),popupElement:Q(e=>e.popupElement),positionerElement:Q(e=>e.positionerElement)};function yo(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=vr(),a=ii()!=null,o=N(()=>new Ba({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new co,floatingId:i,syncOnly:!1,nested:a})).current;return z(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=W(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function bo(e={}){let{nodeId:t,externalTree:n}=e,r=yo(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=j.useState(null),[f,p]=j.useState(void 0),[m,h]=j.useState(void 0),g=j.useRef(null),_=ai(n),v=j.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),y=wa({...e,elements:{...v,...u&&{reference:u}}}),b=W(f)?f:null,x=m===void 0?i.state.floatingElement:m;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:b),i.useSyncedValue(`floatingElement`,x);let S=j.useCallback(e=>{let t=W(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),y.refs.setReference(t)},[y.refs]),C=j.useCallback(e=>{(W(e)||e===null)&&(g.current=e,p(e)),(W(y.refs.reference.current)||y.refs.reference.current===null||e!==null&&!W(e))&&y.refs.setReference(e)},[y.refs,p]),w=j.useCallback(e=>{h(e),y.refs.setFloating(e)},[y.refs]),T=j.useMemo(()=>({...y.refs,setReference:C,setFloating:w,setPositionReference:S,domReference:g}),[y.refs,C,w,S]),E=j.useMemo(()=>({...y.elements,domReference:s}),[y.elements,s]),D=j.useMemo(()=>({...y,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:T,elements:E,nodeId:t,rootStore:i}),[y,T,E,t,i,c,l]);return z(()=>{s&&(g.current=s)},[s]),z(()=>{i.context.dataRef.current.floatingContext=D;let e=_?.nodesRef.current.find(e=>e.id===t);e&&(e.context=D)}),j.useMemo(()=>({...y,context:D,refs:T,elements:E,rootStore:i}),[y,T,E,D,i])}var xo=Se&&we;function So(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=j.useRef(!1),c=j.useRef(null),l=j.useRef(!0),u=fe();j.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=U(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&G(e)&&e===nt(Z(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return Mt(Y(t,`blur`,r),xo&&Y(t,`keydown`,a,!0),xo&&Y(t,`pointerdown`,o,!0))},[i,n]),j.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);W(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=j.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=rt(t.nativeEvent);if(W(a)){if(xo&&!t.relatedTarget){if(!l.current&&!st(a))return}else if(!ut(a))return}let o=it(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,J(xt,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,J(xt,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=W(n)&&n.hasAttribute(er(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=nt(Z(e));!n&&t===e||K(o.current.floatingContext?.refs.floating.current,t)||K(e,t)||a||it(n??t,i.context.triggerElements)||i.setOpen(!1,J(xt,r))})}}},[o,r,i,u]);return j.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Co=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new de,this.restTimeout=new de,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},wo=new WeakMap;function To(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&wo.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),wo.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Eo(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=wo.get(n);a&&a!==e&&To(a),To(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,wo.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Do(e){let t=e.context.dataRef.current,n=N(()=>t.hoverInteractionState??Co.create()).current;return t.hoverInteractionState||=n,le(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Oo(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=ai(),d=ii(),f=Do(a),p=fe(),m=X(()=>ht(l.current.openEvent?.type,f.interactedInside)),h=X(()=>gt(l.current.openEvent?.type)),g=X(()=>{To(f)});z(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),j.useEffect(()=>g,[g]),z(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&W(c)&&s){let e=c,t=s,n=Z(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r;return Eo(f,{scopeElement:f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),j.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&Qn(u.nodesRef.current,d).length>0)}function t(e){let t=pt(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,J(bt,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=rt(e);if(!ct(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(it(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&W(o)&&Qn(u.nodesRef.current,r,!1).some(e=>K(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,J(bt,t)),u.events.emit(`floating.closed`,t)})}let y=s;return Mt(y&&Y(y,`mouseenter`,c),y&&Y(y,`mouseleave`,_),y&&Y(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var ko={current:null};function Ao(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=ko,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p}=t,m=`rootStore`in e?e.rootStore:e,{dataRef:h,events:g}=m.context,_=ai(l),v=Do(m),y=j.useRef(!1),b=zt(i),x=zt(r),S=zt(o),C=zt(n),w=zt(p),T=zt(f),E=X(()=>ht(h.current.openEvent?.type,v.interactedInside)),D=X(()=>w.current?.()!==!1),O=X((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!K(e,t);if(!W(n))return!1;let i=n;return r.hasMatchingElement(e=>K(e,i))&&(!e||!K(e,i))}),k=X(()=>{v.handler&&=(Z(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=X(()=>{To(v)});return u&&(v.handleCloseOptions=b.current?.__options),j.useEffect(()=>k,[k]),j.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===bt,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),j.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=pt(x.current,`close`,v.pointerType);n?v.openChangeTimeout.start(n,()=>{m.setOpen(!1,J(bt,e)),_?.events.emit(`floating.closed`,e)}):t&&(v.openChangeTimeout.clear(),m.setOpen(!1,J(bt,e)),_?.events.emit(`floating.closed`,e))}let t=c.current??(u?m.select(`domReferenceElement`):null);if(!W(t))return;function r(e){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!je(v.pointerType))return;let t=mt(S.current),n=pt(x.current,`open`,v.pointerType),r=rt(e),i=e.currentTarget??null,o=m.select(`domReferenceElement`),s=i;if(W(r)&&!m.context.triggerElements.hasElement(r)){for(let e of m.context.triggerElements.elements())if(K(e,r)){s=e;break}}W(i)&&W(o)&&!m.context.triggerElements.hasElement(i)&&K(i,o)&&(s=o);let c=s==null?!1:O(o,s,r),l=m.select(`open`),u=T.current?.()??m.select(`transitionStatus`)===`ending`,d=!l&&u&&y.current,f=!c&&W(s)&&W(o)&&K(o,s)&&d,p=t>0&&!n,h=c&&(l||d)||f,g=!l||c;if(h){D()&&m.setOpen(!0,J(bt,e,s));return}p||(n?v.openChangeTimeout.start(n,()=>{g&&D()&&m.setOpen(!0,J(bt,e,s))}):g&&D()&&m.setOpen(!0,J(bt,e,s)))}function i(t){if(E()){A();return}k();let n=Z(m.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let r=h.current.floatingContext??d?.();if(!it(t.relatedTarget,m.context.triggerElements)){if(b.current&&r){m.select(`open`)||v.openChangeTimeout.clear();let i=c.current;v.handler=b.current({...r,tree:_,x:t.clientX,y:t.clientY,onClose(){A(),k(),C.current&&!E()&&i===m.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,v.handler),v.handler(t);return}(v.pointerType!==`touch`||!K(m.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?Mt(Y(t,`mousemove`,r,{once:!0}),Y(t,`mouseenter`,r),Y(t,`mouseleave`,i)):Mt(Y(t,`mouseenter`,r),Y(t,`mouseleave`,i))},[k,A,h,x,m,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D]),j.useMemo(()=>{if(!n)return;function e(e){v.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=m.select(`domReferenceElement`),i=m.select(`open`),o=O(r,n,e.target);if(a&&!je(v.pointerType))return;if(i&&o&&v.handleCloseOptions?.blockPointerEvents){let e=m.select(`floatingElement`);e&&Eo(v,{scopeElement:v.handleCloseOptions?.getScope?.()??n.ownerDocument.body,referenceElement:n,floatingElement:e})}let s=mt(S.current);if(i&&!o||s===0||!o&&v.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;v.restTimeout.clear();function c(){if(v.restTimeoutPending=!1,E())return;let e=m.select(`open`);!v.blockMouseMove&&(!e||o)&&D()&&m.setOpen(!0,J(bt,t,n))}v.pointerType===`touch`?P.flushSync(()=>{c()}):o&&i?c():(v.restTimeoutPending=!0,v.restTimeout.start(s,c))}}},[n,v,E,O,a,m,S,D])}var jo=.1,Mo=jo*jo,$=.5;function No(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Po(e,t,n,r,i,a,o,s,c,l){let u=!1;return No(e,t,n,r,i,a)&&(u=!u),No(e,t,i,a,o,s)&&(u=!u),No(e,t,o,s,c,l)&&(u=!u),No(e,t,c,l,n,r)&&(u=!u),u}function Fo(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Io(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Lo(e={}){let{blockPointerEvents:t=!1}=e,n=new de,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Mo;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=rt(r),g=r.type===`mouseleave`,_=K(u,h),v=K(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&W(r.relatedTarget)&&K(u,r.relatedTarget))return;function y(){return!!(s&&Qn(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Io(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Io(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Io(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Io(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!Fo(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+$+1,o=C||T?S.bottom-$:S.top,s=C?T?S.bottom-$:S.top:S.bottom-$;M=Po(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-$,o=C||T?S.top+$:S.bottom,s=C?T?S.top+$:S.bottom:S.top+$;M=Po(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+$+1,o=w||E?S.right-$:S.left,s=w?E?S.right-$:S.left:S.right-$;M=Po(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-$,o=w||E?S.left+$:S.right,s=w?E?S.left+$:S.right:S.left+$;M=Po(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var Ro={...vo,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeOnClick:Q(e=>e.closeOnClick),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},zo=class e extends Ra{constructor(e,t,n=!1){let r=new co,i={...Bo(),...e};i.floatingRootContext=fo(r,t,n),super(i,{popupRef:j.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},Ro)}setOpen=(e,t)=>{to(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,J(yt,e))}static useStore(t,n){return Za(t,(t,r)=>new e(n,t,r)).store}};function Bo(){return{...uo(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var Vo=ie(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=zo.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});no(p,r,n,d),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),p.useSyncedValue(`disabled`,t),io(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=ao(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=j.useRef(null);z(()=>{m&&t&&p.setOpen(!1,J(Et))},[m,t,p]),z(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),z(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let T=j.useCallback(()=>{p.setOpen(!1,J(Dt))},[p]);j.useImperativeHandle(o,()=>({unmount:y,close:T}),[y,T]);let E=h||_||!t&&a!==`none`;return(0,F.jsxs)(V.Provider,{value:p,children:[E&&(0,F.jsx)(Ho,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function Ho({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=xi(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=vi(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n});return oo(e,{activeTriggerProps:j.useMemo(()=>Dr(a.reference,i.reference),[a.reference,i.reference]),inactiveTriggerProps:j.useMemo(()=>Dr(a.trigger,i.trigger),[a.trigger,i.trigger]),popupProps:j.useMemo(()=>Dr(Ya,a.floating,i.floating),[a.floating,i.floating])}),null}var Uo=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Ua.startingStyle]=`startingStyle`,e[e.endingStyle=Ua.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),Wo=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Go={[Wo.popupOpen]:``};Wo.popupOpen,Wo.pressed;var Ko={[Uo.open]:``},qo={[Uo.closed]:``},Jo={[Uo.anchorHidden]:``},Yo={open(e){return e?Go:null}},Xo={open(e){return e?Ko:qo},anchorHidden(e){return e?Jo:null}};function Zo(e){return vr(e,`base-ui`)}var Qo=j.createContext(void 0);function $o(){return j.useContext(Qo)}var es=function(e){return e[e.popupOpen=Wo.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),ts=`data-base-ui-tooltip-trigger`;function ns(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(W(n))return n}}let t=e.target;return W(t)?t:null}function rs(e){let t=e;for(;t;){if(t.hasAttribute(ts))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&W(n.host)?n.host:null}return null}var is=R(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=se(!0),m=a?.store??p;if(!m)throw Error(B(82));let h=Zo(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=j.useRef(null),b=c??600,x=u??0,{registerTrigger:S,isMountedByThisTrigger:C}=ro(h,y,m,{payload:o,closeOnClick:l,closeDelay:x}),w=$o(),{delayRef:T,isInstantPhase:E,hasProvider:D}=jt(v,{open:_}),O=Do(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,M=zt(A),N=m.useState(`trackCursorAxis`),P=m.useState(`disableHoverablePopup`),F=j.useRef(!1),I=fe(),L=j.useRef(void 0);function ee(){let e=w?.delay,t=typeof T.current==`object`?T.current.open:void 0,n=b;return D&&(n=t===0?0:c??e??b),n}function te(e){let t=y.current;if(!t||!e)return!1;let n=rs(e);return n!==null&&n!==t&&K(t,n)}function ne(e){let t=te(e);return F.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,I.clear()),t}let re=Ao(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!P&&N!==`both`?Lo():null,restMs:ee,delay(){let e=typeof T.current==`object`?T.current.close:void 0,t=x;return u==null&&D&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!F.current}}),ie=So(v,{enabled:!A}).reference,R=e=>{let t=F.current,n=ns(e),r=ne(n),i=y.current,a=i&&n&&K(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,J(bt,e));return}if(t&&!r&&a&&!M.current&&!m.select(`open`)&&i&&je(L.current)){let t=()=>{!F.current&&!M.current&&!m.select(`open`)&&m.setOpen(!0,J(bt,e,i))},n=ee();n===0?(I.clear(),t()):I.start(n,t)}},ae=m.useState(`triggerProps`,C);return Vr(`button`,e,{state:{open:_},ref:[t,S,y],props:[re,ie,C||N!==`none`?ae:void 0,{onMouseOver(e){R(e.nativeEvent)},onFocus(e){te(ns(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){F.current=!1,I.clear(),L.current=void 0},onPointerEnter(e){L.current=e.pointerType},onPointerDown(e){L.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[es.triggerDisabled]:A?``:void 0,[ts]:A?void 0:``},f],stateAttributesMapping:Yo})}),as=j.createContext(void 0);function os(){let e=j.useContext(as);if(e===void 0)throw Error(B(70));return e}var ss=j.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=$r({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,F.jsxs)(j.Fragment,{children:[l,c&&P.createPortal(n,c)]})}),cs=j.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return se().useState(`mounted`)||n?(0,F.jsx)(as.Provider,{value:n,children:(0,F.jsx)(ss,{ref:t,...r})}):null}),ls=j.createContext(void 0);function us(){let e=j.useContext(ls);if(e===void 0)throw Error(B(71));return e}var ds=j.createContext(void 0);function fs(){return j.useContext(ds)?.direction??`ltr`}var ps=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,offsetParent:d=`real`}=cn(e,t)||{};if(l==null)return{};let f=En(u),p={x:n,y:r},m=mn(i),h=fn(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=sn(k,j,A),N=!c.arrow&&un(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),ms=(e,t)=>({...ps(e),options:[e,t]}),hs=Aa().fn,gs={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await hs(e)).data?.referenceHidden||a}}}},_s={sideX:`left`,sideY:`top`},vs={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=U(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:_s};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Z(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=ln(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:_s.sideX,g=f===`top`?`bottom`:_s.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function ys(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function bs(e,t,n){let{rects:r,placement:i}=e;return{side:ys(t,ln(i),n),align:un(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function xs(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,inline:f,keepMounted:p=!1,floatingRootContext:m,mounted:h,collisionAvoidance:g,shiftCrossAxis:_=!1,nodeId:v,adaptiveOrigin:y,lazyFlip:b=!1,externalTree:x}=e,[S,C]=j.useState(null);!h&&S!==null&&C(null);let w=g.side||`flip`,T=g.align||`flip`,E=g.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=X(D),k=D?O:t,A=zt(t),M=zt(h),N=fs()===`rtl`,P=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),ee=+(r===`top`),te=+(r===`right`),ne=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+ne,bottom:I+ee,left:I+te}:I&&={top:(I.top||0)+L,right:(I.right||0)+ne,bottom:(I.bottom||0)+ee,left:(I.left||0)+te};let re={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},ie=j.useRef(null),R=zt(i),ae=zt(o),oe=typeof i==`function`?0:i,B=typeof o==`function`?0:o,V=[];f&&V.push(f),V.push(Ta(e=>{let t=bs(e,r,N),n=typeof R.current==`function`?R.current(t):R.current,i=typeof ae.current==`function`?ae.current(t):ae.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[oe,B,N,r]));let se=T===`none`&&w!==`shift`,ce=!se&&(l||_||w===`shift`),le=w===`none`?null:Oa({...re,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!_&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),ue=se?null:Ea(e=>{let t=Z(e.elements.floating).documentElement;return{...re,rootBoundary:_?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:ce,limiter:l||_?void 0:Da(e=>{if(!ie.current)return{};let{width:t,height:n}=ie.current.getBoundingClientRect(),r=pn(ln(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[re,l,_,I,T]);w===`shift`||T===`shift`||a===`center`?V.push(ue,le):V.push(le,ue),V.push(ka({...re,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=U(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),ms(e=>({element:ie.current||Z(e.elements.floating).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=ln(a),l=pn(c),u=ie.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(bs(e,r,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ce&&l===`y`&&b?S:x),{}}},gs,y),z(()=>{!h&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,m]);let de=j.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:fe,elements:pe,x:me,y:he,middlewareData:ge,update:_e,placement:ve,context:ye,isPositioned:be,floatingStyles:xe}=bo({rootContext:m,open:p?h:void 0,placement:F,middleware:V,strategy:n,whileElementsMounted:p?void 0:(...e)=>da(...e,de),nodeId:v,externalTree:x}),{sideX:Se,sideY:Ce}=ge.adaptiveOrigin||_s,we=be?n:`fixed`,Te=j.useMemo(()=>{let e=y?{position:we,[Se]:me,[Ce]:he}:{position:we,...xe};return be||(e.opacity=0),e},[y,we,Se,me,Ce,he,xe,be]),Ee=j.useRef(null);z(()=>{if(!h)return;let e=A.current,t=typeof e==`function`?e():e,n=(Ss(t)?t.current:t)||null;n!==Ee.current&&(fe.setPositionReference(n),Ee.current=n)},[h,fe,k,A]),j.useEffect(()=>{if(!h)return;let e=A.current;typeof e!=`function`&&Ss(e)&&e.current!==Ee.current&&(fe.setPositionReference(e.current),Ee.current=e.current)},[h,fe,k,A]),j.useEffect(()=>{if(p&&h&&pe.reference&&pe.floating)return da(pe.reference,pe.floating,_e,de)},[p,h,pe,_e,de]);let De=ln(ve),Oe=ys(r,De,N),ke=un(ve)||`center`,Ae=!!ge.hide?.referenceHidden;z(()=>{b&&h&&be&&C(De)},[b,h,be,De]);let je=j.useMemo(()=>({position:`absolute`,top:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),Me=ge.arrow?.centerOffset!==0;return j.useMemo(()=>({positionerStyles:Te,arrowStyles:je,arrowRef:ie,arrowUncentered:Me,side:Oe,align:ke,physicalSide:De,anchorHidden:Ae,refs:fe,context:ye,isPositioned:be,update:_e}),[Te,je,ie,Me,Oe,ke,De,Ae,fe,ye,be,_e])}function Ss(e){return e!=null&&`current`in e}function Cs(e){return e===`starting`?qr:q}function ws(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Vr(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Cs(r),i],stateAttributesMapping:Xo})}var Ts=j.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Jr,style:g,..._}=e,v=se(),y=os(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=xs({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?vs:void 0}),O=ws(e,j.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,F.jsx)(ls.Provider,{value:D,children:O})}),Es={...Xo,...Ka},Ds=j.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=se(),{side:s,align:c}=us(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);Ja({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Oo(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Vr(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[f,Cs(d),a],stateAttributesMapping:Es})});function Os(e){return br(19)?e:e?`true`:void 0}var ks=C({method:`GET`}).handler(E(`aa46310016bb8a58b273a648ffd498c87f1f450d12827e30110a3b83ba6a27d9`)),As=C({method:`POST`}).handler(E(`ed679b4e1e05e903a5d4ba4a70d9b9d883991ab22ed59b4d2d69078941818415`)),js=C({method:`GET`}).handler(E(`169566e7637a22599b4eb32ee3775574e99677406922bbef7482a102036c33dd`)),Ms=C({method:`POST`}).handler(E(`27d7eba0b6a2257949392fdd56057275a5c5366484ae01faf3b5897a225ecd83`)),Ns=C({method:`POST`}).handler(E(`a6384dc7154d9930422d29396f5de64b3ac69c62ad3824bc4a22d745fc07b293`));function Ps(e,t){let n=new Set,r=[];for(let i of[...e,...t])n.has(i.id)||(n.add(i.id),r.push(i));return r.sort((e,t)=>e.ts<t.ts?-1:+(e.ts>t.ts)),r}function Fs({schedule:t,nextRun:r,enabled:i,machine:a,workdir:o,model:s,reasoningEffort:c}){return(0,F.jsxs)(`div`,{className:`min-w-0 text-right text-meta text-secondary`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-x-2.5 gap-y-1`,children:[(0,F.jsx)(`span`,{title:t.mode===`cron`?t.cron:void 0,children:e(t)}),(0,F.jsx)(`span`,{className:`text-wire`,children:`·`}),(0,F.jsxs)(`span`,{children:[`next `,x(r)]}),r&&i&&(0,F.jsxs)(`span`,{className:`text-disabled`,children:[`(`,n(r),`)`]}),(0,F.jsx)(`span`,{className:`text-wire`,children:`·`}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:`${a.name||`machine`} · ${a.presence}`,children:[(0,F.jsx)(`span`,{className:`size-1.5 rounded-full ${a.presence===`online`?`bg-rubik-green`:a.presence===`asleep`?`bg-rubik-yellow`:`bg-disabled`}`,"aria-hidden":`true`}),a.name||`machine`,(0,F.jsxs)(`span`,{className:`sr-only`,children:[`(`,a.presence,`)`]})]})]}),(0,F.jsxs)(`div`,{className:`mt-1 truncate`,title:o,children:[o,` · Model: `,s||`default`,` · Reasoning: `,c||`default`]})]})}var Is=16,Ls=`rounded-[4px]`,Rs=`h-5 w-[18px] shrink-0 ${Ls}`;function zs({run:e,onClick:t}){let n=e.error||e.message||``,r=e.durationMs?` · ${c(e.durationMs)}`:``;return(0,F.jsxs)(Vo,{children:[(0,F.jsx)(is,{render:(0,F.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},"aria-label":y(e),className:`${Rs} cursor-pointer transition-opacity hover:opacity-70`,style:{background:o(e),opacity:S(e),...e.phase===`running`?u:{}}})}),(0,F.jsx)(cs,{children:(0,F.jsx)(Ts,{sideOffset:8,children:(0,F.jsxs)(Ds,{className:`glass-strong pointer-events-none max-w-[340px] rounded-control px-3.5 py-2.5 text-meta leading-snug text-primary`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,F.jsx)(`span`,{className:`size-2 shrink-0 rounded-[2px]`,style:{background:o(e)}}),y(e),(0,F.jsxs)(`span`,{className:`ml-auto whitespace-nowrap pl-3 font-mono text-caption font-normal text-secondary`,children:[x(e.ts),r]})]}),n&&(0,F.jsx)(`div`,{className:`mt-1.5 max-h-[150px] overflow-hidden whitespace-pre-wrap ${e.error?`text-accent`:`text-secondary`}`,children:n})]})})})]})}function Bs({count:e,onClick:t,loading:n}){return e?(0,F.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},className:`flex h-5 w-[18px] shrink-0 items-center justify-center overflow-hidden border border-wire px-0 font-mono text-[9px] leading-none text-disabled transition-colors hover:border-display hover:text-primary ${Ls} ${n?`animate-pulse`:`cursor-pointer`}`,title:`${e} more - click to reveal`,children:n?`…`:e}):null}function Vs({loop:e,runs:t,total:r,onLoadMore:i,onPickRun:a}){let o=t,s=e.enabled,c=o.length,l=Math.max(0,r-c),u=d(),[f,p]=(0,j.useState)(-1),[m,h]=(0,j.useState)(!1),g=Math.max(0,c-16),_=f<0?g:Math.min(f,g),v=Math.min(_+16,c),y=o.slice(_,v),b=l+_,S=c-v,C=S===0,w=async()=>{let e=_-Is;if(e<0&&l>0&&!m){h(!0);let e=await i().catch(()=>0);h(!1),p(Math.max(0,_+e-Is));return}p(Math.max(0,e))},T=()=>{let e=_+Is;p(e>=g?-1:e)},E=!!(e.running||e.queued)&&C,D=C&&s&&!!e.nextRun&&!E;return(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[3px] overflow-x-auto`,children:[(0,F.jsx)(Bs,{count:b,onClick:w,loading:m}),y.map(e=>(0,F.jsx)(zs,{run:e,onClick:()=>a(e)},e.id)),D?(0,F.jsxs)(`div`,{className:`ml-1 flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`w-12 border-t border-dashed border-wire`}),(0,F.jsx)(`span`,{className:`size-[11px] shrink-0 rounded-full border border-wire`,title:u?`Next scheduled run · ${x(e.nextRun)}`:void 0}),(0,F.jsx)(`span`,{className:`text-caption text-disabled`,children:u?n(e.nextRun):``})]}):!C&&(0,F.jsx)(Bs,{count:S,onClick:T})]})}var Hs={"claude-code":`Claude Code`,codex:`Codex`},Us=`rounded-sm text-left text-[17px] font-semibold tracking-[-0.01em] text-display outline-none`;function Ws({usage:e}){return(0,F.jsxs)(`span`,{className:`ml-auto whitespace-nowrap`,children:[`Last 7 days · `,i(e.tokenCount),` tokens · `,e.runCount,` runs`]})}function Gs({loop:e,runs:t,onLoadMore:n,onPickRun:r,onOpen:i,extraPill:o}){let s=b({...e,runs:t}),c=k(e),l=d(),u=t.at(-1),f=u?.reportIncident?u:void 0;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[i?(0,F.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i()},className:`${Us} cursor-pointer focus-visible:ring-2 focus-visible:ring-interactive focus-visible:ring-offset-4 focus-visible:ring-offset-surface`,children:e.name}):(0,F.jsx)(`h1`,{className:Us,children:e.name}),(0,F.jsx)(h,{tone:c.tone,children:c.label}),(0,F.jsx)(h,{tone:`outline`,children:Hs[e.agent]}),o,(0,F.jsx)(`div`,{className:`ml-auto min-w-0`,children:(0,F.jsx)(Fs,{schedule:e.schedule,nextRun:e.nextRun,enabled:e.enabled,machine:e.machine,workdir:e.workdir,model:e.model,reasoningEffort:e.reasoningEffort})})]}),(0,F.jsx)(Vs,{loop:e,runs:t,total:e.runCount,onLoadMore:n,onPickRun:r}),(0,F.jsxs)(`div`,{className:`mt-[18px] flex items-center gap-2 text-meta text-secondary`,children:[(0,F.jsxs)(`span`,{children:[e.runCount,` runs`]}),s&&(0,F.jsxs)(`span`,{children:[`· last `,y(s),l&&` · ${a(s.ts)}`]}),(0,F.jsx)(Ws,{usage:e.recentUsage})]}),f?.reportIncident&&(0,F.jsx)(`div`,{className:`mt-1.5 text-meta text-secondary`,children:f.phase===`error`?`Last run failed · Terminal report rejected`:`Last run telemetry warning · Terminal report rejected`})]})}var Ks=j.createContext(!1),qs=j.createContext(void 0);function Js(e){let t=j.useContext(qs);if(e===!1&&t===void 0)throw Error(B(27));return t}var Ys={...Xo,...Ka},Xs=j.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Js(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Vr(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Ys,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Zs=j.createContext(void 0);function Qs(e=!1){let t=j.useContext(Zs);if(t===void 0&&!e)throw Error(B(16));return t}function $s(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:j.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function ec(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=j.useRef(null),s=Qs(!0),c=a??s!==void 0,{props:l}=$s({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=j.useCallback(()=>{let e=o.current;tc(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return z(u,[u]),{getButtonProps:j.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return Dr({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(Rr(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=tc(a),l=!i&&nc(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(Rr(e),a?.(e),e.target===e.currentTarget&&i&&c&&tc(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:X(e=>{o.current=e,u()})}}function tc(e){return G(e)&&e.tagName===`BUTTON`}function nc(e){return!!(e?.tagName===`A`&&e?.href)}var rc=j.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{store:c}=Js(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=ec({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,J(Ct,e.nativeEvent))}return Vr(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),ic=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),ac=function(e){return e[e.open=Uo.open]=`open`,e[e.closed=Uo.closed]=`closed`,e[e.startingStyle=Uo.startingStyle]=`startingStyle`,e[e.endingStyle=Uo.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),oc=j.createContext(void 0);function sc(){let e=j.useContext(oc);if(e===void 0)throw Error(B(26));return e}var cc=`ArrowUp`,lc=`ArrowDown`,uc=`ArrowLeft`,dc=`ArrowRight`,fc=`Home`,pc=new Set([uc,dc]),mc=new Set([cc,lc]),hc=new Set([...pc,...mc]),gc=new Set([...hc,fc,`End`]),_c={...Xo,...Ka,nestedDialogOpen(e){return e?{[ac.nestedDialogOpen]:``}:null}},vc=j.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,{store:c}=Js(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`),C=s.id??S;sc(),Ja({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let w=o===void 0?Xa(c.context.popupRef):o,T=g>0,E=c.useStateSetter(`popupElement`),D=Vr(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:T},props:[f,{id:C,"aria-labelledby":y??void 0,"aria-describedby":l??void 0,role:x,...Ya,hidden:!m,onKeyDown(e){gc.has(e.key)&&e.stopPropagation()},style:{[ic.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,E],stateAttributesMapping:_c});return(0,F.jsx)(hi,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:D})}),yc=j.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,F.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),bc=j.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Js(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,F.jsx)(oc.Provider,{value:n,children:(0,F.jsxs)(ei,{ref:t,...r,children:[a&&o===!0&&(0,F.jsx)(yc,{ref:i.context.internalBackdropRef,inert:Os(!s)}),e.children]})}):null}),xc={},Sc={},Cc=``;function wc(e){if(typeof document>`u`)return!1;let t=Z(e);return U(t).innerWidth-t.documentElement.clientWidth>0}function Tc(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Z(e),n=t.documentElement,r=t.body,i=Le(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Ec(e){let t=Z(e),n=t.documentElement,r=t.body,i=Le(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Dc(e){let t=Z(e),n=t.documentElement,r=t.body,i=U(n),a=0,o=0,s=!1,c=Jt.create();if(we&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,xc={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Cc=n.style.scrollBehavior,Sc={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Le(n)?n:r;if(s=Tc(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,xc),Object.assign(r.style,Sc),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Cc)}function d(){u(),c.request(l)}l();let f=Y(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Oc=new class{lockCount=0;restore=null;timeoutLock=de.create();timeoutUnlock=de.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Z(e).documentElement,n=U(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=_t;return}let r=ye||!wc(e);this.restore=r?Ec(e):Dc(e)}};function kc(e=!0,t=null){z(()=>{if(e)return Oc.acquire(t)},[e,t])}function Ac(e){let{store:t,actionsRef:n}=e,r=t.useState(`open`);so(t,r),io(t);let{forceUnmount:i}=ao(r,t),a=j.useCallback(()=>{t.setOpen(!1,J(Dt))},[t]);j.useImperativeHandle(n,()=>({unmount:i,close:a}),[i,a])}function jc({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=j.useState(0),[u,d]=j.useState(0),f=c===0,p=xi(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0||`touches`in t&&t.touches.length!==1)return!1;let n=rt(t);return f&&!i?a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===n||e.context.backdropRef.current===n||K(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0:!1},escapeKey:f});return kc(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),e.useContextCallback(`onNestedDialogClose`,()=>{l(0),d(0)}),j.useEffect(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(c+1,u+ +!!n),t?.onNestedDialogClose&&!r&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&r&&t.onNestedDialogClose()}),[n,r,c,u,t]),oo(e,{activeTriggerProps:p.reference??q,inactiveTriggerProps:p.trigger??q,popupProps:p.floating??q,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Mc={...vo,modal:Q(e=>e.modal),nested:Q(e=>e.nested),nestedOpenDialogCount:Q(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Q(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Q(e=>e.disablePointerDismissal),openMethod:Q(e=>e.openMethod),descriptionElementId:Q(e=>e.descriptionElementId),titleElementId:Q(e=>e.titleElementId),viewportElement:Q(e=>e.viewportElement),role:Q(e=>e.role)},Nc=class e extends Ra{constructor(e,t,n=!1){let r=new co,i=Pc(e);i.floatingRootContext=fo(r,t,n),super(i,{popupRef:j.createRef(),backdropRef:j.createRef(),internalBackdropRef:j.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:r,onOpenChange:void 0,onOpenChangeComplete:void 0},Mc)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};$a(n,e,t.trigger),this.update(n)};static useStore(t,n){return Za(t,(t,r)=>new e(n,t,r),!0).store}};function Pc(e={}){return{...uo(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function Fc(e,t=`dialog`){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=e,p=t===`drawer`,m=t===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=Js(!0),y={modal:h,disablePointerDismissal:g,nested:!!v,role:_},b=Nc.useStore(u?.store,{open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y});ja(()=>{let e=r===void 0&&b.state.open===!1&&i===!0?{open:!0,activeTriggerId:f}:null;m?b.update(e?{...y,...e}:y):e&&b.update(e)}),b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);Ac({store:b,actionsRef:l});let w=x||S,T=j.useMemo(()=>({store:b}),[b]);return(0,F.jsx)(Ks.Provider,{value:!1,children:(0,F.jsxs)(qs.Provider,{value:T,children:[w&&(0,F.jsx)(jc,{store:b,parentContext:v?.store.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})})}function Ic(e){return Fc(e,j.useContext(Ks)?`drawer`:`dialog`)}var Lc=j.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Js(),c=Zo(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Vr(`h2`,e,{ref:t,props:[{id:c},o]})});function Rc({open:e,onClose:t,children:n,wide:r=!1}){let i=`-translate-y-1/2 max-h-[calc(100dvh-4rem)] ${r?`top-1/2 max-w-[62rem]`:`top-[46%] max-w-160`}`;return(0,F.jsx)(Ic,{open:e,onOpenChange:e=>!e&&t(),children:(0,F.jsxs)(bc,{children:[(0,F.jsx)(Xs,{className:`fixed inset-0 z-[900] bg-black/25 backdrop-blur-[8px] transition-opacity duration-200 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:bg-black/45`}),(0,F.jsx)(vc,{className:`glass-strong fixed left-1/2 z-[901] w-full -translate-x-1/2 overflow-auto rounded-sheet px-[26px] pb-7 pt-6 outline-none transition-opacity duration-200 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 ${i}`,children:n})]})})}function zc({title:e,sub:t}){return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,F.jsx)(Lc,{className:`text-[20px] font-semibold tracking-[-0.015em] text-display`,children:e}),(0,F.jsx)(rc,{"aria-label":`Close`,className:`-mr-1 shrink-0 cursor-pointer rounded-full border-none bg-transparent px-1.5 py-0.5 text-[15px] leading-none text-disabled transition-colors hover:text-display focus-visible:text-display focus-visible:outline-none`,children:`✕`})]}),t!=null&&(0,F.jsx)(`div`,{className:`mt-1.5 text-meta text-secondary`,children:t})]})}function Bc({children:e,action:t}){return(0,F.jsxs)(`div`,{className:`mb-2.5 mt-6 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:[(0,F.jsx)(`h2`,{className:p,children:e}),t]})}function Vc(e,t,n=Date.now()){let r=t?Date.parse(t):NaN;if(!Number.isFinite(r))return`offline`;let i=n-r;return e&&i<3e4?`online`:i<216e5?`asleep`:`offline`}function Hc(e){let t=/^\s*v?(\d+)\.(\d+)\.(\d+)/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function Uc(e){return/^\s*v?\d+\.\d+\.\d+-/.test(e)}function Wc(e,t){if(!e||!t)return!1;let n=Hc(e),r=Hc(t);if(!n||!r)return!1;for(let e=0;e<3;e++){let t=n[e],i=r[e];if(t<i)return!0;if(t>i)return!1}return Uc(e)&&!Uc(t)}function Gc(e,t,n,r){let i=`${n} daemon start --server-url ${e} --connect-key ${t}`;return r?i:`npm install -g @kky42/pievo@latest && ${i}`}function Kc(e,t){let n=`${e} daemon restart`;return t?n:`npm install -g @kky42/pievo@latest && ${n}`}function qc(e,t,n){return Gc(typeof window<`u`?window.location.origin:`http://127.0.0.1:3000`,e,t,n)}function Jc({text:e}){let[t,n]=(0,j.useState)(!1);return(0,F.jsx)(`button`,{className:s,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1400)},children:t?`Copied ✓`:`Copy`})}function Yc({open:e,onClose:t,teamId:n}){let[r,i]=(0,j.useState)([]),[o,c]=(0,j.useState)(null),[u,d]=(0,j.useState)(null),[f,p]=(0,j.useState)(``),[h,y]=(0,j.useState)(!1),[b,x]=(0,j.useState)(null),[S,C]=(0,j.useState)(null),[w,T]=(0,j.useState)(!1);(0,j.useEffect)(()=>{if(!e){x(null);return}let t=!0;return C(null),T(!1),O().then(e=>{t&&C(e)}).catch(()=>{t&&T(!0)}),()=>{t=!1}},[e]);let E=(0,j.useCallback)(async()=>{try{i(await ks({data:n}))}catch{}},[n]),D=(0,j.useRef)(e);D.current=e,(0,j.useEffect)(()=>{if(!e||o)return;E();let t=setInterval(()=>D.current&&void E(),3e3);return()=>clearInterval(t)},[e,o,E]),(0,j.useEffect)(()=>{if(!o)return;let e=!0,t=async()=>{let t=await js({data:o.id}).catch(()=>void 0);!e||t===void 0||(d(t),t?.online&&t.hostname&&p(e=>e||t.hostname||``))};t();let n=setInterval(t,2e3);return()=>{e=!1,clearInterval(n)}},[o]);async function k(){y(!0),x(null);try{let e=await As({data:n});if(`error`in e){x(e.error);return}d(null),p(``),c(e)}finally{y(!1)}}async function M(){o&&await Ns({data:o.id}),c(null),d(null),await E()}async function N(){o&&f.trim()&&await Ms({data:{id:o.id,name:f.trim()}}),c(null),d(null),await E()}async function P(e){x(null);let t=await Ns({data:e});if(!t.ok){x(t.error??`Could not delete this machine.`),await E();return}await E()}let I=!!u?.online;return o?(0,F.jsxs)(Rc,{open:e,onClose:M,children:[(0,F.jsx)(zc,{title:I?`Computer connected`:`Connect computer`}),I?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`mt-5 flex items-center gap-3 rounded-control border border-hairline bg-success-soft px-4 py-3`,children:[(0,F.jsx)(`span`,{className:`text-xl text-success`,children:`✓`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[15px] font-medium text-display`,children:`Computer connected successfully!`}),(0,F.jsxs)(`div`,{className:`text-label text-secondary`,children:[u?.hostname??`unknown`,u?.platform?` - ${u.platform} ${u.arch??``}`:``]})]})]}),(0,F.jsxs)(`div`,{className:`mt-5`,children:[(0,F.jsx)(`label`,{className:l,children:`Computer name`}),(0,F.jsx)(`input`,{className:v,value:f,onChange:e=>p(e.target.value),placeholder:u?.hostname??`My computer`}),(0,F.jsx)(`div`,{className:`mt-1 text-label text-secondary`,children:`A friendly name for this computer.`})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`mt-5 text-body font-medium text-display`,children:`Run this command on your computer to connect:`}),S?(0,F.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,F.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-4 font-mono text-label leading-relaxed text-paper`,children:qc(o.token,S.pievoCli,S.customCli)}),(0,F.jsx)(Jc,{text:qc(o.token,S.pievoCli,S.customCli)})]}):(0,F.jsx)(`div`,{className:`mt-2 text-body text-secondary`,children:w?`Could not load the connection command. Close and try again.`:`Loading connection command…`}),(0,F.jsxs)(`div`,{className:`mt-4 flex items-center gap-2.5 rounded-control border border-hairline bg-warn-soft px-4 py-3`,children:[(0,F.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 animate-pulse rounded-full bg-rubik-orange`}),(0,F.jsx)(`span`,{className:`text-[14px] font-medium text-warn`,children:`Waiting for computer to connect…`})]})]}),(0,F.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{className:s,onClick:()=>void M(),children:`Cancel`}),(0,F.jsx)(`button`,{className:g,disabled:!I||!f.trim(),onClick:()=>void N(),children:`Done`})]})]}):(0,F.jsxs)(Rc,{open:e,onClose:t,children:[(0,F.jsx)(zc,{title:`Machines`,sub:`Each machine runs a pievo daemon that executes your loops via your local coding agent.`}),(0,F.jsx)(Bc,{children:`Connected machines`}),b&&(0,F.jsx)(_,{message:b,onDismiss:()=>x(null)}),r.length===0&&(0,F.jsx)(`div`,{className:`py-3 text-body text-secondary`,children:`No machines yet.`}),(0,F.jsx)(`ul`,{className:`flex flex-col gap-2`,children:r.map(e=>{let t=Vc(e.online,e.lastSeen),n=t===`online`?`bg-rubik-green`:t===`asleep`?`bg-rubik-yellow`:`bg-disabled`,r=t===`online`?`online`:t===`asleep`?`asleep${e.lastSeen?` · seen ${a(e.lastSeen)}`:``}`:e.lastSeen?`offline · seen ${a(e.lastSeen)}`:`offline`;return(0,F.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-control border border-hairline bg-surface px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${n}`,title:t}),(0,F.jsx)(`span`,{className:`text-[15px] font-medium text-display`,children:e.name}),(0,F.jsxs)(`span`,{className:`text-label text-secondary`,children:[r,e.platform?` · ${e.platform} ${e.arch??``}`:``,e.loopCount>0?` · ${e.loopCount} loop${e.loopCount===1?``:`s`}`:``]})]}),(0,F.jsx)(`button`,{className:m,disabled:e.loopCount>0,title:e.loopCount>0?`Delete its loops first`:void 0,onClick:()=>void P(e.id),children:`Delete`})]}),(0,F.jsx)(`div`,{className:`text-label text-secondary`,children:A(e.daemonProtocol).label}),!A(e.daemonProtocol).supported&&(0,F.jsx)(`div`,{className:`text-label text-accent`,children:`Daemon upgrade required to stop a running process`}),!e.online&&!e.token&&(0,F.jsx)(`div`,{className:`text-label text-secondary`,children:`Reconnect command available from the machine owner's account.`}),!e.online&&e.token&&!S&&(0,F.jsx)(`div`,{className:`text-label text-secondary`,children:w?`Could not load the reconnect command. Close and try again.`:`Loading reconnect command…`}),!e.online&&e.token&&S&&(0,F.jsxs)(`details`,{children:[(0,F.jsx)(`summary`,{className:`cursor-pointer select-none text-label font-medium text-secondary marker:content-[''] hover:text-display`,children:`Reconnect command`}),(0,F.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,F.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:qc(e.token,S.pievoCli,S.customCli)}),(0,F.jsx)(Jc,{text:qc(e.token,S.pievoCli,S.customCli)})]})]}),e.needsUpdate&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-control border border-warn/40 bg-warn/10 p-3`,children:[(0,F.jsx)(`div`,{className:`text-label font-medium text-primary`,children:`Daemon needs update before this server will dispatch runs.`}),(0,F.jsxs)(`div`,{className:`text-label text-secondary`,children:[`running `,e.daemonVersion?`v${e.daemonVersion}`:`unknown version`,` · required v`,e.requiredDaemonVersion]}),S?(0,F.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:Kc(S.pievoCli,S.customCli)}),(0,F.jsx)(Jc,{text:Kc(S.pievoCli,S.customCli)})]}):(0,F.jsx)(`div`,{className:`text-label text-secondary`,children:w?`Could not load the upgrade command. Close and try again.`:`Loading upgrade command…`})]}),!e.needsUpdate&&Wc(e.daemonVersion,e.latestDaemonVersion)&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`text-label text-secondary`,children:[`daemon v`,e.daemonVersion,` · upgrade available (v`,e.latestDaemonVersion,`)`]}),S?(0,F.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:Kc(S.pievoCli,S.customCli)}),(0,F.jsx)(Jc,{text:Kc(S.pievoCli,S.customCli)})]}):(0,F.jsx)(`div`,{className:`text-label text-secondary`,children:w?`Could not load the upgrade command. Close and try again.`:`Loading upgrade command…`})]})]},e.id)})}),(0,F.jsx)(`div`,{className:`mt-6`,children:(0,F.jsx)(`button`,{className:g,disabled:h,onClick:()=>void k(),children:h?`Preparing…`:`+ Connect computer`})})]})}export{Bc as a,Ps as c,At as d,zc as i,ks as l,Gc as n,Gs as o,Rc as r,Vs as s,Yc as t,Qo as u};
1
+ import{E as e,M as t,O as n,P as r,S as i,T as a,_ as o,a as s,b as c,d as l,f as u,g as d,j as f,m as p,o as m,r as h,s as g,t as _,u as v,v as y,w as b,x,y as S}from"./ui-s5IMg6RF.js";import{D as C,Et as w,F as T,H as E,P as D,p as O}from"./preload-helper-Bs7oCAsw.js";import{i as k,n as A}from"./lifecycleUi-C0DaC6NM.js";var j=r(t(),1),M={};function N(e,t){let n=j.useRef(M);return n.current===M&&(n.current=e(t)),n}var P=r(w(),1),F=f(),I=T(),L=D(),ee=[],te=void 0;function ne(){return te}function re(e){ee.push(e)}function ie(e){let t=(t,n)=>{let r=N(ae).current,i;try{te=r;for(let e of ee)e.before(r);i=e(t,n);for(let e of ee)e.after(r);r.didInitialize=!0}finally{te=void 0}return i};return t.displayName=e.displayName||e.name,t}function R(e){return j.forwardRef(ie(e))}function ae(){return{didInitialize:!1}}var z=typeof document<`u`?j.useLayoutEffect:()=>{};function oe(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var B=oe(`https://base-ui.com/production-error`,`Base UI`),V=j.createContext(void 0);function se(e){let t=j.useContext(V);if(t===void 0&&!e)throw Error(B(72));return t}var ce=[];function le(e){j.useEffect(e,ce)}var ue=0,de=class e{static create(){return new e}currentId=ue;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=ue,t()},e)}isStarted(){return this.currentId!==ue}clear=()=>{this.currentId!==ue&&(clearTimeout(this.currentId),this.currentId=ue)};disposeEffect=()=>this.clear};function fe(){let e=N(de.create).current;return le(e.disposeEffect),e}function pe(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:me,platform:he,maxTouchPoints:ge}=pe(),_e=me.toLowerCase(),ve=he.toLowerCase(),ye=/^i(os$|p)/.test(ve)||ve===`macintel`&&ge>1,be=`android`,xe=ve===be||_e.includes(be),Se=!ye&&ve.startsWith(`mac`);ve.startsWith(`win`),!xe&&/^(linux|chrome os)/.test(ve);var Ce=Se||ye,we=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!we&&_e.includes(`firefox`),!we&&_e.includes(`chrom`);var Te=Ce,Ee=/jsdom|happydom/.test(_e);function De(e){e.preventDefault(),e.stopPropagation()}function Oe(e){return`nativeEvent`in e}function ke(e){return e.pointerType===``&&e.isTrusted?!0:xe&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Ae(e){return Ee?!1:!xe&&e.width===0&&e.height===0||xe&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function je(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Me(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function Ne(){return typeof window<`u`}function H(e){return Fe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pe(e){return((Fe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Fe(e){return Ne()?e instanceof Node||e instanceof U(e).Node:!1}function W(e){return Ne()?e instanceof Element||e instanceof U(e).Element:!1}function G(e){return Ne()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Ie(e){return!Ne()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Le(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Je(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Re(e){return/^(table|td|th)$/.test(H(e))}function ze(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Be=/transform|translate|scale|rotate|perspective|filter/,Ve=/paint|layout|strict|content/,He=e=>!!e&&e!==`none`,Ue;function We(e){let t=W(e)?Je(e):e;return He(t.transform)||He(t.translate)||He(t.scale)||He(t.rotate)||He(t.perspective)||!Ke()&&(He(t.backdropFilter)||He(t.filter))||Be.test(t.willChange||``)||Ve.test(t.contain||``)}function Ge(e){let t=Xe(e);for(;G(t)&&!qe(t);){if(We(t))return t;if(ze(t))return null;t=Xe(t)}return null}function Ke(){return Ue??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ue}function qe(e){return/^(html|body|#document)$/.test(H(e))}function Je(e){return U(e).getComputedStyle(e)}function Ye(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xe(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ie(e)&&e.host||Pe(e);return Ie(t)?t.host:t}function Ze(e){let t=Xe(e);return qe(t)?e.ownerDocument?e.ownerDocument.body:e.body:G(t)&&Le(t)?t:Ze(t)}function Qe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ze(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=$e(a);return t.concat(a,a.visualViewport||[],Le(r)?r:[],e&&n?Qe(e):[])}else return t.concat(r,Qe(r,[],n))}function $e(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var et=`data-base-ui-focusable`,tt=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`;function nt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function K(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Ie(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function rt(e){return`composedPath`in e?e.composedPath()[0]:e.target}function it(e,t){if(!W(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(K(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function at(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function ot(e){return e.matches(`html,body`)}function st(e){return G(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function ct(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${tt}`)!=null}function lt(e){return e?e.getAttribute(`role`)===`combobox`&&st(e):!1}function ut(e){if(!e||Ee)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function dt(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function ft(e,t){return t!=null&&!je(t)?0:typeof e==`function`?e():e}function pt(e,t,n){let r=ft(e,n);return typeof r==`number`?r:r?.[t]}function mt(e){return typeof e==`function`?e():e}function ht(e,t){return t||e===`click`||e===`mousedown`}function gt(e){return e?.includes(`mouse`)&&e!==`mousedown`}function _t(){}Object.freeze([]);var q=Object.freeze({}),vt=`none`,yt=`trigger-press`,bt=`trigger-hover`,xt=`trigger-focus`,St=`outside-press`,Ct=`close-press`,wt=`focus-out`,Tt=`escape-key`,Et=`disabled`,Dt=`imperative-action`;function J(e,t,n,r){let i=!1,a=!1,o=r??q;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var Ot=j.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new de,currentIdRef:{current:null},currentContextRef:{current:null}});function kt(e,t){e.current=t.current}function At(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=j.useRef(n),a=j.useRef(n),o=j.useRef(null),s=j.useRef(null),c=fe();return z(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:pt(i.current,`open`),close:pt(n,`close`)}},[n,o,i,a]),(0,F.jsx)(Ot.Provider,{value:j.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function jt(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=j.useContext(Ot),[f,p]=j.useState(!1),m=j.useRef(n),h=j.useRef(!1);return z(()=>{m.current=n},[n]),z(()=>()=>{h.current=!0},[]),z(()=>{function e(){h.current||p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),z(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:pt(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,J(vt))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),z(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,kt(o,c),d.clear()}},[l,a,o,i,c,d]),j.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function Y(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Mt(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Nt(e,t,n,r){let i=N(Ft).current;return It(i,e,t,n,r)&&Rt(i,[e,t,n,r]),i.callback}function Pt(e){let t=N(Ft).current;return Lt(t,e)&&Rt(t,e),t.callback}function Ft(){return{callback:null,cleanup:null,refs:[]}}function It(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Lt(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function Rt(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}function zt(e){let t=N(Bt,e).current;return t.next=e,z(t.effect),t}function Bt(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Vt={...j},Ht=Vt.useInsertionEffect,Ut=Ht&&Ht!==Vt.useLayoutEffect?Ht:e=>e();function X(e){let t=N(Wt).current;return t.next=e,Ut(t.effect),t.trampoline}function Wt(){let e={next:void 0,callback:Gt,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Gt(){}var Kt=null;globalThis.requestAnimationFrame;var qt=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},Jt=class e{static create(){return new e}static request(e){return qt.request(e)}static cancel(e){return qt.cancel(e)}currentId=Kt;request(e){this.cancel(),this.currentId=qt.request(()=>{this.currentId=Kt,e()})}cancel=()=>{this.currentId!==Kt&&(qt.cancel(this.currentId),this.currentId=Kt)};disposeEffect=()=>this.cancel};function Yt(){let e=N(Jt.create).current;return le(e.disposeEffect),e}function Z(e){return e?.ownerDocument||document}var Xt={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Zt={...Xt,position:`fixed`,top:0,left:0};({...Xt});var Qt=j.forwardRef(function(e,t){let[n,r]=j.useState();z(()=>{Te&&we&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,F.jsx)(`span`,{...e,ref:t,style:Zt,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),$t=[`top`,`right`,`bottom`,`left`],en=Math.min,tn=Math.max,nn=Math.round,rn=Math.floor,an=e=>({x:e,y:e}),on={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function sn(e,t,n){return tn(e,en(t,n))}function cn(e,t){return typeof e==`function`?e(t):e}function ln(e){return e.split(`-`)[0]}function un(e){return e.split(`-`)[1]}function dn(e){return e===`x`?`y`:`x`}function fn(e){return e===`y`?`height`:`width`}function pn(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function mn(e){return dn(pn(e))}function hn(e,t,n){n===void 0&&(n=!1);let r=un(e),i=mn(e),a=fn(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=wn(o)),[o,wn(o)]}function gn(e){let t=wn(e);return[_n(e),t,_n(t)]}function _n(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var vn=[`left`,`right`],yn=[`right`,`left`],bn=[`top`,`bottom`],xn=[`bottom`,`top`];function Sn(e,t,n){switch(e){case`top`:case`bottom`:return n?t?yn:vn:t?vn:yn;case`left`:case`right`:return t?bn:xn;default:return[]}}function Cn(e,t,n,r){let i=un(e),a=Sn(ln(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(_n)))),a}function wn(e){let t=ln(e);return on[t]+e.slice(t.length)}function Tn(e){return{top:0,right:0,bottom:0,left:0,...e}}function En(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Tn(e)}function Dn(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}}function On(e){return e.visibility===`hidden`||e.visibility===`collapse`}function kn(e,t=e?Je(e):null){return!e||!e.isConnected||!t||On(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var An=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function jn(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return Ie(n)?n.host:null}function Mn(e){for(let t of Array.from(e.children))if(H(t)===`summary`)return t;return null}function Nn(e,t){let n=Mn(t);return!!n&&(e===n||K(n,e))}function Pn(e){let t=e?H(e):``;return e!=null&&e.matches(An)&&(t!==`summary`||e.parentElement!=null&&H(e.parentElement)===`details`&&Mn(e.parentElement)===e)&&(t!==`details`||Mn(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Fn(e){if(!Pn(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=jn(t)){let n=t!==e,r=H(t)===`slot`;if(t.hasAttribute(`inert`)||n&&H(t)===`details`&&!t.open&&!Nn(e,t)||t.hasAttribute(`hidden`)||!r&&!In(t,n))return!1}return!0}function In(e,t){let n=Je(e);return t?n.display!==`none`:kn(e,n)}function Ln(e){let t=e.tabIndex;if(t<0){let t=H(e);if(t===`details`||t===`audio`||t===`video`||G(e)&&e.isContentEditable)return 0}return t}function Rn(e){if(H(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function zn(e,t){let n=Rn(e);if(!n)return!0;let r=t.find(e=>{let t=Rn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Rn(e);return t?.name===n.name&&t.form===n.form})===n}function Bn(e){if(G(e)&&H(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return G(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Vn(e,t){Bn(e).forEach(e=>{Pn(e)&&t.push(e),Vn(e,t)})}function Hn(e,t,n){Bn(e).forEach(e=>{G(e)&&e.matches(t)&&n.push(e),Hn(e,t,n)})}function Un(e){return Fn(e)&&Ln(e)>=0}function Wn(e){let t=[];return Vn(e,t),t.filter(Fn)}function Gn(e){let t=Wn(e);return t.filter(e=>Ln(e)>=0&&zn(e,t))}function Kn(e,t){let n=Gn(e),r=n.length;if(r===0)return;let i=nt(Z(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function qn(e){return Kn(Z(e).body,1)||e}function Jn(e){return Kn(Z(e).body,-1)||e}function Yn(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!K(n,r)}function Xn(e){Gn(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Zn(e){let t=[];Hn(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Qn(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Qn(e,t.id,n)])}function $n(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function er(e){return`data-base-ui-${e}`}var tr=0;function nr(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(tr);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),_t;let o=requestAnimationFrame(a);return tr=o,()=>{tr===o&&(cancelAnimationFrame(o),tr=0)}}var rr={inert:new WeakMap,"aria-hidden":new WeakMap},ir=`data-base-ui-inert`,ar={inert:new WeakSet,"aria-hidden":new WeakSet},or=new WeakMap,sr=0;function cr(e){return ar[e]}function lr(e){return e?Ie(e)?e.host:lr(e.parentNode):null}var ur=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=lr(t);return e.contains(n)?n:null}).filter(e=>e!=null),dr=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},fr=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{H(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function pr(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=ur(t,e),l=i?fr(t,dr(c),new Set(c)):[],u=[],d=[];if(a){let e=rr[a],n=cr(a);s=n,o=e;let r=ur(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);fr(t,dr(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(or.get(e)||0)+1;or.set(e,t),d.push(e),t===1&&e.setAttribute(ir,``)}),sr+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(or.get(e)||0)-1;or.set(e,t),t||e.removeAttribute(ir)}),--sr,sr||(rr.inert=new WeakMap,rr[`aria-hidden`]=new WeakMap,ar.inert=new WeakSet,ar[`aria-hidden`]=new WeakSet,or=new WeakMap)}}function mr(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=Z(e[0]).body;return pr(e,a,n,r,{mark:i})}var hr=0;function gr(e,t=`mui`){let[n,r]=j.useState(e),i=e||n;return j.useEffect(()=>{n??(hr+=1,r(`${t}-${hr}`))},[n,t]),i}var _r=Vt.useId;function vr(e,t){if(_r!==void 0){let n=_r();return e??(t?`${t}-${n}`:n)}return gr(e,t)}var yr=19;function br(e){return yr>=e}function xr(e){if(!j.isValidElement(e))return null;let t=e,n=t.props;return(br(19)?n?.ref:t.ref)??null}function Sr(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Cr(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function wr(e,t){return typeof e==`function`?e(t):e}function Tr(e,t){return typeof e==`function`?e(t):e}var Er={};function Dr(e,t,n,r,i){if(!n&&!r&&!i&&!e)return kr(t);let a=kr(e);return t&&(a=Ar(a,t)),n&&(a=Ar(a,n)),r&&(a=Ar(a,r)),i&&(a=Ar(a,i)),a}function Or(e){if(e.length===0)return Er;if(e.length===1)return kr(e[0]);let t=kr(e[0]);for(let n=1;n<e.length;n+=1)t=Ar(t,e[n]);return t}function kr(e){return Pr(e)?{...Fr(e,Er)}:jr(e)}function Ar(e,t){return Pr(t)?Fr(t,e):Mr(e,t)}function jr(e){let t={...e};for(let e in t){let n=t[e];Nr(e,n)&&(t[e]=Lr(n))}return t}function Mr(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Sr(e.style,r);break;case`className`:e[n]=zr(e.className,r);break;default:Nr(n,r)?e[n]=Ir(e[n],r):e[n]=r}}return e}function Nr(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function Pr(e){return typeof e==`function`}function Fr(e,t){return Pr(e)?e(t):e??Er}function Ir(e,t){return t?e?(...n)=>{let r=n[0];if(Br(r)){let i=r;Rr(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:Lr(t):e}function Lr(e){return e&&((...t)=>{let n=t[0];return Br(n)&&Rr(n),e(...t)})}function Rr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function zr(e,t){return t?e?t+` `+e:t:e}function Br(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function Vr(e,t,n={}){let r=t.render,i=Hr(t,n);return n.enabled===!1?null:Gr(e,r,i,n.state??q)}function Hr(e,t={}){let{className:n,style:r,render:i}=e,{state:a=q,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?wr(n,a):void 0,d=l?Tr(r,a):void 0,f=l?Cr(a,c):q,p=l&&s?Ur(s):void 0,m=l?Sr(f,p)??{}:q;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=Pt([m.ref,xr(i),...o]):m.ref=Nt(m.ref,xr(i),o):Nt(null,null)),l?(u!==void 0&&(m.className=zr(m.className,u)),d!==void 0&&(m.style=Sr(m.style,d)),m):q}function Ur(e){return Array.isArray(e)?Or(e):Dr(void 0,e)}var Wr=Symbol.for(`react.lazy`);function Gr(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Dr(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===Wr&&(i=j.Children.toArray(t)[0]),j.cloneElement(i,e)}if(e&&typeof e==`string`)return Kr(e,n);throw Error(B(8))}function Kr(e,t){return e===`button`?(0,j.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,j.createElement)(`img`,{alt:``,...t,key:t.key}):j.createElement(e,t)}var qr={style:{transition:`none`}},Jr={fallbackAxisSide:`end`},Yr={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Xr=j.createContext(null),Zr=()=>j.useContext(Xr),Qr=er(`portal`);function $r(e={}){let{ref:t,container:n,componentProps:r=q,elementProps:i}=e,a=vr(),o=Zr()?.portalNode,[s,c]=j.useState(null),[l,u]=j.useState(null),d=X(e=>{e!==null&&u(e)}),f=j.useRef(null);z(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(Fe(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=Vr(`div`,r,{ref:[t,d],props:[{id:a,[Qr]:``},i]});return{portalNode:l,portalSubtree:s&&p?P.createPortal(p,s):null}}var ei=j.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,renderGuards:s,...c}=e,{portalNode:l,portalSubtree:u}=$r({container:o,ref:t,componentProps:e,elementProps:c}),d=j.useRef(null),f=j.useRef(null),p=j.useRef(null),m=j.useRef(null),[h,g]=j.useState(null),_=j.useRef(!1),v=h?.modal,y=h?.open,b=typeof s==`boolean`?s:!!h&&!h.modal&&h.open&&!!l;j.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&Yn(e)&&(e.type===`focusin`?_.current&&=(Zn(l),!1):(Xn(l),_.current=!0))}return Mt(Y(l,`focusin`,e,!0),Y(l,`focusout`,e,!0))},[l,v]),z(()=>{!l||y!==!0||!_.current||(Zn(l),_.current=!1)},[y,l]);let x=j.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,F.jsxs)(j.Fragment,{children:[u,(0,F.jsxs)(Xr.Provider,{value:x,children:[b&&l&&(0,F.jsx)(Qt,{"data-type":`outside`,ref:d,onFocus:e=>{Yn(e,l)?p.current?.focus():Jn(h?h.domReference:null)?.focus()}}),b&&l&&(0,F.jsx)(`span`,{"aria-owns":l.id,style:Yr}),l&&P.createPortal(a,l),b&&l&&(0,F.jsx)(Qt,{"data-type":`outside`,ref:f,onFocus:e=>{Yn(e,l)?m.current?.focus():(qn(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,J(`focus-out`,e.nativeEvent)))}})]})]})});function ti(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var ni=j.createContext(null),ri=j.createContext(null),ii=()=>j.useContext(ni)?.id||null,ai=e=>{let t=j.useContext(ri);return e??t};function oi(e){return e==null?e:`current`in e?e.current:e}function si(e,t){let n=U(rt(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var ci=20,li=[];function ui(){li=li.filter(e=>e.deref()?.isConnected)}function di(e){ui(),e&&H(e)!==`body`&&(li.push(new WeakRef(e)),li.length>ci&&(li=li.slice(-20)))}function fi(){return ui(),li[li.length-1]?.deref()}function pi(e){return e?Un(e)?e:Gn(e)[0]||e:null}function mi(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Wn(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Un(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function hi(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=X(()=>b.current.floatingContext?.nodeId),S=i===!1,C=lt(_)&&S,w=zt(i),T=zt(a),E=zt(l),D=zt(g),O=ai(p),k=Zr(),A=j.useRef(!1),M=j.useRef(!1),N=j.useRef(!1),P=j.useRef(null),I=j.useRef(``),L=j.useRef(``),ee=j.useRef(null),te=j.useRef(null),ne=Nt(ee,f,k?.beforeInsideRef),re=Nt(te,k?.afterInsideRef),ie=fe(),R=fe(),ae=Yt(),oe=k!=null,B=dt(v),V=X((e=B)=>e?Gn(e):[]),se=X(()=>m?.().filter(e=>e!=null)??[]);j.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&K(B,nt(Z(B)))&&V().length===0&&!C&&De(e)}return Y(Z(B),`keydown`,e)},[r,B,s,C,V]),j.useEffect(()=>{if(r||!g)return;let e=Z(B);function t(){N.current=!1}function n(e){let t=rt(e),n=se();N.current=!(K(v,t)||K(_,t)||K(k?.portalNode,t)||n.some(e=>e===t||K(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(M.current=!0,R.start(0,()=>{M.current=!1}))}function i(){L.current=`keyboard`}return Mt(Y(e,`pointerdown`,n,!0),Y(e,`pointerup`,t,!0),Y(e,`pointercancel`,t,!0),Y(e,`keydown`,i,!0),t)},[r,v,_,B,g,k,R,se]),j.useEffect(()=>{if(r||!c)return;let e=Z(B);function t(){M.current=!0,R.start(0,()=>{M.current=!1})}function n(e){let t=rt(e);Un(t)&&(P.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=rt(t);s&&n==null&&i!=null&&K(v,i)&&di(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=se(),f=n?.hasAttribute(er(`focus-guard`))&&[ee.current,te.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,oi(d),oi(u)].includes(n),p=!(K(_,n)||K(v,n)||K(n,v)||K(k?.portalNode,n)||l.some(e=>e===n||K(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>K(e,n))||f||O&&(Qn(O.nodesRef.current,a).find(e=>K(e.context?.elements.floating,n)||K(e.context?.elements.domReference,n))||$n(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,dt(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&B&&mi(B),o&&r!==_&&!kn(i)&&nt(e)===e.body){if(G(B)&&(B.focus(),o===`popup`)){ae.request(()=>{B.focus()});return}let e=V(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||B;G(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!M.current&&(C||n!==fi())&&(A.current=!0,h.setOpen(!1,J(wt,t)))})}function a(){N.current||(b.current.insideReactTree=!0,ie.start(0,()=>{b.current.insideReactTree=!1}))}let l=G(_)?_:null;if(!(!v&&!l))return Mt(l&&Y(l,`focusout`,i),l&&Y(l,`pointerdown`,t),v&&Y(v,`focusin`,n),v&&Y(v,`focusout`,i),v&&k&&Y(v,`focusout`,a,!0))},[r,_,v,B,s,O,k,h,c,o,V,C,x,b,ie,R,ae,u,d,se]),j.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${er(`portal`)}]`)||[]),t=(O?$n(O.nodesRef.current,x()):[]).find(e=>lt(e.context?.elements.domReference||null))?.context?.elements.domReference,n=mr([v,...e,ee.current,te.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...se(),t,oi(d),oi(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=mr([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,se]),z(()=>{if(!g||r||!G(B))return;let e=Z(B),t=nt(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||K(B,t))return;let i=null,a=()=>(i??=V(B),i[0]||B),o;o=r===!0||r===null?a():oi(r),o||=a();let s=K(B,nt(e));nr(o,{preventScroll:o===B,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=nt(e);return!(t!==o&&K(B,t))}})})},[r,g,B,V,w,E,D]),z(()=>{if(r||!B)return;let e=Z(B),t=nt(e),n=E.current==null;di(t);function i(e){if(e.open||(I.current=si(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`)if(e.nested)A.current=!1;else if(ke(e.nativeEvent)||Ae(e.nativeEvent))A.current=!1;else{let e=!1;Z(B).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.current=!0}}y.on(`openchange`,i);function a(){let e=T.current,r=typeof e==`function`?e(I.current):e;if(r===void 0||r===!1)return null;r===null&&(r=!0);let i=_?.isConnected?_:null,a=t?.isConnected&&H(t)!==`body`?t:null,o=n?a||i:i||a;return o||=fi()||null,typeof r==`boolean`?o:oi(r)||o||null}return()=>{y.off(`openchange`,i);let t=nt(e),n=se(),r=K(v,t)||n.some(e=>e===t||K(e,t))||O&&Qn(O.nodesRef.current,x(),!1).some(e=>K(e.context?.elements.floating,t)),o=T.current,s=a();queueMicrotask(()=>{let n=pi(s),i=typeof o!=`boolean`;o&&!A.current&&G(n)&&(!(!i&&n!==t&&t!==e.body)||r)&&n.focus({preventScroll:!0}),A.current=!1})}},[r,v,B,T,E,y,O,_,x,se]),z(()=>{if(!we||g||!v)return;let e=nt(Z(v));!G(e)||!st(e)||K(v,e)&&e.blur()},[g,v]),z(()=>{if(!(r||!k))return k.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{k.setFocusManagerState(null)}},[r,k,s,g,h,c,_]),z(()=>{if(!(r||!B))return mi(B),()=>{queueMicrotask(ui)}},[r,B]);let ce=!r&&(s?!C:!0)&&(oe||s);return(0,F.jsxs)(j.Fragment,{children:[ce&&(0,F.jsx)(Qt,{"data-type":`inside`,ref:ne,onFocus:e=>{if(s){let e=V();nr(e[e.length-1])}else k?.portalNode&&(A.current=!1,Yn(e,k.portalNode)?qn(_)?.focus():oi(d??k.beforeOutsideRef)?.focus())}}),n,ce&&(0,F.jsx)(Qt,{"data-type":`inside`,ref:re,onFocus:e=>{s?nr(V()[0]):k?.portalNode&&(c&&(A.current=!0),Yn(e,k.portalNode)?Jn(_)?.focus():oi(u??k.afterOutsideRef)?.focus())}})]})}function gi(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function _i(e){return e!=null&&e.clientX!=null}function vi(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=j.useRef(!1),u=j.useRef(null),[d,f]=j.useState(),[p,m]=j.useState([]),h=X(e=>{i.set(`positionReference`,e)}),g=X((e,t,n)=>{l.current||c.current.openEvent&&!_i(c.current.openEvent)||i.set(`positionReference`,gi(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=X(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=je(d)?o:a;j.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=U(o);function r(t){K(o,rt(t))?e():g(t.clientX,t.clientY)}return!c.current.openEvent||_i(c.current.openEvent)?u.current=Y(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),j.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),j.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),j.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=j.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return j.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function yi(){return!1}function bi(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function xi(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=yi,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f}=l.context,p=ai(c),m=X(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=X(()=>a),{escapeKey:v,outsidePress:y}=bi(s),b=j.useRef(!1),x=j.useRef(!1),S=j.useRef(!1),C=j.useRef(!1),w=j.useRef(``),T=j.useRef(null),E=fe(),D=fe(),O=X(()=>{D.clear(),f.current.insideReactTree=!1}),k=X(e=>{let t=f.current.floatingContext?.nodeId;return(p?Qn(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),A=X(e=>at(e,l.select(`floatingElement`))||at(e,l.select(`domReferenceElement`))),M=X(e=>{o()&&l.setOpen(!1,J(yt,e.nativeEvent))}),N=X(e=>{if(!u||!n||!r||e.key!==`Escape`||C.current||!v&&k(`__escapeKeyBubbles`))return;let t=J(Tt,Oe(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!v&&!t.isPropagationAllowed&&e.stopPropagation()}),P=X(()=>{f.current.insideReactTree=!0,D.start(0,O)}),F=X(e=>{if(!u||!n||e.button!==0)return;let t=rt(e.nativeEvent);K(l.select(`floatingElement`),t)&&(b.current||(b.current=!0,x.current=!1))}),I=X(e=>{!u||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});j.useEffect(()=>{if(!u||!n)return;f.current.__escapeKeyBubbles=v,f.current.__outsidePressBubbles=y;let e=new de,t=new de;function i(){e.clear(),C.current=!0}function a(){e.start(we?5:0,()=>{C.current=!1})}function o(){S.current=!0,t.start(0,()=>{S.current=!1})}function s(){b.current=!1,x.current=!1}function c(){let e=w.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function D(e){let t=f.current.floatingContext?.nodeId,n=p&&Qn(p.nodesRef.current,t).some(t=>at(e,t.context?.elements.floating));return A(e)||n}function j(e){if(m(e)){e.type!==`click`&&!A(e)&&(t.clear(),S.current=!1),O();return}if(f.current.insideReactTree){O();return}let n=rt(e),r=`[${er(`inert`)}]`,i=W(n)?n.getRootNode():null,a=Array.from((Ie(i)?i:Z(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>K(e,n))))return;let s=W(n)?n:null;for(;s&&!qe(s);){let e=Xe(s);if(qe(e)||!W(e))break;s=e}if(!(a.length&&W(n)&&!ot(n)&&!K(n,l.select(`floatingElement`))&&a.every(e=>!K(s,e)))){if(G(n)&&!(`touches`in e)){let t=qe(n),r=Je(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!D(e)){if(c()===`intentional`&&S.current){t.clear(),S.current=!1;return}typeof h==`function`&&!h(e)||k(`__outsidePressBubbles`)||(l.setOpen(!1,J(St,e)),O())}}}function M(e){c()!==`sloppy`||e.pointerType===`touch`||!l.select(`open`)||!n||A(e)||j(e)}function P(e){if(c()!==`sloppy`||!l.select(`open`)||!n||A(e))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=rt(e);if(!n)return;let r=Y(n,e.type,()=>{t(e),r()})}function I(e){w.current=`touch`,F(e,P)}function L(e){E.clear(),e.type===`pointerdown`&&(w.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?M(e):j(e)})}function ee(e){if(!b.current)return;let n=x.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!D(e)){if(n){o();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,O())}}}function te(e){if(c()!==`sloppy`||!T.current||A(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-T.current.startX),r=Math.abs(t.clientY-T.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(T.current.dismissOnTouchEnd=!0),i>10&&(j(e),E.clear(),T.current=null)}function ne(e){F(e,te)}function re(e){c()!==`sloppy`||!T.current||A(e)||(T.current.dismissOnTouchEnd&&j(e),E.clear(),T.current=null)}function ie(e){F(e,re)}let R=Z(d),ae=Mt(r&&Mt(Y(R,`keydown`,N),Y(R,`compositionstart`,i),Y(R,`compositionend`,a)),g&&Mt(Y(R,`click`,L,!0),Y(R,`pointerdown`,L,!0),Y(R,`pointerup`,ee,!0),Y(R,`pointercancel`,ee,!0),Y(R,`mousedown`,L,!0),Y(R,`mouseup`,ee,!0),Y(R,`touchstart`,I,!0),Y(R,`touchmove`,ne,!0),Y(R,`touchend`,ie,!0)));return()=>{ae(),e.clear(),t.clear(),s(),S.current=!1}},[f,d,r,g,h,u,n,v,y,N,O,_,k,A,p,l,E]),j.useEffect(O,[h,O]);let L=j.useMemo(()=>({onKeyDown:N,onPointerDown:M,onClick:M}),[N,M]),ee=j.useMemo(()=>({onKeyDown:N,onPointerDown:I,onMouseDown:I,onClickCapture:P,onMouseDownCapture(e){P(),F(e)},onPointerDownCapture(e){P(),F(e)},onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[N,P,F,I]);return j.useMemo(()=>n?{reference:L,floating:ee,trigger:L}:{},[n,L,ee])}function Si(e,t,n){let{reference:r,floating:i}=e,a=pn(t),o=mn(t),s=fn(o),c=ln(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}}switch(un(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Ci(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}=cn(t,e),p=En(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Dn(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=Dn(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}}var wi=50,Ti=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ci},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Si(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<wi&&(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}=Si(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ei=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}=cn(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ln(r),_=pn(o),v=ln(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[wn(o)]:gn(o)),x=p!==`none`;!d&&x&&b.push(...Cn(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=hn(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`&&_!==pn(t))||T.every(e=>pn(e.placement)===_?e.overflows[0]>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=pn(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;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Di(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Oi(e){return $t.some(t=>e[t]>=0)}var ki=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=cn(e,t);switch(i){case`referenceHidden`:{let e=Di(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Oi(e)}}}case`escaped`:{let e=Di(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Oi(e)}}}default:return{}}}}},Ai=new Set([`left`,`top`]);async function ji(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ln(n),s=un(n),c=pn(n)===`y`,l=Ai.has(o)?-1:1,u=a&&c?-1:1,d=cn(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 Mi=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 ji(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}}}}},Ni=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}=cn(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=pn(ln(i)),p=dn(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=sn(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=sn(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Pi=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}=cn(e,t),u={x:n,y:r},d=pn(i),f=dn(d),p=u[f],m=u[d],h=cn(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};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=Ai.has(ln(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}}}},Fi=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=cn(e,t),u=await o.detectOverflow(t,l),d=ln(i),f=un(i),p=pn(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=en(h-u[g],v),x=en(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=tn(u.left,0),t=tn(u.right,0),n=tn(u.top,0),r=tn(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:tn(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:tn(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Ii(e){let t=Je(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=nn(n)!==a||nn(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Li(e){return W(e)?e:e.contextElement}function Ri(e){let t=Li(e);if(!G(t))return an(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ii(t),o=(a?nn(n.width):n.width)/r,s=(a?nn(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var zi=an(0);function Bi(e){let t=U(e);return!Ke()||!t.visualViewport?zi:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Vi(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==U(e)?!1:t}function Hi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Li(e),o=an(1);t&&(r?W(r)&&(o=Ri(r)):o=Ri(e));let s=Vi(a,n,r)?Bi(a):an(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){let e=U(a),t=r&&W(r)?U(r):r,n=e,i=$e(n);for(;i&&r&&t!==n;){let e=Ri(i),t=i.getBoundingClientRect(),r=Je(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=U(i),i=$e(n)}}return Dn({width:u,height:d,x:c,y:l})}function Ui(e,t){let n=Ye(e).scrollLeft;return t?t.left+n:Hi(Pe(e)).left+n}function Wi(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ui(e,n),y:n.top+t.scrollTop}}function Gi(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Pe(r),s=t?ze(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=an(1),u=an(0),d=G(r);if((d||!d&&!a)&&((H(r)!==`body`||Le(o))&&(c=Ye(r)),d)){let e=Hi(r);l=Ri(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Wi(o,c):an(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 Ki(e){return Array.from(e.getClientRects())}function qi(e){let t=Pe(e),n=Ye(e),r=e.ownerDocument.body,i=tn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=tn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ui(e),s=-n.scrollTop;return Je(r).direction===`rtl`&&(o+=tn(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Ji=25;function Yi(e,t){let n=U(e),r=Pe(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ke();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Ui(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Ji&&(a-=o)}else l<=Ji&&(a+=l);return{width:a,height:o,x:s,y:c}}function Xi(e,t){let n=Hi(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=G(e)?Ri(e):an(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Zi(e,t,n){let r;if(t===`viewport`)r=Yi(e,n);else if(t===`document`)r=qi(Pe(e));else if(W(t))r=Xi(t,n);else{let n=Bi(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Dn(r)}function Qi(e,t){let n=Xe(e);return n===t||!W(n)||qe(n)?!1:Je(n).position===`fixed`||Qi(n,t)}function $i(e,t){let n=t.get(e);if(n)return n;let r=Qe(e,[],!1).filter(e=>W(e)&&H(e)!==`body`),i=null,a=Je(e).position===`fixed`,o=a?Xe(e):e;for(;W(o)&&!qe(o);){let t=Je(o),n=We(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Le(o)&&!n&&Qi(e,o))?r=r.filter(e=>e!==o):i=t,o=Xe(o)}return t.set(e,r),r}function ea(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ze(t)?[]:$i(t,this._c):[].concat(n),r],o=Zi(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=Zi(t,a[e],i);s=tn(n.top,s),c=en(n.right,c),l=en(n.bottom,l),u=tn(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ta(e){let{width:t,height:n}=Ii(e);return{width:t,height:n}}function na(e,t,n){let r=G(t),i=Pe(t),a=n===`fixed`,o=Hi(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=an(0);function l(){c.x=Ui(i)}if(r||!r&&!a)if((H(t)!==`body`||Le(i))&&(s=Ye(t)),r){let e=Hi(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Wi(i,s):an(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function ra(e){return Je(e).position===`static`}function ia(e,t){if(!G(e)||Je(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Pe(e)===n&&(n=n.ownerDocument.body),n}function aa(e,t){let n=U(e);if(ze(e))return n;if(!G(e)){let t=Xe(e);for(;t&&!qe(t);){if(W(t)&&!ra(t))return t;t=Xe(t)}return n}let r=ia(e,t);for(;r&&Re(r)&&ra(r);)r=ia(r,t);return r&&qe(r)&&ra(r)&&!We(r)?n:r||Ge(e)||n}var oa=async function(e){let t=this.getOffsetParent||aa,n=this.getDimensions,r=await n(e.floating);return{reference:na(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sa(e){return Je(e).direction===`rtl`}var ca={convertOffsetParentRelativeRectToViewportRelativeRect:Gi,getDocumentElement:Pe,getClippingRect:ea,getOffsetParent:aa,getElementRects:oa,getClientRects:Ki,getDimensions:ta,getScale:Ri,isElement:W,isRTL:sa};function la(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ua(e,t){let n=null,r,i=Pe(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=rn(d),h=rn(i.clientWidth-(u+f)),g=rn(i.clientHeight-(d+p)),_=rn(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:tn(0,en(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!la(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function da(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=Li(e),u=i||a?[...l?Qe(l):[],...t?Qe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ua(l,n):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?Hi(e):null;c&&g();function g(){let t=Hi(e);h&&!la(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 fa=Mi,pa=Ni,ma=Ei,ha=Fi,ga=ki,_a=Pi,va=(e,t,n)=>{let r=new Map,i={platform:ca,...n},a={...i.platform,_c:r};return Ti(e,t,{...i,platform:a})},ya=typeof document<`u`?j.useLayoutEffect:function(){};function ba(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ba(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ba(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function xa(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Sa(e,t){let n=xa(e);return Math.round(t*n)/n}function Ca(e){let t=j.useRef(e);return ya(()=>{t.current=e}),t}function wa(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=j.useState(r);ba(f,r)||p(r);let[m,h]=j.useState(null),[g,_]=j.useState(null),v=j.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=j.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=j.useRef(null),C=j.useRef(null),w=j.useRef(u),T=c!=null,E=Ca(c),D=Ca(i),O=Ca(l),k=j.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),va(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!ba(w.current,t)&&(w.current=t,P.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);ya(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=j.useRef(!1);ya(()=>(A.current=!0,()=>{A.current=!1}),[]),ya(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let M=j.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),N=j.useMemo(()=>({reference:b,floating:x}),[b,x]),F=j.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Sa(N.floating,u.x),r=Sa(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...xa(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return j.useMemo(()=>({...u,update:k,refs:M,elements:N,floatingStyles:F}),[u,k,M,N,F])}var Ta=(e,t)=>{let n=fa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ea=(e,t)=>{let n=pa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Da=(e,t)=>({fn:_a(e).fn,options:[e,t]}),Oa=(e,t)=>{let n=ma(e);return{name:n.name,fn:n.fn,options:[e,t]}},ka=(e,t)=>{let n=ha(e);return{name:n.name,fn:n.fn,options:[e,t]}},Aa=(e,t)=>{let n=ga(e);return{name:n.name,fn:n.fn,options:[e,t]}};function ja(e){let t=j.useRef(!0);t.current&&(t.current=!1,e())}var Q=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(B(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},Ma=br(19)?Fa:Ia;function Na(e,t,n,r,i){return Ma(e,t,n,r,i)}function Pa(e,t,n,r,i){let a=j.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,I.useSyncExternalStore)(e.subscribe,a,a)}re({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,I.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Fa(e,t,n,r,i){let a=ne();if(!a)return Pa(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function Ia(e,t,n,r,i){return(0,L.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var La=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Na(this,e,t,n,r)}},Ra=class extends La{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){j.useDebugValue(e);let n=this;z(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;z(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;z(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){j.useDebugValue(e);let n=this,r=t!==void 0;z(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return j.useDebugValue(e),Na(this,this.selectors[e],t,n,r)}useContextCallback(e,t){j.useDebugValue(e);let n=X(t??_t);this.context[e]=n}useStateSetter(e){let t=j.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},za={open:Q(e=>e.open),transitionStatus:Q(e=>e.transitionStatus),domReferenceElement:Q(e=>e.domReferenceElement),referenceElement:Q(e=>e.positionReference??e.referenceElement),floatingElement:Q(e=>e.floatingElement),floatingId:Q(e=>e.floatingId)},Ba=class extends Ra{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:ti(),nested:n,triggerElements:i},za),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&Me(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function Va(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=j.useRef(null);r===void 0&&f.current===null&&(f.current=new Ba({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),z(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};W(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function Ha(e,t=!1,n=!1){let[r,i]=j.useState(e&&t?`idle`:void 0),[a,o]=j.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),z(()=>{if(!e&&a&&r!==`ending`&&n){let e=Jt.request(()=>{i(`ending`)});return()=>{Jt.cancel(e)}}},[e,a,r,n]),z(()=>{if(!e||t)return;let n=Jt.request(()=>{i(void 0)});return()=>{Jt.cancel(n)}},[t,e]),z(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=Jt.request(()=>{i(`idle`)});return()=>{Jt.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var Ua=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),Wa={[Ua.startingStyle]:``},Ga={[Ua.endingStyle]:``},Ka={transitionStatus(e){return e===`starting`?Wa:e===`ending`?Ga:null}};function qa(e,t=!1,n=!0){let r=Yt();return X((i,a=null)=>{r.cancel();let o=oi(e);if(o==null)return;let s=o,c=()=>{P.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=Ua.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Ja(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=X(i),o=qa(r,n,!1);j.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var Ya={tabIndex:-1,[et]:``};function Xa(e){return t=>t===`touch`?e.current:!0}function Za(e,t,n=!1){let r=vr(),i=ii()!=null,a=j.useRef(null);e===void 0&&a.current===null&&(a.current=t(r,i));let o=e??a.current;return Va({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:o.setOpen}),{store:o,internalStore:a.current}}function Qa(e,t){let n=j.useRef(null),r=j.useRef(null);return j.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function $a(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let i=n?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=n??null)}function eo(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function to(e,t,n,r={}){let i=n.reason,a=i===bt,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=eo(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i={...r.extraState,open:t};o?i.instantType=`focus`:s?i.instantType=`dismiss`:a&&(i.instantType=void 0),$a(i,t,n.trigger,c()),e.update(i)};a?P.flushSync(l):l()}function no(e,t,n,r){ja(()=>{t===void 0&&e.state.open===!1&&n&&(e.state={...e.state,open:!0,activeTriggerId:r,preventUnmountingOnClose:!1})})}function ro(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Qa(e,n),o=X(t=>{if(a(t),!t)return;let i=n.select(`open`),o=n.select(`activeTriggerId`);if(o===e){n.update({activeTriggerElement:t,...i?r:null});return}o==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return z(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function io(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState(`open`);z(()=>{if(!r){e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,i={};e.state.triggerCount!==t&&(i.triggerCount=t);let a=e.select(`activeTriggerId`),o=null;if(a){let t=e.context.triggerElements.getById(a);t?t!==e.state.activeTriggerElement&&(i.activeTriggerElement=t):o=a}if(!o&&!a&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;i.activeTriggerId=e,i.activeTriggerElement=n}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),o&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===o&&!e.context.triggerElements.getById(o)){let t=J(vt);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,e.useState(`triggerCount`),n])}function ao(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Ha(e),o=t.useState(`preventUnmountingOnClose`),s=e?!1:o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=X(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Ja({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function oo(e,t){e.useSyncedValues(t),z(()=>()=>{e.update({activeTriggerProps:q,inactiveTriggerProps:q,popupProps:q})},[e])}function so(e,t){z(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),z(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var co=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function lo(){return new Ba({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new co,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function uo(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:lo(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:q,inactiveTriggerProps:q,popupProps:q}}function fo(e,t,n=!1){return new Ba({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var po=Q(e=>e.triggerIdProp??e.activeTriggerId),mo=Q(e=>e.openProp??e.open),ho=Q(e=>(e.popupElement?.id??e.floatingId)||void 0);function go(e,t){return t!==void 0&&mo(e)&&po(e)===t}function _o(e,t){return go(e,t)?!0:t!==void 0&&mo(e)&&po(e)==null&&e.triggerCount===1}var vo={open:mo,mounted:Q(e=>e.mounted),transitionStatus:Q(e=>e.transitionStatus),floatingRootContext:Q(e=>e.floatingRootContext),triggerCount:Q(e=>e.triggerCount),preventUnmountingOnClose:Q(e=>e.preventUnmountingOnClose),payload:Q(e=>e.payload),activeTriggerId:po,activeTriggerElement:Q(e=>e.mounted?e.activeTriggerElement:null),popupId:ho,isTriggerActive:Q((e,t)=>t!==void 0&&po(e)===t),isOpenedByTrigger:Q((e,t)=>go(e,t)),isMountedByTrigger:Q((e,t)=>t!==void 0&&po(e)===t&&e.mounted),triggerProps:Q((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:Q((e,t)=>_o(e,t)?ho(e):void 0),popupProps:Q(e=>e.popupProps),popupElement:Q(e=>e.popupElement),positionerElement:Q(e=>e.positionerElement)};function yo(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=vr(),a=ii()!=null,o=N(()=>new Ba({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new co,floatingId:i,syncOnly:!1,nested:a})).current;return z(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=W(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function bo(e={}){let{nodeId:t,externalTree:n}=e,r=yo(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=j.useState(null),[f,p]=j.useState(void 0),[m,h]=j.useState(void 0),g=j.useRef(null),_=ai(n),v=j.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),y=wa({...e,elements:{...v,...u&&{reference:u}}}),b=W(f)?f:null,x=m===void 0?i.state.floatingElement:m;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:b),i.useSyncedValue(`floatingElement`,x);let S=j.useCallback(e=>{let t=W(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),y.refs.setReference(t)},[y.refs]),C=j.useCallback(e=>{(W(e)||e===null)&&(g.current=e,p(e)),(W(y.refs.reference.current)||y.refs.reference.current===null||e!==null&&!W(e))&&y.refs.setReference(e)},[y.refs,p]),w=j.useCallback(e=>{h(e),y.refs.setFloating(e)},[y.refs]),T=j.useMemo(()=>({...y.refs,setReference:C,setFloating:w,setPositionReference:S,domReference:g}),[y.refs,C,w,S]),E=j.useMemo(()=>({...y.elements,domReference:s}),[y.elements,s]),D=j.useMemo(()=>({...y,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:T,elements:E,nodeId:t,rootStore:i}),[y,T,E,t,i,c,l]);return z(()=>{s&&(g.current=s)},[s]),z(()=>{i.context.dataRef.current.floatingContext=D;let e=_?.nodesRef.current.find(e=>e.id===t);e&&(e.context=D)}),j.useMemo(()=>({...y,context:D,refs:T,elements:E,rootStore:i}),[y,T,E,D,i])}var xo=Se&&we;function So(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=j.useRef(!1),c=j.useRef(null),l=j.useRef(!0),u=fe();j.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=U(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&G(e)&&e===nt(Z(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return Mt(Y(t,`blur`,r),xo&&Y(t,`keydown`,a,!0),xo&&Y(t,`pointerdown`,o,!0))},[i,n]),j.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);W(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=j.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=rt(t.nativeEvent);if(W(a)){if(xo&&!t.relatedTarget){if(!l.current&&!st(a))return}else if(!ut(a))return}let o=it(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,J(xt,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,J(xt,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=W(n)&&n.hasAttribute(er(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=nt(Z(e));!n&&t===e||K(o.current.floatingContext?.refs.floating.current,t)||K(e,t)||a||it(n??t,i.context.triggerElements)||i.setOpen(!1,J(xt,r))})}}},[o,r,i,u]);return j.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Co=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new de,this.restTimeout=new de,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},wo=new WeakMap;function To(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&wo.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),wo.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Eo(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=wo.get(n);a&&a!==e&&To(a),To(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,wo.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Do(e){let t=e.context.dataRef.current,n=N(()=>t.hoverInteractionState??Co.create()).current;return t.hoverInteractionState||=n,le(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Oo(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=ai(),d=ii(),f=Do(a),p=fe(),m=X(()=>ht(l.current.openEvent?.type,f.interactedInside)),h=X(()=>gt(l.current.openEvent?.type)),g=X(()=>{To(f)});z(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),j.useEffect(()=>g,[g]),z(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&W(c)&&s){let e=c,t=s,n=Z(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r;return Eo(f,{scopeElement:f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),j.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&Qn(u.nodesRef.current,d).length>0)}function t(e){let t=pt(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,J(bt,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=rt(e);if(!ct(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(it(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&W(o)&&Qn(u.nodesRef.current,r,!1).some(e=>K(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,J(bt,t)),u.events.emit(`floating.closed`,t)})}let y=s;return Mt(y&&Y(y,`mouseenter`,c),y&&Y(y,`mouseleave`,_),y&&Y(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var ko={current:null};function Ao(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=ko,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p}=t,m=`rootStore`in e?e.rootStore:e,{dataRef:h,events:g}=m.context,_=ai(l),v=Do(m),y=j.useRef(!1),b=zt(i),x=zt(r),S=zt(o),C=zt(n),w=zt(p),T=zt(f),E=X(()=>ht(h.current.openEvent?.type,v.interactedInside)),D=X(()=>w.current?.()!==!1),O=X((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!K(e,t);if(!W(n))return!1;let i=n;return r.hasMatchingElement(e=>K(e,i))&&(!e||!K(e,i))}),k=X(()=>{v.handler&&=(Z(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=X(()=>{To(v)});return u&&(v.handleCloseOptions=b.current?.__options),j.useEffect(()=>k,[k]),j.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===bt,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),j.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=pt(x.current,`close`,v.pointerType);n?v.openChangeTimeout.start(n,()=>{m.setOpen(!1,J(bt,e)),_?.events.emit(`floating.closed`,e)}):t&&(v.openChangeTimeout.clear(),m.setOpen(!1,J(bt,e)),_?.events.emit(`floating.closed`,e))}let t=c.current??(u?m.select(`domReferenceElement`):null);if(!W(t))return;function r(e){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!je(v.pointerType))return;let t=mt(S.current),n=pt(x.current,`open`,v.pointerType),r=rt(e),i=e.currentTarget??null,o=m.select(`domReferenceElement`),s=i;if(W(r)&&!m.context.triggerElements.hasElement(r)){for(let e of m.context.triggerElements.elements())if(K(e,r)){s=e;break}}W(i)&&W(o)&&!m.context.triggerElements.hasElement(i)&&K(i,o)&&(s=o);let c=s==null?!1:O(o,s,r),l=m.select(`open`),u=T.current?.()??m.select(`transitionStatus`)===`ending`,d=!l&&u&&y.current,f=!c&&W(s)&&W(o)&&K(o,s)&&d,p=t>0&&!n,h=c&&(l||d)||f,g=!l||c;if(h){D()&&m.setOpen(!0,J(bt,e,s));return}p||(n?v.openChangeTimeout.start(n,()=>{g&&D()&&m.setOpen(!0,J(bt,e,s))}):g&&D()&&m.setOpen(!0,J(bt,e,s)))}function i(t){if(E()){A();return}k();let n=Z(m.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let r=h.current.floatingContext??d?.();if(!it(t.relatedTarget,m.context.triggerElements)){if(b.current&&r){m.select(`open`)||v.openChangeTimeout.clear();let i=c.current;v.handler=b.current({...r,tree:_,x:t.clientX,y:t.clientY,onClose(){A(),k(),C.current&&!E()&&i===m.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,v.handler),v.handler(t);return}(v.pointerType!==`touch`||!K(m.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?Mt(Y(t,`mousemove`,r,{once:!0}),Y(t,`mouseenter`,r),Y(t,`mouseleave`,i)):Mt(Y(t,`mouseenter`,r),Y(t,`mouseleave`,i))},[k,A,h,x,m,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D]),j.useMemo(()=>{if(!n)return;function e(e){v.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=m.select(`domReferenceElement`),i=m.select(`open`),o=O(r,n,e.target);if(a&&!je(v.pointerType))return;if(i&&o&&v.handleCloseOptions?.blockPointerEvents){let e=m.select(`floatingElement`);e&&Eo(v,{scopeElement:v.handleCloseOptions?.getScope?.()??n.ownerDocument.body,referenceElement:n,floatingElement:e})}let s=mt(S.current);if(i&&!o||s===0||!o&&v.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;v.restTimeout.clear();function c(){if(v.restTimeoutPending=!1,E())return;let e=m.select(`open`);!v.blockMouseMove&&(!e||o)&&D()&&m.setOpen(!0,J(bt,t,n))}v.pointerType===`touch`?P.flushSync(()=>{c()}):o&&i?c():(v.restTimeoutPending=!0,v.restTimeout.start(s,c))}}},[n,v,E,O,a,m,S,D])}var jo=.1,Mo=jo*jo,$=.5;function No(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Po(e,t,n,r,i,a,o,s,c,l){let u=!1;return No(e,t,n,r,i,a)&&(u=!u),No(e,t,i,a,o,s)&&(u=!u),No(e,t,o,s,c,l)&&(u=!u),No(e,t,c,l,n,r)&&(u=!u),u}function Fo(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Io(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Lo(e={}){let{blockPointerEvents:t=!1}=e,n=new de,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Mo;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=rt(r),g=r.type===`mouseleave`,_=K(u,h),v=K(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&W(r.relatedTarget)&&K(u,r.relatedTarget))return;function y(){return!!(s&&Qn(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Io(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Io(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Io(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Io(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!Fo(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+$+1,o=C||T?S.bottom-$:S.top,s=C?T?S.bottom-$:S.top:S.bottom-$;M=Po(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-$,o=C||T?S.top+$:S.bottom,s=C?T?S.top+$:S.bottom:S.top+$;M=Po(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+$+1,o=w||E?S.right-$:S.left,s=w?E?S.right-$:S.left:S.right-$;M=Po(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-$,o=w||E?S.left+$:S.right,s=w?E?S.left+$:S.right:S.left+$;M=Po(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var Ro={...vo,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeOnClick:Q(e=>e.closeOnClick),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},zo=class e extends Ra{constructor(e,t,n=!1){let r=new co,i={...Bo(),...e};i.floatingRootContext=fo(r,t,n),super(i,{popupRef:j.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},Ro)}setOpen=(e,t)=>{to(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,J(yt,e))}static useStore(t,n){return Za(t,(t,r)=>new e(n,t,r)).store}};function Bo(){return{...uo(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var Vo=ie(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=zo.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});no(p,r,n,d),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),p.useSyncedValue(`disabled`,t),io(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=ao(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=j.useRef(null);z(()=>{m&&t&&p.setOpen(!1,J(Et))},[m,t,p]),z(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),z(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let T=j.useCallback(()=>{p.setOpen(!1,J(Dt))},[p]);j.useImperativeHandle(o,()=>({unmount:y,close:T}),[y,T]);let E=h||_||!t&&a!==`none`;return(0,F.jsxs)(V.Provider,{value:p,children:[E&&(0,F.jsx)(Ho,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function Ho({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=xi(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=vi(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n});return oo(e,{activeTriggerProps:j.useMemo(()=>Dr(a.reference,i.reference),[a.reference,i.reference]),inactiveTriggerProps:j.useMemo(()=>Dr(a.trigger,i.trigger),[a.trigger,i.trigger]),popupProps:j.useMemo(()=>Dr(Ya,a.floating,i.floating),[a.floating,i.floating])}),null}var Uo=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Ua.startingStyle]=`startingStyle`,e[e.endingStyle=Ua.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),Wo=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Go={[Wo.popupOpen]:``};Wo.popupOpen,Wo.pressed;var Ko={[Uo.open]:``},qo={[Uo.closed]:``},Jo={[Uo.anchorHidden]:``},Yo={open(e){return e?Go:null}},Xo={open(e){return e?Ko:qo},anchorHidden(e){return e?Jo:null}};function Zo(e){return vr(e,`base-ui`)}var Qo=j.createContext(void 0);function $o(){return j.useContext(Qo)}var es=function(e){return e[e.popupOpen=Wo.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),ts=`data-base-ui-tooltip-trigger`;function ns(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(W(n))return n}}let t=e.target;return W(t)?t:null}function rs(e){let t=e;for(;t;){if(t.hasAttribute(ts))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&W(n.host)?n.host:null}return null}var is=R(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=se(!0),m=a?.store??p;if(!m)throw Error(B(82));let h=Zo(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=j.useRef(null),b=c??600,x=u??0,{registerTrigger:S,isMountedByThisTrigger:C}=ro(h,y,m,{payload:o,closeOnClick:l,closeDelay:x}),w=$o(),{delayRef:T,isInstantPhase:E,hasProvider:D}=jt(v,{open:_}),O=Do(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,M=zt(A),N=m.useState(`trackCursorAxis`),P=m.useState(`disableHoverablePopup`),F=j.useRef(!1),I=fe(),L=j.useRef(void 0);function ee(){let e=w?.delay,t=typeof T.current==`object`?T.current.open:void 0,n=b;return D&&(n=t===0?0:c??e??b),n}function te(e){let t=y.current;if(!t||!e)return!1;let n=rs(e);return n!==null&&n!==t&&K(t,n)}function ne(e){let t=te(e);return F.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,I.clear()),t}let re=Ao(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!P&&N!==`both`?Lo():null,restMs:ee,delay(){let e=typeof T.current==`object`?T.current.close:void 0,t=x;return u==null&&D&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!F.current}}),ie=So(v,{enabled:!A}).reference,R=e=>{let t=F.current,n=ns(e),r=ne(n),i=y.current,a=i&&n&&K(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,J(bt,e));return}if(t&&!r&&a&&!M.current&&!m.select(`open`)&&i&&je(L.current)){let t=()=>{!F.current&&!M.current&&!m.select(`open`)&&m.setOpen(!0,J(bt,e,i))},n=ee();n===0?(I.clear(),t()):I.start(n,t)}},ae=m.useState(`triggerProps`,C);return Vr(`button`,e,{state:{open:_},ref:[t,S,y],props:[re,ie,C||N!==`none`?ae:void 0,{onMouseOver(e){R(e.nativeEvent)},onFocus(e){te(ns(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){F.current=!1,I.clear(),L.current=void 0},onPointerEnter(e){L.current=e.pointerType},onPointerDown(e){L.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[es.triggerDisabled]:A?``:void 0,[ts]:A?void 0:``},f],stateAttributesMapping:Yo})}),as=j.createContext(void 0);function os(){let e=j.useContext(as);if(e===void 0)throw Error(B(70));return e}var ss=j.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=$r({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,F.jsxs)(j.Fragment,{children:[l,c&&P.createPortal(n,c)]})}),cs=j.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return se().useState(`mounted`)||n?(0,F.jsx)(as.Provider,{value:n,children:(0,F.jsx)(ss,{ref:t,...r})}):null}),ls=j.createContext(void 0);function us(){let e=j.useContext(ls);if(e===void 0)throw Error(B(71));return e}var ds=j.createContext(void 0);function fs(){return j.useContext(ds)?.direction??`ltr`}var ps=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,offsetParent:d=`real`}=cn(e,t)||{};if(l==null)return{};let f=En(u),p={x:n,y:r},m=mn(i),h=fn(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=sn(k,j,A),N=!c.arrow&&un(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),ms=(e,t)=>({...ps(e),options:[e,t]}),hs=Aa().fn,gs={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await hs(e)).data?.referenceHidden||a}}}},_s={sideX:`left`,sideY:`top`},vs={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=U(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:_s};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Z(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=ln(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:_s.sideX,g=f===`top`?`bottom`:_s.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function ys(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function bs(e,t,n){let{rects:r,placement:i}=e;return{side:ys(t,ln(i),n),align:un(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function xs(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,inline:f,keepMounted:p=!1,floatingRootContext:m,mounted:h,collisionAvoidance:g,shiftCrossAxis:_=!1,nodeId:v,adaptiveOrigin:y,lazyFlip:b=!1,externalTree:x}=e,[S,C]=j.useState(null);!h&&S!==null&&C(null);let w=g.side||`flip`,T=g.align||`flip`,E=g.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=X(D),k=D?O:t,A=zt(t),M=zt(h),N=fs()===`rtl`,P=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),ee=+(r===`top`),te=+(r===`right`),ne=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+ne,bottom:I+ee,left:I+te}:I&&={top:(I.top||0)+L,right:(I.right||0)+ne,bottom:(I.bottom||0)+ee,left:(I.left||0)+te};let re={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},ie=j.useRef(null),R=zt(i),ae=zt(o),oe=typeof i==`function`?0:i,B=typeof o==`function`?0:o,V=[];f&&V.push(f),V.push(Ta(e=>{let t=bs(e,r,N),n=typeof R.current==`function`?R.current(t):R.current,i=typeof ae.current==`function`?ae.current(t):ae.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[oe,B,N,r]));let se=T===`none`&&w!==`shift`,ce=!se&&(l||_||w===`shift`),le=w===`none`?null:Oa({...re,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!_&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),ue=se?null:Ea(e=>{let t=Z(e.elements.floating).documentElement;return{...re,rootBoundary:_?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:ce,limiter:l||_?void 0:Da(e=>{if(!ie.current)return{};let{width:t,height:n}=ie.current.getBoundingClientRect(),r=pn(ln(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[re,l,_,I,T]);w===`shift`||T===`shift`||a===`center`?V.push(ue,le):V.push(le,ue),V.push(ka({...re,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=U(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),ms(e=>({element:ie.current||Z(e.elements.floating).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=ln(a),l=pn(c),u=ie.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(bs(e,r,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ce&&l===`y`&&b?S:x),{}}},gs,y),z(()=>{!h&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,m]);let de=j.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:fe,elements:pe,x:me,y:he,middlewareData:ge,update:_e,placement:ve,context:ye,isPositioned:be,floatingStyles:xe}=bo({rootContext:m,open:p?h:void 0,placement:F,middleware:V,strategy:n,whileElementsMounted:p?void 0:(...e)=>da(...e,de),nodeId:v,externalTree:x}),{sideX:Se,sideY:Ce}=ge.adaptiveOrigin||_s,we=be?n:`fixed`,Te=j.useMemo(()=>{let e=y?{position:we,[Se]:me,[Ce]:he}:{position:we,...xe};return be||(e.opacity=0),e},[y,we,Se,me,Ce,he,xe,be]),Ee=j.useRef(null);z(()=>{if(!h)return;let e=A.current,t=typeof e==`function`?e():e,n=(Ss(t)?t.current:t)||null;n!==Ee.current&&(fe.setPositionReference(n),Ee.current=n)},[h,fe,k,A]),j.useEffect(()=>{if(!h)return;let e=A.current;typeof e!=`function`&&Ss(e)&&e.current!==Ee.current&&(fe.setPositionReference(e.current),Ee.current=e.current)},[h,fe,k,A]),j.useEffect(()=>{if(p&&h&&pe.reference&&pe.floating)return da(pe.reference,pe.floating,_e,de)},[p,h,pe,_e,de]);let De=ln(ve),Oe=ys(r,De,N),ke=un(ve)||`center`,Ae=!!ge.hide?.referenceHidden;z(()=>{b&&h&&be&&C(De)},[b,h,be,De]);let je=j.useMemo(()=>({position:`absolute`,top:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),Me=ge.arrow?.centerOffset!==0;return j.useMemo(()=>({positionerStyles:Te,arrowStyles:je,arrowRef:ie,arrowUncentered:Me,side:Oe,align:ke,physicalSide:De,anchorHidden:Ae,refs:fe,context:ye,isPositioned:be,update:_e}),[Te,je,ie,Me,Oe,ke,De,Ae,fe,ye,be,_e])}function Ss(e){return e!=null&&`current`in e}function Cs(e){return e===`starting`?qr:q}function ws(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Vr(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Cs(r),i],stateAttributesMapping:Xo})}var Ts=j.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Jr,style:g,..._}=e,v=se(),y=os(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=xs({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?vs:void 0}),O=ws(e,j.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,F.jsx)(ls.Provider,{value:D,children:O})}),Es={...Xo,...Ka},Ds=j.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=se(),{side:s,align:c}=us(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);Ja({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Oo(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Vr(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[f,Cs(d),a],stateAttributesMapping:Es})});function Os(e){return br(19)?e:e?`true`:void 0}var ks=C({method:`GET`}).handler(E(`aa46310016bb8a58b273a648ffd498c87f1f450d12827e30110a3b83ba6a27d9`)),As=C({method:`POST`}).handler(E(`ed679b4e1e05e903a5d4ba4a70d9b9d883991ab22ed59b4d2d69078941818415`)),js=C({method:`GET`}).handler(E(`169566e7637a22599b4eb32ee3775574e99677406922bbef7482a102036c33dd`)),Ms=C({method:`POST`}).handler(E(`27d7eba0b6a2257949392fdd56057275a5c5366484ae01faf3b5897a225ecd83`)),Ns=C({method:`POST`}).handler(E(`a6384dc7154d9930422d29396f5de64b3ac69c62ad3824bc4a22d745fc07b293`));function Ps(e,t){let n=new Set,r=[];for(let i of[...e,...t])n.has(i.id)||(n.add(i.id),r.push(i));return r.sort((e,t)=>e.ts<t.ts?-1:+(e.ts>t.ts)),r}function Fs({schedule:t,machine:n,workdir:r,model:i,reasoningEffort:a}){return(0,F.jsxs)(`div`,{className:`min-w-0 text-right text-meta text-secondary`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-x-2.5 gap-y-1`,children:[(0,F.jsx)(`span`,{title:t.mode===`cron`?t.cron:void 0,children:e(t)}),(0,F.jsx)(`span`,{className:`text-wire`,children:`·`}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:`${n.name||`machine`} · ${n.presence}`,children:[(0,F.jsx)(`span`,{className:`size-1.5 rounded-full ${n.presence===`online`?`bg-rubik-green`:n.presence===`asleep`?`bg-rubik-yellow`:`bg-disabled`}`,"aria-hidden":`true`}),n.name||`machine`,(0,F.jsxs)(`span`,{className:`sr-only`,children:[`(`,n.presence,`)`]})]})]}),(0,F.jsxs)(`div`,{className:`mt-1 truncate`,title:r,children:[r,` · Model: `,i||`default`,` · Reasoning: `,a||`default`]})]})}var Is=16,Ls=`rounded-[4px]`,Rs=`h-5 w-[18px] shrink-0 ${Ls}`;function zs({run:e,onClick:t}){let n=e.error||e.message||``,r=e.durationMs?` · ${c(e.durationMs)}`:``;return(0,F.jsxs)(Vo,{children:[(0,F.jsx)(is,{render:(0,F.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},"aria-label":y(e),className:`${Rs} cursor-pointer transition-opacity hover:opacity-70`,style:{background:o(e),opacity:S(e),...e.phase===`running`?u:{}}})}),(0,F.jsx)(cs,{children:(0,F.jsx)(Ts,{sideOffset:8,children:(0,F.jsxs)(Ds,{className:`glass-strong pointer-events-none max-w-[340px] rounded-control px-3.5 py-2.5 text-meta leading-snug text-primary`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,F.jsx)(`span`,{className:`size-2 shrink-0 rounded-[2px]`,style:{background:o(e)}}),y(e),(0,F.jsxs)(`span`,{className:`ml-auto whitespace-nowrap pl-3 font-mono text-caption font-normal text-secondary`,children:[x(e.ts),r]})]}),n&&(0,F.jsx)(`div`,{className:`mt-1.5 max-h-[150px] overflow-hidden whitespace-pre-wrap ${e.error?`text-accent`:`text-secondary`}`,children:n})]})})})]})}function Bs({count:e,onClick:t,loading:n}){return e?(0,F.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},className:`flex h-5 w-[18px] shrink-0 items-center justify-center overflow-hidden border border-wire px-0 font-mono text-[9px] leading-none text-disabled transition-colors hover:border-display hover:text-primary ${Ls} ${n?`animate-pulse`:`cursor-pointer`}`,title:`${e} more - click to reveal`,children:n?`…`:e}):null}function Vs({loop:e,runs:t,total:r,onLoadMore:i,onPickRun:a}){let o=t,s=e.enabled,c=o.length,l=Math.max(0,r-c),u=d(),[f,p]=(0,j.useState)(-1),[m,h]=(0,j.useState)(!1),g=Math.max(0,c-16),_=f<0?g:Math.min(f,g),v=Math.min(_+16,c),y=o.slice(_,v),b=l+_,S=c-v,C=S===0,w=async()=>{let e=_-Is;if(e<0&&l>0&&!m){h(!0);let e=await i().catch(()=>0);h(!1),p(Math.max(0,_+e-Is));return}p(Math.max(0,e))},T=()=>{let e=_+Is;p(e>=g?-1:e)},E=!!(e.running||e.queued)&&C,D=C&&s&&!!e.nextRun&&!E;return(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[3px] overflow-x-auto`,children:[(0,F.jsx)(Bs,{count:b,onClick:w,loading:m}),y.map(e=>(0,F.jsx)(zs,{run:e,onClick:()=>a(e)},e.id)),D?(0,F.jsxs)(`div`,{className:`ml-1 flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`w-12 border-t border-dashed border-wire`}),(0,F.jsx)(`span`,{className:`size-[11px] shrink-0 rounded-full border border-wire`,title:u?`Next scheduled run · ${x(e.nextRun)}`:void 0}),(0,F.jsx)(`span`,{className:`text-caption text-disabled`,children:u?n(e.nextRun):``})]}):!C&&(0,F.jsx)(Bs,{count:S,onClick:T})]})}var Hs={"claude-code":`Claude Code`,codex:`Codex`},Us=`rounded-sm text-left text-[17px] font-semibold tracking-[-0.01em] text-display outline-none`;function Ws({usage:e}){return(0,F.jsxs)(`span`,{className:`ml-auto whitespace-nowrap`,children:[`Last 7 days · `,i(e.tokenCount),` tokens · `,e.runCount,` runs`]})}function Gs({loop:e,runs:t,onLoadMore:n,onPickRun:r,onOpen:i,extraPill:o}){let s=b({...e,runs:t}),c=k(e),l=d(),u=t.at(-1),f=u?.reportIncident?u:void 0;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[i?(0,F.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i()},className:`${Us} cursor-pointer focus-visible:ring-2 focus-visible:ring-interactive focus-visible:ring-offset-4 focus-visible:ring-offset-surface`,children:e.name}):(0,F.jsx)(`h1`,{className:Us,children:e.name}),(0,F.jsx)(h,{tone:c.tone,children:c.label}),(0,F.jsx)(h,{tone:`outline`,children:Hs[e.agent]}),o,(0,F.jsx)(`div`,{className:`ml-auto min-w-0`,children:(0,F.jsx)(Fs,{schedule:e.schedule,machine:e.machine,workdir:e.workdir,model:e.model,reasoningEffort:e.reasoningEffort})})]}),(0,F.jsx)(Vs,{loop:e,runs:t,total:e.runCount,onLoadMore:n,onPickRun:r}),(0,F.jsxs)(`div`,{className:`mt-[18px] flex items-center gap-2 text-meta text-secondary`,children:[(0,F.jsxs)(`span`,{children:[e.runCount,` runs`]}),s&&(0,F.jsxs)(`span`,{children:[`· last `,y(s),l&&` · ${a(s.ts)}`]}),(0,F.jsx)(Ws,{usage:e.recentUsage})]}),f?.reportIncident&&(0,F.jsx)(`div`,{className:`mt-1.5 text-meta text-secondary`,children:f.phase===`error`?`Last run failed · Terminal report rejected`:`Last run telemetry warning · Terminal report rejected`})]})}var Ks=j.createContext(!1),qs=j.createContext(void 0);function Js(e){let t=j.useContext(qs);if(e===!1&&t===void 0)throw Error(B(27));return t}var Ys={...Xo,...Ka},Xs=j.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Js(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Vr(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Ys,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Zs=j.createContext(void 0);function Qs(e=!1){let t=j.useContext(Zs);if(t===void 0&&!e)throw Error(B(16));return t}function $s(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:j.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function ec(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=j.useRef(null),s=Qs(!0),c=a??s!==void 0,{props:l}=$s({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=j.useCallback(()=>{let e=o.current;tc(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return z(u,[u]),{getButtonProps:j.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return Dr({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(Rr(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=tc(a),l=!i&&nc(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(Rr(e),a?.(e),e.target===e.currentTarget&&i&&c&&tc(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:X(e=>{o.current=e,u()})}}function tc(e){return G(e)&&e.tagName===`BUTTON`}function nc(e){return!!(e?.tagName===`A`&&e?.href)}var rc=j.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{store:c}=Js(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=ec({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,J(Ct,e.nativeEvent))}return Vr(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),ic=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),ac=function(e){return e[e.open=Uo.open]=`open`,e[e.closed=Uo.closed]=`closed`,e[e.startingStyle=Uo.startingStyle]=`startingStyle`,e[e.endingStyle=Uo.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),oc=j.createContext(void 0);function sc(){let e=j.useContext(oc);if(e===void 0)throw Error(B(26));return e}var cc=`ArrowUp`,lc=`ArrowDown`,uc=`ArrowLeft`,dc=`ArrowRight`,fc=`Home`,pc=new Set([uc,dc]),mc=new Set([cc,lc]),hc=new Set([...pc,...mc]),gc=new Set([...hc,fc,`End`]),_c={...Xo,...Ka,nestedDialogOpen(e){return e?{[ac.nestedDialogOpen]:``}:null}},vc=j.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,{store:c}=Js(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`),C=s.id??S;sc(),Ja({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let w=o===void 0?Xa(c.context.popupRef):o,T=g>0,E=c.useStateSetter(`popupElement`),D=Vr(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:T},props:[f,{id:C,"aria-labelledby":y??void 0,"aria-describedby":l??void 0,role:x,...Ya,hidden:!m,onKeyDown(e){gc.has(e.key)&&e.stopPropagation()},style:{[ic.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,E],stateAttributesMapping:_c});return(0,F.jsx)(hi,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:D})}),yc=j.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,F.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),bc=j.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Js(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,F.jsx)(oc.Provider,{value:n,children:(0,F.jsxs)(ei,{ref:t,...r,children:[a&&o===!0&&(0,F.jsx)(yc,{ref:i.context.internalBackdropRef,inert:Os(!s)}),e.children]})}):null}),xc={},Sc={},Cc=``;function wc(e){if(typeof document>`u`)return!1;let t=Z(e);return U(t).innerWidth-t.documentElement.clientWidth>0}function Tc(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Z(e),n=t.documentElement,r=t.body,i=Le(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Ec(e){let t=Z(e),n=t.documentElement,r=t.body,i=Le(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Dc(e){let t=Z(e),n=t.documentElement,r=t.body,i=U(n),a=0,o=0,s=!1,c=Jt.create();if(we&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,xc={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Cc=n.style.scrollBehavior,Sc={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Le(n)?n:r;if(s=Tc(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,xc),Object.assign(r.style,Sc),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Cc)}function d(){u(),c.request(l)}l();let f=Y(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Oc=new class{lockCount=0;restore=null;timeoutLock=de.create();timeoutUnlock=de.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Z(e).documentElement,n=U(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=_t;return}let r=ye||!wc(e);this.restore=r?Ec(e):Dc(e)}};function kc(e=!0,t=null){z(()=>{if(e)return Oc.acquire(t)},[e,t])}function Ac(e){let{store:t,actionsRef:n}=e,r=t.useState(`open`);so(t,r),io(t);let{forceUnmount:i}=ao(r,t),a=j.useCallback(()=>{t.setOpen(!1,J(Dt))},[t]);j.useImperativeHandle(n,()=>({unmount:i,close:a}),[i,a])}function jc({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=j.useState(0),[u,d]=j.useState(0),f=c===0,p=xi(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0||`touches`in t&&t.touches.length!==1)return!1;let n=rt(t);return f&&!i?a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===n||e.context.backdropRef.current===n||K(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0:!1},escapeKey:f});return kc(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),e.useContextCallback(`onNestedDialogClose`,()=>{l(0),d(0)}),j.useEffect(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(c+1,u+ +!!n),t?.onNestedDialogClose&&!r&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&r&&t.onNestedDialogClose()}),[n,r,c,u,t]),oo(e,{activeTriggerProps:p.reference??q,inactiveTriggerProps:p.trigger??q,popupProps:p.floating??q,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Mc={...vo,modal:Q(e=>e.modal),nested:Q(e=>e.nested),nestedOpenDialogCount:Q(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Q(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Q(e=>e.disablePointerDismissal),openMethod:Q(e=>e.openMethod),descriptionElementId:Q(e=>e.descriptionElementId),titleElementId:Q(e=>e.titleElementId),viewportElement:Q(e=>e.viewportElement),role:Q(e=>e.role)},Nc=class e extends Ra{constructor(e,t,n=!1){let r=new co,i=Pc(e);i.floatingRootContext=fo(r,t,n),super(i,{popupRef:j.createRef(),backdropRef:j.createRef(),internalBackdropRef:j.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:r,onOpenChange:void 0,onOpenChangeComplete:void 0},Mc)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};$a(n,e,t.trigger),this.update(n)};static useStore(t,n){return Za(t,(t,r)=>new e(n,t,r),!0).store}};function Pc(e={}){return{...uo(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function Fc(e,t=`dialog`){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=e,p=t===`drawer`,m=t===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=Js(!0),y={modal:h,disablePointerDismissal:g,nested:!!v,role:_},b=Nc.useStore(u?.store,{open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y});ja(()=>{let e=r===void 0&&b.state.open===!1&&i===!0?{open:!0,activeTriggerId:f}:null;m?b.update(e?{...y,...e}:y):e&&b.update(e)}),b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);Ac({store:b,actionsRef:l});let w=x||S,T=j.useMemo(()=>({store:b}),[b]);return(0,F.jsx)(Ks.Provider,{value:!1,children:(0,F.jsxs)(qs.Provider,{value:T,children:[w&&(0,F.jsx)(jc,{store:b,parentContext:v?.store.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})})}function Ic(e){return Fc(e,j.useContext(Ks)?`drawer`:`dialog`)}var Lc=j.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Js(),c=Zo(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Vr(`h2`,e,{ref:t,props:[{id:c},o]})});function Rc({open:e,onClose:t,children:n,wide:r=!1}){let i=`-translate-y-1/2 max-h-[calc(100dvh-4rem)] ${r?`top-1/2 max-w-[62rem]`:`top-[46%] max-w-160`}`;return(0,F.jsx)(Ic,{open:e,onOpenChange:e=>!e&&t(),children:(0,F.jsxs)(bc,{children:[(0,F.jsx)(Xs,{className:`fixed inset-0 z-[900] bg-black/25 backdrop-blur-[8px] transition-opacity duration-200 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:bg-black/45`}),(0,F.jsx)(vc,{className:`glass-strong fixed left-1/2 z-[901] w-full -translate-x-1/2 overflow-auto rounded-sheet px-[26px] pb-7 pt-6 outline-none transition-opacity duration-200 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 ${i}`,children:n})]})})}function zc({title:e,sub:t}){return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,F.jsx)(Lc,{className:`text-[20px] font-semibold tracking-[-0.015em] text-display`,children:e}),(0,F.jsx)(rc,{"aria-label":`Close`,className:`-mr-1 shrink-0 cursor-pointer rounded-full border-none bg-transparent px-1.5 py-0.5 text-[15px] leading-none text-disabled transition-colors hover:text-display focus-visible:text-display focus-visible:outline-none`,children:`✕`})]}),t!=null&&(0,F.jsx)(`div`,{className:`mt-1.5 text-meta text-secondary`,children:t})]})}function Bc({children:e,action:t}){return(0,F.jsxs)(`div`,{className:`mb-2.5 mt-6 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:[(0,F.jsx)(`h2`,{className:p,children:e}),t]})}function Vc(e,t,n=Date.now()){let r=t?Date.parse(t):NaN;if(!Number.isFinite(r))return`offline`;let i=n-r;return e&&i<3e4?`online`:i<216e5?`asleep`:`offline`}function Hc(e){let t=/^\s*v?(\d+)\.(\d+)\.(\d+)/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function Uc(e){return/^\s*v?\d+\.\d+\.\d+-/.test(e)}function Wc(e,t){if(!e||!t)return!1;let n=Hc(e),r=Hc(t);if(!n||!r)return!1;for(let e=0;e<3;e++){let t=n[e],i=r[e];if(t<i)return!0;if(t>i)return!1}return Uc(e)&&!Uc(t)}function Gc(e,t,n,r){let i=`${n} daemon start --server-url ${e} --connect-key ${t}`;return r?i:`npm install -g @kky42/pievo@latest && ${i}`}function Kc(e,t){let n=`${e} daemon restart`;return t?n:`npm install -g @kky42/pievo@latest && ${n}`}function qc(e,t,n){return Gc(typeof window<`u`?window.location.origin:`http://127.0.0.1:3000`,e,t,n)}function Jc({text:e}){let[t,n]=(0,j.useState)(!1);return(0,F.jsx)(`button`,{className:s,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1400)},children:t?`Copied ✓`:`Copy`})}function Yc({open:e,onClose:t,teamId:n}){let[r,i]=(0,j.useState)([]),[o,c]=(0,j.useState)(null),[u,d]=(0,j.useState)(null),[f,p]=(0,j.useState)(``),[h,y]=(0,j.useState)(!1),[b,x]=(0,j.useState)(null),[S,C]=(0,j.useState)(null),[w,T]=(0,j.useState)(!1);(0,j.useEffect)(()=>{if(!e){x(null);return}let t=!0;return C(null),T(!1),O().then(e=>{t&&C(e)}).catch(()=>{t&&T(!0)}),()=>{t=!1}},[e]);let E=(0,j.useCallback)(async()=>{try{i(await ks({data:n}))}catch{}},[n]),D=(0,j.useRef)(e);D.current=e,(0,j.useEffect)(()=>{if(!e||o)return;E();let t=setInterval(()=>D.current&&void E(),3e3);return()=>clearInterval(t)},[e,o,E]),(0,j.useEffect)(()=>{if(!o)return;let e=!0,t=async()=>{let t=await js({data:o.id}).catch(()=>void 0);!e||t===void 0||(d(t),t?.online&&t.hostname&&p(e=>e||t.hostname||``))};t();let n=setInterval(t,2e3);return()=>{e=!1,clearInterval(n)}},[o]);async function k(){y(!0),x(null);try{let e=await As({data:n});if(`error`in e){x(e.error);return}d(null),p(``),c(e)}finally{y(!1)}}async function M(){o&&await Ns({data:o.id}),c(null),d(null),await E()}async function N(){o&&f.trim()&&await Ms({data:{id:o.id,name:f.trim()}}),c(null),d(null),await E()}async function P(e){x(null);let t=await Ns({data:e});if(!t.ok){x(t.error??`Could not delete this machine.`),await E();return}await E()}let I=!!u?.online;return o?(0,F.jsxs)(Rc,{open:e,onClose:M,children:[(0,F.jsx)(zc,{title:I?`Computer connected`:`Connect computer`}),I?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`mt-5 flex items-center gap-3 rounded-control border border-hairline bg-success-soft px-4 py-3`,children:[(0,F.jsx)(`span`,{className:`text-xl text-success`,children:`✓`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[15px] font-medium text-display`,children:`Computer connected successfully!`}),(0,F.jsxs)(`div`,{className:`text-label text-secondary`,children:[u?.hostname??`unknown`,u?.platform?` - ${u.platform} ${u.arch??``}`:``]})]})]}),(0,F.jsxs)(`div`,{className:`mt-5`,children:[(0,F.jsx)(`label`,{className:l,children:`Computer name`}),(0,F.jsx)(`input`,{className:v,value:f,onChange:e=>p(e.target.value),placeholder:u?.hostname??`My computer`}),(0,F.jsx)(`div`,{className:`mt-1 text-label text-secondary`,children:`A friendly name for this computer.`})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`mt-5 text-body font-medium text-display`,children:`Run this command on your computer to connect:`}),S?(0,F.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,F.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-4 font-mono text-label leading-relaxed text-paper`,children:qc(o.token,S.pievoCli,S.customCli)}),(0,F.jsx)(Jc,{text:qc(o.token,S.pievoCli,S.customCli)})]}):(0,F.jsx)(`div`,{className:`mt-2 text-body text-secondary`,children:w?`Could not load the connection command. Close and try again.`:`Loading connection command…`}),(0,F.jsxs)(`div`,{className:`mt-4 flex items-center gap-2.5 rounded-control border border-hairline bg-warn-soft px-4 py-3`,children:[(0,F.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 animate-pulse rounded-full bg-rubik-orange`}),(0,F.jsx)(`span`,{className:`text-[14px] font-medium text-warn`,children:`Waiting for computer to connect…`})]})]}),(0,F.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{className:s,onClick:()=>void M(),children:`Cancel`}),(0,F.jsx)(`button`,{className:g,disabled:!I||!f.trim(),onClick:()=>void N(),children:`Done`})]})]}):(0,F.jsxs)(Rc,{open:e,onClose:t,children:[(0,F.jsx)(zc,{title:`Machines`,sub:`Each machine runs a pievo daemon that executes your loops via your local coding agent.`}),(0,F.jsx)(Bc,{children:`Connected machines`}),b&&(0,F.jsx)(_,{message:b,onDismiss:()=>x(null)}),r.length===0&&(0,F.jsx)(`div`,{className:`py-3 text-body text-secondary`,children:`No machines yet.`}),(0,F.jsx)(`ul`,{className:`flex flex-col gap-2`,children:r.map(e=>{let t=Vc(e.online,e.lastSeen),n=t===`online`?`bg-rubik-green`:t===`asleep`?`bg-rubik-yellow`:`bg-disabled`,r=t===`online`?`online`:t===`asleep`?`asleep${e.lastSeen?` · seen ${a(e.lastSeen)}`:``}`:e.lastSeen?`offline · seen ${a(e.lastSeen)}`:`offline`;return(0,F.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-control border border-hairline bg-surface px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${n}`,title:t}),(0,F.jsx)(`span`,{className:`text-[15px] font-medium text-display`,children:e.name}),(0,F.jsxs)(`span`,{className:`text-label text-secondary`,children:[r,e.platform?` · ${e.platform} ${e.arch??``}`:``,e.loopCount>0?` · ${e.loopCount} loop${e.loopCount===1?``:`s`}`:``]})]}),(0,F.jsx)(`button`,{className:m,disabled:e.loopCount>0,title:e.loopCount>0?`Delete its loops first`:void 0,onClick:()=>void P(e.id),children:`Delete`})]}),(0,F.jsx)(`div`,{className:`text-label text-secondary`,children:A(e.daemonProtocol).label}),!A(e.daemonProtocol).supported&&(0,F.jsx)(`div`,{className:`text-label text-accent`,children:`Daemon upgrade required to stop a running process`}),!e.online&&!e.token&&(0,F.jsx)(`div`,{className:`text-label text-secondary`,children:`Reconnect command available from the machine owner's account.`}),!e.online&&e.token&&!S&&(0,F.jsx)(`div`,{className:`text-label text-secondary`,children:w?`Could not load the reconnect command. Close and try again.`:`Loading reconnect command…`}),!e.online&&e.token&&S&&(0,F.jsxs)(`details`,{children:[(0,F.jsx)(`summary`,{className:`cursor-pointer select-none text-label font-medium text-secondary marker:content-[''] hover:text-display`,children:`Reconnect command`}),(0,F.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,F.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:qc(e.token,S.pievoCli,S.customCli)}),(0,F.jsx)(Jc,{text:qc(e.token,S.pievoCli,S.customCli)})]})]}),e.needsUpdate&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-control border border-warn/40 bg-warn/10 p-3`,children:[(0,F.jsx)(`div`,{className:`text-label font-medium text-primary`,children:`Daemon needs update before this server will dispatch runs.`}),(0,F.jsxs)(`div`,{className:`text-label text-secondary`,children:[`running `,e.daemonVersion?`v${e.daemonVersion}`:`unknown version`,` · required v`,e.requiredDaemonVersion]}),S?(0,F.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:Kc(S.pievoCli,S.customCli)}),(0,F.jsx)(Jc,{text:Kc(S.pievoCli,S.customCli)})]}):(0,F.jsx)(`div`,{className:`text-label text-secondary`,children:w?`Could not load the upgrade command. Close and try again.`:`Loading upgrade command…`})]}),!e.needsUpdate&&Wc(e.daemonVersion,e.latestDaemonVersion)&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`text-label text-secondary`,children:[`daemon v`,e.daemonVersion,` · upgrade available (v`,e.latestDaemonVersion,`)`]}),S?(0,F.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:Kc(S.pievoCli,S.customCli)}),(0,F.jsx)(Jc,{text:Kc(S.pievoCli,S.customCli)})]}):(0,F.jsx)(`div`,{className:`text-label text-secondary`,children:w?`Could not load the upgrade command. Close and try again.`:`Loading upgrade command…`})]})]},e.id)})}),(0,F.jsx)(`div`,{className:`mt-6`,children:(0,F.jsx)(`button`,{className:g,disabled:h,onClick:()=>void k(),children:h?`Preparing…`:`+ Connect computer`})})]})}export{Bc as a,Ps as c,At as d,zc as i,ks as l,Gc as n,Gs as o,Rc as r,Vs as s,Yc as t,Qo as u};