@kky42/pievo-server 1.0.0 → 1.0.1
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.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{LoopView-B4H9QibC.js → LoopView-d0XYkzpx.js} +3 -3
- package/.output/public/assets/Modal-D_od-AuP.js +1 -0
- package/.output/public/assets/{SignIn-SHuRRyOv.js → SignIn-CbMeIAJZ.js} +1 -1
- package/.output/public/assets/app-BKySt9Ta.css +2 -0
- package/.output/public/assets/{artifactView-DFuubXLJ.js → artifactView-DekEs5ME.js} +1 -1
- package/.output/public/assets/index-C4UaIr-9.js +12 -0
- package/.output/public/assets/{invite._token-T8oo4Qtw.js → invite._token-CnyCmLfD.js} +1 -1
- package/.output/public/assets/{lifecycleUi-DKkChdnU.js → lifecycleUi-DGVOf5yS.js} +1 -1
- package/.output/public/assets/{loopApi-BM2nj71x.js → loopApi-5s2-kCnu.js} +1 -1
- package/.output/public/assets/loops._loopId-DdWM2f1F.js +5 -0
- package/.output/public/assets/{loops._loopId_.runs._runId-_CflHV38.js → loops._loopId_.runs._runId-DTwSFHkl.js} +2 -2
- package/.output/public/assets/notifyFns-b_jCi5XK.js +1 -0
- package/.output/public/assets/{preload-helper-CKUiEq3b.js → preload-helper-ycaoAemE.js} +1 -1
- package/.output/public/assets/{routes-B9tgli5f.js → routes-G3WYRyPN.js} +1 -1
- package/.output/public/assets/{t._teamId-Bm21mngW.js → t._teamId-CGv7Oq6A.js} +1 -1
- package/.output/server/_libs/@base-ui/react+[...].mjs +23 -2375
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
- package/.output/server/_libs/html-react-parser+[...].mjs +1 -1
- package/.output/server/_libs/react-redux+[...].mjs +1 -1
- package/.output/server/_libs/recharts+victory-vendor.mjs +1 -1
- package/.output/server/_libs/uiw__react-codemirror.mjs +1 -1
- package/.output/server/_ssr/CodeField-tm4rr6G3.mjs +1 -1
- package/.output/server/_ssr/{DashboardView-CC7htv28.mjs → DashboardView-CmDqjCiq.mjs} +45 -35
- package/.output/server/_ssr/{LoopPlaybook-BXH8mhiX.mjs → LoopPlaybook-BBn-xXpG.mjs} +3 -3
- package/.output/server/_ssr/{LoopView-DCugEbHx.mjs → LoopView-DdyJYOCY.mjs} +5 -5
- package/.output/server/_ssr/Modal-DpKZHLZK.mjs +1 -1
- package/.output/server/_ssr/{SignIn-dTndU6Hw.mjs → SignIn-RJN_0GFZ.mjs} +3 -3
- package/.output/server/_ssr/actionUi-CZbEixbf.mjs +1 -1
- package/.output/server/_ssr/{adapters-BS8XosjF.mjs → adapters-CJUhP66K.mjs} +9 -3
- package/.output/server/_ssr/{artifactFiles-Cagtj7J0.mjs → artifactFiles-zP43a-_v.mjs} +3 -3
- package/.output/server/_ssr/{artifactView-DS4O22wl.mjs → artifactView-CYV1r48i.mjs} +3 -3
- package/.output/server/_ssr/artifacts-CwCDal_d.mjs +2 -0
- package/.output/server/_ssr/{auth-DY1DuYZd.mjs → auth-D2SlCxwE.mjs} +9 -9
- package/.output/server/_ssr/{boot-CMHTxQpJ.mjs → boot-BHTcCXzm.mjs} +1 -1
- package/.output/server/_ssr/{boot-BbtG0ImW.mjs → boot-aI3l2EYT.mjs} +494 -107
- package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-CU1Spd6z.mjs → bun-sqlite-dialect-BW9W1_Ps-B-3PhI3u.mjs} +2 -2
- package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-DfG7tB8s.mjs → d1-sqlite-dialect-BLC8LXE6-Dm_NrETM.mjs} +2 -2
- package/.output/server/_ssr/db-7gZ8_zkc.mjs +2 -0
- package/.output/server/_ssr/{dist-BIxFFVZg.mjs → dist-DW3TO9NM.mjs} +2 -2
- package/.output/server/_ssr/{factory-Blq0DYfT.mjs → factory-Voe90MEY.mjs} +2 -2
- package/.output/server/_ssr/{invite._token-NewFt27g.mjs → invite._token-CeD9PCvh.mjs} +6 -6
- package/.output/server/_ssr/{invite._token-BRCo9LGB.mjs → invite._token-D80GP0-u.mjs} +4 -4
- package/.output/server/_ssr/invite._token-DJxGLILJ.mjs +1 -1
- package/.output/server/_ssr/{kysely-adapter-D3XTe64J.mjs → kysely-adapter-DSLWmYjO.mjs} +1 -1
- package/.output/server/_ssr/{lifecycleUi-C9lg1r3r.mjs → lifecycleUi-BhRsBvJ7.mjs} +4 -4
- package/.output/server/_ssr/logger-Dbz2vUU-.mjs +2 -0
- package/.output/server/_ssr/{loopApi-Cxe8WyOB.mjs → loopApi-BfMnXaKT.mjs} +7 -7
- package/.output/server/_ssr/{loopApi-BtfkZQYK.mjs → loopApi-ByX_X17-.mjs} +31 -14
- package/.output/server/_ssr/{loops._loopId-DhnArGdL.mjs → loops._loopId-BODmoHPu.mjs} +236 -370
- package/.output/server/_ssr/{loops._loopId-7NQJPB9W.mjs → loops._loopId-u8Dr2J5f.mjs} +4 -4
- package/.output/server/_ssr/{loops._loopId_.runs._runId-Dip5Xk-q.mjs → loops._loopId_.runs._runId-DaKJdso2.mjs} +48 -6
- package/.output/server/_ssr/{loops._loopId_.runs._runId-Bvuo2nki.mjs → loops._loopId_.runs._runId-kGL-CMG6.mjs} +4 -4
- package/.output/server/_ssr/{machineFns-Dvr5ICUy.mjs → machineFns-MMSoHs7N.mjs} +3 -3
- package/.output/server/_ssr/{node-sqlite-dialect-DhyOpJTX.mjs → node-sqlite-dialect-Y22MTyEv.mjs} +2 -2
- package/.output/server/_ssr/{notifyFns-BcMRY5kP.mjs → notifyFns-Bmqhlrkc.mjs} +3 -3
- package/.output/server/_ssr/{notifyFns-Q458pZmE.mjs → notifyFns-CdrijMGW.mjs} +5 -5
- package/.output/server/_ssr/{router-J8KZ30xw.mjs → router-CdxedJtm.mjs} +30 -30
- package/.output/server/_ssr/routes-Bcs4T1ox.mjs +1 -1
- package/.output/server/_ssr/{routes-D4am3Zff.mjs → routes-Bhay1OjL.mjs} +6 -6
- package/.output/server/_ssr/{routes-BoGrcf-b.mjs → routes-ROFun1nJ.mjs} +5 -5
- package/.output/server/_ssr/{runDiff-CpEFqo7G.mjs → runDiff-DWwt7qXb.mjs} +2 -2
- package/.output/server/_ssr/ssr.mjs +49 -49
- package/.output/server/_ssr/store-D75hcTob.mjs +2 -0
- package/.output/server/_ssr/{t._teamId-DR-hQK7o.mjs → t._teamId-CGba9PRq.mjs} +5 -5
- package/.output/server/_ssr/{t._teamId-CeUhzgzT.mjs → t._teamId-DTKU7GOp.mjs} +6 -6
- package/.output/server/_ssr/t._teamId-Dy_McbRt.mjs +1 -1
- package/.output/server/_ssr/{teamFns-BIDnsg2A.mjs → teamFns-BMDqynoT.mjs} +3 -3
- package/.output/server/_ssr/{teamFns-DA4ovI5g.mjs → teamFns-D4I-0dEB.mjs} +2 -2
- package/.output/server/_ssr/tokens-BHjz7Lvx.mjs +2 -0
- package/.output/server/_ssr/ui-Dej2qjuS.mjs +1 -1
- package/.output/server/{_tanstack-start-manifest_v-CVS6c7re.mjs → _tanstack-start-manifest_v-BwejIUux.mjs} +21 -21
- package/.output/server/drizzle/0009_ordinary_electro.sql +1 -0
- package/.output/server/drizzle/0010_workable_rage.sql +14 -0
- package/.output/server/drizzle/meta/0009_snapshot.json +1793 -0
- package/.output/server/drizzle/meta/0010_snapshot.json +1891 -0
- package/.output/server/drizzle/meta/_journal.json +14 -0
- package/.output/server/index.mjs +102 -102
- package/drizzle/0009_ordinary_electro.sql +1 -0
- package/drizzle/0010_workable_rage.sql +14 -0
- package/drizzle/meta/0009_snapshot.json +1793 -0
- package/drizzle/meta/0010_snapshot.json +1891 -0
- package/drizzle/meta/_journal.json +14 -0
- package/package.json +1 -1
- package/scripts/pievo-server.mjs +5 -0
- package/scripts/server-cli-lib.mjs +2 -0
- package/.output/public/assets/Modal-D33gNSgx.js +0 -1
- package/.output/public/assets/app-DElSo_jy.css +0 -2
- package/.output/public/assets/index-DfpTWRSz.js +0 -12
- package/.output/public/assets/loops._loopId-B19Jw7jC.js +0 -5
- package/.output/public/assets/notifyFns-DCubjpRy.js +0 -1
- package/.output/server/_ssr/artifacts-DngKyW2u.mjs +0 -2
- package/.output/server/_ssr/db-DWAuZq1o.mjs +0 -2
- package/.output/server/_ssr/logger-Dw82jNjH.mjs +0 -2
- package/.output/server/_ssr/store-b3JcQ08F.mjs +0 -2
- package/.output/server/_ssr/tokens-ytd60FUt.mjs +0 -2
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeField-dOzyFQNH.js","assets/jsx-runtime-BseJUIpC.js","assets/LoopView-B4H9QibC.js","assets/Modal-D33gNSgx.js","assets/loopApi-BM2nj71x.js","assets/ui-Dp88qUWh.js","assets/artifactView-DFuubXLJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{C as r,L as i,S as a,a as o,b as s,d as c,g as l,i as u,r as d,s as f,v as p,x as m,y as h}from"./loopApi-BM2nj71x.js";import{c as g,f as _,p as v,t as y}from"./preload-helper-CKUiEq3b.js";import{$t as ee,A as b,B as x,Bn as S,Bt as C,C as w,E as T,En as E,F as D,Fn as te,Ft as O,Gn as k,Gt as A,H as ne,Hn as j,I as M,It as N,J as re,Kn as P,Kt as F,L as I,Ln as ie,M as L,Mn as ae,Mt as R,Nn as z,Nt as B,O as V,P as oe,Pn as H,Pt as U,Q as se,Qt as W,R as ce,Rn as G,S as le,Sn as ue,T as de,Tn as fe,U as pe,Un as K,Ut as me,V as he,W as ge,Wn as q,Wt as J,X as _e,Y as ve,Yt as Y,Z as ye,_ as be,a as xe,an as X,at as Se,c as Ce,cn as we,ct as Te,dn as Ee,en as Z,f as De,fn as Oe,h as ke,i as Ae,in as je,it as Me,j as Ne,jn as Pe,jt as Fe,k as Ie,l as Le,ln as Re,lt as ze,nt as Be,o as Ve,ot as He,p as Ue,pn as We,q as Ge,rt as Ke,s as qe,sn as Je,st as Ye,tn as Xe,tt as Ze,u as Qe,un as $e,ut as et,v as tt,w as nt,x as rt,xn as it,y as at,z as ot,zt as st}from"./Modal-D33gNSgx.js";import{_ as ct,a as lt,d as ut,f as dt,g as ft,h as pt,l as mt,o as ht,p as gt,r as _t,s as vt,u as yt,v as bt}from"./notifyFns-DCubjpRy.js";import{C as xt,D as St,E as Ct,M as wt,N as Tt,O as Et,S as Dt,_ as Ot,b as kt,c as At,d as jt,g as Mt,i as Nt,j as Pt,l as Ft,m as It,n as Lt,o as Rt,p as zt,r as Bt,s as Vt,t as Ht,v as Ut,w as Wt,x as Gt}from"./ui-Dp88qUWh.js";import{i as Kt,n as qt,r as Jt,t as Yt}from"./lifecycleUi-DKkChdnU.js";import{c as Xt,r as Zt}from"./index-DfpTWRSz.js";import{a as Qt,i as $t,n as en,o as tn,t as nn}from"./artifactView-DFuubXLJ.js";import{t as rn}from"./SignIn-SHuRRyOv.js";import{i as an,n as on,r as sn,t as cn}from"./actionUi-ChGGALzg.js";var Q=t(e(),1);function ln(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=W}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Q.useRef(void 0),f=B(),p=S(),m=Q.useMemo(()=>{function e(e,t,n,r){let i=st(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||Pe(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=Re(o);if(X(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}Pe(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return Q.useMemo(()=>n?{reference:m}:Z,[n,m])}var un=`Escape`;function dn(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function fn(e,t){return dn(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function pn(e,t,n){return dn(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function mn(e,t,n){return dn(t,n?e===Ee:e===Oe,e===$e)}function hn(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===un:dn(t,n?e===Oe:e===Ee,e===We)}function gn(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:ee,grid:b}=t,x=b!=null,S=`rootStore`in e?e.rootStore:e,C=S.useState(`open`),w=S.useState(`floatingElement`),T=S.useState(`domReferenceElement`),E=S.context.dataRef,D=Xe(w),te=je(T),k=O(D),A=he(),j=ne(ee),M=Q.useRef(f),N=Q.useRef(o??-1),re=Q.useRef(null),P=Q.useRef(!0),I=U(e=>{i(N.current===-1?null:N.current,e)}),ie=Q.useRef(!!w),L=Q.useRef(C),V=Q.useRef(!1),oe=Q.useRef(!1),W=Q.useRef(null),ce=O(h),G=O(C),le=O(o),ue=O(y),de=B(),pe=B(),ge=U(()=>{function e(e){d?j?.events.emit(`virtualfocus`,e):W.current=se(e,{sync:V.current,preventScroll:!0})}let t=n.current[N.current],r=oe.current;t&&e(t),(V.current?e=>e():e=>de.request(e))(()=>{let i=n.current[N.current]||t;i&&(t||e(i),ye&&(r||!P.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});K(()=>{E.current.orientation=g},[E,g]),K(()=>{a&&(C&&w?(N.current=o??-1,M.current&&o!=null&&(oe.current=!0,I())):ie.current&&(N.current=-1,I()))},[a,C,w,o,I]),K(()=>{if(a){if(!C){V.current=!1;return}if(w)if(r==null){if(V.current=!1,le.current!=null)return;if(ie.current&&(N.current=-1,ge()),(!L.current||!ie.current)&&M.current&&(re.current!=null||M.current===!0&&re.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>pe.request(e):queueMicrotask)(t),e+=1):(N.current=re.current==null||pn(re.current,g,u)||l?Ye(n):He(n),re.current=null,I())};t()}}else ze(n.current,r)||(N.current=r,ge(),oe.current=!1)}},[a,C,w,r,le,l,n,g,u,I,ge,pe]),K(()=>{if(!a||w||!j||d||!ie.current)return;let e=j.nodesRef.current,t=e.find(e=>e.id===A)?.context?.elements.floating,n=Je(R(T??t??null)),r=e.some(e=>e.context&&we(e.context.elements.floating,n));t&&!r&&P.current&&t.focus({preventScroll:!0})},[a,w,T,j,A,d]),K(()=>{L.current=C,ie.current=!!w}),K(()=>{C||(re.current=null,M.current=f)},[C,f]);let q=r!=null,J=U(e=>{if(!G.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(N.current!==t||r!==t)&&(N.current=t,I(e))}),_e=U(()=>_??j?.nodesRef.current.find(e=>e.id===A)?.context?.dataRef?.current.orientation),ve=U(()=>Ye(n,ce.current)),Y=U(e=>{if(P.current=!1,V.current=!0,e.which===229||!G.current&&e.currentTarget===k.current)return;if(l&&hn(e.key,g,u,x)){fn(e.key,_e())||H(e),S.setOpen(!1,st(F,e.nativeEvent)),fe(T)&&(d?j?.events.emit(`virtualfocus`,T):T.focus());return}let t=N.current,r=Ye(n,h),i=He(n,h);if(te||(e.key===`Home`&&(H(e),N.current=r,I(e)),e.key===`End`&&(H(e),N.current=i,I(e))),b!=null){let t=b(e,N.current,n,g,c,u,h,r,i);if(t!=null&&(N.current=t,I(e)),g===`both`)return}if(fn(e.key,g)){if(H(e),C&&!d&&Je(e.currentTarget.ownerDocument)===e.currentTarget){N.current=pn(e.key,g,u)?r:i,I(e);return}pn(e.key,g,u)?c?t>=i?s&&t!==n.current.length?N.current=-1:(V.current=!1,N.current=r):N.current=Se(n.current,{startingIndex:t,disabledIndices:h}):N.current=Math.min(i,Se(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?N.current=n.current.length:(V.current=!1,N.current=i):N.current=Se(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):N.current=Math.max(r,Se(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),ze(n.current,N.current)&&(N.current=-1),I(e)}}),ye=Q.useMemo(()=>({onFocus(e){V.current=!0,J(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){V.current=!0,oe.current=!1,p&&J(e)},onPointerLeave(e){if(!G.current||!P.current||e.pointerType===`touch`)return;V.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&ue.current&&(W.current?.(),W.current=null,N.current=-1,I(e),!d)){let e=k.current,t=Je(R(e));e&&we(e,t)&&e.focus({preventScroll:!0})}}}),[J,G,k,p,n,I,ue,d]),be=Q.useMemo(()=>d&&C&&q&&{"aria-activedescendant":`${v}-${r}`},[d,C,q,v,r]),xe=Q.useMemo(()=>({"aria-orientation":g===`both`?void 0:g,...te?{}:be,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&C&&!d){let t=Re(e.nativeEvent);if(t&&!we(k.current,t))return;H(e),S.setOpen(!1,st(me,e.nativeEvent)),fe(T)&&T.focus();return}Y(e)},onPointerMove(){P.current=!0}}),[be,Y,k,g,te,S,C,d,T]),X=Q.useMemo(()=>{function e(e){S.setOpen(!0,st(F,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&ae(e.nativeEvent)&&(M.current=!d)}function n(e){M.current=f,f===`auto`&&z(e.nativeEvent)&&(M.current=!0)}return{onKeyDown(t){let n=S.select(`open`);P.current=!1;let r=t.key.startsWith(`Arrow`),i=mn(t.key,_e(),u),a=fn(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return Y(t);if(!(!n&&!m&&r)){if(o){let e=fn(t.key,_e());re.current=l&&e?null:t.key}if(l){i&&(H(t),n?(N.current=ve(),I(t)):e(t));return}a&&(le.current!=null&&(N.current=le.current),H(t),!n&&m?e(t):Y(t),n&&I(t))}},onFocus(e){S.select(`open`)&&!d&&(N.current=-1,I(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[Y,f,ve,l,I,S,m,g,_e,u,le,d]),Ce=Q.useMemo(()=>({...be,...X}),[be,X]);return Q.useMemo(()=>a?{reference:Ce,floating:xe,item:ye,trigger:X}:{},[a,Ce,xe,X,ye])}function _n(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=S(),m=Q.useRef(``),h=Q.useRef(u??i??-1),g=Q.useRef(null),_=U(e=>{function t(e){let t=r?.current[e];return!t||Te(t)}function c(e){return t(e)?o==null||!et(ee,e,o):!1}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!c(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(H(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(H(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=U(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);we(n,t)||we(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});K(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]),K(()=>{f&&m.current===``&&(h.current=u??i??-1)},[f,u,i]);let y=Q.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return Q.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}function vn(e){let t=Q.useRef(``),n=Q.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Q.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function yn(e,t){let n=Q.useRef(e),r=U(t);K(()=>{n.current!==e&&r(n.current)},[e,r]),K(()=>{n.current=e},[e])}function bn(e,t){let{onClick:n,onPointerDown:r}=vn(U((n,r)=>{(typeof e==`function`?e():e)||t(r||(ie?`touch`:``))}));return Q.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function xn(e){let[t,n]=Q.useState(null),r=bn(e,n);return yn(e,t=>{t&&!e&&n(null)}),Q.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Sn=Q.createContext(void 0);function Cn(e){let t=Q.useContext(Sn);if(t===void 0&&!e)throw Error(j(33));return t}var wn=Q.createContext(void 0);function Tn(e){let t=Q.useContext(wn);if(t===void 0&&!e)throw Error(j(36));return t}var En=Q.createContext(void 0);function Dn(e=!0){let t=Q.useContext(En);if(t===void 0&&!e)throw Error(j(25));return t}function On(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=Dn(!0),f=d!==void 0;return Q.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:A})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!G&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var kn={type:`regular-item`};function An(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=a.useState(`disabled`),d=n||u,f=Q.useRef(null),{getButtonProps:p,buttonRef:m}=qe({disabled:d,focusableWhenDisabled:!0,native:s,composite:!0}),h=On({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:f,itemMetadata:c}),g=Q.useCallback(e=>_e(h,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,p),[h,p,c]),_=N(f,m);return Q.useMemo(()=>({getItemProps:g,itemRef:_}),[g,_])}var jn=Q.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Mn(){return Q.useContext(jn)}var Nn=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Pn(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=Mn(),f=Q.useRef(-1),[p,m]=Q.useState(a??(i===Nn.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=Q.useRef(null),g=Q.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return K(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),K(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),{ref:g,index:p}}var Fn=Q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Pn({label:a}),f=Cn(!0),p=Qe(i),{store:m}=Tn(),h=m.useState(`isActive`,d.index),g=m.useState(`itemProps`),{getItemProps:_,itemRef:v}=An({closeOnClick:c,disabled:s,highlighted:h,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:kn});return ve(`div`,e,{state:{disabled:s,highlighted:h},props:[g,u,_],ref:[v,t,d.ref]})}),In=Q.createContext(void 0);function Ln(e){let t=Q.useContext(In);if(t===void 0&&!e)throw Error(j(69));return t}var $=n(),Rn={...De,...Ne},zn=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=Tn(),{side:c,align:l}=Cn(),u=Ln(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),ee=s.useState(`floatingRootContext`),b=s.useState(`floatingTreeRoot`),x=s.useState(`closeDelay`),S=s.useState(`activeTriggerElement`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;Ie({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Q.useEffect(()=>{function e(e){s.setOpen(!1,st(e.reason,e.domEvent))}return b.events.on(`close`,e),()=>{b.events.off(`close`,e)}},[b.events,s]),ct(ee,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:x});let D=Q.useCallback(e=>{s.set(`popupElement`,e)},[s]),te=ve(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:Rn,props:[p,{onKeyDown(e){u&&Ve.has(e.key)&&e.stopPropagation()}},yt(f),o,{"data-rootownerid":y}]}),O=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(O=!0),(0,$.jsx)(I,{context:ee,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?O:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:b,previousFocusableElement:S,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:te})}),Bn=Q.createContext(void 0);function Vn(){let e=Q.useContext(Bn);if(e===void 0)throw Error(j(32));return e}var Hn=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Tn();return i.useState(`mounted`)||n?(0,$.jsx)(Bn.Provider,{value:n,children:(0,$.jsx)(ge,{ref:t,...r})}):null});function Un(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=U(i),o=Q.useRef(0),s=P(Gn).current,c=P(Wn).current,[l,u]=Q.useState(0),d=Q.useRef(l),f=U((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=U(e=>{c.delete(e),d.current+=1,u(d.current)}),m=Q.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(Kn).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);K(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),K(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),K(()=>()=>{n.current=[]},[n]),K(()=>()=>{r&&(r.current=[])},[r]);let h=U(e=>(s.add(e),()=>{s.delete(e)}));K(()=>{s.forEach(e=>e(m))},[s,m]);let g=Q.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,$.jsx)(jn.Provider,{value:g,children:t})}function Wn(){return new Map}function Gn(){return new Set}function Kn(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var qn=20;function Jn(e,t,n,r){let[i,a]=Q.useState(!1);K(()=>{if(!e||!t||n==null){a(!1);return}let r=R(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-qn)},[e,t,n]),Ae(e&&(!t||i),r)}var Yn=Q.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Ge,style:g,..._}=e,{store:v}=Tn(),y=Vn(),ee=Dn(!0),x=v.useState(`parent`),C=v.useState(`floatingRootContext`),w=v.useState(`floatingTreeRoot`),T=v.useState(`mounted`),E=v.useState(`open`),D=v.useState(`modal`),te=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),ne=v.useState(`instantType`),j=v.useState(`hasViewport`),M=v.useState(`lastOpenChangeReason`),N=v.useState(`floatingNodeId`),P=v.useState(`floatingParentNodeId`),F=C.useState(`domReferenceElement`),I=Q.useRef(null),ie=b(A,!1,!1),L=n,ae=c,R=l,z=s,B=h;x.type===`context-menu`&&(L=n??x.context?.anchor,z??=`start`,!o&&z!==`center`&&(R=e.alignOffset??2,ae=e.sideOffset??-5));let V=o,oe=z;x.type===`menu`?(V??=`inline-end`,oe??=`start`,B=e.collisionAvoidance??re):x.type===`menubar`&&(V??=x.context.orientation===`vertical`?`inline-end`:`bottom`,oe??=`start`);let H=x.type===`context-menu`,U=ut({anchor:L,floatingRootContext:C,positionMethod:ee?`fixed`:r,mounted:T,side:V,sideOffset:ae,align:oe,alignOffset:R,arrowPadding:H?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:N,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:B,shiftCrossAxis:H&&!(`side`in B&&B.side===`flip`),externalTree:w,adaptiveOrigin:j?dt:void 0});Q.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===N&&v.set(`hoverEnabled`,!1),e.nodeId!==N&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,st(Y)))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[v,w.events,N]),Q.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,st(t))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[w.events,v]);let se=S();Q.useEffect(()=>{E||se.clear()},[E,se]),Q.useEffect(()=>{function e(e){if(!(!E||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?se.isStarted()||se.start(e,()=>{v.setOpen(!1,st(Y))}):v.setOpen(!1,st(Y))}else se.clear()}return w.events.on(`itemhover`,e),()=>{w.events.off(`itemhover`,e)}},[w.events,E,O,v,se]),Q.useEffect(()=>{let e={open:E,nodeId:N,parentNodeId:P,reason:v.select(`lastOpenChangeReason`)};w.events.emit(`menuopenchange`,e)},[w.events,E,v,N,P]),K(()=>{let e=F,t=I.current;if(e&&(I.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return ie(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,ie,v]);let W={open:E,side:U.side,align:U.align,anchorHidden:U.anchorHidden,nested:x.type===`menu`,instant:ne},G=x.type===`menubar`&&x.context.modal;Jn(E&&(G||D&&M!==`trigger-hover`),te===`touch`,A,O);let le=mt(e,W,{styles:U.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!T,inert:!E}),ue=T&&x.type!==`menu`&&(x.type!==`menubar`&&D&&M!==`trigger-hover`||x.type===`menubar`&&x.context.modal),de=null;return x.type===`menubar`?de=x.context.contentElement:x.type===void 0&&(de=O),(0,$.jsxs)(Sn.Provider,{value:U,children:[ue&&(0,$.jsx)(xe,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:Le(!E),cutout:de}),(0,$.jsx)(ce,{id:N,children:(0,$.jsx)(Un,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:le})})]})}),Xn=Q.createContext(null);function Zn(e){let t=Q.useContext(Xn);if(t===null&&!e)throw Error(j(5));return t}var Qn={...be,disabled:D(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:D(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:D(e=>e.openMethod),allowMouseEnter:D(e=>e.allowMouseEnter),highlightItemOnHover:D(e=>e.highlightItemOnHover),stickIfOpen:D(e=>e.stickIfOpen),parent:D(e=>e.parent),rootId:D(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:D(e=>e.activeIndex),isActive:D((e,t)=>e.activeIndex===t),hoverEnabled:D(e=>e.hoverEnabled),instantType:D(e=>e.instantType),lastOpenChangeReason:D(e=>e.openChangeReason),floatingTreeRoot:D(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:D(e=>e.floatingNodeId),floatingParentNodeId:D(e=>e.floatingParentNodeId),itemProps:D(e=>e.itemProps),closeDelay:D(e=>e.closeDelay),hasViewport:D(e=>e.hasViewport),keyboardEventRelay:D(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},$n=class e extends oe{constructor(e){super({...er(),...e},{positionerRef:Q.createRef(),popupRef:Q.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),onOpenChangeComplete:void 0,triggerElements:new tt},Qn),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=P(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function er(){return{...ke(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new pe,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Z,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var tr=Q.createContext(void 0);function nr(){return Q.useContext(tr)}var rr=q(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=Dn(!0),_=Tn(!0),v=Zn(!0),y=nr(),b=Q.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),C=$n.useStore(f?.store,{open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b});nt(C,n,a,m),C.useControlledProp(`openProp`,n),C.useControlledProp(`triggerIdProp`,p),C.useContextCallback(`onOpenChangeComplete`,i);let E=ye(),D=ye(),te=C.useState(`floatingTreeRoot`),O=x(te),k=he(),A=C.useState(`open`),ne=C.useState(`activeTriggerElement`),j=C.useState(`positionerElement`),N=C.useState(`hoverEnabled`),re=C.useState(`disabled`),P=C.useState(`lastOpenChangeReason`),F=C.useState(`parent`),I=C.useState(`activeIndex`),ie=C.useState(`payload`),ae=C.useState(`floatingParentNodeId`),R=Q.useRef(null),z=Q.useRef(F.type!==`context-menu`),B=S(),V=Q.useRef(!0),oe=S(),H=ae!=null,{openMethod:se,triggerProps:W}=xn(A);C.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:F.type===void 0?s:void 0,openMethod:se,rootId:E}),w(C);let{forceUnmount:ce}=de(A,C,()=>{C.update({allowMouseEnter:!1,stickIfOpen:!0})});K(()=>{g&&!_?C.update({parent:{type:`context-menu`,context:g},floatingNodeId:O,floatingParentNodeId:k}):_&&C.update({floatingNodeId:O,floatingParentNodeId:k})},[g,_,O,k,C]),Q.useEffect(()=>{if(A||(R.current=null),F.type===`context-menu`){if(!A){B.clear(),z.current=!1;return}B.start(500,()=>{z.current=!0})}},[B,A,F.type]),K(()=>{!A&&!N&&C.set(`hoverEnabled`,!0)},[A,N,C]);let G=U((e,t)=>{let n=t.reason;if(A===e&&t.trigger===ne&&P===n)return;let i=rt(t);if(!e&&t.trigger==null&&(t.trigger=ne??void 0),r?.(e,t),t.isCanceled)return;C.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!V.current)return;e&&n===`trigger-focus`?(V.current=!1,oe.start(300,()=>{V.current=!0})):(V.current=!0,oe.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0&&a?.isTrusted,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};R.current=t.event??null,le(c,e,t.trigger,i()),C.update(c),F.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?C.set(`instantType`,`group`):o||s?C.set(`instantType`,o?`click`:`dismiss`):C.set(`instantType`,void 0)}),ue=L({popupStore:C,floatingId:D,nested:k!=null,onOpenChange:G}),fe=ue.context.events;Q.useEffect(()=>{let e=({open:e,eventDetails:t})=>G(e,t);return fe.on(`setOpen`,e),()=>{fe?.off(`setOpen`,e)}},[fe,G]);let pe=Q.useCallback(()=>{C.setOpen(!1,st(J))},[C]);Q.useImperativeHandle(u,()=>({unmount:ce,close:pe}),[ce,pe]);let me;F.type===`context-menu`&&(me=F.context),Q.useImperativeHandle(me?.positionerRef,()=>j,[j]),Q.useImperativeHandle(me?.actionsRef,()=>({setOpen:G}),[G]);let ge=M(ue,{enabled:!re,bubbles:{escapeKey:d&&F.type===`menu`},outsidePress(){return F.type!==`context-menu`||R.current?.type===`contextmenu`?!0:z.current},externalTree:H?te:void 0}),q=gt(),ve=Q.useCallback(e=>{C.select(`activeIndex`)!==e&&C.set(`activeIndex`,e)},[C]),Y=gn(ue,{enabled:!re,listRef:C.context.itemDomElements,activeIndex:I,nested:F.type!==void 0,loopFocus:c,orientation:l,parentOrientation:F.type===`menubar`?F.context.orientation:void 0,rtl:q===`rtl`,disabledIndices:ee,onNavigate:ve,openOnArrowKeyDown:F.type!==`context-menu`,externalTree:H?te:void 0,focusItemOnHover:h}),be=Q.useCallback(e=>{C.context.typingRef.current=e},[C]),xe=_n(ue,{enabled:!re,listRef:C.context.itemLabels,elementsRef:C.context.itemDomElements,activeIndex:I,resetMs:500,onMatch:e=>{A&&e!==I&&C.set(`activeIndex`,e)},onTyping:be});T(C,{floatingRootContext:ue,activeTriggerProps:Q.useMemo(()=>{let e=_e(xe.reference,Y.reference,ge.reference,{onMouseMove(){C.set(`allowMouseEnter`,!0)}},W);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=A,e},[C,xe.reference,Y.reference,ge.reference,W,A]),inactiveTriggerProps:Q.useMemo(()=>{let e=_e(Y.trigger,ge.trigger,W);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Y.trigger,ge.trigger,W]),popupProps:Q.useMemo(()=>_e(at,{id:D,role:`menu`,"aria-labelledby":ne?.id,onMouseMove(){C.set(`allowMouseEnter`,!0),F.type===`menu`&&C.set(`hoverEnabled`,!1)},onClick(){C.select(`hoverEnabled`)&&C.set(`hoverEnabled`,!1)},onKeyDown(e){let t=C.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},xe.floating,Y.floating,ge.floating),[ne,D,F.type,C,xe.floating,Y.floating,ge.floating]),itemProps:Y.item??Z});let X=Q.useMemo(()=>({store:C,parent:b}),[C,b]),Se=(0,$.jsx)(wn.Provider,{value:X,children:typeof t==`function`?t({payload:ie}):t});return F.type===void 0||F.type===`context-menu`?(0,$.jsx)(ot,{externalTree:te,children:Se}):Se});function ir(e){let t=e.getBoundingClientRect(),n=ue(e);if(te)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function ar(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Ce(),{ref:i,index:a}=Pn(e),o=n===a,s=Q.useRef(null),c=N(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function or(e){let{render:t,className:n,style:r,state:i=Z,props:a=ee,refs:o=ee,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=ar({metadata:s});return ve(l,e,{state:i,ref:[...o,f],props:[d,...a,u],stateAttributesMapping:c})}function sr(e){if(fe(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!E(e))return sr(it(e))}var cr=t(i(),1);function lr(e,t){let n=Q.useRef(null);function r(t){cr.flushSync(()=>{e.setOpen(!1,st(me,t.nativeEvent,t.currentTarget))}),Ke(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&Me(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{cr.flushSync(()=>{e.setOpen(!1,st(me,n.nativeEvent,n.currentTarget))});let i=Be(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&we(r,i);){let e=i;if(i=Ze(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function ur(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Q.useRef(!1);return Q.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,R(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Z,[t,n,r])}var dr=2,fr=k(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=Tn(!0),h=d?.store??m?.store;if(!h)throw Error(j(85));let g=Qe(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),ee=h.useState(`triggerPopupId`,g),b=Q.useRef(null),w=mr(),T=Ce(!0),E=ne(),D=Q.useMemo(()=>E??new pe,[E]),{registerTrigger:te,isMountedByThisTrigger:O}=V(g,b,h,{payload:f,closeDelay:u,parent:w,floatingTreeRoot:D,floatingNodeId:x(D),floatingParentNodeId:he(),keyboardEventRelay:T?.relayKeyboardEvent}),k=w.type===`menubar`,A=h.useState(`disabled`),M=a||A||k&&w.context.disabled,{getButtonProps:N,buttonRef:re}=qe({disabled:M,native:o});Q.useEffect(()=>{!y&&w.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,w.type]);let P=Q.useRef(null),F=S(),I=U(e=>{if(!P.current)return;F.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(we(P.current,t)||we(h.select(`positionerElement`),t)||t===P.current||t!=null&&sr(t)===h.select(`rootId`))return;let n=ir(P.current);e.clientX>=n.left-dr&&e.clientX<=n.right+dr&&e.clientY>=n.top-dr&&e.clientY<=n.bottom+dr||D.events.emit(`close`,{domEvent:e,reason:C})});Q.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&R(P.current).addEventListener(`mouseup`,I,{once:!0})},[y,I,h]);let ie=k&&w.context.hasSubmenuOpen,L=ft(v,{enabled:(c??ie)&&!M&&w.type!==`context-menu`&&(!k||ie&&!O),handleClose:pt({blockPointerEvents:!k}),mouseOnly:!0,move:!1,restMs:w.type===void 0?l:void 0,delay:{close:u},triggerElementRef:b,externalTree:D,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),ae=pr(y,h.select(`lastOpenChangeReason`)),z=ln(v,{enabled:!M&&w.type!==`context-menu`,event:y&&k?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0?ae:!1}),B=bt(v,{enabled:!M&&ie}),oe=ur({open:y,enabled:k,mouseDownAction:`open`}),H=Q.useMemo(()=>_e(B.reference,z.reference),[B.reference,z.reference]),se=h.useState(`triggerProps`,O),{preFocusGuardRef:W,handlePreFocusGuardFocus:ce,handleFocusTargetFocus:G}=lr(h,b),le={disabled:M,open:y},ue=[P,t,re,te,b],de=[H,L??Z,se,{"aria-haspopup":`menu`,"aria-controls":ee,id:g,onMouseDown:e=>{h.select(`open`)||(F.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),R(e.currentTarget).addEventListener(`mouseup`,I,{once:!0}))}},k?{role:`menuitem`}:{},oe,p,N],fe=ve(`button`,e,{enabled:!k,stateAttributesMapping:Ue,state:le,ref:ue,props:de});return k?(0,$.jsx)(or,{tag:`button`,render:n,className:r,style:i,state:le,refs:ue,props:de,stateAttributesMapping:Ue}):y?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(Fe,{ref:W,onFocus:ce},`${g}-pre-focus-guard`),(0,$.jsx)(Q.Fragment,{children:fe},g),(0,$.jsx)(Fe,{ref:h.context.triggerFocusTargetRef,onFocus:G},`${g}-post-focus-guard`)]}):(0,$.jsx)(Q.Fragment,{children:fe},g)});function pr(e,t){let n=S(),[r,i]=Q.useState(!1);return K(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function mr(){let e=Dn(!0),t=Tn(!0),n=Zn(!0);return Q.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}var hr=Q.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return ve(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function gr(e){if(!e)return null;let t=e.replace(/\\/g,`/`).replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):null}function _r({loopId:e,loopName:t,instruction:n}){let r=n?.trim()||`Describe the change you want to make to this loop.`;return[`I want to adjust my Pievo loop "${t}" (loop id: ${e}).`,``,`The change I want:`,r,``,`Use the installed pievo CLI/skill to apply it: run \`pievo loops\` to find the loop, then \`pievo edit ${e} ...\` to make the change, and confirm the loop now reflects it. Ask me first if anything is unclear.`].join(`
|
|
3
|
-
`)}var vr=e=>e.split(`/`).pop()||e;function yr(e){let t=e.match(/\.([a-z0-9]+)$/i);return t?t[1].toLowerCase():`file`}function br({loopId:e,taskFile:t,taskFileContent:n,taskFileSyncedAt:r,running:i}){let[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useCallback)(async()=>{let t=++l.current;try{let n=await f({data:{loopId:e}});t===l.current&&o(n)}catch{t===l.current&&o(e=>e??[])}},[e]);(0,Q.useEffect)(()=>{o(null),c(null),u()},[e,u]),(0,Q.useEffect)(()=>{let e=setInterval(()=>void u(),i?4e3:12e3);return()=>clearInterval(e)},[i,u]);let d=(0,Q.useMemo)(()=>Qt(t,a??[]),[t,a]),p=s&&d.some(e=>e.path===s)?s:d[0]?.path??null,m=d.find(e=>e.path===p)??null,h=tn(m);return(0,$.jsxs)(`section`,{id:`files`,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-2.5 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:[(0,$.jsxs)(`h2`,{className:`text-label font-semibold text-secondary`,children:[`Files`,a?` (${d.length})`:``]}),(0,$.jsx)(`span`,{className:`text-caption font-medium text-disabled`,children:`Spec + synced artifacts`})]}),d.length===0?(0,$.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled shadow-card`,children:a==null?`Loading…`:`No files yet - the task file and synced artifacts appear here.`}):(0,$.jsxs)(`div`,{className:`grid h-[min(600px,68vh)] grid-cols-1 overflow-hidden rounded-card border border-hairline bg-surface shadow-card sm:grid-cols-[210px_1fr]`,children:[(0,$.jsx)(`nav`,{className:`max-h-44 overflow-y-auto border-b border-hairline sm:max-h-none sm:border-b-0 sm:border-r`,children:(0,$.jsx)(`ul`,{className:`py-1.5`,children:d.map(e=>{let t=e.path===p,n=tn(e),r=!n&&e.kind===`artifact`?e.file.meta:null,i=r?.title?.trim()||``,a=i&&i!==vr(e.path)?i:vr(e.path),o=e.path.includes(`/`)||a!==vr(e.path);return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>c(e.path),className:`flex w-full items-center gap-2 border-l-2 px-3 py-2 text-left transition-colors ${t?`border-display bg-raised`:`border-transparent hover:bg-raised/60`}`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate font-mono text-label ${t?`text-display`:`text-primary`}`,title:e.path,children:a}),o&&(0,$.jsx)(`span`,{className:`block truncate font-mono text-micro text-disabled`,title:e.path,children:e.path})]}),n?(0,$.jsx)(`span`,{className:`shrink-0 rounded-full bg-interactive-soft px-2 text-caption font-medium text-interactive`,children:`Task`}):r?.type?(0,$.jsx)(`span`,{className:`shrink-0 truncate rounded-full bg-raised px-2 text-caption font-medium text-secondary`,title:`type: ${r.type}`,children:r.type}):(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-micro text-disabled`,children:yr(e.path)})]})},e.path)})})}),(0,$.jsx)(`div`,{className:`min-w-0 overflow-y-auto`,children:h&&m?(0,$.jsx)(xr,{path:m.path,content:n,syncedAt:r}):m?.kind===`artifact`?(0,$.jsx)(Sr,{loopId:e,file:m.file}):null})]})]})}function xr({path:e,content:t,syncedAt:n}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(en,{path:e,meta:n?`Task file · synced ${Wt(n)}`:`Task file`}),t==null?(0,$.jsx)(`div`,{className:`px-5 py-6 text-body text-disabled`,children:`(syncs from the machine on the next run)`}):(0,$.jsx)($t,{content:t})]})}function Sr({loopId:e,file:t}){let n=[t.size==null?``:Ct(t.size),`synced ${Wt(t.updatedAt)}`].filter(Boolean).join(` · `);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(en,{path:t.path,meta:n}),(0,$.jsx)(nn,{loopId:e,file:t})]})}var Cr=[`claude-code`,`codex`];function wr(e){return{executor:`claude`,workdir:e.workdir.trim(),model:e.model.trim(),allowControl:e.allowControl}}var Tr=(0,Q.lazy)(()=>y(()=>import(`./CodeField-dOzyFQNH.js`),__vite__mapDeps([0,1])));function Er(e){let t=e?.exec;return{name:e?.name??``,cron:e?.cron??`0 */3 * * *`,scheduleMode:e?.scheduleMode??`cron`,continuousDelayMinutes:String(e?.continuousDelayMinutes??1),taskFile:e?.taskFile??``,notify:e?.notify??`auto`,channelId:e?.channelId??``,workflow:e?.workflow??``,stateSchema:e?.stateSchema?JSON.stringify(e.stateSchema):``,ui:e?.ui??``,agent:e?.agent??`claude-code`,workdir:t?.workdir??``,model:t?.model??``,allowControl:!!t?.allowControl}}var Dr=`mt-1 text-caption leading-snug text-disabled`,Or={"claude-code":`Claude Code`,codex:`Codex`};function kr({label:e,value:t,onChange:n,mono:r,ph:i,hint:a}){return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:It,children:e}),(0,$.jsx)(`input`,{type:`text`,className:r?`${zt} font-mono`:zt,value:t,placeholder:i,onChange:e=>n(e.target.value)}),a&&(0,$.jsx)(`div`,{className:Dr,children:a})]})}function Ar({title:e,hint:t}){return(0,$.jsxs)(`div`,{className:`mb-1 mt-7 border-b border-hairline pb-1.5`,children:[(0,$.jsx)(`h2`,{className:Ot,children:e}),t&&(0,$.jsx)(`div`,{className:`mt-0.5 text-caption text-disabled`,children:t})]})}function jr({minHeight:e}){return(0,$.jsx)(`div`,{className:`rounded-control border border-wire bg-raised`,style:{minHeight:e}})}var Mr=(0,Q.forwardRef)(function({initial:e,channels:t},n){let[r,i]=(0,Q.useState)(()=>Er(e)),a=(e,t)=>i(n=>({...n,[e]:t})),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)([]),u=t??c;return(0,Q.useEffect)(()=>{t||_t().then(l).catch(()=>{})},[t]),(0,Q.useImperativeHandle)(n,()=>({read(){let e,t=r.stateSchema.trim();if(t)try{e=JSON.parse(t)}catch{return s(`Not valid JSON - expected an array like [{"key":"mrr","label":"MRR","unit":"$"}]`),null}return{name:r.name.trim(),cron:r.cron.trim(),scheduleMode:r.scheduleMode,continuousDelayMinutes:Math.max(1,Number.parseInt(r.continuousDelayMinutes,10)||1),taskFile:r.taskFile.trim(),notify:r.notify,channelId:r.channelId||null,workflow:r.workflow.trim(),ui:r.ui.trim()||void 0,agent:r.agent,exec:wr(r),stateSchema:e}}})),(0,$.jsxs)(`div`,{className:`grid gap-x-10 lg:grid-cols-[minmax(300px,380px)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(Ar,{title:`Basics`}),(0,$.jsx)(kr,{label:`Name`,value:r.name,onChange:e=>a(`name`,e)}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:It,children:`Schedule mode`}),(0,$.jsxs)(`select`,{"aria-label":`Schedule mode`,className:Ut,value:r.scheduleMode,onChange:e=>a(`scheduleMode`,e.target.value),children:[(0,$.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,$.jsx)(`option`,{value:`continuous`,children:`Continuous`})]}),r.scheduleMode===`cron`?(0,$.jsxs)(`div`,{className:`${zt} flex cursor-default select-none items-center justify-between gap-2 bg-raised`,title:r.cron,children:[(0,$.jsx)(`span`,{className:`truncate text-primary`,children:kt(r.cron)}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-secondary`,children:r.cron})]}):(0,$.jsx)(kr,{label:`Delay after each exec (minutes)`,value:r.continuousDelayMinutes,onChange:e=>a(`continuousDelayMinutes`,e),mono:!0,hint:`At least 1 minute. Done and error continue; canceled runs do not.`}),(0,$.jsx)(`div`,{className:Dr,children:`Cron is retained while continuous mode is active, so switching back restores it.`})]}),(0,$.jsx)(kr,{label:`Task file`,value:r.taskFile,onChange:e=>a(`taskFile`,e),mono:!0,hint:`Path of the markdown file this loop tracks/maintains on the machine (optional).`}),(0,$.jsx)(Ar,{title:`Notifications`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:It,children:`Notify`}),(0,$.jsx)(`select`,{"aria-label":`Notify`,className:Ut,value:r.notify,onChange:e=>a(`notify`,e.target.value),children:[`auto`,`always`,`never`].map(e=>(0,$.jsx)(`option`,{children:e},e))}),(0,$.jsx)(`div`,{className:Dr,children:`auto pushes only when a run found something; never silences everything.`})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:It,children:`Push channel`}),(0,$.jsxs)(`select`,{"aria-label":`Push channel`,className:Ut,value:r.channelId,onChange:e=>a(`channelId`,e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:`none (dashboard only)`}),u.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,$.jsx)(Ar,{title:`Execution`,hint:`Which coding agent on the machine runs this loop.`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:It,children:`Coding agent`}),(0,$.jsx)(`select`,{"aria-label":`Coding agent`,className:Ut,value:r.agent,onChange:e=>a(`agent`,e.target.value),children:Cr.map(e=>(0,$.jsx)(`option`,{value:e,children:Or[e]??e},e))}),(0,$.jsx)(`div`,{className:Dr,children:`Which coding agent executes this loop on the bound machine.`})]}),(0,$.jsx)(kr,{label:`Working directory`,value:r.workdir,onChange:e=>a(`workdir`,e),mono:!0,ph:`/Users/you/Workspace/project`,hint:`Project root on the machine - empty means workflow-only / agent() escalation.`}),(0,$.jsx)(kr,{label:`Model`,value:r.model,onChange:e=>a(`model`,e),hint:`Optional - the daemon default when empty.`}),(0,$.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-center gap-2 text-body text-primary`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`accent-[color:var(--color-display)]`,checked:r.allowControl,onChange:e=>a(`allowControl`,e.target.checked)}),`Allow self-rescheduling`]})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(Ar,{title:`Agent-authored content`,hint:`Workflow, metrics and dashboard - usually written by evolve passes; edit by hand here when you know exactly what you want.`}),(0,$.jsx)(`label`,{className:It,children:`Workflow · JavaScript function body`}),(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(jr,{minHeight:`180px`}),children:(0,$.jsx)(Tr,{lang:`js`,value:r.workflow,onChange:e=>a(`workflow`,e),minHeight:`180px`,placeholder:`const res = await tools.call("server.tool", { ... })
|
|
4
|
-
return { message: "...", state: { ... } }`})}),(0,$.jsxs)(`div`,{className:Dr,children:[`Deterministic zero-LLM pre-stage; top-level await and return `,`{message, state}`,` are allowed (optional).`]}),(0,$.jsx)(`label`,{className:It,children:`Metrics schema · JSON array`}),(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(jr,{minHeight:`90px`}),children:(0,$.jsx)(Tr,{lang:`json`,value:r.stateSchema,onChange:e=>{a(`stateSchema`,e),s(null)},minHeight:`90px`,invalid:!!o,placeholder:`[{"key":"mrr","label":"MRR","unit":"$"},{"key":"paid"}]`})}),o?(0,$.jsx)(`div`,{className:`mt-1 text-caption leading-snug text-accent`,children:o}):(0,$.jsx)(`div`,{className:Dr,children:`Per-run metrics the agent reports; they feed the dashboard charts.`}),(0,$.jsx)(`label`,{className:It,children:`Dashboard template · HTML`}),(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(jr,{minHeight:`240px`}),children:(0,$.jsx)(Tr,{lang:`html`,value:r.ui,onChange:e=>a(`ui`,e),minHeight:`240px`,placeholder:`<h3>{{latest.mrr}}$</h3>
|
|
5
|
-
<loop-chart series="mrr:MRR:$"></loop-chart>`})}),(0,$.jsxs)(`div`,{className:Dr,children:[`Agent-authored HTML with `,`{{bindings}}`,` and loop-chart / loop-embed / loop-calendar / loop-kanban elements.`]})]})]})}),Nr={"claude-code":`Claude Code`,codex:`Codex`},Pr=[{label:`Change the schedule`,seed:`Change the schedule: `},{label:`Adjust what it does`,seed:`Change what this loop does: `},{label:`Improve the dashboard`,seed:`Improve the dashboard: `},{label:`Set a finish line`,seed:`Give this loop a goal, and finish it once the goal is met: `}],Fr=(0,Q.lazy)(()=>y(()=>import(`./LoopView-B4H9QibC.js`).then(e=>({default:e.LoopView})),__vite__mapDeps([2,1,3,4,5,6])));function Ir({id:e}){let t=v(),[n,i]=(0,Q.useState)(null),[f,g]=(0,Q.useState)([]),[y,ee]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(``),[te,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[ne,j]=(0,Q.useState)(null),M=(0,Q.useRef)(null),[N,re]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(!1),[I,ie]=(0,Q.useState)(!1),[L,ae]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(null),[B,V]=an(),oe=(0,Q.useRef)(null),H=(0,Q.useRef)(!1),[U,se]=(0,Q.useState)([]),W=(0,Q.useCallback)(async(n=!1)=>{try{let t=await c({data:e});i(t),H.current=t.summary.deleteRequestedAt!=null,ee(null)}catch(e){H.current?t({to:`/`}):n||ee(String(e))}},[e]);(0,Q.useEffect)(()=>{i(null),C(!1),T(!1),D(``),O(!1),A(!1),j(null),re(!1),se([]),W(),_t().then(g).catch(()=>{})},[e,W]);let ce=!!n?.summary.running;(0,Q.useEffect)(()=>{if(S)return;let e=setInterval(()=>void W(!0),ce||H.current?3e3:8e3);return()=>clearInterval(e)},[S,ce,W]),(0,Q.useEffect)(()=>{if(!P)return;let e=setTimeout(()=>F(!1),1800);return()=>clearTimeout(e)},[P]);async function G(){await W()}function le(){n?.job.exec?z(`run`):ue()}async function ue(){x(null),ae(`run`);try{let t=await m({data:e});if(t?.error)return x(`Run failed: ${t.error}`);z(null),V({label:t.coalesced?`Already queued`:`Queued`,hold:4e3}),await G()}finally{ae(null)}}async function de(){x(null),ae(`evolve`);try{let t=await u({data:e});if(t?.error)return x(`Evolve failed: ${t.error}`);z(null),V({label:t.coalesced?`Evolve already queued`:`Evolve queued`,hold:4e3}),await G()}finally{ae(null)}}async function fe(n){x(null),ae(`lifecycle`);try{let i=n===`pause`?await h({data:e}):n===`start`?await a({data:e}):n===`stop`?await r({data:e}):n===`delete`?await d({data:e}):await o({data:{id:e,confirmation:`delete-server-data-anyway`}});if(i.error)return x(`${n===`force-delete`?`Force delete`:n[0].toUpperCase()+n.slice(1)} failed: ${i.error}`);if(z(null),i.deleted){H.current=!1,t({to:`/`});return}n===`delete`&&(H.current=!0),await G(),V({label:n===`start`?`Started`:n===`pause`?`Paused`:n===`stop`?`Stop requested`:`Deleting`})}finally{ae(null)}}async function pe(t){x(null);let n=await p({data:{id:e,patch:t}});if(n.error)return x(`Save failed: ${n.error}`);await G(),F(!0)}async function K(){let t=oe.current?.read();if(t){x(null),ae(`save`);try{let n=await p({data:{id:e,patch:t}});if(n.error)return x(`Save failed: ${n.error}`);C(!1),await G(),V({label:`Saved`})}finally{ae(null)}}}async function me(){let t=E.trim();if(t){x(null),ae(`edit`);try{let n=await s({data:{id:e,instruction:t}});if(n.error)return x(`Couldn't queue the edit: ${n.error}`);j(n.runId??null),A(!0),T(!1),D(``),await G()}finally{ae(null)}}}function he(){R===`run`?ue():R===`evolve`?de():R===`pause`?fe(`pause`):R===`stop`?fe(`stop`):R===`delete`?fe(`delete`):R===`force-delete`&&fe(`force-delete`)}let ge=(0,$.jsxs)(_,{to:`/`,className:`inline-flex items-center gap-1.5 text-meta font-medium text-secondary transition-colors hover:text-display`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Loops`]});if(y)return(0,$.jsx)(Rr,{back:ge,children:(0,$.jsx)(sn,{title:`Couldn't load this loop.`,detail:y,onRetry:()=>void W()})});if(!n)return(0,$.jsx)(Rr,{back:ge,children:(0,$.jsx)(Lt,{})});let{job:q,summary:J,runs:_e}=n,ve=!!q.ui,Y=!!L,ye=n.machine.online,be=n.machine.presence===`asleep`,xe=ye?void 0:be?`Machine asleep - requests will stay queued until it wakes`:`Machine offline - requests will stay queued until it reconnects`,X=Et(J),Se=Jt(J),Ce=Kt(n),we=qt(n.machine.daemonProtocol),Te=St(J)&&!X,Ee=n.machine.name?`“${n.machine.name}”`:`the bound machine`,Z=k&&ne?_e.find(e=>e.id===ne):void 0,De=!!Z&&!Z.queued&&!Z.running,Oe=()=>{A(!1),j(null)},ke=gr(q.taskFile),Ae=async()=>{try{await navigator.clipboard.writeText(_r({loopId:e,loopName:J.name,instruction:E})),O(!0),setTimeout(()=>O(!1),4e3)}catch{x(`Could not copy the prompt - try again or copy it manually.`)}},je={run:{q:`Run one real cycle now?`,note:`Spawns the coding agent (${Nr[q.agent??`claude-code`]??q.agent??`Claude Code`}).`,cta:`Run once`,danger:!1},evolve:{q:`Trigger an evolution pass now?`,note:`Re-authors the dashboard / tightens the gate from real run data.`,cta:`Evolve`,danger:!1},pause:{q:`Pause future runs? The current run will continue.`,cta:`Pause`,danger:!1},stop:{q:`Pause this loop, cancel queued work, and stop the current run if it is still running?`,cta:`Stop`,danger:!0},delete:{q:`Stop this loop and delete its Pievo history and synced artifacts? Local project files are not deleted.`,cta:`Delete`,danger:!0},"force-delete":{q:`Delete server data anyway`,note:`The machine is unreachable. Its local process may still be running. This removes Pievo authority and server data only.`,cta:`Delete server data anyway`,danger:!0}},Me=B&&(0,$.jsx)(`div`,{className:`mb-2.5`,children:(0,$.jsx)(on,{label:B.label,tone:B.tone,onUndo:B.undo})}),Ne=R&&je[R],Pe=Y,Fe=`lp-select cursor-pointer rounded-control border border-wire bg-surface py-1.5 pl-2.5 text-meta text-primary outline-none transition-colors hover:border-display focus:border-display disabled:cursor-default disabled:opacity-40`,Ie=`flex w-full cursor-pointer select-none items-center px-3.5 py-2 text-body text-primary outline-none transition-colors data-[highlighted]:bg-raised data-[disabled]:cursor-default data-[disabled]:opacity-40`,Le=`flex w-full cursor-pointer select-none items-center px-3.5 py-2 text-body text-accent outline-none transition-colors data-[highlighted]:bg-accent-soft data-[disabled]:cursor-default data-[disabled]:opacity-40`,Re=Ne?(0,$.jsx)(cn,{prompt:Ne.q,note:`note`in Ne?Ne.note:void 0,cta:Ne.cta,danger:Ne.danger,busy:Pe,onConfirm:he,onCancel:()=>z(null)},R):Se===`deleting`?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-md border border-wire bg-raised px-4 py-3`,children:[(0,$.jsx)(`span`,{className:`text-body font-medium text-display`,children:Ce}),(0,$.jsx)(`span`,{className:`text-meta text-secondary`,children:`Server deletion is waiting for execution authority to end.`}),!ye&&(0,$.jsx)(`button`,{type:`button`,className:At,onClick:()=>z(`force-delete`),disabled:Y,children:`Delete server data anyway`})]}):w?(0,$.jsxs)(`div`,{onKeyDown:e=>{e.key===`Escape`&&L!==`edit`&&(e.stopPropagation(),T(!1))},children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,$.jsx)(`span`,{className:`text-body font-medium text-display`,children:`Edit with your coding agent`}),(0,$.jsxs)(`span`,{className:`text-meta text-secondary`,children:[`One agent pass on `,Ee,` · spends credits`]})]}),(0,$.jsx)(`textarea`,{ref:M,autoFocus:!0,value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&E.trim()&&L!==`edit`&&me()},rows:3,placeholder:`e.g. run at 9am on weekdays instead, and also check coffee stock`,className:`mt-3 w-full resize-y rounded-control border border-wire bg-raised p-3 font-mono text-label leading-relaxed text-primary outline-none transition-shadow placeholder:text-disabled focus:border-transparent focus:shadow-focus`}),!E.trim()&&(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:Pr.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>{D(e.seed),M.current?.focus()},className:`cursor-pointer rounded-full border border-wire bg-surface px-3 py-1 text-label font-medium text-secondary transition-colors hover:bg-raised hover:text-display`,children:e.label},e.label))}),(0,$.jsxs)(`div`,{className:`mt-3.5 flex flex-wrap items-center gap-x-2.5 gap-y-2`,children:[(0,$.jsx)(`button`,{className:Vt,disabled:L===`edit`||!E.trim(),title:xe,onClick:()=>void me(),children:L===`edit`?`Dispatching…`:`Dispatch to your coding agent`}),(0,$.jsx)(`button`,{type:`button`,className:Rt,disabled:L===`edit`,onClick:()=>void Ae(),children:te?`✓ Prompt copied`:`Copy prompt`}),(0,$.jsx)(`button`,{className:Rt,disabled:L===`edit`,onClick:()=>T(!1),children:`Cancel`}),(0,$.jsx)(`span`,{className:`hidden text-caption text-disabled sm:inline`,children:`⌘↩ dispatch · esc cancel`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{T(!1),C(!0)},className:`ml-auto cursor-pointer border-none bg-transparent p-0 text-label text-secondary underline underline-offset-2 transition-colors hover:text-display`,children:`Manual settings →`})]}),(0,$.jsx)(`div`,{className:`mt-2 text-caption leading-snug text-disabled`,children:te?(0,$.jsxs)(`span`,{className:`text-secondary`,children:[`✓ Copied · run your coding agent`,` `,ke?(0,$.jsxs)($.Fragment,{children:[`in `,(0,$.jsx)(`code`,{className:`break-all font-mono text-primary`,children:ke})]}):`in the loop’s local directory on this machine`,` `,`and paste the prompt to adjust the loop yourself.`]}):(0,$.jsx)($.Fragment,{children:`Prefer to adjust it yourself? Copy prompt drops a ready-to-paste prompt for your own coding agent - no dispatch, no credits.`})})]}):N?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,$.jsx)(`span`,{className:`text-label font-medium text-secondary`,children:`Push`}),(0,$.jsx)(`select`,{"aria-label":`Notify`,className:Fe,value:q.notify,disabled:Y,onChange:e=>void pe({notify:e.target.value}),children:[`auto`,`always`,`never`].map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`text-secondary`,children:`→`}),(0,$.jsxs)(`select`,{"aria-label":`Push channel`,className:Fe,value:q.channelId??``,disabled:Y,onChange:e=>void pe({channelId:e.target.value}),children:[(0,$.jsx)(`option`,{value:``,children:`none (dashboard only)`}),f.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-2.5`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`text-[14px] leading-none text-success transition-opacity duration-200 ${P?`opacity-100`:`opacity-0`}`,children:`✓`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>re(!1),className:jt,children:`Done`})]})]}):(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`button`,{className:Ft,disabled:Y||X,onClick:le,title:X?`Loop completed - only Edit is available until it is reopened`:J.running||J.queued?`Queues or coalesces one exec follow-up`:xe??(q.exec?`Spends credits`:void 0),"aria-label":q.exec?`Run once - spends credits`:`Run once`,children:L===`run`?`Queuing…`:J.running||J.queued?`Queue run`:`Run once`}),(0,$.jsx)(`button`,{className:Rt,disabled:Y,title:`Queues an edit; a queued edit is updated with the latest instruction`,onClick:()=>T(!0),children:`Edit`}),(0,$.jsxs)(rr,{children:[(0,$.jsx)(fr,{className:`${Rt} px-2.5`,disabled:Y,"aria-label":`More actions`,children:(0,$.jsxs)(`svg`,{"aria-hidden":!0,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,children:[(0,$.jsx)(`circle`,{cx:`3`,cy:`8`,r:`1.4`}),(0,$.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.4`}),(0,$.jsx)(`circle`,{cx:`13`,cy:`8`,r:`1.4`})]})}),(0,$.jsx)(Hn,{children:(0,$.jsx)(Yn,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[950]`,children:(0,$.jsxs)(zn,{className:`glass-strong min-w-[176px] origin-[var(--transform-origin)] rounded-control py-1.5 outline-none transition-[opacity,transform] duration-150 data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0`,children:[(0,$.jsx)(Fn,{className:Ie,disabled:Y||X,onClick:()=>z(`evolve`),title:X?`Completed loops only accept manual edits`:xe??`Spends credits`,children:L===`evolve`?`Evolving…`:`Evolve now`}),(0,$.jsx)(Fn,{className:Ie,onClick:()=>re(!0),children:`Push…`}),X?(0,$.jsx)(Fn,{className:Ie,onClick:()=>void p({data:{id:e,patch:{enabled:!0}}}).then(G),children:`Reopen`}):Se===`paused`?(0,$.jsx)(Fn,{className:Ie,onClick:()=>void fe(`start`),children:`Start`}):(0,$.jsx)(Fn,{className:Ie,onClick:()=>z(`pause`),children:`Pause`}),!X&&Se!==`stopping`&&(0,$.jsx)(Fn,{className:Le,disabled:!!J.running&&!we.supported,title:J.running&&!we.supported?"Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.":void 0,onClick:()=>z(`stop`),children:`Stop`}),(0,$.jsx)(hr,{className:`my-1.5 h-px bg-hairline`}),(0,$.jsx)(Fn,{className:Le,disabled:!!J.running&&!we.supported,title:J.running&&!we.supported?Yt:void 0,onClick:()=>z(`delete`),children:`Delete`})]})})})]})]})}),ze=b&&(0,$.jsx)(Ht,{message:b,onDismiss:()=>x(null),className:`mb-2.5`}),Be=n.team&&!n.team.isActive?n.team:null,Ve=e=>{Xt(e),t({to:`/t/$teamId`,params:{teamId:e}})},He=Be&&(0,$.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-control border border-hairline bg-raised px-4 py-2.5`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-secondary`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-interactive`}),`Viewing a loop in `,Be.name]}),(0,$.jsx)(`span`,{className:`text-meta text-secondary`,children:`- not your active team.`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>Ve(Be.id),className:`ml-auto cursor-pointer text-meta font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Switch to this team`})]}),Ue=!ye&&(0,$.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-control border border-hairline bg-raised px-4 py-2.5`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-secondary`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full ${be?`bg-rubik-yellow`:`bg-disabled`}`}),`Machine `,n.machine.name?`“${n.machine.name}” `:``,be?`seems to be asleep or offline`:`offline`]}),(0,$.jsxs)(`span`,{className:`text-meta text-secondary`,children:[be?`- queued work starts automatically when it reconnects.`:`- manual run, evolve, and edit requests remain safely queued.`,n.machine.lastSeen?` Last seen ${Pt(n.machine.lastSeen)}.`:``]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>ie(!0),className:`ml-auto cursor-pointer text-meta font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Reconnect`})]});if(S)return(0,$.jsxs)(Rr,{back:ge,children:[(0,$.jsx)(Lr,{name:J.name,onBack:()=>C(!1)}),(0,$.jsxs)(`div`,{className:`mt-5 rounded-card border border-hairline bg-surface px-6 pb-6 pt-2 shadow-card`,children:[(0,$.jsx)(Mr,{ref:oe,initial:q,channels:f}),(0,$.jsxs)(`div`,{className:`mt-7 border-t border-hairline pt-4`,children:[ze,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,$.jsx)(`button`,{className:Ft,disabled:L===`save`,onClick:K,children:L===`save`?`Saving…`:`Save`}),(0,$.jsx)(`button`,{className:Rt,disabled:L===`save`,onClick:()=>C(!1),children:`Cancel`})]})]})]})]});let We=Nr[q.agent??`claude-code`]??q.agent??`Claude Code`,Ge=(0,$.jsx)(`span`,{className:`text-wire`,children:`·`});return(0,$.jsxs)(Rr,{back:ge,children:[(0,$.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,$.jsx)(`h1`,{className:`text-[28px] font-semibold leading-tight tracking-[-0.015em] text-display`,children:J.name}),X?(0,$.jsx)(Bt,{tone:`success`,dot:`green`,children:`Completed`}):(0,$.jsx)(Bt,{tone:Se===`stopping`?`running`:void 0,dot:Se===`stopping`?`pulse`:void 0,children:Ce}),J.queued&&Se===`active`?(0,$.jsx)(Bt,{tone:`outline`,children:`Queued`}):null,Te&&(0,$.jsx)(Bt,{tone:`success`,title:J.goal??void 0,children:`Goal`}),(0,$.jsx)(Bt,{tone:`outline`,title:`Recorded coding agent`,children:We}),Be&&(0,$.jsx)(Bt,{tone:`outline`,title:`This loop belongs to another of your teams`,children:Be.name})]}),(0,$.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-meta text-secondary`,children:[(0,$.jsx)(`span`,{className:`text-primary`,title:q.cron,children:q.scheduleMode===`continuous`?`continuous · ${q.continuousDelayMinutes}m delay`:kt(q.cron)}),Ge,(0,$.jsxs)(`span`,{children:[`next `,Wt(J.nextRun)]}),J.nextRun&&J.enabled&&!X&&(0,$.jsxs)(`span`,{className:`text-disabled`,children:[`(`,Tt(J.nextRun),`)`]}),Ge,(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:ye?`Machine online`:be?`Machine asleep`:`Machine offline`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full ${ye?`bg-rubik-green`:be?`bg-rubik-yellow`:`bg-disabled`}`}),n.machine.name||`machine`]}),Ge,(0,$.jsx)(`span`,{title:`Breaking daemon/server lifecycle protocol`,children:we.label}),Ge,(0,$.jsx)(`code`,{className:`font-mono text-label text-disabled`,children:J.id})]}),Te&&J.goal&&(0,$.jsxs)(`div`,{className:`mt-2 text-body leading-snug text-secondary`,children:[`Working toward: `,(0,$.jsx)(`span`,{className:`text-primary`,children:J.goal})]}),X&&(0,$.jsxs)(`div`,{className:`mt-2 text-body leading-snug text-success`,children:[`Completed`,J.completedAt?` · ${Wt(J.completedAt)}`:``,J.completionReason&&(0,$.jsxs)(`span`,{className:`text-secondary`,children:[` - `,J.completionReason]})]})]})}),(0,$.jsxs)(`div`,{className:`mt-5 border-t border-hairline pt-4`,children:[He,Ue,ze,Me,Re]})]}),k&&(0,$.jsxs)(`section`,{className:`mt-6 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,style:{animation:`fadeIn 0.2s ease-out`},"aria-live":`polite`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[!Z||Z.queued?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 text-body text-secondary`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full bg-disabled`}),(0,$.jsx)(`span`,{className:`font-medium text-primary`,children:`Edit queued`}),(0,$.jsxs)(`span`,{children:[`waiting for `,Ee,` and higher-priority work…`]})]}):Z.running?(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2.5 text-body text-secondary`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full`,style:Mt}),(0,$.jsx)(`span`,{className:`shrink-0 font-medium text-primary`,children:`Applying your edit`})]}):(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 text-body`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2.5 shrink-0 rounded-[2px]`,style:{background:Gt(Z)}}),(0,$.jsx)(`span`,{className:`font-medium`,style:{color:Gt(Z)},children:Z.canceled?`Edit canceled`:Z.outcome===`error`?`Edit failed`:`Edit applied`}),Z.error&&(0,$.jsxs)(`span`,{className:`truncate text-secondary`,children:[`· `,Z.error]})]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-3.5`,children:[Z&&(0,$.jsx)(_,{to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:Z.id},className:`text-label font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`View run →`}),(0,$.jsx)(`button`,{type:`button`,onClick:Oe,className:`inline-flex cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-meta font-medium text-secondary transition-colors hover:text-display`,children:De?`Done`:`Hide`})]})]}),De&&Z.message&&(0,$.jsx)(`div`,{className:`mt-3.5`,children:(0,$.jsx)(Nt,{children:Z.message})})]}),ve&&(0,$.jsxs)(`section`,{className:`mt-6 min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,$.jsx)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 text-label font-semibold text-secondary`,children:`Dashboard`}),(0,$.jsx)(`div`,{className:`min-w-0 overflow-x-auto`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Lt,{className:`py-4`}),children:(0,$.jsx)(Fr,{html:q.ui,runs:_e,loopId:e,taskFile:q.taskFile})})})]}),(0,$.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,$.jsx)(br,{loopId:e,taskFile:q.taskFile,taskFileContent:n.taskFileContent,taskFileSyncedAt:n.taskFileSyncedAt,running:ce}),(0,$.jsx)(zr,{loopId:e,summary:J,runs:_e,older:U,onMore:async()=>{let t=(U.length?vt(J.runs??[],U):J.runs??[])[0];if(!t)return 0;let n=await l({data:{loopId:e,beforeTs:t.ts,limit:16}});return n.length&&se(e=>vt(e,n)),n.length},onPickRun:n=>t({to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id}})})]}),(0,$.jsx)(lt,{open:I,onClose:()=>ie(!1)})]})}function Lr({name:e,onBack:t}){return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:t,className:jt,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]}),(0,$.jsxs)(`h1`,{className:`mt-2.5 text-[24px] font-semibold leading-tight tracking-[-0.015em] text-display`,children:[`Manual settings · `,e]}),(0,$.jsx)(`p`,{className:`mt-1.5 max-w-[640px] text-meta leading-snug text-secondary`,children:`The raw fields, saved directly - no agent pass, no credits. For schedule or task changes in plain words, use Edit with your coding agent instead.`})]})}function Rr({back:e,children:t}){return(0,$.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,$.jsx)(`div`,{className:`mb-5`,children:e}),t]})}function zr({loopId:e,summary:t,runs:n,older:r,onMore:i,onPickRun:a}){let o=(0,Q.useMemo)(()=>r.length?vt(t.runs??[],r):t.runs??[],[t.runs,r]);return(0,$.jsxs)(`section`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-2.5 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:(0,$.jsxs)(`h2`,{className:Ot,children:[`Runs (`,t.runCount,`)`]})}),t.runCount===0?(0,$.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled`,children:`Never run`}):(0,$.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 pb-4 pt-5 shadow-card`,children:[(0,$.jsx)(ht,{job:t,runs:o,total:t.runCount,onLoadMore:i,onPickRun:a}),(0,$.jsx)(`ul`,{className:`mt-5 max-h-[clamp(280px,46vh,520px)] divide-y divide-hairline overflow-y-auto border-t border-hairline`,children:n.map(t=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(_,{to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:t.id},className:`flex items-start gap-2.5 py-2.5 transition-colors hover:bg-raised`,children:[(0,$.jsx)(`span`,{className:`mt-1 inline-block size-2.5 shrink-0 rounded-[2px]`,style:{background:Gt(t)},title:Dt(t),"aria-label":Dt(t)}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex items-baseline justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-label text-secondary`,children:wt(t.ts)}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:xt(t.durationMs)})]}),(0,$.jsx)(`span`,{className:`mt-0.5 block`,children:t.queued?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta text-secondary`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-disabled`}),(0,$.jsx)(`span`,{children:`Queued`})]}):t.running?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta text-secondary`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full`,style:Mt}),(0,$.jsx)(`span`,{children:`Running`})]}):t.error?(0,$.jsx)(`span`,{className:`line-clamp-2 text-meta text-secondary`,children:t.error}):(0,$.jsx)(`span`,{className:`line-clamp-2 text-meta text-primary`,children:t.message||Dt(t)})})]})]})},t.id))})]})]})}function Br(){let{loopId:e}=Zt.useParams(),{auth:t}=Zt.useLoaderData()??{auth:{enabled:!1}},{data:n,isPending:r}=g();return t?.enabled&&!r&&!n?(0,$.jsx)(rn,{callbackURL:`/loops/${e}`}):(0,$.jsx)(Ir,{id:e})}export{Br as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{L as r,O as i,T as a,l as o}from"./loopApi-BM2nj71x.js";import{$ as s,An as c,At as l,Bn as u,C as d,Cn as f,Ct as p,D as m,Dn as h,Dt as g,E as _,En as v,Et as y,F as b,Ft as x,G as S,Gn as C,H as w,Hn as T,I as E,In as D,J as O,K as k,Kn as A,Lt as j,Mt as M,N,O as P,On as ee,Ot as te,P as F,Pt as I,Qt as ne,Rn as re,Rt as L,Sn as R,St as ie,T as ae,Tn as z,Tt as B,Un as V,V as oe,Vn as se,Vt as ce,Wn as le,Wt as ue,X as de,Xt as fe,Y as pe,Z as me,Zt as H,_ as he,_n as ge,_t as _e,an as ve,b as ye,bn as be,bt as xe,cn as U,d as Se,dt as Ce,en as we,et as Te,f as Ee,ft as W,g as De,gn as G,gt as Oe,h as ke,hn as Ae,ht as je,j as Me,jn as Ne,k as Pe,kn as Fe,kt as Ie,ln as Le,m as Re,mn as K,mt as ze,n as Be,nn as Ve,on as He,pt as q,qt as Ue,r as We,rn as Ge,sn as Ke,t as qe,u as Je,v as Ye,vn as Xe,vt as Ze,w as Qe,wn as J,wt as Y,xn as $e,xt as et,y as tt,yn as nt,yt as rt,zn as it,zt as X}from"./Modal-D33gNSgx.js";import{C as at,N as ot,O as st,S as ct,c as lt,h as ut,j as dt,l as ft,m as pt,o as mt,p as ht,t as gt,w as _t,x as vt,y as yt}from"./ui-Dp88qUWh.js";import{n as bt}from"./lifecycleUi-DKkChdnU.js";var xt=t(r(),1),Z=n(),Q=t(e(),1),St=Q.createContext(void 0);function Ct(e){let t=Q.useContext(St);if(t===void 0&&!e)throw Error(T(72));return t}function wt(e,t){return t!=null&&!Ne(t)?0:typeof e==`function`?e():e}function Tt(e,t,n){let r=wt(e,n);return typeof r==`number`?r:r?.[t]}function Et(e){return typeof e==`function`?e():e}function Dt(e,t){return t||e===`click`||e===`mousedown`}function Ot(e){return e?.includes(`mouse`)&&e!==`mousedown`}var kt=Q.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new it,currentIdRef:{current:null},currentContextRef:{current:null}});function At(e,t){e.current=t.current}function jt(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Q.useRef(n),a=Q.useRef(n),o=Q.useRef(null),s=Q.useRef(null),c=u();return V(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Tt(i.current,`open`),close:Tt(n,`close`)}},[n,o,i,a]),(0,Z.jsx)(kt.Provider,{value:Q.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Mt(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}=Q.useContext(kt),[f,p]=Q.useState(!1),m=Q.useRef(n),h=Q.useRef(!1);return V(()=>{m.current=n},[n]),V(()=>()=>{h.current=!0},[]),V(()=>{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]),V(()=>{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:Tt(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,X(Ue))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),V(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,At(o,c),d.clear()}},[l,a,o,i,c,d]),Q.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function Nt(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 Pt(e){return e!=null&&e.clientX!=null}function Ft(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=Q.useRef(!1),u=Q.useRef(null),[d,f]=Q.useState(),[p,m]=Q.useState([]),h=I(e=>{i.set(`positionReference`,e)}),g=I((e,t,n)=>{l.current||c.current.openEvent&&!Pt(c.current.openEvent)||i.set(`positionReference`,Nt(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=I(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=Ne(d)?o:a;Q.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=R(o);function r(t){U(o,Le(t))?e():g(t.clientX,t.clientY)}return!c.current.openEvent||Pt(c.current.openEvent)?u.current=L(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),Q.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Q.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Q.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=Q.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return Q.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function It(e,t,n){let{reference:r,floating:i}=e,a=B(t),o=Oe(t),s=Ze(o),c=Y(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(je(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 Lt(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}=q(t,e),m=p(f),h=o[d?u===`floating`?`reference`:`floating`:u],g=te(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(h))??!0?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),_=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(v))&&await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1},b=te(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:v,strategy:s}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}var Rt=50,zt=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Lt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=It(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<Rt&&(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}=It(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Bt=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}=q(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Y(r),_=B(o),v=Y(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ie(o)]:rt(o)),x=p!==`none`;!d&&x&&b.push(...et(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=_e(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`&&_!==B(t))||T.every(e=>B(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=B(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 Vt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ht(e){return l.some(t=>e[t]>=0)}var Ut=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=q(e,t);switch(i){case`referenceHidden`:{let e=Vt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ht(e)}}}case`escaped`:{let e=Vt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ht(e)}}}default:return{}}}}},Wt=new Set([`left`,`top`]);async function Gt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Y(n),s=je(n),c=B(n)===`y`,l=Wt.has(o)?-1:1,u=a&&c?-1:1,d=q(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 Kt=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 Gt(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}}}}},qt=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}=q(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=B(Y(i)),p=xe(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=Ce(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=Ce(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}}}}}},Jt=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}=q(e,t),u={x:n,y:r},d=B(i),f=xe(d),p=u[f],m=u[d],h=q(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=Wt.has(Y(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}}}},Yt=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}=q(e,t),u=await o.detectOverflow(t,l),d=Y(i),f=je(i),p=B(i)===`y`,{width:m,height:h}=a.floating,_,v;d===`top`||d===`bottom`?(_=d,v=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(v=d,_=f===`end`?`top`:`bottom`);let b=h-u.top-u.bottom,x=m-u.left-u.right,S=g(h-u[_],b),C=g(m-u[v],x),w=!t.middlewareData.shift,T=S,E=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(E=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=b),w&&!f){let e=y(u.left,0),t=y(u.right,0),n=y(u.top,0),r=y(u.bottom,0);p?E=m-2*(e!==0||t!==0?e+t:y(u.left,u.right)):T=h-2*(n!==0||r!==0?n+r:y(u.top,u.bottom))}await c({...t,availableWidth:E,availableHeight:T});let D=await o.getDimensions(s.floating);return m!==D.width||h!==D.height?{reset:{rects:!0}}:{}}}};function Xt(e){let t=K(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=z(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ie(n)!==a||Ie(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Zt(e){return J(e)?e:e.contextElement}function Qt(e){let t=Zt(e);if(!z(t))return W(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Xt(t),o=(a?Ie(n.width):n.width)/r,s=(a?Ie(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var $t=W(0);function en(e){let t=R(e);return!c()||!t.visualViewport?$t:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==R(e)?!1:t}function nn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Zt(e),o=W(1);t&&(r?J(r)&&(o=Qt(r)):o=Qt(e));let s=tn(a,n,r)?en(a):W(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=R(a),t=r&&J(r)?R(r):r,n=e,i=ge(n);for(;i&&r&&t!==n;){let e=Qt(i),t=i.getBoundingClientRect(),r=K(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=R(i),i=ge(n)}}return te({width:u,height:d,x:c,y:l})}function rn(e,t){let n=nt(e).scrollLeft;return t?t.left+n:nn(G(e)).left+n}function an(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-rn(e,n),y:n.top+t.scrollTop}}function on(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=G(r),s=t?Fe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=W(1),u=W(0),d=z(r);if((d||!d&&!a)&&((Xe(r)!==`body`||h(o))&&(c=nt(r)),d)){let e=nn(r);l=Qt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?an(o,c):W(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function sn(e){return Array.from(e.getClientRects())}function cn(e){let t=G(e),n=nt(e),r=e.ownerDocument.body,i=y(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=y(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+rn(e),s=-n.scrollTop;return K(r).direction===`rtl`&&(o+=y(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ln=25;function un(e,t){let n=R(e),r=G(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;let e=c();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,l=i.offsetTop)}let u=rn(r);if(u<=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<=ln&&(a-=o)}else u<=ln&&(a+=u);return{width:a,height:o,x:s,y:l}}function dn(e,t){let n=nn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=z(e)?Qt(e):W(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function fn(e,t,n){let r;if(t===`viewport`)r=un(e,n);else if(t===`document`)r=cn(G(e));else if(J(t))r=dn(t,n);else{let n=en(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return te(r)}function pn(e,t){let n=$e(e);return n===t||!J(n)||v(n)?!1:K(n).position===`fixed`||pn(n,t)}function mn(e,t){let n=t.get(e);if(n)return n;let r=be(e,[],!1).filter(e=>J(e)&&Xe(e)!==`body`),i=null,a=K(e).position===`fixed`,o=a?$e(e):e;for(;J(o)&&!v(o);){let t=K(o),n=f(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||h(o)&&!n&&pn(e,o))?r=r.filter(e=>e!==o):i=t,o=$e(o)}return t.set(e,r),r}function hn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Fe(t)?[]:mn(t,this._c):[].concat(n),r],o=fn(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=fn(t,a[e],i);s=y(n.top,s),c=g(n.right,c),l=g(n.bottom,l),u=y(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function gn(e){let{width:t,height:n}=Xt(e);return{width:t,height:n}}function _n(e,t,n){let r=z(t),i=G(t),a=n===`fixed`,o=nn(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=W(0);function l(){c.x=rn(i)}if(r||!r&&!a)if((Xe(t)!==`body`||h(i))&&(s=nt(t)),r){let e=nn(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?an(i,s):W(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 vn(e){return K(e).position===`static`}function yn(e,t){if(!z(e)||K(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return G(e)===n&&(n=n.ownerDocument.body),n}function bn(e,t){let n=R(e);if(Fe(e))return n;if(!z(e)){let t=$e(e);for(;t&&!v(t);){if(J(t)&&!vn(t))return t;t=$e(t)}return n}let r=yn(e,t);for(;r&&ee(r)&&vn(r);)r=yn(r,t);return r&&v(r)&&vn(r)&&!f(r)?n:r||Ae(e)||n}var xn=async function(e){let t=this.getOffsetParent||bn,n=this.getDimensions,r=await n(e.floating);return{reference:_n(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Sn(e){return K(e).direction===`rtl`}var Cn={convertOffsetParentRelativeRectToViewportRelativeRect:on,getDocumentElement:G,getClippingRect:hn,getOffsetParent:bn,getElementRects:xn,getClientRects:sn,getDimensions:gn,getScale:Qt,isElement:J,isRTL:Sn};function wn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Tn(e,t){let n=null,r,i=G(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=ze(d),h=ze(i.clientWidth-(u+f)),_=ze(i.clientHeight-(d+p)),v=ze(u),b={rootMargin:-m+`px `+-h+`px `+-_+`px `+-v+`px`,threshold:y(0,g(1,c))||1},x=!0;function S(t){let n=t[0].intersectionRatio;if(n!==c){if(!x)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!wn(l,e.getBoundingClientRect())&&o(),x=!1}try{n=new IntersectionObserver(S,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,b)}n.observe(e)}return o(!0),a}function En(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=Zt(e),u=i||a?[...l?be(l):[],...t?be(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Tn(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?nn(e):null;c&&g();function g(){let t=nn(e);h&&!wn(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 Dn=Kt,On=qt,kn=Bt,An=Yt,jn=Ut,Mn=Jt,Nn=(e,t,n)=>{let r=new Map,i={platform:Cn,...n},a={...i.platform,_c:r};return zt(e,t,{...i,platform:a})},Pn=typeof document<`u`?Q.useLayoutEffect:function(){};function Fn(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(!Fn(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)&&!Fn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function In(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ln(e,t){let n=In(e);return Math.round(t*n)/n}function Rn(e){let t=Q.useRef(e);return Pn(()=>{t.current=e}),t}function zn(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]=Q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Q.useState(r);Fn(f,r)||p(r);let[m,h]=Q.useState(null),[g,_]=Q.useState(null),v=Q.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Q.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Q.useRef(null),C=Q.useRef(null),w=Q.useRef(u),T=c!=null,E=Rn(c),D=Rn(i),O=Rn(l),k=Q.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Nn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Fn(w.current,t)&&(w.current=t,xt.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Pn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Q.useRef(!1);Pn(()=>(A.current=!0,()=>{A.current=!1}),[]),Pn(()=>{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 j=Q.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Q.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Q.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Ln(M.floating,u.x),r=Ln(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...In(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Q.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Bn=(e,t)=>{let n=Dn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vn=(e,t)=>{let n=On(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hn=(e,t)=>({fn:Mn(e).fn,options:[e,t]}),Un=(e,t)=>{let n=kn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wn=(e,t)=>{let n=An(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gn=(e,t)=>{let n=jn(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Kn(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=me(),a=oe()!=null,o=A(()=>new N({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ye,floatingId:i,syncOnly:!1,nested:a})).current;return V(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=J(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 qn(e={}){let{nodeId:t,externalTree:n}=e,r=Kn(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]=Q.useState(null),[f,p]=Q.useState(void 0),[m,h]=Q.useState(void 0),g=Q.useRef(null),_=w(n),v=Q.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),y=zn({...e,elements:{...v,...u&&{reference:u}}}),b=J(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=Q.useCallback(e=>{let t=J(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),y.refs.setReference(t)},[y.refs]),C=Q.useCallback(e=>{(J(e)||e===null)&&(g.current=e,p(e)),(J(y.refs.reference.current)||y.refs.reference.current===null||e!==null&&!J(e))&&y.refs.setReference(e)},[y.refs,p]),T=Q.useCallback(e=>{h(e),y.refs.setFloating(e)},[y.refs]),E=Q.useMemo(()=>({...y.refs,setReference:C,setFloating:T,setPositionReference:S,domReference:g}),[y.refs,C,T,S]),D=Q.useMemo(()=>({...y.elements,domReference:s}),[y.elements,s]),O=Q.useMemo(()=>({...y,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:E,elements:D,nodeId:t,rootStore:i}),[y,E,D,t,i,c,l]);return V(()=>{s&&(g.current=s)},[s]),V(()=>{i.context.dataRef.current.floatingContext=O;let e=_?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),Q.useMemo(()=>({...y,context:O,refs:E,elements:D,rootStore:i}),[y,E,D,O,i])}var Jn=re&&D;function Yn(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,c=Q.useRef(!1),l=Q.useRef(null),d=Q.useRef(!0),f=u();Q.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=R(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&z(e)&&e===Ke(M(e))&&(c.current=!0)}function a(){d.current=!0}function o(){d.current=!1}return j(L(t,`blur`,r),Jn&&L(t,`keydown`,a,!0),Jn&&L(t,`pointerdown`,o,!0))},[i,n]),Q.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);J(e)&&(l.current=e,c.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let p=Q.useMemo(()=>{function e(){c.current=!1,l.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(c.current){if(l.current===n)return;e()}let a=Le(t.nativeEvent);if(J(a)){if(Jn&&!t.relatedTarget){if(!d.current&&!ve(a))return}else if(!He(a))return}let o=Ge(t.relatedTarget,i.context.triggerElements),{nativeEvent:s,currentTarget:u}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,X(fe,s,u));return}f.start(p,()=>{c.current||i.setOpen(!0,X(fe,s,u))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=J(n)&&n.hasAttribute(s(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;f.start(0,()=>{let e=i.select(`domReferenceElement`),t=Ke(M(e));!n&&t===e||U(o.current.floatingContext?.refs.floating.current,t)||U(e,t)||a||Ge(n??t,i.context.triggerElements)||i.setOpen(!1,X(fe,r))})}}},[o,r,i,f]);return Q.useMemo(()=>n?{reference:p,trigger:p}:{},[n,p])}var Xn=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 it,this.restTimeout=new it,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Zn=new WeakMap;function Qn(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Zn.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Zn.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function $n(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Zn.get(n);a&&a!==e&&Qn(a),Qn(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Zn.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function er(e){let t=e.context.dataRef.current,n=A(()=>t.hoverInteractionState??Xn.create()).current;return t.hoverInteractionState||=n,se(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function tr(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,d=w(),f=oe(),p=er(a),m=u(),h=I(()=>Dt(l.current.openEvent?.type,p.interactedInside)),g=I(()=>Ot(l.current.openEvent?.type)),_=I(()=>{Qn(p)});V(()=>{o||(p.pointerType=void 0,p.restTimeoutPending=!1,p.interactedInside=!1,_())},[o,p,_]),Q.useEffect(()=>_,[_]),V(()=>{if(n&&o&&p.handleCloseOptions?.blockPointerEvents&&g()&&J(c)&&s){let e=c,t=s,n=M(s),r=d?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=p.pointerEventsScopeElement===t?null:p.pointerEventsScopeElement,a=r===t?null:r;return $n(p,{scopeElement:p.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{_()}}},[n,o,c,s,p,g,d,f,_]),Q.useEffect(()=>{if(!n)return;function e(){return!!(d&&f&&Te(d.nodesRef.current,f).length>0)}function t(e){let t=Tt(r,`close`,p.pointerType),n=()=>{a.setOpen(!1,X(H,e)),d?.events.emit(`floating.closed`,e)};t?p.openChangeTimeout.start(t,n):(p.openChangeTimeout.clear(),n())}function o(e){let t=Le(e);if(!Ve(t)){p.interactedInside=!1;return}p.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){p.openChangeTimeout.clear(),m.clear(),d?.events.off(`floating.closed`,v),_()}function u(n){if(e()&&d){d.events.on(`floating.closed`,v);return}if(Ge(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(d&&r&&J(o)&&Te(d.nodesRef.current,r,!1).some(e=>U(e.context?.elements.floating,o)))){if(p.handler){p.handler(n);return}_(),g()&&!h()&&t(n)}}function v(t){!d||!f||e()||m.start(0,()=>{d.events.off(`floating.closed`,v),a.setOpen(!1,X(H,t)),d.events.emit(`floating.closed`,t)})}let y=s;return j(y&&L(y,`mouseenter`,c),y&&L(y,`mouseleave`,u),y&&L(y,`pointerdown`,o,!0),()=>{d?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,g,h,_,p,d,f,m])}var nr={current:null};function rr(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=nr,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,_=w(l),v=er(m),y=Q.useRef(!1),b=x(i),S=x(r),C=x(o),T=x(n),E=x(p),D=x(f),O=I(()=>Dt(h.current.openEvent?.type,v.interactedInside)),k=I(()=>E.current?.()!==!1),A=I((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!U(e,t);if(!J(n))return!1;let i=n;return r.hasMatchingElement(e=>U(e,i))&&(!e||!U(e,i))}),N=I(()=>{v.handler&&=(M(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),P=I(()=>{Qn(v)});return u&&(v.handleCloseOptions=b.current?.__options),Q.useEffect(()=>N,[N]),Q.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===H,N(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,N]),Q.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Tt(S.current,`close`,v.pointerType);n?v.openChangeTimeout.start(n,()=>{m.setOpen(!1,X(H,e)),_?.events.emit(`floating.closed`,e)}):t&&(v.openChangeTimeout.clear(),m.setOpen(!1,X(H,e)),_?.events.emit(`floating.closed`,e))}let t=c.current??(u?m.select(`domReferenceElement`):null);if(!J(t))return;function r(e){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!Ne(v.pointerType))return;let t=Et(C.current),n=Tt(S.current,`open`,v.pointerType),r=Le(e),i=e.currentTarget??null,o=m.select(`domReferenceElement`),s=i;if(J(r)&&!m.context.triggerElements.hasElement(r)){for(let e of m.context.triggerElements.elements())if(U(e,r)){s=e;break}}J(i)&&J(o)&&!m.context.triggerElements.hasElement(i)&&U(i,o)&&(s=o);let c=s==null?!1:A(o,s,r),l=m.select(`open`),u=D.current?.()??m.select(`transitionStatus`)===`ending`,d=!l&&u&&y.current,f=!c&&J(s)&&J(o)&&U(o,s)&&d,p=t>0&&!n,h=c&&(l||d)||f,g=!l||c;if(h){k()&&m.setOpen(!0,X(H,e,s));return}p||(n?v.openChangeTimeout.start(n,()=>{g&&k()&&m.setOpen(!0,X(H,e,s))}):g&&k()&&m.setOpen(!0,X(H,e,s)))}function i(t){if(O()){P();return}N();let n=M(m.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let r=h.current.floatingContext??d?.();if(!Ge(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(){P(),N(),T.current&&!O()&&i===m.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,v.handler),v.handler(t);return}(v.pointerType!==`touch`||!U(m.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?j(L(t,`mousemove`,r,{once:!0}),L(t,`mouseenter`,r),L(t,`mouseleave`,i)):j(L(t,`mouseenter`,r),L(t,`mouseleave`,i))},[N,P,h,S,m,n,b,v,u,A,O,a,s,C,c,_,T,d,D,k]),Q.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=A(r,n,e.target);if(a&&!Ne(v.pointerType))return;if(i&&o&&v.handleCloseOptions?.blockPointerEvents){let e=m.select(`floatingElement`);e&&$n(v,{scopeElement:v.handleCloseOptions?.getScope?.()??n.ownerDocument.body,referenceElement:n,floatingElement:e})}let s=Et(C.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,O())return;let e=m.select(`open`);!v.blockMouseMove&&(!e||o)&&k()&&m.setOpen(!0,X(H,t,n))}v.pointerType===`touch`?xt.flushSync(()=>{c()}):o&&i?c():(v.restTimeoutPending=!0,v.restTimeout.start(s,c))}}},[n,v,O,A,a,m,C,k])}var ir=.1,ar=ir*ir,$=.5;function or(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function sr(e,t,n,r,i,a,o,s,c,l){let u=!1;return or(e,t,n,r,i,a)&&(u=!u),or(e,t,i,a,o,s)&&(u=!u),or(e,t,o,s,c,l)&&(u=!u),or(e,t,c,l,n,r)&&(u=!u),u}function cr(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function lr(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 ur(e={}){let{blockPointerEvents:t=!1}=e,n=new it,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*ar;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=Le(r),g=r.type===`mouseleave`,_=U(u,h),v=U(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&J(r.relatedTarget)&&U(u,r.relatedTarget))return;function y(){return!!(s&&Te(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=lr(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=lr(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=lr(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=lr(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!cr(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=sr(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=sr(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=sr(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=sr(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 dr={...he,disabled:b(e=>e.disabled),instantType:b(e=>e.instantType),isInstantPhase:b(e=>e.isInstantPhase),trackCursorAxis:b(e=>e.trackCursorAxis),disableHoverablePopup:b(e=>e.disableHoverablePopup),lastOpenChangeReason:b(e=>e.openChangeReason),closeOnClick:b(e=>e.closeOnClick),closeDelay:b(e=>e.closeDelay),hasViewport:b(e=>e.hasViewport)},fr=class e extends F{constructor(e,t,n=!1){let r=new Ye,i={...pr(),...e};i.floatingRootContext=De(r,t,n),super(i,{popupRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},dr)}setOpen=(e,t)=>{ye(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,X(ne,e))}static useStore(t,n){return m(t,(t,r)=>new e(n,t,r)).store}};function pr(){return{...ke(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var mr=le(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:f=null,children:p}=e,m=fr.useStore(l?.store,{open:n,openProp:r,activeTriggerId:f,triggerIdProp:u});Qe(m,r,n,f),m.useControlledProp(`openProp`,r),m.useControlledProp(`triggerIdProp`,u),m.useContextCallback(`onOpenChange`,s),m.useContextCallback(`onOpenChangeComplete`,c);let h=m.useState(`open`),g=!t&&h,_=m.useState(`activeTriggerId`),v=m.useState(`mounted`),y=m.useState(`payload`);m.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),m.useSyncedValue(`disabled`,t),d(m,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:b,transitionStatus:x}=ae(g,m),S=m.useState(`isInstantPhase`),C=m.useState(`instantType`),w=m.useState(`lastOpenChangeReason`),T=Q.useRef(null);V(()=>{h&&t&&m.setOpen(!1,X(ce))},[h,t,m]),V(()=>{x===`ending`&&w===`none`||x!==`ending`&&S?(C!==`delay`&&(T.current=C),m.set(`instantType`,`delay`)):T.current!==null&&(m.set(`instantType`,T.current),T.current=null)},[x,S,w,C,m]),V(()=>{g&&(_??m.set(`payload`,void 0))},[m,_,g]);let E=Q.useCallback(()=>{m.setOpen(!1,X(ue))},[m]);Q.useImperativeHandle(o,()=>({unmount:b,close:E}),[b,E]);let D=g||v||!t&&a!==`none`;return(0,Z.jsxs)(St.Provider,{value:m,children:[D&&(0,Z.jsx)(hr,{store:m,disabled:t,trackCursorAxis:a}),typeof p==`function`?p({payload:y}):p]})});function hr({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=E(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=Ft(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n});return _(e,{activeTriggerProps:Q.useMemo(()=>de(a.reference,i.reference),[a.reference,i.reference]),inactiveTriggerProps:Q.useMemo(()=>de(a.trigger,i.trigger),[a.trigger,i.trigger]),popupProps:Q.useMemo(()=>de(tt,a.floating,i.floating),[a.floating,i.floating])}),null}var gr=Q.createContext(void 0);function _r(){return Q.useContext(gr)}var vr=function(e){return e[e.popupOpen=Se.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),yr=`data-base-ui-tooltip-trigger`;function br(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(J(n))return n}}let t=e.target;return J(t)?t:null}function xr(e){let t=e;for(;t;){if(t.hasAttribute(yr))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&J(n.host)?n.host:null}return null}var Sr=C(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:d,id:f,...p}=e,m=Ct(!0),h=a?.store??m;if(!h)throw Error(T(82));let g=Je(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`isOpenedByTrigger`,g),y=h.useState(`floatingRootContext`),b=Q.useRef(null),S=c??600,C=d??0,{registerTrigger:w,isMountedByThisTrigger:E}=P(g,b,h,{payload:o,closeOnClick:l,closeDelay:C}),D=_r(),{delayRef:O,isInstantPhase:k,hasProvider:A}=Mt(y,{open:v}),j=er(y);h.useSyncedValue(`isInstantPhase`,k);let M=h.useState(`disabled`),N=s??M,ee=x(N),te=h.useState(`trackCursorAxis`),F=h.useState(`disableHoverablePopup`),I=Q.useRef(!1),ne=u(),re=Q.useRef(void 0);function L(){let e=D?.delay,t=typeof O.current==`object`?O.current.open:void 0,n=S;return A&&(n=t===0?0:c??e??S),n}function R(e){let t=b.current;if(!t||!e)return!1;let n=xr(e);return n!==null&&n!==t&&U(t,n)}function ie(e){let t=R(e);return I.current=t,t&&(j.openChangeTimeout.clear(),j.restTimeout.clear(),j.restTimeoutPending=!1,ne.clear()),t}let ae=rr(y,{enabled:!N,mouseOnly:!0,move:!1,handleClose:!F&&te!==`both`?ur():null,restMs:L,delay(){let e=typeof O.current==`object`?O.current.close:void 0,t=C;return d==null&&A&&(t=e),{close:t}},triggerElementRef:b,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!I.current}}),z=Yn(y,{enabled:!N}).reference,B=e=>{let t=I.current,n=br(e),r=ie(n),i=b.current,a=i&&n&&U(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,X(H,e));return}if(t&&!r&&a&&!ee.current&&!h.select(`open`)&&i&&Ne(re.current)){let t=()=>{!I.current&&!ee.current&&!h.select(`open`)&&h.setOpen(!0,X(H,e,i))},n=L();n===0?(ne.clear(),t()):ne.start(n,t)}},V=h.useState(`triggerProps`,E);return pe(`button`,e,{state:{open:v},ref:[t,w,b],props:[ae,z,E||te!==`none`?V:void 0,{onMouseOver(e){B(e.nativeEvent)},onFocus(e){R(br(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){I.current=!1,ne.clear(),re.current=void 0},onPointerEnter(e){re.current=e.pointerType},onPointerDown(e){re.current=e.pointerType,h.set(`closeOnClick`,l),l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},id:g,[vr.triggerDisabled]:N?``:void 0,[yr]:N?void 0:``},p],stateAttributesMapping:Re})}),Cr=Q.createContext(void 0);function wr(){let e=Q.useContext(Cr);if(e===void 0)throw Error(T(70));return e}var Tr=Q.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=S({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Z.jsxs)(Q.Fragment,{children:[l,c&&xt.createPortal(n,c)]})}),Er=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Ct().useState(`mounted`)||n?(0,Z.jsx)(Cr.Provider,{value:n,children:(0,Z.jsx)(Tr,{ref:t,...r})}):null}),Dr=Q.createContext(void 0);function Or(){let e=Q.useContext(Dr);if(e===void 0)throw Error(T(71));return e}var kr=Q.createContext(void 0);function Ar(){return Q.useContext(kr)?.direction??`ltr`}var jr=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`}=q(e,t)||{};if(l==null)return{};let f=p(u),m={x:n,y:r},h=Oe(i),g=Ze(h),_=await o.getDimensions(l),v=h===`y`,y=v?`top`:`left`,b=v?`bottom`:`right`,x=v?`clientHeight`:`clientWidth`,S=a.reference[g]+a.reference[h]-m[h]-a.floating[g],C=m[h]-a.reference[h],w=d===`real`?await o.getOffsetParent?.(l):s.floating,T=s.floating[x]||a.floating[g];(!T||!await o.isElement?.(w))&&(T=s.floating[x]||a.floating[g]);let E=S/2-C/2,D=T/2-_[g]/2-1,O=Math.min(f[y],D),k=Math.min(f[b],D),A=O,j=T-_[g]-k,M=T/2-_[g]/2+E,N=Ce(A,M,j),P=!c.arrow&&je(i)!=null&&M!==N&&a.reference[g]/2-(M<A?O:k)-_[g]/2<0,ee=P?M<A?M-A:M-j:0;return{[h]:m[h]+ee,data:{[h]:N,centerOffset:M-N-ee,...P&&{alignmentOffset:ee}},reset:P}}}),Mr=(e,t)=>({...jr(e),options:[e,t]}),Nr=Gn().fn,Pr={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 Nr(e)).data?.referenceHidden||a}}}},Fr={sideX:`left`,sideY:`top`},Ir={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=R(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:Fr};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=M(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=Y(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`:Fr.sideX,g=f===`top`?`bottom`:Fr.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Lr(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 Rr(e,t,n){let{rects:r,placement:i}=e;return{side:Lr(t,Y(i),n),align:je(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function zr(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:S}=e,[C,w]=Q.useState(null);!h&&C!==null&&w(null);let T=g.side||`flip`,E=g.align||`flip`,D=g.fallbackAxisSide||`end`,O=typeof t==`function`?t:void 0,k=I(O),A=O?k:t,j=x(t),N=x(h),P=Ar()===`rtl`,ee=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":P?`left`:`right`,"inline-start":P?`right`:`left`}[r],te=a===`center`?ee:`${ee}-${a}`,F=c,ne=+(r===`bottom`),re=+(r===`top`),L=+(r===`right`),ie=+(r===`left`);typeof F==`number`?F={top:F+ne,right:F+ie,bottom:F+re,left:F+L}:F&&={top:(F.top||0)+ne,right:(F.right||0)+ie,bottom:(F.bottom||0)+re,left:(F.left||0)+L};let ae={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},z=Q.useRef(null),oe=x(i),se=x(o),ce=typeof i==`function`?0:i,le=typeof o==`function`?0:o,ue=[];f&&ue.push(f),ue.push(Bn(e=>{let t=Rr(e,r,P),n=typeof oe.current==`function`?oe.current(t):oe.current,i=typeof se.current==`function`?se.current(t):se.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[ce,le,P,r]));let de=E===`none`&&T!==`shift`,fe=!de&&(l||_||T===`shift`),pe=T===`none`?null:Un({...ae,padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!_&&T===`flip`,crossAxis:E===`flip`?`alignment`:!1,fallbackAxisSideDirection:D}),me=de?null:Vn(e=>{let t=M(e.elements.floating).documentElement;return{...ae,rootBoundary:_?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:E!==`none`,crossAxis:fe,limiter:l||_?void 0:Hn(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=B(Y(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[ae,l,_,F,E]);T===`shift`||E===`shift`||a===`center`?ue.push(me,pe):ue.push(pe,me),ue.push(Wn({...ae,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!N.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=R(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`)}}),Mr(e=>({element:z.current||M(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=Y(a),l=B(c),u=z.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(Rr(e,r,P)):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`,fe&&l===`y`&&b?S:x),{}}},Pr,y),V(()=>{!h&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,m]);let H=Q.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:he,elements:ge,x:_e,y:ve,middlewareData:ye,update:be,placement:xe,context:U,isPositioned:Se,floatingStyles:Ce}=qn({rootContext:m,open:p?h:void 0,placement:te,middleware:ue,strategy:n,whileElementsMounted:p?void 0:(...e)=>En(...e,H),nodeId:v,externalTree:S}),{sideX:we,sideY:Te}=ye.adaptiveOrigin||Fr,Ee=Se?n:`fixed`,W=Q.useMemo(()=>{let e=y?{position:Ee,[we]:_e,[Te]:ve}:{position:Ee,...Ce};return Se||(e.opacity=0),e},[y,Ee,we,_e,Te,ve,Ce,Se]),De=Q.useRef(null);V(()=>{if(!h)return;let e=j.current,t=typeof e==`function`?e():e,n=(Br(t)?t.current:t)||null;n!==De.current&&(he.setPositionReference(n),De.current=n)},[h,he,A,j]),Q.useEffect(()=>{if(!h)return;let e=j.current;typeof e!=`function`&&Br(e)&&e.current!==De.current&&(he.setPositionReference(e.current),De.current=e.current)},[h,he,A,j]),Q.useEffect(()=>{if(p&&h&&ge.reference&&ge.floating)return En(ge.reference,ge.floating,be,H)},[p,h,ge,be,H]);let G=Y(xe),Oe=Lr(r,G,P),ke=je(xe)||`center`,Ae=!!ye.hide?.referenceHidden;V(()=>{b&&h&&Se&&w(G)},[b,h,Se,G]);let Me=Q.useMemo(()=>({position:`absolute`,top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Ne=ye.arrow?.centerOffset!==0;return Q.useMemo(()=>({positionerStyles:W,arrowStyles:Me,arrowRef:z,arrowUncentered:Ne,side:Oe,align:ke,physicalSide:G,anchorHidden:Ae,refs:he,context:U,isPositioned:Se,update:be}),[W,Me,z,Ne,Oe,ke,G,Ae,he,U,Se,be])}function Br(e){return e!=null&&`current`in e}function Vr(e){return e===`starting`?k:we}function Hr(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),pe(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Vr(r),i],stateAttributesMapping:Ee})}var Ur=Q.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=O,style:g,..._}=e,v=Ct(),y=wr(),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=zr({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`)?Ir:void 0}),k=Hr(e,Q.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,Z.jsx)(Dr.Provider,{value:D,children:k})}),Wr={...Ee,...Me},Gr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Ct(),{side:s,align:c}=Or(),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`);Pe({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),tr(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return pe(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[f,Vr(d),a],stateAttributesMapping:Wr})}),Kr=a({method:`GET`}).handler(i(`aa46310016bb8a58b273a648ffd498c87f1f450d12827e30110a3b83ba6a27d9`)),qr=a({method:`POST`}).handler(i(`ed679b4e1e05e903a5d4ba4a70d9b9d883991ab22ed59b4d2d69078941818415`)),Jr=a({method:`GET`}).handler(i(`169566e7637a22599b4eb32ee3775574e99677406922bbef7482a102036c33dd`)),Yr=a({method:`POST`}).handler(i(`27d7eba0b6a2257949392fdd56057275a5c5366484ae01faf3b5897a225ecd83`)),Xr=a({method:`POST`}).handler(i(`a6384dc7154d9930422d29396f5de64b3ac69c62ad3824bc4a22d745fc07b293`));function Zr(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}var Qr=16,$r=`rounded-[4px]`,ei=`h-5 w-[18px] shrink-0 ${$r}`;function ti({run:e,onClick:t}){let n=e.error||e.message||``,r=e.durationMs?` · ${at(e.durationMs)}`:``;return(0,Z.jsxs)(mr,{children:[(0,Z.jsx)(Sr,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},"aria-label":ct(e),className:`${ei} cursor-pointer transition-opacity hover:opacity-70`,style:{background:vt(e),...e.running?ut:{}}})}),(0,Z.jsx)(Er,{children:(0,Z.jsx)(Ur,{sideOffset:8,children:(0,Z.jsxs)(Gr,{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,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,Z.jsx)(`span`,{className:`size-2 shrink-0 rounded-[2px]`,style:{background:vt(e)}}),ct(e),(0,Z.jsxs)(`span`,{className:`ml-auto whitespace-nowrap pl-3 font-mono text-caption font-normal text-secondary`,children:[_t(e.ts),r]})]}),n&&(0,Z.jsx)(`div`,{className:`mt-1.5 max-h-[150px] overflow-hidden whitespace-pre-wrap ${e.error?`text-accent`:`text-secondary`}`,children:n})]})})})]})}function ni({count:e,onClick:t,loading:n}){return e?(0,Z.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 ${$r} ${n?`animate-pulse`:`cursor-pointer`}`,title:`${e} more - click to reveal`,children:n?`…`:e}):null}function ri({job:e,runs:t,total:n,onLoadMore:r,onPickRun:i}){let a=t,o=e.enabled,s=st(e),c=a.length,l=Math.max(0,n-c),u=yt(),[d,f]=(0,Q.useState)(-1),[p,m]=(0,Q.useState)(!1),h=Math.max(0,c-16),g=d<0?h:Math.min(d,h),_=Math.min(g+16,c),v=a.slice(g,_),y=l+g,b=c-_,x=b===0,S=async()=>{let e=g-Qr;if(e<0&&l>0&&!p){m(!0);let e=await r().catch(()=>0);m(!1),f(Math.max(0,g+e-Qr));return}f(Math.max(0,e))},C=()=>{let e=g+Qr;f(e>=h?-1:e)},w=!!(e.running||e.queued)&&x,T=x&&o&&!s&&!!e.nextRun&&!w;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[3px] overflow-x-auto`,children:[(0,Z.jsx)(ni,{count:y,onClick:S,loading:p}),v.map(e=>(0,Z.jsx)(ti,{run:e,onClick:()=>i(e)},e.id)),T?(0,Z.jsxs)(`div`,{className:`ml-1 flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-12 border-t border-dashed border-wire`}),(0,Z.jsx)(`span`,{className:`size-[11px] shrink-0 rounded-full border border-wire`,title:u?`Next scheduled run · ${_t(e.nextRun)}`:void 0}),(0,Z.jsx)(`span`,{className:`text-caption text-disabled`,children:u?ot(e.nextRun):``})]}):!x&&(0,Z.jsx)(ni,{count:b,onClick:C})]})}function ii(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 ai(e){let t=/^\s*v?(\d+)\.(\d+)\.(\d+)/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function oi(e){return/^\s*v?\d+\.\d+\.\d+-/.test(e)}function si(e,t){if(!e||!t)return!1;let n=ai(e),r=ai(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 oi(e)&&!oi(t)}function ci(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 li(e,t){let n=`${e} daemon restart`;return t?n:`npm install -g @kky42/pievo@latest && ${n}`}function ui(e,t,n){return ci(typeof window<`u`?window.location.origin:`http://127.0.0.1:3000`,e,t,n)}function di({text:e}){let[t,n]=(0,Q.useState)(!1);return(0,Z.jsx)(`button`,{className:mt,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1400)},children:t?`Copied ✓`:`Copy`})}function fi({open:e,onClose:t,teamId:n}){let[r,i]=(0,Q.useState)([]),[a,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(!e){h(null);return}let t=!0;return _(null),y(!1),o().then(e=>{t&&_(e)}).catch(()=>{t&&y(!0)}),()=>{t=!1}},[e]);let b=(0,Q.useCallback)(async()=>{try{i(await Kr({data:n}))}catch{}},[n]),x=(0,Q.useRef)(e);x.current=e,(0,Q.useEffect)(()=>{if(!e||a)return;b();let t=setInterval(()=>x.current&&void b(),3e3);return()=>clearInterval(t)},[e,a,b]),(0,Q.useEffect)(()=>{if(!a)return;let e=!0,t=async()=>{let t=await Jr({data:a.id}).catch(()=>void 0);!e||t===void 0||(l(t),t?.online&&t.hostname&&d(e=>e||t.hostname||``))};t();let n=setInterval(t,2e3);return()=>{e=!1,clearInterval(n)}},[a]);async function S(){p(!0),h(null);try{let e=await qr({data:n});if(`error`in e){h(e.error);return}l(null),d(``),s(e)}finally{p(!1)}}async function C(){a&&await Xr({data:a.id}),s(null),l(null),await b()}async function w(){a&&u.trim()&&await Yr({data:{id:a.id,name:u.trim()}}),s(null),l(null),await b()}async function T(e){h(null);let t=await Xr({data:e});if(!t.ok){h(t.error??`Could not delete this machine.`),await b();return}await b()}let E=!!c?.online;return a?(0,Z.jsxs)(qe,{open:e,onClose:C,children:[(0,Z.jsx)(Be,{title:E?`Computer connected`:`Connect computer`}),E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mt-5 flex items-center gap-3 rounded-control border border-hairline bg-success-soft px-4 py-3`,children:[(0,Z.jsx)(`span`,{className:`text-xl text-success`,children:`✓`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-[15px] font-medium text-display`,children:`Computer connected successfully!`}),(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[c?.hostname??`unknown`,c?.platform?` - ${c.platform} ${c.arch??``}`:``]})]})]}),(0,Z.jsxs)(`div`,{className:`mt-5`,children:[(0,Z.jsx)(`label`,{className:pt,children:`Computer name`}),(0,Z.jsx)(`input`,{className:ht,value:u,onChange:e=>d(e.target.value),placeholder:c?.hostname??`My computer`}),(0,Z.jsx)(`div`,{className:`mt-1 text-label text-secondary`,children:`A friendly name for this computer.`})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mt-5 text-body font-medium text-display`,children:`Run this command on your computer to connect:`}),g?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,Z.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:ui(a.token,g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:ui(a.token,g.pievoCli,g.customCli)})]}):(0,Z.jsx)(`div`,{className:`mt-2 text-body text-secondary`,children:v?`Could not load the connection command. Close and try again.`:`Loading connection command…`}),(0,Z.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,Z.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 animate-pulse rounded-full bg-rubik-orange`}),(0,Z.jsx)(`span`,{className:`text-[14px] font-medium text-warn`,children:`Waiting for computer to connect…`})]})]}),(0,Z.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,Z.jsx)(`button`,{className:mt,onClick:()=>void C(),children:`Cancel`}),(0,Z.jsx)(`button`,{className:ft,disabled:!E||!u.trim(),onClick:()=>void w(),children:`Done`})]})]}):(0,Z.jsxs)(qe,{open:e,onClose:t,children:[(0,Z.jsx)(Be,{title:`Machines`,sub:`Each machine runs a pievo daemon that executes your loops via your local coding agent.`}),(0,Z.jsx)(We,{children:`Connected machines`}),m&&(0,Z.jsx)(gt,{message:m,onDismiss:()=>h(null)}),r.length===0&&(0,Z.jsx)(`div`,{className:`py-3 text-body text-secondary`,children:`No machines yet.`}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2`,children:r.map(e=>{let t=ii(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 ${dt(e.lastSeen)}`:``}`:e.lastSeen?`offline · seen ${dt(e.lastSeen)}`:`offline`;return(0,Z.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-control border border-hairline bg-surface px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${n}`,title:t}),(0,Z.jsx)(`span`,{className:`text-[15px] font-medium text-display`,children:e.name}),(0,Z.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,Z.jsx)(`button`,{className:lt,disabled:e.loopCount>0,title:e.loopCount>0?`Delete its loops first`:void 0,onClick:()=>void T(e.id),children:`Delete`})]}),(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:bt(e.daemonProtocol).label}),e.daemonProtocol!==2&&(0,Z.jsx)(`div`,{className:`text-label text-accent`,children:`Daemon upgrade required to stop a running process`}),!e.online&&!e.token&&(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:`Reconnect command available from the machine owner's account.`}),!e.online&&e.token&&!g&&(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:v?`Could not load the reconnect command. Close and try again.`:`Loading reconnect command…`}),!e.online&&e.token&&g&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer select-none text-label font-medium text-secondary marker:content-[''] hover:text-display`,children:`Reconnect command`}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,Z.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:ui(e.token,g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:ui(e.token,g.pievoCli,g.customCli)})]})]}),si(e.daemonVersion,e.latestDaemonVersion)&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[`daemon v`,e.daemonVersion,` · upgrade available (v`,e.latestDaemonVersion,`)`]}),g?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.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:li(g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:li(g.pievoCli,g.customCli)})]}):(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:v?`Could not load the upgrade command. Close and try again.`:`Loading upgrade command…`})]})]},e.id)})}),(0,Z.jsx)(`div`,{className:`mt-6`,children:(0,Z.jsx)(`button`,{className:ft,disabled:f,onClick:()=>void S(),children:f?`Preparing…`:`+ Connect computer`})})]})}var pi=a({method:`GET`}).handler(i(`ced5641f28e3e64d3b8773ea4c875b78ee305bd08caba90a2207e86ef1ab3327`)),mi=a({method:`POST`}).handler(i(`d6cb1ea6f7fdaf940fbbe91d6b0898a0d5ac2308f8bc572dc3b856824a1f4581`)),hi=a({method:`POST`}).handler(i(`9defc1b5d0f4316d61621e2c4614a70dc052ad6b7a3aa2ead00836f7d5cb5b4c`)),gi=a({method:`POST`}).handler(i(`a4e3ae06af7087a3dc291236cf6d5ad272e2f754884c1f948e75a18a4ebada93`));export{tr as _,fi as a,Kr as c,zr as d,Ir as f,rr as g,ur as h,gi as i,Hr as l,gr as m,hi as n,ri as o,Ar as p,pi as r,Zr as s,mi as t,Vr as u,Yn as v,jt as y};
|