@kky42/pievo-server 2.2.0 → 2.3.0
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-BTXoqfzM.js → LoopView-DjVHUyrR.js} +1 -1
- package/.output/public/assets/{Modal-Ba36NAkv.js → Modal-CCRvx959.js} +1 -1
- package/.output/public/assets/{SignIn-Cc1zxGnA.js → SignIn-Qxw5zDFq.js} +1 -1
- package/.output/public/assets/{actionUi-DDDfD0WX.js → actionUi-CXxhzYe2.js} +1 -1
- package/.output/public/assets/{index-BGM1XGY0.js → index-BRN_CQ8U.js} +4 -4
- package/.output/public/assets/{invite._token-CUCNcN89.js → invite._token-BIxr8DlP.js} +1 -1
- package/.output/public/assets/{invite._token-C3t4JfAY.js → invite._token-j2BTCeG1.js} +1 -1
- package/.output/public/assets/lifecycleUi-Qy_8beQK.js +1 -0
- package/.output/public/assets/{loops._loopId-CrSSvSVl.js → loops._loopId-BRBQzioy.js} +3 -3
- package/.output/public/assets/{loops._loopId_.runs._runId-B5Qacloe.js → loops._loopId_.runs._runId-CMnOJkem.js} +2 -2
- package/.output/public/assets/{notifyFns-CYiZT7CK.js → notifyFns-DYD4EKaG.js} +1 -1
- package/.output/public/assets/{routes-DsdcURfk.js → routes-3nuEJGdo.js} +1 -1
- package/.output/public/assets/{routes-B6Kg4mFC.js → routes-DORLim-C.js} +1 -1
- package/.output/public/assets/{t._teamId-Cmm4xdKj.js → t._teamId-F5f4K8kd.js} +1 -1
- package/.output/public/assets/{t._teamId-C9uEyAh_.js → t._teamId-XfE_S1Fo.js} +1 -1
- package/.output/public/assets/ui-Dhsx6SW0.js +1 -0
- package/.output/server/_ssr/{DashboardView-0yoKh8Em.mjs → DashboardView-BF7PciP7.mjs} +9 -6
- package/.output/server/_ssr/{LoopPlaybook-uq_sFfgU.mjs → LoopPlaybook-DC7QVvPY.mjs} +2 -2
- package/.output/server/_ssr/{LoopView-BlOY-jfJ.mjs → LoopView-DwSrm9Ja.mjs} +4 -4
- package/.output/server/_ssr/{Modal-Bc_5TYGr.mjs → Modal-MaCG52Pv.mjs} +2 -2
- package/.output/server/_ssr/{SignIn-C4fSJl_j.mjs → SignIn-RmpWm9uy.mjs} +3 -3
- package/.output/server/_ssr/{actionUi-BKF6xI3d.mjs → actionUi-BN55TNYE.mjs} +2 -2
- package/.output/server/_ssr/{adapters-RReIIwAx.mjs → adapters-BoLkOf1T.mjs} +12 -6
- package/.output/server/_ssr/{artifactFiles-C8PQKN6V.mjs → artifactFiles-BCaIIrrT.mjs} +3 -3
- package/.output/server/_ssr/artifacts-jQ-bfdhI.mjs +2 -0
- package/.output/server/_ssr/{auth-Sie6sQHF.mjs → auth-30Z4lV1w.mjs} +9 -9
- package/.output/server/_ssr/{boot-akwC2sQg.mjs → boot-3BNKujyp.mjs} +75 -26
- package/.output/server/_ssr/{boot-pVS0wjd0.mjs → boot-CsEFT53K.mjs} +1 -1
- package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-CLY8cORt.mjs → bun-sqlite-dialect-BW9W1_Ps-_7tfuNRi.mjs} +2 -2
- package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-CRsXQNRe.mjs → d1-sqlite-dialect-BLC8LXE6-ucDUbeBk.mjs} +2 -2
- package/.output/server/_ssr/db-CXownd1H.mjs +2 -0
- package/.output/server/_ssr/{dist-Cc_x6bBb.mjs → dist-Cd6nlLlO.mjs} +2 -2
- package/.output/server/_ssr/{factory-CDwHL_zY.mjs → factory-CWWwV7XZ.mjs} +2 -2
- package/.output/server/_ssr/{invite._token-BE_QUAVb.mjs → invite._token-BKlz0R2f.mjs} +4 -4
- package/.output/server/_ssr/{invite._token-BlbVjz-o.mjs → invite._token-CWl6kipD.mjs} +2 -2
- package/.output/server/_ssr/{invite._token-C7GjrJxr.mjs → invite._token-SdWXemIc.mjs} +5 -5
- package/.output/server/_ssr/{kysely-adapter-zflsyYBA.mjs → kysely-adapter-C8iS51DB.mjs} +1 -1
- package/.output/server/_ssr/{lifecycleUi-Djb44Aj3.mjs → lifecycleUi-DgBQAYzp.mjs} +2 -1
- package/.output/server/_ssr/logger-Gy-47z3k.mjs +2 -0
- package/.output/server/_ssr/{loopApi-JzmqWENY.mjs → loopApi-ABi9SgWS.mjs} +12 -12
- package/.output/server/_ssr/{loops._loopId-DZ-FjscA.mjs → loops._loopId-SON_t43g.mjs} +3 -3
- package/.output/server/_ssr/{loops._loopId-D-aCCtrX.mjs → loops._loopId-p1KWsvMM.mjs} +10 -10
- package/.output/server/_ssr/{loops._loopId_.runs._runId-rBHW41dx.mjs → loops._loopId_.runs._runId-PUGBrD5q.mjs} +14 -8
- package/.output/server/_ssr/{loops._loopId_.runs._runId-Dk1QY49p.mjs → loops._loopId_.runs._runId-Ymy4lwee.mjs} +3 -3
- package/.output/server/_ssr/{machineFns-CoqLRLRh.mjs → machineFns-BZ9puxDt.mjs} +3 -3
- package/.output/server/_ssr/{node-sqlite-dialect-dmrazfbM.mjs → node-sqlite-dialect-D_3JmkMo.mjs} +2 -2
- package/.output/server/_ssr/{notifyFns-CH7-bcmd.mjs → notifyFns-BUCePuF3.mjs} +3 -3
- package/.output/server/_ssr/{notifyFns-DXMbgYu2.mjs → notifyFns-DuPR1zd7.mjs} +5 -5
- package/.output/server/_ssr/{router-BFPzSTFx.mjs → router-Czxvra6l.mjs} +38 -32
- package/.output/server/_ssr/{routes-DebVUmCS.mjs → routes-ClZEdsnB.mjs} +5 -5
- package/.output/server/_ssr/{routes-Bx0bRxt9.mjs → routes-ComqHvCL.mjs} +2 -2
- package/.output/server/_ssr/{routes-dQCBLTxY.mjs → routes-D5jJJ-30.mjs} +5 -5
- package/.output/server/_ssr/runDiff--qLtU4FI.mjs +2 -0
- package/.output/server/_ssr/ssr.mjs +49 -49
- package/.output/server/_ssr/store-40eVzW1S.mjs +2 -0
- package/.output/server/_ssr/{t._teamId-BzWy4Ft2.mjs → t._teamId-BgHV_KFP.mjs} +5 -5
- package/.output/server/_ssr/{t._teamId-D9nCEa2h.mjs → t._teamId-DDERNgfn.mjs} +2 -2
- package/.output/server/_ssr/{t._teamId-BqOUF-0J.mjs → t._teamId-DRJvKHZn.mjs} +5 -5
- package/.output/server/_ssr/{teamFns-BcnGMC-g.mjs → teamFns-Bp81UO-x.mjs} +3 -3
- package/.output/server/_ssr/tokens-CbfoRC_s.mjs +2 -0
- package/.output/server/_ssr/{ui-B6mE5-5v.mjs → ui-Ww2tTM2u.mjs} +9 -2
- package/.output/server/{_tanstack-start-manifest_v-COr27bxK.mjs → _tanstack-start-manifest_v-DwKENYCN.mjs} +25 -25
- package/.output/server/index.mjs +100 -100
- package/package.json +1 -1
- package/.output/public/assets/lifecycleUi-CMFw5Nlj.js +0 -1
- package/.output/public/assets/ui-Gb1413-F.js +0 -1
- package/.output/server/_ssr/artifacts-B_F6vSih.mjs +0 -2
- package/.output/server/_ssr/db-Bdm9PFZF.mjs +0 -2
- package/.output/server/_ssr/logger-tfiliKTi.mjs +0 -2
- package/.output/server/_ssr/runDiff-qA1C8R_L.mjs +0 -2
- package/.output/server/_ssr/store-DWUdkIq2.mjs +0 -2
- package/.output/server/_ssr/tokens-DG8z1GIg.mjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{a as r,c as i,p as a}from"./preload-helper-DFkkpP6W.js";import{l as o}from"./ui-
|
|
1
|
+
import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{a as r,c as i,p as a}from"./preload-helper-DFkkpP6W.js";import{l as o}from"./ui-Dhsx6SW0.js";import{c as s,n as c,s as l}from"./index-BRN_CQ8U.js";import{t as u}from"./SignIn-Qxw5zDFq.js";var d=t(e()),f=n();function p({children:e}){return(0,f.jsxs)(`div`,{className:`mx-auto mt-32 max-w-sm text-center`,children:[(0,f.jsx)(r,{size:52}),(0,f.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold tracking-tight text-display`,children:`Team invite`}),e]})}function m(){let e=c.useLoaderData(),{data:t,isPending:n}=i(),r=a(),[m,h]=(0,d.useState)(`idle`),[g,_]=(0,d.useState)(null),v=(0,d.useRef)(!1),y=e.auth.enabled,b=y?!!t:!1;return(0,d.useEffect)(()=>{!y||n||!b||v.current||(v.current=!0,h(`redeeming`),(async()=>{let t=await l({data:e.token});if(t.ok){s(t.teamId),r({to:`/t/$teamId`,params:{teamId:t.teamId}});return}_(t.error),h(`error`)})())},[y,n,b,e.token,r]),y?!n&&!b?(0,f.jsx)(u,{callbackURL:`/invite/${e.token}`}):m===`error`?(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-3 text-sm text-accent`,children:g}),(0,f.jsx)(`button`,{className:`${o} mt-6`,onClick:()=>void r({to:`/`}),children:`Go to the dashboard`})]}):(0,f.jsx)(p,{children:(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`Joining the team…`})}):(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`This Pievo server runs in open mode (a single shared workspace), so team invites don't apply here.`}),(0,f.jsx)(`button`,{className:`${o} mt-6`,onClick:()=>void r({to:`/`}),children:`Go to the dashboard`})]})}export{m as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-CXxhzYe2.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't open this invite.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.";function t(e){if(e.deleteRequestedAt!=null)return`deleting`;let t=e.runs.find(e=>e.running);return!e.enabled&&t?.cancelRequested?`stopping`:!e.enabled&&(e.running||t)?`paused-finishing`:e.enabled?`active`:`paused`}function n(e){return e===3?{supported:!0,label:`Daemon protocol 3 · Stop supported`}:{supported:!1,label:`Daemon protocol ${e??`unknown`} · upgrade required`}}function r(n){let r=t(n.summary);if(n.summary.queued&&n.summary.reconciliationBlocking)return n.machine.presence===`online`?`Queued · machine is checking an interrupted run`:`Queued · waiting for machine recovery`;let i=n.summary.runs.find(e=>e.running);if(i&&n.machine.daemonProtocol!==3)return e;if(r===`stopping`&&i&&!n.machine.online)return`Stopping · waiting for ${n.machine.name||`machine`}`;switch(r){case`deleting`:return`Deleting`;case`stopping`:return`Stopping`;case`paused-finishing`:return n.summary.pauseCause?.kind===`blocked`?`Paused — blocked · current run finishing`:n.summary.pauseCause?.kind===`owner`?`Paused by owner · current run finishing`:`Paused · current run finishing`;case`paused`:return n.summary.pauseCause?.kind===`blocked`?`Paused — blocked`:n.summary.pauseCause?.kind===`failure-streak`?`Paused automatically`:n.summary.pauseCause?.kind===`owner`?`Paused by owner`:`Paused`;case`active`:return`Active`}}export{r as i,n,t as r,e as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeField-dOzyFQNH.js","assets/jsx-runtime-BseJUIpC.js","assets/LoopView-
|
|
2
|
-
import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{C as r,S as i,b as a,d as o,g as s,i as c,o as ee,r as l,v as u,x as d,y as te}from"./loopApi-CT1mMhlb.js";import{c as f,f as p,p as ne,t as re}from"./preload-helper-DFkkpP6W.js";import{a as ie,o as ae,r as oe,s as se}from"./notifyFns-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeField-dOzyFQNH.js","assets/jsx-runtime-BseJUIpC.js","assets/LoopView-DjVHUyrR.js","assets/Modal-CCRvx959.js","assets/loopApi-CT1mMhlb.js","assets/ui-Dhsx6SW0.js","assets/artifactView-Cd5wWPil.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,S as i,b as a,d as o,g as s,i as c,o as ee,r as l,v as u,x as d,y as te}from"./loopApi-CT1mMhlb.js";import{c as f,f as p,p as ne,t as re}from"./preload-helper-DFkkpP6W.js";import{a as ie,o as ae,r as oe,s as se}from"./notifyFns-DYD4EKaG.js";import{A as ce,D as le,M as ue,S as m,T as de,_ as h,b as fe,c as pe,d as g,g as me,i as he,j as _,l as ge,m as v,n as _e,o as y,p as b,r as x,s as ve,t as ye,v as S,w as C,x as be}from"./ui-Dhsx6SW0.js";import{i as xe,n as Se,r as Ce,t as we}from"./lifecycleUi-Qy_8beQK.js";import{c as Te,r as w}from"./index-BRN_CQ8U.js";import{a as T,i as Ee,n as E,o as D,t as O}from"./artifactView-Cd5wWPil.js";import{t as De}from"./SignIn-Qxw5zDFq.js";import{i as Oe,n as ke,r as Ae,t as je}from"./actionUi-CXxhzYe2.js";var k=t(e(),1);function Me(e){if(!e)return null;let t=e.replace(/\\/g,`/`).replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):null}function Ne({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
3
|
`)}var A=n(),j=e=>e.split(`/`).pop()||e;function M(e){let t=e.match(/\.([a-z0-9]+)$/i);return t?t[1].toLowerCase():`file`}function Pe({loopId:e,taskFile:t,taskFileContent:n,taskFileSyncedAt:r,running:i}){let[a,o]=(0,k.useState)(null),[s,c]=(0,k.useState)(null),l=(0,k.useRef)(0),u=(0,k.useCallback)(async()=>{let t=++l.current;try{let n=await ee({data:{loopId:e}});t===l.current&&o(n)}catch{t===l.current&&o(e=>e??[])}},[e]);(0,k.useEffect)(()=>{o(null),c(null),u()},[e,u]),(0,k.useEffect)(()=>{let e=setInterval(()=>void u(),i?4e3:12e3);return()=>clearInterval(e)},[i,u]);let d=(0,k.useMemo)(()=>T(t,a??[]),[t,a]),te=s&&d.some(e=>e.path===s)?s:d[0]?.path??null,f=d.find(e=>e.path===te)??null,p=D(f);return(0,A.jsxs)(`section`,{id:`files`,className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`mb-2.5 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:[(0,A.jsxs)(`h2`,{className:`text-label font-semibold text-secondary`,children:[`Files`,a?` (${d.length})`:``]}),(0,A.jsx)(`span`,{className:`text-caption font-medium text-disabled`,children:`Spec + synced artifacts`})]}),d.length===0?(0,A.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,A.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,A.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,A.jsx)(`ul`,{className:`py-1.5`,children:d.map(e=>{let t=e.path===te,n=D(e),r=!n&&e.kind===`artifact`?e.file.meta:null,i=r?.title?.trim()||``,a=i&&i!==j(e.path)?i:j(e.path),o=e.path.includes(`/`)||a!==j(e.path);return(0,A.jsx)(`li`,{children:(0,A.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,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`span`,{className:`block truncate font-mono text-label ${t?`text-display`:`text-primary`}`,title:e.path,children:a}),o&&(0,A.jsx)(`span`,{className:`block truncate font-mono text-micro text-disabled`,title:e.path,children:e.path})]}),n?(0,A.jsx)(`span`,{className:`shrink-0 rounded-full bg-interactive-soft px-2 text-caption font-medium text-interactive`,children:`Task`}):r?.type?(0,A.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,A.jsx)(`span`,{className:`shrink-0 font-mono text-micro text-disabled`,children:M(e.path)})]})},e.path)})})}),(0,A.jsx)(`div`,{className:`min-w-0 overflow-y-auto`,children:p&&f?(0,A.jsx)(N,{path:f.path,content:n,syncedAt:r}):f?.kind===`artifact`?(0,A.jsx)(P,{loopId:e,file:f.file}):null})]})]})}function N({path:e,content:t,syncedAt:n}){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(E,{path:e,meta:n?`Task file · synced ${de(n)}`:`Task file`}),t==null?(0,A.jsx)(`div`,{className:`px-5 py-6 text-body text-disabled`,children:`(syncs from the machine on the next run)`}):(0,A.jsx)(Ee,{content:t})]})}function P({loopId:e,file:t}){let n=[t.size==null?``:le(t.size),`synced ${de(t.updatedAt)}`].filter(Boolean).join(` · `);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(E,{path:t.path,meta:n}),(0,A.jsx)(O,{loopId:e,file:t})]})}var Fe=[`claude-code`,`codex`];function F(e){return{executor:`claude`,workdir:e.workdir.trim(),model:e.model.trim(),reasoningEffort:e.reasoningEffort.trim(),allowControl:e.allowControl}}var I=(0,k.lazy)(()=>re(()=>import(`./CodeField-dOzyFQNH.js`),__vite__mapDeps([0,1])));function L(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??``,metricSchema:e?.metricSchema?JSON.stringify(e.metricSchema):``,ui:e?.ui??``,agent:e?.agent??`claude-code`,workdir:t?.workdir??``,model:t?.model??``,reasoningEffort:t?.reasoningEffort??``,allowControl:!!t?.allowControl}}var R=`mt-1 text-caption leading-snug text-disabled`,z={"claude-code":`Claude Code`,codex:`Codex`};function B({label:e,value:t,onChange:n,mono:r,ph:i,hint:a}){let o=(0,k.useId)();return(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`label`,{htmlFor:o,className:v,children:e}),(0,A.jsx)(`input`,{id:o,type:`text`,className:r?`${b} font-mono`:b,value:t,placeholder:i,onChange:e=>n(e.target.value)}),a&&(0,A.jsx)(`div`,{className:R,children:a})]})}function V({title:e,hint:t}){return(0,A.jsxs)(`div`,{className:`mb-1 mt-7 border-b border-hairline pb-1.5`,children:[(0,A.jsx)(`h2`,{className:h,children:e}),t&&(0,A.jsx)(`div`,{className:`mt-0.5 text-caption text-disabled`,children:t})]})}function H({minHeight:e}){return(0,A.jsx)(`div`,{className:`rounded-control border border-wire bg-raised`,style:{minHeight:e}})}var Ie=(0,k.forwardRef)(function({initial:e,channels:t},n){let[r,i]=(0,k.useState)(()=>L(e)),a=(e,t)=>i(n=>({...n,[e]:t})),[o,s]=(0,k.useState)(null),[c,ee]=(0,k.useState)([]),l=t??c;return(0,k.useEffect)(()=>{t||oe().then(ee).catch(()=>{})},[t]),(0,k.useImperativeHandle)(n,()=>({read(){let e,t=r.metricSchema.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,ui:r.ui.trim()||void 0,agent:r.agent,exec:F(r),metricSchema:e}}})),(0,A.jsxs)(`div`,{className:`grid gap-x-10 lg:grid-cols-[minmax(300px,380px)_minmax(0,1fr)]`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(V,{title:`Basics`}),(0,A.jsx)(B,{label:`Name`,value:r.name,onChange:e=>a(`name`,e)}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`label`,{className:v,children:`Schedule mode`}),(0,A.jsxs)(`select`,{"aria-label":`Schedule mode`,className:S,value:r.scheduleMode,onChange:e=>a(`scheduleMode`,e.target.value),children:[(0,A.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,A.jsx)(`option`,{value:`continuous`,children:`Continuous`})]}),r.scheduleMode===`cron`?(0,A.jsxs)(`div`,{className:`${b} flex cursor-default select-none items-center justify-between gap-2 bg-raised`,title:r.cron,children:[(0,A.jsx)(`span`,{className:`truncate text-primary`,children:fe(r.cron)}),(0,A.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-secondary`,children:r.cron})]}):(0,A.jsx)(B,{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,A.jsx)(`div`,{className:R,children:`Cron is retained while continuous mode is active, so switching back restores it.`})]}),(0,A.jsx)(B,{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,A.jsx)(V,{title:`Notifications`}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`label`,{className:v,children:`Notify`}),(0,A.jsx)(`select`,{"aria-label":`Notify`,className:S,value:r.notify,onChange:e=>a(`notify`,e.target.value),children:[`auto`,`always`,`never`].map(e=>(0,A.jsx)(`option`,{children:e},e))}),(0,A.jsx)(`div`,{className:R,children:`auto pushes only when a run found something; never silences everything.`})]}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`label`,{className:v,children:`Push channel`}),(0,A.jsxs)(`select`,{"aria-label":`Push channel`,className:S,value:r.channelId,onChange:e=>a(`channelId`,e.target.value),children:[(0,A.jsx)(`option`,{value:``,children:`none (dashboard only)`}),l.map(e=>(0,A.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,A.jsx)(V,{title:`Execution`,hint:`Which coding agent on the machine runs this loop.`}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`label`,{className:v,children:`Coding agent`}),(0,A.jsx)(`select`,{"aria-label":`Coding agent`,className:S,value:r.agent,onChange:e=>a(`agent`,e.target.value),children:Fe.map(e=>(0,A.jsx)(`option`,{value:e,children:z[e]??e},e))}),(0,A.jsx)(`div`,{className:R,children:`Which coding agent executes this loop on the bound machine.`})]}),(0,A.jsx)(B,{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 lets the daemon use a scratch directory.`}),(0,A.jsx)(B,{label:`Model`,value:r.model,onChange:e=>a(`model`,e),ph:`default`,hint:`Optional arbitrary model id. Empty uses the coding-agent CLI default.`}),(0,A.jsx)(B,{label:`Reasoning effort`,value:r.reasoningEffort,onChange:e=>a(`reasoningEffort`,e),ph:`default`,hint:`Optional arbitrary effort value. Empty uses the coding-agent CLI default.`}),(0,A.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-center gap-2 text-body text-primary`,children:[(0,A.jsx)(`input`,{type:`checkbox`,className:`accent-[color:var(--color-display)]`,checked:r.allowControl,onChange:e=>a(`allowControl`,e.target.checked)}),`Allow self-rescheduling`]})]}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(V,{title:`Agent-authored content`,hint:`Metrics and dashboard - usually written by evolve passes; edit by hand here when you know exactly what you want.`}),(0,A.jsx)(`label`,{className:v,children:`Metrics schema · JSON array`}),(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(H,{minHeight:`90px`}),children:(0,A.jsx)(I,{lang:`json`,value:r.metricSchema,onChange:e=>{a(`metricSchema`,e),s(null)},minHeight:`90px`,invalid:!!o,placeholder:`[{"key":"mrr","label":"MRR","unit":"$"},{"key":"paid"}]`})}),o?(0,A.jsx)(`div`,{className:`mt-1 text-caption leading-snug text-accent`,children:o}):(0,A.jsx)(`div`,{className:R,children:`Per-run metrics the agent reports; they feed the dashboard charts.`}),(0,A.jsx)(`label`,{className:v,children:`Dashboard template · HTML`}),(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(H,{minHeight:`240px`}),children:(0,A.jsx)(I,{lang:`html`,value:r.ui,onChange:e=>a(`ui`,e),minHeight:`240px`,placeholder:`<h3>{{latest.mrr}}$</h3>
|
|
4
|
-
<loop-chart type="line" x="runIndex" series="mrr:MRR:$"></loop-chart>`})}),(0,A.jsxs)(`div`,{className:R,children:[`Agent-authored HTML with `,`{{bindings}}`,` and loop-chart / loop-embed / loop-calendar / loop-kanban elements.`]})]})]})}),Le={"claude-code":`Claude Code`,codex:`Codex`},Re=[{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 an objective`,seed:`Give this loop a standing objective to optimize toward: `}],ze=(0,k.lazy)(()=>re(()=>import(`./LoopView-BTXoqfzM.js`).then(e=>({default:e.LoopView})),__vite__mapDeps([2,1,3,4,5,6])));function U({id:e}){let t=ne(),[n,ee]=(0,k.useState)(null),[f,re]=(0,k.useState)([]),[ae,le]=(0,k.useState)(null),[m,h]=(0,k.useState)(null),[g,_]=(0,k.useState)(!1),[v,b]=(0,k.useState)(!1),[S,C]=(0,k.useState)(``),[w,T]=(0,k.useState)(!1),[Ee,E]=(0,k.useState)(!1),[D,O]=(0,k.useState)(null),De=(0,k.useRef)(null),[j,M]=(0,k.useState)(!1),[N,P]=(0,k.useState)(null),[Fe,F]=(0,k.useState)(!1),[I,L]=Oe(),R=(0,k.useRef)(null),z=(0,k.useRef)(!1),[B,V]=(0,k.useState)([]),H=(0,k.useCallback)(async(n=!1)=>{try{let t=await o({data:e});ee(t),z.current=t.summary.deleteRequestedAt!=null,le(null)}catch(e){z.current?t({to:`/`}):n||le(String(e))}},[e]);(0,k.useEffect)(()=>{ee(null),_(!1),b(!1),C(``),T(!1),E(!1),O(null),F(!1),V([]),H(),oe().then(re).catch(()=>{})},[e,H]);let U=!!n?.summary.running;(0,k.useEffect)(()=>{if(g)return;let e=setInterval(()=>void H(!0),U||z.current?3e3:8e3);return()=>clearInterval(e)},[g,U,H]);async function G(){await H()}async function He(){h(null),P(`run`);try{let t=await d({data:e});if(t?.error)return h(`Run failed: ${t.error}`);L({label:t.coalesced?`Already queued`:`Queued`,hold:4e3}),await G()}finally{P(null)}}async function Ue(){h(null),P(`evolve`);try{let t=await c({data:e});if(t?.error)return h(`Evolve failed: ${t.error}`);L({label:t.coalesced?`Evolve already queued`:`Evolve queued`,hold:4e3}),await G()}finally{P(null)}}async function We(n){h(null),P(`lifecycle`);try{let a=n===`pause`?await te({data:e}):n===`start`?await i({data:e}):n===`stop`?await r({data:e}):await l({data:e});if(a.error)return h(`${n[0].toUpperCase()+n.slice(1)} failed: ${a.error}`);if(F(!1),a.deleted){z.current=!1,t({to:`/`});return}n===`delete`&&(z.current=!0),await G(),L({label:n===`start`?`Started`:n===`pause`?`Paused`:n===`stop`?`Stop requested`:`Deleting`})}finally{P(null)}}async function Ge(){let t=R.current?.read();if(t){h(null),P(`save`);try{let n=await u({data:{id:e,patch:t}});if(n.error)return h(`Save failed: ${n.error}`);_(!1),await G(),L({label:`Saved`})}finally{P(null)}}}async function Ke(){let t=S.trim();if(t){h(null),P(`steer`);try{let n=await a({data:{id:e,instruction:t}});if(n.error)return h(`Couldn't queue the steer pass: ${n.error}`);O(n.runId??null),E(!0),b(!1),C(``),await G()}finally{P(null)}}}let qe=(0,A.jsxs)(p,{to:`/`,className:`inline-flex items-center gap-1.5 text-meta font-medium text-secondary transition-colors hover:text-display`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Loops`]});if(ae)return(0,A.jsx)(W,{back:qe,children:(0,A.jsx)(Ae,{title:`Couldn't load this loop.`,detail:ae,onRetry:()=>void H()})});if(!n)return(0,A.jsx)(W,{back:qe,children:(0,A.jsx)(_e,{})});let{job:K,summary:q,runs:Je}=n,Ye=!!K.ui,Xe=!!N,Ze=n.machine.online,J=n.machine.presence===`asleep`,Qe=Ze?void 0:J?`Machine asleep - requests will stay queued until it wakes`:`Machine offline - requests will stay queued until it reconnects`,$e=Ce(q),et=xe(n),tt=Se(n.machine.daemonProtocol),nt=n.machine.name?`“${n.machine.name}”`:`the bound machine`,Y=Ee&&D?Je.find(e=>e.id===D):void 0,rt=!!Y&&!Y.queued&&!Y.running,it=()=>{E(!1),O(null)},at=Me(K.taskFile),ot=async()=>{try{await navigator.clipboard.writeText(Ne({loopId:e,loopName:q.name,instruction:S})),T(!0),setTimeout(()=>T(!1),4e3)}catch{h(`Could not copy the prompt - try again or copy it manually.`)}},st=I&&(0,A.jsx)(`div`,{className:`mb-2.5`,children:(0,A.jsx)(ke,{label:I.label,tone:I.tone,onUndo:I.undo})}),X=$e===`deleting`,ct=!q.enabled&&!X,lt=q.enabled&&!X,Z=Xe||X,Q=lt||ct,ut=Q&&!!q.running&&tt.supported,dt=q.running&&!tt.supported?we:q.running?void 0:`No run is currently running`,ft=(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,A.jsx)(`button`,{className:ge,disabled:Z||!Q,onClick:()=>void He(),title:Q?Qe??(K.exec?`Spends credits`:void 0):`Unavailable for a deleting loop`,"aria-label":K.exec?`Run once - spends credits`:`Run once`,children:N===`run`?`Queuing…`:`Run once`}),(0,A.jsx)(`button`,{className:y,disabled:Z||!Q,title:`Dispatch or copy a prompt for an owner-requested steer`,onClick:()=>b(!0),children:`Steer`}),(0,A.jsx)(`button`,{className:y,disabled:Z||!Q,title:Q?Qe??`Spends credits`:`Unavailable for a deleting loop`,onClick:()=>void Ue(),children:N===`evolve`?`Evolving…`:`Evolve once`}),(0,A.jsx)(`button`,{className:y,disabled:Z,onClick:()=>_(!0),children:`Settings`}),(0,A.jsx)(`button`,{className:y,disabled:Z||!ct,onClick:()=>void We(`start`),children:`Start`}),(0,A.jsx)(`button`,{className:y,disabled:Z||!lt,onClick:()=>void We(`pause`),children:`Pause`}),(0,A.jsx)(`button`,{className:pe,disabled:Z||!ut,title:dt,onClick:()=>void We(`stop`),children:`Stop`}),(0,A.jsx)(`button`,{className:pe,disabled:Z,onClick:()=>F(!0),children:X?`Deleting…`:`Delete`})]}),Fe&&!X&&(0,A.jsx)(`div`,{className:`mt-3`,children:(0,A.jsx)(je,{prompt:`Stop this loop and delete its server data?`,note:`This stops the loop and deletes server history and synced artifacts. Local files are not deleted. If the machine is unreachable, server data is still deleted and its local process may continue running.`,cta:`Delete`,danger:!0,busy:Xe,onConfirm:()=>void We(`delete`),onCancel:()=>F(!1)})}),X&&(0,A.jsx)(`div`,{className:`mt-3 rounded-md border border-wire bg-raised px-4 py-3 text-meta text-secondary`,children:`Deleting… graceful stop is waiting for execution authority to end.`}),v&&!X&&(0,A.jsxs)(`div`,{className:`mt-4 border-t border-hairline pt-4`,onKeyDown:e=>{e.key===`Escape`&&N!==`steer`&&(e.stopPropagation(),b(!1))},children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,A.jsx)(`span`,{className:`text-body font-medium text-display`,children:`Steer with your coding agent`}),(0,A.jsxs)(`span`,{className:`text-meta text-secondary`,children:[`One agent pass on `,nt,` · spends credits`]})]}),(0,A.jsx)(`textarea`,{ref:De,autoFocus:!0,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&S.trim()&&N!==`steer`&&Ke()},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`}),!S.trim()&&(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:Re.map(e=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>{C(e.seed),De.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,A.jsxs)(`div`,{className:`mt-3.5 flex flex-wrap items-center gap-x-2.5 gap-y-2`,children:[(0,A.jsx)(`button`,{className:ve,disabled:N===`steer`||!S.trim(),title:Qe,onClick:()=>void Ke(),children:N===`steer`?`Dispatching…`:`Dispatch to your coding agent`}),(0,A.jsx)(`button`,{type:`button`,className:y,disabled:N===`steer`,onClick:()=>void ot(),children:w?`✓ Prompt copied`:`Copy prompt`}),(0,A.jsx)(`button`,{className:y,disabled:N===`steer`,onClick:()=>b(!1),children:`Cancel`}),(0,A.jsx)(`span`,{className:`hidden text-caption text-disabled sm:inline`,children:`⌘↩ dispatch · esc cancel`})]}),(0,A.jsx)(`div`,{className:`mt-2 text-caption leading-snug text-disabled`,children:w?(0,A.jsxs)(`span`,{className:`text-secondary`,children:[`✓ Copied · run your coding agent`,` `,at?(0,A.jsxs)(A.Fragment,{children:[`in `,(0,A.jsx)(`code`,{className:`break-all font-mono text-primary`,children:at})]}):`in the loop’s local directory on this machine`,` `,`and paste the prompt to adjust the loop yourself.`]}):(0,A.jsx)(A.Fragment,{children:`Prefer to adjust it yourself? Copy prompt drops a ready-to-paste prompt for your own coding agent - no dispatch, no credits.`})})]})]}),pt=m&&(0,A.jsx)(ye,{message:m,onDismiss:()=>h(null),className:`mb-2.5`}),$=n.team&&!n.team.isActive?n.team:null,mt=e=>{Te(e),t({to:`/t/$teamId`,params:{teamId:e}})},ht=$&&(0,A.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,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-interactive`}),`Viewing a loop in `,$.name]}),(0,A.jsx)(`span`,{className:`text-meta text-secondary`,children:`- not your active team.`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>mt($.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`})]}),gt=n.machine.needsUpdate&&(0,A.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-control border border-warn/40 bg-warn/10 px-4 py-2.5`,children:[(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-primary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-warn`}),`Daemon update required`]}),(0,A.jsxs)(`span`,{className:`text-meta text-secondary`,children:[`This server requires v`,n.machine.requiredDaemonVersion,`; `,n.machine.name?`“${n.machine.name}”`:`the bound machine`,` reports `,n.machine.daemonVersion?`v${n.machine.daemonVersion}`:`an unknown version`,`. Queued work will wait.`]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`ml-auto cursor-pointer text-meta font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Update daemon`})]}),_t=!Ze&&(0,A.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,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full ${J?`bg-rubik-yellow`:`bg-disabled`}`}),`Machine `,n.machine.name?`“${n.machine.name}” `:``,J?`seems to be asleep or offline`:`offline`]}),(0,A.jsxs)(`span`,{className:`text-meta text-secondary`,children:[J?`- queued work starts automatically when it reconnects.`:`- manual run, evolve, and steer requests remain safely queued.`,n.machine.lastSeen?` Last seen ${ce(n.machine.lastSeen)}.`:``]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`ml-auto cursor-pointer text-meta font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Reconnect`})]});if(g)return(0,A.jsxs)(W,{back:qe,children:[(0,A.jsx)(Be,{name:q.name,onBack:()=>_(!1)}),(0,A.jsxs)(`div`,{className:`mt-5 rounded-card border border-hairline bg-surface px-6 pb-6 pt-2 shadow-card`,children:[(0,A.jsx)(Ie,{ref:R,initial:K,channels:f}),(0,A.jsxs)(`div`,{className:`mt-7 border-t border-hairline pt-4`,children:[pt,(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,A.jsx)(`button`,{className:ge,disabled:N===`save`,onClick:Ge,children:N===`save`?`Saving…`:`Save`}),(0,A.jsx)(`button`,{className:y,disabled:N===`save`,onClick:()=>_(!1),children:`Cancel`})]})]})]})]});let vt=Le[K.agent??`claude-code`]??K.agent??`Claude Code`,yt=K.exec?.model?.trim()||`default`,bt=K.exec?.reasoningEffort?.trim()||`default`,xt=Je[0],St=xt?.reportIncident?xt:void 0,Ct=(0,A.jsx)(`span`,{className:`text-wire`,children:`·`});return(0,A.jsxs)(W,{back:qe,children:[(0,A.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,A.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,A.jsx)(`h1`,{className:`text-[28px] font-semibold leading-tight tracking-[-0.015em] text-display`,children:q.name}),(0,A.jsx)(x,{tone:$e===`stopping`?`running`:void 0,dot:$e===`stopping`?`pulse`:void 0,children:et}),q.queued&&$e===`active`?(0,A.jsx)(x,{tone:`outline`,children:`Queued`}):null,q.goal&&(0,A.jsx)(x,{tone:`success`,title:q.goal??void 0,children:`Objective`}),(0,A.jsx)(x,{tone:`outline`,title:`Recorded coding agent`,children:vt}),(0,A.jsx)(x,{tone:`outline`,title:`Model: ${yt}`,children:(0,A.jsxs)(`span`,{className:`max-w-72 truncate`,children:[`Model: `,yt]})}),(0,A.jsx)(x,{tone:`outline`,title:`Reasoning: ${bt}`,children:(0,A.jsxs)(`span`,{className:`max-w-72 truncate`,children:[`Reasoning: `,bt]})}),$&&(0,A.jsx)(x,{tone:`outline`,title:`This loop belongs to another of your teams`,children:$.name})]}),(0,A.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-meta text-secondary`,children:[(0,A.jsx)(`span`,{className:`text-primary`,title:K.cron,children:K.scheduleMode===`continuous`?`continuous · ${K.continuousDelayMinutes}m delay`:fe(K.cron)}),Ct,(0,A.jsxs)(`span`,{children:[`next `,de(q.nextRun)]}),q.nextRun&&q.enabled&&(0,A.jsxs)(`span`,{className:`text-disabled`,children:[`(`,ue(q.nextRun),`)`]}),Ct,(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:Ze?`Machine online`:J?`Machine asleep`:`Machine offline`,children:[(0,A.jsx)(`span`,{className:`size-1.5 rounded-full ${Ze?`bg-rubik-green`:J?`bg-rubik-yellow`:`bg-disabled`}`}),n.machine.name||`machine`]}),Ct,(0,A.jsx)(`code`,{className:`font-mono text-label text-disabled`,children:q.id})]}),q.goal&&(0,A.jsxs)(`div`,{className:`mt-2 text-body leading-snug text-secondary`,children:[`Working toward: `,(0,A.jsx)(`span`,{className:`text-primary`,children:q.goal})]}),St?.reportIncident&&(0,A.jsx)(`div`,{className:`mt-2 text-body leading-snug text-secondary`,children:St.phase===`error`?`Last run failed · Terminal report rejected`:`Last run telemetry warning · Terminal report rejected`})]})}),(0,A.jsxs)(`div`,{className:`mt-5 border-t border-hairline pt-4`,children:[ht,gt,_t,pt,st,ft]})]}),Ee&&(0,A.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,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[!Y||Y.queued?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 text-body text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full bg-disabled`}),(0,A.jsx)(`span`,{className:`font-medium text-primary`,children:`Steer queued`}),(0,A.jsxs)(`span`,{children:[`waiting for `,nt,` and higher-priority work…`]})]}):Y.running?(0,A.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2.5 text-body text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full`,style:me}),(0,A.jsx)(`span`,{className:`shrink-0 font-medium text-primary`,children:`Applying your steer`})]}):(0,A.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 text-body`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-2.5 shrink-0 rounded-[2px]`,style:{background:be(Y)}}),(0,A.jsx)(`span`,{className:`font-medium`,style:{color:be(Y)},children:Y.canceled?`Steer canceled`:Y.phase===`error`?`Steer failed`:`Steer applied`}),Y.error&&(0,A.jsxs)(`span`,{className:`truncate text-secondary`,children:[`· `,Y.error]})]}),(0,A.jsxs)(`div`,{className:`ml-auto flex items-center gap-3.5`,children:[Y&&(0,A.jsx)(p,{to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:Y.id},className:`text-label font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`View run →`}),(0,A.jsx)(`button`,{type:`button`,onClick:it,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:rt?`Done`:`Hide`})]})]}),rt&&Y.message&&(0,A.jsx)(`div`,{className:`mt-3.5`,children:(0,A.jsx)(he,{children:Y.message})})]}),Ye&&(0,A.jsxs)(`section`,{className:`mt-6 min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,A.jsx)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 text-label font-semibold text-secondary`,children:`Dashboard`}),(0,A.jsx)(`div`,{className:`min-w-0 overflow-x-auto`,children:(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(_e,{className:`py-4`}),children:(0,A.jsx)(ze,{html:K.ui,runs:Je,loopId:e,taskFile:K.taskFile})})})]}),(0,A.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,A.jsx)(Pe,{loopId:e,taskFile:K.taskFile,taskFileContent:n.taskFileContent,taskFileSyncedAt:n.taskFileSyncedAt,running:U}),(0,A.jsx)(Ve,{loopId:e,summary:q,runs:Je,older:B,onMore:async()=>{let t=(B.length?se(q.runs??[],B):q.runs??[])[0];if(!t)return 0;let n=await s({data:{loopId:e,beforeTs:t.ts,limit:16}});return n.length&&V(e=>se(e,n)),n.length},onPickRun:n=>t({to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id}})})]}),(0,A.jsx)(ie,{open:j,onClose:()=>M(!1)})]})}function Be({name:e,onBack:t}){return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`button`,{type:`button`,onClick:t,className:g,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]}),(0,A.jsxs)(`h1`,{className:`mt-2.5 text-[24px] font-semibold leading-tight tracking-[-0.015em] text-display`,children:[`Settings · `,e]}),(0,A.jsx)(`p`,{className:`mt-1.5 max-w-[640px] text-meta leading-snug text-secondary`,children:`Loop configuration, notifications, and push channel, saved directly - no agent pass or credits. For changes in plain words, use Steer instead.`})]})}function W({back:e,children:t}){return(0,A.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,A.jsx)(`div`,{className:`mb-5`,children:e}),t]})}function Ve({loopId:e,summary:t,runs:n,older:r,onMore:i,onPickRun:a}){let o=(0,k.useMemo)(()=>r.length?se(t.runs??[],r):t.runs??[],[t.runs,r]);return(0,A.jsxs)(`section`,{className:`min-w-0`,children:[(0,A.jsx)(`div`,{className:`mb-2.5 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:(0,A.jsxs)(`h2`,{className:h,children:[`Runs (`,t.runCount,`)`]})}),t.runCount===0?(0,A.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled`,children:`Never run`}):(0,A.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 pb-4 pt-5 shadow-card`,children:[(0,A.jsx)(ae,{job:t,runs:o,total:t.runCount,onLoadMore:i,onPickRun:a}),(0,A.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,A.jsx)(`li`,{children:(0,A.jsxs)(p,{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,A.jsx)(`span`,{className:`mt-1 inline-block size-2.5 shrink-0 rounded-[2px]`,style:{background:be(t)},title:m(t),"aria-label":m(t)}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`span`,{className:`flex items-baseline justify-between gap-2`,children:[(0,A.jsx)(`span`,{className:`font-mono text-label text-secondary`,children:_(t.ts)}),(0,A.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:C(t.durationMs)})]}),(0,A.jsx)(`span`,{className:`mt-0.5 block`,children:t.queued?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-disabled`}),(0,A.jsx)(`span`,{children:`Queued`})]}):t.running?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full`,style:me}),(0,A.jsx)(`span`,{children:`Running`})]}):t.error?(0,A.jsx)(`span`,{className:`line-clamp-2 text-meta text-secondary`,children:t.error}):(0,A.jsx)(`span`,{className:`line-clamp-2 text-meta text-primary`,children:t.message||m(t)})})]})]})},t.id))})]})]})}function G(){let{loopId:e}=w.useParams(),{auth:t}=w.useLoaderData()??{auth:{enabled:!1}},{data:n,isPending:r}=f();return t?.enabled&&!r&&!n?(0,A.jsx)(De,{callbackURL:`/loops/${e}`}):(0,A.jsx)(U,{id:e})}export{G as component};
|
|
4
|
+
<loop-chart type="line" x="runIndex" series="mrr:MRR:$"></loop-chart>`})}),(0,A.jsxs)(`div`,{className:R,children:[`Agent-authored HTML with `,`{{bindings}}`,` and loop-chart / loop-embed / loop-calendar / loop-kanban elements.`]})]})]})}),Le={"claude-code":`Claude Code`,codex:`Codex`},Re=[{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 an objective`,seed:`Give this loop a standing objective to optimize toward: `}],ze=(0,k.lazy)(()=>re(()=>import(`./LoopView-DjVHUyrR.js`).then(e=>({default:e.LoopView})),__vite__mapDeps([2,1,3,4,5,6])));function U({id:e}){let t=ne(),[n,ee]=(0,k.useState)(null),[f,re]=(0,k.useState)([]),[ae,le]=(0,k.useState)(null),[m,h]=(0,k.useState)(null),[g,_]=(0,k.useState)(!1),[v,b]=(0,k.useState)(!1),[S,C]=(0,k.useState)(``),[w,T]=(0,k.useState)(!1),[Ee,E]=(0,k.useState)(!1),[D,O]=(0,k.useState)(null),De=(0,k.useRef)(null),[j,M]=(0,k.useState)(!1),[N,P]=(0,k.useState)(null),[Fe,F]=(0,k.useState)(!1),[I,L]=Oe(),R=(0,k.useRef)(null),z=(0,k.useRef)(!1),[B,V]=(0,k.useState)([]),H=(0,k.useCallback)(async(n=!1)=>{try{let t=await o({data:e});ee(t),z.current=t.summary.deleteRequestedAt!=null,le(null)}catch(e){z.current?t({to:`/`}):n||le(String(e))}},[e]);(0,k.useEffect)(()=>{ee(null),_(!1),b(!1),C(``),T(!1),E(!1),O(null),F(!1),V([]),H(),oe().then(re).catch(()=>{})},[e,H]);let U=!!n?.summary.running;(0,k.useEffect)(()=>{if(g)return;let e=setInterval(()=>void H(!0),U||z.current?3e3:8e3);return()=>clearInterval(e)},[g,U,H]);async function G(){await H()}async function He(){h(null),P(`run`);try{let t=await d({data:e});if(t?.error)return h(`Run failed: ${t.error}`);L({label:t.coalesced?`Already queued`:`Queued`,hold:4e3}),await G()}finally{P(null)}}async function Ue(){h(null),P(`evolve`);try{let t=await c({data:e});if(t?.error)return h(`Evolve failed: ${t.error}`);L({label:t.coalesced?`Evolve already queued`:`Evolve queued`,hold:4e3}),await G()}finally{P(null)}}async function We(n){h(null),P(`lifecycle`);try{let a=n===`pause`?await te({data:e}):n===`start`?await i({data:e}):n===`stop`?await r({data:e}):await l({data:e});if(a.error)return h(`${n[0].toUpperCase()+n.slice(1)} failed: ${a.error}`);if(F(!1),a.deleted){z.current=!1,t({to:`/`});return}n===`delete`&&(z.current=!0),await G(),L({label:n===`start`?`Started`:n===`pause`?`Paused`:n===`stop`?`Stop requested`:`Deleting`})}finally{P(null)}}async function Ge(){let t=R.current?.read();if(t){h(null),P(`save`);try{let n=await u({data:{id:e,patch:t}});if(n.error)return h(`Save failed: ${n.error}`);_(!1),await G(),L({label:`Saved`})}finally{P(null)}}}async function Ke(){let t=S.trim();if(t){h(null),P(`steer`);try{let n=await a({data:{id:e,instruction:t}});if(n.error)return h(`Couldn't queue the steer pass: ${n.error}`);O(n.runId??null),E(!0),b(!1),C(``),await G()}finally{P(null)}}}let qe=(0,A.jsxs)(p,{to:`/`,className:`inline-flex items-center gap-1.5 text-meta font-medium text-secondary transition-colors hover:text-display`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Loops`]});if(ae)return(0,A.jsx)(W,{back:qe,children:(0,A.jsx)(Ae,{title:`Couldn't load this loop.`,detail:ae,onRetry:()=>void H()})});if(!n)return(0,A.jsx)(W,{back:qe,children:(0,A.jsx)(_e,{})});let{job:K,summary:q,runs:Je}=n,Ye=!!K.ui,Xe=!!N,Ze=n.machine.online,J=n.machine.presence===`asleep`,Qe=Ze?void 0:J?`Machine asleep - requests will stay queued until it wakes`:`Machine offline - requests will stay queued until it reconnects`,$e=Ce(q),et=xe(n),tt=Se(n.machine.daemonProtocol),nt=n.machine.name?`“${n.machine.name}”`:`the bound machine`,Y=Ee&&D?Je.find(e=>e.id===D):void 0,rt=!!Y&&!Y.queued&&!Y.running,it=()=>{E(!1),O(null)},at=Me(K.taskFile),ot=async()=>{try{await navigator.clipboard.writeText(Ne({loopId:e,loopName:q.name,instruction:S})),T(!0),setTimeout(()=>T(!1),4e3)}catch{h(`Could not copy the prompt - try again or copy it manually.`)}},st=I&&(0,A.jsx)(`div`,{className:`mb-2.5`,children:(0,A.jsx)(ke,{label:I.label,tone:I.tone,onUndo:I.undo})}),X=$e===`deleting`,ct=!q.enabled&&!X,lt=q.enabled&&!X,Z=Xe||X,Q=lt||ct,ut=Q&&!!q.running&&tt.supported,dt=q.running&&!tt.supported?we:q.running?void 0:`No run is currently running`,ft=(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,A.jsx)(`button`,{className:ge,disabled:Z||!Q,onClick:()=>void He(),title:Q?Qe??(K.exec?`Spends credits`:void 0):`Unavailable for a deleting loop`,"aria-label":K.exec?`Run once - spends credits`:`Run once`,children:N===`run`?`Queuing…`:`Run once`}),(0,A.jsx)(`button`,{className:y,disabled:Z||!Q,title:`Dispatch or copy a prompt for an owner-requested steer`,onClick:()=>b(!0),children:`Steer`}),(0,A.jsx)(`button`,{className:y,disabled:Z||!Q,title:Q?Qe??`Spends credits`:`Unavailable for a deleting loop`,onClick:()=>void Ue(),children:N===`evolve`?`Evolving…`:`Evolve once`}),(0,A.jsx)(`button`,{className:y,disabled:Z,onClick:()=>_(!0),children:`Settings`}),(0,A.jsx)(`button`,{className:y,disabled:Z||!ct,onClick:()=>void We(`start`),children:`Start`}),(0,A.jsx)(`button`,{className:y,disabled:Z||!lt,onClick:()=>void We(`pause`),children:`Pause`}),(0,A.jsx)(`button`,{className:pe,disabled:Z||!ut,title:dt,onClick:()=>void We(`stop`),children:`Stop`}),(0,A.jsx)(`button`,{className:pe,disabled:Z,onClick:()=>F(!0),children:X?`Deleting…`:`Delete`})]}),Fe&&!X&&(0,A.jsx)(`div`,{className:`mt-3`,children:(0,A.jsx)(je,{prompt:`Stop this loop and delete its server data?`,note:`This stops the loop and deletes server history and synced artifacts. Local files are not deleted. If the machine is unreachable, server data is still deleted and its local process may continue running.`,cta:`Delete`,danger:!0,busy:Xe,onConfirm:()=>void We(`delete`),onCancel:()=>F(!1)})}),X&&(0,A.jsx)(`div`,{className:`mt-3 rounded-md border border-wire bg-raised px-4 py-3 text-meta text-secondary`,children:`Deleting… graceful stop is waiting for execution authority to end.`}),v&&!X&&(0,A.jsxs)(`div`,{className:`mt-4 border-t border-hairline pt-4`,onKeyDown:e=>{e.key===`Escape`&&N!==`steer`&&(e.stopPropagation(),b(!1))},children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,A.jsx)(`span`,{className:`text-body font-medium text-display`,children:`Steer with your coding agent`}),(0,A.jsxs)(`span`,{className:`text-meta text-secondary`,children:[`One agent pass on `,nt,` · spends credits`]})]}),(0,A.jsx)(`textarea`,{ref:De,autoFocus:!0,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&S.trim()&&N!==`steer`&&Ke()},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`}),!S.trim()&&(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:Re.map(e=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>{C(e.seed),De.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,A.jsxs)(`div`,{className:`mt-3.5 flex flex-wrap items-center gap-x-2.5 gap-y-2`,children:[(0,A.jsx)(`button`,{className:ve,disabled:N===`steer`||!S.trim(),title:Qe,onClick:()=>void Ke(),children:N===`steer`?`Dispatching…`:`Dispatch to your coding agent`}),(0,A.jsx)(`button`,{type:`button`,className:y,disabled:N===`steer`,onClick:()=>void ot(),children:w?`✓ Prompt copied`:`Copy prompt`}),(0,A.jsx)(`button`,{className:y,disabled:N===`steer`,onClick:()=>b(!1),children:`Cancel`}),(0,A.jsx)(`span`,{className:`hidden text-caption text-disabled sm:inline`,children:`⌘↩ dispatch · esc cancel`})]}),(0,A.jsx)(`div`,{className:`mt-2 text-caption leading-snug text-disabled`,children:w?(0,A.jsxs)(`span`,{className:`text-secondary`,children:[`✓ Copied · run your coding agent`,` `,at?(0,A.jsxs)(A.Fragment,{children:[`in `,(0,A.jsx)(`code`,{className:`break-all font-mono text-primary`,children:at})]}):`in the loop’s local directory on this machine`,` `,`and paste the prompt to adjust the loop yourself.`]}):(0,A.jsx)(A.Fragment,{children:`Prefer to adjust it yourself? Copy prompt drops a ready-to-paste prompt for your own coding agent - no dispatch, no credits.`})})]})]}),pt=m&&(0,A.jsx)(ye,{message:m,onDismiss:()=>h(null),className:`mb-2.5`}),$=n.team&&!n.team.isActive?n.team:null,mt=e=>{Te(e),t({to:`/t/$teamId`,params:{teamId:e}})},ht=$&&(0,A.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,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-interactive`}),`Viewing a loop in `,$.name]}),(0,A.jsx)(`span`,{className:`text-meta text-secondary`,children:`- not your active team.`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>mt($.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`})]}),gt=n.machine.needsUpdate&&(0,A.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-control border border-warn/40 bg-warn/10 px-4 py-2.5`,children:[(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-primary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-warn`}),`Daemon update required`]}),(0,A.jsxs)(`span`,{className:`text-meta text-secondary`,children:[`This server requires v`,n.machine.requiredDaemonVersion,`; `,n.machine.name?`“${n.machine.name}”`:`the bound machine`,` reports `,n.machine.daemonVersion?`v${n.machine.daemonVersion}`:`an unknown version`,`. Queued work will wait.`]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`ml-auto cursor-pointer text-meta font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Update daemon`})]}),_t=!Ze&&(0,A.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,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full ${J?`bg-rubik-yellow`:`bg-disabled`}`}),`Machine `,n.machine.name?`“${n.machine.name}” `:``,J?`seems to be asleep or offline`:`offline`]}),(0,A.jsxs)(`span`,{className:`text-meta text-secondary`,children:[J?`- queued work starts automatically when it reconnects.`:`- manual run, evolve, and steer requests remain safely queued.`,n.machine.lastSeen?` Last seen ${ce(n.machine.lastSeen)}.`:``]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`ml-auto cursor-pointer text-meta font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Reconnect`})]});if(g)return(0,A.jsxs)(W,{back:qe,children:[(0,A.jsx)(Be,{name:q.name,onBack:()=>_(!1)}),(0,A.jsxs)(`div`,{className:`mt-5 rounded-card border border-hairline bg-surface px-6 pb-6 pt-2 shadow-card`,children:[(0,A.jsx)(Ie,{ref:R,initial:K,channels:f}),(0,A.jsxs)(`div`,{className:`mt-7 border-t border-hairline pt-4`,children:[pt,(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,A.jsx)(`button`,{className:ge,disabled:N===`save`,onClick:Ge,children:N===`save`?`Saving…`:`Save`}),(0,A.jsx)(`button`,{className:y,disabled:N===`save`,onClick:()=>_(!1),children:`Cancel`})]})]})]})]});let vt=Le[K.agent??`claude-code`]??K.agent??`Claude Code`,yt=K.exec?.model?.trim()||`default`,bt=K.exec?.reasoningEffort?.trim()||`default`,xt=Je[0],St=xt?.reportIncident?xt:void 0,Ct=(0,A.jsx)(`span`,{className:`text-wire`,children:`·`});return(0,A.jsxs)(W,{back:qe,children:[(0,A.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,A.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,A.jsx)(`h1`,{className:`text-[28px] font-semibold leading-tight tracking-[-0.015em] text-display`,children:q.name}),(0,A.jsx)(x,{tone:$e===`stopping`?`running`:void 0,dot:$e===`stopping`?`pulse`:void 0,children:et}),q.queued&&$e===`active`?(0,A.jsx)(x,{tone:`outline`,children:`Queued`}):null,q.goal&&(0,A.jsx)(x,{tone:`success`,title:q.goal??void 0,children:`Objective`}),(0,A.jsx)(x,{tone:`outline`,title:`Recorded coding agent`,children:vt}),(0,A.jsx)(x,{tone:`outline`,title:`Model: ${yt}`,children:(0,A.jsxs)(`span`,{className:`max-w-72 truncate`,children:[`Model: `,yt]})}),(0,A.jsx)(x,{tone:`outline`,title:`Reasoning: ${bt}`,children:(0,A.jsxs)(`span`,{className:`max-w-72 truncate`,children:[`Reasoning: `,bt]})}),$&&(0,A.jsx)(x,{tone:`outline`,title:`This loop belongs to another of your teams`,children:$.name})]}),(0,A.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-meta text-secondary`,children:[(0,A.jsx)(`span`,{className:`text-primary`,title:K.cron,children:K.scheduleMode===`continuous`?`continuous · ${K.continuousDelayMinutes}m delay`:fe(K.cron)}),Ct,(0,A.jsxs)(`span`,{children:[`next `,de(q.nextRun)]}),q.nextRun&&q.enabled&&(0,A.jsxs)(`span`,{className:`text-disabled`,children:[`(`,ue(q.nextRun),`)`]}),Ct,(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:Ze?`Machine online`:J?`Machine asleep`:`Machine offline`,children:[(0,A.jsx)(`span`,{className:`size-1.5 rounded-full ${Ze?`bg-rubik-green`:J?`bg-rubik-yellow`:`bg-disabled`}`}),n.machine.name||`machine`]}),Ct,(0,A.jsx)(`code`,{className:`font-mono text-label text-disabled`,children:q.id})]}),q.goal&&(0,A.jsxs)(`div`,{className:`mt-2 text-body leading-snug text-secondary`,children:[`Working toward: `,(0,A.jsx)(`span`,{className:`text-primary`,children:q.goal})]}),St?.reportIncident&&(0,A.jsx)(`div`,{className:`mt-2 text-body leading-snug text-secondary`,children:St.phase===`error`?`Last run failed · Terminal report rejected`:`Last run telemetry warning · Terminal report rejected`})]})}),(0,A.jsxs)(`div`,{className:`mt-5 border-t border-hairline pt-4`,children:[ht,gt,_t,pt,st,ft]})]}),Ee&&(0,A.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,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[!Y||Y.queued?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 text-body text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full bg-disabled`}),(0,A.jsx)(`span`,{className:`font-medium text-primary`,children:`Steer queued`}),(0,A.jsxs)(`span`,{children:[`waiting for `,nt,` and higher-priority work…`]})]}):Y.running?(0,A.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2.5 text-body text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full`,style:me}),(0,A.jsx)(`span`,{className:`shrink-0 font-medium text-primary`,children:`Applying your steer`})]}):(0,A.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 text-body`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-2.5 shrink-0 rounded-[2px]`,style:{background:be(Y)}}),(0,A.jsx)(`span`,{className:`font-medium`,style:{color:be(Y)},children:Y.canceled?`Steer canceled`:Y.phase===`error`?`Steer failed`:`Steer applied`}),Y.error&&(0,A.jsxs)(`span`,{className:`truncate text-secondary`,children:[`· `,Y.error]})]}),(0,A.jsxs)(`div`,{className:`ml-auto flex items-center gap-3.5`,children:[Y&&(0,A.jsx)(p,{to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:Y.id},className:`text-label font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`View run →`}),(0,A.jsx)(`button`,{type:`button`,onClick:it,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:rt?`Done`:`Hide`})]})]}),rt&&Y.message&&(0,A.jsx)(`div`,{className:`mt-3.5`,children:(0,A.jsx)(he,{children:Y.message})})]}),Ye&&(0,A.jsxs)(`section`,{className:`mt-6 min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,A.jsx)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 text-label font-semibold text-secondary`,children:`Dashboard`}),(0,A.jsx)(`div`,{className:`min-w-0 overflow-x-auto`,children:(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(_e,{className:`py-4`}),children:(0,A.jsx)(ze,{html:K.ui,runs:Je,loopId:e,taskFile:K.taskFile})})})]}),(0,A.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,A.jsx)(Pe,{loopId:e,taskFile:K.taskFile,taskFileContent:n.taskFileContent,taskFileSyncedAt:n.taskFileSyncedAt,running:U}),(0,A.jsx)(Ve,{loopId:e,summary:q,runs:Je,older:B,onMore:async()=>{let t=(B.length?se(q.runs??[],B):q.runs??[])[0];if(!t)return 0;let n=await s({data:{loopId:e,beforeTs:t.ts,limit:16}});return n.length&&V(e=>se(e,n)),n.length},onPickRun:n=>t({to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id}})})]}),(0,A.jsx)(ie,{open:j,onClose:()=>M(!1)})]})}function Be({name:e,onBack:t}){return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`button`,{type:`button`,onClick:t,className:g,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]}),(0,A.jsxs)(`h1`,{className:`mt-2.5 text-[24px] font-semibold leading-tight tracking-[-0.015em] text-display`,children:[`Settings · `,e]}),(0,A.jsx)(`p`,{className:`mt-1.5 max-w-[640px] text-meta leading-snug text-secondary`,children:`Loop configuration, notifications, and push channel, saved directly - no agent pass or credits. For changes in plain words, use Steer instead.`})]})}function W({back:e,children:t}){return(0,A.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,A.jsx)(`div`,{className:`mb-5`,children:e}),t]})}function Ve({loopId:e,summary:t,runs:n,older:r,onMore:i,onPickRun:a}){let o=(0,k.useMemo)(()=>r.length?se(t.runs??[],r):t.runs??[],[t.runs,r]);return(0,A.jsxs)(`section`,{className:`min-w-0`,children:[(0,A.jsx)(`div`,{className:`mb-2.5 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:(0,A.jsxs)(`h2`,{className:h,children:[`Runs (`,t.runCount,`)`]})}),t.runCount===0?(0,A.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled`,children:`Never run`}):(0,A.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 pb-4 pt-5 shadow-card`,children:[(0,A.jsx)(ae,{job:t,runs:o,total:t.runCount,onLoadMore:i,onPickRun:a}),(0,A.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,A.jsx)(`li`,{children:(0,A.jsxs)(p,{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,A.jsx)(`span`,{className:`mt-1 inline-block size-2.5 shrink-0 rounded-[2px]`,style:{background:be(t)},title:m(t),"aria-label":m(t)}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`span`,{className:`flex items-baseline justify-between gap-2`,children:[(0,A.jsx)(`span`,{className:`font-mono text-label text-secondary`,children:_(t.ts)}),(0,A.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:C(t.durationMs)})]}),(0,A.jsx)(`span`,{className:`mt-0.5 block`,children:t.queued?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-disabled`}),(0,A.jsx)(`span`,{children:`Queued`})]}):t.running?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta text-secondary`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full`,style:me}),(0,A.jsx)(`span`,{children:`Running`})]}):t.error?(0,A.jsx)(`span`,{className:`line-clamp-2 text-meta text-secondary`,children:t.error}):(0,A.jsx)(`span`,{className:`line-clamp-2 text-meta text-primary`,children:t.message||m(t)})})]})]})},t.id))})]})]})}function G(){let{loopId:e}=w.useParams(),{auth:t}=w.useLoaderData()??{auth:{enabled:!1}},{data:n,isPending:r}=f();return t?.enabled&&!r&&!n?(0,A.jsx)(De,{callbackURL:`/loops/${e}`}):(0,A.jsx)(U,{id:e})}export{G as component};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{d as r,f as i,g as a,w as o}from"./loopApi-CT1mMhlb.js";import{c as s,f as c}from"./preload-helper-DFkkpP6W.js";import{D as l,E as u,T as d,_ as f,a as p,c as m,g as h,n as g,o as _,r as v,w as y}from"./ui-
|
|
1
|
+
import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{d as r,f as i,g as a,w as o}from"./loopApi-CT1mMhlb.js";import{c as s,f as c}from"./preload-helper-DFkkpP6W.js";import{D as l,E as u,T as d,_ as f,a as p,c as m,g as h,n as g,o as _,r as v,w as y}from"./ui-Dhsx6SW0.js";import"./lifecycleUi-Qy_8beQK.js";import{t as b}from"./index-BRN_CQ8U.js";import{t as x}from"./SignIn-Qxw5zDFq.js";import{r as S}from"./actionUi-CXxhzYe2.js";var C=t(e(),1);function w(e,t){return e.startsWith(`@@`)?{kind:`hunk`,text:e,gutter:``}:t?e.startsWith(`+`)?{kind:`add`,text:e.slice(1),gutter:`+`}:e.startsWith(`-`)?{kind:`del`,text:e.slice(1),gutter:`-`}:e.startsWith(` `)?{kind:`context`,text:e.slice(1),gutter:``}:{kind:`context`,text:e,gutter:``}:e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`diff `)||e.startsWith(`index `)||e.startsWith(`Index:`)||e.startsWith(`===`)?{kind:`meta`,text:e,gutter:``}:{kind:`context`,text:e,gutter:``}}function T(e){if(!e)return[];let t=e.endsWith(`
|
|
2
2
|
`)?e.slice(0,-1):e,n=!1;return t.split(`
|
|
3
|
-
`).map(e=>{let t=w(e,n);return t.kind===`hunk`&&(n=!0),t})}function E(e){let t=0,n=0;for(let r of e)r.kind===`add`?t++:r.kind===`del`&&n++;return{added:t,removed:n}}var D=n(),O={added:`Added`,modified:`Changed`,removed:`Removed`},k={added:`text-success`,modified:`text-secondary`,removed:`text-accent`};function A(e){return e==null||e===0?``:`${e>0?`+`:`−`}${l(e)}`}var j={add:`bg-[color:var(--color-diff-add-bg)] text-primary`,del:`bg-[color:var(--color-diff-del-bg)] text-primary`,hunk:`bg-[color:var(--color-diff-hunk-bg)] text-disabled`,meta:`text-disabled`,context:`text-secondary`},M={add:`text-success`,del:`text-accent`,hunk:`text-disabled`,meta:`text-disabled`,context:`text-disabled`};function N({lines:e}){return(0,D.jsx)(`div`,{className:`min-w-0 max-h-[420px] overflow-auto border-t border-hairline bg-raised font-mono text-label leading-[1.55]`,children:(0,D.jsx)(`div`,{className:`min-w-max`,children:e.map((e,t)=>(0,D.jsxs)(`div`,{className:`flex ${j[e.kind]}`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`w-6 shrink-0 select-none pl-2.5 text-center ${M[e.kind]}`,children:e.gutter}),(0,D.jsx)(`span`,{className:`whitespace-pre pr-4`,children:e.text||`\xA0`})]},t))})})}function P({f:e,lines:t}){let n=A(e.sizeDelta),r=t?E(t):null;return(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1 text-meta`,children:[(0,D.jsx)(`span`,{className:`shrink-0 text-caption font-medium ${k[e.status]}`,children:O[e.status]}),(0,D.jsx)(`span`,{className:`min-w-0 break-all font-mono text-primary`,children:e.path}),r&&(r.added>0||r.removed>0)&&(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-caption`,children:[r.added>0&&(0,D.jsxs)(`span`,{className:`text-success`,children:[`+`,r.added]}),r.added>0&&r.removed>0&&` `,r.removed>0&&(0,D.jsxs)(`span`,{className:`text-accent`,children:[`−`,r.removed]})]}),n&&(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:n}),e.binary&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Binary`}),e.tooLarge&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Too large to diff`})]})}var F=40;function I({files:e}){return(0,D.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{if(!e.diff)return(0,D.jsx)(`div`,{className:`rounded-control border border-hairline bg-surface px-3.5 py-2`,children:(0,D.jsx)(P,{f:e,lines:null})},e.path);let t=T(e.diff);return(0,D.jsxs)(`details`,{open:t.length<=F,className:`group min-w-0 overflow-hidden rounded-control border border-hairline bg-surface`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-2 px-3.5 py-2 marker:content-['']`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled transition-transform group-open:rotate-90`,children:`▸`}),(0,D.jsx)(P,{f:e,lines:t})]}),(0,D.jsx)(N,{lines:t})]},e.path)})})}function L({label:e,count:t,children:n}){return(0,D.jsxs)(`section`,{className:`min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,D.jsxs)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 ${f}`,children:[e,t!=null&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[` (`,t,`)`]})]}),n]})}function R({k:e,children:t}){return(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`div`,{className:`mb-0.5 text-label font-medium text-secondary`,children:e}),(0,D.jsx)(`div`,{className:`min-w-0 text-body text-primary`,children:t})]})}function z(e){return!e||e.inputTokens===void 0&&e.outputTokens===void 0?null:(e.inputTokens??0)+(e.outputTokens??0)}function B({run:e}){let[t,n]=(0,C.useState)(null);return(0,C.useEffect)(()=>{if(e.queued||e.running)return;let t=!0;return i({data:{runId:e.id}}).then(e=>t&&n(e)).catch(()=>t&&n({hasSnapshot:!1,files:[]})),()=>{t=!1}},[e.id,e.queued,e.running]),e.queued||e.running?(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`File changes appear once the run finishes.`})}):t?t.hasSnapshot?(0,D.jsx)(L,{label:`Changes`,count:t.files.length,children:t.files.length===0?(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No files changed since the previous run.`}):(0,D.jsx)(I,{files:t.files})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No file snapshot was recorded for this run.`})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(g,{})})}function V({run:e}){let t=y(Math.max(0,Date.now()-Date.parse(e.ts)));return(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2.5 text-body text-secondary`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:h}),(0,D.jsxs)(`span`,{children:[`Run in progress`,t?` for ${t}`:``,`.`]})]})})}function H({id:e}){let[t,n]=(0,C.useState)(!1);return(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},title:`Copy session id`,className:`inline-flex max-w-full cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left font-mono text-label text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled`,children:t?`✓ copied`:`copy`})]})}var U=64;function W({loopId:e,runId:t}){let[n,i]=(0,C.useState)(null),[s,l]=(0,C.useState)(null),[f,h]=(0,C.useState)(!1),[b,x]=(0,C.useState)(null),w=(0,C.useCallback)(async()=>{try{i(await r({data:e})),x(null)}catch(e){x(String(e))}},[e]),T=(0,C.useCallback)(async()=>{try{i(await r({data:e}))}catch{}},[e]);(0,C.useEffect)(()=>{i(null),l(null),h(!1),x(null),w()},[e,t,w]);let E=n?.runs.find(e=>e.id===t)??s,O=z(E?.usage??null);(0,C.useEffect)(()=>{if(!n||E||f)return;let r=!0;return(async()=>{try{let i=n.runs.length?n.runs[n.runs.length-1].ts:new Date().toISOString();for(let n=0;n<U&&r;n++){let n=await a({data:{loopId:e,beforeTs:i,limit:100}});if(!n.length)break;let o=n.find(e=>e.id===t);if(o){r&&l(o);return}i=n[0].ts}}finally{r&&h(!0)}})(),()=>{r=!1}},[n,E,f,e,t]);let k=!!(E?.queued||E?.running);(0,C.useEffect)(()=>{if(!k)return;let e=setInterval(()=>void T(),3e3);return()=>clearInterval(e)},[k,T]);async function A(){if(!E||!confirm(`Stop this run? If it is running, Pievo will ask the daemon to terminate it.`))return;let e=await o({data:E.id});if(e?.error){alert(`Stop failed: ${e.error}`);return}await w()}if(b)return(0,D.jsx)(S,{title:`Couldn't load this run.`,detail:b,onRetry:()=>void w()});if(!n||!E&&!f)return(0,D.jsx)(g,{});if(!E)return(0,D.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-6 py-10 text-center shadow-card`,children:[(0,D.jsx)(`div`,{className:`text-[14px] text-secondary`,children:`This run is no longer available.`}),(0,D.jsx)(c,{to:`/loops/$loopId`,params:{loopId:e},className:`mt-3 inline-block text-label font-medium text-interactive underline underline-offset-2 hover:text-display`,children:`← Back to the loop`})]});let j=n.summary.name,M=E.role||null;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(`h1`,{className:`text-[26px] font-medium leading-tight tracking-tight text-display`,children:[`Run · `,j]}),(0,D.jsx)(p,{run:E,colorText:!0})]}),(0,D.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 text-meta text-secondary`,children:[(0,D.jsx)(`span`,{className:`text-primary`,children:d(E.ts)}),(0,D.jsx)(`span`,{className:`text-wire`,children:`·`}),M&&(0,D.jsx)(v,{children:M}),E.durationMs!=null&&(0,D.jsx)(v,{tone:`ink`,children:y(E.durationMs)}),(0,D.jsx)(`code`,{className:`font-mono text-disabled`,children:E.id})]})]})}),(0,D.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2.5 border-t border-hairline pt-4`,children:[(0,D.jsx)(c,{to:`/loops/$loopId`,params:{loopId:e},className:_,children:`View the whole loop →`}),(E.queued||E.running)&&(0,D.jsx)(`button`,{type:`button`,onClick:A,className:m,disabled:!!E.running&&n.machine.daemonProtocol!==3,title:E.running&&n.machine.daemonProtocol!==3?"Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.":void 0,children:`Stop run`})]})]}),(0,D.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[E.queued?(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:`Queued; it starts when this loop is free and the machine polls.`})}):E.running?(0,D.jsx)(V,{run:E}):null,E.reportIncident&&(0,D.jsx)(L,{label:`Terminal report rejected`,children:(0,D.jsxs)(`div`,{className:`space-y-3 text-body text-primary`,children:[(0,D.jsx)(`div`,{className:`font-medium`,children:E.reportIncident.code}),(0,D.jsx)(`div`,{className:`break-words text-secondary`,children:E.reportIncident.reason}),(0,D.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-label`,children:[(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Fault domain`}),(0,D.jsx)(`dd`,{children:E.reportIncident.faultDomain}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Recommended action`}),(0,D.jsx)(`dd`,{className:`break-words`,children:E.reportIncident.recommendedAction}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Report ID`}),(0,D.jsx)(`dd`,{className:`break-all font-mono`,children:E.reportIncident.reportId})]})]})}),E.message&&(0,D.jsx)(L,{label:`Report`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words rounded-control border border-hairline bg-raised px-4 py-3.5 text-body leading-relaxed text-primary`,children:E.message})}),(0,D.jsx)(B,{run:E}),E.control&&E.control.length>0&&(0,D.jsx)(L,{label:`Control actions`,count:E.control.length,children:(0,D.jsx)(`ul`,{className:`space-y-1.5`,children:E.control.map((e,t)=>(0,D.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 font-mono text-label`,children:[(0,D.jsx)(`span`,{className:`text-display`,children:e.command}),(0,D.jsx)(`span`,{className:`min-w-0 break-all text-secondary`,children:JSON.stringify(e.args)}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`text-wire`,children:`→`}),(0,D.jsx)(`span`,{className:`text-primary`,children:e.result}),e.detail&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[`(`,e.detail,`)`]})]},t))})}),E.finalText&&(0,D.jsx)(L,{label:`Final output`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body text-primary`,children:E.finalText})})]}),(0,D.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,D.jsx)(L,{label:`Details`,children:(0,D.jsxs)(`div`,{className:`space-y-3.5`,children:[E.status&&(0,D.jsx)(R,{k:`Status`,children:E.status}),E.durationMs!=null&&(0,D.jsx)(R,{k:`Duration`,children:y(E.durationMs)}),E.exitCode!=null&&(0,D.jsx)(R,{k:`Exit code`,children:E.exitCode}),O!=null&&(0,D.jsx)(R,{k:`Token usage`,children:(0,D.jsxs)(`span`,{className:`text-disabled`,children:[u(O),` tokens`]})}),E.metrics!=null&&(0,D.jsx)(R,{k:`Run metrics`,children:(0,D.jsx)(`code`,{className:`block break-all font-mono text-label text-secondary`,children:JSON.stringify(E.metrics)})}),E.error&&(0,D.jsx)(R,{k:`Error`,children:(0,D.jsx)(`span`,{className:`break-words`,style:{color:`var(--color-run-error)`},children:E.error})}),E.sessionId&&(0,D.jsx)(R,{k:`Session`,children:(0,D.jsx)(H,{id:E.sessionId})})]})})})]})]})}function G(){let{loopId:e,runId:t}=b.useParams(),{auth:n}=b.useLoaderData()??{auth:{enabled:!1}},{data:r,isPending:i}=s();return(0,D.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,D.jsx)(`div`,{className:`mb-5`,children:(0,D.jsxs)(c,{to:`/loops/$loopId`,params:{loopId:e},className:`inline-flex items-center gap-1.5 text-label font-medium text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]})}),n?.enabled&&!i&&!r?(0,D.jsx)(x,{callbackURL:`/loops/${e}/runs/${t}`}):(0,D.jsx)(W,{loopId:e,runId:t})]})}export{G as component};
|
|
3
|
+
`).map(e=>{let t=w(e,n);return t.kind===`hunk`&&(n=!0),t})}function E(e){let t=0,n=0;for(let r of e)r.kind===`add`?t++:r.kind===`del`&&n++;return{added:t,removed:n}}var D=n(),O={added:`Added`,modified:`Changed`,removed:`Removed`},k={added:`text-success`,modified:`text-secondary`,removed:`text-accent`};function A(e){return e==null||e===0?``:`${e>0?`+`:`−`}${l(e)}`}var j={add:`bg-[color:var(--color-diff-add-bg)] text-primary`,del:`bg-[color:var(--color-diff-del-bg)] text-primary`,hunk:`bg-[color:var(--color-diff-hunk-bg)] text-disabled`,meta:`text-disabled`,context:`text-secondary`},M={add:`text-success`,del:`text-accent`,hunk:`text-disabled`,meta:`text-disabled`,context:`text-disabled`};function N({lines:e}){return(0,D.jsx)(`div`,{className:`min-w-0 max-h-[420px] overflow-auto border-t border-hairline bg-raised font-mono text-label leading-[1.55]`,children:(0,D.jsx)(`div`,{className:`min-w-max`,children:e.map((e,t)=>(0,D.jsxs)(`div`,{className:`flex ${j[e.kind]}`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`w-6 shrink-0 select-none pl-2.5 text-center ${M[e.kind]}`,children:e.gutter}),(0,D.jsx)(`span`,{className:`whitespace-pre pr-4`,children:e.text||`\xA0`})]},t))})})}function P({f:e,lines:t}){let n=A(e.sizeDelta),r=t?E(t):null;return(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1 text-meta`,children:[(0,D.jsx)(`span`,{className:`shrink-0 text-caption font-medium ${k[e.status]}`,children:O[e.status]}),(0,D.jsx)(`span`,{className:`min-w-0 break-all font-mono text-primary`,children:e.path}),r&&(r.added>0||r.removed>0)&&(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-caption`,children:[r.added>0&&(0,D.jsxs)(`span`,{className:`text-success`,children:[`+`,r.added]}),r.added>0&&r.removed>0&&` `,r.removed>0&&(0,D.jsxs)(`span`,{className:`text-accent`,children:[`−`,r.removed]})]}),n&&(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:n}),e.binary&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Binary`}),e.tooLarge&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Too large to diff`})]})}var F=40;function I({files:e}){return(0,D.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{if(!e.diff)return(0,D.jsx)(`div`,{className:`rounded-control border border-hairline bg-surface px-3.5 py-2`,children:(0,D.jsx)(P,{f:e,lines:null})},e.path);let t=T(e.diff);return(0,D.jsxs)(`details`,{open:t.length<=F,className:`group min-w-0 overflow-hidden rounded-control border border-hairline bg-surface`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-2 px-3.5 py-2 marker:content-['']`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled transition-transform group-open:rotate-90`,children:`▸`}),(0,D.jsx)(P,{f:e,lines:t})]}),(0,D.jsx)(N,{lines:t})]},e.path)})})}function L({label:e,count:t,children:n}){return(0,D.jsxs)(`section`,{className:`min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,D.jsxs)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 ${f}`,children:[e,t!=null&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[` (`,t,`)`]})]}),n]})}function R({k:e,children:t}){return(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`div`,{className:`mb-0.5 text-label font-medium text-secondary`,children:e}),(0,D.jsx)(`div`,{className:`min-w-0 text-body text-primary`,children:t})]})}function z(e){return!e||e.inputTokens===void 0&&e.outputTokens===void 0?null:(e.inputTokens??0)+(e.outputTokens??0)}function B({run:e}){let[t,n]=(0,C.useState)(null);return(0,C.useEffect)(()=>{if(e.queued||e.running)return;let t=!0;return i({data:{runId:e.id}}).then(e=>t&&n(e)).catch(()=>t&&n({hasSnapshot:!1,files:[]})),()=>{t=!1}},[e.id,e.queued,e.running]),e.queued||e.running?(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`File changes appear once the run finishes.`})}):t?t.hasSnapshot?(0,D.jsx)(L,{label:`Changes`,count:t.files.length,children:t.files.length===0?(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No files changed since the previous run.`}):(0,D.jsx)(I,{files:t.files})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No file snapshot was recorded for this run.`})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(g,{})})}function V({run:e}){let t=y(Math.max(0,Date.now()-Date.parse(e.ts)));return(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2.5 text-body text-secondary`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:h}),(0,D.jsxs)(`span`,{children:[`Run in progress`,t?` for ${t}`:``,`.`]})]})})}function H({id:e}){let[t,n]=(0,C.useState)(!1);return(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},title:`Copy session id`,className:`inline-flex max-w-full cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left font-mono text-label text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled`,children:t?`✓ copied`:`copy`})]})}var U=64;function W({loopId:e,runId:t}){let[n,i]=(0,C.useState)(null),[s,l]=(0,C.useState)(null),[f,h]=(0,C.useState)(!1),[b,x]=(0,C.useState)(null),w=(0,C.useCallback)(async()=>{try{i(await r({data:e})),x(null)}catch(e){x(String(e))}},[e]),T=(0,C.useCallback)(async()=>{try{i(await r({data:e}))}catch{}},[e]);(0,C.useEffect)(()=>{i(null),l(null),h(!1),x(null),w()},[e,t,w]);let E=n?.runs.find(e=>e.id===t)??s,O=z(E?.usage??null);(0,C.useEffect)(()=>{if(!n||E||f)return;let r=!0;return(async()=>{try{let i=n.runs.length?n.runs[n.runs.length-1].ts:new Date().toISOString();for(let n=0;n<U&&r;n++){let n=await a({data:{loopId:e,beforeTs:i,limit:100}});if(!n.length)break;let o=n.find(e=>e.id===t);if(o){r&&l(o);return}i=n[0].ts}}finally{r&&h(!0)}})(),()=>{r=!1}},[n,E,f,e,t]);let k=!!(E?.queued||E?.running||E?.reconciliation);(0,C.useEffect)(()=>{if(!k)return;let e=setInterval(()=>void T(),3e3);return()=>clearInterval(e)},[k,T]);async function A(){if(!E||!confirm(`Stop this run? If it is running, Pievo will ask the daemon to terminate it.`))return;let e=await o({data:E.id});if(e?.error){alert(`Stop failed: ${e.error}`);return}await w()}if(b)return(0,D.jsx)(S,{title:`Couldn't load this run.`,detail:b,onRetry:()=>void w()});if(!n||!E&&!f)return(0,D.jsx)(g,{});if(!E)return(0,D.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-6 py-10 text-center shadow-card`,children:[(0,D.jsx)(`div`,{className:`text-[14px] text-secondary`,children:`This run is no longer available.`}),(0,D.jsx)(c,{to:`/loops/$loopId`,params:{loopId:e},className:`mt-3 inline-block text-label font-medium text-interactive underline underline-offset-2 hover:text-display`,children:`← Back to the loop`})]});let j=n.summary.name,M=E.role||null;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(`h1`,{className:`text-[26px] font-medium leading-tight tracking-tight text-display`,children:[`Run · `,j]}),(0,D.jsx)(p,{run:E,colorText:!0})]}),(0,D.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 text-meta text-secondary`,children:[(0,D.jsx)(`span`,{className:`text-primary`,children:d(E.ts)}),(0,D.jsx)(`span`,{className:`text-wire`,children:`·`}),M&&(0,D.jsx)(v,{children:M}),E.durationMs!=null&&(0,D.jsx)(v,{tone:`ink`,children:y(E.durationMs)}),(0,D.jsx)(`code`,{className:`font-mono text-disabled`,children:E.id})]})]})}),(0,D.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2.5 border-t border-hairline pt-4`,children:[(0,D.jsx)(c,{to:`/loops/$loopId`,params:{loopId:e},className:_,children:`View the whole loop →`}),(E.queued||E.running)&&(0,D.jsx)(`button`,{type:`button`,onClick:A,className:m,disabled:!!E.running&&n.machine.daemonProtocol!==3,title:E.running&&n.machine.daemonProtocol!==3?"Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.":void 0,children:`Stop run`})]})]}),(0,D.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[E.queued?(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:`Queued; it starts when this loop is free and the machine polls.`})}):E.running?(0,D.jsx)(V,{run:E}):E.reconciliation?(0,D.jsx)(L,{label:`Recovery`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:E.reconciliation===`blocking`?n.machine.presence===`online`?`The machine is online and checking an interrupted run. Queued work starts automatically after recovery.`:`Waiting for the machine to reconnect and check an interrupted run. Queued work starts automatically; no action is required.`:`This interrupted run no longer blocks queued work. Pievo will still accept its saved report if it arrives.`})}):null,E.reportIncident&&(0,D.jsx)(L,{label:`Terminal report rejected`,children:(0,D.jsxs)(`div`,{className:`space-y-3 text-body text-primary`,children:[(0,D.jsx)(`div`,{className:`font-medium`,children:E.reportIncident.code}),(0,D.jsx)(`div`,{className:`break-words text-secondary`,children:E.reportIncident.reason}),(0,D.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-label`,children:[(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Fault domain`}),(0,D.jsx)(`dd`,{children:E.reportIncident.faultDomain}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Recommended action`}),(0,D.jsx)(`dd`,{className:`break-words`,children:E.reportIncident.recommendedAction}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Report ID`}),(0,D.jsx)(`dd`,{className:`break-all font-mono`,children:E.reportIncident.reportId})]})]})}),E.message&&(0,D.jsx)(L,{label:`Report`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words rounded-control border border-hairline bg-raised px-4 py-3.5 text-body leading-relaxed text-primary`,children:E.message})}),(0,D.jsx)(B,{run:E}),E.control&&E.control.length>0&&(0,D.jsx)(L,{label:`Control actions`,count:E.control.length,children:(0,D.jsx)(`ul`,{className:`space-y-1.5`,children:E.control.map((e,t)=>(0,D.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 font-mono text-label`,children:[(0,D.jsx)(`span`,{className:`text-display`,children:e.command}),(0,D.jsx)(`span`,{className:`min-w-0 break-all text-secondary`,children:JSON.stringify(e.args)}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`text-wire`,children:`→`}),(0,D.jsx)(`span`,{className:`text-primary`,children:e.result}),e.detail&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[`(`,e.detail,`)`]})]},t))})}),E.finalText&&(0,D.jsx)(L,{label:`Final output`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body text-primary`,children:E.finalText})})]}),(0,D.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,D.jsx)(L,{label:`Details`,children:(0,D.jsxs)(`div`,{className:`space-y-3.5`,children:[E.status&&(0,D.jsx)(R,{k:`Status`,children:E.status}),E.durationMs!=null&&(0,D.jsx)(R,{k:`Duration`,children:y(E.durationMs)}),E.exitCode!=null&&(0,D.jsx)(R,{k:`Exit code`,children:E.exitCode}),O!=null&&(0,D.jsx)(R,{k:`Token usage`,children:(0,D.jsxs)(`span`,{className:`text-disabled`,children:[u(O),` tokens`]})}),E.metrics!=null&&(0,D.jsx)(R,{k:`Run metrics`,children:(0,D.jsx)(`code`,{className:`block break-all font-mono text-label text-secondary`,children:JSON.stringify(E.metrics)})}),E.error&&(0,D.jsx)(R,{k:`Error`,children:(0,D.jsx)(`span`,{className:`break-words`,style:{color:`var(--color-run-error)`},children:E.error})}),E.sessionId&&(0,D.jsx)(R,{k:`Session`,children:(0,D.jsx)(H,{id:E.sessionId})})]})})})]})]})}function G(){let{loopId:e,runId:t}=b.useParams(),{auth:n}=b.useLoaderData()??{auth:{enabled:!1}},{data:r,isPending:i}=s();return(0,D.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,D.jsx)(`div`,{className:`mb-5`,children:(0,D.jsxs)(c,{to:`/loops/$loopId`,params:{loopId:e},className:`inline-flex items-center gap-1.5 text-label font-medium text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]})}),n?.enabled&&!i&&!r?(0,D.jsx)(x,{callbackURL:`/loops/${e}/runs/${t}`}):(0,D.jsx)(W,{loopId:e,runId:t})]})}export{G as component};
|
|
@@ -1 +1 @@
|
|
|
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-CT1mMhlb.js";import{$ as s,A as c,At as l,B as u,Bt as d,C as f,Ct as p,D as m,Dt as h,E as g,Et as _,F as v,Ft as y,G as b,Gt as x,H as S,Ht as C,I as w,It as T,J as E,Jt as D,K as O,Kt as k,L as A,Lt as j,M,Mt as N,N as P,Nt as F,O as I,Ot as L,P as ee,Pt as R,Q as te,R as z,Rt as ne,S as re,St as ie,T as ae,Tt as oe,U as se,Ut as ce,V as le,Vt as ue,W as de,Wt as fe,X as B,Xt as pe,Y as V,Yt as me,Z as H,_ as he,_t as ge,a as _e,at as ve,b as ye,bt as be,c as xe,ct as Se,d as Ce,dt as we,et as Te,f as Ee,ft as De,g as Oe,gt as ke,h as Ae,ht as je,i as Me,it as U,j as Ne,jt as W,k as Pe,kt as Fe,l as Ie,m as Le,mt as Re,n as ze,nt as Be,o as Ve,ot as G,p as He,pt as K,q as Ue,qt as q,r as We,rt as J,s as Ge,st as Y,t as Ke,tt as qe,u as Je,ut as Ye,v as Xe,vt as Ze,w as Qe,wt as $e,x as et,xt as X,y as tt,yt as nt,z as rt,zt as it}from"./Modal-Ba36NAkv.js";import{A as at,C as ot,M as st,S as ct,T as lt,c as ut,h 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-Gb1413-F.js";import{n as bt}from"./lifecycleUi-CMFw5Nlj.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(k(72));return t}function wt(e,t){return t!=null&&!d(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 ce,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=fe();return q(()=>{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 q(()=>{m.current=n},[n]),q(()=>()=>{h.current=!0},[]),q(()=>{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]),q(()=>{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,Y(we))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),q(()=>()=>{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),[f,p]=Q.useState(),[m,h]=Q.useState([]),g=J(e=>{i.set(`positionReference`,e)}),_=J((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:f}))}),v=J(e=>{a?u.current||(_(e.clientX,e.clientY,e.currentTarget),h([])):_(e.clientX,e.clientY,e.currentTarget)}),y=d(f)?o:a;Q.useEffect(()=>{if(!n){g(s);return}if(!y)return;function e(){u.current?.(),u.current=null}let t=W(o);function r(t){X(o,ie(t))?e():_(t.clientX,t.clientY)}return!c.current.openEvent||Pt(c.current.openEvent)?u.current=G(t,`mousemove`,r):g(s),e},[y,n,o,c,s,i,_,g,m]),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 b=Q.useMemo(()=>{function e(e){p(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return Q.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}function It(e,t,n){let{reference:r,floating:i}=e,a=B(t),o=le(t),s=se(o),c=V(t),l=a===`y`,d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2,m;switch(c){case`top`:m={x:d,y:r.y-i.height};break;case`bottom`:m={x:d,y:r.y+r.height};break;case`right`:m={x:r.x+r.width,y:f};break;case`left`:m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}switch(u(t)){case`start`:m[o]-=p*(n&&l?-1:1);break;case`end`:m[o]+=p*(n&&l?-1:1);break}return m}async function Lt(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=z(t,e),m=E(p),h=o[f?d===`floating`?`reference`:`floating`:d],g=s(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:l,rootBoundary:u,strategy:c})),_=d===`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=s(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:v,strategy:c}):_);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}=z(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=V(r),_=B(o),v=V(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ue(o)]:de(o)),x=p!==`none`;!d&&x&&b.push(...O(o,m,p,y));let C=[o,...b],w=await s.detectOverflow(t,h),T=[],E=i.flip?.overflows||[];if(l&&T.push(w[g]),u){let e=S(r,a,y);T.push(w[e[0]],w[e[1]])}if(E=[...E,{placement:r,overflows:T}],!T.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=C[e];if(t&&(!(u===`alignment`&&_!==B(t))||E.every(e=>B(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:E},reset:{placement:t}};let n=E.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=E.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 qe.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}=z(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=V(n),s=u(n),c=B(n)===`y`,l=Wt.has(o)?-1:1,d=a&&c?-1:1,f=z(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof f==`number`?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof h==`number`&&(m=s===`end`?h*-1:h),c?{x:m*d,y:p*l}:{x:p*l,y:m*d}}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}=z(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=B(V(i)),p=b(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=w(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=w(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}=z(e,t),u={x:n,y:r},d=B(i),f=b(d),p=u[f],m=u[d],h=z(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(V(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}=z(e,t),d=await o.detectOverflow(t,l),f=V(i),p=u(i),m=B(i)===`y`,{width:h,height:g}=a.floating,_,v;f===`top`||f===`bottom`?(_=f,v=p===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(v=f,_=p===`end`?`top`:`bottom`);let y=g-d.top-d.bottom,b=h-d.left-d.right,x=te(g-d[_],y),S=te(h-d[v],b),C=!t.middlewareData.shift,w=x,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=y),C&&!p){let e=H(d.left,0),t=H(d.right,0),n=H(d.top,0),r=H(d.bottom,0);m?T=h-2*(e!==0||t!==0?e+t:H(d.left,d.right)):w=g-2*(n!==0||r!==0?n+r:H(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:w});let E=await o.getDimensions(s.floating);return h!==E.width||g!==E.height?{reset:{rects:!0}}:{}}}};function Xt(e){let t=p(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=R(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Te(n)!==a||Te(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Zt(e){return F(e)?e:e.contextElement}function Qt(e){let t=Zt(e);if(!R(t))return A(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Xt(t),o=(a?Te(n.width):n.width)/r,s=(a?Te(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var $t=A(0);function en(e){let t=W(e);return!it()||!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!==W(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=A(1);t&&(r?F(r)&&(o=Qt(r)):o=Qt(e));let c=tn(a,n,r)?en(a):A(0),l=(i.left+c.x)/o.x,u=(i.top+c.y)/o.y,d=i.width/o.x,f=i.height/o.y;if(a){let e=W(a),t=r&&F(r)?W(r):r,n=e,i=_(n);for(;i&&r&&t!==n;){let e=Qt(i),t=i.getBoundingClientRect(),r=p(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,u*=e.y,d*=e.x,f*=e.y,l+=a,u+=o,n=W(i),i=_(n)}}return s({width:d,height:f,x:l,y:u})}function rn(e,t){let n=L(e).scrollLeft;return t?t.left+n:nn(oe(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=oe(r),s=t?ne(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=A(1),u=A(0),d=R(r);if((d||!d&&!a)&&((h(r)!==`body`||T(o))&&(c=L(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):A(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=oe(e),n=L(e),r=e.ownerDocument.body,i=H(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=H(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+rn(e),s=-n.scrollTop;return p(r).direction===`rtl`&&(o+=H(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ln=25;function un(e,t){let n=W(e),r=oe(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=it();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=rn(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ln&&(a-=o)}else l<=ln&&(a+=l);return{width:a,height:o,x:s,y:c}}function dn(e,t){let n=nn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=R(e)?Qt(e):A(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(oe(e));else if(F(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 s(r)}function pn(e,t){let n=l(e);return n===t||!F(n)||y(n)?!1:p(n).position===`fixed`||pn(n,t)}function mn(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>F(e)&&h(e)!==`body`),i=null,a=p(e).position===`fixed`,o=a?l(e):e;for(;F(o)&&!y(o);){let t=p(o),n=N(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||T(o)&&!n&&pn(e,o))?r=r.filter(e=>e!==o):i=t,o=l(o)}return t.set(e,r),r}function hn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ne(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=H(n.top,s),c=te(n.right,c),l=te(n.bottom,l),u=H(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=R(t),i=oe(t),a=n===`fixed`,o=nn(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=A(0);function l(){c.x=rn(i)}if(r||!r&&!a)if((h(t)!==`body`||T(i))&&(s=L(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):A(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 p(e).position===`static`}function yn(e,t){if(!R(e)||p(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return oe(e)===n&&(n=n.ownerDocument.body),n}function bn(e,t){let n=W(e);if(ne(e))return n;if(!R(e)){let t=l(e);for(;t&&!y(t);){if(F(t)&&!vn(t))return t;t=l(t)}return n}let r=yn(e,t);for(;r&&j(r)&&vn(r);)r=yn(r,t);return r&&y(r)&&vn(r)&&!N(r)?n:r||$e(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 p(e).direction===`rtl`}var Cn={convertOffsetParentRelativeRectToViewportRelativeRect:on,getDocumentElement:oe,getClippingRect:hn,getOffsetParent:bn,getElementRects:xn,getClientRects:sn,getDimensions:gn,getScale:Qt,isElement:F,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=oe(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=rt(d),h=rt(i.clientWidth-(u+f)),g=rt(i.clientHeight-(d+p)),_=rt(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:H(0,te(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!wn(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function 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?Fe(l):[],...t?Fe(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=P(),a=g()!=null,o=pe(()=>new re({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ce,floatingId:i,syncOnly:!1,nested:a})).current;return q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=F(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),[h,g]=Q.useState(void 0),_=Q.useRef(null),v=m(n),y=Q.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),b=zn({...e,elements:{...y,...u&&{reference:u}}}),x=F(f)?f:null,S=h===void 0?i.state.floatingElement:h;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:x),i.useSyncedValue(`floatingElement`,S);let C=Q.useCallback(e=>{let t=F(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),b.refs.setReference(t)},[b.refs]),w=Q.useCallback(e=>{(F(e)||e===null)&&(_.current=e,p(e)),(F(b.refs.reference.current)||b.refs.reference.current===null||e!==null&&!F(e))&&b.refs.setReference(e)},[b.refs,p]),T=Q.useCallback(e=>{g(e),b.refs.setFloating(e)},[b.refs]),E=Q.useMemo(()=>({...b.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:_}),[b.refs,w,T,C]),D=Q.useMemo(()=>({...b.elements,domReference:s}),[b.elements,s]),O=Q.useMemo(()=>({...b,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:E,elements:D,nodeId:t,rootStore:i}),[b,E,D,t,i,c,l]);return q(()=>{s&&(_.current=s)},[s]),q(()=>{i.context.dataRef.current.floatingContext=O;let e=v?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),Q.useMemo(()=>({...b,context:O,refs:E,elements:D,rootStore:i}),[b,E,D,O,i])}var Jn=C&&ue;function Yn(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Q.useRef(!1),c=Q.useRef(null),l=Q.useRef(!0),u=fe();Q.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=W(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&R(e)&&e===be(Be(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return ve(G(t,`blur`,r),Jn&&G(t,`keydown`,a,!0),Jn&&G(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`);F(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Q.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=ie(t.nativeEvent);if(F(a)){if(Jn&&!t.relatedTarget){if(!l.current&&!Ze(a))return}else if(!nt(a))return}let o=ge(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,Y(De,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,Y(De,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=F(n)&&n.hasAttribute(ee(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=be(Be(e));!n&&t===e||X(o.current.floatingContext?.refs.floating.current,t)||X(e,t)||a||ge(n??t,i.context.triggerElements)||i.setOpen(!1,Y(De,r))})}}},[o,r,i,u]);return Q.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}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 ce,this.restTimeout=new ce,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=pe(()=>t.hoverInteractionState??Xn.create()).current;return t.hoverInteractionState||=n,x(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,u=m(),d=g(),f=er(a),p=fe(),h=J(()=>Dt(l.current.openEvent?.type,f.interactedInside)),_=J(()=>Ot(l.current.openEvent?.type)),y=J(()=>{Qn(f)});q(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,y())},[o,f,y]),Q.useEffect(()=>y,[y]),q(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&_()&&F(c)&&s){let e=c,t=s,n=Be(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r;return $n(f,{scopeElement:f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{y()}}},[n,o,c,s,f,_,u,d,y]),Q.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&v(u.nodesRef.current,d).length>0)}function t(e){let t=Tt(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,Y(K,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=ie(e);if(!ke(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,g),y()}function m(n){if(e()&&u){u.events.on(`floating.closed`,g);return}if(ge(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&F(o)&&v(u.nodesRef.current,r,!1).some(e=>X(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}y(),_()&&!h()&&t(n)}}function g(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,g),a.setOpen(!1,Y(K,t)),u.events.emit(`floating.closed`,t)})}let b=s;return ve(b&&G(b,`mouseenter`,c),b&&G(b,`mouseleave`,m),b&&G(b,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,g)})},[n,s,a,l,r,i,_,h,y,f,u,d,p])}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:f,isClosing:p,shouldOpen:h}=t,g=`rootStore`in e?e.rootStore:e,{dataRef:_,events:v}=g.context,y=m(l),b=er(g),x=Q.useRef(!1),S=U(i),C=U(r),w=U(o),T=U(n),E=U(h),D=U(p),O=J(()=>Dt(_.current.openEvent?.type,b.interactedInside)),k=J(()=>E.current?.()!==!1),A=J((e,t,n)=>{let r=g.context.triggerElements;if(r.hasElement(t))return!e||!X(e,t);if(!F(n))return!1;let i=n;return r.hasMatchingElement(e=>X(e,i))&&(!e||!X(e,i))}),j=J(()=>{b.handler&&=(Be(g.select(`domReferenceElement`)).removeEventListener(`mousemove`,b.handler),void 0)}),M=J(()=>{Qn(b)});return u&&(b.handleCloseOptions=S.current?.__options),Q.useEffect(()=>j,[j]),Q.useEffect(()=>{if(!n)return;function e(e){e.open?x.current=!1:(x.current=e.reason===K,j(),b.openChangeTimeout.clear(),b.restTimeout.clear(),b.blockMouseMove=!0,b.restTimeoutPending=!1)}return v.on(`openchange`,e),()=>{v.off(`openchange`,e)}},[n,v,b,j]),Q.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Tt(C.current,`close`,b.pointerType);n?b.openChangeTimeout.start(n,()=>{g.setOpen(!1,Y(K,e)),y?.events.emit(`floating.closed`,e)}):t&&(b.openChangeTimeout.clear(),g.setOpen(!1,Y(K,e)),y?.events.emit(`floating.closed`,e))}let t=c.current??(u?g.select(`domReferenceElement`):null);if(!F(t))return;function r(e){if(b.openChangeTimeout.clear(),b.blockMouseMove=!1,a&&!d(b.pointerType))return;let t=Et(w.current),n=Tt(C.current,`open`,b.pointerType),r=ie(e),i=e.currentTarget??null,o=g.select(`domReferenceElement`),s=i;if(F(r)&&!g.context.triggerElements.hasElement(r)){for(let e of g.context.triggerElements.elements())if(X(e,r)){s=e;break}}F(i)&&F(o)&&!g.context.triggerElements.hasElement(i)&&X(i,o)&&(s=o);let c=s==null?!1:A(o,s,r),l=g.select(`open`),u=D.current?.()??g.select(`transitionStatus`)===`ending`,f=!l&&u&&x.current,p=!c&&F(s)&&F(o)&&X(o,s)&&f,m=t>0&&!n,h=c&&(l||f)||p,_=!l||c;if(h){k()&&g.setOpen(!0,Y(K,e,s));return}m||(n?b.openChangeTimeout.start(n,()=>{_&&k()&&g.setOpen(!0,Y(K,e,s))}):_&&k()&&g.setOpen(!0,Y(K,e,s)))}function i(t){if(O()){M();return}j();let n=Be(g.select(`domReferenceElement`));b.restTimeout.clear(),b.restTimeoutPending=!1;let r=_.current.floatingContext??f?.();if(!ge(t.relatedTarget,g.context.triggerElements)){if(S.current&&r){g.select(`open`)||b.openChangeTimeout.clear();let i=c.current;b.handler=S.current({...r,tree:y,x:t.clientX,y:t.clientY,onClose(){M(),j(),T.current&&!O()&&i===g.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,b.handler),b.handler(t);return}(b.pointerType!==`touch`||!X(g.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?ve(G(t,`mousemove`,r,{once:!0}),G(t,`mouseenter`,r),G(t,`mouseleave`,i)):ve(G(t,`mouseenter`,r),G(t,`mouseleave`,i))},[j,M,_,C,g,n,S,b,u,A,O,a,s,w,c,y,T,f,D,k]),Q.useMemo(()=>{if(!n)return;function e(e){b.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=g.select(`domReferenceElement`),i=g.select(`open`),o=A(r,n,e.target);if(a&&!d(b.pointerType))return;if(i&&o&&b.handleCloseOptions?.blockPointerEvents){let e=g.select(`floatingElement`);e&&$n(b,{scopeElement:b.handleCloseOptions?.getScope?.()??n.ownerDocument.body,referenceElement:n,floatingElement:e})}let s=Et(w.current);if(i&&!o||s===0||!o&&b.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;b.restTimeout.clear();function c(){if(b.restTimeoutPending=!1,O())return;let e=g.select(`open`);!b.blockMouseMove&&(!e||o)&&k()&&g.setOpen(!0,Y(K,t,n))}b.pointerType===`touch`?xt.flushSync(()=>{c()}):o&&i?c():(b.restTimeoutPending=!0,b.restTimeout.start(s,c))}}},[n,b,O,A,a,g,w,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 ce,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=ie(r),g=r.type===`mouseleave`,_=X(u,h),y=X(a,h);if(_&&(l=!0,!g))return;if(y&&(l=!1,!g)){l=!0;return}if(g&&F(r.relatedTarget)&&X(u,r.relatedTarget))return;function b(){return!!(s&&v(s.nodesRef.current,o).length>0)}function x(){b()||m()}if(b())return;let S=a.getBoundingClientRect(),C=u.getBoundingClientRect(),w=e>C.right-C.width/2,T=t>C.bottom-C.height/2,E=C.width>S.width,D=C.height>S.height,O=(E?S:C).left,k=(E?S:C).right,A=(D?S:C).top,j=(D?S:C).bottom;if(c===`top`&&t>=S.bottom-1||c===`bottom`&&t<=S.top+1||c===`left`&&e>=S.right-1||c===`right`&&e<=S.left+1){x();return}let M=!1;switch(c){case`top`:M=lr(d,f,O,S.top+1,k,C.bottom-1);break;case`bottom`:M=lr(d,f,O,C.top+1,k,S.bottom-1);break;case`left`:M=lr(d,f,C.right-1,j,S.left+1,A);break;case`right`:M=lr(d,f,S.right-1,j,C.left+1,A);break;default:}if(M)return;if(l&&!cr(d,f,S)){x();return}if(!g&&p(d,f)){x();return}let N=!1;switch(c){case`top`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t+$+1,o=w||E?C.bottom-$:C.top,s=w?E?C.bottom-$:C.top:C.bottom-$;N=sr(d,f,r,a,i,a,C.left,o,C.right,s);break}case`bottom`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t-$,o=w||E?C.top+$:C.bottom,s=w?E?C.top+$:C.bottom:C.top+$;N=sr(d,f,r,a,i,a,C.left,o,C.right,s);break}case`left`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e+$+1,o=T||D?C.right-$:C.left,s=T?D?C.right-$:C.left:C.right-$;N=sr(d,f,o,C.top,s,C.bottom,a,r,a,i);break}case`right`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e-$,o=T||D?C.left+$:C.right,s=T?D?C.left+$:C.right:C.left+$;N=sr(d,f,a,r,a,i,o,C.top,s,C.bottom);break}default:}N?l||n.start(40,x):x()}};return r.__options={...e,blockPointerEvents:t},r}var dr={...Je,disabled:Qe(e=>e.disabled),instantType:Qe(e=>e.instantType),isInstantPhase:Qe(e=>e.isInstantPhase),trackCursorAxis:Qe(e=>e.trackCursorAxis),disableHoverablePopup:Qe(e=>e.disableHoverablePopup),lastOpenChangeReason:Qe(e=>e.openChangeReason),closeOnClick:Qe(e=>e.closeOnClick),closeDelay:Qe(e=>e.closeDelay),hasViewport:Qe(e=>e.hasViewport)},fr=class e extends f{constructor(e,t,n=!1){let r=new Ce,i={...pr(),...e};i.floatingRootContext=Ie(r,t,n),super(i,{popupRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},dr)}setOpen=(e,t)=>{He(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,Y(Re,e))}static useStore(t,n){return Xe(t,(t,r)=>new e(n,t,r)).store}};function pr(){return{...xe(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var mr=D(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=fr.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});Ae(p,r,n,d),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),p.useSyncedValue(`disabled`,t),Le(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=Oe(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Q.useRef(null);q(()=>{m&&t&&p.setOpen(!1,Y(Se))},[m,t,p]),q(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let T=Q.useCallback(()=>{p.setOpen(!1,Y(Ye))},[p]);Q.useImperativeHandle(o,()=>({unmount:y,close:T}),[y,T]);let E=h||_||!t&&a!==`none`;return(0,Z.jsxs)(St.Provider,{value:p,children:[E&&(0,Z.jsx)(hr,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function hr({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=ae(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=Ft(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n});return he(e,{activeTriggerProps:Q.useMemo(()=>M(a.reference,i.reference),[a.reference,i.reference]),inactiveTriggerProps:Q.useMemo(()=>M(a.trigger,i.trigger),[a.trigger,i.trigger]),popupProps:Q.useMemo(()=>M(Ee,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=_e.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(F(n))return n}}let t=e.target;return F(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&&F(n.host)?n.host:null}return null}var Sr=me(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:f,...p}=e,m=Ct(!0),h=a?.store??m;if(!h)throw Error(k(82));let g=Me(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`isOpenedByTrigger`,g),y=h.useState(`floatingRootContext`),b=Q.useRef(null),x=c??600,S=u??0,{registerTrigger:C,isMountedByThisTrigger:w}=tt(g,b,h,{payload:o,closeOnClick:l,closeDelay:S}),T=_r(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Mt(y,{open:v}),A=er(y);h.useSyncedValue(`isInstantPhase`,D);let j=h.useState(`disabled`),M=s??j,N=U(M),P=h.useState(`trackCursorAxis`),F=h.useState(`disableHoverablePopup`),I=Q.useRef(!1),L=fe(),ee=Q.useRef(void 0);function R(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:c??e??x),n}function te(e){let t=b.current;if(!t||!e)return!1;let n=xr(e);return n!==null&&n!==t&&X(t,n)}function z(e){let t=te(e);return I.current=t,t&&(A.openChangeTimeout.clear(),A.restTimeout.clear(),A.restTimeoutPending=!1,L.clear()),t}let ne=rr(y,{enabled:!M,mouseOnly:!0,move:!1,handleClose:!F&&P!==`both`?ur():null,restMs:R,delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return u==null&&O&&(t=e),{close:t}},triggerElementRef:b,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!I.current}}),re=Yn(y,{enabled:!M}).reference,ie=e=>{let t=I.current,n=br(e),r=z(n),i=b.current,a=i&&n&&X(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,Y(K,e));return}if(t&&!r&&a&&!N.current&&!h.select(`open`)&&i&&d(ee.current)){let t=()=>{!I.current&&!N.current&&!h.select(`open`)&&h.setOpen(!0,Y(K,e,i))},n=R();n===0?(L.clear(),t()):L.start(n,t)}},ae=h.useState(`triggerProps`,w);return Ne(`button`,e,{state:{open:v},ref:[t,C,b],props:[ne,re,w||P!==`none`?ae:void 0,{onMouseOver(e){ie(e.nativeEvent)},onFocus(e){te(br(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){I.current=!1,L.clear(),ee.current=void 0},onPointerEnter(e){ee.current=e.pointerType},onPointerDown(e){ee.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]:M?``:void 0,[yr]:M?void 0:``},p],stateAttributesMapping:Ge})}),Cr=Q.createContext(void 0);function wr(){let e=Q.useContext(Cr);if(e===void 0)throw Error(k(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}=I({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(k(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:d=0,offsetParent:f=`real`}=z(e,t)||{};if(l==null)return{};let p=E(d),m={x:n,y:r},h=le(i),g=se(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],T=f===`real`?await o.getOffsetParent?.(l):s.floating,D=s.floating[x]||a.floating[g];(!D||!await o.isElement?.(T))&&(D=s.floating[x]||a.floating[g]);let O=S/2-C/2,k=D/2-_[g]/2-1,A=Math.min(p[y],k),j=Math.min(p[b],k),M=A,N=D-_[g]-j,P=D/2-_[g]/2+O,F=w(M,P,N),I=!c.arrow&&u(i)!=null&&P!==F&&a.reference[g]/2-(P<M?A:j)-_[g]/2<0,L=I?P<M?P-M:P-N:0;return{[h]:m[h]+L,data:{[h]:F,centerOffset:P-F-L,...I&&{alignmentOffset:L}},reset:I}}}),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=W(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=Be(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=V(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,V(i),n),align:u(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:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Q.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=typeof t==`function`?t:void 0,k=J(O),A=O?k:t,j=U(t),M=U(g),N=Ar()===`rtl`,P=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),ee=+(r===`top`),R=+(r===`right`),te=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+te,bottom:I+ee,left:I+R}:I&&={top:(I.top||0)+L,right:(I.right||0)+te,bottom:(I.bottom||0)+ee,left:(I.left||0)+R};let z={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},ne=Q.useRef(null),re=U(i),ie=U(o),ae=typeof i==`function`?0:i,oe=typeof o==`function`?0:o,se=[];p&&se.push(p),se.push(Bn(e=>{let t=Rr(e,r,N),n=typeof re.current==`function`?re.current(t):re.current,i=typeof ie.current==`function`?ie.current(t):ie.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[ae,oe,N,r]));let ce=E===`none`&&T!==`shift`,le=!ce&&(l||v||T===`shift`),ue=T===`none`?null:Un({...z,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!v&&T===`flip`,crossAxis:E===`flip`?`alignment`:!1,fallbackAxisSideDirection:D}),de=ce?null:Vn(e=>{let t=Be(e.elements.floating).documentElement;return{...z,rootBoundary:v?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:E!==`none`,crossAxis:le,limiter:l||v?void 0:Hn(e=>{if(!ne.current)return{};let{width:t,height:n}=ne.current.getBoundingClientRect(),r=B(V(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[z,l,v,I,E]);T===`shift`||E===`shift`||a===`center`?se.push(de,ue):se.push(ue,de),se.push(Wn({...z,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=W(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:ne.current||Be(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=V(a),l=B(c),u=ne.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,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,le&&l===`y`&&b?S:x),{}}},Pr,b),q(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let fe=Q.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:pe,elements:me,x:H,y:he,middlewareData:ge,update:_e,placement:ve,context:ye,isPositioned:be,floatingStyles:xe}=qn({rootContext:h,open:m?g:void 0,placement:F,middleware:se,strategy:n,whileElementsMounted:m?void 0:(...e)=>En(...e,fe),nodeId:y,externalTree:S}),{sideX:Se,sideY:Ce}=ge.adaptiveOrigin||Fr,we=be?n:`fixed`,Te=Q.useMemo(()=>{let e=b?{position:we,[Se]:H,[Ce]:he}:{position:we,...xe};return be||(e.opacity=0),e},[b,we,Se,H,Ce,he,xe,be]),Ee=Q.useRef(null);q(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(Br(t)?t.current:t)||null;n!==Ee.current&&(pe.setPositionReference(n),Ee.current=n)},[g,pe,A,j]),Q.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&Br(e)&&e.current!==Ee.current&&(pe.setPositionReference(e.current),Ee.current=e.current)},[g,pe,A,j]),Q.useEffect(()=>{if(m&&g&&me.reference&&me.floating)return En(me.reference,me.floating,_e,fe)},[m,g,me,_e,fe]);let De=V(ve),Oe=Lr(r,De,N),ke=u(ve)||`center`,Ae=!!ge.hide?.referenceHidden;q(()=>{x&&g&&be&&w(De)},[x,g,be,De]);let je=Q.useMemo(()=>({position:`absolute`,top:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),Me=ge.arrow?.centerOffset!==0;return Q.useMemo(()=>({positionerStyles:Te,arrowStyles:je,arrowRef:ne,arrowUncentered:Me,side:Oe,align:ke,physicalSide:De,anchorHidden:Ae,refs:pe,context:ye,isPositioned:be,update:_e}),[Te,je,ne,Me,Oe,ke,De,Ae,pe,ye,be,_e])}function Br(e){return e!=null&&`current`in e}function Vr(e){return e===`starting`?Pe:je}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`),Ne(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Vr(r),i],stateAttributesMapping:Ve})}var Ur=Q.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=c,style:_,...v}=e,y=Ct(),b=wr(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`trackCursorAxis`),w=y.useState(`disableHoverablePopup`),T=y.useState(`floatingRootContext`),E=y.useState(`instantType`),D=y.useState(`transitionStatus`),O=zr({anchor:i,positionMethod:a,floatingRootContext:T,mounted:S,side:o,sideOffset:l,align:s,alignOffset:u,collisionBoundary:d,collisionPadding:f,sticky:m,arrowPadding:p,disableAnchorTracking:h,keepMounted:b,collisionAvoidance:g,adaptiveOrigin:y.useState(`hasViewport`)?Ir:void 0}),k=Hr(e,Q.useMemo(()=>({open:x,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:C===`none`?E:`tracking-cursor`}),[x,O.side,O.align,O.anchorHidden,C,E]),{styles:O.positionerStyles,transitionStatus:D,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x||C===`both`||w});return(0,Z.jsx)(Dr.Provider,{value:O,children:k})}),Wr={...Ve,...et},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`);ye({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),tr(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Ne(`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?` · ${_t(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),opacity:ot(e),...e.running?dt:{}}})}),(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:[lt(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=a.length,c=Math.max(0,n-s),l=yt(),[u,d]=(0,Q.useState)(-1),[f,p]=(0,Q.useState)(!1),m=Math.max(0,s-16),h=u<0?m:Math.min(u,m),g=Math.min(h+16,s),_=a.slice(h,g),v=c+h,y=s-g,b=y===0,x=async()=>{let e=h-Qr;if(e<0&&c>0&&!f){p(!0);let e=await r().catch(()=>0);p(!1),d(Math.max(0,h+e-Qr));return}d(Math.max(0,e))},S=()=>{let e=h+Qr;d(e>=m?-1:e)},C=!!(e.running||e.queued)&&b,w=b&&o&&!!e.nextRun&&!C;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[3px] overflow-x-auto`,children:[(0,Z.jsx)(ni,{count:v,onClick:x,loading:f}),_.map(e=>(0,Z.jsx)(ti,{run:e,onClick:()=>i(e)},e.id)),w?(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:l?`Next scheduled run · ${lt(e.nextRun)}`:void 0}),(0,Z.jsx)(`span`,{className:`text-caption text-disabled`,children:l?st(e.nextRun):``})]}):!b&&(0,Z.jsx)(ni,{count:y,onClick:S})]})}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)(Ke,{open:e,onClose:C,children:[(0,Z.jsx)(ze,{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)(Ke,{open:e,onClose:t,children:[(0,Z.jsx)(ze,{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 ${at(e.lastSeen)}`:``}`:e.lastSeen?`offline · seen ${at(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:ut,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}),!bt(e.daemonProtocol).supported&&(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)})]})]}),e.needsUpdate&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-control border border-warn/40 bg-warn/10 p-3`,children:[(0,Z.jsx)(`div`,{className:`text-label font-medium text-primary`,children:`Daemon needs update before this server will dispatch runs.`}),(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[`running `,e.daemonVersion?`v${e.daemonVersion}`:`unknown version`,` · required v`,e.requiredDaemonVersion]}),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.needsUpdate&&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{fi as a,Kr as c,gi as i,gr as l,hi as n,ri as o,pi as r,Zr as s,mi as t,jt as u};
|
|
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-CT1mMhlb.js";import{$ as s,A as c,At as l,B as u,Bt as d,C as f,Ct as p,D as m,Dt as h,E as g,Et as _,F as v,Ft as y,G as b,Gt as x,H as S,Ht as C,I as w,It as T,J as E,Jt as D,K as O,Kt as k,L as A,Lt as j,M,Mt as N,N as P,Nt as F,O as I,Ot as L,P as ee,Pt as R,Q as te,R as z,Rt as ne,S as re,St as ie,T as ae,Tt as oe,U as se,Ut as ce,V as le,Vt as ue,W as de,Wt as fe,X as B,Xt as pe,Y as V,Yt as me,Z as H,_ as he,_t as ge,a as _e,at as ve,b as ye,bt as be,c as xe,ct as Se,d as Ce,dt as we,et as Te,f as Ee,ft as De,g as Oe,gt as ke,h as Ae,ht as je,i as Me,it as U,j as Ne,jt as W,k as Pe,kt as Fe,l as Ie,m as Le,mt as Re,n as ze,nt as Be,o as Ve,ot as G,p as He,pt as K,q as Ue,qt as q,r as We,rt as J,s as Ge,st as Y,t as Ke,tt as qe,u as Je,ut as Ye,v as Xe,vt as Ze,w as Qe,wt as $e,x as et,xt as X,y as tt,yt as nt,z as rt,zt as it}from"./Modal-CCRvx959.js";import{A as at,C as ot,M as st,S as ct,T as lt,c as ut,h 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-Dhsx6SW0.js";import{n as bt}from"./lifecycleUi-Qy_8beQK.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(k(72));return t}function wt(e,t){return t!=null&&!d(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 ce,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=fe();return q(()=>{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 q(()=>{m.current=n},[n]),q(()=>()=>{h.current=!0},[]),q(()=>{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]),q(()=>{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,Y(we))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),q(()=>()=>{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),[f,p]=Q.useState(),[m,h]=Q.useState([]),g=J(e=>{i.set(`positionReference`,e)}),_=J((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:f}))}),v=J(e=>{a?u.current||(_(e.clientX,e.clientY,e.currentTarget),h([])):_(e.clientX,e.clientY,e.currentTarget)}),y=d(f)?o:a;Q.useEffect(()=>{if(!n){g(s);return}if(!y)return;function e(){u.current?.(),u.current=null}let t=W(o);function r(t){X(o,ie(t))?e():_(t.clientX,t.clientY)}return!c.current.openEvent||Pt(c.current.openEvent)?u.current=G(t,`mousemove`,r):g(s),e},[y,n,o,c,s,i,_,g,m]),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 b=Q.useMemo(()=>{function e(e){p(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return Q.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}function It(e,t,n){let{reference:r,floating:i}=e,a=B(t),o=le(t),s=se(o),c=V(t),l=a===`y`,d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2,m;switch(c){case`top`:m={x:d,y:r.y-i.height};break;case`bottom`:m={x:d,y:r.y+r.height};break;case`right`:m={x:r.x+r.width,y:f};break;case`left`:m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}switch(u(t)){case`start`:m[o]-=p*(n&&l?-1:1);break;case`end`:m[o]+=p*(n&&l?-1:1);break}return m}async function Lt(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=z(t,e),m=E(p),h=o[f?d===`floating`?`reference`:`floating`:d],g=s(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:l,rootBoundary:u,strategy:c})),_=d===`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=s(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:v,strategy:c}):_);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}=z(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=V(r),_=B(o),v=V(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ue(o)]:de(o)),x=p!==`none`;!d&&x&&b.push(...O(o,m,p,y));let C=[o,...b],w=await s.detectOverflow(t,h),T=[],E=i.flip?.overflows||[];if(l&&T.push(w[g]),u){let e=S(r,a,y);T.push(w[e[0]],w[e[1]])}if(E=[...E,{placement:r,overflows:T}],!T.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=C[e];if(t&&(!(u===`alignment`&&_!==B(t))||E.every(e=>B(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:E},reset:{placement:t}};let n=E.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=E.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 qe.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}=z(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=V(n),s=u(n),c=B(n)===`y`,l=Wt.has(o)?-1:1,d=a&&c?-1:1,f=z(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof f==`number`?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof h==`number`&&(m=s===`end`?h*-1:h),c?{x:m*d,y:p*l}:{x:p*l,y:m*d}}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}=z(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=B(V(i)),p=b(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=w(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=w(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}=z(e,t),u={x:n,y:r},d=B(i),f=b(d),p=u[f],m=u[d],h=z(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(V(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}=z(e,t),d=await o.detectOverflow(t,l),f=V(i),p=u(i),m=B(i)===`y`,{width:h,height:g}=a.floating,_,v;f===`top`||f===`bottom`?(_=f,v=p===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(v=f,_=p===`end`?`top`:`bottom`);let y=g-d.top-d.bottom,b=h-d.left-d.right,x=te(g-d[_],y),S=te(h-d[v],b),C=!t.middlewareData.shift,w=x,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=y),C&&!p){let e=H(d.left,0),t=H(d.right,0),n=H(d.top,0),r=H(d.bottom,0);m?T=h-2*(e!==0||t!==0?e+t:H(d.left,d.right)):w=g-2*(n!==0||r!==0?n+r:H(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:w});let E=await o.getDimensions(s.floating);return h!==E.width||g!==E.height?{reset:{rects:!0}}:{}}}};function Xt(e){let t=p(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=R(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Te(n)!==a||Te(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Zt(e){return F(e)?e:e.contextElement}function Qt(e){let t=Zt(e);if(!R(t))return A(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Xt(t),o=(a?Te(n.width):n.width)/r,s=(a?Te(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var $t=A(0);function en(e){let t=W(e);return!it()||!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!==W(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=A(1);t&&(r?F(r)&&(o=Qt(r)):o=Qt(e));let c=tn(a,n,r)?en(a):A(0),l=(i.left+c.x)/o.x,u=(i.top+c.y)/o.y,d=i.width/o.x,f=i.height/o.y;if(a){let e=W(a),t=r&&F(r)?W(r):r,n=e,i=_(n);for(;i&&r&&t!==n;){let e=Qt(i),t=i.getBoundingClientRect(),r=p(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,u*=e.y,d*=e.x,f*=e.y,l+=a,u+=o,n=W(i),i=_(n)}}return s({width:d,height:f,x:l,y:u})}function rn(e,t){let n=L(e).scrollLeft;return t?t.left+n:nn(oe(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=oe(r),s=t?ne(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=A(1),u=A(0),d=R(r);if((d||!d&&!a)&&((h(r)!==`body`||T(o))&&(c=L(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):A(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=oe(e),n=L(e),r=e.ownerDocument.body,i=H(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=H(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+rn(e),s=-n.scrollTop;return p(r).direction===`rtl`&&(o+=H(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ln=25;function un(e,t){let n=W(e),r=oe(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=it();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=rn(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ln&&(a-=o)}else l<=ln&&(a+=l);return{width:a,height:o,x:s,y:c}}function dn(e,t){let n=nn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=R(e)?Qt(e):A(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(oe(e));else if(F(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 s(r)}function pn(e,t){let n=l(e);return n===t||!F(n)||y(n)?!1:p(n).position===`fixed`||pn(n,t)}function mn(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>F(e)&&h(e)!==`body`),i=null,a=p(e).position===`fixed`,o=a?l(e):e;for(;F(o)&&!y(o);){let t=p(o),n=N(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||T(o)&&!n&&pn(e,o))?r=r.filter(e=>e!==o):i=t,o=l(o)}return t.set(e,r),r}function hn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ne(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=H(n.top,s),c=te(n.right,c),l=te(n.bottom,l),u=H(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=R(t),i=oe(t),a=n===`fixed`,o=nn(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=A(0);function l(){c.x=rn(i)}if(r||!r&&!a)if((h(t)!==`body`||T(i))&&(s=L(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):A(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 p(e).position===`static`}function yn(e,t){if(!R(e)||p(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return oe(e)===n&&(n=n.ownerDocument.body),n}function bn(e,t){let n=W(e);if(ne(e))return n;if(!R(e)){let t=l(e);for(;t&&!y(t);){if(F(t)&&!vn(t))return t;t=l(t)}return n}let r=yn(e,t);for(;r&&j(r)&&vn(r);)r=yn(r,t);return r&&y(r)&&vn(r)&&!N(r)?n:r||$e(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 p(e).direction===`rtl`}var Cn={convertOffsetParentRelativeRectToViewportRelativeRect:on,getDocumentElement:oe,getClippingRect:hn,getOffsetParent:bn,getElementRects:xn,getClientRects:sn,getDimensions:gn,getScale:Qt,isElement:F,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=oe(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=rt(d),h=rt(i.clientWidth-(u+f)),g=rt(i.clientHeight-(d+p)),_=rt(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:H(0,te(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!wn(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function 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?Fe(l):[],...t?Fe(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=P(),a=g()!=null,o=pe(()=>new re({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ce,floatingId:i,syncOnly:!1,nested:a})).current;return q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=F(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),[h,g]=Q.useState(void 0),_=Q.useRef(null),v=m(n),y=Q.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),b=zn({...e,elements:{...y,...u&&{reference:u}}}),x=F(f)?f:null,S=h===void 0?i.state.floatingElement:h;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:x),i.useSyncedValue(`floatingElement`,S);let C=Q.useCallback(e=>{let t=F(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),b.refs.setReference(t)},[b.refs]),w=Q.useCallback(e=>{(F(e)||e===null)&&(_.current=e,p(e)),(F(b.refs.reference.current)||b.refs.reference.current===null||e!==null&&!F(e))&&b.refs.setReference(e)},[b.refs,p]),T=Q.useCallback(e=>{g(e),b.refs.setFloating(e)},[b.refs]),E=Q.useMemo(()=>({...b.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:_}),[b.refs,w,T,C]),D=Q.useMemo(()=>({...b.elements,domReference:s}),[b.elements,s]),O=Q.useMemo(()=>({...b,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:E,elements:D,nodeId:t,rootStore:i}),[b,E,D,t,i,c,l]);return q(()=>{s&&(_.current=s)},[s]),q(()=>{i.context.dataRef.current.floatingContext=O;let e=v?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),Q.useMemo(()=>({...b,context:O,refs:E,elements:D,rootStore:i}),[b,E,D,O,i])}var Jn=C&&ue;function Yn(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Q.useRef(!1),c=Q.useRef(null),l=Q.useRef(!0),u=fe();Q.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=W(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&R(e)&&e===be(Be(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return ve(G(t,`blur`,r),Jn&&G(t,`keydown`,a,!0),Jn&&G(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`);F(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Q.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=ie(t.nativeEvent);if(F(a)){if(Jn&&!t.relatedTarget){if(!l.current&&!Ze(a))return}else if(!nt(a))return}let o=ge(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,Y(De,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,Y(De,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=F(n)&&n.hasAttribute(ee(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=be(Be(e));!n&&t===e||X(o.current.floatingContext?.refs.floating.current,t)||X(e,t)||a||ge(n??t,i.context.triggerElements)||i.setOpen(!1,Y(De,r))})}}},[o,r,i,u]);return Q.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}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 ce,this.restTimeout=new ce,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=pe(()=>t.hoverInteractionState??Xn.create()).current;return t.hoverInteractionState||=n,x(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,u=m(),d=g(),f=er(a),p=fe(),h=J(()=>Dt(l.current.openEvent?.type,f.interactedInside)),_=J(()=>Ot(l.current.openEvent?.type)),y=J(()=>{Qn(f)});q(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,y())},[o,f,y]),Q.useEffect(()=>y,[y]),q(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&_()&&F(c)&&s){let e=c,t=s,n=Be(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r;return $n(f,{scopeElement:f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{y()}}},[n,o,c,s,f,_,u,d,y]),Q.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&v(u.nodesRef.current,d).length>0)}function t(e){let t=Tt(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,Y(K,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=ie(e);if(!ke(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,g),y()}function m(n){if(e()&&u){u.events.on(`floating.closed`,g);return}if(ge(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&F(o)&&v(u.nodesRef.current,r,!1).some(e=>X(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}y(),_()&&!h()&&t(n)}}function g(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,g),a.setOpen(!1,Y(K,t)),u.events.emit(`floating.closed`,t)})}let b=s;return ve(b&&G(b,`mouseenter`,c),b&&G(b,`mouseleave`,m),b&&G(b,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,g)})},[n,s,a,l,r,i,_,h,y,f,u,d,p])}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:f,isClosing:p,shouldOpen:h}=t,g=`rootStore`in e?e.rootStore:e,{dataRef:_,events:v}=g.context,y=m(l),b=er(g),x=Q.useRef(!1),S=U(i),C=U(r),w=U(o),T=U(n),E=U(h),D=U(p),O=J(()=>Dt(_.current.openEvent?.type,b.interactedInside)),k=J(()=>E.current?.()!==!1),A=J((e,t,n)=>{let r=g.context.triggerElements;if(r.hasElement(t))return!e||!X(e,t);if(!F(n))return!1;let i=n;return r.hasMatchingElement(e=>X(e,i))&&(!e||!X(e,i))}),j=J(()=>{b.handler&&=(Be(g.select(`domReferenceElement`)).removeEventListener(`mousemove`,b.handler),void 0)}),M=J(()=>{Qn(b)});return u&&(b.handleCloseOptions=S.current?.__options),Q.useEffect(()=>j,[j]),Q.useEffect(()=>{if(!n)return;function e(e){e.open?x.current=!1:(x.current=e.reason===K,j(),b.openChangeTimeout.clear(),b.restTimeout.clear(),b.blockMouseMove=!0,b.restTimeoutPending=!1)}return v.on(`openchange`,e),()=>{v.off(`openchange`,e)}},[n,v,b,j]),Q.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Tt(C.current,`close`,b.pointerType);n?b.openChangeTimeout.start(n,()=>{g.setOpen(!1,Y(K,e)),y?.events.emit(`floating.closed`,e)}):t&&(b.openChangeTimeout.clear(),g.setOpen(!1,Y(K,e)),y?.events.emit(`floating.closed`,e))}let t=c.current??(u?g.select(`domReferenceElement`):null);if(!F(t))return;function r(e){if(b.openChangeTimeout.clear(),b.blockMouseMove=!1,a&&!d(b.pointerType))return;let t=Et(w.current),n=Tt(C.current,`open`,b.pointerType),r=ie(e),i=e.currentTarget??null,o=g.select(`domReferenceElement`),s=i;if(F(r)&&!g.context.triggerElements.hasElement(r)){for(let e of g.context.triggerElements.elements())if(X(e,r)){s=e;break}}F(i)&&F(o)&&!g.context.triggerElements.hasElement(i)&&X(i,o)&&(s=o);let c=s==null?!1:A(o,s,r),l=g.select(`open`),u=D.current?.()??g.select(`transitionStatus`)===`ending`,f=!l&&u&&x.current,p=!c&&F(s)&&F(o)&&X(o,s)&&f,m=t>0&&!n,h=c&&(l||f)||p,_=!l||c;if(h){k()&&g.setOpen(!0,Y(K,e,s));return}m||(n?b.openChangeTimeout.start(n,()=>{_&&k()&&g.setOpen(!0,Y(K,e,s))}):_&&k()&&g.setOpen(!0,Y(K,e,s)))}function i(t){if(O()){M();return}j();let n=Be(g.select(`domReferenceElement`));b.restTimeout.clear(),b.restTimeoutPending=!1;let r=_.current.floatingContext??f?.();if(!ge(t.relatedTarget,g.context.triggerElements)){if(S.current&&r){g.select(`open`)||b.openChangeTimeout.clear();let i=c.current;b.handler=S.current({...r,tree:y,x:t.clientX,y:t.clientY,onClose(){M(),j(),T.current&&!O()&&i===g.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,b.handler),b.handler(t);return}(b.pointerType!==`touch`||!X(g.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?ve(G(t,`mousemove`,r,{once:!0}),G(t,`mouseenter`,r),G(t,`mouseleave`,i)):ve(G(t,`mouseenter`,r),G(t,`mouseleave`,i))},[j,M,_,C,g,n,S,b,u,A,O,a,s,w,c,y,T,f,D,k]),Q.useMemo(()=>{if(!n)return;function e(e){b.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=g.select(`domReferenceElement`),i=g.select(`open`),o=A(r,n,e.target);if(a&&!d(b.pointerType))return;if(i&&o&&b.handleCloseOptions?.blockPointerEvents){let e=g.select(`floatingElement`);e&&$n(b,{scopeElement:b.handleCloseOptions?.getScope?.()??n.ownerDocument.body,referenceElement:n,floatingElement:e})}let s=Et(w.current);if(i&&!o||s===0||!o&&b.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;b.restTimeout.clear();function c(){if(b.restTimeoutPending=!1,O())return;let e=g.select(`open`);!b.blockMouseMove&&(!e||o)&&k()&&g.setOpen(!0,Y(K,t,n))}b.pointerType===`touch`?xt.flushSync(()=>{c()}):o&&i?c():(b.restTimeoutPending=!0,b.restTimeout.start(s,c))}}},[n,b,O,A,a,g,w,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 ce,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=ie(r),g=r.type===`mouseleave`,_=X(u,h),y=X(a,h);if(_&&(l=!0,!g))return;if(y&&(l=!1,!g)){l=!0;return}if(g&&F(r.relatedTarget)&&X(u,r.relatedTarget))return;function b(){return!!(s&&v(s.nodesRef.current,o).length>0)}function x(){b()||m()}if(b())return;let S=a.getBoundingClientRect(),C=u.getBoundingClientRect(),w=e>C.right-C.width/2,T=t>C.bottom-C.height/2,E=C.width>S.width,D=C.height>S.height,O=(E?S:C).left,k=(E?S:C).right,A=(D?S:C).top,j=(D?S:C).bottom;if(c===`top`&&t>=S.bottom-1||c===`bottom`&&t<=S.top+1||c===`left`&&e>=S.right-1||c===`right`&&e<=S.left+1){x();return}let M=!1;switch(c){case`top`:M=lr(d,f,O,S.top+1,k,C.bottom-1);break;case`bottom`:M=lr(d,f,O,C.top+1,k,S.bottom-1);break;case`left`:M=lr(d,f,C.right-1,j,S.left+1,A);break;case`right`:M=lr(d,f,S.right-1,j,C.left+1,A);break;default:}if(M)return;if(l&&!cr(d,f,S)){x();return}if(!g&&p(d,f)){x();return}let N=!1;switch(c){case`top`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t+$+1,o=w||E?C.bottom-$:C.top,s=w?E?C.bottom-$:C.top:C.bottom-$;N=sr(d,f,r,a,i,a,C.left,o,C.right,s);break}case`bottom`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t-$,o=w||E?C.top+$:C.bottom,s=w?E?C.top+$:C.bottom:C.top+$;N=sr(d,f,r,a,i,a,C.left,o,C.right,s);break}case`left`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e+$+1,o=T||D?C.right-$:C.left,s=T?D?C.right-$:C.left:C.right-$;N=sr(d,f,o,C.top,s,C.bottom,a,r,a,i);break}case`right`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e-$,o=T||D?C.left+$:C.right,s=T?D?C.left+$:C.right:C.left+$;N=sr(d,f,a,r,a,i,o,C.top,s,C.bottom);break}default:}N?l||n.start(40,x):x()}};return r.__options={...e,blockPointerEvents:t},r}var dr={...Je,disabled:Qe(e=>e.disabled),instantType:Qe(e=>e.instantType),isInstantPhase:Qe(e=>e.isInstantPhase),trackCursorAxis:Qe(e=>e.trackCursorAxis),disableHoverablePopup:Qe(e=>e.disableHoverablePopup),lastOpenChangeReason:Qe(e=>e.openChangeReason),closeOnClick:Qe(e=>e.closeOnClick),closeDelay:Qe(e=>e.closeDelay),hasViewport:Qe(e=>e.hasViewport)},fr=class e extends f{constructor(e,t,n=!1){let r=new Ce,i={...pr(),...e};i.floatingRootContext=Ie(r,t,n),super(i,{popupRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},dr)}setOpen=(e,t)=>{He(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,Y(Re,e))}static useStore(t,n){return Xe(t,(t,r)=>new e(n,t,r)).store}};function pr(){return{...xe(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var mr=D(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=fr.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});Ae(p,r,n,d),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),p.useSyncedValue(`disabled`,t),Le(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=Oe(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Q.useRef(null);q(()=>{m&&t&&p.setOpen(!1,Y(Se))},[m,t,p]),q(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let T=Q.useCallback(()=>{p.setOpen(!1,Y(Ye))},[p]);Q.useImperativeHandle(o,()=>({unmount:y,close:T}),[y,T]);let E=h||_||!t&&a!==`none`;return(0,Z.jsxs)(St.Provider,{value:p,children:[E&&(0,Z.jsx)(hr,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function hr({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=ae(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=Ft(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n});return he(e,{activeTriggerProps:Q.useMemo(()=>M(a.reference,i.reference),[a.reference,i.reference]),inactiveTriggerProps:Q.useMemo(()=>M(a.trigger,i.trigger),[a.trigger,i.trigger]),popupProps:Q.useMemo(()=>M(Ee,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=_e.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(F(n))return n}}let t=e.target;return F(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&&F(n.host)?n.host:null}return null}var Sr=me(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:f,...p}=e,m=Ct(!0),h=a?.store??m;if(!h)throw Error(k(82));let g=Me(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`isOpenedByTrigger`,g),y=h.useState(`floatingRootContext`),b=Q.useRef(null),x=c??600,S=u??0,{registerTrigger:C,isMountedByThisTrigger:w}=tt(g,b,h,{payload:o,closeOnClick:l,closeDelay:S}),T=_r(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Mt(y,{open:v}),A=er(y);h.useSyncedValue(`isInstantPhase`,D);let j=h.useState(`disabled`),M=s??j,N=U(M),P=h.useState(`trackCursorAxis`),F=h.useState(`disableHoverablePopup`),I=Q.useRef(!1),L=fe(),ee=Q.useRef(void 0);function R(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:c??e??x),n}function te(e){let t=b.current;if(!t||!e)return!1;let n=xr(e);return n!==null&&n!==t&&X(t,n)}function z(e){let t=te(e);return I.current=t,t&&(A.openChangeTimeout.clear(),A.restTimeout.clear(),A.restTimeoutPending=!1,L.clear()),t}let ne=rr(y,{enabled:!M,mouseOnly:!0,move:!1,handleClose:!F&&P!==`both`?ur():null,restMs:R,delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return u==null&&O&&(t=e),{close:t}},triggerElementRef:b,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!I.current}}),re=Yn(y,{enabled:!M}).reference,ie=e=>{let t=I.current,n=br(e),r=z(n),i=b.current,a=i&&n&&X(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,Y(K,e));return}if(t&&!r&&a&&!N.current&&!h.select(`open`)&&i&&d(ee.current)){let t=()=>{!I.current&&!N.current&&!h.select(`open`)&&h.setOpen(!0,Y(K,e,i))},n=R();n===0?(L.clear(),t()):L.start(n,t)}},ae=h.useState(`triggerProps`,w);return Ne(`button`,e,{state:{open:v},ref:[t,C,b],props:[ne,re,w||P!==`none`?ae:void 0,{onMouseOver(e){ie(e.nativeEvent)},onFocus(e){te(br(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){I.current=!1,L.clear(),ee.current=void 0},onPointerEnter(e){ee.current=e.pointerType},onPointerDown(e){ee.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]:M?``:void 0,[yr]:M?void 0:``},p],stateAttributesMapping:Ge})}),Cr=Q.createContext(void 0);function wr(){let e=Q.useContext(Cr);if(e===void 0)throw Error(k(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}=I({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(k(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:d=0,offsetParent:f=`real`}=z(e,t)||{};if(l==null)return{};let p=E(d),m={x:n,y:r},h=le(i),g=se(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],T=f===`real`?await o.getOffsetParent?.(l):s.floating,D=s.floating[x]||a.floating[g];(!D||!await o.isElement?.(T))&&(D=s.floating[x]||a.floating[g]);let O=S/2-C/2,k=D/2-_[g]/2-1,A=Math.min(p[y],k),j=Math.min(p[b],k),M=A,N=D-_[g]-j,P=D/2-_[g]/2+O,F=w(M,P,N),I=!c.arrow&&u(i)!=null&&P!==F&&a.reference[g]/2-(P<M?A:j)-_[g]/2<0,L=I?P<M?P-M:P-N:0;return{[h]:m[h]+L,data:{[h]:F,centerOffset:P-F-L,...I&&{alignmentOffset:L}},reset:I}}}),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=W(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=Be(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=V(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,V(i),n),align:u(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:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Q.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=typeof t==`function`?t:void 0,k=J(O),A=O?k:t,j=U(t),M=U(g),N=Ar()===`rtl`,P=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),ee=+(r===`top`),R=+(r===`right`),te=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+te,bottom:I+ee,left:I+R}:I&&={top:(I.top||0)+L,right:(I.right||0)+te,bottom:(I.bottom||0)+ee,left:(I.left||0)+R};let z={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},ne=Q.useRef(null),re=U(i),ie=U(o),ae=typeof i==`function`?0:i,oe=typeof o==`function`?0:o,se=[];p&&se.push(p),se.push(Bn(e=>{let t=Rr(e,r,N),n=typeof re.current==`function`?re.current(t):re.current,i=typeof ie.current==`function`?ie.current(t):ie.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[ae,oe,N,r]));let ce=E===`none`&&T!==`shift`,le=!ce&&(l||v||T===`shift`),ue=T===`none`?null:Un({...z,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!v&&T===`flip`,crossAxis:E===`flip`?`alignment`:!1,fallbackAxisSideDirection:D}),de=ce?null:Vn(e=>{let t=Be(e.elements.floating).documentElement;return{...z,rootBoundary:v?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:E!==`none`,crossAxis:le,limiter:l||v?void 0:Hn(e=>{if(!ne.current)return{};let{width:t,height:n}=ne.current.getBoundingClientRect(),r=B(V(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[z,l,v,I,E]);T===`shift`||E===`shift`||a===`center`?se.push(de,ue):se.push(ue,de),se.push(Wn({...z,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=W(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:ne.current||Be(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=V(a),l=B(c),u=ne.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,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,le&&l===`y`&&b?S:x),{}}},Pr,b),q(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let fe=Q.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:pe,elements:me,x:H,y:he,middlewareData:ge,update:_e,placement:ve,context:ye,isPositioned:be,floatingStyles:xe}=qn({rootContext:h,open:m?g:void 0,placement:F,middleware:se,strategy:n,whileElementsMounted:m?void 0:(...e)=>En(...e,fe),nodeId:y,externalTree:S}),{sideX:Se,sideY:Ce}=ge.adaptiveOrigin||Fr,we=be?n:`fixed`,Te=Q.useMemo(()=>{let e=b?{position:we,[Se]:H,[Ce]:he}:{position:we,...xe};return be||(e.opacity=0),e},[b,we,Se,H,Ce,he,xe,be]),Ee=Q.useRef(null);q(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(Br(t)?t.current:t)||null;n!==Ee.current&&(pe.setPositionReference(n),Ee.current=n)},[g,pe,A,j]),Q.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&Br(e)&&e.current!==Ee.current&&(pe.setPositionReference(e.current),Ee.current=e.current)},[g,pe,A,j]),Q.useEffect(()=>{if(m&&g&&me.reference&&me.floating)return En(me.reference,me.floating,_e,fe)},[m,g,me,_e,fe]);let De=V(ve),Oe=Lr(r,De,N),ke=u(ve)||`center`,Ae=!!ge.hide?.referenceHidden;q(()=>{x&&g&&be&&w(De)},[x,g,be,De]);let je=Q.useMemo(()=>({position:`absolute`,top:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),Me=ge.arrow?.centerOffset!==0;return Q.useMemo(()=>({positionerStyles:Te,arrowStyles:je,arrowRef:ne,arrowUncentered:Me,side:Oe,align:ke,physicalSide:De,anchorHidden:Ae,refs:pe,context:ye,isPositioned:be,update:_e}),[Te,je,ne,Me,Oe,ke,De,Ae,pe,ye,be,_e])}function Br(e){return e!=null&&`current`in e}function Vr(e){return e===`starting`?Pe:je}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`),Ne(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Vr(r),i],stateAttributesMapping:Ve})}var Ur=Q.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=c,style:_,...v}=e,y=Ct(),b=wr(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`trackCursorAxis`),w=y.useState(`disableHoverablePopup`),T=y.useState(`floatingRootContext`),E=y.useState(`instantType`),D=y.useState(`transitionStatus`),O=zr({anchor:i,positionMethod:a,floatingRootContext:T,mounted:S,side:o,sideOffset:l,align:s,alignOffset:u,collisionBoundary:d,collisionPadding:f,sticky:m,arrowPadding:p,disableAnchorTracking:h,keepMounted:b,collisionAvoidance:g,adaptiveOrigin:y.useState(`hasViewport`)?Ir:void 0}),k=Hr(e,Q.useMemo(()=>({open:x,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:C===`none`?E:`tracking-cursor`}),[x,O.side,O.align,O.anchorHidden,C,E]),{styles:O.positionerStyles,transitionStatus:D,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x||C===`both`||w});return(0,Z.jsx)(Dr.Provider,{value:O,children:k})}),Wr={...Ve,...et},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`);ye({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),tr(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Ne(`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?` · ${_t(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),opacity:ot(e),...e.running?dt:{}}})}),(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:[lt(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=a.length,c=Math.max(0,n-s),l=yt(),[u,d]=(0,Q.useState)(-1),[f,p]=(0,Q.useState)(!1),m=Math.max(0,s-16),h=u<0?m:Math.min(u,m),g=Math.min(h+16,s),_=a.slice(h,g),v=c+h,y=s-g,b=y===0,x=async()=>{let e=h-Qr;if(e<0&&c>0&&!f){p(!0);let e=await r().catch(()=>0);p(!1),d(Math.max(0,h+e-Qr));return}d(Math.max(0,e))},S=()=>{let e=h+Qr;d(e>=m?-1:e)},C=!!(e.running||e.queued)&&b,w=b&&o&&!!e.nextRun&&!C;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[3px] overflow-x-auto`,children:[(0,Z.jsx)(ni,{count:v,onClick:x,loading:f}),_.map(e=>(0,Z.jsx)(ti,{run:e,onClick:()=>i(e)},e.id)),w?(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:l?`Next scheduled run · ${lt(e.nextRun)}`:void 0}),(0,Z.jsx)(`span`,{className:`text-caption text-disabled`,children:l?st(e.nextRun):``})]}):!b&&(0,Z.jsx)(ni,{count:y,onClick:S})]})}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)(Ke,{open:e,onClose:C,children:[(0,Z.jsx)(ze,{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)(Ke,{open:e,onClose:t,children:[(0,Z.jsx)(ze,{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 ${at(e.lastSeen)}`:``}`:e.lastSeen?`offline · seen ${at(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:ut,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}),!bt(e.daemonProtocol).supported&&(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)})]})]}),e.needsUpdate&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-control border border-warn/40 bg-warn/10 p-3`,children:[(0,Z.jsx)(`div`,{className:`text-label font-medium text-primary`,children:`Daemon needs update before this server will dispatch runs.`}),(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[`running `,e.daemonVersion?`v${e.daemonVersion}`:`unknown version`,` · required v`,e.requiredDaemonVersion]}),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.needsUpdate&&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{fi as a,Kr as c,gi as i,gr as l,hi as n,ri as o,pi as r,Zr as s,mi as t,jt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-CXxhzYe2.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't load the dashboard.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BseJUIpC.js";import{c as t}from"./preload-helper-DFkkpP6W.js";import{a as n,o as r}from"./index-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BseJUIpC.js";import{c as t}from"./preload-helper-DFkkpP6W.js";import{a as n,o as r}from"./index-BRN_CQ8U.js";import{t as i}from"./SignIn-Qxw5zDFq.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{initial:e.initial})}export{o as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BseJUIpC.js";import{c as t}from"./preload-helper-DFkkpP6W.js";import{i as n,o as r}from"./index-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BseJUIpC.js";import{c as t}from"./preload-helper-DFkkpP6W.js";import{i as n,o as r}from"./index-BRN_CQ8U.js";import{t as i}from"./SignIn-Qxw5zDFq.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{teamId:e.teamId,initial:e.initial},e.teamId)}export{o as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-CXxhzYe2.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't open this team.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
|