@bivy/bivy 0.20.8-staging.2 → 0.20.8
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/package.json +1 -1
- package/web/assets/{AutomationsView-BJrM6yqr.js → AutomationsView-CI8mce5b.js} +1 -1
- package/web/assets/{ChangesCard-DUM4KclA.js → ChangesCard-CPnPUh6N.js} +1 -1
- package/web/assets/{LibraryView-Jz-F19Hx.js → LibraryView-CbEXd0eI.js} +1 -1
- package/web/assets/{ProviderConnect-DMi6KdOt.js → ProviderConnect-CoqAK5Wk.js} +1 -1
- package/web/assets/{Settings-ykv3LJak.js → Settings-DzwwvcJY.js} +3 -3
- package/web/assets/{Sheet-C_EacxTh.js → Sheet-DDK1zw1r.js} +1 -1
- package/web/assets/{Terminal-DUFzWYWz.js → Terminal-1RXw5d-8.js} +1 -1
- package/web/assets/{VoiceSettings-DnW4NrOd.js → VoiceSettings-XKgK-rHp.js} +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-Blsf1sXg.js → abnfDiagram-VCTEODGH-mGY2XgpR.js} +1 -1
- package/web/assets/architecture-7GRP2DOG-iTGIo6ed.js +1 -0
- package/web/assets/{architectureDiagram-5GKGNRK7-pQucVtqJ.js → architectureDiagram-5GKGNRK7-iODllUCA.js} +1 -1
- package/web/assets/{blockDiagram-I7D4REHJ-CJjLYKUh.js → blockDiagram-I7D4REHJ-Ge7J4mPm.js} +1 -1
- package/web/assets/{c4Diagram-7LVT6UL2-in7wpv_Y.js → c4Diagram-7LVT6UL2-f-kX3zo7.js} +1 -1
- package/web/assets/channel-CZ9L6iYi.js +1 -0
- package/web/assets/{chunk-4HAMMTFA-CtBTWKdL.js → chunk-4HAMMTFA-DgLlEu-R.js} +1 -1
- package/web/assets/{chunk-75Z2AOVW-CyK4H7YV.js → chunk-75Z2AOVW-Dml242zI.js} +1 -1
- package/web/assets/{chunk-DU6HZSFF-JgufHRwj.js → chunk-DU6HZSFF-DHGHAQj_.js} +1 -1
- package/web/assets/{chunk-F27PBJKO-BbizrxZN.js → chunk-F27PBJKO-DYJWgQwW.js} +1 -1
- package/web/assets/{chunk-GMAD6QVW-KIACzNr2.js → chunk-GMAD6QVW-Be6XrE8S.js} +1 -1
- package/web/assets/{chunk-GVQU2GXP-pnWOiX0K.js → chunk-GVQU2GXP-CrJtrbng.js} +1 -1
- package/web/assets/{chunk-IMKFNOWR-Bl5rsYIL.js → chunk-IMKFNOWR-BNoFxzwg.js} +1 -1
- package/web/assets/{chunk-L3NEJ4N5-Cn1VbQnI.js → chunk-L3NEJ4N5-8rFD5H7o.js} +1 -1
- package/web/assets/{chunk-OSK3NFVY-DAv04RJI.js → chunk-OSK3NFVY-Df7-4Mnn.js} +1 -1
- package/web/assets/{chunk-P2QGCYS3-CPSKdVOi.js → chunk-P2QGCYS3-rHBlhB9b.js} +1 -1
- package/web/assets/{chunk-POPQ4Y6H-CUeRM6RM.js → chunk-POPQ4Y6H-TtIAtZss.js} +1 -1
- package/web/assets/{chunk-PWAF6VOD-LtGeTKO3.js → chunk-PWAF6VOD-CkwX1I_u.js} +1 -1
- package/web/assets/{chunk-SHT3W25Y-CTRcgKl6.js → chunk-SHT3W25Y-QK-L20Uq.js} +1 -1
- package/web/assets/{chunk-SVP7TREG-BXVUypt7.js → chunk-SVP7TREG-r_Z2GtSi.js} +1 -1
- package/web/assets/{chunk-TICWLB2K-DcnRyemH.js → chunk-TICWLB2K-CUKfLR5q.js} +1 -1
- package/web/assets/classDiagram-ZZMXUADV-D_pQOsdw.js +1 -0
- package/web/assets/classDiagram-v2-VYDZK3BY-D_pQOsdw.js +1 -0
- package/web/assets/{cynefin-OW5HDTMX-slpqEmmd.js → cynefin-OW5HDTMX-Dt3Y2U_d.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-B86Q2u1j.js → cynefinDiagram-5FMLGOSQ-Y5k7qfOG.js} +1 -1
- package/web/assets/{dagre-GXQ25YYZ-BAVQlz7w.js → dagre-GXQ25YYZ-D6uSyP7i.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-MYjsPdvN.js → diagram-S7CK7UJ4-cy3iJG3K.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-B-ZaHoFo.js → diagram-UQ7AKVKN-D-Dujcue.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-D6fe-epm.js → diagram-VSXAHHWV-BmI9Opjx.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-BRMgys2t.js → diagram-VX7I27RA-Ca81_y4A.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-Ds4LfCSB.js → diagram-Z3DM3KII-BBMq_KK4.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-C3HaB5L6.js → ebnfDiagram-PWID7BFC-Bc-yp1-u.js} +1 -1
- package/web/assets/{erDiagram-RLTQ6QDP-6B50LaD1.js → erDiagram-RLTQ6QDP-C4not1_u.js} +1 -1
- package/web/assets/eventmodeling-NTZA5JFV-kTJMsPPZ.js +1 -0
- package/web/assets/flowDiagram-HODETNUW-BKXsEnEc.js +1 -0
- package/web/assets/{ganttDiagram-EL5Y4UJY-CXnWaWkT.js → ganttDiagram-EL5Y4UJY-eOqP4w8u.js} +1 -1
- package/web/assets/{gitGraph-4MIJSDKK-m0TPZPvh.js → gitGraph-4MIJSDKK-CNyrdfwo.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-iKJdFdpu.js → gitGraphDiagram-WWUBYQGX-DWlo-lrH.js} +1 -1
- package/web/assets/{index-B-OIyYhf.js → index-C1fVIjSt.js} +2 -2
- package/web/assets/{info-A6RAGUB7-ZBbvPqMx.js → info-A6RAGUB7-CUQ_micy.js} +1 -1
- package/web/assets/{infoDiagram-27XIBGKW-IXSH8PPI.js → infoDiagram-27XIBGKW-BGpJ5FNT.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-BnZ9o-gi.js → ishikawaDiagram-5VMMS53U-BPHiUQm6.js} +1 -1
- package/web/assets/{journeyDiagram-3NMN7TZE-PLRSILNS.js → journeyDiagram-3NMN7TZE-B4LBaWaP.js} +1 -1
- package/web/assets/{kanban-definition-UXKFOSKX-CnzBs18I.js → kanban-definition-UXKFOSKX-DNVvNHrT.js} +1 -1
- package/web/assets/{line-Bk9HDHIm.js → line-DEBH51YO.js} +1 -1
- package/web/assets/{mermaid-parser.core-CNUOUSnV.js → mermaid-parser.core-DKGY5TTe.js} +3 -3
- package/web/assets/{mermaid.core-Danc2DP_.js → mermaid.core-SY5t-W54.js} +4 -4
- package/web/assets/{mindmap-definition-YA3MSWOX-CXLT2-3g.js → mindmap-definition-YA3MSWOX-DNzu0vrE.js} +1 -1
- package/web/assets/mount-BAMZ2poC.js +33 -0
- package/web/assets/{packet-AYTQ26CC-C_vat1x9.js → packet-AYTQ26CC-BFmJxIPS.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-DKesU0gA.js → pegDiagram-XKGWAZYB-Cg4XSQXq.js} +1 -1
- package/web/assets/{pie-WAS4IAKB-C0xOPHgv.js → pie-WAS4IAKB-BjugvaCZ.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-BLIs9T6q.js → pieDiagram-E7YTZNPT-CZUoS4VP.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-DMZO3EkQ.js → quadrantDiagram-AXDQQJYC-Dt2ha5S3.js} +1 -1
- package/web/assets/{radar-RG4KPBEZ-BK3zzA24.js → radar-RG4KPBEZ-wvkY1jFj.js} +1 -1
- package/web/assets/{railroad-74A4TZTK-DKZnLvR8.js → railroad-74A4TZTK-C0urSGwW.js} +1 -1
- package/web/assets/railroad-abnf-HS5TGJTU-D3fB8KBr.js +1 -0
- package/web/assets/railroad-ebnf-LZEXJU2U-DxtPt5hF.js +1 -0
- package/web/assets/railroad-peg-WCYAUIDC-DSr1P8IJ.js +1 -0
- package/web/assets/{railroadDiagram-O6MQD6OU-CMlCyIe1.js → railroadDiagram-O6MQD6OU-CMPDMFEF.js} +1 -1
- package/web/assets/{requirementDiagram-BXWQKSXE-BoXRk42A.js → requirementDiagram-BXWQKSXE-CgG1fTgc.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB--pbCT8h1.js → sankeyDiagram-P5KCCOFB-CqQc0C6b.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-CH_TKQH-.js → sequenceDiagram-WJ2MYXX4-CCar7eyP.js} +1 -1
- package/web/assets/{settingsRoute-Cd6tTDi7.js → settingsRoute-D75Kl5qJ.js} +1 -1
- package/web/assets/{stateDiagram-D77RDMKH-HLLYr-pa.js → stateDiagram-D77RDMKH-hZdV5Olo.js} +1 -1
- package/web/assets/stateDiagram-v2-MP3YSRHH-DSUfNYnq.js +1 -0
- package/web/assets/{swimlanes-42K2YHIH-B4OZbR_V.js → swimlanes-42K2YHIH-BOjTGDck.js} +1 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-6bUIqkAR.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-ynfvHV_N.js → timeline-definition-24CTP7MA-EQ9J2i8-.js} +1 -1
- package/web/assets/{treeView-Q6P3EWNA-BtXJN16V.js → treeView-Q6P3EWNA-C_5CbmSf.js} +1 -1
- package/web/assets/{treemap-WGGIJYW6-CUrynl2p.js → treemap-WGGIJYW6-C37qSFRc.js} +1 -1
- package/web/assets/{useStore-CL3mGGAi.js → useStore-BjrbW265.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-aFeOLLPo.js → vennDiagram-4TSXK5OY-Dz_rYEly.js} +1 -1
- package/web/assets/{wardley-WFR3VGLG-BoH-ty45.js → wardley-WFR3VGLG-ByC5Xl0N.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-CQekw2h_.js → wardleyDiagram-VM6X3IG4-ZORHthei.js} +1 -1
- package/web/assets/{xychartDiagram-S5SC5T6Z-BA3XmHdI.js → xychartDiagram-S5SC5T6Z-BsEewrR8.js} +1 -1
- package/web/index.html +1 -1
- package/web/sw.js +1 -1
- package/web/assets/architecture-7GRP2DOG-BM4DpyE3.js +0 -1
- package/web/assets/channel-CraWjtfA.js +0 -1
- package/web/assets/classDiagram-ZZMXUADV-DoE_AgTB.js +0 -1
- package/web/assets/classDiagram-v2-VYDZK3BY-DoE_AgTB.js +0 -1
- package/web/assets/eventmodeling-NTZA5JFV-DALcUxpX.js +0 -1
- package/web/assets/flowDiagram-HODETNUW-CepTrRu_.js +0 -1
- package/web/assets/mount-DJ9B76y6.js +0 -33
- package/web/assets/railroad-abnf-HS5TGJTU-DVwOxwF5.js +0 -1
- package/web/assets/railroad-ebnf-LZEXJU2U-QjUyJR5P.js +0 -1
- package/web/assets/railroad-peg-WCYAUIDC-BOvnDZTN.js +0 -1
- package/web/assets/stateDiagram-v2-MP3YSRHH-BO_OH0Z6.js +0 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-BUF3R_U5.js +0 -8
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/common-DvIV9UK2.js","assets/rolldown-runtime-hePW80VL.js","assets/mermaid.core-Danc2DP_.js","assets/index-B-OIyYhf.js","assets/index-D76QD5dl.css","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-B6xuSHsQ.js","assets/chunk-DU6HZSFF-JgufHRwj.js","assets/chunk-75Z2AOVW-CyK4H7YV.js","assets/dist-v5Q1xZ2K.js","assets/chunk-PWAF6VOD-LtGeTKO3.js","assets/chunk-GMAD6QVW-KIACzNr2.js","assets/chunk-P2QGCYS3-CPSKdVOi.js","assets/chunk-4HAMMTFA-CtBTWKdL.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-GVQU2GXP-pnWOiX0K.js","assets/chunk-OSK3NFVY-DAv04RJI.js","assets/line-Bk9HDHIm.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/graphlib-DS17s2tU.js","assets/chunk-L3NEJ4N5-Cn1VbQnI.js","assets/Terminal-DUFzWYWz.js","assets/useStore-CL3mGGAi.js","assets/jsx-runtime-NZYk81nU.js","assets/Sheet-C_EacxTh.js","assets/ChangesCard-DUM4KclA.js","assets/StatusDot-dpbztK53.js","assets/Terminal-B1njb2Cr.css","assets/ReadinessChecklist-Bbgq2GQ8.js","assets/Settings-ykv3LJak.js","assets/ProviderConnect-DMi6KdOt.js","assets/AutomationsView-BJrM6yqr.js","assets/LibraryView-Jz-F19Hx.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,t}from"./rolldown-runtime-hePW80VL.js";import{D as n,E as r,I as i,L as a,N as o,R as s,V as c,a as l,b as u,c as d,d as f,f as p,i as m,j as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,z as T}from"./index-B-OIyYhf.js";import{A as E,B as D,C as O,Ct as k,D as A,Dt as ee,E as j,Et as te,F as M,I as N,J as P,L as ne,M as F,Nt as I,Ot as re,P as ie,R as ae,S as oe,T as se,Tt as ce,U as le,V as ue,W as de,Y as L,_ as R,a as fe,c as pe,d as me,dt as he,f as ge,ft as _e,g as ve,h as ye,i as z,j as be,k as xe,l as Se,m as Ce,mt as we,n as Te,o as Ee,p as De,pt as Oe,rt as ke,s as Ae,t as je,u as Me,ut as Ne,v as Pe,vt as Fe,w as Ie,wt as Le,x as Re,xt as ze,y as Be,yt as Ve,z as He}from"./useStore-CL3mGGAi.js";import{D as Ue,E as We,M as Ge,O as Ke,S as qe,T as Je,_ as Ye,a as B,b as Xe,c as Ze,d as Qe,f as $e,g as et,h as tt,i as nt,j as rt,k as it,l as at,n as ot,o as st,r as ct,t as lt,v as ut,w as V,x as dt,y as ft}from"./Sheet-C_EacxTh.js";import{_ as pt,a as mt,c as ht,g as gt,h as _t,i as vt,l as yt,m as bt,n as xt,o as St,p as Ct,r as wt,s as Tt,t as Et}from"./ChangesCard-DUM4KclA.js";import{t as Dt}from"./jsx-runtime-NZYk81nU.js";import{t as Ot}from"./StatusDot-dpbztK53.js";import{a as kt,i as At,n as jt,r as Mt,t as Nt}from"./settingsRoute-Cd6tTDi7.js";import{i as Pt,n as Ft,r as It}from"./ProviderConnect-DMi6KdOt.js";var Lt=[{kind:`fork`,pattern:/^I am continuing an existing Bivy session \(forked from (.+?) to .+?\)\./},{kind:`import`,pattern:/^I am continuing an? (.+?) session that was started outside Bivy and imported here\./}];function Rt(e){if(e)for(let t of Lt){let n=t.pattern.exec(e);if(n)return{kind:t.kind,from:n[1]}}}var zt=[`todos`,`plan`,`entries`,`items`,`steps`,`tasks`],Bt=[`content`,`step`,`text`,`title`,`subject`,`description`,`task`],Vt={pending:`pending`,todo:`pending`,notstarted:`pending`,open:`pending`,inprogress:`in_progress`,active:`in_progress`,running:`in_progress`,doing:`in_progress`,current:`in_progress`,started:`in_progress`,completed:`completed`,complete:`completed`,done:`completed`,finished:`completed`,success:`completed`,cancelled:`cancelled`,canceled:`cancelled`,skipped:`cancelled`,abandoned:`cancelled`};function H(e){return Vt[String(e??``).toLowerCase().replace(/[^a-z]/g,``)]}function Ht(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}}function Ut(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=zt.map(e=>t[e]).find(Array.isArray);if(!n?.length)return;let r=[];for(let e of n){if(typeof e==`string`){r.push({text:e,status:`pending`});continue}if(!e||typeof e!=`object`)continue;let t=e,n=Ht(t,Bt),i=H(t.status??t.state),a=t.id??t.taskId;r.push({...n?{text:n}:{},...i?{status:i}:{},...a!=null&&a!==``?{id:String(a)}:{}})}let i=t.merge===!0;if(i||r.some(e=>e.text))return{entries:r,merge:i}}function Wt(e,t){if(!t.merge)return t.entries.filter(e=>e.text).map(e=>({text:e.text,status:e.status??`pending`,...e.id?{id:e.id}:{}}));let n=e.map(e=>({...e}));for(let e of t.entries){let t=e.id?n.find(t=>t.id===e.id):void 0;t?(e.text&&(t.text=e.text),e.status&&(t.status=e.status)):e.text&&n.push({text:e.text,status:e.status??`pending`,...e.id?{id:e.id}:{}})}return n}function Gt(e){if(e==null||e===``)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Kt(e){let t=String(e||``).trim();if(!t)return``;let n=t.split(`/`).filter(Boolean);return n.length>2?`…/${n.slice(-2).join(`/`)}`:t}function qt(e){return e?.toolInput??e?.input??e?.args??e?.arguments??e?.toolCall?.arguments??{}}function Jt(e){return String(e?.toolName||e?.name||e?.tool?.name||e?.tool||e?.toolCall?.name||`tool`).toLowerCase()}var Yt={apply_automations:{title:`Apply automations to your account?`,consequence:e=>{let t=Array.isArray(e.changes)?e.changes.length:0;return`The agent wants to make ${t} change${t===1?``:`s`} to your automations.`},severity:e=>Array.isArray(e.changes)&&e.changes.some(e=>String(e).startsWith(`Remove `))?`critical`:`high`,fields:e=>[[`File`,e.file],[`Changes`,Array.isArray(e.changes)?e.changes.join(`
|
|
3
|
-
`):``]]}};function Xt(e){let t=qt(e),n=Jt(e),r=Yt[n];if(r)return r.severity(t);let i=`${n} ${Object.values(t).map(Gt).join(` `)}`.toLowerCase();return/\b(rm\s+-rf|rm\s+-r|delete|unlink|drop\s+table|shutdown|reboot|format|wipe)\b/.test(i)?`critical`:/\b(send|email|mail|post|publish|deploy|push|scp|curl|wget|ssh|chmod|chown|sudo)\b/.test(i)?`high`:/\b(write|edit|mv|move|cp|copy|install|update|create)\b/.test(i)?`medium`:`low`}function Zt(e){let t=qt(e),n=Jt(e);if(Yt[n])return Yt[n].title;let r=t.path||t.file||t.filePath||t.pathname;return n.includes(`bash`)||n.includes(`shell`)?`Run this command?`:n.includes(`mail`)||n.includes(`email`)||n.includes(`send`)?`Agent wants to send a message`:n.includes(`edit`)?`Edit ${Kt(r)||`a file`}?`:n.includes(`write`)?`Write ${Kt(r)||`a file`}?`:`Allow ${n}?`}function Qt(e,t=Xt(e)){let n=qt(e),r=Jt(e);if(Yt[r])return Yt[r].consequence(n);let i=String(n.command||n.cmd||n.shell||``).trim(),a=n.path||n.file||n.filePath||n.pathname||n.cwd||n.directory,o=n.to||n.recipients||n.recipient,s=Array.isArray(o)?o.length:o?String(o).split(`,`).filter(Boolean).length:0,c=`${r} ${i}`.toLowerCase();return s||r.includes(`mail`)||r.includes(`email`)||/\b(sendmail|mail)\b/.test(c)?s?`This sends a message to ${s} recipient${s===1?``:`s`} immediately.`:`This sends a message immediately.`:t===`critical`?a?`This can permanently change or delete data in ${a}. This may not be undoable.`:`This can permanently change or delete data. This may not be undoable.`:/\b(curl|wget|ssh|scp|git\s+push|deploy)\b/.test(c)?`This connects to an external service or publishes data outside this machine.`:/\b(npm|bun|pnpm|yarn)\s+(install|add|update)\b/.test(c)?`This changes project dependencies on this machine.`:r.includes(`write`)||r.includes(`edit`)||/\b(write|edit|mv|cp)\b/.test(c)?a?`This changes files at ${a}.`:`This changes files in the workspace.`:`The agent is paused until you approve this action.`}function $t(e){let t=qt(e),n=Jt(e);return n.includes(`bash`)||n.includes(`shell`)?String(t.command||t.cmd||t.shell||``).trim():``}function en(e){let t=qt(e),n=Jt(e),r=[],i=(e,t,n=420)=>{let i=String(t??``).trim();i&&r.push([e,i.length>n?`${i.slice(0,n)}…`:i])};if(Yt[n]){for(let[e,r]of Yt[n].fields(t))i(e,r,1/0);return r}return i(`Tool`,n),i(`File`,t.path||t.file||t.filePath||t.pathname),i(`Command`,n.includes(`bash`)||n.includes(`shell`)?``:t.command),i(`Find`,t.oldText||t.search||t.find),i(`Replace`,t.newText||t.replace),i(`Text`,t.content||t.text),r}function tn(e){let t=Xt(e),n=qt(e),r=``;try{r=JSON.stringify(n,null,2)}catch{r=String(n)}return{severity:t,title:Zt(e),consequence:Qt(e,t),command:$t(e),fields:en(e),rawInput:r,canRemember:t!==`critical`}}var nn=`receipt.v1`,rn={id:200,text:240,ref:500,list:100,checks:50},an=/prompt|transcript|reasoning|diff|secret|token|stdout|stderr|raw.?output|raw.?input|raw.?command|raw.?tool|file.?content|repository.?content/i;function on(e,t=new Set){if(e&&typeof e==`object`){if(t.has(e))throw Error(`cyclic Receipt evidence rejected`);t.add(e);for(let[n,r]of Object.entries(e)){if(an.test(n))throw Error(`prohibited Receipt field rejected: ${n}`);on(r,t)}t.delete(e)}}function U(e,t,n=rn.text){if(e!=null&&e!==``){if(typeof e!=`string`||e.length>n)throw Error(`${t} must be a string of at most ${n} characters`);return e}}function W(e,t,n=rn.id){let r=U(e,t,n)?.trim();if(!r)throw Error(`${t} is required`);return r}function sn(e,t){let n=U(e,t,40);if(n){if(!Number.isFinite(Date.parse(n)))throw Error(`${t} must be an ISO date-time`);return n}}function cn(e,t){e.includes(t)||e.push(t)}var ln={run_in_progress:`The Run has no evidence-backed terminal outcome yet.`,session_not_correlated:`Run evidence was not correlated to an underlying Session.`,machine_identity_not_reported:`A customer-readable Machine identity was not reported with this Run.`,execution_identity_not_reported:`Provider, runtime, or model version evidence was not fully reported.`,effective_protection_not_observed:`Requested protection is visible, but its effective settings were not observed.`,approval_decisions_not_correlated:`Approval and denial decisions were not durably correlated to this Run.`,governance_events_not_correlated:`Governance audit events were not durably correlated to this Run.`,change_metadata_not_reported:`A bounded file/change summary or explicit no-change evidence was not reported.`,check_metadata_incomplete:`One or more checks lack required, timeout, or other deterministic metadata.`,audit_health_unknown:`Audit storage health or successful writes could not be confirmed.`,audit_write_failed:`At least one required audit write or readable-storage check is missing.`};function un(e){if(on(e),!e||typeof e!=`object`||!e.run||typeof e.run!=`object`)throw Error(`Receipt evidence is required`);let t=W(e.receiptId,`receiptId`),n=W(e.run.id,`run.id`),r=W(sn(e.createdAt,`createdAt`),`createdAt`,40),i=U(e.run.output?.sessionId,`sessionId`,rn.id),a=sn(e.run.startedAt??e.run.claimedAt,`run.startedAt`),o=sn(e.run.completedAt,`run.completedAt`),s=a&&o?Date.parse(o)-Date.parse(a):void 0;if(s!==void 0&&s<0)throw Error(`Run end precedes start`);let c=(e.run.checks??[]).slice(0,rn.checks).map((e,t)=>({name:W(e.name,`checks[${t}].name`,120),...U(e.commandHash,`checks[${t}].commandHash`,128)?{commandHash:e.commandHash}:{},status:e.status,...typeof e.durationMs==`number`?{durationMs:e.durationMs}:{},...typeof e.exitCode==`number`?{exitCode:e.exitCode}:{}})),l=[`succeeded`,`failed`,`cancelled`,`done`].includes(e.run.status),u,d;e.run.status===`cancelled`?(u=`cancelled`,d=`run_cancelled`):l&&c.some(e=>e.status===`failed`)?(u=`checks_failed`,d=`check_failed`):e.run.status===`failed`?(u=`failed`,d=`run_failed`):l&&(e.run.output?.branch||e.run.output?.commit||e.run.output?.prUrl||e.run.output?.checkpoint||e.run.output?.artifactUrl)?(u=`changes_ready`,d=`artifact_recorded`):e.run.status===`succeeded`&&c.length>0&&c.every(e=>e.status===`passed`)&&(u=`succeeded`,d=`checks_passed`);let f=e.run.repo?`${W(e.run.repo,`run.repo`,200)}${Number.isInteger(e.run.issueNumber)?`#${e.run.issueNumber}`:``}`:U(e.run.externalId,`run.externalId`,200),p=(e.run.events??[]).filter(e=>e.kind===`retry`||e.kind===`fallback`).slice(-rn.list).map(e=>e.kind),m=e.protection?.effective,h=(e.protection?.capabilities??[]).slice(0,20).map((e,t)=>({capability:W(e.capability,`capabilities[${t}].capability`,40),evidenceClass:e.evidenceClass,...U(e.mechanism,`capabilities[${t}].mechanism`,120)?{mechanism:e.mechanism}:{}})),g=e.auditHealth??{correlation:`unknown`,readableStorage:`unknown`,successfulWrites:`unknown`},_=e.governance,v={...U(e.run.output?.branch,`changes.branch`,rn.ref)?{branch:e.run.output.branch}:{},...U(e.run.output?.commit,`changes.commit`,200)?{commit:e.run.output.commit}:{},...U(e.run.output?.prUrl,`changes.pullRequest`,rn.ref)?{pullRequest:e.run.output.prUrl}:{},...U(e.run.output?.checkpoint,`changes.checkpoint`,rn.ref)?{checkpoint:e.run.output.checkpoint}:{},...U(e.run.output?.artifactUrl,`changes.artifact`,rn.ref)?{artifact:e.run.output.artifactUrl}:{},files:(_?.fileChanges.files??[]).slice(0,rn.list).map((e,t)=>({path:W(e.path,`changes.files[${t}].path`,rn.ref),...U(e.op,`changes.files[${t}].op`,20)?{op:e.op}:{},...typeof e.added==`number`?{added:e.added}:{},...typeof e.removed==`number`?{removed:e.removed}:{}})),added:_?.fileChanges.added??0,removed:_?.fileChanges.removed??0},y=[];(!a||!o)&&cn(y,`run_timing`),u||cn(y,`terminal_outcome`),i||cn(y,`session_correlation`),(!e.run.claimedByNodeId||!e.execution?.machineName)&&cn(y,`machine_identity`),(!e.execution?.profile||!e.execution.controller||!e.run.runtimeId||!e.run.model||!e.execution.modelVersionStatus)&&cn(y,`execution_identity`),m||cn(y,`effective_protection`),h.length||cn(y,`protection_evidence`),_||cn(y,`approval_decisions`),!v.branch&&!v.commit&&!v.pullRequest&&!v.checkpoint&&!v.artifact&&!v.files.length&&cn(y,`change_evidence`),_||cn(y,`file_change_summary`),c.some(e=>!e.commandHash||typeof e.durationMs!=`number`||e.status!==`skipped`&&typeof e.exitCode!=`number`)&&cn(y,`check_details`),g.correlation!==`healthy`&&cn(y,`audit_correlation`),g.readableStorage!==`healthy`&&cn(y,`audit_storage`),g.successfulWrites!==`healthy`&&cn(y,`audit_writes`);let b=[];return u||b.push(`run_in_progress`),i||b.push(`session_not_correlated`),y.includes(`machine_identity`)&&b.push(`machine_identity_not_reported`),y.includes(`execution_identity`)&&b.push(`execution_identity_not_reported`),y.includes(`effective_protection`)&&b.push(`effective_protection_not_observed`),y.includes(`approval_decisions`)&&b.push(`approval_decisions_not_correlated`),y.includes(`audit_correlation`)&&b.push(`governance_events_not_correlated`),(y.includes(`change_evidence`)||y.includes(`file_change_summary`))&&b.push(`change_metadata_not_reported`),y.includes(`check_details`)&&b.push(`check_metadata_incomplete`),[g.correlation,g.readableStorage,g.successfulWrites].includes(`unknown`)&&b.push(`audit_health_unknown`),[g.readableStorage,g.successfulWrites].includes(`missing`)&&b.push(`audit_write_failed`),{schemaVersion:nn,receiptId:t,runId:n,...i?{sessionId:i}:{},createdAt:r,completeness:y.length?`partial`:`complete`,run:{...a?{startedAt:a}:{},...o?{endedAt:o}:{},...s===void 0?{}:{durationMs:s},...u?{terminalOutcome:u,outcomeReason:d}:{},attempts:Math.max(1,Math.min(100,Math.trunc(e.run.attempt??1))),retryFallbackReasons:p,source:{kind:W(e.run.source,`run.source`,40),...f?{reference:f}:{}}},execution:{...e.run.claimedByNodeId?{machineId:W(e.run.claimedByNodeId,`machineId`)}:{},...e.execution?.machineName?{machineName:W(e.execution.machineName,`machineName`,120)}:{},...e.execution?.profile?{profile:e.execution.profile}:{},...e.execution?.controller?{controller:e.execution.controller}:{},...e.execution?.provider?{provider:W(e.execution.provider,`provider`,80)}:{},...e.execution?.region?{region:W(e.execution.region,`region`,80)}:{},...e.execution?.image?{image:W(e.execution.image,`image`,160)}:{},...e.run.runtimeId?{agentId:W(e.run.runtimeId,`agentId`,120)}:{},...e.execution?.agentVersion?{agentVersion:W(e.execution.agentVersion,`agentVersion`,80)}:{},...e.run.model?{modelId:W(e.run.model,`modelId`,160)}:{},...e.execution?.modelVersionStatus?{modelVersionStatus:e.execution.modelVersionStatus}:{}},protection:{requested:{...e.run.sandbox?{sandboxTier:e.run.sandbox}:{},...e.run.approvalMode?{approvalMode:e.run.approvalMode}:{}},effective:m?{...m,...m.trustModes?{trustModes:m.trustModes.slice(0,20).map((e,t)=>W(e,`trustModes[${t}]`,80))}:{}}:{},capabilities:h},approvals:_?.approvals??{requests:0,approved:0,denied:0},changes:v,checks:c,auditHealth:g,missingEvidence:y,observationLimitations:b.map(e=>({code:e,message:ln[e]}))}}function dn(e,t){let n=e.source.kind||`unknown`,[,r,i]=n.length>40&&n.match(/^([^:]{1,40}):(.+)$/)||[],a=r??n.slice(0,40),o=e.source.reference||i?.slice(0,200),s=o?.match(/^([^#]+)#(\d+)$/);return un({receiptId:`receipt-${e.id}`,createdAt:t,run:{id:e.id,source:a,status:e.origin.status,createdAt:e.timestamps.createdAt,claimedAt:e.timestamps.claimedAt,startedAt:e.timestamps.startedAt,completedAt:e.timestamps.completedAt,attempt:e.attempt,...s?{repo:s[1],issueNumber:Number(s[2])}:o?{externalId:o}:{},...e.machine?.id?{claimedByNodeId:e.machine.id}:{},...e.requested.runtimeId?{runtimeId:e.requested.runtimeId}:{},...e.requested.model?{model:e.requested.model}:{},...e.requested.approvalMode?{approvalMode:e.requested.approvalMode}:{},...e.requested.sandbox?{sandbox:e.requested.sandbox}:{},output:{...e.sessionId?{sessionId:e.sessionId}:{},...e.references.branch?{branch:e.references.branch}:{},...e.references.commit?{commit:e.references.commit}:{},...e.references.pullRequest?{prUrl:e.references.pullRequest}:{},...e.references.checkpoint?{checkpoint:e.references.checkpoint}:{},...e.references.artifact?{artifactUrl:e.references.artifact}:{}},checks:e.checks,events:e.events},...e.machine?.name||e.receiptEvidence?.execution?{execution:{...e.receiptEvidence?.execution??{},...e.machine?.name?{machineName:e.machine.name}:{}}}:{},...e.receiptEvidence?.protection?{protection:e.receiptEvidence.protection}:{},...e.receiptEvidence?{governance:e.receiptEvidence,auditHealth:e.receiptEvidence.auditHealth}:{}})}function fn(e){on(e);let t={schemaVersion:nn,receiptId:W(e.receiptId,`receiptId`),runId:W(e.runId,`runId`),...U(e.sessionId,`sessionId`,rn.id)?{sessionId:e.sessionId}:{},createdAt:W(sn(e.createdAt,`createdAt`),`createdAt`,40),completeness:e.completeness,run:{...sn(e.run.startedAt,`run.startedAt`)?{startedAt:e.run.startedAt}:{},...sn(e.run.endedAt,`run.endedAt`)?{endedAt:e.run.endedAt}:{},...typeof e.run.durationMs==`number`?{durationMs:e.run.durationMs}:{},...e.run.terminalOutcome?{terminalOutcome:e.run.terminalOutcome}:{},...e.run.outcomeReason?{outcomeReason:e.run.outcomeReason}:{},attempts:e.run.attempts,retryFallbackReasons:e.run.retryFallbackReasons.slice(0,rn.list),source:{kind:W(e.run.source.kind,`run.source.kind`,40),...U(e.run.source.reference,`run.source.reference`,200)?{reference:e.run.source.reference}:{}}},execution:{...U(e.execution.machineId,`execution.machineId`,rn.id)?{machineId:e.execution.machineId}:{},...U(e.execution.machineName,`execution.machineName`,120)?{machineName:e.execution.machineName}:{},...e.execution.profile?{profile:e.execution.profile}:{},...e.execution.controller?{controller:e.execution.controller}:{},...U(e.execution.provider,`execution.provider`,80)?{provider:e.execution.provider}:{},...U(e.execution.region,`execution.region`,80)?{region:e.execution.region}:{},...U(e.execution.image,`execution.image`,160)?{image:e.execution.image}:{},...U(e.execution.agentId,`execution.agentId`,120)?{agentId:e.execution.agentId}:{},...U(e.execution.agentVersion,`execution.agentVersion`,80)?{agentVersion:e.execution.agentVersion}:{},...U(e.execution.modelId,`execution.modelId`,160)?{modelId:e.execution.modelId}:{},...e.execution.modelVersionStatus?{modelVersionStatus:e.execution.modelVersionStatus}:{}},protection:{requested:{...e.protection.requested.sandboxTier?{sandboxTier:W(e.protection.requested.sandboxTier,`protection.requested.sandboxTier`,40)}:{},...e.protection.requested.approvalMode?{approvalMode:W(e.protection.requested.approvalMode,`protection.requested.approvalMode`,40)}:{}},effective:{...e.protection.effective.executionProfile?{executionProfile:W(e.protection.effective.executionProfile,`protection.effective.executionProfile`,40)}:{},...e.protection.effective.sandboxTier?{sandboxTier:W(e.protection.effective.sandboxTier,`protection.effective.sandboxTier`,40)}:{},...e.protection.effective.approvalMode?{approvalMode:W(e.protection.effective.approvalMode,`protection.effective.approvalMode`,40)}:{},...e.protection.effective.runtimeEnforcement?{runtimeEnforcement:W(e.protection.effective.runtimeEnforcement,`protection.effective.runtimeEnforcement`,120)}:{},...e.protection.effective.trustModes?{trustModes:e.protection.effective.trustModes.slice(0,20).map((e,t)=>W(e,`trustModes[${t}]`,80))}:{}},capabilities:e.protection.capabilities.slice(0,20).map((e,t)=>({capability:W(e.capability,`capabilities[${t}].capability`,40),evidenceClass:e.evidenceClass,...U(e.mechanism,`capabilities[${t}].mechanism`,120)?{mechanism:e.mechanism}:{}}))},approvals:{requests:e.approvals.requests,approved:e.approvals.approved,denied:e.approvals.denied},changes:{...U(e.changes.branch,`changes.branch`,rn.ref)?{branch:e.changes.branch}:{},...U(e.changes.commit,`changes.commit`,200)?{commit:e.changes.commit}:{},...U(e.changes.pullRequest,`changes.pullRequest`,rn.ref)?{pullRequest:e.changes.pullRequest}:{},...U(e.changes.checkpoint,`changes.checkpoint`,rn.ref)?{checkpoint:e.changes.checkpoint}:{},...U(e.changes.artifact,`changes.artifact`,rn.ref)?{artifact:e.changes.artifact}:{},files:e.changes.files.slice(0,rn.list).map((e,t)=>({path:W(e.path,`changes.files[${t}].path`,rn.ref),...U(e.op,`changes.files[${t}].op`,20)?{op:e.op}:{},...typeof e.added==`number`?{added:e.added}:{},...typeof e.removed==`number`?{removed:e.removed}:{}})),added:e.changes.added,removed:e.changes.removed},checks:e.checks.slice(0,rn.checks).map((e,t)=>({name:W(e.name,`checks[${t}].name`,120),...U(e.commandHash,`checks[${t}].commandHash`,128)?{commandHash:e.commandHash}:{},status:e.status,...typeof e.durationMs==`number`?{durationMs:e.durationMs}:{},...typeof e.exitCode==`number`?{exitCode:e.exitCode}:{}})),auditHealth:{correlation:e.auditHealth.correlation,readableStorage:e.auditHealth.readableStorage,successfulWrites:e.auditHealth.successfulWrites},missingEvidence:e.missingEvidence.slice(0,20),observationLimitations:e.observationLimitations.slice(0,20).map(e=>({code:e.code,message:ln[e.code]}))};return JSON.stringify(t,null,2)}function pn(e,t){return t.hash?{id:`${e.id}:${t.hash}`,hash:t.hash,name:t.name,mimeType:t.mimeType,kind:t.kind,size:t.size,caption:e.role===`assistant`&&e.text?e.text:void 0,createdAt:t.createdAt,artifact:!!t.artifact,origin:e.role===`assistant`?`agent`:`user`,entryId:e.id}:null}function mn(e,t){return{id:`${e.id}:${t.hash}`,hash:t.hash,name:t.name,mimeType:t.mimeType,kind:t.kind,size:t.size,artifact:!1,origin:`inline`,entryId:e.id}}function hn(e,t){return e&&e.artifact&&!t.artifact?{...t,artifact:!0}:t}function gn(e){let t=new Map;for(let n of e){for(let e of n.attachments??[]){let r=pn(n,e);r&&t.set(r.hash,hn(t.get(r.hash),r))}for(let e of Object.values(n.imageRefs??{}))e?.hash&&!t.has(e.hash)&&t.set(e.hash,mn(n,e))}return[...t.values()].sort((e,t)=>(t.createdAt??-1)-(e.createdAt??-1)).slice(0,500)}function _n(e){let t=new Map;for(let n of e)n.app&&!t.has(n.app.appId)&&t.set(n.app.appId,n.app);return[...t.values()]}var G=I();function vn(e){return e.needsAction||e.status===`needs_action`?`needs-action`:e.status===`working`?`working`:e.status===`failed`?`failed`:e.status===`saved`?`saved`:`idle`}function yn(e){return bn(e)?`unseen`:vn(e)}function bn(e){return e.status!==`idle`||e.finishedAt==null?!1:e.lastSeenAt==null||e.finishedAt>e.lastSeenAt}function xn(e){return e.needsAction||e.status===`needs_action`?3:e.status===`failed`?2:+!!bn(e)}function Sn(e){return e.needsAction||e.status===`needs_action`?`Waiting for you`:e.status===`working`?`Working`:e.status===`failed`?`Failed`:e.finishedAt==null?e.status===`saved`?`Saved`:`Open`:`Finished`}function Cn(e){return e.needsAction||e.status===`needs_action`?`Needs your response`:e.state?.agent===`waiting`?`Waiting for background tasks`:e.status===`working`?`Agent working`:e.status===`failed`?`Last turn failed`:e.status===`saved`?`Saved`:bn(e)?`Finished · new`:`Open`}function wn(e){let t=new Map;for(let n of e??[]){let e=n.output?.sessionId;if(!e||n.targetKind===`existing_session`||n.targetSessionId===e)continue;let r=t.get(e);(!r||n.createdAt<r.createdAt)&&t.set(e,n)}return new Map([...t].map(([e,t])=>[e,On(t.source)]))}var Tn={kind:`cli`,label:`Terminal · bivy run`,automation:!1};function En(e){return(e.source??``).trim()===`cli`&&e.status===`working`}function Dn(e){return(e.source??``).trim()===`cli:log`}function On(e){let t=(e??``).trim();return t.startsWith(`issue:`)||t===`queue:github:issue`||t.startsWith(`github:issue`)?{kind:`github-issue`,label:`GitHub · labelled issue`,automation:!0}:t===`queue:github:comment`||t===`github:comment`?{kind:`github-mention`,label:`GitHub · @-mention`,automation:!0}:t===`queue:slack`||t===`slack`?{kind:`slack`,label:`Slack request`,automation:!0}:t===`queue:linear:issue`||t===`linear:issue`?{kind:`linear`,label:`Linear issue`,automation:!0}:t===`queue:schedule`||t===`schedule`?{kind:`schedule`,label:`Scheduled run`,automation:!0}:t===`queue:webhook`||t===`webhook`||t.startsWith(`automation:`)||t.startsWith(`queue:automation:`)?{kind:`webhook`,label:`Webhook`,automation:!0}:t===`queue:manual`||t===`manual`?{kind:`manual`,label:`Manual run`,automation:!0}:t===`cli`||t===`cli:log`?Tn:{kind:`app`,label:`App session`,automation:!1}}function kn(e){switch(e){case`github-issue`:case`github-mention`:return`GitHub`;case`slack`:return`Slack`;case`linear`:return`Linear`;case`schedule`:return`Schedule`;case`webhook`:return`Webhook`;case`manual`:return`Manual`;case`cli`:return`CLI`;case`app`:return`App`}}var K=Dt();function An({kind:e}){switch(e){case`github-issue`:case`github-mention`:return(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z`})});case`slack`:return(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.528 2.528 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.528 2.528 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z`})});case`linear`:return(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M.403 13.517c-.06-.213.19-.365.347-.207l9.94 9.94c.157.157.006.407-.207.347C5.24 22.293 1.707 18.76.403 13.517zM.004 10.62a.19.19 0 0 0 .056.148l13.117 13.117a.19.19 0 0 0 .148.056 11.9 11.9 0 0 0 1.951-.324.19.19 0 0 0 .09-.32L.648 8.58a.19.19 0 0 0-.32.089c-.157.636-.266 1.288-.324 1.95zM1.036 6.926a.19.19 0 0 0 .038.22l15.78 15.78a.19.19 0 0 0 .22.038 12 12 0 0 0 1.463-.842.19.19 0 0 0 .03-.297L2.175 5.433a.19.19 0 0 0-.297.03 12 12 0 0 0-.842 1.463zM2.658 4.5a.19.19 0 0 1-.02-.245C4.847 1.203 8.194 0 12 0 18.627 0 24 5.373 24 12c0 3.806-1.203 7.153-4.255 9.362a.19.19 0 0 1-.245-.02L2.658 4.5z`})});case`schedule`:return(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,K.jsx)(`path`,{d:`M12 7.5V12l3 2`})]});case`webhook`:return(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,K.jsx)(`circle`,{cx:`6`,cy:`6.5`,r:`2.6`}),(0,K.jsx)(`circle`,{cx:`18`,cy:`9.5`,r:`2.6`}),(0,K.jsx)(`circle`,{cx:`9.5`,cy:`18`,r:`2.6`}),(0,K.jsx)(`path`,{d:`M7.6 8.6 8.9 15.4M8.3 6.9 15.4 8.6M16.2 11.8 11.4 16.4`})]});case`manual`:return(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M5.5 3.7 18 11l-5 1.4 2.7 5.6-2.4 1.1-2.7-5.6L5.2 18z`})});case`cli`:return(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M5 7l4 4-4 4M12 16h6`})});case`app`:return(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M4 5.5h16v10.5H9l-4 3.5v-3.5H4z`})})}}function jn({kind:e,size:t=`md`,status:n,title:r}){return(0,K.jsxs)(`span`,{className:`source-mark${t===`md`?``:` ${t}`}${n?` has-status`:``}`,title:r,"aria-hidden":!0,children:[(0,K.jsx)(An,{kind:e}),n&&(0,K.jsx)(Ot,{status:n})]})}function Mn(e){let t=new Map;for(let n of e??[]){let e=n.output?.sessionId;e&&!t.has(e)&&t.set(e,n)}return t}function Nn(e){let t=e.checks;if(!t||t.length===0)return null;let n=0,r=0,i=0;for(let e of t)e.status===`passed`?n++:e.status===`failed`?r++:i++;return{passed:n,failed:r,skipped:i,total:t.length}}function Pn(e){let t=e.startedAt??e.claimedAt,n=e.completedAt;if(!t||!n)return null;let r=new Date(n).getTime()-new Date(t).getTime();if(!Number.isFinite(r)||r<0)return null;let i=Math.round(r/1e3);if(i<60)return`${i}s`;let a=Math.round(i/60);if(a<60)return`${a}m`;let o=Math.floor(a/60),s=a%60;return s?`${o}h ${s}m`:`${o}h`}function Fn(e){return[...e.events??[]].reverse().find(e=>e.kind===`retry`||e.kind===`fallback`)?.summary||null}function In(e){let t=e.output;return t?t.prUrl?{label:`Pull request`,url:t.prUrl}:t.artifactUrl?{label:`Artifact`,url:t.artifactUrl}:t.branch?{label:`branch ${t.branch}`}:t.commit?{label:`commit ${t.commit.slice(0,12)}`}:null:null}function Ln(e){return(e.checks??[]).filter(e=>e.status===`failed`).map(e=>e.name)}function Rn(e){let t=ee(e);return t.terminal?t.kind===`checks_failed`||t.kind===`agent_failed`||t.kind===`timed_out`?[`fix`,`retry`,`fork`]:t.reviewable?[`fork`]:[]:[]}function zn(e){if(!e)return null;if(e.status===`failed`){let t=(e.checks??[]).find(e=>e.status===`failed`);return t?{text:`${t.name} failed`,tone:`danger`}:{text:e.output?.failure||`run failed`,tone:`danger`}}if(e.status===`needs_attention`){let t=[...e.events??[]].reverse().find(e=>e.kind===`needs_attention`||e.kind===`approval`||e.kind===`policy_denial`);return{text:i(t?.summary||e.routingReason||`needs your input`),tone:`warn`}}return null}function Bn(e,t=new Date){if(e==null)return`Older`;let n=new Date(e);if(Number.isNaN(n.getTime()))return`Older`;let r=new Date(t.getFullYear(),t.getMonth(),t.getDate()),i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),a=Math.round((r.getTime()-i.getTime())/864e5);return a<=0?`Today`:a===1?`Yesterday`:a<7?`Previous 7 days`:`Older`}function Vn(e){let t=new Set(e.map(e=>e.sessionId)),n=new Map,r=[];for(let i of e){let e=i.delegatedFrom?.sessionId;e&&e!==i.sessionId&&t.has(e)?n.set(e,[...n.get(e)??[],i]):r.push(i)}return r.flatMap(e=>[e,...(n.get(e.sessionId)??[]).map(t=>({...t,nestedUnder:e.sessionId}))])}var Hn=new Set([`working`,`needs-action`,`failed`,`unseen`]);function Un({status:e,srLabel:t}){return(0,K.jsxs)(K.Fragment,{children:[Hn.has(e)&&(0,K.jsx)(`span`,{className:`row-status`,children:(0,K.jsx)(Ot,{status:e})}),(0,K.jsx)(`span`,{className:`sr-only`,children:t})]})}function Wn(){return(0,K.jsx)(`svg`,{className:`gh-icon`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z`})})}var Gn={open:{label:`Open pull request`,tone:`ok`,paths:[`M13 6h3a2 2 0 0 1 2 2v7`,`M6 9v12`]},merged:{label:`Merged`,tone:`merged`,paths:[`M6 21V9a9 9 0 0 0 9 9`]},closed:{label:`Closed pull request`,tone:void 0,paths:[`M6 9v12`,`m21 3-6 6`,`m21 9-6-6`,`M18 11.5V15`]}};function Kn({prs:e}){let t=ie(e);if(!t)return null;let n=Gn[t.state===`merged`||t.state===`closed`?t.state:`open`],r=e&&e.length>1?e.length:0,i=r?`${n.label} · ${r} pull requests`:n.label;return(0,K.jsxs)(Te,{tone:n.tone,variant:`soft`,className:`session-pr`,title:i,children:[(0,K.jsxs)(`svg`,{className:`pr-glyph`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,K.jsx)(`circle`,{cx:`6`,cy:`6`,r:`3`}),(0,K.jsx)(`circle`,{cx:`18`,cy:`18`,r:`3`}),n.paths.map(e=>(0,K.jsx)(`path`,{d:e},e))]}),r>0&&(0,K.jsx)(`span`,{className:`session-pr-text`,"aria-hidden":!0,children:r}),(0,K.jsx)(`span`,{className:`sr-only`,children:i})]})}function qn(e){if(e==null)return 0;let t=typeof e==`number`?e:new Date(e).getTime();return Number.isFinite(t)?t:0}function Jn(e){let t=qn(e);if(!t)return``;let n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`now`;let r=Math.round(n/60);if(r<60)return`${r}m`;let i=Math.round(r/60);if(i<24)return`${i}h`;let a=Math.round(i/24);return a<7?`${a}d`:`${Math.round(a/7)}w`}function Yn(e){return M(e.source)||F(e.source)?.repo||``}function Xn(e,t){let n=M(e.source)||F(e.source)?.repo||``,r=e.branch||``,i=String(e.name||``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``),a=r.toLowerCase().split(`/`).pop()?.replace(/-[a-f0-9]{5,}$/i,``)||``,o=r&&a!==i?r:``,s=On(e.source),c=n||(s.automation?``:Zn(e.source));return[s.automation?kn(s.kind):null,e.forkedFrom?`Forked`:null,e.delegatedFrom?`Delegated`:null,e.agentName,t,c,o].filter(Boolean).join(` · `)}function Zn(e){let t=F(e);if(t)return`${t.repo} #${t.issueNumber}`;if(typeof e==`string`&&e.startsWith(`queue:`)){let t=e.slice(6);return t===`slack`?`Slack`:t===`github:comment`?`GitHub @-mention`:t===`github:issue`?`GitHub issue`:t.startsWith(`agent-delegation:`)?``:t||`Queue`}return``}var Qn=10,$n=[{view:`artifacts`,label:`Artifacts`,icon:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),(0,K.jsx)(`path`,{d:`M14 3v5h5`}),(0,K.jsx)(`path`,{d:`M9 13h6M9 17h4`})]})},{view:`apps`,label:`Apps`,icon:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`rect`,{x:`4`,y:`4`,width:`6.5`,height:`6.5`,rx:`1.5`}),(0,K.jsx)(`rect`,{x:`13.5`,y:`4`,width:`6.5`,height:`6.5`,rx:`1.5`}),(0,K.jsx)(`rect`,{x:`4`,y:`13.5`,width:`6.5`,height:`6.5`,rx:`1.5`}),(0,K.jsx)(`rect`,{x:`13.5`,y:`13.5`,width:`6.5`,height:`6.5`,rx:`1.5`})]})}];function er({onPick:e,onPickTerminal:t,runEvidence:n,sessionSources:r,onOpenAutomations:i,automationsActive:a,onOpenLibrary:o,libraryActive:s,onOpenTerminal:c,terminalDisabled:l}){let{sessionIndex:{sessions:u,runTerminals:d},activeSession:{activeSessionId:f},connection:{nodes:p,currentNodeId:m}}=je(),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(null),[y,b]=(0,G.useState)(null),[x,S]=(0,G.useState)(``),[C,w]=(0,G.useState)(``),[T,E]=(0,G.useState)(!1),[D,O]=(0,G.useState)(Qn),k=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!T)return;let e=e=>{k.current&&!k.current.contains(e.target)&&E(!1)},t=e=>{e.key===`Escape`&&E(!1)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,t)}},[T]),(0,G.useEffect)(()=>{let e=setInterval(()=>{document.visibilityState!==`hidden`&&z.refreshSessions()},6e4);return()=>clearInterval(e)},[]),(0,G.useEffect)(()=>{z.refreshSessions()},[]);let A=e=>z.direct||!e?null:p.find(t=>t.id===e)?.name||e,ee=e=>p.length>1?A(e):null,j=(0,G.useMemo)(()=>Array.from(new Set(u.map(Yn).filter(Boolean))).sort((e,t)=>e.localeCompare(t)),[u]),te=(0,G.useMemo)(()=>{if(x)return[];let e=d;C&&(e=e.filter(e=>(e.nodeId||m)===C));let t=h.trim().toLowerCase();return t&&(e=e.filter(e=>`${e.name??``} ${e.label??``} ${e.agent??``} ${e.workspace??``}`.toLowerCase().includes(t))),[...e].sort((e,t)=>qn(t.lastActivityAt??t.createdAt)-qn(e.lastActivityAt??e.createdAt))},[d,h,x,C,m]),M=(0,G.useMemo)(()=>{let e=h.trim().toLowerCase(),t=new Set(d.map(e=>e.sessionId).filter(Boolean));return Vn([...u.filter(n=>{if(t.has(n.sessionId))return!1;let r=Yn(n);if(C&&n.nodeId!==C||x&&r!==x)return!1;let i=z.direct||!n.nodeId?``:p.find(e=>e.id===n.nodeId)?.name||``,a=[n.name,n.source,n.agentName,r,n.branch,n.nodeId,i].filter(Boolean).join(` `);return!e||a.toLowerCase().includes(e)})].sort((e,t)=>xn(t)-xn(e)||qn(t.updatedAt)-qn(e.updatedAt)))},[u,d,p,h,x,C]),N=x.length>0||C.length>0,P=h.trim().length>0||N?M:M.slice(0,D),ne=M.length-P.length;(0,G.useEffect)(()=>{O(Qn)},[h,x,C]);let F=+!!x+ +!!C,I=[C?A(C):z.direct?null:`All machines`,x||null].filter(Boolean).join(` · `),re=h.trim()||x||C?`No matching sessions.`:`No sessions yet. Start one with New session.`,ie=e=>{let t=String(e.workspace||``).replace(/[\\/]+$/,``).split(/[\\/]/).pop();return[e.label||e.agent,ee(e.nodeId||m||void 0),t].filter(Boolean).join(` · `)};return(0,K.jsxs)(`div`,{className:`session-list`,children:[_&&(0,K.jsx)(B,{title:`Delete saved session?`,message:`Delete “${_.name}” and its saved Cloud history? This can't be undone.`,confirmLabel:`Delete`,danger:!0,onCancel:()=>v(null),onConfirm:()=>{let e=_.sessionId;v(null),b(e),z.deleteSession(e).catch(()=>z.store.setError(`Couldn't delete the session.`)).finally(()=>b(null))}}),(i||o||c)&&(0,K.jsxs)(`nav`,{className:`sidebar-nav`,"aria-label":`Workspace`,children:[i&&(0,K.jsxs)(`button`,{className:`sidebar-nav-item${a?` active`:``}`,onClick:i,"aria-current":a?`page`:void 0,children:[(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M13 2 3 14h9l-1 8 10-12h-9z`})}),(0,K.jsx)(`span`,{children:`Automations`})]}),o&&$n.map(({view:e,label:t,icon:n})=>(0,K.jsxs)(`button`,{className:`sidebar-nav-item${s===e?` active`:``}`,onClick:()=>o(e),"aria-current":s===e?`page`:void 0,children:[(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:n}),(0,K.jsx)(`span`,{children:t})]},e)),c&&(0,K.jsxs)(`button`,{className:`sidebar-nav-item`,onClick:c,disabled:l,"aria-label":`Open standalone terminal`,children:[(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,K.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,K.jsx)(`path`,{d:`m7 9 3 3-3 3`}),(0,K.jsx)(`path`,{d:`M13 15h4`})]}),(0,K.jsx)(`span`,{children:`Terminal`})]})]}),(0,K.jsxs)(`div`,{className:`session-list-tools`,children:[(0,K.jsxs)(`label`,{className:`session-search-wrap`,children:[(0,K.jsx)(Ke,{size:17,"aria-hidden":!0}),(0,K.jsx)(`input`,{className:`field session-search`,type:`search`,"aria-label":`Search sessions`,placeholder:u.length>1?`Search ${u.length} sessions`:`Search sessions`,value:h,onChange:e=>g(e.target.value)})]}),(0,K.jsxs)(`div`,{className:`session-filter`,ref:k,children:[(0,K.jsxs)(`button`,{className:`session-filter-btn${F?` active`:``}`,type:`button`,"aria-label":F?`Filter sessions, ${I}`:`Filter sessions`,"aria-haspopup":`menu`,"aria-expanded":T,onClick:e=>{e.stopPropagation(),!z.direct&&p.length===0&&z.refreshNodes(),E(e=>!e)},children:[(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M3 5h18l-7 8v6l-4-2v-4z`})}),F>0&&(0,K.jsx)(Te,{tone:`accent`,variant:`solid`,className:`session-filter-count`,children:F})]}),T&&(0,K.jsxs)(`div`,{className:`menu session-filter-menu`,role:`menu`,children:[!z.direct&&(0,K.jsxs)(`div`,{className:`session-filter-section`,children:[(0,K.jsx)(`div`,{className:`session-filter-head`,children:`Machine`}),(0,K.jsxs)(`button`,{className:`menu-item session-filter-item`,role:`menuitemradio`,"aria-checked":!C,onClick:()=>{w(``),E(!1)},children:[(0,K.jsx)(`span`,{children:`All machines`}),!C&&(0,K.jsx)(`span`,{className:`session-filter-check`,children:(0,K.jsx)(at,{size:15})})]}),p.length===0?(0,K.jsx)(`div`,{className:`session-filter-empty`,children:`No machines`}):p.map(e=>(0,K.jsxs)(`button`,{className:`menu-item session-filter-item`,role:`menuitemradio`,"aria-checked":e.id===C,onClick:()=>{w(e.id),E(!1)},children:[(0,K.jsx)(`span`,{children:e.name||e.id}),e.id===C&&(0,K.jsx)(`span`,{className:`session-filter-check`,children:(0,K.jsx)(at,{size:15})})]},e.id))]}),(0,K.jsxs)(`div`,{className:`session-filter-section`,children:[(0,K.jsx)(`div`,{className:`session-filter-head`,children:`GitHub repo`}),(0,K.jsxs)(`button`,{className:`menu-item session-filter-item`,role:`menuitemradio`,"aria-checked":!x,onClick:()=>{S(``),E(!1)},children:[(0,K.jsx)(`span`,{children:`All repositories`}),!x&&(0,K.jsx)(`span`,{className:`session-filter-check`,children:(0,K.jsx)(at,{size:15})})]}),j.length===0&&(0,K.jsx)(`div`,{className:`session-filter-empty`,children:`No GitHub repos`}),j.map(e=>(0,K.jsxs)(`button`,{className:`menu-item session-filter-item`,role:`menuitemradio`,"aria-checked":e===x,onClick:()=>{S(e),E(!1)},children:[(0,K.jsx)(`span`,{children:e}),e===x&&(0,K.jsx)(`span`,{className:`session-filter-check`,children:(0,K.jsx)(at,{size:15})})]},e))]}),(0,K.jsxs)(`div`,{className:`session-filter-foot`,children:[(0,K.jsx)(`span`,{className:`session-filter-summary`,children:I}),(x||C)&&(0,K.jsx)(`button`,{className:`session-filter-clear`,onClick:()=>{S(``),w(``)},children:`Clear`})]})]})]})]}),M.length===0&&te.length===0&&(0,K.jsx)(`div`,{className:`session-empty`,children:re}),(0,K.jsxs)(`ul`,{children:[te.length>0&&(0,K.jsx)(`li`,{className:`session-group-label`,children:`Running`}),te.map(e=>{let n=e.name||e.label||e.agent||`Terminal session`,r=ie(e);return(0,K.jsx)(`li`,{className:`session-row`,children:(0,K.jsx)(`button`,{className:`session-item`,onClick:()=>t(e.termId,e.nodeId),children:(0,K.jsxs)(`span`,{className:`session-body`,children:[(0,K.jsxs)(`span`,{className:`session-title-row`,children:[(0,K.jsx)(Un,{status:`working`,srLabel:`${Tn.label} · Running in terminal`}),(0,K.jsx)(`span`,{className:`session-name`,children:n}),Jn(e.lastActivityAt??e.createdAt)&&(0,K.jsx)(`span`,{className:`session-age`,title:`Running in terminal`,children:Jn(e.lastActivityAt??e.createdAt)})]}),r&&(0,K.jsx)(`span`,{className:`session-meta`,children:r})]})})},e.termId)}),P.map((t,i)=>{let a=e=>xn(e)>0?`Needs attention`:Bn(e.updatedAt),o=t.nestedUnder?null:a(t),s=i>0?P.slice(0,i).reverse().find(e=>!e.nestedUnder):void 0,c=s?a(s):null,l=o&&o!==c?(0,K.jsx)(`li`,{className:`session-group-label`,children:o}):null,u=Xn(t,ee(t.nodeId)||t.pendingNodeName||null),d=Cn(t),p=r?.get(t.sessionId)??On(t.source),m=zn(n?.get(t.sessionId))??(xn(t)>0?{text:Cn(t),tone:t.status===`failed`||t.status===`needs_action`||t.needsAction?`danger`:`warn`}:null),h=t.pendingLaunch&&t.status===`failed`;return(0,K.jsxs)(G.Fragment,{children:[l,(0,K.jsxs)(`li`,{className:`session-row${t.nestedUnder?` nested`:``}`,children:[(0,K.jsx)(`button`,{className:`session-item${t.sessionId===f?` active`:``}`,"aria-current":t.sessionId===f?`page`:void 0,onClick:()=>e(t.sessionId,t.path,t.nodeId),children:(0,K.jsxs)(`span`,{className:`session-body`,children:[(0,K.jsxs)(`span`,{className:`session-title-row`,children:[(0,K.jsx)(Un,{status:yn(t),srLabel:`${p.label} · ${d}`}),(0,K.jsx)(`span`,{className:`session-name`,children:t.name}),(0,K.jsx)(Kn,{prs:t.prs}),Jn(t.updatedAt)&&(0,K.jsx)(`span`,{className:`session-age`,title:d,children:Jn(t.updatedAt)})]}),(m||u)&&(0,K.jsxs)(`span`,{className:`session-meta`,children:[p.automation&&(0,K.jsx)(jn,{kind:p.kind,size:`xs`}),m&&(0,K.jsx)(`span`,{className:`row-hint ${m.tone}`,children:m.text}),m&&u?` · `:``,u]})]})}),t.rebuildable&&!t.pendingLaunch&&(0,K.jsx)(`span`,{className:`pending-launch-actions`,children:(0,K.jsx)(`button`,{type:`button`,disabled:y===t.sessionId,"aria-label":`Delete ${t.name}`,onClick:()=>v({sessionId:t.sessionId,name:t.name||`Saved session`}),children:y===t.sessionId?`Deleting…`:`Delete`})}),h&&(0,K.jsxs)(`span`,{className:`pending-launch-actions`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>void z.retryPendingLaunch(t.sessionId),children:`Retry`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void z.dismissPendingLaunch(t.sessionId),children:`Dismiss`})]})]})]},t.sessionId)})]}),ne>0&&(0,K.jsxs)(`button`,{className:`session-more`,onClick:()=>O(e=>e+Qn),children:[`Show more (`,ne,`)`]})]})}function tr({checked:e,onChange:t,disabled:n,label:r}){return(0,K.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":r,disabled:n,className:`settings-toggle${e?` on`:``}`,onClick:()=>t(!e),children:(0,K.jsx)(`span`,{className:`settings-toggle-knob`,"aria-hidden":!0})})}var nr=new Set;function rr(){for(let e of nr)e()}function ir(e){return e.kind===`automations`?{section:e.section}:null}var ar=ir(se()),or=null;typeof window<`u`&&window.addEventListener(`popstate`,()=>{ar=ir(se()),rr()});function sr(e){return nr.add(e),()=>nr.delete(e)}function cr(){return ar}function lr(e){or=e?.setup??null;let t=e?.section??null;Ie({kind:`automations`,section:t}),ar={section:t},rr()}function ur(e){Ie({kind:`automations`,section:e},{replace:!0}),ar={section:e},rr()}function dr(){let e=or;return or=null,e}function fr(e){Ie(e,{replace:!0}),ar=null,or=null,rr()}var pr=new Set,mr=!1;function hr(){for(let e of pr)e()}function gr(e){return pr.add(e),()=>pr.delete(e)}function _r(){return mr}function vr(){mr=!0,hr()}function yr(){mr=!1,hr()}var br=`curl -fsSL https://bivy.sh/install.sh | bash`;function xr(e){try{let t=new URL(e).hostname;return t===`bivy.sh`||t.endsWith(`.bivy.sh`)}catch{return!1}}function Sr(e,t,n){let r=e.replace(/\/$/,``),i=t?.replace(/\/$/,``),a=[`BIVY_CONTROL_PLANE_URL=${Cr(r)}`,...i?[`BIVY_RELAY_URL=${Cr(i)}`]:[]],o=n?[`BIVY_ACCOUNT_TOKEN=${Cr(n)}`,...a]:a,s=xr(e),c=e=>e.length?`curl -fsSL https://bivy.sh/install.sh | ${e.join(` `)} bash`:br,l=s?br:c(a);return{command:n?c(o):l,plainCommand:l,hosted:s,authenticated:!!n}}function Cr(e){return/^[A-Za-z0-9_.:/=@%+-]+$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}function wr({onEnrolled:e}){let[t,n]=(0,G.useState)(null),[r,i]=(0,G.useState)(!0),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),[l,d]=(0,G.useState)(0),f=(0,G.useRef)(null),p=(0,G.useRef)(null),m=(0,G.useRef)(e);m.current=e;let h=Sr(u(),z.local.relay);(0,G.useEffect)(()=>{let e=!1;return i(!0),o(null),f.current??=z.createNodeClaim(),f.current.then(t=>{if(!t.command)throw Error(`This server did not return an install command.`);e||n(t)}).catch(t=>{e||o(t instanceof Error?t.message:String(t))}).finally(()=>{e||i(!1)}),()=>{e=!0}},[l]),(0,G.useEffect)(()=>{if(!t||t.status!==`pending`)return;let e=!1,r,i=async()=>{try{if(Date.parse(t.expiresAt)<=Date.now()){e||n({...t,status:`expired`,command:void 0});return}let r=await z.listNodeClaims();if(e)return;let i=r.find(e=>e.id===t.id);if(o(null),i&&i.status!==`pending`){n({...i,command:void 0}),i.status===`used`&&i.nodeId&&m.current?.(i.nodeId);return}}catch{e||o(`Could not check installation progress. Retrying automatically…`)}e||(r=setTimeout(i,3e3))};return i(),()=>{e=!0,clearTimeout(r)}},[t]),(0,G.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]);let g=async(e,t)=>{if(!await nt(e)){o(`Could not copy. Select and copy the command manually.`);return}c(t),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>c(null),1500)};return(0,K.jsxs)(`div`,{className:`settings-form machine-install-instructions`,children:[(0,K.jsx)(`h3`,{children:`Run this on your machine`}),(0,K.jsx)(`p`,{className:`muted`,children:`On your Mac or Linux computer, open a terminal in your repository and paste this command. It installs Bivy and connects your machine to this account.`}),r&&(0,K.jsx)(`p`,{className:`muted`,role:`status`,children:`Preparing your one-time install command…`}),a&&(0,K.jsx)(`p`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:a}),t?.status===`pending`&&t.command&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`connect-command`,children:[(0,K.jsx)(`code`,{tabIndex:0,"aria-label":`One-time install command`,children:t.command}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost icon-only${s===`claim`?` is-copied`:``}`,onClick:()=>void g(t.command,`claim`),"aria-label":s===`claim`?`Install command copied`:`Copy install command`,title:s===`claim`?`Copied`:`Copy install command`,children:s===`claim`?(0,K.jsx)(at,{size:16}):(0,K.jsx)(et,{size:16})})]}),(0,K.jsx)(`p`,{className:`muted`,children:`Single-use · expires in 10 minutes. Paste only on a machine you trust. No second Bivy sign-in required.`})]}),t?.status===`used`&&(0,K.jsxs)(`div`,{role:`status`,children:[(0,K.jsx)(`p`,{children:`Machine enrolled. Waiting for it to come online…`}),(0,K.jsx)(`p`,{className:`muted`,children:`Keep the installer running until it finishes. If it reports a service error, follow its recovery instructions on the machine.`})]}),(t?.status===`expired`||t?.status===`revoked`)&&(0,K.jsxs)(`p`,{role:`status`,children:[`This install command has `,t.status===`expired`?`expired`:`been revoked`,`. Create a new one to continue.`]}),!r&&t?.status!==`pending`&&t?.status!==`used`&&(0,K.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:()=>{f.current=null,n(null),c(null),d(e=>e+1)},children:t?`Create new install command`:`Retry install command`}),(0,K.jsx)(`p`,{className:`muted`,children:`Bivy runs in the background and detects available agents. Existing agent logins are reused where supported. Keep this machine awake and online while work runs.`}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{children:`Other ways to install`}),(0,K.jsxs)(`p`,{className:`muted`,children:[`Use this command if you prefer to sign in on the machine.`,!h.hosted&&` It connects to your self-hosted server.`]}),(0,K.jsxs)(`div`,{className:`connect-command`,children:[(0,K.jsx)(`code`,{tabIndex:0,children:h.plainCommand}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost icon-only${s===`plain`?` is-copied`:``}`,onClick:()=>void g(h.plainCommand,`plain`),"aria-label":s===`plain`?`Regular sign-in command copied`:`Copy regular sign-in command`,children:s===`plain`?(0,K.jsx)(at,{size:16}):(0,K.jsx)(et,{size:16})})]})]})]})}function Tr({onClose:e}){return(0,K.jsx)(ot,{title:`Add a Machine`,onClose:e,variant:`centered`,children:(0,K.jsx)(wr,{})})}var Er=e=>e?.();function Dr({docked:e,...t}){if(!e)return(0,K.jsx)(ot,{...t});let{title:n,headExtra:r,children:i,ariaLabel:a}=t;return(0,K.jsxs)(`section`,{className:`pane-panel`,"data-size":t.size,"aria-label":a??(typeof n==`string`?n:void 0),children:[(0,K.jsxs)(`div`,{className:`pane-panel-head`,children:[(0,K.jsx)(`span`,{className:`pane-panel-title`,children:n}),r]}),(0,K.jsx)(`div`,{className:`pane-panel-content`,children:typeof i==`function`?i(Er):i})]})}function Or({label:e,items:t,onOpen:n}){let[r,i]=(0,G.useState)(!1),a=(0,G.useRef)(null),o=()=>{i(!1),a.current?.querySelector(`[aria-haspopup=menu]`)?.focus()};return rt(o,r),(0,G.useEffect)(()=>{if(!r)return;a.current?.querySelector(`[role^=menuitem]:not(:disabled)`)?.focus();let e=e=>{a.current?.contains(e.target)||i(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[r]),(0,K.jsxs)(`div`,{className:`apps-more`,ref:a,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn ghost icon`,"aria-label":e,title:`More`,"aria-haspopup":`menu`,"aria-expanded":r,onClick:e=>{e.stopPropagation(),r||n?.(),i(e=>!e)},children:(0,K.jsx)(V,{size:18})}),r&&(0,K.jsx)(`div`,{className:`menu apps-more-menu`,role:`menu`,"aria-label":e,children:t.map(e=>`heading`in e?(0,K.jsx)(`div`,{className:`menu-heading`,role:`presentation`,children:e.heading},e.heading):(0,K.jsxs)(`button`,{type:`button`,role:e.checked===void 0?`menuitem`:e.toggle?`menuitemcheckbox`:`menuitemradio`,"aria-checked":e.checked,className:`menu-item${e.danger?` danger`:``}${e.separated?` separated`:``}`,disabled:e.disabled,onClick:()=>{o(),e.onSelect()},children:[(0,K.jsx)(`span`,{className:`menu-item-label`,children:e.label}),e.checked&&(0,K.jsx)(at,{size:15,"aria-hidden":!0})]},e.label))})]})}function kr(e){let t=e.setups.filter(e=>e.active&&e.id!==`local`);return t.length?t.map(e=>e.label).join(` + `):e.setups.find(e=>e.id===`local`)?.label??`This machine only`}function Ar(e,t){let n=e.setups.filter(e=>e.gives[t]===2).map(e=>e.label);return n.length>1?`${n.slice(0,-1).join(`, `)} or ${n.at(-1).replace(/^Your/,`your`)}`:n[0]??``}var jr=[``,`on your tailnet`,`from anywhere`];function Mr(e=!0){let[t,n]=(0,G.useState)(null),[r,i]=(0,G.useState)(``);return(0,G.useEffect)(()=>{if(!e)return;let t=!0;return z.getAccess().then(e=>{t&&n(e)}).catch(e=>{t&&i(String(e?.message||e))}),()=>{t=!1}},[e]),{report:t,error:r}}function Nr({command:e}){let[t,n]=(0,G.useState)(!1);return(0,K.jsxs)(`div`,{className:`repo-connect-command`,children:[(0,K.jsx)(`code`,{children:e}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost${t?` is-copied`:``}`,"aria-label":`Copy ${e}`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),window.setTimeout(()=>n(!1),1500)})},children:t?`Copied`:`Copy`})]})}function Pr(){let{report:e,error:t}=Mr();return(0,K.jsxs)(`section`,{className:`settings-section`,"aria-labelledby":`access-title`,children:[(0,K.jsx)(`h4`,{className:`settings-subhead`,id:`access-title`,children:`How you reach this machine`}),e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`small`,children:[(0,K.jsx)(`strong`,{children:kr(e)}),e.tailscaleUrl?(0,K.jsxs)(`span`,{className:`muted`,children:[` · `,e.tailscaleUrl]}):null]}),(0,K.jsx)(`ul`,{className:`readiness-checks`,children:e.features.map(t=>{let n=e.reach[t.id];return(0,K.jsxs)(`li`,{className:`readiness-check${n?``:` state-pending`}`,children:[(0,K.jsx)(`span`,{className:`readiness-mark${n?` mark-passed`:``}`,"aria-hidden":!0,children:n?`✓`:`–`}),(0,K.jsx)(`span`,{className:`readiness-label`,children:t.label}),(0,K.jsx)(`span`,{className:`readiness-detail`,"aria-hidden":!0,children:n?jr[n]:`not with this setup`}),(0,K.jsx)(`span`,{className:`sr-only`,children:n?`: yes, ${jr[n]}`:`: not with this setup`})]},t.id)})}),e.next.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h4`,{className:`settings-subhead`,children:`Next`}),e.next.map(t=>{let n=e.setups.find(e=>e.id===t.id);return n?(0,K.jsxs)(`div`,{className:`settings-section`,children:[(0,K.jsxs)(`div`,{className:`small`,children:[(0,K.jsx)(`strong`,{children:n.label}),` `,(0,K.jsxs)(`span`,{className:`muted`,children:[`adds `,t.addsText,`. `,n.summary]})]}),n.command&&(0,K.jsx)(Nr,{command:n.command})]},t.id):null}),(0,K.jsx)(`div`,{className:`muted small`,children:`Run these on the machine. Setups stack: adding one never takes away another.`})]})]}):(0,K.jsx)(`p`,{className:`muted small`,role:t?`alert`:`status`,children:t?`Couldn't ask the machine: ${t}`:`Checking…`})]})}function Fr({feature:e,inSettings:t=!1}){let{report:n}=Mr(z.direct);if(!n||n.reach[e]>0)return null;let r=n.features.find(t=>t.id===e)?.label??e;return(0,K.jsxs)(`div`,{className:`banner inline`,"data-tone":`accent`,children:[(0,K.jsxs)(`span`,{className:`banner-text`,role:`status`,children:[r,` need `,Ar(n,e),`.`]}),(0,K.jsx)(`span`,{className:`banner-actions`,children:(0,K.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:()=>t?At(`nodes`):Mt(`nodes`),children:`See options`})})]})}var Ir=`bivy.app-share`;function Lr(){try{let e=JSON.parse(localStorage.getItem(Ir)??`{}`);return{duration:be.some(t=>t.id===e.duration)?e.duration:`1d`,controls:e.controls!==!1}}catch{return{duration:`1d`,controls:!0}}}var Rr=e=>new Date(e).toLocaleString([],{weekday:`short`,hour:`numeric`,minute:`2-digit`});function zr({sessionId:e,appId:t,viewId:n,name:r,nodeId:i,address:a,disabled:o,onRevoked:s}){let{connection:c}=je(),l=!!i&&!z.direct&&i!==c.currentNodeId||c.status===`online`,[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(``),[b,x]=(0,G.useState)(``),[S,C]=(0,G.useState)(``),[w,T]=(0,G.useState)(Lr),[E,D]=(0,G.useState)(null),[O,k]=(0,G.useState)(!1),A=e=>T(t=>{let n={...t,...e};try{localStorage.setItem(Ir,JSON.stringify(n))}catch{}return n}),ee=async()=>{let r=(await z.appCommand(`apps.list`,e,{},i)).apps.find(e=>e.id===t)?.views.find(e=>e.id===n);return r?.kind===`web`?r:void 0},j=()=>ee().then(e=>D(e?.sharing??null)).catch(()=>{});(0,G.useEffect)(()=>{u&&l&&j()},[u,l]);let te=async e=>{p(!0),_(!1),x(``),y(``),C(``);try{await e()}catch(e){x(e instanceof Error?e.message:`Could not update app access.`)}finally{p(!1)}},M=async(e,t=!1)=>{let n=new URL(e);if(n.protocol!==`https:`||n.username||n.password||n.origin===location.origin)throw Error(`Machine returned an unsafe preview URL.`);let r=await nt(n.href);t?y(r?`Address copied. Only works when signed in to Bivy.`:`Your address · Bivy sign-in required.`):r?_(!0):y(`Copy this link to share.`),r||C(n.href)},N=()=>te(async()=>{let e=a??(await ee())?.address;if(!e)throw Error(`Address unavailable. Try republishing the app.`);await M(e,!0)});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{className:`btn sm ghost`,disabled:o,onClick:()=>d(!0),"aria-label":`Share ${r}`,children:[(0,K.jsx)(dt,{size:15}),`Share`]}),u&&(0,K.jsxs)(ot,{title:`Share ${r}`,onClose:()=>{d(!1),_(!1),y(``),x(``),C(``)},autoFocusSearch:!1,headExtra:(0,K.jsx)(Or,{label:`Sharing options`,items:[{label:`Copy personal address`,disabled:f||!a&&!l,onSelect:()=>void N()},{label:`Revoke all access…`,danger:!0,separated:!0,disabled:f||!l||o,onSelect:()=>h(!0)}]}),children:[(0,K.jsxs)(`div`,{className:`apps-sheet`,children:[(0,K.jsx)(Fr,{feature:`sharing`}),E&&(0,K.jsxs)(`div`,{className:`banner`,"data-tone":`accent`,children:[(0,K.jsxs)(`span`,{className:`banner-text`,role:`status`,children:[`Shared · `,E.links===1?`1 link`:`${E.links} links`,` until `,Rr(E.expiresAt)]}),(0,K.jsx)(`span`,{className:`banner-actions`,children:(0,K.jsx)(`button`,{className:`btn sm danger-ghost`,disabled:f||!l,onClick:()=>k(!0),children:`Stop sharing`})})]}),(0,K.jsxs)(`div`,{className:`apps-group`,children:[(0,K.jsx)(`p`,{className:`apps-group-title`,id:`share-for-${n}`,children:`Link works for`}),(0,K.jsx)(`div`,{className:`segmented`,role:`radiogroup`,"aria-labelledby":`share-for-${n}`,children:be.map(e=>(0,K.jsx)(`button`,{type:`button`,role:`radio`,className:`seg-btn`,"aria-checked":w.duration===e.id,onClick:()=>A({duration:e.id}),children:e.label},e.id))})]}),(0,K.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,K.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,K.jsx)(`span`,{className:`settings-toggle-title`,children:`Feedback tools`}),(0,K.jsx)(`span`,{className:`muted small`,children:w.controls?`People can point, draw and leave you notes.`:`People see only the app.`})]}),(0,K.jsx)(tr,{checked:w.controls,onChange:e=>A({controls:e}),label:`Feedback tools`})]}),(0,K.jsx)(`p`,{className:`apps-foot`,children:`Anyone with the link can use this app, including its live backend, until it expires or you stop sharing.`}),(0,K.jsxs)(`button`,{className:`btn primary`,disabled:f||!l||o,"aria-label":`Copy share link`,onClick:()=>void te(async()=>{let r=await z.appCommand(`apps.share`,e,{appId:t,viewId:n,duration:w.duration,controls:w.controls},i);await M(r.url),j()}),children:[g?(0,K.jsx)(at,{size:16}):(0,K.jsx)(dt,{size:16}),(0,K.jsx)(`span`,{role:`status`,children:f?`Preparing…`:g?`Copied`:`Copy link`})]}),b&&(0,K.jsx)(`p`,{className:`apps-foot`,role:`alert`,children:b}),v&&(0,K.jsx)(`p`,{className:`apps-foot`,role:`status`,children:v}),S&&(0,K.jsx)(`input`,{className:`field`,readOnly:!0,value:S,"aria-label":`Link to ${r}`,onFocus:e=>e.currentTarget.select()})]}),O&&(0,K.jsx)(B,{title:`Stop sharing?`,message:`Every share link stops working, and people who have the app open lose it. Your own previews keep working.`,confirmLabel:`Stop sharing`,danger:!0,onCancel:()=>k(!1),onConfirm:()=>{k(!1),te(async()=>{await z.appCommand(`apps.unshare`,e,{appId:t,viewId:n},i),D(null),y(`Sharing stopped.`)})}}),m&&(0,K.jsx)(B,{title:`Revoke all access?`,message:`Share links and every open preview, including yours, stop working. The app stays available.`,confirmLabel:`Revoke access`,danger:!0,onCancel:()=>h(!1),onConfirm:()=>{h(!1),te(async()=>{await z.appCommand(`apps.revoke`,e,{appId:t,viewId:n},i),D(null),y(`Access revoked.`),s?.()})}})]})]})}var Br=`Picture: retaken on the machine, so it may not show this page’s state (a cart, a sign-in, an open menu). The marks and elements are exact.`,Vr=`bivy.previewPeekBlocked`,Hr=6048e5;function Ur(){try{let e=JSON.parse(localStorage.getItem(Vr)??`null`);return e?.agent===navigator.userAgent&&typeof e.at==`number`&&Date.now()-e.at<Hr}catch{return!1}}function Wr(){try{localStorage.setItem(Vr,JSON.stringify({agent:navigator.userAgent,at:Date.now()}))}catch{}}function Gr({url:e,name:t,sessionId:n,appId:r,viewId:i,onClose:a,onOpenInTab:o,access:s,onManage:c,revoked:l,docked:u}){let f=(0,G.useRef)(null),[p,m]=(0,G.useState)(!1),{settings:{sttConfig:h}}=je(),g=yt(h),[_,v]=(0,G.useState)(null),y=new URL(e).origin,[b,x]=(0,G.useState)(null),S=(0,G.useCallback)(e=>{f.current?.contentWindow?.postMessage({source:`bivy`,...e},y)},[y]),C=!!(r&&i),w=(0,G.useCallback)(()=>{S({type:`voice`,available:!!g}),S({type:`draw`,available:C})},[g,C,S]);(0,G.useEffect)(()=>{w()},[w]);let T=(0,G.useCallback)((e,t=[],o=!1)=>{z.prefillComposer(e,t)||d(localStorage,n,e),o&&r&&i&&z.stagePin({sessionId:n,appId:r,viewId:i,context:e.trim().slice(-80)}),x(null),a()},[n,r,i,a]),E=(0,G.useCallback)(async(e,t)=>{if(!r||!i)return T(e);x({state:`working`});try{let a=await z.appCommand(`apps.annotate`,n,{appId:r,viewId:i,...t});if(a.screenshotsOff||!a.image){x({state:`off`,text:e,mark:t});return}let o=a.image,s={kind:`image`,mimeType:o.mimeType,data:o.data,size:Math.round(o.data.length*3/4),name:a.approximate?o.name.replace(/\.png$/,` (approximate).png`):o.name};T(a.approximate?`${e}\n${Br}`:e,[s],!0)}catch(n){x({state:`failed`,text:e,mark:t,message:n instanceof Error?n.message:`Couldn’t take the picture.`})}},[r,i,n,T]),D=async(e,t)=>{x({state:`working`});try{await z.setNodeSettings({appScreenshots:!0}),await E(e,t)}catch(n){x({state:`failed`,text:e,mark:t,message:n instanceof Error?n.message:`Couldn’t turn on screenshots.`})}};return(0,G.useEffect)(()=>{let e=e=>{if(e.origin!==y||e.source!==f.current?.contentWindow)return;let t=e.data;if(t?.source===`bivy-preview`){if(t.type===`draft`&&typeof t.text==`string`){let e=t.text.slice(0,8e3);z.prefillComposer(e)||d(localStorage,n,e),a()}else t.type===`blocked`?(Wr(),m(!0)):t.type===`hello`?w():t.type===`annotation`&&typeof t.text==`string`&&t.mark?E(t.text.slice(0,8e3),t.mark):t.type===`listen`&&(t.state===`start`?g?v(e=>e??{stop:0}):S({type:`transcript`,error:ht}):t.state===`stop`?v(e=>e&&{stop:e.stop+1}):t.state===`cancel`&&v(null))}};return addEventListener(`message`,e),()=>removeEventListener(`message`,e)},[y,n,a,g,S,w,E]),(0,K.jsx)(Dr,{docked:u,title:t,ariaLabel:`Preview: ${t}`,onClose:a,size:`full`,autoFocusSearch:!1,headExtra:(0,K.jsxs)(`div`,{className:`preview-head-actions`,children:[(0,K.jsx)(`button`,{className:`btn ghost icon`,onClick:o,"aria-label":`Open in tab ↗`,title:`Open in tab · Only you`,children:(0,K.jsx)(`span`,{"aria-hidden":!0,children:`↗`})}),s,c&&(0,K.jsx)(`button`,{className:`btn ghost icon`,onClick:c,"aria-label":`App options`,title:`App options`,children:(0,K.jsx)(V,{size:18})})]}),children:l?(0,K.jsx)(`div`,{className:`changes-binary`,role:`status`,children:`Access revoked. Open a new preview to continue.`}):p?(0,K.jsxs)(`div`,{className:`changes-binary`,role:`status`,children:[`This browser doesn’t allow app previews inside Bivy, so previews will open in a tab on this device. `,(0,K.jsx)(`button`,{className:`btn sm`,onClick:o,children:`Open in tab ↗`})]}):(0,K.jsxs)(`div`,{className:`preview-peek-stage`,children:[_&&g&&(0,K.jsx)(`div`,{className:`preview-voice`,children:(0,K.jsx)(Tt,{engine:g,stop:_.stop,onResult:e=>S({type:`transcript`,text:e.slice(0,4e3)}),onCancel:()=>{v(null),S({type:`listening`,on:!1})},onError:e=>S({type:`transcript`,error:e})})}),(0,K.jsx)(`iframe`,{ref:f,className:`preview-peek`,src:e,title:t,referrerPolicy:`no-referrer`,sandbox:`allow-scripts allow-same-origin allow-forms allow-downloads allow-popups`,allow:`clipboard-read; clipboard-write`,onLoad:w}),b&&(0,K.jsx)(`div`,{className:`preview-marking`,role:b.state===`working`?`status`:`alert`,children:b.state===`working`?(0,K.jsxs)(`div`,{className:`banner inline`,"data-tone":`neutral`,children:[(0,K.jsx)(Ct,{size:`sm`}),(0,K.jsx)(`span`,{className:`banner-text`,children:`Adding a picture of what you marked…`})]}):(0,K.jsxs)(`div`,{className:`banner inline`,"data-tone":b.state===`off`?`neutral`:`danger`,children:[(0,K.jsx)(`span`,{className:`banner-text`,children:b.state===`off`?`Screenshots are off on this machine, so there’s no picture. Your marks and the elements you marked still go with your words.`:`Couldn’t add the picture: ${b.message}`}),(0,K.jsxs)(`span`,{className:`banner-actions`,children:[b.state===`off`?(0,K.jsx)(`button`,{className:`btn primary`,onClick:()=>void D(b.text,b.mark),children:`Turn on and add picture`}):(0,K.jsx)(`button`,{className:`btn`,onClick:()=>void E(b.text,b.mark),children:`Try again`}),(0,K.jsx)(`button`,{className:`btn ghost`,onClick:()=>T(b.text,[],!0),children:`Add without picture`})]})]})})]})})}var Kr=e=>`bivy:notes-seen:${e}`,qr=`bivy:notes-seen`;function Jr(e){return Number(localStorage.getItem(Kr(e)))||0}function Yr(e,t){t<=Jr(e)||(localStorage.setItem(Kr(e),String(t)),window.dispatchEvent(new CustomEvent(qr,{detail:e})))}function Xr(e,t){let[n,r]=(0,G.useState)(()=>e?Jr(e):0);return(0,G.useEffect)(()=>{if(!e)return;r(Jr(e));let t=t=>{t.detail===e&&r(Jr(e))};return window.addEventListener(qr,t),()=>window.removeEventListener(qr,t)},[e]),t.filter(e=>e>n).length}var Zr=new Set;function Qr(e){for(let t of Zr)t(e)}function $r(e){return Zr.add(e),()=>{Zr.delete(e)}}function ei(e){return e.trim().charAt(0).toUpperCase()||`A`}function ti({tile:e,name:t,meta:n,detail:r,action:i,small:a=!1}){return(0,K.jsxs)(`div`,{className:`app-row${a?` small`:``}`,children:[(0,K.jsx)(`span`,{className:`app-tile`,"aria-hidden":!0,children:e}),(0,K.jsxs)(`div`,{className:`app-row-text`,children:[(0,K.jsx)(`strong`,{className:`app-row-name`,children:t}),n&&(0,K.jsx)(`span`,{className:`app-row-meta`,children:n}),r]}),i&&(0,K.jsx)(`div`,{className:`app-row-action`,children:i})]})}function ni({app:e}){return(0,K.jsx)(`div`,{className:`apps-card app-message`,children:(0,K.jsx)(ti,{tile:ei(e.name),name:e.name,meta:`App · opens over the chat`,action:(0,K.jsx)(`button`,{className:`btn sm primary`,onClick:()=>Qr({sessionId:e.sessionId,appId:e.appId}),"aria-label":`Open app: ${e.name}`,children:`Open`})})})}function ri(e){return e.flatMap(e=>e.shot?[{kind:`image`,name:`Reviewer note (approximate).png`,mimeType:`image/png`,hash:e.shot.hash,size:e.shot.size,createdAt:e.at,description:`Retaken on the machine; may differ from the reviewer's browser.`}]:[])}async function ii(e){return Promise.all(ri(e).map(async e=>{let t=await z.fetchAttachment(e.hash,e.createdAt);if(!t)throw Error(`A reviewer picture is no longer available. The notes have not been added.`);return{...e,...t}}))}var ai={present:`Ready to review`,run:`Changed in this run`,asked:`As it looks now`,notes:`Reviewer notes`},oi={requests:`Requests`,data:`Data`,logs:`Logs`},si={ok:`ok`,warn:`changed`,danger:`problem`};function ci(e){let[t,n]=(0,G.useState)({url:null,missing:!1});return(0,G.useEffect)(()=>{if(!e)return;let t=!0,r=null;return z.fetchAttachment(e.hash).then(i=>{if(t){if(i){let e=Uint8Array.from(atob(i.data),e=>e.charCodeAt(0));r=URL.createObjectURL(new Blob([e],{type:i.mimeType||`image/png`}))}n({hash:e.hash,url:r,missing:!i})}},()=>{t&&n({hash:e.hash,url:null,missing:!0})}),()=>{t=!1,r&&URL.revokeObjectURL(r)}},[e?.hash]),e?t.hash===e.hash?{url:t.url,state:t.missing?`missing`:`ready`}:{url:null,state:`loading`}:{url:null,state:`none`}}function li({review:e}){let{connection:t,activeSession:n}=je(),r=n.activeSessionId===e.sessionId&&n.working,i=t.status===`online`,a=(0,G.useRef)(null),[o,s]=(0,G.useState)(!1);(0,G.useEffect)(()=>{let e=new IntersectionObserver(([t])=>{t?.isIntersecting&&(s(!0),e.disconnect())},{rootMargin:`300px`});return a.current&&e.observe(a.current),()=>e.disconnect()},[]);let c=ci(!o||e.expired?void 0:e.shot),l=ci(!o||e.expired?void 0:e.before),[u,f]=(0,G.useState)(`now`),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(!1),y=l.state===`ready`&&c.state===`ready`,b=u===`before`&&y?l:c,x=()=>{p||z.appCommand(`apps.list`,e.sessionId).then(t=>{let n=t.apps?.find(t=>t.id===e.appId);m(n?.reviewMode??`ready`)},()=>{})},S=async(e,t,n)=>{v(!0),g(``);try{await t(),n&&g(n)}catch(t){g(t instanceof Error?t.message:`Could not ${e}.`)}finally{v(!1)}},C=()=>S(`take a screenshot`,()=>z.appCommand(`apps.showMe`,e.sessionId,{appId:e.appId})),w=t=>S(`change preview cards`,async()=>{await z.appCommand(`apps.reviewMode`,e.sessionId,{appId:e.appId,mode:t}),m(t)},t===`off`?`No more cards for ${e.name}. Show me still works.`:`Preview cards: ${So[t].toLowerCase()}.`),T=()=>S(`read the notes`,async()=>{let t=(await z.appCommand(`apps.list`,e.sessionId)).apps?.find(t=>t.id===e.appId)?.views.find(t=>t.id===e.viewId),n=t?.kind===`web`?t.notes??[]:[];if(!n.length){g(`These notes were cleared.`);return}let r=Co(t.name,n),i=await ii(n);if(!z.prefillComposer(r,i)){if(i.length)throw Error(`Open this session’s chat before adding reviewer pictures.`);d(localStorage,e.sessionId,r)}},`Added to your message. Nothing is sent until you send it.`),E=()=>S(`turn on screenshots`,async()=>{await z.setNodeSettings({appScreenshots:!0}),await z.appCommand(`apps.showMe`,e.sessionId,{appId:e.appId})}),D=t=>Qr({sessionId:e.sessionId,appId:e.appId,...t?{openView:{viewId:e.viewId,path:e.path}}:{}}),O=e.evidence??[],k=t=>Qr({sessionId:e.sessionId,appId:e.appId,openView:{viewId:t.viewId,...t.item?{item:t.item}:{}}}),A=O.some(t=>t.viewId===e.viewId)&&!e.shot,ee=O.find(e=>e.tone===`warn`||e.tone===`danger`)??O[0],j=A?e.name:`${e.name}${e.view&&e.view!==e.name?` · ${e.view}`:``}`,te=A?`${ai[e.trigger]} · backend`:`${ai[e.trigger]} · ${e.path}`,M=t=>Qr({sessionId:e.sessionId,appId:e.appId,openView:{viewId:e.viewId,scenario:t}});return(0,K.jsxs)(`section`,{ref:a,className:`apps-card review-card`,"aria-label":`${e.name}: ${ai[e.trigger].toLowerCase()}`,children:[(0,K.jsx)(ti,{tile:ei(e.name),name:j,meta:te,action:(0,K.jsx)(Or,{label:`Preview card options for ${e.name}`,onOpen:x,items:[{label:`App options`,onSelect:()=>D(!1)},{heading:`Preview cards`},...[`ready`,`every`,`off`].map(e=>({label:So[e],checked:p?p===e:void 0,disabled:_||!i||!p,onSelect:()=>void w(e)})),...r?[{label:`Mute for this run`,disabled:_||!i,separated:!0,onSelect:()=>void S(`mute`,()=>z.appCommand(`apps.mute`,e.sessionId),`Muted until the agent’s next run.`)}]:[],{label:`Show me now`,disabled:_||!i,separated:!r,onSelect:()=>void C()}]})}),e.trigger===`notes`||A?null:e.screenshotsOff&&!e.shot?(0,K.jsxs)(`div`,{className:`banner inline review-banner`,"data-tone":`neutral`,role:`status`,children:[(0,K.jsx)(`span`,{className:`banner-text`,children:`Turn on agent screenshots to see the app here. Bivy takes them with Chrome on this machine.`}),(0,K.jsx)(`span`,{className:`banner-actions`,children:(0,K.jsx)(`button`,{className:`btn`,disabled:_||!i,onClick:()=>void E(),children:`Turn on`})})]}):(0,K.jsxs)(`div`,{className:`review-stage`,children:[e.expired||b.state===`missing`||!e.shot?(0,K.jsx)(`p`,{className:`review-gone`,children:e.expired||b.state===`missing`?`Screenshot no longer stored`:`No screenshot this time`}):(0,K.jsx)(`button`,{type:`button`,className:`review-shot`,style:e.shot?{aspectRatio:`${e.shot.width} / ${e.shot.height}`,blockSize:`var(--review-shot-height)`,maxInlineSize:`100%`}:void 0,onClick:()=>D(!0),"aria-label":`Open preview of ${e.name} at ${e.path}`,children:b.url?(0,K.jsx)(`img`,{src:b.url,alt:`${e.name} at ${e.path}, ${u===`before`&&y?`before this run`:`now`}`,width:e.shot?.width,height:e.shot?.height}):(0,K.jsxs)(`span`,{className:`review-loading`,children:[(0,K.jsx)(Ct,{size:`sm`}),(0,K.jsx)(`span`,{className:`sr-only`,children:`Loading screenshot…`})]})}),e.before&&!e.expired&&(0,K.jsx)(`div`,{className:`segmented review-side`,role:`radiogroup`,"aria-label":`Show the app`,children:[`before`,`now`].map(e=>(0,K.jsx)(`button`,{type:`button`,role:`radio`,className:`seg-btn`,disabled:!y,"aria-checked":u===e,onClick:()=>f(e),children:e===`before`?`Before`:`Now`},e))})]}),O.length>0&&(0,K.jsx)(`ul`,{className:`review-evidence`,"aria-label":`What changed in the backend`,children:O.map((e,t)=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,className:`review-evidence-row`,onClick:()=>k(e),"aria-label":`${oi[e.backend]}: ${e.summary}${e.detail?`, ${e.detail}`:``}. Open ${e.view}`,children:[(0,K.jsx)(`span`,{className:`review-evidence-kind`,children:O[t-1]?.viewId===e.viewId?``:oi[e.backend]}),(0,K.jsxs)(`span`,{className:`review-evidence-text`,children:[(0,K.jsx)(`span`,{children:e.summary}),e.detail&&(0,K.jsx)(`code`,{children:e.detail})]}),e.tone!==`neutral`&&(0,K.jsx)(`span`,{className:`badge`,"data-tone":e.tone,"aria-hidden":`true`,children:si[e.tone]})]})},`${e.viewId}:${e.item??t}`))}),e.note&&(0,K.jsx)(`p`,{className:`review-note`,children:e.note}),e.try?.length?(0,K.jsxs)(`div`,{className:`review-try`,role:`group`,"aria-label":`Try ${e.name} in a scenario`,children:[(0,K.jsx)(`span`,{className:`review-try-label`,"aria-hidden":`true`,children:`Try it:`}),e.try.map(e=>(0,K.jsx)(`button`,{type:`button`,className:`btn sm`,disabled:!i,onClick:()=>M(e.id),children:e.name},e.id))]}):null,e.notes?(0,K.jsxs)(`div`,{className:`banner inline review-banner`,"data-tone":`neutral`,role:`group`,"aria-label":`Reviewer notes on ${j}`,children:[(0,K.jsxs)(`span`,{className:`banner-text`,children:[e.notes===1?`1 note`:`${e.notes} notes`,` from people with a shared link. They reach the agent only if you send them.`]}),(0,K.jsxs)(`span`,{className:`banner-actions`,children:[(0,K.jsx)(`button`,{className:`btn sm`,disabled:_||!i,onClick:()=>void T(),children:`Add to message`}),(0,K.jsx)(`button`,{className:`btn sm ghost`,disabled:!i,onClick:()=>D(!1),children:`Open in Apps`})]})]}):null,h&&(0,K.jsx)(`p`,{className:`review-status`,role:`status`,children:h}),(0,K.jsx)(`div`,{className:`review-actions`,children:A&&ee?(0,K.jsx)(`button`,{className:`btn primary`,disabled:!i,onClick:()=>k(ee),children:`Review changes`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{className:`btn${e.trigger===`notes`?``:` primary`}`,disabled:!i,onClick:()=>D(!0),children:`Open preview`}),(0,K.jsx)(zr,{sessionId:e.sessionId,appId:e.appId,viewId:e.viewId,name:e.view||e.name,disabled:!i})]})})]})}var ui={open:{label:`Open`,detail:`Nothing has changed here yet.`},changed:{label:`Changed`,tone:`ok`,detail:`A later run changed what you marked. Have a look.`},gone:{label:`Element gone`,tone:`warn`,detail:`What you marked is no longer on the page.`},done:{label:`Done`,tone:`ok`,detail:`You marked this done.`}};function di({pin:e}){let{connection:t}=je(),n=t.status===`online`,r=(0,G.useRef)(null),[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(``);(0,G.useEffect)(()=>{let e=new IntersectionObserver(([t])=>{t?.isIntersecting&&(a(!0),e.disconnect())},{rootMargin:`300px`});return r.current&&e.observe(r.current),()=>e.disconnect()},[]),(0,G.useEffect)(()=>{if(!i||!e.shot)return;let t=!0,n=null;return z.fetchAttachment(e.shot.hash).then(e=>{if(!t)return;if(!e){l(!0);return}let r=Uint8Array.from(atob(e.data),e=>e.charCodeAt(0));n=URL.createObjectURL(new Blob([r],{type:e.mimeType||`image/png`})),s(n)},()=>{t&&l(!0)}),()=>{t=!1,n&&URL.revokeObjectURL(n)}},[i,e.shot?.hash]);let m=ui[e.state],h=async t=>{d(!0),p(``);try{await z.appCommand(`apps.pinState`,e.sessionId,{pinId:e.id,state:t})}catch(e){p(e instanceof Error?e.message:`Could not update this pin.`)}finally{d(!1)}},g=()=>Qr({sessionId:e.sessionId,appId:e.appId,openView:{viewId:e.viewId,path:e.path}});return(0,K.jsxs)(`section`,{ref:r,className:`apps-card review-card pin-card`,"aria-label":`${e.number?`Note ${e.number} p`:`P`}inned on ${e.name}: ${m.label.toLowerCase()}`,children:[(0,K.jsx)(ti,{tile:ei(e.name),name:`${e.name}${e.view&&e.view!==e.name?` · ${e.view}`:``}`,meta:`${e.number?`Note ${e.number} · `:``}Pinned · ${e.path}`,action:(0,K.jsx)(Te,{tone:m.tone,children:m.label})}),e.shot&&!c?(0,K.jsx)(`div`,{className:`review-stage`,children:(0,K.jsx)(`button`,{type:`button`,className:`review-shot`,style:{aspectRatio:`${e.shot.width} / ${e.shot.height}`,blockSize:`var(--review-shot-height)`,maxInlineSize:`100%`},onClick:g,"aria-label":`Open the preview of ${e.name} at ${e.path}`,children:o?(0,K.jsx)(`img`,{src:o,alt:`What you marked on ${e.name} at ${e.path}${e.number?`, note ${e.number}`:``}`,width:e.shot.width,height:e.shot.height}):(0,K.jsxs)(`span`,{className:`review-loading`,children:[(0,K.jsx)(Ct,{size:`sm`}),(0,K.jsx)(`span`,{className:`sr-only`,children:`Loading what you marked…`})]})})}):(0,K.jsx)(`p`,{className:`review-gone`,children:c?`Picture no longer stored`:`Marked without a picture`}),e.words&&(0,K.jsx)(`p`,{className:`review-note`,children:e.words}),(0,K.jsx)(`p`,{className:`review-status`,children:m.detail}),f&&(0,K.jsx)(`p`,{className:`review-status`,role:`alert`,children:f}),(0,K.jsxs)(`div`,{className:`review-actions`,children:[(0,K.jsx)(`button`,{className:`btn primary`,disabled:!n,onClick:g,children:`Open preview`}),e.state===`done`?(0,K.jsx)(`button`,{className:`btn ghost`,disabled:u||!n,onClick:()=>void h(`open`),children:`Reopen`}):(0,K.jsx)(`button`,{className:`btn`,disabled:u||!n,onClick:()=>void h(`done`),children:`Mark done`})]})]})}var fi=e=>`bivy:suggestion:${e}`,pi=()=>window.dispatchEvent(new Event(`bivy:suggestions`));function mi(e){try{return JSON.parse(localStorage.getItem(fi(e))??`null`)}catch{return null}}function hi(e,t){localStorage.setItem(fi(e),JSON.stringify(t)),pi()}var gi=new Set;function _i(e,t){t?gi.delete(e):gi.add(e),pi()}function vi(e,t){let n=e.findIndex(e=>e.suggestion?.id===t);if(n<0)return{run:[],last:!1};let r=n,i=n;for(;r>0&&e[r-1]?.suggestion;)r--;for(;e[i+1]?.suggestion;)i++;return{run:e.slice(r,i+1).map(e=>e.suggestion),last:n===i}}var yi=e=>e.map((e,t)=>`${t+1}. ${e.title?`${e.title}: `:``}${e.text}`).join(`
|
|
4
|
-
|
|
5
|
-
`),bi={here:{label:e=>e>1?`Do ${e} here`:`Do it here`,hint:e=>e>1?`this session’s agent does them one after another.`:`this session’s agent does it next.`,prompt:e=>e.length>1?`Please do these ${e.length} tasks, one after another:\n\n${yi(e)}`:e[0].text,done:`✓ Sent to this session`},subagents:{label:e=>e>1?`Run ${e} as sub-agents`:`Use a sub-agent`,hint:()=>`this session’s agent hands the work to its sub-agents and reports back.`,prompt:e=>e.length>1?`Please do these ${e.length} tasks in parallel, one sub-agent per task, then report back on each:\n\n${yi(e)}`:`Please hand this task to a sub-agent, then report back:\n\n${e[0].text}`,done:`✓ Sent to this session’s sub-agents`},new:{label:e=>e>1?`Start ${e} new sessions`:`Start in new session`,hint:e=>e>1?`each task gets its own agent, running side by side.`:`it gets its own agent, running side by side with this one.`,done:`✓ Started in a new session`}},xi=Object.keys(bi),Si=(e,t)=>e.run??(t?`new`:`here`);function Ci({text:e}){let t=(0,G.useId)(),n=(0,G.useRef)(null),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1);return(0,G.useEffect)(()=>{let e=n.current;if(!e||r)return;let t=()=>o(e.scrollHeight>e.clientHeight);t();let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[e,r]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{ref:n,id:t,className:`suggestion-text`,"data-expanded":r,children:e}),a&&(0,K.jsx)(`div`,{children:(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost-link`,"aria-expanded":r,"aria-controls":t,onClick:()=>i(e=>!e),children:r?`Show less`:`Show more`})})]})}function wi({suggestion:e}){let t=je(),n=t.activeSession.activeSessionId??``,r=t.connection.status===`online`,[i,a]=(0,G.useState)(()=>mi(e.id)),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(null),[,u]=(0,G.useState)(0);(0,G.useEffect)(()=>{let t=()=>{a(mi(e.id)),u(e=>e+1)};return window.addEventListener(`bivy:suggestions`,t),()=>window.removeEventListener(`bivy:suggestions`,t)},[e.id]);let{run:d,last:f}=vi(t.activeSession.transcript,e.id),p=d.length>1,m=d.filter(e=>!mi(e.id)),h=p?m.filter(e=>!gi.has(e.id)):[e],g=e.title||e.text,_=o||!r||!n||h.length===0,v=new Set(h.map(e=>Si(e,p))),y=v.size===1?[...v][0]:`new`,b=[y,...xi.filter(e=>e!==`subagents`||d.some(e=>e.run===`subagents`)).filter(e=>e!==y)],x=async e=>{let t=bi[e].prompt;if(t){z.sendPrompt(t(h));for(let t of h)hi(t.id,{where:e});return}s(!0),l(null);try{for(let e of h){let t=await z.startSessionLike(n,e.text);hi(e.id,{where:`new`,sessionId:t})}}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}},S=p?f&&m.length>0:!i,C=h.length;return(0,K.jsxs)(`section`,{className:`card suggestion-card`,"aria-label":`Suggested task: ${g}`,children:[(0,K.jsx)(`p`,{className:`suggestion-eyebrow`,children:`Suggested task`}),p&&!i?(0,K.jsxs)(`label`,{className:`suggestion-pick`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:!gi.has(e.id),disabled:o,onChange:t=>_i(e.id,t.target.checked)}),(0,K.jsx)(`span`,{className:`suggestion-title`,children:g})]}):(0,K.jsx)(`p`,{className:`suggestion-title`,children:g}),e.title&&(0,K.jsx)(Ci,{text:e.text}),c&&(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:c}),i&&(0,K.jsxs)(`p`,{className:`suggestion-status`,role:`status`,children:[bi[i.where].done,i.where===`new`&&(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost`,onClick:()=>z.openSession(i.sessionId),children:`Open`})]}),S&&(0,K.jsxs)(`div`,{className:p?`suggestion-all`:`suggestion-bar`,children:[p&&(0,K.jsx)(`p`,{className:`suggestion-hint`,role:`status`,children:C===0?`Select the tasks to start.`:`${C} of ${m.length} selected`}),(0,K.jsx)(`div`,{className:`suggestion-actions`,children:b.map(e=>(0,K.jsx)(`button`,{type:`button`,className:`btn sm ${e===y?`primary`:`ghost`}`,disabled:_,onClick:()=>void x(e),children:o&&e===`new`?`Starting…`:bi[e].label(Math.max(C,1))},e))}),(0,K.jsxs)(`p`,{className:`suggestion-hint`,children:[`Recommended: `,bi[y].hint(C)]})]})]})}function Ti({notice:e}){return(0,K.jsxs)(`section`,{className:`card notice-card`,"data-tone":e.urgent?`warn`:`accent`,"aria-label":e.urgent?`Urgent message from the agent`:`Message from the agent`,children:[(0,K.jsxs)(`p`,{className:`notice-eyebrow`,children:[`Message for you`,e.urgent&&(0,K.jsx)(Te,{tone:`warn`,variant:`soft`,children:`Urgent`})]}),(0,K.jsx)(`p`,{className:`notice-text`,children:e.text})]})}var Ei={pending:{label:`Queued`,tone:`accent`},claimed:{label:`Starting`,tone:`accent`},running:{label:`Working`,tone:`accent`},waiting:{label:`Waiting`,tone:`accent`},needs_attention:{label:`Needs attention`,tone:`warn`},succeeded:{label:`Done`,tone:`ok`},failed:{label:`Failed`,tone:`danger`},cancelled:{label:`Cancelled`}};function Di(e){let t=je(),n=e.agent?t.catalogs.runtimes.find(t=>t.id===e.agent)?.displayName||e.agent:`Default agent`;return{agent:n,label:e.machine?`${n} @ ${e.machine}`:n}}function Oi({status:e}){let t=Ei[e]??{label:e};return(0,K.jsx)(`span`,{className:`badge`,"data-tone":t.tone,children:t.label})}function ki({card:e,target:t,compact:n}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`delegation-head`,children:[(0,K.jsxs)(`span`,{className:`delegation-target`,children:[t.agent,e.machine&&(0,K.jsxs)(`span`,{className:`delegation-machine`,children:[`on `,e.machine]})]}),(0,K.jsx)(Oi,{status:e.status})]}),!n&&(0,K.jsx)(`p`,{className:`delegation-task`,children:e.task}),e.failure&&(0,K.jsx)(`p`,{className:`delegation-failure`,children:e.failure}),e.answer&&(0,K.jsxs)(`details`,{className:`delegation-answer`,open:n,children:[(0,K.jsx)(`summary`,{children:`Answer`}),(0,K.jsx)(`p`,{children:e.answer})]}),(e.branch||e.prUrl)&&(0,K.jsxs)(`p`,{className:`delegation-refs`,children:[e.branch&&(0,K.jsx)(`code`,{children:e.branch}),e.prUrl&&(0,K.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noreferrer`,children:`Pull request`})]}),e.childSessionId&&(0,K.jsx)(`div`,{className:`delegation-actions`,children:(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost`,onClick:()=>e.childSessionId&&z.openSessionOnNode(e.childSessionId,void 0,e.nodeId),children:`Open session`})})]})}function Ai({card:e}){let t=Di(e),n=e.status===`succeeded`;return(0,K.jsxs)(`section`,{className:`card delegation-member`,"aria-label":`${t.label}: ${Ei[e.status]?.label??e.status}`,children:[(0,K.jsx)(ki,{card:e,target:t,compact:!0}),n&&(0,K.jsx)(`button`,{type:`button`,className:`btn sm primary`,onClick:()=>z.sendPrompt(`Go with ${t.label}'s result (delegated run ${e.id})${e.branch?`. Its work is on branch \`${e.branch}\`: fetch it and merge it into the current branch`:``}.`),children:`Use this`})]})}function ji({delegation:e}){let t=je(),n=Di(e);if(e.group){let n=t.activeSession.transcript.flatMap(t=>t.delegation&&t.delegation.group===e.group?[t.delegation]:[]);if(n[0]?.id!==e.id)return null;let r=n.filter(e=>[`succeeded`,`failed`,`cancelled`].includes(e.status)).length;return(0,K.jsxs)(`section`,{className:`delegation-group`,"aria-label":`Compared across ${n.length} agents`,children:[(0,K.jsxs)(`p`,{className:`delegation-eyebrow`,children:[`Compared across `,n.length,` agents · `,r,`/`,n.length,` finished`]}),(0,K.jsx)(`p`,{className:`delegation-task`,children:e.task}),(0,K.jsx)(`div`,{className:`delegation-grid`,children:n.map(e=>(0,K.jsx)(Ai,{card:e},e.id))})]})}return(0,K.jsxs)(`section`,{className:`card delegation-card`,"aria-label":`Delegated to ${n.label}`,children:[(0,K.jsx)(`p`,{className:`delegation-eyebrow`,children:`Delegated`}),(0,K.jsx)(ki,{card:e,target:n})]})}function Mi(e){let t=new Map(e.map(e=>[e.callId,e])),n=new Map,r=e=>!!(e.parentToolUseId&&e.parentToolUseId!==e.callId&&t.has(e.parentToolUseId));for(let t of e)if(r(t)){let e=n.get(t.parentToolUseId)??[];e.push(t),n.set(t.parentToolUseId,e)}let i=[],a=new Set,o=(e,t)=>{if(!a.has(e.callId)){a.add(e.callId),i.push({tool:e,depth:t});for(let r of n.get(e.callId)??[])o(r,t+1)}};for(let t of e)r(t)||o(t,0);for(let t of e)a.has(t.callId)||o(t,0);return i}function Ni(e,t){let n=new Map;for(let e of t){let t=e.parentToolUseId;if(!t||t===e.callId)continue;let r=n.get(t)??[];r.push(e),n.set(t,r)}let r=new Set([e]),i=[...n.get(e)??[]],a=0;for(;i.length;){let e=i.pop();if(!r.has(e.callId)){r.add(e.callId),a+=1;for(let t of n.get(e.callId)??[])i.push(t)}}return a}function Pi({glyph:e}){let t={width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`};switch(e){case`terminal`:return(0,K.jsxs)(`svg`,{...t,children:[(0,K.jsx)(`polyline`,{points:`4 17 10 11 4 5`}),(0,K.jsx)(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`})]});case`pencil`:case`create`:return(0,K.jsxs)(`svg`,{...t,children:[(0,K.jsx)(`path`,{d:`M12 20h9`}),(0,K.jsx)(`path`,{d:`M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z`})]});case`search`:return(0,K.jsxs)(`svg`,{...t,children:[(0,K.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,K.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]});case`list`:return(0,K.jsxs)(`svg`,{...t,children:[(0,K.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,K.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,K.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,K.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`}),(0,K.jsx)(`line`,{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`}),(0,K.jsx)(`line`,{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`})]});case`globe`:return(0,K.jsxs)(`svg`,{...t,children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,K.jsx)(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),(0,K.jsx)(`path`,{d:`M12 3a15 15 0 0 1 0 18a15 15 0 0 1 0-18Z`})]});case`agent`:return(0,K.jsxs)(`svg`,{...t,children:[(0,K.jsx)(`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`}),(0,K.jsx)(`circle`,{cx:`9`,cy:`7`,r:`4`}),(0,K.jsx)(`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`}),(0,K.jsx)(`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`})]});default:return(0,K.jsxs)(`svg`,{...t,children:[(0,K.jsx)(`path`,{d:`M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}}function Fi({added:e,removed:t}){return!e&&!t?null:(0,K.jsxs)(`span`,{className:`tool-stat`,children:[e>0&&(0,K.jsxs)(`span`,{className:`add`,children:[`+`,e]}),t>0&&(0,K.jsxs)(`span`,{className:`del`,children:[`−`,t]})]})}function Ii(e){if(e.detail?.kind!==`delegation`)return``;let t=Number(e.input?.elapsedSeconds);return!Number.isFinite(t)||t<1?``:t<60?`${Math.floor(t)}s`:`${Math.floor(t/60)}m ${Math.floor(t%60)}s`}function Li({tool:e,f:t,depth:n=0,onSelect:r}){let i=Ii(e),a=pt(t),o=i?`${a||`Sub-agent`} · ${i}`:a,s=e.status===`running`,c=n>1?{paddingLeft:`${28+(n-1)*16}px`}:void 0;return(0,K.jsx)(`div`,{className:`activity${s?` is-running`:``}${t.isError?` is-error`:``}${n>0?` is-subagent-step`:``}`,"data-depth":n||void 0,children:(0,K.jsxs)(`button`,{className:`activity-row`,style:c,onClick:()=>r(e.callId),children:[(0,K.jsx)(`span`,{className:`activity-ic`,children:(0,K.jsx)(Pi,{glyph:t.glyph})}),(0,K.jsx)(`span`,{className:`activity-verb`,children:t.verb}),(0,K.jsx)(`span`,{className:`activity-desc`,children:o}),t.isError&&(0,K.jsx)(Te,{tone:`danger`,variant:`soft`,upper:!0,title:typeof t.exitCode==`number`?`exit ${t.exitCode}`:`failed`,children:`Failed`}),(0,K.jsx)(Fi,{added:t.added,removed:t.removed}),(0,K.jsx)(`span`,{className:`tool-chevron`,children:(0,K.jsx)($e,{size:14})})]})})}function Ri({tool:e,f:t,subSteps:n=0}){let r=e.result||t.output||``,i=r&&(t.diffs.length===0||t.command||t.verb===`Agent output`),a=Ii(e);return(0,K.jsxs)(`div`,{className:`activity-detail`,children:[e.detail?.kind===`delegation`&&e.status===`running`&&(0,K.jsxs)(`div`,{className:`tool-detail-block`,children:[(0,K.jsx)(`div`,{className:`tool-detail-label`,children:`Status`}),(0,K.jsxs)(`div`,{className:`tool-detail-value`,children:[`Sub-agent active`,a?` · ${a} elapsed`:``]})]}),e.detail?.kind===`delegation`&&n>0&&(0,K.jsxs)(`div`,{className:`tool-detail-block`,children:[(0,K.jsx)(`div`,{className:`tool-detail-label`,children:`Sub-agent work`}),(0,K.jsxs)(`div`,{className:`tool-detail-value`,children:[n,` step`,n===1?``:`s`,` nested below this delegation`]})]}),(t.isError||t.truncated)&&(0,K.jsxs)(`div`,{className:`tool-detail-block`,children:[(0,K.jsx)(`div`,{className:`tool-detail-label`,children:`Outcome`}),(0,K.jsxs)(`div`,{className:`tool-detail-value${t.isError?` is-error`:``}`,children:[t.isError?`Failed`:`Completed`,typeof t.exitCode==`number`?` · exit ${t.exitCode}`:``,t.truncated?` · output truncated`:``]})]}),t.path&&(0,K.jsxs)(`div`,{className:`tool-detail-block`,children:[(0,K.jsx)(`div`,{className:`tool-detail-label`,children:`File`}),(0,K.jsx)(`div`,{className:`tool-detail-value`,children:t.path})]}),t.command&&(0,K.jsxs)(`div`,{className:`tool-detail-block`,children:[(0,K.jsx)(`div`,{className:`tool-detail-label`,children:`Command`}),(0,K.jsx)(`div`,{className:`tool-detail-value`,children:t.command})]}),t.query&&(0,K.jsxs)(`div`,{className:`tool-detail-block`,children:[(0,K.jsx)(`div`,{className:`tool-detail-label`,children:`Query`}),(0,K.jsx)(`div`,{className:`tool-detail-value`,children:t.query})]}),t.diffs.length>0&&(0,K.jsxs)(`div`,{className:`tool-detail-block`,children:[(0,K.jsx)(`div`,{className:`tool-detail-label`,children:`Diff`}),(0,K.jsx)(St,{hunks:t.diffs,single:t.path})]}),t.diffs.length===0&&t.edits?(0,K.jsx)(`div`,{className:`tool-detail-block`,children:(0,K.jsxs)(`div`,{className:`tool-detail-value output`,children:[t.edits,` targeted edits`]})}):null,i&&(0,K.jsxs)(`div`,{className:`tool-detail-block`,children:[(0,K.jsx)(`div`,{className:`tool-detail-label`,children:e.status===`running`?`Live output`:`Output`}),(0,K.jsx)(`div`,{className:`tool-detail-value output`,dangerouslySetInnerHTML:{__html:re(r)}})]}),!t.path&&!t.command&&!t.query&&!t.diffs.length&&!i&&(0,K.jsx)(`div`,{className:`tool-detail-value output`,children:e.status===`running`?`Still working. Details will appear here when the agent streams them.`:`No further details.`})]})}function zi(e){let t=bt(e.name,e.input,e.detail,{diffStats:!1});if(t.verb===`Agent output`)return`Reading agent output…`;if(e.detail?.kind===`delegation`){let t=e.detail.label?`${e.detail.label} sub-agent`:`Sub-agent`,n=Ii(e);return`${t} working${n?` · ${n}`:``}…`}let n=pt(t);return t.command?`Running ${n||`command`}…`:n?`${t.verb} ${n}…`:`Agent is working…`}function Bi({tools:e,summary:t,onClose:n}){let[r,i]=(0,G.useState)(null),a=r?e.find(e=>e.callId===r):void 0,o=a?bt(a.name,a.input,a.detail):void 0,s=a?Ni(a.callId,e):0,c=(0,G.useRef)(null);return(0,G.useEffect)(()=>{c.current?.closest(`.sheet-content`)?.scrollTo(0,0)},[r]),(0,K.jsx)(ot,{title:a&&o?o.title:t,onClose:n,headExtra:a?(0,K.jsx)(`button`,{className:`sheet-back`,onClick:()=>i(null),"aria-label":`Back`,children:`‹`}):void 0,children:(0,K.jsx)(`div`,{ref:c,children:a&&o?(0,K.jsx)(Ri,{tool:a,f:o,subSteps:s}):e.length?Mi(e).map(({tool:e,depth:t})=>(0,K.jsx)(Li,{tool:e,depth:t,f:bt(e.name,e.input,e.detail),onSelect:i},e.callId)):(0,K.jsx)(`div`,{className:`tool-detail-value output`,children:`No tool activity.`})})})}var Vi=(0,G.memo)(function({tools:e}){let[t,n]=(0,G.useState)(!1),r=(0,G.useCallback)(()=>n(!1),[]),i=e.some(e=>e.status===`running`),a=e.some(e=>gt(e.detail)),o=e.filter(e=>e.status===`running`&&e.detail?.kind===`delegation`),s=o.length>1?`${o.length} sub-agents working…`:o.length===1?zi(o[0]):i&&e.every(e=>e.status===`running`)&&e.length===1?zi(e[0]):_t(e),c=i?`Working`:`Worked`,l=s,u=`${i?`Work in progress`:`Work log`} · ${e.length} action${e.length===1?``:`s`}`;return(0,K.jsxs)(`div`,{className:`tool-group`,children:[(0,K.jsxs)(`button`,{className:`tool-group-line${i?` is-running`:``}${a?` is-error`:``}`,onClick:()=>n(!0),"aria-label":`${c}: ${l}. Open work details`,children:[(0,K.jsx)(`span`,{className:`tool-group-state`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`tool-group-label`,children:c}),(0,K.jsx)(`span`,{className:`tool-group-summary`,children:l}),(0,K.jsx)(`span`,{className:`tool-chevron`,children:(0,K.jsx)($e,{size:14})})]}),t&&(0,K.jsx)(Bi,{tools:e,summary:u,onClose:r})]})},(e,t)=>e.tools.length===t.tools.length&&e.tools.every((e,n)=>e===t.tools[n])),Hi={completed:`Done`,in_progress:`In progress`,pending:`To do`,cancelled:`Cancelled`},Ui=(0,G.memo)(function({plan:e}){let t=e.filter(e=>e.status===`completed`||e.status===`cancelled`).length,n=e.filter(e=>e.status===`completed`).length,r=e.find(e=>e.status===`in_progress`),[i,a]=(0,G.useState)(null),o=i??t<e.length,s=`${n} of ${e.length} done${r&&!o?` · ${r.text}`:``}`;return(0,K.jsxs)(`div`,{className:`tool-group plan-card`,children:[(0,K.jsxs)(`button`,{className:`tool-group-line`,onClick:()=>a(!o),"aria-expanded":o,children:[(0,K.jsx)(`span`,{className:`tool-group-label`,children:`Plan`}),(0,K.jsx)(`span`,{className:`tool-group-summary`,children:s}),(0,K.jsx)(`span`,{className:`tool-chevron plan-chevron`,children:(0,K.jsx)($e,{size:14})})]}),o&&(0,K.jsx)(`ol`,{className:`plan-steps`,children:e.map((e,t)=>(0,K.jsxs)(`li`,{className:`plan-step is-${e.status}`,children:[(0,K.jsx)(`span`,{className:`plan-mark`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`plan-text`,children:e.text}),(0,K.jsxs)(`span`,{className:`sr-only`,children:[`, `,Hi[e.status]]})]},e.id??t))})]})});function Wi(e){let t=z.store.getState().catalogs.runtimes.find(t=>t.id===e);return String(t?.displayName||t?.name||e)}function Gi(){let{activeSession:{activeSessionId:e},sessionIndex:{sessions:t}}=je(),n=t.find(t=>t.sessionId===e)?.forkedFrom,r=n?t.find(e=>e.sessionId===n):void 0;if(r)return{sessionId:r.sessionId,name:r.name||`Session ${r.sessionId.slice(0,8)}`,nodeId:r.nodeId}}var Ki=(0,G.memo)(function({seed:e,text:t}){let[n,r]=(0,G.useState)(!1),i=(0,G.useCallback)(()=>r(!1),[]),a=Gi(),o=e.kind===`fork`?`Handed over`:`Imported`,s=`from ${Wi(e.from)}`,c=`${o} ${s}. Show what was sent`;return(0,K.jsxs)(`div`,{className:`tool-group handoff-line`,children:[(0,K.jsxs)(`button`,{className:`tool-group-line`,onClick:()=>r(!0),"aria-label":c,children:[(0,K.jsx)(`span`,{className:`tool-group-label`,children:o}),(0,K.jsx)(`span`,{className:`tool-group-summary`,children:s})]}),e.kind===`fork`&&a&&(0,K.jsx)(`button`,{type:`button`,className:`handoff-source`,onClick:()=>z.openSessionOnNode(a.sessionId,void 0,a.nodeId),"aria-label":`Open the original session: ${a.name}`,children:a.name}),(0,K.jsx)(`button`,{className:`tool-group-line handoff-open`,onClick:()=>r(!0),tabIndex:-1,"aria-hidden":`true`,children:(0,K.jsx)(`span`,{className:`tool-chevron`,children:(0,K.jsx)($e,{size:14})})}),n&&(0,K.jsx)(ot,{title:`Context sent to the agent`,onClose:i,children:(0,K.jsx)(`div`,{className:`tool-detail-value output handoff-seed-text`,children:t})})]})});function qi(e,t){let n=[],r=null,i=null,a=[],o=[],s=()=>{let e=i??r;if(e){if(a.length===0)n.push(e);else{let t=new Set,r=a.filter(e=>{let n=e.hash||`${e.kind}:${e.name}:${e.size}`;return!t.has(n)&&(t.add(n),!0)});n.push({...e,attachments:r})}}n.push(...o.filter(t=>t.id!==e?.id)),r=null,i=null,a=[],o=[]};for(let t of e)if(!(t.tool||t.role===`thinking`)){if(t.role===`assistant`){r=t,(t.app||t.review||t.suggestion||t.notice)&&o.push(t),(t.text||t.streaming)&&(i=t),t.attachments?.length&&a.push(...t.attachments);continue}s(),n.push(t)}if(s(),!t)return n;let c=n.findLastIndex(e=>e.role===`user`);return n.flatMap((e,t)=>e.role===`assistant`&&(c<0||t>c)?e.app||e.review||e.suggestion||e.notice||e.attachments?.length?[{...e,text:``,html:void 0,streaming:!1}]:[]:[e])}var Ji=3e4,Yi=null;function Xi(e,t){Yi={sessionId:e,target:t,at:Date.now()}}var q=(e,t)=>`hash`in t?!!e.attachments?.some(e=>e.hash===t.hash):`reviewId`in t?e.review?.id===t.reviewId:e.app?.appId===t.appId;function Zi(e,t){if(!Yi||Yi.sessionId!==e)return null;if(Date.now()-Yi.at>Ji)return Yi=null,null;let{target:n}=Yi,r=t.findLastIndex(e=>q(e,n));return r>=0?r:null}function Qi(){Yi=null}var $i=null;function ea(e){return Array.from(e.classList).some(e=>e.toLowerCase()===`language-mermaid`)}var ta=`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>`,na=`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden><polyline points="20 6 9 17 4 12"/></svg>`;function ra(e){if(!e)return;let t=Array.from(e.querySelectorAll(`pre`)).filter(e=>{let t=e.querySelector(`code`);return t&&!ea(t)&&!e.parentElement?.classList.contains(`code-block-wrap`)});for(let e of t){let t=document.createElement(`div`);t.className=`code-block-wrap`,e.parentNode?.insertBefore(t,e),t.appendChild(e);let n=document.createElement(`button`);n.type=`button`,n.className=`code-copy-btn`,n.title=`Copy code`,n.setAttribute(`aria-label`,`Copy code`),n.innerHTML=ta;let r=null;n.addEventListener(`click`,()=>{let t=e.querySelector(`code`)?.textContent??``;nt(t).then(e=>{e&&(n.classList.add(`copied`),n.innerHTML=na,r&&clearTimeout(r),r=setTimeout(()=>{n.classList.remove(`copied`),n.innerHTML=ta},1200))})}),t.appendChild(n)}}function ia(e){if(!e)return;let t=Array.from(e.querySelectorAll(`pre code`)).filter(e=>!ea(e)&&e.dataset.highlighted!==`yes`);t.length!==0&&($i??=C(()=>import(`./common-DvIV9UK2.js`).then(e=>e.default),__vite__mapDeps([0,1])),$i.then(e=>{for(let n of t){if(!n.isConnected||n.dataset.highlighted===`yes`)continue;let t=Array.from(n.classList).find(e=>e.startsWith(`language-`))?.slice(9);t&&!e.getLanguage(t)&&n.classList.remove(`language-${t}`),e.highlightElement(n)}}))}var aa=null,oa=Promise.resolve(),sa=0;function ca(){return aa??=C(async()=>{let{default:e}=await import(`./mermaid.core-Danc2DP_.js`);return{default:e}},__vite__mapDeps([2,3,4,5,6,1,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,suppressErrorRendering:!0,theme:`base`,fontFamily:`inherit`}),e)),aa}function la(e){return e instanceof HTMLElement&&Array.from(e.classList).some(e=>e.toLowerCase()===`language-mermaid`)}function ua(e){if(!e)return;let t=Array.from(e.querySelectorAll(`pre > code`)).filter(la);for(let n of t){let t=n.parentElement;if(!t||t.dataset.mermaidState)continue;t.dataset.mermaidState=`queued`;let r=n.textContent??``;oa=oa.then(async()=>{if(t.isConnected&&e.contains(t))try{let n=await ca();if(!t.isConnected||!e.contains(t))return;let i=`bivy-mermaid-${++sa}`,{svg:a,bindFunctions:o}=await n.render(i,r);if(!t.isConnected||!e.contains(t))return;let s=document.createElement(`div`);s.className=`mermaid-diagram`,s.setAttribute(`role`,`img`),s.setAttribute(`aria-label`,`Mermaid diagram`),s.innerHTML=a,t.replaceWith(s),o?.(s)}catch{t.dataset.mermaidState=`error`,t.title=`This Mermaid diagram could not be rendered`}})}}var da=`bivy.speech.preferences.v1`,fa={reader:`browser`,browserVoice:``,rate:1,openaiVoice:`coral`,tone:`natural`},pa=[`alloy`,`ash`,`ballad`,`coral`,`echo`,`fable`,`nova`,`onyx`,`sage`,`shimmer`,`verse`],ma=[{id:`natural`,label:`Natural`,instructions:`Speak naturally and conversationally, with clear phrasing and subtle expression.`},{id:`calm`,label:`Calm`,instructions:`Speak calmly and evenly at a relaxed pace, with a reassuring tone.`},{id:`warm`,label:`Warm`,instructions:`Speak with a warm, friendly, empathetic tone.`},{id:`energetic`,label:`Energetic`,instructions:`Speak with upbeat energy and engaging emphasis, without sounding exaggerated.`},{id:`professional`,label:`Professional`,instructions:`Speak clearly and confidently in a polished, professional tone.`}];function ha(){try{let e=JSON.parse(localStorage.getItem(da)||`{}`);return{reader:e.reader===`openai`?`openai`:`browser`,browserVoice:typeof e.browserVoice==`string`?e.browserVoice:``,rate:typeof e.rate==`number`&&e.rate>=.7&&e.rate<=1.5?e.rate:1,openaiVoice:pa.includes(e.openaiVoice||``)?e.openaiVoice:fa.openaiVoice,tone:ma.some(t=>t.id===e.tone)?e.tone:fa.tone}}catch{return{...fa}}}function ga(e){localStorage.setItem(da,JSON.stringify(e))}function _a(e){return ma.find(t=>t.id===e)?.instructions??`Speak naturally and conversationally.`}function va(){return typeof window<`u`&&`speechSynthesis`in window&&typeof SpeechSynthesisUtterance<`u`}function ya(){return typeof window<`u`&&(va()||typeof Audio<`u`)}function ba(e){return e.replace(/```[\s\S]*?```/g,` `).replace(/`([^`]+)`/g,`$1`).replace(/!\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/^\s{0,3}#{1,6}\s+/gm,``).replace(/^\s{0,3}>\s?/gm,``).replace(/^\s{0,3}([-*+]|\d+\.)\s+/gm,``).replace(/^\s{0,3}([-*_])\s*\1\s*\1[\s\S]*?$/gm,``).replace(/(\*\*|__)(.*?)\1/g,`$2`).replace(/(\*|_)(.*?)\1/g,`$2`).replace(/~~(.*?)~~/g,`$2`).replace(/\|/g,` `).replace(/[ \t]+/g,` `).replace(/\n{2,}/g,`
|
|
6
|
-
`).trim()}function xa(e,t,n){return{distanceFromBottom:Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight),pinned:t,limit:n}}function Sa(e,t){return!t||t.pinned?e.scrollHeight:Math.max(0,e.scrollHeight-e.clientHeight-t.distanceFromBottom)}function Ca(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function wa(e,t){try{let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return URL.createObjectURL(new Blob([r],{type:t||`application/octet-stream`}))}catch{return null}}function Ta(e){let t=(0,G.useMemo)(()=>{if(!e||e.omitted)return null;if(e.data)return wa(e.data,e.mimeType);if(e.text!==void 0)try{return URL.createObjectURL(new Blob([e.text],{type:e.mimeType||`text/plain`}))}catch{return null}return null},[e]);(0,G.useEffect)(()=>()=>{t&&URL.revokeObjectURL(t)},[t]);let[n,r]=(0,G.useState)(null);return(0,G.useEffect)(()=>{if(r(null),t||!e||e.omitted||!e.hash)return;let n=e.mimeType,i=!1,a=null;return z.fetchAttachment(e.hash,e.createdAt).then(e=>{!i&&e&&(a=wa(e.data,e.mimeType||n),a&&r(a))}),()=>{i=!0,a&&URL.revokeObjectURL(a)}},[t,e]),t??n}function Ea({attachment:e,onOpenImage:t}){let n=Ta(e);return(0,K.jsxs)(`div`,{className:`msg-attachment`,children:[e.kind===`image`&&n&&(0,K.jsx)(`a`,{className:`attach-preview`,href:n,target:`_blank`,rel:`noopener`,title:e.name,onClick:t?e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0||(e.preventDefault(),t())}:void 0,children:(0,K.jsx)(`img`,{src:n,alt:e.description||e.name})}),(0,K.jsxs)(`div`,{className:`attach-details`,children:[(0,K.jsxs)(`div`,{className:`attach-copy`,children:[(0,K.jsx)(`div`,{className:`attach-name`,children:e.name}),(0,K.jsx)(`div`,{className:`attach-description`,children:e.description||`${e.mimeType||(e.kind===`image`?`Image`:`File`)} · ${Ca(e.size)}`})]}),n?(0,K.jsx)(`a`,{className:`btn icon attach-download`,href:n,download:e.name,"aria-label":`Download ${e.name}`,title:`Download ${e.name}`,children:(0,K.jsx)(Da,{})}):(0,K.jsx)(`button`,{className:`btn icon attach-download`,disabled:!0,"aria-label":`Download ${e.name} unavailable`,title:`Content unavailable or still loading`,children:(0,K.jsx)(Da,{})})]})]})}function Da(){return(0,K.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M12 3v12m-5-5 5 5 5-5M4 15v5h16v-5`})})}function Oa({attachments:e}){let t=(0,G.useMemo)(()=>e.filter(e=>e.kind===`image`&&!e.omitted),[e]),[n,r]=(0,G.useState)(null);return(0,K.jsxs)(`div`,{className:`msg-attachments`,children:[e.map((e,n)=>{let i=t.indexOf(e);return(0,K.jsx)(Ea,{attachment:e,onOpenImage:i>=0?()=>r(i):void 0},`${e.name}-${n}`)}),n!==null&&(0,K.jsx)(Ja,{images:t,index:n,onClose:()=>r(null)})]})}function ka(e){return e===`/new`?`New session`:e===`/resume`?`Resume`:e===`fork`?`Fork to another agent`:e===`cancel-resume`?`Cancel auto-retry`:e===`fix-auth`||e.startsWith(`fix-auth:`)?`Fix sign-in`:e===`retry-auth`?`Refresh and retry`:e.startsWith(`connect-provider:`)?`Connect a provider`:e.startsWith(`retry-at-reset:`)?`Retry automatically at ${Aa(e.slice(15))}`:`Run ${e}`}function Aa(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return`reset`;let n=t.toDateString()===new Date().toDateString();return t.toLocaleString(void 0,n?{hour:`numeric`,minute:`2-digit`}:{weekday:`short`,hour:`numeric`,minute:`2-digit`})}function ja({actions:e,onAction:t,size:n}){return!e?.length||!t?null:(0,K.jsx)(`div`,{className:`entry-actions`,children:e.map((e,r)=>(0,K.jsx)(`button`,{type:`button`,className:[`btn`,n,r===0?`primary`:``].filter(Boolean).join(` `),onClick:()=>t(e),children:ka(e)},e))})}function Ma(){return(0,K.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,K.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),(0,K.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]})}function Na(){return(0,K.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:(0,K.jsx)(`polyline`,{points:`20 6 9 17 4 12`})})}function Pa({text:e}){let[t,n]=(0,G.useState)(!1),r=(0,G.useCallback)(()=>{nt(e).then(e=>{e&&(n(!0),setTimeout(()=>n(!1),1200))})},[e]);return(0,K.jsx)(`button`,{type:`button`,className:`msg-copy-btn${t?` copied`:``}`,onClick:r,title:t?`Copied`:`Copy message`,"aria-label":`Copy message`,children:t?(0,K.jsx)(Na,{}):(0,K.jsx)(Ma,{})})}function Fa(){return(0,K.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,K.jsx)(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),(0,K.jsx)(`path`,{d:`M15.54 8.46a5 5 0 0 1 0 7.07`}),(0,K.jsx)(`path`,{d:`M19.07 4.93a10 10 0 0 1 0 14.14`})]})}function Ia(){return(0,K.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:(0,K.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`1.5`})})}var La=null;function Ra({text:e}){let[t,n]=(0,G.useState)(!1),r=(0,G.useRef)(null),i=(0,G.useRef)(null),a=(0,G.useRef)(0),o=(0,G.useCallback)(()=>{a.current+=1;let e=r.current;e&&(e.onend=null,e.onerror=null,r.current=null),window.speechSynthesis.cancel();let t=i.current;t&&(t.audio.pause(),URL.revokeObjectURL(t.url),i.current=null),n(!1),La===o&&(La=null)},[]);(0,G.useEffect)(()=>o,[o]);let s=(0,G.useCallback)(async()=>{if(t){o();return}let s=ba(e);if(!s)return;La?.(),La=o,n(!0);let c=ha();if(c.reader===`openai`){let e=++a.current;try{let t=await z.synthesize(s,c.openaiVoice,_a(c.tone));if(a.current!==e)return;let n=wa(t.audio,t.mimeType);if(!n)throw Error(`The generated speech audio was invalid.`);let r=new Audio(n);i.current={audio:r,url:n},r.onended=o,r.onerror=()=>{z.store.setError(`Could not play the generated speech.`),o()},await r.play()}catch(t){a.current===e&&(z.store.setError(t instanceof Error?t.message:String(t)),o())}return}if(!va()){z.store.setError(`Browser speech is not supported on this device. Choose OpenAI under Settings → Voice.`),o();return}let l=window.speechSynthesis;l.cancel();let u=new SpeechSynthesisUtterance(s);u.rate=c.rate,c.browserVoice&&(u.voice=l.getVoices().find(e=>e.voiceURI===c.browserVoice||e.name===c.browserVoice)??null);let d=()=>{r.current===u&&o()};u.onend=d,u.onerror=d,r.current=u,l.speak(u)},[t,o,e]);return(0,K.jsx)(`button`,{type:`button`,className:`msg-speak-btn${t?` speaking`:``}`,onClick:s,title:t?`Stop`:`Read aloud`,"aria-label":t?`Stop reading`:`Read message aloud`,children:t?(0,K.jsx)(Ia,{}):(0,K.jsx)(Fa,{})})}var za=(0,G.memo)(function({entry:e,onAction:t,authAction:n}){let r=(0,G.useMemo)(()=>e.role===`assistant`&&!e.streaming?e.html??re(e.text):``,[e.role,e.streaming,e.html,e.text]),i=(0,G.useRef)(null);if((0,G.useEffect)(()=>{if(e.role!==`assistant`)return;ua(i.current),ia(i.current),ra(i.current);let t=i.current;if(!t||!e.imageRefs)return;let n=!1,r=[];return t.querySelectorAll(`img.md-image[data-remote-src]`).forEach(t=>{let i=t.dataset.remoteSrc;if(!i||t.dataset.hydrated===`1`)return;let a=e.imageRefs?.[i];a&&(t.dataset.hydrated=`1`,z.fetchAttachment(a.hash).then(e=>{if(n||!e)return;let i=wa(e.data,e.mimeType||a.mimeType);i&&(t.src=i,r.push(i))}))}),()=>{n=!0,r.forEach(e=>URL.revokeObjectURL(e))}},[e.role,r,e.imageRefs]),e.role===`system`)return(0,K.jsxs)(`div`,{className:`msg system`,children:[(0,K.jsx)(`span`,{className:`system-text`,dangerouslySetInnerHTML:{__html:re(e.text)}}),(0,K.jsx)(ja,{actions:e.actions,onAction:t,size:`sm`})]});if(e.role===`thinking`)return(0,K.jsx)(`div`,{className:`msg thinking${e.streaming?` streaming`:``}`,children:e.text});if(e.role===`error`){let[r=`The agent hit an error`,...i]=e.text.split(`
|
|
7
|
-
`),a=i.join(`
|
|
8
|
-
`).trim(),o=e.actions?.length?e.actions:n&&te(e.text)?[n,`retry-auth`]:void 0;return(0,K.jsxs)(`div`,{className:`card`,"data-tone":`danger`,role:`alert`,children:[(0,K.jsx)(`strong`,{children:r}),(0,K.jsx)(ja,{actions:o,onAction:t}),a&&(0,K.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,K.jsx)(`summary`,{className:`settings-disclosure-summary`,children:`Details`}),(0,K.jsx)(`pre`,{className:`settings-disclosure-body`,children:a})]})]})}if(e.role===`user`){let t=Rt(e.text);if(t)return(0,K.jsx)(Ki,{seed:t,text:e.text});let n=!!e.attachments&&e.attachments.length>0,r=n?E(e.text):e.text;return(0,K.jsxs)(`div`,{className:`msg user`,id:n?`msg-${e.id}`:void 0,children:[n&&(0,K.jsx)(Oa,{attachments:e.attachments}),r]})}if(e.streaming)return(0,K.jsx)(`div`,{className:`assistant-row`,children:(0,K.jsx)(`div`,{ref:i,className:`msg assistant streaming streaming-text`,children:e.text})});let a=!!e.attachments&&e.attachments.length>0,o=e.attachments?.length===1&&e.attachments[0]?.description===e.text;return(0,K.jsxs)(`div`,{className:`assistant-row`,id:a||e.app||e.review||e.pin||e.suggestion||e.notice||e.delegation?`msg-${e.id}`:void 0,children:[e.app&&(0,K.jsx)(ni,{app:e.app}),e.review&&(0,K.jsx)(li,{review:e.review}),e.pin&&(0,K.jsx)(di,{pin:e.pin}),e.notice&&(0,K.jsx)(Ti,{notice:e.notice}),e.delegation&&(0,K.jsx)(ji,{delegation:e.delegation}),a&&(0,K.jsx)(Oa,{attachments:e.attachments}),(e.text&&!o||!a&&!e.app&&!e.review&&!e.pin&&!e.suggestion&&!e.notice&&!e.delegation)&&(0,K.jsx)(`div`,{ref:i,className:`msg assistant`,dangerouslySetInnerHTML:{__html:r}}),e.text&&!o&&(0,K.jsxs)(`div`,{className:`msg-actions`,children:[(0,K.jsx)(Pa,{text:e.text}),ya()&&(0,K.jsx)(Ra,{text:e.text})]}),e.suggestion&&(0,K.jsx)(wi,{suggestion:e.suggestion})]})});function Ba(e){let t=[],n=null;for(let r of e){if(r.kind===`entry`&&r.entry.role===`user`){n={kind:`turn`,key:`turn-${r.key}`,user:r,response:[]},t.push(n);continue}if(r.kind===`entry`&&(r.entry.role===`system`||r.entry.role===`error`)){t.push({kind:`standalone`,key:`standalone-${r.key}`,item:r}),n=null;continue}n||(n={kind:`turn`,key:`turn-${r.key}`,response:[]},t.push(n)),n.response.push(r)}for(let e of t){if(e.kind!==`turn`)continue;let t=Ua(e.response,e.key),n=e=>e.kind===`entry`&&!!e.entry.suggestion;e.response=[...t.filter(e=>!n(e)),...t.filter(n)]}return t}function Va(e){return e.detail?.kind===`plan`&&!e.parentToolUseId&&Ut(e.input)!==void 0}function Ha(e){let t=new Map,n=[];for(let r of e)r.tool&&Va(r.tool)&&(n=Wt(n,Ut(r.tool.input)),t.set(r.tool.callId,n));return t}function Ua(e,t){let n=-1;if(e.forEach((e,t)=>{e.kind===`plan`&&(n=t)}),n<0)return e;let r=[];return e.forEach((e,i)=>{if(e.kind===`plan`&&i!==n)return;let a=r[r.length-1];if(e.kind===`tools`&&a?.kind===`tools`){r[r.length-1]={...a,tools:[...a.tools,...e.tools]};return}r.push(e.kind===`plan`?{...e,key:`plan-${t}`}:e)}),r}function Wa(e){let t=[],n=[],r=``,i=()=>{n.length&&t.push({kind:`tools`,key:r,tools:n}),n=[]};for(let a of e)a.tool&&Va(a.tool)?(i(),t.push({kind:`plan`,key:`plan-${a.tool.callId}`,callId:a.tool.callId})):a.tool?(n.length||(r=`tools-${a.tool.callId||a.id}`),n.push(a.tool)):(i(),t.push({kind:`entry`,key:a.id,entry:a}));return i(),t}var Ga=20,Ka=40;function qa({entries:e,working:t,workingLabel:n,draftRoute:r,opening:i,sessionKey:a,focusView:o,onAction:s,authAction:c,header:l,footer:u,greeting:d}){let f=(0,G.useRef)(null),p=(0,G.useRef)(null),[m,h]=(0,G.useState)(!0),g=(0,G.useMemo)(()=>o?qi(e,t):e,[e,o,t]),_=g.length,v=(0,G.useRef)(new Map),[y,b]=(0,G.useState)(()=>({sessionKey:a,focusView:o,initialized:_>0,start:Math.max(0,_-Ga)})),x=Math.max(0,_-Ga),S=Math.min(y.start,x);if(y.sessionKey!==a||y.focusView!==o||!y.initialized&&_>0){let e=v.current.get(a??`new`);S=Math.max(0,_-Math.max(Ga,e?.limit??Ga)),b({sessionKey:a,focusView:o,initialized:_>0,start:S})}else(S!==y.start||y.initialized&&_===0)&&b({...y,initialized:_>0,start:S});let C=Zi(a,g);C!==null&&C<S&&(S=C,b({sessionKey:a,focusView:o,initialized:!0,start:S}));let w=(0,G.useRef)(_-S);(0,G.useLayoutEffect)(()=>{w.current=_-S},[_,S]);let T=(0,G.useRef)(!0),E=(0,G.useCallback)(e=>{T.current=e,h(e)},[]),D=(0,G.useCallback)(()=>{let e=f.current;return!e||e.scrollHeight-e.scrollTop-e.clientHeight<80},[]),O=(0,G.useCallback)(()=>{let e=f.current;e&&(e.scrollTop=e.scrollHeight)},[]),k=(0,G.useCallback)(()=>{let e=f.current;e&&e.scrollTo({top:e.scrollHeight,behavior:`smooth`}),E(!0)},[E]);(0,G.useLayoutEffect)(()=>{let e=v.current.get(a??`new`);E(e?.pinned??!0);let t=requestAnimationFrame(()=>{let t=f.current;t&&(t.scrollTop=Sa(t,e))});return()=>cancelAnimationFrame(t)},[a,E]),(0,G.useLayoutEffect)(()=>{let e=Zi(a,g);if(e===null||e<S)return;let t=`msg-${g[e].id}`;Qi(),E(!1),requestAnimationFrame(()=>{let e=document.getElementById(t);e&&(e.scrollIntoView({block:`center`}),e.classList.add(`is-jump-target`),setTimeout(()=>e.classList.remove(`is-jump-target`),2400))})},[a,g,S,E]);let A=(0,G.useCallback)(()=>{let e=f.current;if(!e)return;let t=D();E(t),v.current.set(a??`new`,xa(e,t,w.current))},[D,a,E]),ee=(0,G.useCallback)(()=>{b(e=>({...e,start:Math.max(0,e.start-Ka)}))},[]);(0,G.useLayoutEffect)(()=>{T.current&&O()}),(0,G.useEffect)(()=>{let e=p.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{T.current&&O()});return t.observe(e),()=>t.disconnect()},[O]);let j=(0,G.useMemo)(()=>Ha(g),[g]),te=S>0?g.slice(S):g,M=Ba(Wa(te)),N=te.at(-1),P=!!(N?.role===`assistant`||N?.tool),ne=e=>e.kind===`tools`?(0,K.jsx)(Vi,{tools:e.tools},e.key):e.kind===`plan`?j.get(e.callId)?.length?(0,K.jsx)(Ui,{plan:j.get(e.callId)},e.key):null:(0,K.jsx)(za,{entry:e.entry,onAction:s,authAction:c},e.key);return(0,K.jsxs)(`div`,{className:`chat-wrap`,children:[(0,K.jsx)(`div`,{className:`chat`,ref:f,onScroll:A,children:(0,K.jsxs)(`div`,{className:`chat-inner`,ref:p,children:[l,_===0&&!l&&!r&&i&&(0,K.jsxs)(`div`,{className:`chat-loading`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(Ct,{size:`lg`}),(0,K.jsx)(`p`,{children:`Fetching transcript…`})]}),_===0&&!l&&r&&d&&(0,K.jsx)(`div`,{className:`chat-greeting`,children:(0,K.jsx)(`h2`,{children:d})}),_===0&&!l&&!r&&!i&&(0,K.jsxs)(`div`,{className:`chat-empty`,children:[(0,K.jsx)(`p`,{className:`chat-empty-title`,children:`No messages yet`}),(0,K.jsx)(`p`,{className:`chat-empty-sub`,children:`This session has no transcript so far. Send a message below to continue, or open the terminal if it is running there.`})]}),S>0&&(0,K.jsxs)(`button`,{className:`load-earlier`,onClick:ee,children:[`↑ Show earlier messages (`,S,` more)`]}),M.map(e=>e.kind===`standalone`?(0,K.jsx)(`div`,{className:`transcript-standalone`,children:ne(e.item)},e.key):(0,K.jsxs)(`div`,{className:`transcript-turn`,children:[e.user?.kind===`entry`&&(0,K.jsx)(za,{entry:e.user.entry,onAction:s}),e.response.length>0&&(0,K.jsx)(`div`,{className:`turn-response-body`,children:e.response.map(ne)})]},e.key)),t&&!P&&(0,K.jsxs)(`div`,{className:`working-row`,children:[(0,K.jsxs)(`span`,{className:`working-dots`,"aria-hidden":!0,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{})]}),(0,K.jsx)(`span`,{className:`working-label`,children:n||`working…`})]}),u]})}),!m&&_>0&&(0,K.jsx)(`button`,{className:`jump-latest`,onClick:k,"aria-label":`Jump to latest`,children:`↓ Latest`})]})}function Ja({images:e,index:t,onClose:n}){let[r,i]=(0,G.useState)(t),a=e.length;(0,G.useEffect)(()=>i(t),[t]);let o=(0,G.useCallback)(e=>i(t=>a?(t+e+a)%a:0),[a]),s=e[r],c=Ta(s);return(0,K.jsx)(mt,{src:c,name:s?.name??`Image`,current:r,count:a,onNavigate:o,onClose:n},`${r}:${c}`)}function Ya({sessionId:e,nodeId:t,app:n,view:r,item:i,docked:a,online:o,onBack:s,onClose:c,onDraft:l}){let u=async(i,a={})=>await z.appCommand(i,e,{appId:n.id,viewId:r.id,...a},t),d=Xa[r.backend],[f,p]=(0,G.useState)(null);return(0,K.jsx)(Dr,{docked:a,title:r.name,ariaLabel:`${n.name}: ${r.name}`,onClose:c,autoFocusSearch:!1,size:`large`,children:(0,K.jsxs)(`div`,{className:`backend-view`,children:[(0,K.jsxs)(`div`,{className:`backend-toolbar`,children:[(0,K.jsxs)(`button`,{className:`btn sm ghost backend-back`,onClick:f?f.back:s,children:[`‹ `,f?f.label:`Apps`]}),(0,K.jsxs)(`span`,{className:`backend-source`,children:[n.name,` · `,r.detail]})]}),(0,K.jsx)(d,{ask:u,item:i,online:o,onDraft:l,app:n,setBack:p})]})})}var Xa={requests:io,data:so,logs:go},Za=e=>{let t=Jn(e);return t===`now`?`just now`:`${t} ago`},Qa=(e,t)=>e instanceof Error?e.message:t,$a=e=>e?e.error||e.status>=500?`danger`:e.status>=400?`warn`:`ok`:void 0,eo=e=>e.error?`No answer`:String(e.status);function to({value:e,options:t,onChange:n,label:r}){return(0,K.jsx)(`div`,{className:`segmented backend-switch`,role:`radiogroup`,"aria-label":r,children:t.map(t=>(0,K.jsx)(`button`,{type:`button`,role:`radio`,className:`seg-btn`,"aria-checked":e===t.id,disabled:t.disabled,onClick:()=>n(t.id),children:t.label},t.id))})}function no({changes:e,empty:t}){return e.length?(0,K.jsx)(`ul`,{className:`backend-changes`,children:e.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`backend-path`,children:e.path}),e.before!==void 0&&(0,K.jsxs)(`span`,{className:`backend-was`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:`was `}),e.before]}),e.after===void 0?(0,K.jsx)(`span`,{className:`backend-gone`,children:`removed`}):(0,K.jsxs)(`span`,{className:`backend-now`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:`now `}),e.after]})]},e.path))}):(0,K.jsx)(`p`,{className:`backend-empty`,children:t})}function ro(e){if(e.error)return e.error;if(e.json)try{return JSON.stringify(JSON.parse(e.body),null,2)}catch{}return e.body||`(empty body)`}function io({ask:e,item:t,online:n,onDraft:r,setBack:i}){let[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(t),[l,u]=(0,G.useState)(null),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(``),h=()=>e(`apps.requests`).then(o,e=>f(Qa(e,`Could not read the requests.`)));(0,G.useEffect)(()=>{h()},[]),(0,G.useEffect)(()=>(i(s?{label:`Requests`,back:()=>{c(void 0),h()}}:null),()=>i(null)),[s]);let g=async()=>{u(`all`),f(``);try{o(await e(`apps.runRequest`))}catch(e){f(Qa(e,`Could not run the requests.`))}finally{u(null)}},_=a?.scenarios??[],v=_.length>0&&(0,K.jsxs)(`label`,{className:`backend-scenario`,children:[(0,K.jsx)(`span`,{children:`Run in`}),(0,K.jsxs)(`select`,{className:`field`,value:p,onChange:e=>m(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:`Your data (the real server)`}),_.map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),y=_.find(e=>e.id===p);if(s)return(0,K.jsxs)(K.Fragment,{children:[v,y&&(0,K.jsxs)(`p`,{className:`backend-meta`,children:[`Simulates `,y.simulated,`; other requests reach the server.`]}),(0,K.jsx)(oo,{ask:e,id:s,online:n,onDraft:r,scenario:p})]});if(!a)return d?(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:d}):(0,K.jsxs)(`div`,{className:`apps-state`,role:`status`,children:[(0,K.jsx)(Ct,{size:`sm`}),(0,K.jsx)(`span`,{children:`Reading requests…`})]});let b=[...new Set(a.requests.map(e=>e.file))];return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`backend-toolbar`,children:[(0,K.jsx)(`span`,{className:`backend-meta`,children:a.base?(0,K.jsxs)(K.Fragment,{children:[`Against `,(0,K.jsx)(`code`,{children:a.base})]}):`No server for {{base}}: give the view a base`}),(0,K.jsxs)(`button`,{className:`btn sm`,disabled:!n||l!==null||!a.requests.some(e=>e.auto),onClick:()=>void g(),children:[l===`all`?(0,K.jsx)(Ct,{size:`xs`}):null,`Run all`]})]}),v,d&&(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:d}),a.problems.map(e=>(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`warn`,role:`status`,children:(0,K.jsxs)(`span`,{className:`banner-text`,children:[(0,K.jsx)(`code`,{children:e.file}),` `,e.error]})},e.file)),!a.requests.length&&!a.problems.length&&(0,K.jsxs)(`div`,{className:`apps-empty`,children:[(0,K.jsx)(`strong`,{children:`No requests yet`}),(0,K.jsxs)(`p`,{children:[`Requests are `,(0,K.jsx)(`code`,{children:`.http`}),` files in `,(0,K.jsx)(`code`,{children:`.bivy/requests`}),`, like `,(0,K.jsxs)(`code`,{children:[`GET `,`{{base}}`,`/orders`]}),`. Ask the agent to add the ones that show what it changed.`]})]}),b.map(e=>(0,K.jsxs)(`section`,{className:`backend-group`,"aria-label":e,children:[(0,K.jsx)(`h3`,{className:`apps-group-title`,children:e}),(0,K.jsx)(`ul`,{className:`backend-list`,children:a.requests.filter(t=>t.file===e).map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,className:`backend-row`,onClick:()=>c(e.id),children:[(0,K.jsx)(`span`,{className:`backend-method`,"data-method":e.method,children:e.method}),(0,K.jsxs)(`span`,{className:`backend-row-text`,children:[(0,K.jsx)(`span`,{className:`backend-row-name`,children:e.name}),(0,K.jsx)(`code`,{className:`backend-row-sub`,children:e.url.replace(a.base,``)||`/`})]}),e.external&&(0,K.jsxs)(`span`,{className:`badge`,"data-tone":`warn`,title:`Not this app's server`,children:[`→ `,e.external]}),(0,K.jsx)(ao,{request:e})]})},e.id))})]},e)),a.requests.length>0&&(0,K.jsxs)(`p`,{className:`backend-foot`,children:[`GET requests to this app, and those marked `,(0,K.jsx)(`code`,{children:`# @auto`}),`, run before and after each agent run. Others run only when you tap them.`]})]})}function ao({request:e}){if(!e.last)return(0,K.jsx)(`span`,{className:`badge`,children:e.auto?`not run yet`:`runs on tap`});if(e.last.simulated)return(0,K.jsxs)(`span`,{className:`badge`,"data-tone":`accent`,children:[eo(e.last),` · simulated`]});let t=e.before&&(e.before.status!==e.last.status||!!e.before.error!=!!e.last.error);return(0,K.jsx)(`span`,{className:`badge`,"data-tone":t?`warn`:$a(e.last),children:t?`${eo(e.before)} → ${eo(e.last)}`:eo(e.last)})}function oo({ask:e,id:t,online:n,onDraft:r,scenario:i}){let[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(`now`),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(!1);(0,G.useEffect)(()=>{e(`apps.request`,{id:t}).then(e=>{o(e),e.changes?.length&&c(`changes`)},e=>f(Qa(e,`Could not read the request.`)))},[t]);let h=async()=>{m(!1),u(!0),f(``);try{let n=await e(`apps.runRequest`,{id:t,...i?{scenario:i}:{}});o(n),c(n.changes?.length?`changes`:`now`)}catch(e){f(Qa(e,`Could not run the request.`))}finally{u(!1)}};if(!a)return(0,K.jsx)(K.Fragment,{children:d?(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:d}):(0,K.jsxs)(`div`,{className:`apps-state`,role:`status`,children:[(0,K.jsx)(Ct,{size:`sm`}),(0,K.jsx)(`span`,{children:`Reading…`})]})});let{item:g,request:_}=a,v=s===`before`?g.before:g.last,y=()=>r(`The request “${g.name}” (${g.method} ${g.url}, .bivy/requests/${g.file})${g.last?.scenario?` in the scenario “${g.last.scenario}”`:``} ${g.last?`answered ${eo(g.last)}${g.before?` (it answered ${eo(g.before)} before your last run)`:``}`:`hasn't run yet`}:\n\n${g.last?ro(g.last).slice(0,3e3):``}\n\nWhat should it answer?`);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`backend-detail-head`,children:[(0,K.jsx)(`span`,{className:`backend-method`,"data-method":g.method,children:g.method}),(0,K.jsxs)(`span`,{className:`backend-row-text`,children:[(0,K.jsx)(`span`,{className:`backend-row-name`,children:g.name}),(0,K.jsx)(`code`,{className:`backend-row-sub`,children:g.url})]})]}),d&&(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:d}),g.last?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`backend-status`,children:[(0,K.jsx)(`span`,{className:`badge`,"data-tone":$a(g.last),children:g.last.error?`No answer`:`${g.last.status} ${g.last.statusText}`.trim()}),g.before&&!g.last.simulated&&g.before.status!==g.last.status&&(0,K.jsxs)(`span`,{className:`backend-meta`,children:[`was `,eo(g.before)]}),(0,K.jsxs)(`span`,{className:`backend-meta`,children:[g.last.ms,` ms · `,Za(g.last.at)]}),g.last.scenario&&(0,K.jsx)(`span`,{className:`badge`,"data-tone":`accent`,children:g.last.simulated?`Simulated by “${g.last.scenario}”`:`In “${g.last.scenario}”`})]}),(0,K.jsx)(to,{label:`Show the answer`,value:s,onChange:c,options:[{id:`before`,label:`Before`,disabled:!g.before},{id:`now`,label:`Now`},{id:`changes`,label:`Changes`,disabled:!a.changes}]}),s===`changes`?(0,K.jsx)(no,{changes:a.changes??[],empty:`The same answer as before the agent's last run.`}):v?(0,K.jsxs)(`pre`,{className:`backend-body`,children:[ro(v),v.truncated?`
|
|
9
|
-
… (cut at 1 MB)`:``]}):null]}):(0,K.jsx)(`p`,{className:`backend-empty`,children:`Not run yet.`}),(0,K.jsxs)(`details`,{className:`backend-request`,children:[(0,K.jsx)(`summary`,{children:`Request`}),(0,K.jsx)(`pre`,{className:`backend-body`,children:[`${_.method} ${_.url}`,..._.headers.map(([e,t])=>`${e}: ${t}`),..._.body?[``,_.body]:[]].join(`
|
|
10
|
-
`)})]}),(0,K.jsxs)(`div`,{className:`backend-actions`,children:[(0,K.jsx)(`button`,{className:`btn ghost`,disabled:!g.last,onClick:y,children:`Send to agent…`}),(0,K.jsxs)(`button`,{className:`btn primary`,disabled:!n||l,onClick:()=>g.auto?void h():m(!0),children:[l?(0,K.jsx)(Ct,{size:`xs`}):null,g.last?`Run again`:`Run`]})]}),p&&(0,K.jsx)(B,{title:`Run ${g.method} ${g.name}?`,message:`This sends ${g.method} ${g.url} from this machine. It may change data${g.external?` on ${g.external}, which isn't this app's server`:``}.`,confirmLabel:`Run it`,danger:!!g.external,onCancel:()=>m(!1),onConfirm:()=>void h()})]})}function so({ask:e,item:t,online:n}){let[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),l=async t=>{o(!0),c(``);try{i(await e(`apps.data`,t?{run:t}:{}))}catch(e){c(Qa(e,`Could not run the queries.`))}finally{o(!1)}};return(0,G.useEffect)(()=>{l(!1)},[]),r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`backend-toolbar`,children:[(0,K.jsx)(`span`,{className:`backend-meta`,children:r.queries.length===1?`1 saved query`:`${r.queries.length} saved queries`}),(0,K.jsxs)(`button`,{className:`btn sm`,disabled:!n||a,onClick:()=>void l(!0),children:[a?(0,K.jsx)(Ct,{size:`xs`}):null,`Run again`]})]}),s&&(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:s}),r.problems.map(e=>(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`warn`,role:`status`,children:(0,K.jsxs)(`span`,{className:`banner-text`,children:[(0,K.jsx)(`code`,{children:e.file}),` `,e.error]})},e.file)),!r.queries.length&&(0,K.jsxs)(`div`,{className:`apps-empty`,children:[(0,K.jsx)(`strong`,{children:`No saved queries yet`}),(0,K.jsxs)(`p`,{children:[`Queries are `,(0,K.jsx)(`code`,{children:`.sql`}),` files in `,(0,K.jsx)(`code`,{children:`.bivy/queries`}),`. Start one with `,(0,K.jsx)(`code`,{children:`-- key: id`}),` so changed rows can be matched. Ask the agent to add the ones that show what it changed.`]})]}),r.queries.map(e=>(0,K.jsx)(lo,{query:e,focused:e.id===t},e.id))]}):s?(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:s}):(0,K.jsxs)(`div`,{className:`apps-state`,role:`status`,children:[(0,K.jsx)(Ct,{size:`sm`}),(0,K.jsx)(`span`,{children:`Running queries…`})]})}var co=e=>e.added.length+e.changed.length+e.removed.length;function lo({query:e,focused:t}){let n=e.changes?co(e.changes):0,[r,i]=(0,G.useState)(e.changes?`changes`:`now`),a=(0,G.useRef)(null);return(0,G.useEffect)(()=>{t&&a.current?.scrollIntoView({block:`start`})},[t]),(0,K.jsxs)(`section`,{ref:a,className:`backend-query`,"aria-label":e.title,children:[(0,K.jsxs)(`div`,{className:`backend-query-head`,children:[(0,K.jsx)(`h3`,{children:e.title}),n>0&&e.changes&&(0,K.jsxs)(`span`,{className:`backend-counts`,"aria-label":`${e.changes.added.length} added, ${e.changes.changed.length} changed, ${e.changes.removed.length} removed since the agent's last run began`,children:[e.changes.added.length>0&&(0,K.jsxs)(`span`,{"data-tone":`ok`,children:[`+`,e.changes.added.length,` `]}),e.changes.changed.length>0&&(0,K.jsxs)(`span`,{"data-tone":`warn`,children:[`~`,e.changes.changed.length,` `]}),e.changes.removed.length>0&&(0,K.jsxs)(`span`,{"data-tone":`danger`,children:[`−`,e.changes.removed.length]})]})]}),e.error?(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:(0,K.jsx)(`span`,{className:`banner-text`,children:e.error})}):(0,K.jsxs)(K.Fragment,{children:[e.changes&&(0,K.jsx)(to,{label:`Show ${e.title}`,value:r,onChange:i,options:[{id:`changes`,label:`Changes`},{id:`now`,label:`Now`}]}),r===`changes`&&e.changes?n?(0,K.jsx)(`ul`,{className:`backend-list`,children:[...e.changes.added.map(t=>(0,K.jsx)(fo,{kind:`added`,row:t,keyName:e.key},`+${t.key}`)),...e.changes.changed.map(t=>(0,K.jsx)(fo,{kind:`changed`,row:t,keyName:e.key},`~${t.key}`)),...e.changes.removed.map(t=>(0,K.jsx)(fo,{kind:`removed`,row:t,keyName:e.key},`-${t.key}`))]}):(0,K.jsxs)(`p`,{className:`backend-empty`,children:[`No changes · `,e.count,` `,e.count===1?`row`:`rows`]}):(0,K.jsx)(po,{query:e})]}),(0,K.jsxs)(`p`,{className:`backend-foot`,children:[(0,K.jsx)(`code`,{children:e.file}),`, keyed by `,(0,K.jsx)(`code`,{children:e.key}),e.at?` · ran ${Za(e.at)}`:``]})]})}var uo={added:`Added`,changed:`Changed`,removed:`Removed`};function fo({kind:e,row:t,keyName:n}){let r=e===`changed`?t.fields??[]:Object.entries(t.row).filter(([e])=>e!==n).map(([e,t])=>({path:e,after:t}));return(0,K.jsxs)(`li`,{className:`backend-rowcard`,"data-kind":e,children:[(0,K.jsxs)(`span`,{className:`backend-row-name`,children:[(0,K.jsxs)(`span`,{className:`sr-only`,children:[uo[e],`: `]}),t.key]}),(0,K.jsx)(`dl`,{className:`backend-fields`,children:r.slice(0,12).map(t=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:t.path}),(0,K.jsxs)(`dd`,{children:[e===`changed`&&t.before!==void 0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`s`,{className:`backend-was`,children:t.before}),` `]}),e===`removed`?(0,K.jsx)(`s`,{children:t.after}):t.after]})]},t.path))})]})}function po({query:e}){return e.rows.length?(0,K.jsxs)(`div`,{className:`backend-table-wrap`,children:[(0,K.jsxs)(`table`,{className:`backend-table`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsx)(`tr`,{children:e.columns.map(e=>(0,K.jsx)(`th`,{scope:`col`,children:e},e))})}),(0,K.jsx)(`tbody`,{children:e.rows.map((t,n)=>(0,K.jsx)(`tr`,{children:e.columns.map(e=>(0,K.jsx)(`td`,{children:t[e]},e))},t[e.key]??n))})]}),e.count>e.rows.length&&(0,K.jsxs)(`p`,{className:`backend-foot`,children:[`Showing `,e.rows.length,` of `,e.count,` rows.`]})]}):(0,K.jsx)(`p`,{className:`backend-empty`,children:`No rows.`})}var mo=2e3,ho=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function go({ask:e,onDraft:t,app:n}){let[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(`all`),[s,c]=(0,G.useState)(``),l=(0,G.useRef)(!1),u=(0,G.useRef)(null);if((0,G.useEffect)(()=>{let t=!0,n,r=async()=>{try{let n=await e(`apps.serverLog`);t&&(i(n),c(``))}catch(e){t&&c(Qa(e,`Could not read the logs.`))}t&&(n=setTimeout(()=>void r(),mo))};return r(),()=>{t=!1,clearTimeout(n)}},[]),(0,G.useEffect)(()=>{r&&!l.current&&u.current&&(l.current=!0,u.current.scrollIntoView({block:`start`}))},[r]),!r)return s?(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:s}):(0,K.jsxs)(`div`,{className:`apps-state`,role:`status`,children:[(0,K.jsx)(Ct,{size:`sm`}),(0,K.jsx)(`span`,{children:`Reading logs…`})]});let d=r.marks.at(-1),f=r.lines.filter(e=>!d||e.at>=d.at),p=f.filter(e=>e.level===`error`),m=[...r.lines.filter(e=>a===`all`||e.level===`error`).map(e=>({line:e})),...r.marks.map(e=>({mark:e}))].sort((e,t)=>(`mark`in e?e.mark.at-.5:e.line.at)-(`mark`in t?t.mark.at-.5:t.line.at));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`backend-toolbar`,children:[(0,K.jsx)(to,{label:`Show`,value:a,onChange:o,options:[{id:`all`,label:`All`},{id:`errors`,label:`Errors${r.lines.some(e=>e.level===`error`)?` (${r.lines.filter(e=>e.level===`error`).length})`:``}`}]}),!r.running&&(0,K.jsx)(`span`,{className:`badge`,"data-tone":`warn`,children:`Not running`})]}),s&&(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:s}),!r.lines.length&&(0,K.jsx)(`p`,{className:`backend-empty`,children:r.running?`Nothing logged yet. Use the app, or run a request, and its output shows here.`:`The server isn't running, so there's nothing to show. Open the app's preview to start it.`}),(0,K.jsx)(`ol`,{className:`backend-log`,"aria-label":`Log`,children:m.map((e,t)=>`mark`in e?(0,K.jsxs)(`li`,{ref:e.mark===d?u:void 0,className:`backend-mark`,children:[e.mark===d?`Your last action`:`Action`,` · `,e.mark.label,` · `,ho(e.mark.at)]},`m${e.mark.at}`):(0,K.jsxs)(`li`,{className:`backend-line`,"data-level":e.line.level,children:[e.line.level===`error`&&(0,K.jsx)(`span`,{className:`badge`,"data-tone":`danger`,children:`error`}),(0,K.jsx)(`span`,{className:`backend-line-time`,children:ho(e.line.at)}),` `,e.line.text]},t))}),(0,K.jsx)(`div`,{className:`backend-actions`,children:(0,K.jsx)(`button`,{className:`btn${p.length?` primary`:``}`,disabled:!f.length,onClick:()=>t(`${n.name}'s server logged ${p.length===1?`an error`:`${p.length} errors`}${d?` after “${d.label}” (${ho(d.at)})`:``}:\n\n${f.slice(-40).map(e=>e.text).join(`
|
|
11
|
-
`)}\n\nPlease find the cause and fix it.`),children:p.length?`Send ${p.length===1?`error`:`errors`} to agent…`:`Send to agent…`})})]})}var _o=(0,G.lazy)(()=>C(()=>import(`./Terminal-DUFzWYWz.js`).then(e=>({default:e.TerminalOverlay})),__vite__mapDeps([22,1,23,3,4,24,25,26,27,28]))),vo=()=>{},yo={terminal:`Terminal · starts when opened`,static:`Snapshot · refreshed after each turn`,service:`Live server`,managed:`Live server · run by Bivy`,display:`Desktop app · own display`},bo={requests:`Requests · the API as buttons`,data:`Data · rows from saved queries`,logs:`Logs · the server's output`},xo={requests:`Open requests`,data:`Open data`,logs:`Open logs`},So={ready:`When ready`,every:`Every change`,off:`Off`};function Co(e,t){return`Notes from people reviewing "${e}":\n`+t.map(e=>`- "${e.note}" on ${e.selector}${e.text?` ("${e.text}")`:``}, page ${e.path}, viewport ${e.viewport.width}×${e.viewport.height}${e.context?`\n${e.context}`:``}${e.shot?`
|
|
12
|
-
Attached picture is approximate: retaken on the machine, not the reviewer’s browser.`:``}`).join(`
|
|
13
|
-
`)}function wo({sessionId:e,appId:t,nodeId:n,openView:r,onOpenInChat:i,onClose:a,docked:o}){let s=o?vo:a,{connection:c,activeSession:l}=je(),[f,p]=(0,G.useState)(null),m=!!n&&!z.direct&&n!==c.currentNodeId,h=m?n:c.currentNodeId,[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)([]),[b,x]=(0,G.useState)(``),[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(0),[E,D]=(0,G.useState)(null),[O,k]=(0,G.useState)(null),[A,ee]=(0,G.useState)(null),[j,te]=(0,G.useState)(!1),[M,N]=(0,G.useState)(null),[P,ne]=(0,G.useState)(null),F=(0,G.useRef)(0),I=m||c.status===`online`;(0,G.useEffect)(()=>{D(null)},[e,c.currentNodeId]),(0,G.useEffect)(()=>{let r=++F.current;return C(!0),x(``),_(null),N(null),ne(null),y([]),t||z.appCommand(`apps.offers`,e,{},n).then(e=>{F.current===r&&y(e.offers??[])},()=>{}),z.appCommand(`apps.list`,e,{},n).then(e=>{F.current===r&&_(e)}).catch(e=>{F.current===r&&x(e instanceof Error?e.message:`Could not load apps.`)}).finally(()=>{F.current===r&&C(!1)}),()=>{F.current=r+1}},[e,h,I,w,n,t]),(0,G.useEffect)(()=>z.onAppsChanged(t=>{if(t!==e)return;let r=F.current;z.appCommand(`apps.list`,e,{},n).then(e=>{F.current===r&&_(e)},()=>{})}),[e,n]),(0,G.useEffect)(()=>{let t=g?.apps.flatMap(e=>e.views.flatMap(e=>e.kind===`web`?(e.notes??[]).map(e=>e.at):[]))??[];t.length&&Yr(e,Math.max(...t))},[g,e]),(0,G.useEffect)(()=>{if(!M)return;let e=setTimeout(()=>N(null),55e3);return()=>clearTimeout(e)},[M]);let re=async(t,r=`peek`,i,a)=>{let o=F.current;C(!0),x(``),N(null),ne(null);let c=(`offer`in t||t.view.kind===`web`)&&(r===`tab`||Ur()),l=c?window.open(`about:blank`,`_blank`):null;try{if(l){l.opener=null,l.document.title=`Bivy · Opening app`;let e=l.document.createElement(`p`);e.setAttribute(`role`,`status`),e.textContent=`Opening app…`,l.document.body?.append(e)}let r,d;if(`offer`in t){if(r=(await z.appCommand(`apps.adopt`,e,{port:t.offer.port},n)).app,d=r.views[0],F.current===o){let e=r;_(t=>t&&{...t,apps:[...t.apps,e]}),y(e=>e.filter(e=>e.port!==t.offer.port))}}else({app:r,view:d}=t);let f=await z.appCommand(`apps.open`,e,{appId:r.id,viewId:d.id,returnTo:`${u()}/sessions/${encodeURIComponent(e)}`,...i?{path:i}:{},...a?{scenario:a}:{}},n);if(F.current!==o){l?.close();return}if(f.kind===`terminal`)D(f.termId);else if(f.kind===`web`){let e=ie(f.url);c?l&&!l.closed?(l.location.replace(e),s()):N({viewId:d.id,url:e}):(te(!1),ee({url:e,app:r,view:d}))}else throw Error(`This app view is not supported by this client.`)}catch(e){l?.close(),F.current===o&&x(e instanceof Error?e.message:`Could not open view.`)}finally{F.current===o&&C(!1)}},ie=e=>{let t=new URL(e);if(t.protocol!==`https:`||t.origin===location.origin||t.username||t.password)throw Error(`Machine returned an unsafe preview URL.`);return t.href},ae=(0,G.useRef)(!1);(0,G.useEffect)(()=>{if(!r||ae.current||!g)return;let e=g.apps.find(e=>e.views.some(e=>e.id===r.viewId)),t=e?.views.find(e=>e.id===r.viewId);e&&t&&(ae.current=!0,t.kind===`backend`?k({app:e,view:t,item:r.item}):re({app:e,view:t},`peek`,r.path,r.scenario))},[r,g]);let oe=async(t,r)=>{x(``);try{await z.appCommand(`apps.reviewMode`,e,{appId:t.id,mode:r},n),_(e=>e&&{...e,apps:e.apps.map(e=>e.id===t.id?{...e,reviewMode:r}:e)})}catch(e){x(e instanceof Error?e.message:`Could not change preview cards.`)}},se=async(t,r)=>{let i=F.current;C(!0),x(``);try{let a=await z.appCommand(`apps.logs`,e,{appId:t.id,viewId:r.id},n);F.current===i&&a.kind===`terminal`&&D(a.termId)}catch(e){F.current===i&&x(e instanceof Error?e.message:`Could not open the server logs.`)}finally{F.current===i&&C(!1)}},ce=async t=>{C(!0),x(``);try{let n=t.notes??[],r=Co(t.name,n),i=await ii(n);if(m||l.activeSessionId!==e||!z.prefillComposer(r,i)){if(i.length)throw Error(`Open this session’s chat before adding reviewer pictures.`);d(localStorage,e,r)}s()}catch(e){x(e instanceof Error?e.message:`Could not add notes.`)}finally{C(!1)}},le=async(t,r)=>{x(``);try{await z.appCommand(`apps.agentNotes`,e,{appId:t.id,enabled:r},n),_(e=>e&&{...e,apps:e.apps.map(e=>e.id===t.id?{...e,agentNotes:r||void 0}:e)})}catch(e){x(e instanceof Error?e.message:`Could not change who can read notes.`)}},ue=async(t,r)=>{let i=F.current;C(!0),x(``);try{await z.appCommand(`apps.clearNotes`,e,{appId:t.id,viewId:r.id},n),F.current===i&&T(e=>e+1)}catch(e){F.current===i&&x(e instanceof Error?e.message:`Could not clear notes.`)}finally{F.current===i&&C(!1)}},de=async t=>{let r=F.current;C(!0),x(``),ne(null);try{await z.appCommand(`apps.remove`,e,{appId:t.id},n),F.current===r&&T(e=>e+1)}catch(e){F.current===r&&x(e instanceof Error?e.message:`Could not remove app.`)}finally{F.current===r&&C(!1)}};if(A)return(0,K.jsx)(Gr,{docked:o,url:A.url,name:A.app.name,sessionId:e,appId:A.app.id,viewId:A.view.id,onClose:s,access:(0,K.jsx)(zr,{sessionId:e,appId:A.app.id,viewId:A.view.id,name:A.view.name,nodeId:n,disabled:!I||!g?.previewAvailable,onRevoked:()=>te(!0)}),revoked:j,onManage:()=>ee(null),onOpenInTab:()=>{let{app:e,view:t}=A;ee(null),re({app:e,view:t},`tab`)}});let L=t=>{(m||l.activeSessionId!==e||!z.prefillComposer(t))&&d(localStorage,e,t),s()};if(O)return(0,K.jsx)(Ya,{sessionId:e,nodeId:n,app:O.app,view:O.view,item:O.item,docked:o,online:I,onBack:()=>k(null),onClose:a,onDraft:L});if(E)return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(ot,{title:`App terminal`,onClose:()=>D(null),children:(0,K.jsx)(`p`,{role:`status`,children:`Loading terminal…`})}),children:(0,K.jsx)(_o,{sessionId:e,attachTermId:E,attachOnly:!0,onClose:()=>D(null)})});let R=!!g?.previewAvailable,fe=g?.apps.filter(e=>!t||e.id===t)??[];return(0,K.jsxs)(Dr,{docked:o,title:`Apps`,ariaLabel:`Session apps`,onClose:a,autoFocusSearch:!1,size:`large`,headExtra:(0,K.jsx)(`button`,{className:`btn ghost icon`,onClick:()=>T(e=>e+1),disabled:S||!I,"aria-label":`Refresh`,title:`Refresh`,children:S&&g?(0,K.jsx)(Ct,{size:`xs`}):(0,K.jsx)(Ue,{size:18})}),children:[(0,K.jsxs)(`div`,{className:`apps-sheet`,children:[S&&!g&&(0,K.jsxs)(`div`,{className:`apps-state`,role:`status`,children:[(0,K.jsx)(Ct,{size:`sm`}),(0,K.jsx)(`span`,{children:`Loading apps…`})]}),S&&g&&(0,K.jsx)(`span`,{className:`sr-only`,role:`status`,children:`Preparing…`}),b&&(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:b}),g&&!R&&(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`warn`,role:`status`,children:`Bivy’s preview service is unavailable. Try Refresh shortly. Terminal views still work.`}),g&&t&&!g.apps.some(e=>e.id===t)&&(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`neutral`,role:`status`,children:`This app is no longer available. Ask the agent to republish it; previews expire when the machine restarts.`}),g?.apps.length===0&&v.length===0&&(0,K.jsxs)(`div`,{className:`apps-empty`,children:[(0,K.jsx)(`span`,{className:`app-tile`,"aria-hidden":!0,children:(0,K.jsx)(Xe,{size:20})}),(0,K.jsx)(`strong`,{children:`No apps yet`}),(0,K.jsxs)(`p`,{children:[`When the agent starts a web server in this session’s workspace, it shows up here. Agents can also publish views with `,(0,K.jsx)(`code`,{children:`bivy app publish`}),`.`]})]}),!t&&v.length>0&&(0,K.jsxs)(`section`,{className:`apps-group`,"aria-label":`Running in this workspace`,children:[(0,K.jsx)(`h3`,{className:`apps-group-title`,children:`Running in this workspace`}),v.map(e=>(0,K.jsxs)(`div`,{className:`apps-card`,children:[(0,K.jsx)(ti,{tile:(0,K.jsx)(`span`,{className:`app-tile-port`,children:e.port}),name:`Port ${e.port}`,meta:`Live server · not previewed yet`,action:(0,K.jsx)(`button`,{className:`btn sm primary`,disabled:S||!I||!R,onClick:()=>void re({offer:e}),"aria-label":`Preview port ${e.port}`,children:`Preview`})}),(0,K.jsx)(`code`,{className:`apps-cmd`,children:e.command})]},e.port))]}),fe.map(t=>(0,K.jsxs)(`section`,{className:`apps-card`,"aria-label":t.name,children:[(0,K.jsx)(ti,{tile:ei(t.name),name:t.name,meta:`${t.views.length===1?`1 view`:`${t.views.length} views`}${t.createdAt?` · published ${Jn(t.createdAt)} ago`:``}`,action:(0,K.jsx)(Or,{label:`More actions for ${t.name}`,items:[{heading:`Preview cards in chat`},...[`ready`,`every`,`off`].map(e=>({label:So[e],checked:(t.reviewMode??`ready`)===e,disabled:S||!I,onSelect:()=>void oe(t,e)})),...t.views.some(e=>e.kind===`web`)?[{heading:`Reviewer notes`},{label:`Agents can read notes`,toggle:!0,checked:t.agentNotes===!0,disabled:S||!I,onSelect:()=>void le(t,t.agentNotes!==!0)}]:[],{label:`Remove app…`,danger:!0,disabled:S||!I,onSelect:()=>ne({app:t}),separated:!0}]})}),t.views.map(r=>{if(r.kind===`backend`)return(0,K.jsxs)(`article`,{className:`apps-view`,"aria-label":r.name,children:[(0,K.jsx)(ti,{small:!0,tile:(0,K.jsx)(qe,{size:18}),name:r.name,meta:bo[r.backend],action:(0,K.jsx)(`button`,{className:`btn sm`,disabled:S||!I,onClick:()=>k({app:t,view:r}),children:xo[r.backend]})}),(0,K.jsx)(`code`,{className:`apps-cmd`,children:r.detail})]},r.id);let a=r.kind===`terminal`?`terminal`:r.source===`service`&&r.managed?`managed`:r.source,o=r.kind===`terminal`?it:r.source===`display`?ut:Xe;return(0,K.jsxs)(`article`,{className:`apps-view`,"aria-label":r.name,children:[(0,K.jsx)(ti,{small:!0,tile:(0,K.jsx)(o,{size:18}),name:r.name,meta:yo[a],action:M?.viewId===r.id?(0,K.jsx)(`a`,{className:`btn sm primary`,href:M.url,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>setTimeout(s,0),children:`Open preview ↗`}):r.kind===`terminal`&&m?(0,K.jsx)(`button`,{className:`btn sm`,onClick:()=>{s(),i?.()},children:`Open in chat`}):(0,K.jsx)(`button`,{className:`btn sm${r.kind===`web`?` primary`:``}`,disabled:S||!I||r.kind===`web`&&!R,onClick:()=>r.kind===`terminal`?ne({app:t,view:r}):void re({app:t,view:r}),children:r.kind===`terminal`?`Open terminal`:`Open preview`})}),r.kind===`terminal`&&(0,K.jsx)(`code`,{className:`apps-cmd`,children:To(r.command,r.args)}),r.kind===`web`&&(0,K.jsxs)(`div`,{className:`apps-view-tools`,children:[(0,K.jsx)(zr,{sessionId:e,appId:t.id,viewId:r.id,name:r.name,nodeId:n,address:r.address,disabled:S||!I||!R,onRevoked:()=>N(null)}),r.managed&&!m&&(0,K.jsxs)(`button`,{className:`btn sm ghost`,disabled:S||!I,onClick:()=>void se(t,r),"aria-label":`${r.source===`display`?`App`:`Server`} logs for ${r.name}`,children:[(0,K.jsx)(qe,{size:15}),`Logs`]})]}),r.kind===`web`&&r.notes?.length?(0,K.jsxs)(`div`,{className:`apps-notes`,role:`group`,"aria-label":`Reviewer notes on ${r.name}`,children:[(0,K.jsxs)(`div`,{className:`apps-notes-head`,children:[(0,K.jsx)(`span`,{children:`Reviewer notes`}),(0,K.jsx)(`span`,{className:`apps-count`,"aria-label":`${r.notes.length} from people with a shared link`,children:r.notes.length})]}),(0,K.jsx)(`ul`,{children:r.notes.map(e=>(0,K.jsxs)(`li`,{className:`apps-note`,children:[(0,K.jsxs)(`span`,{className:`apps-note-text`,children:[`“`,e.note,`”`]}),` `,(0,K.jsxs)(`span`,{className:`app-row-meta`,children:[e.text?`on “${e.text}”`:e.selector,` · `,e.path,` · `,e.viewport.width,`×`,e.viewport.height]}),e.shot&&(0,K.jsx)(`button`,{className:`btn sm ghost`,onClick:()=>p(e),children:`View approximate picture`})]},e.id))}),(0,K.jsxs)(`div`,{className:`apps-notes-actions`,children:[(0,K.jsx)(`button`,{className:`btn sm`,disabled:S||!I,onClick:()=>void ce(r),children:`Add to message`}),(0,K.jsx)(`button`,{className:`btn sm ghost`,disabled:S||!I,onClick:()=>void ue(t,r),children:`Clear`})]})]}):null]},r.id)})]},t.id)),(fe.length>0||v.length>0)&&(0,K.jsx)(`p`,{className:`apps-foot`,children:`Apps stay available while this machine runs. Removing an app keeps your project files.`})]}),f&&(0,K.jsx)(Ja,{images:ri([f]),index:0,onClose:()=>p(null)}),P&&(0,K.jsx)(B,{title:P.view?`Open ${P.view.name}?`:`Remove ${P.app.name}?`,message:P.view?.kind===`terminal`?`This starts or reconnects to “${To(P.view.command,P.view.args)}”. It runs with the machine user’s permissions, not in a new sandbox. Only run code you trust.`:`Preview access will be revoked and this app’s terminals stopped. Project files and externally started servers are not removed.`,confirmLabel:P.view?`Open terminal`:`Remove app`,danger:!P.view,onCancel:()=>ne(null),onConfirm:()=>{P.view?re({app:P.app,view:P.view}):de(P.app)}})]})}function To(e,t=[]){return[e,...t].map(e=>/^[\w@%+=:,./-]+$/.test(e)?e:JSON.stringify(e)).join(` `)}var Eo=Ge();function Do(e){let t={name:``,path:``,type:`dir`,children:[]};for(let n of e){let e=n.path.split(`/`).filter(Boolean),r=t;for(let t=0;t<e.length;t++){let i=t===e.length-1,a=e[t],o=e.slice(0,t+1).join(`/`);r.children??=[];let s=r.children.find(e=>e.name===a&&e.type===(i?`file`:`dir`));s||(s=i?{name:a,path:o,type:`file`,file:n}:{name:a,path:o,type:`dir`,children:[]},r.children.push(s)),r=s}}let n=e=>{e.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`dir`?-1:1);for(let t of e)t.children&&=r(n(t.children));return e},r=e=>e.map(e=>{let t=e;for(;t.type===`dir`&&t.children?.length===1&&t.children[0].type===`dir`;){let e=t.children[0];t={...e,name:`${t.name}/${e.name}`}}return t});return r(n(t.children??[]))}function Oo(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function ko(e,t){try{let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return URL.createObjectURL(new Blob([r],{type:t||`application/octet-stream`}))}catch{return null}}function Ao(e){return{kind:e.kind,name:e.name,size:e.size,mimeType:e.mimeType,hash:e.hash,createdAt:e.createdAt,artifact:e.artifact}}function jo(e){let[t,n]=(0,G.useState)({status:`loading`});return(0,G.useEffect)(()=>{let t=!1,r=null;return n({status:`loading`}),z.fetchAttachment(e.hash,e.createdAt).then(i=>{if(t)return;let a=i&&ko(i.data,i.mimeType||e.mimeType);a?(r=a,n({status:`ready`,url:a})):n({status:`unavailable`})}),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e.hash,e.mimeType,e.createdAt]),t}async function Mo(e){let t=await z.fetchAttachment(e.hash,2**53-1),n=t&&ko(t.data,t.mimeType||e.mimeType);if(!n)return!1;let r=document.createElement(`a`);return r.href=n,r.download=e.name,r.click(),URL.revokeObjectURL(n),!0}function No({artifact:e,onOpen:t}){let n=jo(e);return n.status===`ready`?(0,K.jsx)(`button`,{type:`button`,className:`artifact-thumb-button`,onClick:t,"aria-label":`View ${e.name}`,children:(0,K.jsx)(`img`,{className:`artifact-thumb`,src:n.url,alt:``})}):(0,K.jsx)(`span`,{className:`artifact-thumb artifact-thumb-${n.status}`,"aria-hidden":!0,children:n.status===`unavailable`?`⚠`:``})}function Po({artifact:e,onJump:t,onOpenImage:n}){let[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1),s=async()=>{i(!0),o(!1);let t=await Mo(e);i(!1),t||o(!0)},c=[Oo(e.size),e.createdAt?wt(e.createdAt):null].filter(Boolean).join(` · `);return(0,K.jsxs)(`div`,{className:`artifact-row`,children:[e.kind===`image`&&n?(0,K.jsx)(No,{artifact:e,onOpen:n}):(0,K.jsx)(`span`,{className:`artifact-thumb artifact-glyph`,"aria-hidden":!0,children:`📄`}),(0,K.jsxs)(`div`,{className:`artifact-main`,children:[(0,K.jsxs)(`div`,{className:`artifact-name-line`,children:[(0,K.jsx)(`span`,{className:`artifact-name`,title:e.name,children:e.name}),e.artifact&&(0,K.jsx)(Te,{tone:`accent`,variant:`solid`,upper:!0,children:`Artifact`})]}),(0,K.jsx)(`div`,{className:`artifact-meta`,children:c}),e.caption&&(0,K.jsx)(`div`,{className:`artifact-caption`,children:e.caption.split(/\r?\n/,1)[0]}),a&&(0,K.jsx)(`div`,{className:`artifact-unavailable`,children:`Not available right now — the Machine may be offline, or this file was pruned.`})]}),(0,K.jsxs)(`div`,{className:`artifact-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:()=>void s(),disabled:r,"aria-busy":r,children:r?`Downloading…`:`Download`}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost`,onClick:()=>t(e.entryId),children:`Jump to turn`})]})]})}function J({artifacts:e,onClose:t,docked:n}){let r=(0,G.useMemo)(()=>e.filter(e=>e.kind===`image`),[e]),i=(0,G.useMemo)(()=>r.map(Ao),[r]),[a,o]=(0,G.useState)(null),s=e=>{n||t(),requestAnimationFrame(()=>{document.getElementById(`msg-${e}`)?.scrollIntoView({behavior:`smooth`,block:`center`})})},c=e.filter(e=>e.kind===`file`),l=e.length>0?`${e.length} artifact${e.length===1?``:`s`}`:`Artifacts`;return(0,K.jsxs)(Dr,{docked:n,title:l,onClose:t,autoFocusSearch:!1,children:[e.length===0&&(0,K.jsx)(`div`,{className:`changes-binary`,children:`No artifacts yet this session.`}),r.length>0&&(0,K.jsxs)(`div`,{className:`artifacts-group`,children:[(0,K.jsx)(`div`,{className:`artifacts-group-title`,children:`Images`}),r.map((e,t)=>(0,K.jsx)(Po,{artifact:e,onJump:s,onOpenImage:()=>o(t)},e.id))]}),c.length>0&&(0,K.jsxs)(`div`,{className:`artifacts-group`,children:[(0,K.jsx)(`div`,{className:`artifacts-group-title`,children:`Files`}),c.map(e=>(0,K.jsx)(Po,{artifact:e,onJump:s},e.id))]}),a!=null&&(0,K.jsx)(Ja,{images:i,index:a,onClose:()=>o(null)})]})}var Fo=`bivy.appIconBadge.enabled`,Io=`bivy.notificationPreferences.snapshot`,Lo=`bivy-notification-settings-change`,Ro,zo=null;function Bo(){window.dispatchEvent(new Event(Lo))}function Vo(){return localStorage.getItem(Fo)!==`0`}function Ho(e){localStorage.setItem(Fo,e?`1`:`0`),Bo()}function Uo(e){let t=t=>{(t.key===Fo||t.key===Io)&&e()};return window.addEventListener(Lo,e),window.addEventListener(`storage`,t),()=>{window.removeEventListener(Lo,e),window.removeEventListener(`storage`,t)}}function Wo(){let e=localStorage.getItem(Io);if(e===Ro)return zo;if(Ro=e,!e)return zo=null,zo;try{zo=he(JSON.parse(e))}catch{zo=null}return zo}function Go(e){localStorage.setItem(Io,JSON.stringify(e)),Bo()}function Ko(e){let[t,n]=(0,G.useState)(()=>typeof matchMedia==`function`&&matchMedia(e).matches);return(0,G.useEffect)(()=>{if(typeof matchMedia!=`function`)return;let t=matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function qo(e){let t=e.activeSession.activeSessionId,n=e.sessionIndex.sessions.find(e=>e.sessionId===t);return t?n?.worktree||n?.workspace||e.activeSession.github.repo:e.draft.repo}function Jo(e,t,n,r){let i=r?`project:${r}`:n?.active||`default`;if(!n)return{preset:i};let a=n.presets??{},o=r?.split(/[/\\]/).filter(Boolean)??[],s=(r?.startsWith(`/`)?[r,o.at(-1),...o.filter(e=>e.includes(`__`)).map(e=>e.replace(`__`,`/`))]:[r]).filter(Boolean).map(t=>a[`project:${t}`]?.[e]).find(Boolean)||(n.active?a[n.active]?.[e]:void 0);return s?{preset:i,label:t.find(e=>e.label===s)?.label}:{preset:i,label:(t.find(t=>t.label===a.default?.[e])??t.find(e=>e.label==="default")??(t.length===1?t[0]:void 0))?.label}}function Yo({state:e,model:t,onClose:n}){let[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(null),s=(0,G.useRef)(!0);(0,G.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let c=String(t.provider||``),l=e.settings.credentialRecords.filter(e=>e.provider===c),u=e.settings.credentialPresets,d=qo(e),f=Jo(c,l,u,d),p=e.catalogs.providers.find(e=>e.id===c)?.name||c,m=`${t.label||t.id} account`;return(0,K.jsx)(ot,{title:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`btn ghost icon`,onClick:n,"aria-label":`Back to models`,children:`‹`}),` `,m]}),ariaLabel:m,onClose:n,size:`large`,autoFocusSearch:!1,children:(0,K.jsxs)(`div`,{className:`picker-list`,children:[(0,K.jsxs)(`div`,{className:`settings-form`,children:[(0,K.jsx)(`p`,{className:`settings-hint`,children:d?`Applies to all ${p} models in ${d} on this machine.`:`Applies to all ${p} models using this machine’s active credential preset, including other sessions.`}),r&&(0,K.jsx)(`p`,{className:`muted`,role:`status`,children:`Switching account…`}),!u&&(0,K.jsx)(`p`,{className:`muted`,role:`status`,children:`Loading accounts…`}),a&&(0,K.jsx)(`p`,{className:`settings-error`,role:`alert`,children:a})]}),l.length===0&&(0,K.jsx)(`div`,{className:`picker-empty`,children:`No saved accounts available on this machine.`}),l.map(t=>(0,K.jsx)(lt,{title:(0,K.jsxs)(K.Fragment,{children:[t.label,f.label===t.label&&(0,K.jsx)(`span`,{className:`sr-only`,children:` (selected)`})]}),meta:t.kind===`oauth`?`Subscription sign-in`:t.kind===`reference`?`Password-manager reference`:`API key`,active:f.label===t.label,disabled:r||!u||e.connection.status!==`online`,onClick:async()=>{i(!0),o(null);try{await z.setPresetMapping(f.preset,c,t.label),z.listModels(),s.current&&n()}catch(e){s.current&&o(e instanceof Error?e.message:String(e))}finally{s.current&&i(!1)}}},t.label))]})})}var Xo=new Set([`claude-code-sdk`,`codex-approvals`,`grok`,`opencode`,`pi`]);function Zo(e){return String(e.displayName||e.name||e.id||`Agent`)}function Qo(e){return Xo.has(e.id)}function $o(e,t){let n=t.trim().toLocaleLowerCase();return[...n?e.filter(e=>Zo(e).toLocaleLowerCase().includes(n)):e].sort((e,t)=>Zo(e).localeCompare(Zo(t),void 0,{sensitivity:`base`}))}var es=Zo,ts={off:`Fastest`,minimal:`Minimal`,low:`Light`,medium:`Default`,high:`Deep`,xhigh:`Deeper`,max:`Deepest`};function ns(e){let t=e.capabilities||{},n=e.authOwner;return ze({now:new Date().toISOString(),preview:!0,agentId:e.id,agentDisplayName:es(e),detectedVersion:e.testedVersion,versionSource:e.testedVersion?`tested-pin`:void 0,supportTier:e.supportTier,certification:e.certification,executionMode:e.executionMode,authOrigin:n===`bivy`?`bivy`:n===`agent`?`agent-native`:`unknown`,resumeAdvertised:t.resume===!0,resumeRefIsPath:t.sessionRefIsPath===!0,toolInterceptionEnforced:t.toolInterception===!0,mcpToolApprovalsOnly:t.mcpToolApprovals===!0,runtimeEnforcement:e.protectionLevel})}function rs({state:e,onSetup:t}){let n=e.catalogs.githubConnect;(0,G.useEffect)(()=>{if(n.status!==`waiting`)return;let e=n.intervalMs&&n.intervalMs>0?n.intervalMs:5e3,t=setInterval(()=>z.githubConnectPoll(),e);return()=>clearInterval(t)},[n.status,n.intervalMs]),(0,G.useEffect)(()=>{n.status===`connected`&&z.listRepos()},[n.status]),(0,G.useEffect)(()=>()=>z.githubConnectReset(),[]);let r=n.status===`denied`?`Authorization was denied. Try again.`:n.status===`expired`?`That code expired before you authorized. Try again.`:n.status===`error`?n.error||`Couldn't connect. Try again.`:null;return(0,K.jsxs)(`div`,{className:`repo-connect`,children:[(0,K.jsx)(`p`,{className:`repo-connect-lead`,children:`Connect GitHub to list your repos.`}),n.status===`waiting`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`repo-connect-sub`,children:[`Open`,` `,(0,K.jsx)(`a`,{href:n.verificationUri||`https://github.com/login/device`,target:`_blank`,rel:`noopener`,children:(n.verificationUri||`github.com/login/device`).replace(/^https?:\/\//,``)}),` `,`and enter this code:`]}),(0,K.jsx)(`div`,{className:`repo-connect-code`,"aria-label":`Device code`,children:n.userCode||`…`}),(0,K.jsx)(`p`,{className:`repo-connect-waiting muted`,children:`Waiting for you to authorize on GitHub…`}),(0,K.jsx)(`button`,{type:`button`,className:`btn link`,onClick:()=>z.githubConnectReset(),children:`Cancel`})]}):n.status===`connected`?(0,K.jsx)(`p`,{className:`repo-connect-sub`,children:`Connected — loading your repos…`}):n.status===`unconfigured`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`repo-connect-sub`,children:`Already installed the GitHub App? Connect its key to this machine in GitHub settings. No reinstall needed.`}),(0,K.jsx)(`button`,{type:`button`,className:`btn primary block`,onClick:t,children:`Connect GitHub App to this machine`}),e.catalogs.reposReason===`gh-unauthed`&&(0,K.jsxs)(`p`,{className:`repo-connect-alt`,children:[`The GitHub CLI is installed but signed out — you can also run `,(0,K.jsx)(`code`,{children:`gh auth login`}),`.`]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`repo-connect-sub`,children:`Connect an existing GitHub App to this machine, or set up a new App.`}),(0,K.jsx)(`button`,{type:`button`,className:`btn primary block`,onClick:t,children:`Connect GitHub App to this machine`}),(0,K.jsx)(`button`,{type:`button`,className:`btn link`,disabled:n.status===`starting`,onClick:()=>z.githubConnectStart(),children:n.status===`starting`?`Starting…`:`Use GitHub device login instead`}),r&&(0,K.jsx)(`p`,{className:`repo-connect-alt`,children:r}),e.catalogs.reposReason===`gh-unauthed`&&(0,K.jsxs)(`p`,{className:`repo-connect-alt`,children:[`The GitHub CLI is installed but signed out — you can also run `,(0,K.jsx)(`code`,{children:`gh auth login`}),`.`]})]}),(0,K.jsxs)(`p`,{className:`repo-connect-note muted`,children:[`You don't need a repo to start — pick `,(0,K.jsx)(`strong`,{children:`Default workspace`}),` above to work in the machine's default workspace.`]})]})}function is({error:e}){let[t,n]=(0,G.useState)(null),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(``);(0,G.useEffect)(()=>{z.centralGithubApp().then(n).catch(e=>o(String(e?.message||e))),z.fetchGithubApp().then(e=>{let t=e.apps.find(e=>e.appId&&!e.hosted);t?.appId&&u(t.appId)}).catch(()=>{})},[]);let h=async()=>{i(!0),o(null);try{let e=await z.createCentralGithubInstall(`/`);window.location.assign(e.installUrl)}catch(e){o(String(e?.message||e)),i(!1)}},g=async()=>{i(!0),o(null);try{await z.setHostedProvisioning({githubIdentity:`central-app`}),z.listRepos()}catch(e){o(String(e?.message||e))}finally{i(!1)}},_=async()=>{i(!0),o(null);try{await z.connectHostedGithubApp({appId:l.trim(),privateKeyPem:p.trim(),...d.trim()?{installationId:d.trim()}:{}}),m(``),z.listRepos()}catch(e){o(String(e?.message||e))}finally{i(!1)}},v=!!t?.installations.length;return(0,K.jsxs)(`div`,{className:`repo-connect`,children:[(0,K.jsx)(`p`,{className:`repo-connect-lead`,children:`Connect the Bivy GitHub App for hosted Machines.`}),(0,K.jsx)(`p`,{className:`repo-connect-sub`,children:`Choose which repositories Bivy Cloud may access. This is separate from any custom GitHub App connected to a personal Machine.`}),t&&!t.configured?(0,K.jsx)(`p`,{className:`repo-connect-alt`,children:`The hosted GitHub App is not available on this deployment.`}):v?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`btn primary block`,disabled:r,onClick:()=>void g(),children:r?`Connecting…`:`Use Bivy GitHub App`}),(0,K.jsx)(`button`,{type:`button`,className:`btn link`,disabled:r,onClick:()=>void h(),children:`Add another GitHub account or organization…`})]}):(0,K.jsx)(`button`,{type:`button`,className:`btn primary block`,disabled:r||t===null,onClick:()=>void h(),children:r?`Opening GitHub…`:t===null?`Checking GitHub App…`:`Install Bivy GitHub App`}),(0,K.jsx)(`button`,{type:`button`,className:`btn link`,disabled:r,onClick:()=>c(e=>!e),children:s?`Cancel custom App setup`:`Use my GitHub App`}),s&&(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),_()},children:[(0,K.jsx)(`p`,{className:`repo-connect-note muted`,children:`Hosted Machines need an encrypted server-side copy of this App key to mint short-lived, repository-scoped tokens. Your personal Machine's copy is unchanged.`}),(0,K.jsx)(`label`,{className:`field-label`,htmlFor:`hosted-own-app-id`,children:`GitHub App ID`}),(0,K.jsx)(`input`,{id:`hosted-own-app-id`,className:`picker-search`,inputMode:`numeric`,required:!0,value:l,onChange:e=>u(e.target.value)}),(0,K.jsx)(`label`,{className:`field-label`,htmlFor:`hosted-own-app-key`,children:`Private key (.pem contents)`}),(0,K.jsx)(`textarea`,{id:`hosted-own-app-key`,className:`picker-search`,required:!0,rows:4,value:p,onChange:e=>m(e.target.value)}),(0,K.jsx)(`label`,{className:`field-label`,htmlFor:`hosted-own-installation-id`,children:`Installation ID (only when the App has multiple installations)`}),(0,K.jsx)(`input`,{id:`hosted-own-installation-id`,className:`picker-search`,inputMode:`numeric`,value:d,onChange:e=>f(e.target.value)}),(0,K.jsx)(`button`,{type:`submit`,className:`btn primary block`,disabled:r||!l.trim()||!p.trim(),children:r?`Connecting…`:`Use this App on hosted Machines`})]}),(a||e)&&(0,K.jsx)(`p`,{className:`repo-connect-alt`,children:a||e})]})}function as(){let[e,t]=(0,G.useState)(!1),[n,r]=(0,G.useState)(null),i=async()=>{t(!0),r(null);try{let e=await z.createCentralGithubInstall(`/`);window.location.assign(e.installUrl)}catch(e){r(String(e?.message||e)),t(!1)}};return(0,K.jsxs)(`div`,{className:`repo-connect-note`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn link`,disabled:e,onClick:()=>void i(),children:e?`Opening GitHub…`:`Add another GitHub account or organization…`}),n&&(0,K.jsx)(`p`,{className:`repo-connect-alt`,children:n})]})}function os({state:e,onClose:t}){let[n,r]=(0,G.useState)(``),[i,a]=(0,G.useState)(null),o=e.draft.ephemeralConfig?.computeSource===`managed`;(0,G.useEffect)(()=>{z.listRepos();let t=e.draft.repo;t&&z.listBranches(t)},[]);let{repos:s,repoTotal:c}=(0,G.useMemo)(()=>{let t=n.trim().toLowerCase(),r=t?e.catalogs.repos.filter(e=>`${e.slug} ${e.description||``}`.toLowerCase().includes(t)):e.catalogs.repos;return{repos:r.slice(0,60),repoTotal:r.length}},[e.catalogs.repos,n]);return i?(0,K.jsx)(ss,{state:e,repo:i,onBack:()=>a(null),onClose:t}):(0,K.jsxs)(ot,{title:`Repository`,onClose:t,children:[(0,K.jsx)(`input`,{className:`picker-search`,placeholder:`Search repos…`,value:n,onChange:e=>r(e.target.value)}),(0,K.jsxs)(`div`,{className:`picker-list`,children:[(0,K.jsx)(`div`,{className:`picker-section-label`,children:`This Machine`}),(0,K.jsx)(lt,{active:!e.draft.repo,title:`Default workspace`,meta:`Work in the machine's default workspace`,onClick:()=>{z.chooseRepo(null),t()}}),e.catalogs.reposLoading&&(0,K.jsx)(`div`,{className:`picker-empty`,children:`Loading repos…`}),!e.catalogs.reposLoading&&!e.catalogs.reposAuthed&&o&&(0,K.jsx)(is,{error:e.catalogs.reposError}),!e.catalogs.reposLoading&&!e.catalogs.reposAuthed&&!o&&!e.catalogs.reposError&&(0,K.jsx)(rs,{state:e,onSetup:()=>{t(),Mt(`github`)}}),!e.catalogs.reposLoading&&e.catalogs.reposError&&!o&&(0,K.jsxs)(`div`,{className:`picker-empty`,role:`alert`,children:[e.catalogs.reposError,(0,K.jsx)(`button`,{type:`button`,className:`btn link`,onClick:()=>z.listRepos(),children:`Retry`}),(0,K.jsx)(`button`,{type:`button`,className:`btn link`,onClick:()=>{t(),Mt(`github`)},children:`GitHub settings`})]}),!e.catalogs.reposLoading&&e.catalogs.reposAuthed&&!e.catalogs.reposError&&s.length===0&&(0,K.jsxs)(`div`,{className:`picker-empty`,children:[n?`No repositories match your search.`:`No repositories available. Check the App’s repository access on GitHub.`,!n&&(0,K.jsx)(`button`,{type:`button`,className:`btn link`,onClick:()=>{t(),Mt(`github`)},children:`GitHub settings`})]}),s.length>0&&(0,K.jsx)(`div`,{className:`picker-section-label`,children:`GitHub repositories`}),s.map(n=>{let r=n.slug===e.draft.repo;return(0,K.jsx)(lt,{active:r,title:n.slug,meta:[n.private?`private`:null,r?e.draft.branch?`branch: ${e.draft.branch}`:`default branch`:null,n.description].filter(Boolean).join(` · `),right:(0,K.jsx)(`button`,{type:`button`,className:`btn ghost icon repo-branch-arrow`,title:`Choose a branch of ${n.slug}`,"aria-label":`Choose a branch of ${n.slug}`,onClick:e=>{e.stopPropagation(),z.listBranches(n.slug),a(n.slug)},children:`›`}),onClick:()=>{z.chooseRepo(n.slug),t()}},n.slug)}),c>s.length&&(0,K.jsxs)(`div`,{className:`picker-empty`,children:[`Showing first `,s.length,` of `,c,` — search to narrow.`]}),o&&e.catalogs.reposAuthed&&(0,K.jsx)(as,{})]})]})}function ss({state:e,repo:t,onBack:n,onClose:r}){let[i,a]=(0,G.useState)(``),o=e.catalogs.branchesLoading||e.catalogs.branchesRepo!==t,{branches:s,branchTotal:c}=(0,G.useMemo)(()=>{let t=i.trim().toLowerCase(),n=t?e.catalogs.branches.filter(e=>e.name.toLowerCase().includes(t)):e.catalogs.branches;return{branches:n.slice(0,200),branchTotal:n.length}},[e.catalogs.branches,i]),l=e.catalogs.repos.find(e=>e.slug===t)?.defaultBranch??(e.catalogs.branchesRepo===t?e.catalogs.branchesDefault:null)??null,u=e.draft.repo===t?e.draft.branch:null,d=e=>{z.chooseRepoBranch(t,e&&e!==l?e:null),r()};return(0,K.jsxs)(ot,{title:t,onClose:r,headExtra:(0,K.jsx)(`button`,{className:`sheet-back`,onClick:n,"aria-label":`Back to repositories`,children:`‹`}),children:[(0,K.jsx)(`input`,{className:`picker-search`,placeholder:`Search branches…`,value:i,onChange:e=>a(e.target.value)}),(0,K.jsxs)(`div`,{className:`picker-list`,children:[(0,K.jsx)(lt,{active:!u,title:`Default branch${l?` (${l})`:``}`,meta:`Clone and start from the repo's default branch`,onClick:()=>d(null)}),o&&(0,K.jsx)(`div`,{className:`picker-empty`,children:`Loading branches…`}),!o&&e.catalogs.branchesError&&(0,K.jsx)(`div`,{className:`picker-empty`,children:e.catalogs.branchesError}),!o&&!e.catalogs.branchesError&&s.length===0&&i&&(0,K.jsxs)(`div`,{className:`picker-empty`,children:[`No branches match “`,i,`”.`]}),!o&&s.map(e=>(0,K.jsx)(lt,{active:e.name===u,title:e.name,meta:e.name===l?`Default`:void 0,onClick:()=>d(e.name)},e.name)),!o&&c>s.length&&(0,K.jsxs)(`div`,{className:`picker-empty`,children:[`Showing first `,s.length,` of `,c,` — search to narrow.`]})]})]})}function cs({state:e,onClose:t}){let n=e.settings.nodeSettings?.defaultSandbox,[r,i]=(0,G.useState)(!1),a=e.catalogs.runtimes.find(t=>t.id===e.catalogs.selectedAgentId),o=Pt(a),s=e.catalogs.currentAgentName||`This agent`;return(0,K.jsxs)(ot,{title:`Protection`,onClose:t,autoFocusSearch:!1,children:[!o&&(0,K.jsxs)(`div`,{className:`banner`,"data-tone":`warn`,role:`note`,children:[s,` can't ask for approval — protection choices are treated as full access.`]}),(0,K.jsxs)(`div`,{className:`picker-list`,children:[(0,K.jsx)(lt,{active:!e.draft.sandbox,title:`Machine default${n?` (${n})`:``}`,meta:`Use this machine's configured protection`,onClick:()=>{z.setSessionSandbox(null),t()}}),It.map(n=>{let a=n.id===`danger-full-access`,o=a&&r;return(0,K.jsx)(lt,{active:e.draft.sandbox===n.id,title:o?`Confirm full computer access`:n.label,meta:o?`This agent can access anything your OS user can. Bivy is not an isolation boundary. Select again to continue.`:n.hint,onClick:()=>{if(a&&!r){i(!0);return}z.setSessionSandbox(n.id),t()}},n.id)})]})]})}function ls({state:e,currentNodeId:t,onPick:n,onClose:r}){return(0,K.jsx)(ot,{title:`Open terminal on`,onClose:r,autoFocusSearch:!1,children:(0,K.jsxs)(`div`,{className:`picker-list`,children:[e.connection.nodes.length===0&&(0,K.jsx)(`div`,{className:`picker-empty`,children:`No machines available.`}),e.connection.nodes.map(e=>(0,K.jsx)(lt,{active:e.id===t,title:e.name||e.id,meta:e.online?`Online`:`Offline`,onClick:()=>n(e.id)},e.id))]})})}function us({state:e,onClose:t}){let n=!!e.activeSession.activeSessionId&&e.activeSession.transcript.some(e=>e.role===`user`),r=n?e.activeSession.activeRuntimeId??e.sessionIndex.sessions.find(t=>t.sessionId===e.activeSession.activeSessionId)?.runtimeId??null:e.catalogs.selectedAgentId??(e.catalogs.runtimes.find(e=>e.current)?.id||null),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(null),u=(0,G.useRef)(null),d=(0,G.useRef)(null);(0,G.useEffect)(()=>{z.listRuntimes(),z.prefetchModels()},[]);let f=(0,G.useMemo)(()=>$o(e.catalogs.runtimes,i),[e.catalogs.runtimes,i]),p=f.filter(Qo),m=f.filter(e=>!Qo(e)),h=e.catalogs.runtimes.find(e=>e.id===r);(0,G.useEffect)(()=>{h&&!Qo(h)&&s(!0)},[h]),(0,G.useEffect)(()=>{if(!r||d.current===r)return;let e=u.current?.querySelector(`.picker-item-row.active`);e&&(e.scrollIntoView({block:`center`}),d.current=r)},[r,f.length,o]);let g=c?e.catalogs.runtimes.find(e=>e.id===c):void 0,_=(e,t)=>{(n?void 0:ns(e))?.requiresAcknowledgement&&z.acknowledgeSessionAgentReducedProtections(!0),n?z.chooseAgent(e,()=>new Promise(e=>t(e))):t(()=>z.chooseAgent(e))},v=(t,i)=>{let a=String(t.status||`available`)===`available`,o=!a&&!!t.install,s=e.catalogs.installingRuntimeId===t.id,c=t.id===r,u=n?void 0:ns(t),d=!n&&!!u?.requiresAcknowledgement,f=String(t.description||``);return(0,K.jsx)(lt,{active:c,title:es(t),meta:[s?`Setting up…`:a?n?`Fork and hand off`:null:o?`Install required`:`Needs sign-in`,f].filter(Boolean).join(` · `),disabled:s||!a&&!o,right:o&&!s?(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost`,onClick:e=>{e.stopPropagation(),z.installAgent(t.id)},children:`Install`}):void 0,onClick:()=>{if(o){z.installAgent(t.id);return}if(a){if(d){l(t.id);return}_(t,i)}}},t.id)};return(0,K.jsx)(ot,{title:n?`Hand off to agent`:`Agent`,onClose:t,autoFocusSearch:!1,size:`large`,children:e=>(0,K.jsxs)(K.Fragment,{children:[n&&(0,K.jsx)(`div`,{className:`picker-empty`,children:`Choosing an agent forks this session with its transcript and working files, then opens the fork in that agent.`}),(0,K.jsx)(`input`,{className:`picker-search`,placeholder:`Search agents…`,value:i,onChange:e=>{a(e.target.value),l(null)}}),(0,K.jsxs)(`div`,{className:`picker-list`,ref:u,children:[f.length===0&&(0,K.jsx)(`div`,{className:`picker-empty`,children:`No agents available.`}),p.length>0&&(0,K.jsx)(`div`,{className:`picker-section-label`,children:`Recommended`}),p.map(t=>v(t,e)),m.length>0&&(0,K.jsxs)(`button`,{type:`button`,className:`picker-section-toggle`,onClick:()=>s(e=>!e),"aria-expanded":o||!!i.trim(),children:[`More agents `,(0,K.jsx)(`span`,{"aria-hidden":!0,children:o||i.trim()?`▾`:`▸`})]}),(o||!!i.trim())&&m.map(t=>v(t,e))]}),g&&(0,K.jsx)(B,{title:`Check how ${es(g)} runs`,message:`Bivy couldn't check which sign-in this agent will use or guarantee its protection level.`,confirmLabel:`Use ${es(g)}`,onCancel:()=>l(null),onConfirm:()=>_(g,e)})]})})}function ds({state:e}){let[t,n]=(0,G.useState)(!1),r=(0,G.useRef)(null);rt(()=>n(!1),t),(0,G.useEffect)(()=>{if(!t)return;let e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[t]);let i=e.catalogs.thinking;if(!i.supportsThinking||!i.availableThinkingLevels||i.availableThinkingLevels.length<=1)return null;let a=ts[i.thinkingLevel]||i.thinkingLevel;return(0,K.jsxs)(`div`,{className:`reasoning-wrap`,ref:r,children:[(0,K.jsxs)(`button`,{className:`reasoning-pill`,onClick:()=>n(e=>!e),children:[`✦ `,a,` `,t?`▾`:`▸`]}),t&&(0,K.jsx)(`div`,{className:`menu reasoning-menu`,role:`menu`,children:i.availableThinkingLevels.map(e=>(0,K.jsx)(`button`,{className:`menu-item reasoning-opt${e===i.thinkingLevel?` active`:``}`,role:`menuitemradio`,"aria-checked":e===i.thinkingLevel,onClick:()=>{z.setThinkingLevel(e),n(!1)},children:ts[e]||e},e))})]})}function fs(e,t){let n=e.contextWindow;return[e.provider,t,n?`${Math.round(n/1e3)}k ctx`:null].filter(Boolean).join(` · `)}function ps({state:e,onClose:t}){let[n,r]=(0,G.useState)(``),[i,a]=(0,G.useState)(null),o=(0,G.useRef)(null),s=(0,G.useRef)(null);(0,G.useEffect)(()=>{i||o.current?.focus()},[i]);let[c,l]=(0,G.useState)(null),u=()=>{z.listModels(),z.listProviders(),z.listCredentialRecords(),z.getCredentialPresets()};(0,G.useEffect)(u,[e.connection.currentNodeId]);let[d,f]=(0,G.useState)(!1),p=`${e.catalogs.modelsRuntimeId??``}:${e.catalogs.models.length}:${e.catalogs.models.map(e=>e.id).join(`,`)}`;(0,G.useEffect)(()=>{d&&f(!1)},[p]),(0,G.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>f(!1),2500);return()=>clearTimeout(e)},[d]),(0,G.useEffect)(()=>{c&&e.catalogs.providers.find(e=>e.id===c)?.configured&&(z.listModels(),l(null))},[c,e.catalogs.providers]);let m=t=>e.catalogs.providers.find(e=>e.id===t)?.name||t,h=(0,G.useMemo)(()=>{let t=n.trim().toLowerCase();return t?e.catalogs.models.filter(e=>`${e.id} ${e.label||``} ${e.provider||``} ${m(String(e.provider||``))}`.toLowerCase().includes(t)):e.catalogs.models},[e.catalogs.models,e.catalogs.providers,n]),g=h.filter(e=>e.configured!==!1),_=h.filter(e=>e.configured===!1),v=t=>e.catalogs.currentModel!=null&&t.id===e.catalogs.currentModel.id&&t.provider===e.catalogs.currentModel.provider;return i?(0,K.jsx)(Yo,{state:e,model:i,onClose:()=>a(null)}):c?(0,K.jsx)(ot,{title:m(c),onClose:t,size:`large`,headExtra:(0,K.jsx)(`button`,{className:`sheet-back`,onClick:()=>l(null),"aria-label":`Back`,children:`‹`}),children:(0,K.jsx)(Ft,{state:e,providerId:c})}):(0,K.jsxs)(ot,{title:`Model`,ariaLabel:`Model`,onClose:t,headExtra:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ds,{state:e}),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost icon`,onClick:()=>{f(!0),u()},disabled:d,"aria-label":`Refresh models`,title:`Refresh models`,children:d?(0,K.jsx)(Ct,{size:`xs`}):(0,K.jsx)(Ue,{size:18})}),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost icon`,onClick:()=>{t(),Mt(`providers`)},"aria-label":`Model and provider settings`,title:`Model and provider settings`,children:(0,K.jsx)(ft,{size:18})})]}),autoFocusSearch:!1,size:`large`,children:[(0,K.jsx)(`input`,{className:`picker-search`,placeholder:`Search models…`,value:n,onChange:e=>r(e.target.value)}),(0,K.jsxs)(`div`,{className:`picker-list`,children:[g.length===0&&_.length===0&&(0,K.jsx)(`div`,{className:`picker-empty`,children:`No models available.`}),g.map(n=>{let r=String(n.provider||``),i=e.settings.credentialRecords.filter(e=>e.provider===r),c=Jo(r,i,e.settings.credentialPresets,qo(e)),l=i.length?c.label||(e.settings.credentialPresets?`Choose account`:`Loading account…`):void 0;return(0,K.jsx)(lt,{active:v(n),title:n.label||n.id,meta:fs(n,l),right:i.length>1?(0,K.jsx)(`button`,{type:`button`,className:`btn ghost icon`,"aria-label":`Change account for ${n.label||n.id}`,ref:s.current===`${r}:${n.id}`?o:void 0,onClick:()=>{s.current=`${r}:${n.id}`,a(n)},children:(0,K.jsx)($e,{})}):void 0,onClick:()=>{z.chooseModel(n),t()}},`${n.provider||``}:${n.id}`)}),_.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`picker-section-label`,children:`Other models`}),_.map(e=>{let t=String(e.provider||``),n=m(t),r=Number(e.modelCount)||0;return(0,K.jsx)(lt,{title:n,meta:`${r} model${r===1?``:`s`} · Not connected`,right:(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost`,onClick:e=>{e.stopPropagation(),l(t)},children:`Connect`}),onClick:()=>l(t)},`${t}:${e.id}`)})]})]})]})}function ms(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function hs(e){let t=new Date(e),n=t.toDateString()===new Date().toDateString(),r=t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`});return n?`Sends today at ${r}`:`Sends ${t.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})} at ${r}`}function gs(e,t){if(e.status===`scheduled`)return e.scheduledAt==null?`Scheduled`:hs(e.scheduledAt);if(e.status===`sending`)return`Sending…`;if(e.status===`failed`)return`Failed — will retry`;let n=`Queued · #${t+1}`;return e.scheduledAutomationId?`${n} · sends on close`:n}function _s(e){return String(e).padStart(2,`0`)}function vs(e){return`${e.getFullYear()}-${_s(e.getMonth()+1)}-${_s(e.getDate())}T${_s(e.getHours())}:${_s(e.getMinutes())}`}function ys({sessionId:e,item:t,position:n,count:r,canSteer:i,busy:a,onError:o}){let[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(t.text),[d,f]=(0,G.useState)(t.attachments??[]),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(()=>t.scheduledAt==null?vs(new Date):vs(new Date(t.scheduledAt))),_=t.status===`scheduled`,v=t.status!==`queued`&&!_,[y,b]=(0,G.useState)(!1),x=async()=>{b(!0);try{await z.startSessionLike(e,t.text,t.attachments),z.removeFollowup(e,t.id)}catch(e){o?.(e instanceof Error?e.message:String(e)),b(!1)}};function S(){v||(u(t.text),f(t.attachments??[]),c(!0))}function C(){c(!1)}function w(){let n=l.trim();if(!n&&d.length===0){o?.(`A follow-up needs some text or an attachment.`);return}let r=z.editFollowup(e,t.id,{text:n,attachments:d.length?d:void 0},t.version);if(!r.ok){let e=r.reason===`stale`?`This follow-up changed elsewhere — refresh and try again.`:r.reason===`not_queued`?`This follow-up is already sending — it can no longer be edited.`:`This follow-up is gone — it may have already been sent.`;o?.(e)}c(!1)}function T(e){f(t=>t.filter((t,n)=>n!==e))}function E(){_&&(g(t.scheduledAt==null?vs(new Date):vs(new Date(t.scheduledAt))),m(!0))}function D(){m(!1)}function O(){let n=new Date(h);if(!Number.isFinite(n.getTime())||n.getTime()<=Date.now()){o?.(`Pick a time in the future.`);return}(async()=>{let r=await z.editScheduledFollowup(e,t.id,n);r?o?.(r):m(!1)})()}let k=a&&i?`Steer now`:`Send next`;return(0,K.jsx)(`div`,{className:`card followup-card${s||p?` editing`:``}${v?` locked`:``}`,"data-tone":`muted`,role:`listitem`,children:s||p?(0,K.jsxs)(`div`,{className:`followup-edit`,children:[p?(0,K.jsxs)(`label`,{className:`schedule-field`,children:[(0,K.jsx)(`span`,{className:`schedule-label`,children:`Send at`}),(0,K.jsx)(`input`,{type:`datetime-local`,className:`field`,value:h,min:vs(new Date),autoFocus:!0,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),D()):e.key===`Enter`&&(e.preventDefault(),O())}})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`textarea`,{className:`field followup-edit-input`,value:l,autoFocus:!0,rows:2,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),C()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),w())}}),d.length>0&&(0,K.jsx)(`div`,{className:`attach-chips`,children:d.map((e,t)=>(0,K.jsxs)(`span`,{className:`attach-chip`,title:e.name,children:[(0,K.jsx)(`span`,{className:`attach-glyph`,children:e.kind===`image`?`🖼`:`📄`}),(0,K.jsx)(`span`,{className:`attach-name`,children:e.name}),(0,K.jsx)(`button`,{type:`button`,className:`attach-remove`,onClick:()=>T(t),"aria-label":`Remove ${e.name}`,children:`✕`})]},`${e.name}-${t}`))})]}),(0,K.jsxs)(`div`,{className:`followup-edit-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`queue-action-btn`,onClick:p?D:C,children:`Cancel`}),(0,K.jsx)(`button`,{type:`button`,className:`queue-action-btn active`,onClick:p?O:w,children:`Save`})]})]}):(0,K.jsxs)(`div`,{className:`followup-card-row`,tabIndex:v?-1:0,role:`group`,"aria-label":_?`Scheduled message`:`Follow-up ${n+1} of ${r}`,onKeyDown:r=>{if(!v){if(_){r.key===`Enter`?(r.preventDefault(),E()):(r.key===`Delete`||r.key===`Backspace`)&&(r.preventDefault(),z.removeFollowup(e,t.id));return}r.key===`ArrowUp`?(r.preventDefault(),z.reorderFollowup(e,t.id,n-1)):r.key===`ArrowDown`?(r.preventDefault(),z.reorderFollowup(e,t.id,n+1)):r.key===`Enter`?(r.preventDefault(),S()):(r.key===`Delete`||r.key===`Backspace`)&&(r.preventDefault(),z.removeFollowup(e,t.id))}},children:[!_&&(0,K.jsxs)(`div`,{className:`followup-reorder`,children:[(0,K.jsx)(`button`,{type:`button`,className:`queue-action-btn icon`,disabled:v||n===0,onClick:()=>z.reorderFollowup(e,t.id,n-1),"aria-label":`Move earlier`,title:`Move earlier`,children:`▲`}),(0,K.jsx)(`button`,{type:`button`,className:`queue-action-btn icon`,disabled:v||n===r-1,onClick:()=>z.reorderFollowup(e,t.id,n+1),"aria-label":`Move later`,title:`Move later`,children:`▼`})]}),(0,K.jsxs)(`div`,{className:`followup-body`,children:[(0,K.jsx)(`div`,{className:`followup-status`,children:gs(t,n)}),(0,K.jsx)(`div`,{className:`followup-text`,children:t.text||`(attachment only)`}),t.attachments&&t.attachments.length>0&&(0,K.jsx)(`div`,{className:`followup-attachments`,children:t.attachments.map((e,t)=>(0,K.jsxs)(`span`,{className:`attach-chip`,title:e.name,children:[(0,K.jsx)(`span`,{className:`attach-glyph`,children:e.kind===`image`?`🖼`:`📄`}),(0,K.jsx)(`span`,{className:`attach-name`,children:e.name}),(0,K.jsx)(`span`,{className:`attach-size`,children:ms(e.size)})]},`${e.name}-${t}`))})]}),(0,K.jsx)(`div`,{className:`followup-card-actions`,children:_?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`queue-action-btn icon`,onClick:E,"aria-label":`Change scheduled time`,title:`Change time`,children:`✎`}),(0,K.jsx)(`button`,{type:`button`,className:`queue-action-btn icon danger`,onClick:()=>z.removeFollowup(e,t.id),"aria-label":`Cancel scheduled message`,title:`Cancel`,children:`✕`})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`queue-action-btn icon`,disabled:v,onClick:S,"aria-label":`Edit follow-up`,title:`Edit`,children:`✎`}),(0,K.jsx)(`button`,{type:`button`,className:`queue-action-btn icon danger`,disabled:v,onClick:()=>z.removeFollowup(e,t.id),"aria-label":`Remove follow-up`,title:`Remove`,children:`✕`}),(0,K.jsx)(`button`,{type:`button`,className:`queue-action-btn`,disabled:v||y,onClick:()=>void x(),title:`Start this now in its own session; this one keeps working`,children:y?`Starting…`:`Run in new session`}),(0,K.jsx)(`button`,{type:`button`,className:`queue-action-btn`,disabled:v||y,onClick:()=>z.sendFollowupNow(e,t.id),title:k,children:k})]})})]})})}function bs({sessionId:e,items:t,canSteer:n,busy:r,onError:i}){if(!t.length)return null;let a=t.filter(e=>e.status===`queued`).length,o=t.filter(e=>e.status===`scheduled`).length,s=a>0?`${a} follow-up${a>1?`s`:``} queued${o?` · ${o} scheduled`:``}`:`${o} scheduled message${o>1?`s`:``}`;return(0,K.jsxs)(`div`,{className:`followup-queue`,children:[(0,K.jsx)(`div`,{className:`followup-queue-head`,children:(0,K.jsx)(`span`,{children:s})}),(0,K.jsx)(`div`,{className:`followup-list`,role:`list`,children:t.map((a,o)=>(0,K.jsx)(ys,{sessionId:e,item:a,position:o,count:t.length,canSteer:n,busy:r,onError:i},a.id))})]})}function xs(e,t,n,r){let i=e?.draft;if(i&&i.device.id!==t.id&&n&&r-i.at<18e5)return{from:i.device.label,text:i.text,at:i.at}}function Ss(e){let{connection:t}=je(),n=t.status===`online`,[r,i]=(0,G.useState)();return(0,G.useEffect)(()=>{if(i(void 0),!e||!n)return;let t=!0,r=()=>z.getPresence(e).then(e=>{t&&i(e)},()=>{});r();let a=()=>{document.visibilityState===`visible`&&r()};document.addEventListener(`visibilitychange`,a);let o=z.onPresence(n=>{t&&n.sessionId===e&&i(n)});return()=>{t=!1,o(),document.removeEventListener(`visibilitychange`,a)}},[e,n,t.currentNodeId]),r}function Cs(e){let t=e.trim().split(`
|
|
14
|
-
`)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function ws({handoff:e,onContinue:t}){return(0,K.jsxs)(`div`,{className:`banner handoff-banner`,"data-tone":`neutral`,role:`status`,children:[(0,K.jsxs)(`span`,{className:`banner-text`,children:[(0,K.jsxs)(`strong`,{children:[`Unsent draft from `,e.from,` · `,wt(e.at)]}),(0,K.jsx)(`span`,{className:`handoff-preview`,children:Cs(e.text)})]}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm banner-action`,onClick:t,children:`Continue draft`})]})}function Ts({sessionId:e,composerEmpty:t,onUseDraft:n}){let r=Ss(e),[i,a]=(0,G.useState)(``),o=xs(r,fe(),t,Date.now());if(!o)return null;let s=`${e}:${o.at}`;return i===s?null:(0,K.jsx)(ws,{handoff:o,onContinue:()=>{n(o.text),a(s)}})}function Es({standby:e,onContinueHere:t,onOpenOnOwner:n}){let[r,i]=(0,G.useState)(!1);return e.ownerOnline?(0,K.jsxs)(`div`,{className:`banner handoff-banner`,"data-tone":`neutral`,role:`status`,children:[(0,K.jsx)(`span`,{className:`banner-text`,children:(0,K.jsxs)(`strong`,{children:[`Standby copy. This session is live on `,e.ownerName,`.`]})}),(0,K.jsxs)(`button`,{type:`button`,className:`btn sm banner-action`,onClick:n,children:[`Open on `,e.ownerName]})]}):(0,K.jsxs)(`div`,{className:`banner handoff-banner`,"data-tone":`warn`,role:`status`,children:[(0,K.jsxs)(`span`,{className:`banner-text`,children:[(0,K.jsxs)(`strong`,{children:[e.ownerName,` is offline.`]}),(0,K.jsx)(`span`,{children:`This machine has a standby copy, up to its last finished turn.`})]}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm banner-action`,disabled:r,"aria-busy":r,onClick:()=>{i(!0),t().finally(()=>i(!1))},children:r?`Continuing…`:`Continue here`})]})}function Ds(e,t){if(!e?.startsWith(`replica`))return;let n=e.slice(8),r=n?t.find(e=>e.id===n):void 0;return{ownerId:n,ownerName:r?.name||`another machine`,ownerOnline:!!r?.online}}var Os=10485760,ks=12,As=41943040,js=524288,Ms=1500,Ns=/\.(md|txt|json|ya?ml|csv|ts|tsx|js|jsx|css|html|xml|py|rb|go|rs|java|c|cpp|h|hpp|sh|sql)$/i;function Ps(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}function Fs(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error),r.readAsText(e)})}function Is(){return typeof window<`u`&&window.matchMedia(`(max-width: 720px)`).matches}function Ls(e){if(typeof document>`u`)return!0;let t=document.activeElement;if(!t||t===document.body||t===e)return!0;let n=t.tagName;return!(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t.isContentEditable||t.closest?.(`[role="dialog"], .settings-modal`))}function Rs(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function zs(e){return e.kind!==`image`||!e.data?null:`data:${e.mimeType||`image/png`};base64,${e.data}`}function Bs(e){return!!(e&&Array.from(e.types||[]).includes(`Files`))}function Vs(){return(0,K.jsx)(`svg`,{className:`pill-gh`,viewBox:`0 0 16 16`,width:`14`,height:`14`,fill:`currentColor`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z`})})}function Hs(){return(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`19`,height:`19`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,K.jsx)(`path`,{d:`M12 15.5a3 3 0 003-3V6a3 3 0 10-6 0v6.5a3 3 0 003 3z`}),(0,K.jsx)(`path`,{d:`M6 11.5v1a6 6 0 0012 0v-1M12 18.5V21M9 21h6`})]})}function Us(){return(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`})})}function Ws(){return(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`8`,r:`3`}),(0,K.jsx)(`path`,{d:`M5.5 20a6.5 6.5 0 0 1 13 0`})]})}function Gs(){return(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,K.jsx)(`path`,{d:`m12 3 1.4 4.1L17.5 8.5l-4.1 1.4L12 14l-1.4-4.1-4.1-1.4 4.1-1.4L12 3Z`}),(0,K.jsx)(`path`,{d:`m18.5 14 .8 2.2 2.2.8-2.2.8-.8 2.2-.8-2.2-2.2-.8 2.2-.8.8-2.2Z`})]})}function Ks(e,t){let[n,...r]=e.split(` `),i=t.split(` `)[0];return r.length&&n&&i&&n.toLowerCase()===i.toLowerCase()?r.join(` `):e}function qs({state:e,disabled:t,disabledHint:n,working:r,onSend:i,onAbort:a,onError:o}){let s=(0,G.useRef)(null);s.current||=p(localStorage,e.activeSession.activeSessionId);let[c,l]=(0,G.useState)(()=>s.current?.text??``),[u,d]=(0,G.useState)(null),[m,h]=(0,G.useState)(()=>s.current?.attachments??[]),[_,v]=(0,G.useState)(()=>s.current?.recovered??[]),[y,x]=(0,G.useState)(0),[S,C]=(0,G.useState)(!1),[T,E]=(0,G.useState)(null),[D,O]=(0,G.useState)(!1),[k,A]=(0,G.useState)(!1),[ee,j]=(0,G.useState)(!1),[te,M]=(0,G.useState)(0),[P,F]=(0,G.useState)(null),I=(0,G.useRef)(0);(0,G.useEffect)(()=>{if(!r){A(!1),j(!1);return}if(!k)return;let e=window.setTimeout(()=>j(!0),1e4);return()=>window.clearTimeout(e)},[k,r]);let re=()=>{k||(A(!0),j(!1),a())},ie=e.catalogs.runtimes.find(t=>t.id===(e.activeSession.activeRuntimeId??e.catalogs.selectedAgentId)),oe=ie?.capabilities,se=!!e.sessionIndex.sessions.find(t=>t.sessionId===e.activeSession.activeSessionId)?.pendingLaunch,ce=!se&&oe?.modelSelection!==!1,le=e.activeSession.activeSessionId?e.sessionIndex.commandsBySession[e.activeSession.activeSessionId]:void 0,ue=Array.isArray(oe?.commands)?oe.commands:[],de=le??(e.activeSession.activeSessionId?[]:ue),L=e.activeSession.activeSessionId?e.sessionIndex.followupsBySession[e.activeSession.activeSessionId]??[]:[],R=z.supportsSteering(),fe=(0,G.useRef)(null),pe=(0,G.useRef)(null),me=(0,G.useRef)(null),he=!e.activeSession.activeSessionId,ge=Ds(e.sessionIndex.sessions.find(t=>t.sessionId===e.activeSession.activeSessionId)?.source,e.connection.nodes),_e=(0,G.useRef)(w(e.activeSession.activeSessionId)),ve=(0,G.useRef)(e.activeSession.activeSessionId),ye=(0,G.useRef)(c),be=(0,G.useRef)(m),xe=(0,G.useRef)(_);(0,G.useEffect)(()=>{ye.current=c},[c]),(0,G.useEffect)(()=>{be.current=m},[m]),(0,G.useEffect)(()=>{xe.current=_},[_]),(0,G.useEffect)(()=>{let t=w(e.activeSession.activeSessionId);if(_e.current===t)return;b(localStorage,ve.current,ye.current,[...be.current,...xe.current]),f(ve.current,be.current);let n=p(localStorage,e.activeSession.activeSessionId);l(n.text),h(n.attachments),v(n.recovered),C(!1),x(0),requestAnimationFrame(ke),_e.current=t,ve.current=e.activeSession.activeSessionId},[e.activeSession.activeSessionId]),(0,G.useEffect)(()=>{b(localStorage,ve.current,c,[...m,..._]),f(ve.current,m),Ce({hasDraft:!!c.trim(),pendingAttachments:m.length+_.length,readingAttachments:te>0})},[c,m,_,te]),(0,G.useEffect)(()=>()=>Ce({hasDraft:!1,pendingAttachments:0,readingAttachments:!1}),[]);let Se=(0,G.useRef)(new Map);(0,G.useEffect)(()=>{let t=e.activeSession.activeSessionId;if(!t)return;let n=setTimeout(()=>{(Se.current.get(t)??``)!==c&&(Se.current.set(t,c),z.publishDraft(t,c))},Ms);return()=>clearTimeout(n)},[c,e.activeSession.activeSessionId]),(0,G.useLayoutEffect)(()=>{ke()},[c]),(0,G.useEffect)(()=>{let e=me.current;if(!e||typeof ResizeObserver>`u`)return;let t=document.documentElement,n=()=>t.style.setProperty(`--composer-h`,`${Math.round(e.offsetHeight)}px`);n();let r=new ResizeObserver(n);return r.observe(e),()=>{r.disconnect(),t.style.removeProperty(`--composer-h`)}},[]);let we=(0,G.useRef)(!1);(0,G.useEffect)(()=>{!t&&we.current&&Ls(fe.current)&&fe.current?.focus()},[t]),(0,G.useEffect)(()=>z.onComposerFocus(()=>{we.current=!0,requestAnimationFrame(()=>{Ls(fe.current)&&fe.current?.focus()})}),[]),(0,G.useEffect)(()=>z.onComposerPrefill((e,t)=>{let n=e.trim();t.length&&h(e=>[...e,...t]),(n||t.length)&&(n&&l(e=>e.trim()?`${e.trimEnd()}\n\n${n}`:n),C(!1),we.current=!0,requestAnimationFrame(()=>{ke();let e=fe.current;Ls(e)&&(e?.focus(),e?.setSelectionRange(e.value.length,e.value.length))}))}),[]),(0,G.useEffect)(()=>z.onOpenSlash(()=>{l(e=>e.trimStart().startsWith(`/`)?e:`/`),C(!1),x(0),we.current=!0,requestAnimationFrame(()=>{ke(),Ls(fe.current)&&fe.current?.focus()})}),[]),rt(()=>F(null),!!P),(0,G.useEffect)(()=>{!t&&!e.settings.sttConfig&&z.getSttConfig()},[t,e.settings.sttConfig]);function Te(){if(t)return;let n=yt(e.settings.sttConfig);n?E(n):o?.(ht)}function Ee(e){let t=e.trim();t&&(l(e=>`${e}${e&&!/\s$/.test(e)?` `:``}${t}`),requestAnimationFrame(()=>{ke(),fe.current?.focus()}))}let De=!t&&!S?ne(c,de):[],Oe=(()=>{if(t||S)return!1;let e=c.trimStart();return e.startsWith(`/`)&&!/\s/.test(e)})()&&De.length===0;function ke(){let e=fe.current;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,200)+`px`)}async function Ae(e){if(e&&e.length){M(e=>e+1);try{let t=[],n=m.reduce((e,t)=>e+Number(t.size||0),0),r=m.length;for(let i of Array.from(e)){if(r>=ks){o?.(`A message can include at most ${ks} attachments.`);break}if(i.size>Os){o?.(`${i.name} is larger than ${Rs(Os)} and was not attached.`);continue}if(n+i.size>As){o?.(`Attachments are limited to ${Rs(As)} per message.`);continue}n+=i.size,r+=1;try{if(i.type.startsWith(`image/`)){let e=await Ps(i),n=e.includes(`,`)?e.split(`,`).pop()||``:e;t.push({kind:`image`,name:i.name,size:i.size,mimeType:i.type||`image/png`,data:n});continue}if(!(i.type.startsWith(`text/`)||Ns.test(i.name))){let e=await Ps(i),n=e.includes(`,`)?e.split(`,`).pop()||``:e;t.push({kind:`file`,name:i.name,size:i.size,mimeType:i.type||`application/octet-stream`,data:n});continue}let e=await Fs(i);t.push({kind:`file`,name:i.name,size:i.size,mimeType:i.type||`text/plain`,text:e.slice(0,js),truncated:e.length>js})}catch{n-=i.size,--r,o?.(`Could not read ${i.name}.`)}}t.length&&(h(e=>[...e,...t]),v(e=>e.filter(e=>!t.some(t=>t.name===e.name)))),pe.current&&(pe.current.value=``)}finally{M(e=>Math.max(0,e-1))}}}function je(e){h(t=>t.filter((t,n)=>n!==e))}function Me(){g(localStorage,ve.current),l(``),h([]),v([]),C(!1),x(0),requestAnimationFrame(ke)}function Ne(e,t){e.mode===`protocol`?z.invokeAgentCommand(e.name,t):i(t?`${e.name} ${t}`:e.name)}function Pe(e){l(`${e.name} `),C(!0),x(0),requestAnimationFrame(()=>{ke(),fe.current?.focus()})}function Fe(){let n=c.trim();if(!n&&!m.length||t)return;let r=e.catalogs.currentModel?.id||e.catalogs.currentModelId;if(he&&ce&&(!r||r===`unknown`)){d(`model`);return}if(N(n)){let e=ae(n);if(e){let t=He(e,de);if(t.kind===`agent`){Ne(t.command,t.args),Me();return}if(t.hasCatalog){o?.(`Unknown command ${t.name}. Type / to see this agent's commands.`);return}}}i(n,m.length?m:void 0),l(``),h([]),requestAnimationFrame(ke)}let Ie=se?`Choose model`:e.catalogs.currentModel?.label||e.catalogs.currentModel?.id||`Choose a model`,Le=String(ie?.displayName||ie?.name||ie?.id||e.catalogs.currentAgentName||`Choose an agent`),Re=e.draft.repo?e.draft.branch?`${e.draft.repo} @ ${e.draft.branch}`:e.draft.repo:`Choose repository`,ze=e.draft.repo?e.draft.branch?`Repository ${e.draft.repo} (branch ${e.draft.branch})`:`Repository ${e.draft.repo} (default branch)`:`Choose repository`,Be=It.find(t=>t.id===e.draft.sandbox),Ve=It.find(t=>t.id===e.settings.nodeSettings?.defaultSandbox),Ue=Be?Be.label:Ve?Ve.label:e.settings.nodeSettings?.defaultSandbox??`Default`,We=e.catalogs.runtimes.find(t=>t.id===e.catalogs.selectedAgentId),Ge=Pt(We)?Be?Be.hint:`Protection for this session (machine default)`:`${e.catalogs.currentAgentName||`This agent`} can't ask for approval — treated as full access`,Ke=!t&&(!!c.trim()||m.length>0),qe=he&&!!e.draft.ephemeralConfig;return(0,K.jsxs)(K.Fragment,{children:[he&&(0,K.jsxs)(`div`,{className:`composer-lead`,"aria-label":`Session setup`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`btn sm ghost repo-pill`,onClick:()=>d(`repo`),title:ze,children:[(0,K.jsx)(Vs,{}),(0,K.jsx)(`span`,{className:`pill-label`,children:Re})]}),(0,K.jsxs)(`button`,{type:`button`,className:`btn sm ghost sandbox-pill`,onClick:()=>d(`sandbox`),title:Ge,"aria-label":`Protection: ${Ue}`,children:[(0,K.jsx)(`span`,{className:`pill-glyph`,children:`◈`}),(0,K.jsx)(`span`,{className:`pill-label`,children:Ue})]})]}),ge&&e.activeSession.activeSessionId&&(()=>{let t=e.activeSession.activeSessionId;return(0,K.jsx)(Es,{standby:ge,onOpenOnOwner:()=>z.openSessionOnNode(t,void 0,ge.ownerId),onContinueHere:async()=>{try{await z.promoteSession(t,e.connection.currentNodeId??``),z.store.setNotice(`Continuing this session on this machine.`)}catch(e){z.store.setError(e instanceof Error?e.message:String(e))}}})})(),e.activeSession.activeSessionId&&(0,K.jsx)(Ts,{sessionId:e.activeSession.activeSessionId,composerEmpty:!c.trim(),onUseDraft:e=>{l(e),requestAnimationFrame(()=>{ke(),fe.current?.focus()})}}),e.activeSession.activeSessionId&&(0,K.jsx)(bs,{sessionId:e.activeSession.activeSessionId,items:L,canSteer:R,busy:r,onError:o}),ee&&(0,K.jsxs)(`div`,{className:`banner`,"data-tone":`warn`,role:`alert`,children:[(0,K.jsx)(`span`,{className:`banner-text`,children:`The agent didn't confirm it stopped.`}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm banner-action`,onClick:()=>location.reload(),children:`Reload`})]}),(0,K.jsx)(`form`,{ref:me,className:`composer`,onSubmit:e=>{e.preventDefault(),Fe()},children:(0,K.jsxs)(`div`,{className:`composer-card${D?` dragging`:``}`,onDragEnter:e=>{!t&&Bs(e.dataTransfer)&&(e.preventDefault(),I.current+=1,O(!0))},onDragOver:e=>{!t&&Bs(e.dataTransfer)&&e.preventDefault()},onDragLeave:()=>{I.current!==0&&(--I.current,I.current===0&&O(!1))},onDrop:e=>{!t&&Bs(e.dataTransfer)&&(e.preventDefault(),I.current=0,O(!1),Ae(e.dataTransfer.files))},children:[D&&(0,K.jsx)(`div`,{className:`composer-drop`,"aria-hidden":!0,children:(0,K.jsx)(`span`,{children:`Drop files to attach`})}),De.length>0&&(0,K.jsx)(`div`,{className:`menu slash-menu`,role:`listbox`,"aria-label":`Commands`,children:De.map((e,t)=>{let n=Math.min(y,De.length-1);return(0,K.jsxs)(`button`,{type:`button`,className:`menu-item slash-item${t===n?` active`:``}`,role:`option`,"aria-selected":t===n,onMouseDown:t=>{t.preventDefault(),Pe(e)},children:[(0,K.jsx)(`span`,{className:`slash-name`,children:e.name}),(0,K.jsx)(`span`,{className:`slash-desc`,children:e.description})]},e.name)})}),Oe&&(0,K.jsx)(`div`,{className:`menu slash-menu slash-empty`,role:`status`,children:de.length===0?`This agent has no slash commands.`:`No matching command — press Esc to send as a message.`}),_.length>0&&(0,K.jsxs)(`div`,{className:`attachment-recovery`,role:`status`,children:[(0,K.jsxs)(`span`,{children:[`Reload preserved metadata for `,_.map(e=>e.name).join(`, `),`, not file contents. Re-select before sending.`]}),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>v([]),children:`Clear`})]}),(m.length>0||te>0)&&(0,K.jsxs)(`div`,{className:`attach-chips`,children:[te>0&&(0,K.jsxs)(`span`,{className:`attach-chip reading`,"aria-live":`polite`,children:[(0,K.jsx)(Ct,{size:`xs`}),`Reading file`,te>1?`s`:``,`…`]}),m.map((e,t)=>{let n=zs(e);return(0,K.jsxs)(`span`,{className:`attach-chip${e.omitted?` omitted`:``}${n?` has-thumb`:``}`,title:e.omitted?`File could not be read — not attached`:e.name,children:[n?(0,K.jsx)(`button`,{type:`button`,className:`attach-thumb-btn`,onClick:()=>F(n),"aria-label":`View ${e.name}`,title:`View ${e.name}`,children:(0,K.jsx)(`img`,{className:`attach-thumb`,src:n,alt:e.name})}):(0,K.jsx)(`span`,{className:`attach-glyph`,children:e.kind===`image`?`🖼`:`📄`}),(0,K.jsx)(`span`,{className:`attach-name`,children:e.name}),(0,K.jsx)(`button`,{type:`button`,className:`attach-remove`,onClick:()=>je(t),"aria-label":`Remove ${e.name}`,children:`✕`})]},`${e.name}-${t}`)})]}),T&&(0,K.jsx)(Tt,{engine:T,onResult:Ee,onCancel:()=>E(null),onError:e=>o?.(e)}),(0,K.jsx)(`textarea`,{ref:fe,className:`composer-input`,placeholder:t?n||`Connecting…`:qe?`Describe your first task…`:`Message your agent…`,rows:2,hidden:!!T,value:c,disabled:t,onFocus:()=>{we.current=!0},onBlur:()=>{t||(we.current=!1)},onPaste:e=>{let t=e.clipboardData?.files;t&&t.length&&Array.from(t).some(e=>e.type.startsWith(`image/`))&&(e.preventDefault(),Ae(t))},onChange:e=>{l(e.target.value),C(!1),x(0),ke()},onKeyDown:e=>{if(De.length>0){if(e.key===`ArrowDown`){e.preventDefault(),x(e=>Math.min(e+1,De.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),x(e=>Math.max(e-1,0));return}if(e.key===`Escape`){e.preventDefault(),C(!0);return}if(e.key===`Enter`&&!e.shiftKey||e.key===`Tab`){e.preventDefault();let t=De[Math.min(y,De.length-1)];t&&Pe(t);return}}e.key!==`Enter`||e.shiftKey||Is()||(e.preventDefault(),Fe())}}),(0,K.jsxs)(`div`,{className:`composer-actions`,hidden:!!T,children:[(0,K.jsx)(`input`,{ref:pe,type:`file`,multiple:!0,hidden:!0,onChange:e=>void Ae(e.target.files)}),(0,K.jsxs)(`div`,{className:`composer-meta`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost attach-pill`,onClick:()=>pe.current?.click(),disabled:t,title:`Attach files`,"aria-label":`Attach files`,children:(0,K.jsx)(`span`,{className:`pill-glyph`,children:(0,K.jsx)(Us,{})})}),(0,K.jsxs)(`button`,{type:`button`,className:`btn sm ghost agent-pill`,onClick:()=>d(`agent`),title:`Agent: ${Le}`,children:[(0,K.jsx)(`span`,{className:`pill-glyph`,children:(0,K.jsx)(Ws,{})}),(0,K.jsx)(`span`,{className:`pill-label`,children:Le})]}),(0,K.jsxs)(`button`,{type:`button`,className:`btn sm ghost model-pill`,"data-pending-model":se||void 0,onClick:()=>{ce&&d(`model`)},disabled:!ce,title:ce?`Model: ${Ie}`:se?`Choose a model after startup, before your saved first message is sent`:`This agent uses its own default model`,children:[(0,K.jsx)(`span`,{className:`pill-glyph`,children:(0,K.jsx)(Gs,{})}),(0,K.jsx)(`span`,{className:`pill-label`,children:e.catalogs.currentModel&&!se?Ks(Ie,Le):Ie})]})]}),(0,K.jsx)(`button`,{type:`button`,className:`composer-btn mic`,onClick:Te,disabled:t,title:`Voice input`,"aria-label":`Voice input`,children:(0,K.jsx)(Hs,{})}),r&&Ke&&R&&(0,K.jsx)(`button`,{type:`button`,className:`composer-btn steer`,onClick:()=>{z.steerNow(c,m.length?m:void 0)&&Me()},title:`Steer current turn — inject this now instead of queueing it`,"aria-label":`Steer current turn`,children:`⚡`}),r&&!c.trim()&&(0,K.jsx)(`button`,{type:`button`,className:`composer-btn stop${k?` is-stopping`:``}`,onClick:re,title:k?`Stopping`:`Stop`,"aria-label":k?`Stopping current turn`:`Stop current turn`,disabled:k,children:k?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`working-dots`,"aria-hidden":!0,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{})]}),(0,K.jsx)(`span`,{children:`Stopping…`})]}):(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,"aria-hidden":!0,children:(0,K.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`3`,fill:`currentColor`})})}),(!r||Ke)&&(0,K.jsx)(`button`,{type:`submit`,className:`composer-btn send`,disabled:!Ke,title:r?`Queue follow-up`:qe?`Launch Machine and send task`:`Send`,"aria-label":qe?`Launch Machine and send task`:r?`Queue follow-up`:`Send`,children:(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,K.jsx)(`path`,{d:`M12 19V5`}),(0,K.jsx)(`path`,{d:`m5 12 7-7 7 7`})]})})]})]})}),u===`repo`&&(0,K.jsx)(os,{state:e,onClose:()=>d(null)}),u===`sandbox`&&(0,K.jsx)(cs,{state:e,onClose:()=>d(null)}),u===`agent`&&(0,K.jsx)(us,{state:e,onClose:()=>d(null)}),u===`model`&&ce&&(0,K.jsx)(ps,{state:e,onClose:()=>d(null)}),P&&(0,K.jsx)(mt,{src:P,name:`Attachment preview`,onClose:()=>F(null)},P)]})}function Js(e,t){let n=String(e||``);return!!t.find(e=>e.id===n||e.id===`${n}-approvals`||e.id===`${n}-code-sdk`)?.capabilities?.sessionDiscovery}var Ys=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Xs=t(((e,t)=>{t.exports=Ys()})),Zs=t((e=>{var t=Xs(),n=I(),r=Ge();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function C(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),k=Symbol.for(`react.strict_mode`),A=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),j=Symbol.for(`react.context`),te=Symbol.for(`react.forward_ref`),M=Symbol.for(`react.suspense`),N=Symbol.for(`react.suspense_list`),P=Symbol.for(`react.memo`),ne=Symbol.for(`react.lazy`),F=Symbol.for(`react.activity`),re=Symbol.for(`react.legacy_hidden`),ie=Symbol.for(`react.memo_cache_sentinel`),ae=Symbol.for(`react.view_transition`),oe=Symbol.for(`react.recoverable`),se=Symbol.iterator;function ce(e){return typeof e!=`object`||!e?null:(e=se&&e[se]||e[`@@iterator`],typeof e==`function`?e:null)}var le=Symbol.for(`react.client.reference`);function ue(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case A:return`Profiler`;case k:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`;case F:return`Activity`;case ae:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case j:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case te:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?ue(e.type)||`Memo`:t;case ne:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var de=Array.isArray,L=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},pe=[],me=-1;function he(e){return{current:e}}function ge(e){0>me||(e.current=pe[me],pe[me]=null,me--)}function _e(e,t){me++,pe[me]=e.current,e.current=t}var ve=he(null),ye=he(null),z=he(null),be=he(null);function xe(e,t){switch(_e(z,t),_e(ye,e),_e(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ge(ve),_e(ve,e)}function Se(){ge(ve),ge(ye),ge(z)}function Ce(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,_e(be,e)),t=ve.current;var n=dp(t,e.type);t!==n&&(_e(ye,e),_e(ve,n))}function we(e){ye.current===e&&(ge(ve),ge(ye)),be.current===e&&(ge(be),sh._currentValue=fe)}var Te,Ee;function De(e){if(Te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Te=t&&t[1]||``,Ee=-1<e.stack.indexOf(`
|
|
15
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
16
|
-
`+Te+e+Ee}var Oe=!1;function ke(e,t){if(!e||Oe)return``;Oe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
17
|
-
`),l=s.split(`
|
|
18
|
-
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
19
|
-
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Oe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?De(n):``}function Ae(e,t){switch(e.tag){case 26:case 27:case 5:return De(e.type);case 16:return De(`Lazy`);case 13:return e.child!==t&&t!==null?De(`Suspense Fallback`):De(`Suspense`);case 19:return De(`SuspenseList`);case 0:case 15:return ke(e.type,!1);case 11:return ke(e.type.render,!1);case 1:return ke(e.type,!0);case 31:return De(`Activity`);case 30:return De(`ViewTransition`);default:return``}}function je(e){try{var t=``,n=null;do t+=Ae(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
20
|
-
Error generating stack: `+e.message+`
|
|
21
|
-
`+e.stack}}var Me=Object.prototype.hasOwnProperty,Ne=t.unstable_scheduleCallback,Pe=t.unstable_cancelCallback,Fe=t.unstable_shouldYield,Ie=t.unstable_requestPaint,Le=t.unstable_now,Re=t.unstable_getCurrentPriorityLevel,ze=t.unstable_ImmediatePriority,Be=t.unstable_UserBlockingPriority,Ve=t.unstable_NormalPriority,He=t.unstable_LowPriority,Ue=t.unstable_IdlePriority,We=t.log,Ke=t.unstable_setDisableYieldValue,qe=null,Je=null;function Ye(e){if(typeof We==`function`&&Ke(e),Je&&typeof Je.setStrictMode==`function`)try{Je.setStrictMode(qe,e)}catch{}}var B=Math.clz32?Math.clz32:Qe,Xe=Math.log,Ze=Math.LN2;function Qe(e){return e>>>=0,e===0?32:31-(Xe(e)/Ze|0)|0}var $e=256,et=262144,tt=4194304;function nt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function rt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=nt(n))):i=nt(o):i=nt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=nt(n))):i=nt(o)):i=nt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function it(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function at(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-B(n),i=1<<r;t|=e[r],n&=~i}return t}function ot(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function st(){var e=tt;return tt<<=1,!(tt&62914560)&&(tt=4194304),e}function ct(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function lt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ut(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-B(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&V(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function V(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-B(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function dt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-B(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ft(e,t){var n=t&-t;return n=n&42?1:pt(n),(n&(e.suspendedLanes|t))===0?n:0}function pt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function mt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ht(){var e=R.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function gt(e,t){var n=R.p;try{return R.p=e,t()}finally{R.p=n}}var _t=Math.random().toString(36).slice(2),vt=`__reactFiber$`+_t,yt=`__reactProps$`+_t,bt=`__reactContainer$`+_t,xt=`__reactEvents$`+_t,St=`__reactListeners$`+_t,Ct=`__reactHandles$`+_t,wt=`__reactResources$`+_t,Tt=`__reactMarker$`+_t,Et=`__reactLoad$`+_t;function Dt(e){delete e[vt],delete e[yt],delete e[St],delete e[Ct]}function Ot(e){var t;if(t=e[vt])return t;for(var n=e.parentNode;n;){if(t=n[bt]||n[vt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[vt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function kt(e){if(e=e[vt]||e[bt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function At(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function jt(e){var t=e[wt];return t||=e[wt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Mt(e){e[Tt]=!0}function Nt(e){e[Et]=void 0}var Pt=new Set,Ft={};function It(e,t){Lt(e,t),Lt(e+`Capture`,t)}function Lt(e,t){for(Ft[e]=t,e=0;e<t.length;e++)Pt.add(t[e])}var Rt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),zt={},Bt={};function Vt(e){return Me.call(Bt,e)?!0:Me.call(zt,e)?!1:Rt.test(e)?Bt[e]=!0:(zt[e]=!0,!1)}var H=!1;function Ht(){var e=H;return H=!1,e}function Ut(e,t,n){if(Vt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Wt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Gt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function Kt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function qt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Jt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yt(e){if(!e._valueTracker){var t=qt(e)?`checked`:`value`;e._valueTracker=Jt(e,t,``+e[t])}}function Xt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=qt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Zt=/[\n"\\]/g;function Qt(e){return e.replace(Zt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function $t(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Kt(t)):e.value!==``+Kt(t)&&(e.value=``+Kt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):tn(e,Kt(n)):o===`number`&&e.value==t?tn(e,Kt(e.value)):tn(e,Kt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Kt(s):e.removeAttribute(`name`)}function en(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Yt(e);return}n=n==null?``:``+Kt(n),t=t==null?n:``+Kt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Yt(e)}function tn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function nn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Kt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function rn(e,t,n){if(t!=null&&(t=``+Kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Kt(n)}function an(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(de(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Kt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Yt(e)}function on(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var U=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function W(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||U.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function sn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,H=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(W(e,a,r),H=!0)}else for(var o in t)t.hasOwnProperty(o)&&W(e,o,t[o])}function cn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var ln=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),un=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function dn(e){return un.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function fn(){}var pn=null;function mn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hn=null,gn=null;function _n(e){var t=kt(e);if(t&&(e=t.stateNode)){var n=e[yt]||null;a:switch(e=t.stateNode,t.type){case`input`:if($t(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Qt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[yt]||null;if(!a)throw Error(i(90));$t(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Xt(r)}break a;case`textarea`:rn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&nn(e,!!n.multiple,t,!1)}}}var G=!1;function vn(e,t,n){if(G)return e(t,n);G=!0;try{return e(t)}finally{if(G=!1,(hn!==null||gn!==null)&&(Ld(),hn&&(t=hn,e=gn,gn=hn=null,_n(t),e)))for(t=0;t<e.length;t++)_n(e[t])}}function yn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[yt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var bn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,xn=!1;if(bn)try{var Sn={};Object.defineProperty(Sn,"passive",{get:function(){xn=!0}}),window.addEventListener(`test`,Sn,Sn),window.removeEventListener(`test`,Sn,Sn)}catch{xn=!1}var Cn=null,wn=null,Tn=null;function En(){if(Tn)return Tn;var e,t=wn,n=t.length,r,i=`value`in Cn?Cn.value:Cn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Tn=i.slice(e,1<r?1-r:void 0)}function Dn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function On(){return!0}function kn(){return!1}function K(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?On:kn,this.isPropagationStopped=kn,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=On)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=On)},persist:function(){},isPersistent:On}),t}var An={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},jn=K(An),Mn=w({},An,{view:0,detail:0}),Nn=K(Mn),Pn,Fn,In,Ln=w({},Mn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Jn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==In&&(In&&e.type===`mousemove`?(Pn=e.screenX-In.screenX,Fn=e.screenY-In.screenY):Fn=Pn=0,In=e),Pn)},movementY:function(e){return`movementY`in e?e.movementY:Fn}}),Rn=K(Ln),zn=K(w({},Ln,{dataTransfer:0})),Bn=K(w({},Mn,{relatedTarget:0})),Vn=K(w({},An,{animationName:0,elapsedTime:0,pseudoElement:0})),Hn=K(w({},An,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Un=K(w({},An,{data:0})),Wn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Gn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Kn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function qn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Kn[e])?!!t[e]:!1}function Jn(){return qn}var Yn=K(w({},Mn,{key:function(e){if(e.key){var t=Wn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Dn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Gn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Jn,charCode:function(e){return e.type===`keypress`?Dn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Dn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Xn=K(w({},Ln,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Zn=K(w({},An,{submitter:0})),Qn=K(w({},Mn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Jn})),$n=K(w({},An,{propertyName:0,elapsedTime:0,pseudoElement:0})),er=K(w({},Ln,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),tr=K(w({},An,{newState:0,oldState:0,source:0})),nr=[9,13,27,32],rr=bn&&`CompositionEvent`in window,ir=null;bn&&`documentMode`in document&&(ir=document.documentMode);var ar=bn&&`TextEvent`in window&&!ir,or=bn&&(!rr||ir&&8<ir&&11>=ir),sr=` `,cr=!1;function lr(e,t){switch(e){case`keyup`:return nr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ur(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var dr=!1;function fr(e,t){switch(e){case`compositionend`:return ur(t);case`keypress`:return t.which===32?(cr=!0,sr):null;case`textInput`:return e=t.data,e===sr&&cr?null:e;default:return null}}function pr(e,t){if(dr)return e===`compositionend`||!rr&&lr(e,t)?(e=En(),Tn=wn=Cn=null,dr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return or&&t.locale!==`ko`?null:t.data;default:return null}}var mr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!mr[e.type]:t===`textarea`}function gr(e,t,n,r){hn?gn?gn.push(r):gn=[r]:hn=r,t=qf(t,`onChange`),0<t.length&&(n=new jn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var _r=null,vr=null;function yr(e){Bf(e,0)}function br(e){if(Xt(At(e)))return e}function xr(e,t){if(e===`change`)return t}var Sr=!1;if(bn){var Cr;if(bn){var wr=`oninput`in document;if(!wr){var Tr=document.createElement(`div`);Tr.setAttribute(`oninput`,`return;`),wr=typeof Tr.oninput==`function`}Cr=wr}else Cr=!1;Sr=Cr&&(!document.documentMode||9<document.documentMode)}function Er(){_r&&(_r.detachEvent(`onpropertychange`,Dr),vr=_r=null)}function Dr(e){if(e.propertyName===`value`&&br(vr)){var t=[];gr(t,vr,e,mn(e)),vn(yr,t)}}function Or(e,t,n){e===`focusin`?(Er(),_r=t,vr=n,_r.attachEvent(`onpropertychange`,Dr)):e===`focusout`&&Er()}function kr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return br(vr)}function Ar(e,t){if(e===`click`)return br(t)}function jr(e,t){if(e===`input`||e===`change`)return br(t)}function Mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Nr=typeof Object.is==`function`?Object.is:Mr;function Pr(e,t){if(Nr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Me.call(t,i)||!Nr(e[i],t[i]))return!1}return!0}function Fr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ir(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lr(e,t){var n=Ir(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Ir(n)}}function Rr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Rr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Fr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Fr(e.document)}return t}function Br(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Vr=bn&&`documentMode`in document&&11>=document.documentMode,Hr=null,Ur=null,Wr=null,Gr=!1;function Kr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Gr||Hr==null||Hr!==Fr(r)||(r=Hr,`selectionStart`in r&&Br(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Wr&&Pr(Wr,r)||(Wr=r,r=qf(Ur,`onSelect`),0<r.length&&(t=new jn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Hr)))}function qr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Jr={animationend:qr(`Animation`,`AnimationEnd`),animationiteration:qr(`Animation`,`AnimationIteration`),animationstart:qr(`Animation`,`AnimationStart`),transitionrun:qr(`Transition`,`TransitionRun`),transitionstart:qr(`Transition`,`TransitionStart`),transitioncancel:qr(`Transition`,`TransitionCancel`),transitionend:qr(`Transition`,`TransitionEnd`)},Yr={},Xr={};bn&&(Xr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Jr.animationend.animation,delete Jr.animationiteration.animation,delete Jr.animationstart.animation),`TransitionEvent`in window||delete Jr.transitionend.transition);function Zr(e){if(Yr[e])return Yr[e];if(!Jr[e])return e;var t=Jr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Xr)return Yr[e]=t[n];return e}var Qr=Zr(`animationend`),$r=Zr(`animationiteration`),ei=Zr(`animationstart`),ti=Zr(`transitionrun`),ni=Zr(`transitionstart`),ri=Zr(`transitioncancel`),ii=Zr(`transitionend`),ai=new Map,oi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);oi.push(`scrollEnd`);function si(e,t){ai.set(e,t),It(t,[e])}var ci=0;function li(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=vd.identifierPrefix;var n=ci++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function ui(e){if(e==null||typeof e==`string`)return e;var t=null,n=Ed;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function di(e,t){return e=ui(e),t=ui(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var fi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},pi=[],mi=0,hi=0;function gi(){for(var e=mi,t=hi=mi=0;t<e;){var n=pi[t];pi[t++]=null;var r=pi[t];pi[t++]=null;var i=pi[t];pi[t++]=null;var a=pi[t];if(pi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&bi(n,i,a)}}function _i(e,t,n,r){pi[mi++]=e,pi[mi++]=t,pi[mi++]=n,pi[mi++]=r,hi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function vi(e,t,n,r){return _i(e,t,n,r),xi(e)}function yi(e,t){return _i(e,null,null,t),xi(e)}function bi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-B(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function xi(e){if(50<Dd)throw Dd=0,Od=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Si={};function Ci(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wi(e,t,n,r){return new Ci(e,t,n,r)}function Ti(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ei(e,t){var n=e.alternate;return n===null?(n=wi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Di(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Oi(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Ti(r)&&(s=1);else if(typeof r==`string`)s=qm(e,n,ve.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case F:return e=wi(31,n,t,a),e.elementType=F,e.lanes=o,e;case O:return ki(n.children,a,o,t);case k:s=8,a|=24;break;case A:return e=wi(12,n,t,a|2),e.elementType=A,e.lanes=o,e;case M:return e=wi(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=wi(19,n,t,a),e.elementType=N,e.lanes=o,e;case re:case ae:return e=a|32,e=wi(30,n,t,e),e.elementType=ae,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case j:s=10;break a;case ee:s=9;break a;case te:s=11;break a;case P:s=14;break a;case ne:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=wi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ki(e,t,n,r){return e=wi(7,e,r,t),e.lanes=n,e}function Ai(e,t,n){return e=wi(6,e,null,t),e.lanes=n,e}function ji(e){var t=wi(18,null,null,0);return t.stateNode=e,t}function Mi(e,t,n){return t=wi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ni=new WeakMap;function Pi(e,t){if(typeof e==`object`&&e){var n=Ni.get(e);return n===void 0?(t={value:e,source:t,stack:je(t)},Ni.set(e,t),t):n}return{value:e,source:t,stack:je(t)}}var Fi=[],Ii=0,Li=null,Ri=0,zi=[],Bi=0,Vi=null,Hi=1,Ui=``;function Wi(e,t){Fi[Ii++]=Ri,Fi[Ii++]=Li,Li=e,Ri=t}function Gi(e,t,n){zi[Bi++]=Hi,zi[Bi++]=Ui,zi[Bi++]=Vi,Vi=e;var r=Hi;e=Ui;var i=32-B(r)-1;r&=~(1<<i),n+=1;var a=32-B(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Hi=1<<32-B(t)+i|n<<i|r,Ui=a+e}else Hi=1<<a|n<<i|r,Ui=e}function Ki(e){e.return!==null&&(Wi(e,1),Gi(e,1,0))}function qi(e){for(;e===Li;)Li=Fi[--Ii],Fi[Ii]=null,Ri=Fi[--Ii],Fi[Ii]=null;for(;e===Vi;)Vi=zi[--Bi],zi[Bi]=null,Ui=zi[--Bi],zi[Bi]=null,Hi=zi[--Bi],zi[Bi]=null}function Ji(e,t){zi[Bi++]=Hi,zi[Bi++]=Ui,zi[Bi++]=Vi,Hi=t.id,Ui=t.overflow,Vi=e}var Yi=null,Xi=null,q=!1,Zi=null,Qi=!1,$i=Error(i(519));function ea(e){throw oa(Pi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),$i}function ta(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[vt]=e,t[yt]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<Rf.length;n++)$(Rf[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),en(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),an(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||$f(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=fn),t=!0):t=!1,t||ea(e,!0)}function na(e){for(Yi=e.return;Yi;)switch(Yi.tag){case 5:case 31:case 13:Qi=!1;return;case 27:case 3:Qi=!0;return;default:Yi=Yi.return}}function ra(e){if(e!==Yi)return!1;if(!q)return na(e),q=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||pp(e.type,e.memoizedProps)),n=!n),n&&Xi&&ea(e),na(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Xi=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Xi=dm(e)}else t===27?(t=Xi,Sp(e.type)?(e=um,um=null,Xi=e):Xi=t):Xi=Yi?lm(e.stateNode.nextSibling):null;return!0}function ia(){Xi=Yi=null,q=!1}function aa(){var e=Zi;return e!==null&&(ud===null?ud=e:ud.push.apply(ud,e),Zi=null),e}function oa(e){Zi===null?Zi=[e]:Zi.push(e)}var sa=he(null),ca=null,la=null;function ua(e,t,n){_e(sa,t._currentValue),t._currentValue=n}function da(e){e._currentValue=sa.current,ge(sa)}function fa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function pa(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),fa(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),fa(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),fa(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ma(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Nr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===be.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}a=a.return}return e!==null&&pa(t,e,n,r),t.flags|=262144,e!==null}function ha(e){for(e=e.firstContext;e!==null;){if(!Nr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ga(e){ca=e,la=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function _a(e){return ya(ca,e)}function va(e,t){return ca===null&&ga(e),ya(e,t)}function ya(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},la===null){if(e===null)throw Error(i(308));la=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else la=la.next=t;return n}var ba=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},xa=t.unstable_scheduleCallback,Sa=t.unstable_NormalPriority,Ca={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wa(){return{controller:new ba,data:new Map,refCount:0}}function Ta(e){e.refCount--,e.refCount===0&&xa(Sa,function(){e.controller.abort()})}function Ea(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Da=null;function Oa(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var ka=null,Aa=0,ja=0,Ma=null;function Na(e,t){if(ka===null){var n=ka=[];Aa=0,ja=Nf(),Ma={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Aa++,t.then(Pa,Pa),t}function Pa(){if(--Aa===0&&(Da=null,ka!==null)){Ma!==null&&(Ma.status=`fulfilled`);var e=ka;ka=null,ja=0,Ma=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Fa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ia=L.S;L.S=function(e,t){if(pd=Le(),typeof t==`object`&&t&&typeof t.then==`function`&&Na(e,t),Da!==null)for(var n=yf;n!==null;)Ea(n,Da),n=n.next;if(n=e.types,n!==null){for(var r=yf;r!==null;)Ea(r,n),r=r.next;if(ja!==0){r=Da,r===null&&(r=Da=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ia!==null&&Ia(e,t)};var La=he(null);function Ra(){var e=La.current;return e===null?Xu.pooledCache:e}function za(e,t){t===null?_e(La,La.current):_e(La,t.pool)}function Ba(){var e=Ra();return e===null?null:{parent:Ca._currentValue,pool:e}}var Va=Error(i(460)),Ha=Error(i(474)),Ua=Error(i(542)),Wa={then:function(){}};function Ga(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ka(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(fn,fn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Xa(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(fn,fn);else{if(e=Xu,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Xa(e),e}throw Ja=t,Va}}function qa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ja=e,Va):e}}var Ja=null;function Ya(){if(Ja===null)throw Error(i(459));var e=Ja;return Ja=null,e}function Xa(e){if(e===Va||e===Ua)throw Error(i(483))}var Za=null,Qa=0;function $a(e){var t=Qa;return Qa+=1,Za===null&&(Za=[]),Ka(Za,e,t)}function eo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function to(e,t){throw t.$$typeof===T?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function no(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Ei(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ai(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===O?(e=d(e,t,n.props.children,r,n.key),eo(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===ne&&qa(i)===t.type)?(t=a(t,n.props),eo(t,n),t.return=e,t):(t=Oi(n.type,n.key,n.props,null,e.mode,r),eo(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Mi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ki(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ai(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case E:return n=Oi(t.type,t.key,t.props,null,e.mode,n),eo(n,t),n.return=e,n;case D:return t=Mi(t,e.mode,n),t.return=e,t;case ne:return t=qa(t),f(e,t,n)}if(de(t)||ce(t))return t=ki(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,$a(t),n);if(t.$$typeof===j)return f(e,va(e,t),n);to(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case E:return n.key===i?l(e,t,n,r):null;case D:return n.key===i?u(e,t,n,r):null;case ne:return n=qa(n),p(e,t,n,r)}if(de(n)||ce(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,$a(n),r);if(n.$$typeof===j)return p(e,t,va(e,n),r);to(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case E:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case D:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case ne:return r=qa(r),m(e,t,n,r,i)}if(de(r)||ce(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,$a(r),i);if(r.$$typeof===j)return m(e,t,n,va(t,r),i);to(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),q&&Wi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return q&&Wi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),q&&Wi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),q&&Wi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return q&&Wi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),q&&Wi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===O&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case E:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===O){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),eo(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ne&&qa(l)===r.type){n(e,r.sibling),c=a(r,o.props),eo(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===O?(c=ki(o.props.children,e.mode,c,o.key),eo(c,o),c.return=e,e=c):(c=Oi(o.type,o.key,o.props,null,e.mode,c),eo(c,o),c.return=e,e=c)}return s(e);case D:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Mi(o,e.mode,c),c.return=e,e=c}return s(e);case ne:return o=qa(o),_(e,r,o,c)}if(de(o))return h(e,r,o,c);if(ce(o)){if(l=ce(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,$a(o),c);if(o.$$typeof===j)return _(e,r,va(e,o),c);to(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Ai(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Qa=0;var i=_(e,t,n,r);return Za=null,i}catch(t){if(t===Va||t===Ua)throw t;var a=wi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ro=no(!0),io=no(!1),ao=!1;function oo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function so(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function co(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function lo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Yu&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=xi(e),bi(e,null,n),t}return _i(e,r,t,n),xi(e)}function uo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}function fo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var po=!1;function mo(){if(po){var e=Ma;if(e!==null)throw e}}function ho(e,t,n,r){po=!1;var i=e.updateQueue;ao=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Q&f)===f:(r&f)===f){f!==0&&f===ja&&(po=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=w({},d,f);break a;case 2:ao=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),id|=o,e.lanes=o,e.memoizedState=d}}function go(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function _o(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)go(n[e],t)}var vo=he(null),yo=he(0);function bo(e,t){e=nd,_e(yo,e),_e(vo,t),nd=e|t.baseLanes}function xo(){_e(yo,nd),_e(vo,vo.current)}function So(){nd=yo.current,ge(vo),ge(yo)}var Co=he(null),wo=null;function To(e){var t=e.alternate;_e(Ao,Ao.current&1),_e(Co,e),wo===null&&(t===null||vo.current!==null||t.memoizedState!==null)&&(wo=e)}function Eo(e){_e(Ao,Ao.current),_e(Co,e),wo===null&&(wo=e)}function Do(e){e.tag===22?(_e(Ao,Ao.current),_e(Co,e),wo===null&&(wo=e)):Oo()}function Oo(){_e(Ao,Ao.current),_e(Co,Co.current)}function ko(e){ge(Co),wo===e&&(wo=null),ge(Ao)}var Ao=he(0);function jo(e,t){_e(Co,Co.current),_e(Ao,t)}function Mo(e){ge(Ao),ge(Co),wo===e&&(wo=null)}function No(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Po=0,J=null,Fo=null,Io=null,Lo=!1,Ro=!1,zo=!1,Bo=0,Vo=0,Ho=null,Uo=0;function Wo(){throw Error(i(321))}function Go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Nr(e[n],t[n]))return!1;return!0}function Ko(e,t,n,r,i,a){return Po=a,J=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,L.H=e===null||e.memoizedState===null?uc:dc,zo=!1,a=n(r,i),zo=!1,Ro&&(a=Jo(t,n,r,i)),qo(e),a}function qo(e){L.H=lc;var t=Fo!==null&&Fo.next!==null;if(Po=0,Io=Fo=J=null,Lo=!1,Vo=0,Ho=null,t)throw Error(i(300));e===null||Oc||(e=e.dependencies,e!==null&&ha(e)&&(Oc=!0))}function Jo(e,t,n,r){J=e;var a=0;do{if(Ro&&(Ho=null),Vo=0,Ro=!1,25<=a)throw Error(i(301));if(a+=1,Io=Fo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}L.H=fc,o=t(n,r)}while(Ro);return o}function Yo(){var e=L.H,t=e.useState()[0];return t=typeof t.then==`function`?ns(t):t,e=e.useState()[0],(Fo===null?null:Fo.memoizedState)!==e&&(J.flags|=1024),t}function Xo(){var e=Bo!==0;return Bo=0,e}function Zo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Qo(e){if(Lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Lo=!1}Po=0,Io=Fo=J=null,Ro=!1,Vo=Bo=0,Ho=null}function $o(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Io===null?J.memoizedState=Io=e:Io=Io.next=e,Io}function es(){if(Fo===null){var e=J.alternate;e=e===null?null:e.memoizedState}else e=Fo.next;var t=Io===null?J.memoizedState:Io.next;if(t!==null)Io=t,Fo=e;else{if(e===null)throw J.alternate===null?Error(i(467)):Error(i(310));Fo=e,e={memoizedState:Fo.memoizedState,baseState:Fo.baseState,baseQueue:Fo.baseQueue,queue:Fo.queue,next:null},Io===null?J.memoizedState=Io=e:Io=Io.next=e}return Io}function ts(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ns(e){var t=Vo;return Vo+=1,Ho===null&&(Ho=[]),e=Ka(Ho,e,t),t=J,(Io===null?t.memoizedState:Io.next)===null&&(t=t.alternate,L.H=t===null||t.memoizedState===null?uc:dc),e}function rs(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ns(e);if(e.$$typeof===oe)return;if(e.$$typeof===j)return _a(e)}throw Error(i(438,String(e)))}function is(e){var t=null,n=J.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=J.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ts(),J.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ie;return t.index++,n}function as(e,t){return typeof t==`function`?t(e):t}function os(e){return ss(es(),Fo,e)}function ss(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Po&f)===f:(Q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ja&&(d=!0);else if((Po&p)===p){u=u.next,p===ja&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,J.lanes|=p,id|=p;f=u.action,zo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,J.lanes|=f,id|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Nr(o,e.memoizedState)&&(Oc=!0,d&&(n=Ma,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function cs(e){var t=es(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Nr(o,t.memoizedState)||(Oc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ls(e,t,n){var r=J,a=es(),o=q;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Nr((Fo||a).memoizedState,n);if(s&&(a.memoizedState=n,Oc=!0),a=a.queue,Ps(fs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Io!==null&&!!(Io.memoizedState.tag&1),ks(e?9:8,{destroy:void 0},ds.bind(null,r,a,n,t),null),e){if(r.flags|=2048,Xu===null)throw Error(i(349));o||Po&127||us(r,t,n)}return n}function us(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=J.updateQueue,t===null?(t=ts(),J.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ds(e,t,n,r){t.value=n,t.getSnapshot=r,ps(t)&&ms(e)}function fs(e,t,n){return n(function(){ps(t)&&ms(e)})}function ps(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Nr(e,n)}catch{return!0}}function ms(e){var t=yi(e,2);t!==null&&Md(t,e,2)}function hs(e){var t=$o();if(typeof e==`function`){var n=e;if(e=n(),zo){Ye(!0);try{n()}finally{Ye(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:e},t}function gs(e,t,n,r){return e.baseState=n,ss(e,Fo,typeof r==`function`?r:as)}function _s(e,t,n,r,a){if(oc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};L.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,vs(t,o)):(o.next=n.next,t.pending=n.next=o)}}function vs(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=L.T,o={};o.types=a===null?null:a.types,L.T=o;try{var s=n(i,r),c=L.S;c!==null&&c(o,s),ys(e,t,s)}catch(n){xs(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),L.T=a}}else try{a=n(i,r),ys(e,t,a)}catch(n){xs(e,t,n)}}function ys(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){bs(e,t,n)},function(n){return xs(e,t,n)}):bs(e,t,n)}function bs(e,t,n){t.status=`fulfilled`,t.value=n,Ss(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,vs(e,n)))}function xs(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Ss(t),t=t.next;while(t!==r)}e.action=null}function Ss(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Cs(e,t){return t}function ws(e,t){if(q){var n=Xu.formState;if(n!==null){a:{var r=J;if(q){if(Xi){b:{for(var i=Xi,a=Qi;i.nodeType!==8;){if(!a){i=null;break b}if(i=lm(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Xi=lm(i.nextSibling),r=i.data===`F!`;break a}}ea(r)}r=!1}r&&(t=n[0])}}return n=$o(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cs,lastRenderedState:t},n.queue=r,n=rc.bind(null,J,r),r.dispatch=n,r=hs(!1),a=ac.bind(null,J,!1,r.queue),r=$o(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=_s.bind(null,J,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ts(e){return Es(es(),Fo,e)}function Es(e,t,n){if(t=ss(e,t,Cs)[0],e=os(as)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ns(t)}catch(e){throw e===Va?Ua:e}else r=t;t=es();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(J.flags|=2048,ks(9,{destroy:void 0},Ds.bind(null,i,n),null)),[r,a,e]}function Ds(e,t){e.action=t}function Os(e){var t=es(),n=Fo;if(n!==null)return Es(t,n,e);es(),t=t.memoizedState,n=es();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ks(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=J.updateQueue,t===null&&(t=ts(),J.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function As(){return es().memoizedState}function js(e,t,n,r){var i=$o();J.flags|=e,i.memoizedState=ks(1|t,{destroy:void 0},n,r===void 0?null:r)}function Ms(e,t,n,r){var i=es();r=r===void 0?null:r;var a=i.memoizedState.inst;Fo!==null&&r!==null&&Go(r,Fo.memoizedState.deps)?i.memoizedState=ks(t,a,n,r):(J.flags|=e,i.memoizedState=ks(1|t,a,n,r))}function Ns(e,t){js(8390656,8,e,t)}function Ps(e,t){Ms(2048,8,e,t)}function Fs(e){J.flags|=4;var t=J.updateQueue;if(t===null)t=ts(),J.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Is(e){var t=es().memoizedState;return Fs({ref:t,nextImpl:e}),function(){if(Yu&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Ls(e,t){return Ms(4,2,e,t)}function Rs(e,t){return Ms(4,4,e,t)}function zs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Bs(e,t,n){n=n==null?null:n.concat([e]),Ms(4,4,zs.bind(null,t,e),n)}function Vs(){}function Hs(e,t){var n=es();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Go(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Us(e,t){var n=es();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Go(t,r[1]))return r[0];if(r=e(),zo){Ye(!0);try{e()}finally{Ye(!1)}}return n.memoizedState=[r,t],r}function Ws(e,t,n){return n===void 0||Po&1073741824&&!(Q&261930)?e.memoizedState=t:(e.memoizedState=n,e=Ad(),J.lanes|=e,id|=e,n)}function Gs(e,t,n,r){return Nr(n,t)?n:vo.current===null?!(Po&106)||Po&1073741824&&!(Q&261930)?(Oc=!0,e.memoizedState=n):(e=Ad(),J.lanes|=e,id|=e,t):(e=Ws(e,n,r),Nr(e,t)||(Oc=!0),e)}function Ks(e,t,n,r,i){var a=R.p;R.p=a!==0&&8>a?a:8;var o=L.T,s={};s.types=o===null?null:o.types,L.T=s,ac(e,!1,t,n);try{var c=i(),l=L.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ic(e,t,Fa(c,r),kd(e)):ic(e,t,r,kd(e))}catch(n){ic(e,t,{then:function(){},status:`rejected`,reason:n},kd())}finally{R.p=a,o!==null&&s.types!==null&&(o.types=s.types),L.T=o}}function qs(){}function Js(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ys(e).queue;Ks(e,a,t,fe,n===null?qs:function(){return Zs(e),n(r)})}function Ys(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:fe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Zs(e){var t=Ys(e);t.next===null&&(t=e.alternate.memoizedState),ic(e,t.next.queue,{},kd())}function Qs(){return _a(sh)}function $s(){return es().memoizedState}function ec(){return es().memoizedState}function tc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kd();e=co(n);var r=lo(t,e,n);r!==null&&(Md(r,t,n),uo(r,t,n)),t={cache:wa()},e.payload=t;return}t=t.return}}function nc(e,t,n){var r=kd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},oc(e)?sc(t,n):(n=vi(e,t,n,r),n!==null&&(Md(n,e,r),cc(n,t,r)))}function rc(e,t,n){ic(e,t,n,kd())}function ic(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(oc(e))sc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Nr(s,o))return _i(e,t,i,0),Xu===null&&gi(),!1}catch{}if(n=vi(e,t,i,r),n!==null)return Md(n,e,r),cc(n,t,r),!0}return!1}function ac(e,t,n,r){if(r={lane:2,revertLane:Nf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},oc(e)){if(t)throw Error(i(479))}else t=vi(e,n,r,2),t!==null&&Md(t,e,2)}function oc(e){var t=e.alternate;return e===J||t!==null&&t===J}function sc(e,t){Ro=Lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}var lc={readContext:_a,use:rs,useCallback:Wo,useContext:Wo,useEffect:Wo,useImperativeHandle:Wo,useLayoutEffect:Wo,useInsertionEffect:Wo,useMemo:Wo,useReducer:Wo,useRef:Wo,useState:Wo,useDebugValue:Wo,useDeferredValue:Wo,useTransition:Wo,useSyncExternalStore:Wo,useId:Wo,useHostTransitionStatus:Wo,useFormState:Wo,useActionState:Wo,useOptimistic:Wo,useMemoCache:Wo,useCacheRefresh:Wo,useEffectEvent:Wo},uc={readContext:_a,use:rs,useCallback:function(e,t){return $o().memoizedState=[e,t===void 0?null:t],e},useContext:_a,useEffect:Ns,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),js(4194308,4,zs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return js(4194308,4,e,t)},useInsertionEffect:function(e,t){js(4,2,e,t)},useMemo:function(e,t){var n=$o();t=t===void 0?null:t;var r=e();if(zo){Ye(!0);try{e()}finally{Ye(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=$o();if(n!==void 0){var i=n(t);if(zo){Ye(!0);try{n(t)}finally{Ye(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=nc.bind(null,J,e),[r.memoizedState,e]},useRef:function(e){var t=$o();return e={current:e},t.memoizedState=e},useState:function(e){e=hs(e);var t=e.queue,n=rc.bind(null,J,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Vs,useDeferredValue:function(e,t){return Ws($o(),e,t)},useTransition:function(){var e=hs(!1);return e=Ks.bind(null,J,e.queue,!0,!1),$o().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=J,a=$o();if(q){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Xu===null)throw Error(i(349));Q&127||us(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Ns(fs.bind(null,r,o,e),[e]),r.flags|=2048,ks(9,{destroy:void 0},ds.bind(null,r,o,n,t),null),n},useId:function(){var e=$o(),t=Xu.identifierPrefix;if(q){var n=Ui,r=Hi;n=(r&~(1<<32-B(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Bo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Uo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Qs,useFormState:ws,useActionState:ws,useOptimistic:function(e){var t=$o();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ac.bind(null,J,!0,n),n.dispatch=t,[e,t]},useMemoCache:is,useCacheRefresh:function(){return $o().memoizedState=tc.bind(null,J)},useEffectEvent:function(e){var t=$o(),n={impl:e};return t.memoizedState=n,function(){if(Yu&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},dc={readContext:_a,use:rs,useCallback:Hs,useContext:_a,useEffect:Ps,useImperativeHandle:Bs,useInsertionEffect:Ls,useLayoutEffect:Rs,useMemo:Us,useReducer:os,useRef:As,useState:function(){return os(as)},useDebugValue:Vs,useDeferredValue:function(e,t){return Gs(es(),Fo.memoizedState,e,t)},useTransition:function(){var e=os(as)[0],t=es().memoizedState;return[typeof e==`boolean`?e:ns(e),t]},useSyncExternalStore:ls,useId:$s,useHostTransitionStatus:Qs,useFormState:Ts,useActionState:Ts,useOptimistic:function(e,t){return gs(es(),Fo,e,t)},useMemoCache:is,useCacheRefresh:ec,useEffectEvent:Is},fc={readContext:_a,use:rs,useCallback:Hs,useContext:_a,useEffect:Ps,useImperativeHandle:Bs,useInsertionEffect:Ls,useLayoutEffect:Rs,useMemo:Us,useReducer:cs,useRef:As,useState:function(){return cs(as)},useDebugValue:Vs,useDeferredValue:function(e,t){var n=es();return Fo===null?Ws(n,e,t):Gs(n,Fo.memoizedState,e,t)},useTransition:function(){var e=cs(as)[0],t=es().memoizedState;return[typeof e==`boolean`?e:ns(e),t]},useSyncExternalStore:ls,useId:$s,useHostTransitionStatus:Qs,useFormState:Os,useActionState:Os,useOptimistic:function(e,t){var n=es();return Fo===null?(n.baseState=e,[e,n.queue.dispatch]):gs(n,Fo,e,t)},useMemoCache:is,useCacheRefresh:ec,useEffectEvent:Is};function pc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var mc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=kd(),i=co(r);i.payload=t,n!=null&&(i.callback=n),t=lo(e,i,r),t!==null&&(Md(t,e,r),uo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=kd(),i=co(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=lo(e,i,r),t!==null&&(Md(t,e,r),uo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=kd(),r=co(n);r.tag=2,t!=null&&(r.callback=t),t=lo(e,r,n),t!==null&&(Md(t,e,n),uo(t,e,n))}};function hc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Pr(n,r)||!Pr(i,a):!0}function gc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&mc.enqueueReplaceState(t,t.state,null)}function _c(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=w({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function vc(e){fi(e)}function yc(e){console.error(e)}function bc(e){fi(e)}function xc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Sc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Cc(e,t,n){return n=co(n),n.tag=3,n.payload={element:null},n.callback=function(){xc(e,t)},n}function wc(e){return e=co(e),e.tag=3,e}function Tc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Sc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Sc(t,n,r),typeof i!=`function`&&(gd===null?gd=new Set([this]):gd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ec(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ma(t,n,a,!0),n=Co.current,n!==null){switch(n.tag){case 31:case 13:case 19:return wo===null?Wd():n.alternate===null&&rd===0&&(rd=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Wa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),pf(e,r,a)),!1;case 22:return n.flags|=65536,r===Wa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),pf(e,r,a)),!1}throw Error(i(435,n.tag))}return pf(e,r,a),Wd(),!1}if(q)return t=Co.current,t===null?(r!==$i&&(t=Error(i(423),{cause:r}),oa(Pi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Pi(r,n),a=Cc(e.stateNode,r,a),fo(e,a),rd!==4&&(rd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==$i&&(e=Error(i(422),{cause:r}),oa(Pi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Pi(o,n),ld===null?ld=[o]:ld.push(o),rd!==4&&(rd=2),t===null)return!0;r=Pi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Cc(n.stateNode,r,e),fo(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(gd===null||!gd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=wc(a),Tc(a,e,n,r),fo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Dc=Error(i(461)),Oc=!1;function kc(e,t,n,r){t.child=e===null?io(t,null,n,r):ro(t,e.child,n,r)}function Ac(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ga(t),r=Ko(e,t,n,o,a,i),s=Xo(),e!==null&&!Oc?(Zo(e,t,i),il(e,t,i)):(q&&s&&Ki(t),t.flags|=1,kc(e,t,r,i),t.child)}function jc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ti(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Mc(e,t,a,r,i)):(e=Oi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!al(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Pr:n,n(o,r)&&e.ref===t.ref)return il(e,t,i)}return t.flags|=1,e=Ei(a,r),e.ref=t.ref,e.return=t,t.child=e}function Mc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Pr(a,r)&&e.ref===t.ref){if(Oc=!1,t.pendingProps=r=a,al(e,i))e.flags&131072&&(Oc=!0);else return t.lanes=e.lanes,il(e,t,i)}}return Bc(e,t,n,r,i)}function Nc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Fc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&za(t,a===null?null:a.cachePool),a===null?xo():bo(t,a),Do(t);else return r=t.lanes=536870912,Fc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&za(t,null),xo(),Oo()):(za(t,a.cachePool),bo(t,a),Oo(),t.memoizedState=null);return kc(e,t,i,n),t.child}function Pc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Fc(e,t,n,r,i){var a=Ra();return a=a===null?null:{parent:Ca._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&za(t,null),xo(),Do(t),e!==null&&ma(e,t,r,!0),t.childLanes=i,null}function Ic(e,t){return t=Yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Lc(e,t,n){return ro(t,e.child,null,n),e=Ic(t,t.pendingProps),e.flags|=2,ko(t),t.memoizedState=null,e}function Rc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(q){if(r.mode===`hidden`)return e=Ic(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Pc(null,e);if(Eo(t),(e=Xi)?(e=am(e,Qi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Vi===null?null:{id:Hi,overflow:Ui},retryLane:536870912,hydrationErrors:null},n=ji(e),n.return=t,t.child=n,Yi=t,Xi=null)):e=null,e===null)throw ea(t);return t.lanes=536870912,null}return Ic(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Eo(t),a){if(t.flags&256)t.flags&=-257,t=Lc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Oc||ma(e,t,n,!1),a=(n&e.childLanes)!==0,Oc||a){if(vo.current===null){if(r=Xu,r!==null&&(s=ft(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,yi(e,s),Md(r,e,s),Dc;Wd()}t=Lc(e,t,n)}else e=o.treeContext,Xi=lm(s.nextSibling),Yi=t,q=!0,Zi=null,Qi=!1,e!==null&&Ji(t,e),t=Ic(t,r),t.flags|=134221824;return t}return e=Ei(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function zc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Bc(e,t,n,r,i){return ga(t),n=Ko(e,t,n,r,void 0,i),r=Xo(),e!==null&&!Oc?(Zo(e,t,i),il(e,t,i)):(q&&r&&Ki(t),t.flags|=1,kc(e,t,n,i),t.child)}function Vc(e,t,n,r,i,a){return ga(t),t.updateQueue=null,n=Jo(t,r,n,i),qo(e),r=Xo(),e!==null&&!Oc?(Zo(e,t,a),il(e,t,a)):(q&&r&&Ki(t),t.flags|=1,kc(e,t,n,a),t.child)}function Hc(e,t,n,r,i){if(ga(t),t.stateNode===null){var a=Si,o=n.contextType;typeof o==`object`&&o&&(a=_a(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=mc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},oo(t),o=n.contextType,a.context=typeof o==`object`&&o?_a(o):Si,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(pc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&mc.enqueueReplaceState(a,a.state,null),ho(t,r,a,i),mo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=_c(n,s);a.props=c;var l=a.context,u=n.contextType;o=Si,typeof u==`object`&&u&&(o=_a(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&gc(t,a,r,o),ao=!1;var f=t.memoizedState;a.state=f,ho(t,r,a,i),mo(),l=t.memoizedState,s||f!==l||ao?(typeof d==`function`&&(pc(t,n,d,r),l=t.memoizedState),(c=ao||hc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,so(e,t),o=t.memoizedProps,u=_c(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Si,typeof l==`object`&&l&&(c=_a(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&gc(t,a,r,c),ao=!1,f=t.memoizedState,a.state=f,ho(t,r,a,i),mo();var p=t.memoizedState;o!==d||f!==p||ao||e!==null&&e.dependencies!==null&&ha(e.dependencies)?(typeof s==`function`&&(pc(t,n,s,r),p=t.memoizedState),(u=ao||hc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ha(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,zc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ro(t,e.child,null,i),t.child=ro(t,null,n,i)):kc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=il(e,t,i),e}function Uc(e,t,n,r){return ia(),t.flags|=256,kc(e,t,n,r),t.child}var Wc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gc(e){return{baseLanes:e,cachePool:Ba()}}function Kc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=sd),e}function qc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Ao.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(q){if(i?To(t):Oo(),(e=Xi)?(e=am(e,Qi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Vi===null?null:{id:Hi,overflow:Ui},retryLane:536870912,hydrationErrors:null},n=ji(e),n.return=t,t.child=n,Yi=t,Xi=null)):e=null,e===null)throw ea(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Oo(),i=t.mode,a=Yc({mode:`hidden`,children:a},i),r=ki(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Gc(n),r.childLanes=Kc(e,o,n),t.memoizedState=Wc,Pc(null,r)):(To(t),Jc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return Zc(e,t,a,o,r,c,s,n)}return i?(Oo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Ei(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=ki(i,a,n,null),i.flags|=2):i=Ei(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Pc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Gc(n):(a=i.cachePool,a===null?a=Ba():(s=Ca._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Kc(e,o,n),t.memoizedState=Wc,Pc(e.child,r)):(To(t),n=e.child,e=n.sibling,n=Ei(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Jc(e,t){return t=Yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Yc(e,t){return e=wi(22,e,null,t),e.lanes=0,e}function Xc(e,t,n){return ro(t,e.child,null,n),e=Jc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zc(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(To(t),t.flags&=-257,Xc(e,t,c)):t.memoizedState===null?(Oo(),o=a.fallback,s=t.mode,a=Yc({mode:`visible`,children:a.children},s),o=ki(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,ro(t,e.child,null,c),a=t.child,a.memoizedState=Gc(c),a.childLanes=Kc(e,r,c),t.memoizedState=Wc,Pc(null,a)):(Oo(),t.child=e.child,t.flags|=128,null);if(To(t),sm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,oa({value:a,source:null,stack:null})),Xc(e,t,c)}if(Oc||ma(e,t,c,!1),r=(c&e.childLanes)!==0,Oc||r){if(vo.current!==null)return Xc(e,t,c);if(r=Xu,r!==null&&(a=ft(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,yi(e,a),Md(r,e,a),Dc;return om(o)||Wd(),Xc(e,t,c)}return om(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,Xi=lm(o.nextSibling),Yi=t,q=!0,Zi=null,Qi=!1,e!==null&&Ji(t,e),t=Jc(t,a.children),t.flags|=134221824,t)}function Qc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),fa(e.return,t,n)}function $c(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&No(n)===null&&(t=e),e=e.sibling}return t}function el(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function tl(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function nl(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Ao.current;if(t.flags&128)return jo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,jo(t,o),i===`backwards`&&e!==null?(tl(e),kc(e,t,r,n),tl(e)):kc(e,t,r,n),r=q?Ri:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Qc(e,n,t);else if(e.tag===19)Qc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=$c(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,tl(t)),el(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&No(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}el(t,!0,n,null,a,r);break;case`together`:el(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=$c(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),el(t,!1,i,n,a,r)}return t.child}function rl(e,t,n){var r=t.pendingProps;return ua(t,t.type,r.value),kc(e,t,r.children,n),t.child}function il(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),id|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ma(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Ei(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ei(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function al(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ha(e)))}function ol(e,t,n){switch(t.tag){case 3:xe(t,t.stateNode.containerInfo),ua(t,Ca,e.memoizedState.cache),ia();break;case 27:case 5:Ce(t);break;case 4:xe(t,t.stateNode.containerInfo);break;case 10:ua(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Eo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return To(t),t.flags|=128,null;r=ma(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?qc(e,t,n):(To(t),e=il(e,t,n),e===null?null:e.sibling)}To(t);break;case 19:if(t.flags&128)return nl(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(ma(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return nl(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),jo(t,Ao.current),r)break;return null;case 22:return t.lanes=0,Nc(e,t,n,t.pendingProps);case 24:ua(t,Ca,e.memoizedState.cache)}return il(e,t,n)}function sl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Oc=!0;else{if(!al(e,n)&&!(t.flags&128))return Oc=!1,ol(e,t,n);Oc=!!(e.flags&131072)}}else Oc=!1,q&&t.flags&1048576&&Gi(t,Ri,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=qa(t.elementType),t.type=e,typeof e==`function`)Ti(e)?(r=_c(e,r),t.tag=1,t=Hc(null,t,e,r,n)):(t.tag=0,t=Bc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===te){t.tag=11,t=Ac(null,t,e,r,n);break a}if(a===P){t.tag=14,t=jc(null,t,e,r,n);break a}if(a===j){t.tag=10,t.type=e,t=rl(null,t,n);break a}}throw t=ue(e)||e,Error(i(306,t,``))}}return t;case 0:return Bc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=_c(r,t.pendingProps),Hc(e,t,r,a,n);case 3:a:{if(xe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,so(e,t),ho(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ua(t,Ca,r),r!==o.cache&&pa(t,[Ca],n,!0),mo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Uc(e,t,r,n);break a}if(r!==a){a=Pi(Error(i(424)),t),oa(a),t=Uc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Xi=lm(e.firstChild),Yi=t,q=!0,Zi=null,Qi=!0,n=io(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ia(),r===a){t=il(e,t,n);break a}kc(e,t,r,n)}t=t.child}return t;case 26:return zc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:q||(t.stateNode=fp(t.type,t.pendingProps,z.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ce(t),e===null&&q&&(r=t.stateNode=hm(t.type,t.pendingProps,z.current),Yi=t,Qi=!0,a=Xi,Sp(t.type)?(um=a,Xi=lm(r.firstChild)):Xi=a),kc(e,t,t.pendingProps.children,n),zc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&q&&((a=r=Xi)&&(r=rm(r,t.type,t.pendingProps,Qi),r===null?a=!1:(t.stateNode=r,Yi=t,Xi=lm(r.firstChild),Qi=!1,a=!0)),a||ea(t)),Ce(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,pp(a,o)?r=null:s!==null&&pp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Ko(e,t,Yo,null,null,n),sh._currentValue=a),zc(e,t),kc(e,t,r,n),t.child;case 6:return e===null&&q&&((e=n=Xi)&&(n=im(n,t.pendingProps,Qi),n===null?e=!1:(t.stateNode=n,Yi=t,Xi=null,e=!0)),e||ea(t)),null;case 13:return qc(e,t,n);case 4:return xe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ro(t,null,r,n):kc(e,t,r,n),t.child;case 11:return Ac(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,zc(e,t),kc(e,t,r,n),t.child;case 8:return kc(e,t,t.pendingProps.children,n),t.child;case 12:return kc(e,t,t.pendingProps.children,n),t.child;case 10:return rl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,ga(t),a=_a(a),r=r(a),t.flags|=1,kc(e,t,r,n),t.child;case 14:return jc(e,t,t.type,t.pendingProps,n);case 15:return Mc(e,t,t.type,t.pendingProps,n);case 19:return nl(e,t,n);case 31:return Rc(e,t,n);case 22:return Nc(e,t,n,t.pendingProps);case 24:return ga(t),r=_a(Ca),e===null?(a=Ra(),a===null&&(a=Xu,o=wa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},oo(t),ua(t,Ca,a)):((e.lanes&n)!==0&&(so(e,t),ho(t,null,null,n),mo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,ua(t,Ca,r),r!==a.cache&&pa(t,[Ca],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),ua(t,Ca,r))),kc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:q&&Ki(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:zc(e,t),kc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function cl(e){e.flags|=4}function ll(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Vd())e.flags|=8192;else throw Ja=Wa,Ha}}else e.flags&=-16777217}function ul(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Vd())e.flags|=8192;else throw Ja=Wa,Ha}}function dl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:st(),e.lanes|=t,cd|=t)}function fl(e,t){if(!q)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function pl(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ml(e,t,n){var r=t.pendingProps;switch(qi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pl(t),null;case 1:return pl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),da(Ca),Se(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ra(t)?cl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,aa())),pl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(cl(t),o===null?(pl(t),ll(t,a,null,r,n)):(pl(t),ul(t,o))):o?o===e.memoizedState?(pl(t),t.flags&=-16777217):(cl(t),pl(t),ul(t,o)):(e=e.memoizedProps,e!==r&&cl(t),pl(t),ll(t,a,e,r,n)),null;case 27:if(we(t),n=z.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return pl(t),t.subtreeFlags&=-33554433,null}e=ve.current,ra(t)?ta(t,e):(e=hm(a,r,n),t.stateNode=e,cl(t))}return pl(t),t.subtreeFlags&=-33554433,null;case 5:if(we(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return pl(t),t.subtreeFlags&=-33554433,null}if(o=ve.current,ra(t))ta(t,o);else{var s=lp(z.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[vt]=t,o[yt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(np(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&cl(t)}}return pl(t),t.subtreeFlags&=-33554433,ll(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=z.current,ra(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Yi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[vt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||$f(e.nodeValue,n)),e||ea(t,!0)}else e=lp(e).createTextNode(r),e[vt]=t,t.stateNode=e}return pl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ra(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[vt]=t}else ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pl(t),e=!1}else n=aa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ko(t),t):(ko(t),null);if(t.flags&128)throw Error(i(558))}return pl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ra(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[vt]=t}else ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pl(t),a=!1}else a=aa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ko(t),t):(ko(t),null)}return ko(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),dl(t,t.updateQueue),pl(t),null);case 4:return Se(),e===null&&Uf(t.stateNode.containerInfo),t.flags|=67108864,pl(t),null;case 10:return da(t.type),pl(t),null;case 19:if(Mo(t),r=t.memoizedState,r===null)return pl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)fl(r,!1);else{if(rd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=No(e),o!==null){for(t.flags|=128,fl(r,!1),e=o.updateQueue,t.updateQueue=e,dl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Di(n,e),n=n.sibling;return jo(t,Ao.current&1|2),q&&Wi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Le()>md&&(t.flags|=128,a=!0,fl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=No(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,dl(t,e),fl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!q)return pl(t),null}else 2*Le()-r.renderingStartTime>md&&n!==536870912&&(t.flags|=128,a=!0,fl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Le(),e.sibling=null,o=Ao.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||q?jo(t,o):(n=o,_e(Co,t),_e(Ao,n),wo===null&&(wo=t)),q&&Wi(t,r.treeForkCount),e}return pl(t),null;case 22:case 23:return ko(t),So(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(pl(t),t.subtreeFlags&6&&(t.flags|=8192)):pl(t),n=t.updateQueue,n!==null&&dl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ge(La),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),da(Ca),pl(t),null;case 25:return null;case 30:return t.flags|=33554432,pl(t),null}throw Error(i(156,t.tag))}function hl(e,t){switch(qi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return da(Ca),Se(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return we(t),null;case 31:if(t.memoizedState!==null){if(ko(t),t.alternate===null)throw Error(i(340));ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ko(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Mo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Se(),null;case 10:return da(t.type),null;case 22:case 23:return ko(t),So(),e!==null&&ge(La),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return da(Ca),null;case 25:return null;default:return null}}function gl(e,t){switch(qi(t),t.tag){case 3:da(Ca),Se();break;case 26:case 27:case 5:we(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&ko(t);break;case 13:ko(t);break;case 19:Mo(t);break;case 10:da(t.type);break;case 22:case 23:ko(t),So(),e!==null&&ge(La);break;case 24:da(Ca)}}function _l(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){ff(t,t.return,e)}}function vl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){ff(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ff(t,t.return,e)}}function yl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{_o(t,n)}catch(t){ff(e,e.return,t)}}}function bl(e,t,n){n.props=_c(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ff(e,t,n)}}function xl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=li(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);f(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ff(e,t,n)}}function Y(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){ff(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){ff(e,t,n)}else n.current=null}}function Sl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)em(e.stateNode,t[n])}function Cl(e){for(var t=e.return;t!==null&&(El(t)&&em(e.stateNode,t.stateNode),!Tl(t));)t=t.return}function wl(e){for(var t=e.return;t!==null&&(El(t)&&tm(e.stateNode,t.stateNode),!Tl(t));)t=t.return}function Tl(e){return e.tag===5||e.tag===3||e.tag===27}function El(e){return e&&e.tag===7&&e.stateNode!==null}function Dl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){ff(e,e.return,t)}}function Ol(e,t,n){try{var r=e.stateNode;ip(r,e.type,n,t),r[yt]=t}catch(t){ff(e,e.return,t)}}function kl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sp(e.type)||e.tag===4}function Al(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||kl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Sp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function jl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=fn)),Sl(e,r),H=!0;else if(i!==4&&(i===27&&(Sl(e,r),r=null,Sp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(jl(e,t,n,r),e=e.sibling;e!==null;)jl(e,t,n,r),e=e.sibling}function Ml(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Sl(e,r),H=!0;else if(i!==4&&(i===27&&(Sl(e,r),r=null,Sp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Ml(e,t,n,r),e=e.sibling;e!==null;)Ml(e,t,n,r),e=e.sibling}function Nl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);np(t,r,n),t[vt]=e,t[yt]=n}catch(t){ff(e,e.return,t)}}var Pl=!1,Fl=null;function Il(e){(e.tag===30||e.subtreeFlags&33554432)&&(Pl=!0)}var Ll=null;function Rl(){var e=Ll;return Ll=null,e}var zl=0;function Bl(e,t,n,r,i){return zl=0,Vl(e.child,t,n,r,i)}function Vl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Op(o);r.push(s),s.view&&(a=!0)}else a||Op(o).view&&(a=!0);Pl=!0,Tp(o,zl===0?t:t+`_`+zl,n),zl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Vl(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function Hl(e,t){for(;e!==null;)e.tag===5?Ep(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Hl(e.child,t)),e=e.sibling}function Ul(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Ul(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=di(t.default,t.share),t!==`none`&&(Bl(e,n,t,null,!1)||Hl(e.child,!1))}e=e.sibling}}function Wl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=li(r,n),a=di(r.default,n.paired?r.share:r.enter);a===`none`?Ul(e):Bl(e,i,a,null,!1)?(Ul(e),n.paired||t||jd(e,r.onEnter)):Hl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Wl(e,t),e=e.sibling;else Ul(e)}function Gl(e){if(Fl!==null&&Fl.size!==0){var t=Fl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=di(n.default,n.share);if(a!==`none`&&(Bl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,jd(e,n.onShare)):Hl(e.child,!1)),t.delete(r),t.size===0)break}}}Gl(e)}e=e.sibling}}}function Kl(e){if(e.tag===30){var t=e.memoizedProps,n=li(t,e.stateNode),r=Fl===null?void 0:Fl.get(n),i=di(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Bl(e,n,i,null,!1)?r===void 0?jd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Fl.delete(n),jd(e,t.onShare)):Hl(e.child,!1)),Fl!==null&&Gl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Kl(e),e=e.sibling;else Fl!==null&&Gl(e)}function ql(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=li(t,e.stateNode);t=di(t.default,t.update),e.flags&=-5,t!==`none`&&Bl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&ql(e);e=e.sibling}}function Jl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Hl(e.child,!1))}Jl(e)}e=e.sibling}}function Yl(e){if(e.tag===30)e.stateNode.paired=null,Hl(e.child,!1),Jl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Yl(e),e=e.sibling;else Jl(e)}function Xl(e){for(e=e.child;e!==null;)e.tag===30?Hl(e.child,!1):e.subtreeFlags&33554432&&Xl(e),e=e.sibling}function Zl(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&zl<a.length){var l=a[zl],u=Op(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Tp(c,zl===0?n:n+`_`+zl,i),s&&e.flags&4||(Ll===null&&(Ll=[]),Ll.push(c,zl===0?r:r+`_`+zl,t.memoizedProps)),zl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:Zl(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Ql(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=li(n,r),a=di(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(kp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;zl=0,i=Zl(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||jd(e,n.onUpdate))}else e.subtreeFlags&33554432&&Ql(e,t);e=e.sibling}}var $l=!1,X=!1,eu=!1,tu=!1,nu=typeof WeakSet==`function`?WeakSet:Set,ru=null,iu=!1,au=!1,ou=!1,su=!1;function cu(e,t,n){if(e=e.containerInfo,sp=gh,e=zr(e),Br(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(cp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,ru=t,t=n?9270:1024;ru!==null;){if(e=ru,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Kl(r[a]);if(e.alternate===null&&e.flags&2)n&&Il(e),lu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Kl(r),lu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Il(e),lu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,ru=r):(n&&ql(e),lu(n))}}Fl=null}function lu(e){for(;ru!==null;){var t=ru,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=_c(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){ff(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)nm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:nm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=li(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=di(a.default,a.update),a!==`none`&&Bl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,ru=r;break}ru=t.return}}function uu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Au(e,n),r&4&&_l(5,n);break;case 1:if(Au(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ff(n,n.return,e)}else{var i=_c(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ff(n,n.return,e)}}}r&64&&yl(n),r&512&&xl(n,n.return);break;case 3:if(Au(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{_o(e,t)}catch(e){ff(n,n.return,e)}}break;case 27:t===null&&r&4&&Nl(n);case 26:case 5:Au(e,n),t===null&&r&4&&Dl(n),r&512&&xl(n,n.return);break;case 12:Au(e,n);break;case 31:Au(e,n),r&4&&yu(e,n);break;case 13:Au(e,n),r&4&&bu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=gf.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||$l,!r){var a=t!==null&&t.memoizedState!==null||X;t=$l,i=X,$l=r,(X=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Mu(e,n,r)):Au(e,n),$l=t,X=i}break;case 30:Au(e,n),r&512&&xl(n,n.return);break;case 7:r&512&&xl(n,n.return);default:Au(e,n)}}function du(e,t){for(e=e.child;e!==null;)fu(e,t),e=e.sibling}function fu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){ff(e,e.return,t)}pu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,H=!0}catch(t){ff(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?wp(s,!0):wp(e.stateNode,!1)}catch(t){ff(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&du(e,t);break;default:du(e,t)}}function pu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:fu(n,r);break a;case 22:n.memoizedState===null&&pu(n,r);break a;default:pu(n,r)}}e=e.sibling}}function mu(e){var t=e.alternate;t!==null&&(e.alternate=null,mu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Dt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var hu=null,gu=!1;function _u(e,t,n){for(n=n.child;n!==null;)vu(e,t,n),n=n.sibling}function vu(e,t,n){if(Je&&typeof Je.onCommitFiberUnmount==`function`)try{Je.onCommitFiberUnmount(qe,n)}catch{}switch(n.tag){case 26:X||Y(n,t),_u(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!X&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:X||Y(n,t),wl(n);var r=hu,i=gu;Sp(n.type)&&(hu=n.stateNode,gu=!1),_u(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),hu=r,gu=i;break;case 5:X||Y(n,t),wl(n);case 6:if(n.tag===6&&wl(n),r=hu,i=gu,hu=null,_u(e,t,n),hu=r,gu=i,hu!==null){if(gu)try{(hu.nodeType===9?hu.body:hu.nodeName===`HTML`?hu.ownerDocument.body:hu).removeChild(n.stateNode),H=!0}catch(e){ff(n,t,e)}else try{hu.removeChild(n.stateNode),H=!0}catch(e){ff(n,t,e)}}break;case 18:hu!==null&&(gu?(e=hu,Cp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):Cp(hu,n.stateNode));break;case 4:r=hu,i=gu,hu=n.stateNode.containerInfo,gu=!0,_u(e,t,n),hu=r,gu=i;break;case 0:case 11:case 14:case 15:vl(2,n,t),X||vl(4,n,t),_u(e,t,n);break;case 1:X||(Y(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&bl(n,t,r)),_u(e,t,n);break;case 21:_u(e,t,n);break;case 22:X=(r=X)||n.memoizedState!==null,_u(e,t,n),X=r;break;case 30:Y(n,t),_u(e,t,n);break;case 7:X||Y(n,t),_u(e,t,n);break;default:_u(e,t,n)}}function yu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){ff(t,t.return,e)}}}function bu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){ff(t,t.return,e)}}function xu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new nu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new nu),t;default:throw Error(i(435,e.tag))}}function Su(e,t){var n=xu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=_f.bind(null,e,t);t.then(r,r)}})}function Cu(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Sp(l.type)){hu=l.stateNode,gu=!1;break a}break;case 5:hu=l.stateNode,gu=!1;break a;case 3:case 4:hu=l.stateNode.containerInfo,gu=!0;break a}l=l.return}if(hu===null)throw Error(i(160));vu(s,c,o),hu=null,gu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Tu(t,e,n),t=t.sibling}var wu=null;function Tu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Cu(t,e,n),Eu(e),a&4&&(vl(3,e,e.return),_l(3,e),vl(5,e,e.return));break;case 1:Cu(t,e,n),Eu(e),a&512&&(X||r===null||Y(r,r.return)),a&64&&$l&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=wu,Cu(t,e,n),Eu(e),a&512&&(X||r===null||Y(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if($l)e.stateNode=fp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[Tt]||r[vt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),np(r,t,n),r[vt]=e,Mt(r),t=r;break a;case`link`:if(o=Gm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Gm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[vt]=e,Mt(r),t=r}e.stateNode=t}}else $l||Km(o,e.type,e.stateNode)}else e.stateNode=Bm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Ol(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||X||t.parentNode.removeChild(t)):a.count--,n===null?$l||Km(o,e.type,e.stateNode):Bm(o,n,e.memoizedProps))}break;case 27:Cu(t,e,n),Eu(e),a&512&&(X||r===null||Y(r,r.return)),r!==null&&a&4&&Ol(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=eu,eu=!1,Cu(t,e,n),eu=o,Eu(e),a&512&&(X||r===null||Y(r,r.return)),e.flags&32){t=e.stateNode;try{on(t,``),H=!0}catch(t){ff(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Ol(e,t,r===null?t:r.memoizedProps)),a&1024&&(tu=!0);break;case 6:if(Cu(t,e,n),Eu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,H=!0}catch(t){ff(e,e.return,t)}}break;case 3:if(H=!1,Wm=null,o=wu,wu=bm(t.containerInfo),Cu(t,e,n),wu=o,Eu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){ff(e,e.return,t)}tu&&(tu=!1,Du(e)),H=!1;break;case 4:a=eu,eu=$l,r=Ht(),o=wu,wu=bm(e.stateNode.containerInfo),Cu(t,e,n),Eu(e),wu=o,H&&au&&(ou=!0),H=r,eu=a;break;case 12:Cu(t,e,n),Eu(e);break;case 31:Cu(t,e,n),Eu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Su(e,t)));break;case 13:Cu(t,e,n),Eu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(fd=Le()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Su(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=$l,l=X,u=eu;$l=c||o,eu=u||o,X=l||s,Cu(t,e,n),X=l,eu=u,$l=c,Eu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||$l||X||(t=s||X,n=$l,r=X,$l=o||$l,X=t,ju(e,2),$l=n,X=r),!o&&eu||du(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Su(e,n))));break;case 19:Cu(t,e,n),Eu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Su(e,t)));break;case 30:a&512&&(X||r===null||Y(r,r.return)),a=Ht(),o=au,s=(n&335544064)===n,c=e.memoizedProps,au=s&&di(c.default,c.update)!==`none`,Cu(t,e,n),Eu(e),s&&r!==null&&H&&(e.flags|=4),au=o,H=a;break;case 21:break;case 7:a&512&&(X||r===null||Y(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Cu(t,e,n),Eu(e)}}function Eu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(kl(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(El(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Tl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Ml(e,Al(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(on(l,``),n.flags&=-33),Ml(e,Al(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;jl(e,Al(e),u,s);break;default:throw Error(i(161))}}catch(t){ff(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Du(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Du(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Ou(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)ku(t,e),t=t.sibling;else Ql(t,!1)}function ku(e,t){var n=e.alternate;if(n===null)Wl(e,!1);else switch(e.tag){case 3:if(su=iu=!1,Rl(),Ou(t,e),!iu&&!ou){if(e=Ll,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ep(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),su=!0}Ll=null;break;case 5:Ou(t,e);break;case 4:r=iu,iu=!1,Ou(t,e),iu&&(ou=!0),iu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Ou(t,e):Wl(e,!1));break;case 30:r=iu,i=Rl(),iu=!1,Ou(t,e),iu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=li(a,o),o=li(n.memoizedProps,o);var s=di(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,zl=0,t=Zl(e,n,t,o,s,a,!0),zl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(jd(e,e.memoizedProps.onUpdate),Ll=i):i!==null&&(i.push.apply(i,Ll),Ll=i),iu=e.flags&32?!0:r;break;default:Ou(t,e)}}function Au(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)uu(e,t.alternate,t),t=t.sibling}function ju(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:vl(4,n,n.return),ju(n,r);break;case 1:Y(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&bl(n,n.return,i),ju(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:Y(n,n.return),n.tag!==5&&n.tag!==27||wl(n),ju(n,r);break;case 6:wl(n);break;case 26:Y(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||X||i.parentNode.removeChild(i),ju(n,r);break;case 22:n.memoizedState===null&&ju(n,r);break;case 30:Y(n,n.return),ju(n,r);break;case 7:Y(n,n.return);default:ju(n,r)}e=e.sibling}}function Mu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Mu(i,a,n),_l(4,a);break;case 1:if(Mu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ff(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)go(l[i],c)}catch(e){ff(r,r.return,e)}}s&&o&64&&yl(a),xl(a,a.return);break;case 27:n&2&&Nl(a);case 5:a.tag!==5&&a.tag!==27||Cl(a),Mu(i,a,n),s&&r===null&&o&4&&Dl(a),xl(a,a.return);break;case 6:Cl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||$l||Km(bm(c.ownerDocument),a.type,c),Mu(i,a,n),s&&r===null&&o&4&&Dl(a),xl(a,a.return);break;case 12:Mu(i,a,n);break;case 31:Mu(i,a,n),s&&o&4&&yu(i,a);break;case 13:Mu(i,a,n),s&&o&4&&bu(i,a);break;case 22:a.memoizedState===null&&Mu(i,a,n),xl(a,a.return);break;case 30:Mu(i,a,n),xl(a,a.return);break;case 7:xl(a,a.return);default:Mu(i,a,n)}t=t.sibling}}function Nu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ta(n))}function Pu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ta(e))}function Fu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Iu(e,t,n,r),t=t.sibling;else i&&Xl(t)}function Iu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Yl(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Fu(e,t,n,r),a&2048&&_l(9,t);break;case 1:Fu(e,t,n,r);break;case 3:Fu(e,t,n,r),i&&su&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ta(a)));break;case 12:if(a&2048){Fu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){ff(t,t.return,e)}}else Fu(e,t,n,r);break;case 31:Fu(e,t,n,r);break;case 13:Fu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&Yl(t),o._visibility&2?Fu(e,t,n,r):(o._visibility|=2,Lu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&Yl(s),o._visibility&2?Fu(e,t,n,r):Ru(e,t)),a&2048&&Nu(s,t);break;case 24:Fu(e,t,n,r),a&2048&&Pu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Hl(a.child,!0),Hl(t.child,!0))),Fu(e,t,n,r);break;default:Fu(e,t,n,r)}}function Lu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Lu(a,o,s,c,i),_l(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Lu(a,o,s,c,i)):u._visibility&2?Lu(a,o,s,c,i):Ru(a,o),i&&l&2048&&Nu(o.alternate,o);break;case 24:Lu(a,o,s,c,i),i&&l&2048&&Pu(o.alternate,o);break;default:Lu(a,o,s,c,i)}t=t.sibling}}function Ru(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ru(n,r),i&2048&&Nu(r.alternate,r);break;case 24:Ru(n,r),i&2048&&Pu(r.alternate,r);break;default:Ru(n,r)}t=t.sibling}}var zu=8192;function Bu(e,t,n){if(e.subtreeFlags&zu)for(e=e.child;e!==null;)Vu(e,t,n),e=e.sibling}function Vu(e,t,n){switch(e.tag){case 26:Bu(e,t,n),e.flags&zu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,wu,e.memoizedState,e.memoizedProps));break;case 5:Bu(e,t,n),e.flags&zu&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=wu;wu=bm(e.stateNode.containerInfo),Bu(e,t,n),wu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=zu,zu=16777216,Bu(e,t,n),zu=r):Bu(e,t,n));break;case 30:if((e.flags&zu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Fl===null&&(Fl=new Map),Fl.set(r,i)}Bu(e,t,n);break;default:Bu(e,t,n)}}function Hu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Uu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ru=r,Ku(r,e)}Hu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Wu(e),e=e.sibling}function Wu(e){switch(e.tag){case 0:case 11:case 15:Uu(e),e.flags&2048&&vl(9,e,e.return);break;case 3:Uu(e);break;case 12:Uu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Gu(e)):Uu(e);break;default:Uu(e)}}function Gu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ru=r,Ku(r,e)}Hu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:vl(8,t,t.return),Gu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Gu(t));break;default:Gu(t)}e=e.sibling}}function Ku(e,t){for(;ru!==null;){var n=ru;switch(n.tag){case 0:case 11:case 15:vl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ta(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ru=r;else a:for(n=e;ru!==null;){r=ru;var i=r.sibling,a=r.return;if(mu(r),r===n){ru=null;break a}if(i!==null){i.return=a,ru=i;break a}ru=a}}}var qu={getCacheForType:function(e){var t=_a(Ca),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return _a(Ca).controller.signal}},Ju=typeof WeakMap==`function`?WeakMap:Map,Yu=0,Xu=null,Z=null,Q=0,Zu=0,Qu=null,$u=!1,ed=!1,td=!1,nd=0,rd=0,id=0,ad=0,od=0,sd=0,cd=0,ld=null,ud=null,dd=!1,fd=0,pd=0,md=1/0,hd=null,gd=null,_d=0,vd=null,yd=null,bd=0,xd=0,Sd=null,Cd=null,wd=null,Td=null,Ed=null,Dd=0,Od=null;function kd(){return Yu&2&&Q!==0?Q&-Q:L.T===null?ht():Nf()}function Ad(){if(sd===0){if(!(Q&536870912)||q){var e=et;et<<=1,!(et&3932160)&&(et=262144),sd=e}else sd=536870912}return e=Co.current,e!==null&&(e.flags|=32),sd}function jd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Pp(li(e.memoizedProps,n))),Td===null&&(Td=[]),Td.push(t.bind(null,r))}}function Md(e,t,n){(e===Xu&&(Zu===2||Zu===9)||e.cancelPendingCommit!==null)&&(zd(e,0),Id(e,Q,sd,!1)),lt(e,n),(!(Yu&2)||e!==Xu)&&(e===Xu&&(!(Yu&2)&&(ad|=n),rd===4&&Id(e,Q,sd,!1)),Tf(e))}function Nd(e,t,n){if(Yu&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||it(e,t),a=r?qd(e,t):Gd(e,t,!0),o=r;do{if(a===0){ed&&!r&&Id(e,t,0,!1);break}if(n=e.current.alternate,o&&!Fd(n)){a=Gd(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=ld;var l=c.current.memoizedState.isDehydrated;if(l&&(zd(c,s).flags|=256),s=Gd(c,s,!1),s!==2&&s!==6){if(td&&!l){c.errorRecoveryDisabledLanes|=o,ad|=o,a=4;break a}o=ud,ud=a,o!==null&&(ud===null?ud=o:ud.push.apply(ud,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){zd(e,0),Id(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Id(r,t,sd,!$u);break a;case 2:ud=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=fd+300-Le(),10<a)){if(Id(r,t,sd,!$u),rt(r,0,!0)!==0)break a;bd=t,r.timeoutHandle=gp(Pd.bind(null,r,n,ud,hd,dd,t,sd,ad,cd,$u,o,`Throttled`,-0,0),a);break a}Pd(r,n,ud,hd,dd,t,sd,ad,cd,$u,o,null,-0,0)}break}while(1);Tf(e)}function Pd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;if(d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:fn},Fl=null,Vu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?fd-Le():(a&4194048)===a?pd-Le():0,m=eh(d,m),m!==null)){bd=a,e.cancelPendingCommit=m(ef.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Id(e,a,o,!l);return}ef(e,t,a,n,r,i,o,s,c,l,u,d)}function Fd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Nr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Id(e,t,n,r){t=at(e,t),t&=~od,t&=~ad,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-B(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&V(e,n,t)}function Ld(){return Yu&6?!0:(Ef(0,!1),!1)}function Rd(){if(Z!==null){if(Zu===0)var e=Z.return;else e=Z,la=ca=null,Qo(e),Za=null,Qa=0,e=Z;for(;e!==null;)gl(e.alternate,e),e=e.return;Z=null}}function zd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,_p(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),bd=0,Rd(),Xu=e,Z=n=Ei(e.current,null),Q=t,Zu=0,Qu=null,$u=!1,ed=it(e,t),td=!1,cd=sd=od=ad=id=rd=0,ud=ld=null,dd=!1,nd=at(e,t),gi(),n}function Bd(e,t){J=null,L.H=lc,t===Va||t===Ua?(t=Ya(),Zu=3):t===Ha?(t=Ya(),Zu=4):Zu=t===Dc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Qu=t,Z===null&&(rd=1,xc(e,Pi(t,e.current)))}function Vd(){var e=Co.current;return e===null?!0:(Q&4194048)===Q?wo===null:(Q&62914560)===Q||Q&536870912?e===wo:!1}function Hd(){var e=L.H;return L.H=lc,e===null?lc:e}function Ud(){var e=L.A;return L.A=qu,e}function Wd(){rd=4,$u||(Q&4194048)!==Q&&Co.current!==null||(ed=!0),!(id&134217727)&&!(ad&134217727)||Xu===null||Id(Xu,Q,sd,!1)}function Gd(e,t,n){var r=Yu;Yu|=2;var i=Hd(),a=Ud();(Xu!==e||Q!==t)&&(hd=null,zd(e,t)),t=!1;var o=rd;a:do try{if(Zu!==0&&Z!==null){var s=Z,c=Qu;switch(Zu){case 8:Rd(),o=6;break a;case 3:case 2:case 9:case 6:Co.current===null&&(t=!0);var l=Zu;if(Zu=0,Qu=null,Zd(e,s,c,l),n&&ed){o=0;break a}break;default:l=Zu,Zu=0,Qu=null,Zd(e,s,c,l)}}Kd(),o=rd;break}catch(t){Bd(e,t)}while(1);return t&&e.shellSuspendCounter++,la=ca=null,Yu=r,L.H=i,L.A=a,Z===null&&(Xu=null,Q=0,gi()),o}function Kd(){for(;Z!==null;)Yd(Z)}function qd(e,t){var n=Yu;Yu|=2;var r=Hd(),a=Ud();Xu!==e||Q!==t?(hd=null,md=Le()+500,zd(e,t)):ed=it(e,t);a:do try{if(Zu!==0&&Z!==null){t=Z;var o=Qu;b:switch(Zu){case 1:Zu=0,Qu=null,Zd(e,t,o,1);break;case 2:case 9:if(Ga(o)){Zu=0,Qu=null,Xd(t);break}t=function(){Zu!==2&&Zu!==9||Xu!==e||(Zu=7),Tf(e)},o.then(t,t);break a;case 3:Zu=7;break a;case 4:Zu=5;break a;case 7:Ga(o)?(Zu=0,Qu=null,Xd(t)):(Zu=0,Qu=null,Zd(e,t,o,7));break;case 5:var s=null;switch(Z.tag){case 26:s=Z.memoizedState;case 5:case 27:var c=Z;if(s?Ym(s):c.stateNode.complete){Zu=0,Qu=null;var l=c.sibling;if(l!==null)Z=l;else{var u=c.return;u===null?Z=null:(Z=u,Qd(u))}break b}}Zu=0,Qu=null,Zd(e,t,o,5);break;case 6:Zu=0,Qu=null,Zd(e,t,o,6);break;case 8:Rd(),rd=6;break a;default:throw Error(i(462))}}Jd();break}catch(t){Bd(e,t)}while(1);return la=ca=null,L.H=r,L.A=a,Yu=n,Z===null?(Xu=null,Q=0,gi(),rd):0}function Jd(){for(;Z!==null&&!Fe();)Yd(Z)}function Yd(e){var t=sl(e.alternate,e,nd);e.memoizedProps=e.pendingProps,t===null?Qd(e):Z=t}function Xd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Vc(n,t,t.pendingProps,t.type,void 0,Q);break;case 11:t=Vc(n,t,t.pendingProps,t.type.render,t.ref,Q);break;case 5:Qo(t);var r=t;r===Yi&&(q?(na(r),r.tag===5&&r.stateNode!=null&&(Xi=r.stateNode)):(na(r),q=!0));default:gl(n,t),t=Z=Di(t,nd),t=sl(n,t,nd)}e.memoizedProps=e.pendingProps,t===null?Qd(e):Z=t}function Zd(e,t,n,r){la=ca=null,Qo(t),Za=null,Qa=0;var i=t.return;try{if(Ec(e,i,t,n,Q)){rd=1,xc(e,Pi(n,e.current)),Z=null;return}}catch(t){if(i!==null)throw Z=i,t;rd=1,xc(e,Pi(n,e.current)),Z=null;return}t.flags&32768?(q||r===1?e=!0:ed||Q&536870912?e=!1:($u=e=!0,(r===2||r===9||r===3||r===6)&&(r=Co.current,r!==null&&r.tag===13&&(r.flags|=16384))),$d(t,e)):Qd(t)}function Qd(e){var t=e;do{if(t.flags&32768){$d(t,$u);return}e=t.return;var n=ml(t.alternate,t,nd);if(n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);rd===0&&(rd=5)}function $d(e,t){do{var n=hl(e.alternate,e);if(n!==null){n.flags&=32767,Z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Z=e;return}Z=e=n}while(e!==null);rd=6,Z=null}function ef(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do lf();while(_d!==0);if(Yu&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===Xu&&(Z=Xu=null,Q=0),yd=t,vd=e,bd=n,Sd=a,Cd=r,tf(e,t,n,s,c,l,f)}}function tf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(xd=s,s|=hi,ut(e,n,s,r,i,a),Td=null,(n&335544064)===n?(Ed=Oa(e),r=10262):(Ed=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,vf(Ve,function(){return uf(),null})):(e.callbackNode=null,e.callbackPriority=0),Pl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=L.T,L.T=null,i=R.p,R.p=2,a=Yu,Yu|=4;try{cu(e,t,n)}finally{Yu=a,R.p=i,L.T=r}}_d=1,Pl?wd=Mp(o,e.containerInfo,Ed,af,of,rf,sf,uf,nf,null,null):(af(),of(),sf())}function nf(e){if(_d!==0){var t=vd.onRecoverableError;t(e,{componentStack:null})}}function rf(){_d===3&&(_d=0,ku(yd,vd),_d=4)}function af(){if(_d===1){_d=0;var e=vd,t=yd,n=bd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=L.T,L.T=null;var i=R.p;R.p=2;var a=Yu;Yu|=4;try{au=ou=!1,Tu(t,e,n),n=cp;var o=zr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Rr(s.ownerDocument.documentElement,s)){if(c!==null&&Br(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Lr(s,h),v=Lr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!sp,cp=sp=null}finally{Yu=a,R.p=i,L.T=r}}e.current=t,_d=2}}function of(){if(_d===2){_d=0;var e=vd,t=yd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=L.T,L.T=null;var r=R.p;R.p=2;var i=Yu;Yu|=4;try{uu(e,t.alternate,t)}finally{Yu=i,R.p=r,L.T=n}}_d=3}}function sf(){if(_d===4||_d===3){_d=0;var e=wd;wd=null,Ie();var t=vd,n=yd,r=bd,i=Cd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?_d=5:(_d=0,yd=vd=null,cf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(gd=null),mt(r),n=n.stateNode,Je&&typeof Je.onCommitFiberRoot==`function`)try{Je.onCommitFiberRoot(qe,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=L.T,a=R.p,R.p=2,L.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{L.T=n,R.p=a}}if(i=Td,o=Ed,Ed=null,i!==null&&(Td=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);bd&3&&lf(),Tf(t),a=t.pendingLanes,r&261930&&a&42?t===Od?Dd++:(Dd=0,Od=t):(Dd=0,Od=null),Ef(0,!1)}}function cf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ta(t)))}function lf(){return wd!==null&&(wd.skipTransition(),wd=null),af(),of(),sf(),uf()}function uf(){if(_d!==5)return!1;var e=vd,t=xd;xd=0;var n=mt(bd),r=L.T,a=R.p;try{R.p=32>n?32:n,L.T=null,n=Sd,Sd=null;var o=vd,s=bd;if(_d=0,yd=vd=null,bd=0,Yu&6)throw Error(i(331));var c=Yu;if(Yu|=4,Wu(o.current),Iu(o,o.current,s,n),Yu=c,Ef(0,!1),Je&&typeof Je.onPostCommitFiberRoot==`function`)try{Je.onPostCommitFiberRoot(qe,o)}catch{}return!0}finally{R.p=a,L.T=r,cf(e,t)}}function df(e,t,n){t=Pi(n,t),t=Cc(e.stateNode,t,2),e=lo(e,t,2),e!==null&&(lt(e,2),Tf(e))}function ff(e,t,n){if(e.tag===3)df(e,e,n);else for(;t!==null;){if(t.tag===3){df(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(gd===null||!gd.has(r))){e=Pi(n,e),n=wc(2),r=lo(t,n,2),r!==null&&(Tc(n,r,t,e),lt(r,2),Tf(r));break}}t=t.return}}function pf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ju;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(td=!0,i.add(n),e=mf.bind(null,e,t,n),t.then(e,e))}function mf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Xu===e&&(Q&n)===n&&(rd===4||rd===3&&(Q&62914560)===Q&&300>Le()-fd?Yu&2?od|=n:zd(e,0):od|=n,cd===Q&&(cd=0)),Tf(e)}function hf(e,t){t===0&&(t=st()),e=yi(e,t),e!==null&&(lt(e,t),Tf(e))}function gf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),hf(e,n)}function _f(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),hf(e,n)}function vf(e,t){return Ne(e,t)}var yf=null,bf=null,xf=!1,Sf=!1,Cf=!1,wf=0;function Tf(e){e!==bf&&e.next===null&&(bf===null?yf=bf=e:bf=bf.next=e),Sf=!0,xf||(xf=!0,Mf())}function Ef(e,t){if(!Cf&&Sf){Cf=!0;do for(var n=!1,r=yf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-B(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,jf(r,a))}else a=Q,a=rt(r,r===Xu?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||it(r,a)||(n=!0,jf(r,a))}r=r.next}while(n);Cf=!1}}function Df(){Of()}function Of(){Sf=xf=!1;var e=0;wf!==0&&hp()&&(e=wf);for(var t=Le(),n=null,r=yf;r!==null;){var i=r.next,a=kf(r,t);a===0?(r.next=null,n===null?yf=i:n.next=i,i===null&&(bf=n)):(n=r,(e!==0||a&3)&&(Sf=!0)),r=i}_d!==0&&_d!==5||Ef(e,!1),wf!==0&&(wf=0)}function kf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-B(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=ot(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Xu,n=Q,n=rt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Zu===2||Zu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Pe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||it(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Pe(r),mt(n)){case 2:case 8:n=Be;break;case 32:n=Ve;break;case 268435456:n=Ue;break;default:n=Ve}return r=Af.bind(null,e),n=Ne(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Pe(r),e.callbackPriority=2,e.callbackNode=null,2}function Af(e,t){if(_d!==0&&_d!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(lf()&&e.callbackNode!==n)return null;var r=Q;return r=rt(e,e===Xu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Nd(e,r,t),kf(e,Le()),e.callbackNode!=null&&e.callbackNode===n?Af.bind(null,e):null)}function jf(e,t){if(lf())return null;Nd(e,t,!0)}function Mf(){bp(function(){Yu&6?Ne(ze,Df):Of()})}function Nf(){if(wf===0){var e=ja;e===0&&(e=$e,$e<<=1,!($e&261888)&&($e=256)),wf=e}return wf}function Pf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:dn(e)}function Ff(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Pf((i[yt]||null).action),o=r.submitter;o&&(t=(t=o[yt]||null)?Pf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new jn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(wf!==0){var e=new FormData(i,o);Js(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Js(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var If=0;If<oi.length;If++){var Lf=oi[If];si(Lf.toLowerCase(),`on`+(Lf[0].toUpperCase()+Lf.slice(1)))}si(Qr,`onAnimationEnd`),si($r,`onAnimationIteration`),si(ei,`onAnimationStart`),si(`dblclick`,`onDoubleClick`),si(`focusin`,`onFocus`),si(`focusout`,`onBlur`),si(ti,`onTransitionRun`),si(ni,`onTransitionStart`),si(ri,`onTransitionCancel`),si(ii,`onTransitionEnd`),Lt(`onMouseEnter`,[`mouseout`,`mouseover`]),Lt(`onMouseLeave`,[`mouseout`,`mouseover`]),Lt(`onPointerEnter`,[`pointerout`,`pointerover`]),Lt(`onPointerLeave`,[`pointerout`,`pointerover`]),It(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),It(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),It(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),It(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),It(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),It(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Rf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),zf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Rf));function Bf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){fi(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){fi(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[xt];n===void 0&&(n=t[xt]=new Set);var r=e+`__bubble`;n.has(r)||(Wf(t,e,2,!1),n.add(r))}function Vf(e,t,n){var r=0;t&&(r|=4),Wf(n,e,r,t)}var Hf=`_reactListening`+Math.random().toString(36).slice(2);function Uf(e){if(!e[Hf]){e[Hf]=!0,Pt.forEach(function(t){t!==`selectionchange`&&(zf.has(t)||Vf(t,!1,e),Vf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Hf]||(t[Hf]=!0,Vf(`selectionchange`,!1,t))}}function Wf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!xn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Gf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Ot(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}vn(function(){var r=a,i=mn(n),s=[];a:{var c=ai.get(e);if(c!==void 0){var l=jn,u=e;switch(e){case`keypress`:if(Dn(n)===0)break a;case`keydown`:case`keyup`:l=Yn;break;case`focusin`:u=`focus`,l=Bn;break;case`focusout`:u=`blur`,l=Bn;break;case`beforeblur`:case`afterblur`:l=Bn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Rn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=zn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Qn;break;case Qr:case $r:case ei:l=Vn;break;case ii:l=$n;break;case`scroll`:case`scrollend`:l=Nn;break;case`wheel`:l=er;break;case`copy`:case`cut`:case`paste`:l=Hn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Xn;break;case`submit`:l=Zn;break;case`toggle`:case`beforetoggle`:l=tr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=yn(m,p),g!=null&&d.push(Kf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==pn&&(u=n.relatedTarget||n.fromElement)&&(Ot(u)||u[bt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ot(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Rn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Xn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:At(c),h=l==null?u:At(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Ot(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?C(c,l,Jf):null,c!==null&&Yf(s,u,c,d,!1),l!==null&&f!==null&&Yf(s,f,l,d,!0)))}a:{if(c=r?At(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=xr;else if(hr(c)){if(Sr)_=jr;else{_=kr;var v=Or}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&cn(r.elementType)&&(_=xr):_=Ar;if(_&&=_(e,r)){gr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?At(r):window,e){case`focusin`:(hr(v)||v.contentEditable===`true`)&&(Hr=v,Ur=r,Wr=null);break;case`focusout`:Wr=Ur=Hr=null;break;case`mousedown`:Gr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Gr=!1,Kr(s,n,i);break;case`selectionchange`:if(Vr)break;case`keydown`:case`keyup`:Kr(s,n,i)}var y;if(rr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else dr?lr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(or&&n.locale!==`ko`&&(dr||b!==`onCompositionStart`?b===`onCompositionEnd`&&dr&&(y=En()):(Cn=i,wn=`value`in Cn?Cn.value:Cn.textContent,dr=!0)),v=qf(r,b),0<v.length&&(b=new Un(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=ur(n),y!==null&&(b.data=y)))),(y=ar?fr(e,n):pr(e,n))&&(b=qf(r,`onBeforeInput`),0<b.length&&(v=new Un(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Ff(s,e,r,n,i)}Bf(s,t)})}function Kf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=yn(e,n),i!=null&&r.unshift(Kf(e,i,a)),i=yn(e,t),i!=null&&r.push(Kf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Jf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Yf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=yn(n,a),l!=null&&o.unshift(Kf(n,l,c))):i||(l=yn(n,a),l!=null&&o.push(Kf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Xf=/\r\n?/g,Zf=/\u0000|\uFFFD/g;function Qf(e){return(typeof e==`string`?e:``+e).replace(Xf,`
|
|
22
|
-
`).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||on(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&on(e,``+r);else return;break;case`className`:Wt(e,`class`,r);break;case`tabIndex`:Wt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Wt(e,n,r);break;case`style`:sn(e,r,o);return;case`data`:if(t!==`object`){Wt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=dn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,a.name,a,null),ep(e,t,`formEncType`,a.formEncType,a,null),ep(e,t,`formMethod`,a.formMethod,a,null),ep(e,t,`formTarget`,a.formTarget,a,null)):(ep(e,t,`encType`,a.encType,a,null),ep(e,t,`method`,a.method,a,null),ep(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=dn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=fn);return;case`onScroll`:r!=null&&$(`scroll`,e);return;case`onScrollEnd`:r!=null&&$(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=dn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),Ut(e,`popover`,r);break;case`xlinkActuate`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Gt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Gt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Gt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Gt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ut(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=ln.get(n)||n,Ut(e,n,r);else return}H=!0}function tp(e,t,n,r,a,o){switch(n){case`style`:sn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)on(e,r);else if(typeof r==`number`||typeof r==`bigint`)on(e,``+r);else return;break;case`onScroll`:r!=null&&$(`scroll`,e);return;case`onScrollEnd`:r!=null&&$(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=fn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Ft.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[yt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}H=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ut(e,n,r)}return}H=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,o,s,n,null)}}a&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:ep(e,t,r,d,n,null)}}en(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ep(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&nn(e,!!r,n,!0):nn(e,!!r,t,!1);return;case`textarea`:for(s in $(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:ep(e,t,s,c,n,null)}an(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ep(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<Rf.length;r++)$(Rf[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,u,r,n,null)}return;default:if(cn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ep(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(H=!0),o=m;break;case`name`:m!==f&&(H=!0),a=m;break;case`checked`:m!==f&&(H=!0),u=m;break;case`defaultChecked`:m!==f&&(H=!0),d=m;break;case`value`:m!==f&&(H=!0),s=m;break;case`defaultValue`:m!==f&&(H=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}$t(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||ep(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(H=!0),p=o;break;case`defaultValue`:o!==l&&(H=!0),c=o;break;case`multiple`:o!==l&&(H=!0),s=o;default:o!==l&&ep(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?nn(e,!!n,n?[]:``,!1):nn(e,!!n,t,!0)):nn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(H=!0),p=a;break;case`defaultValue`:a!==o&&(H=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&ep(e,t,s,a,r,o)}rn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ep(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(H=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ep(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(cn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[vt]=r,n[yt]=t,np(n,e,t),Mt(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Tt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:w({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),f(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return _(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),f(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return _(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=p(this._fragmentFiber);if(t===null)return!0;t=_(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){f(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=_(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=p(this._fragmentFiber);e!==null&&(e=_(e),e=lp(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=_(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag!==6&&(e=_(e),t.observe(e),!1)}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag!==6&&(e=_(e),t.unobserve(e),!1)}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=_(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=p(this._fragmentFiber);return t===null?this:_(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=p(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];f(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=_(t);if(n.length===0){if(n=r,m(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=h(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=_(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=_(n[0]),i=_(n[n.length-1]);var a=m(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=Ot(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=p(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=C(n,a,S),t===null?t=!1:(f(t,!0,b,a,n),a=v,v=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=C(r,a,S),t===null?t=!1:(f(t,!0,x,a,r),a=v,y=v=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];f(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=h(this._fragmentFiber);if(r=n?r[1]||r[0]||p(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=_(r),Zp(e,n);return}if(r=_(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=_(a),Zp(a,n)):_(a).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=_(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),Dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Tt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===fn&&(e.onclick=null),Dt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Dt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=R.d;R.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Ld();return e||t}function Cm(e){var t=kt(e);t!==null&&t.tag===5&&t.type===`form`?Zs(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=Qt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Mt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+Qt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Qt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Qt(n.imageSizes)+`"]`)):i+=`[href="`+Qt(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=w({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[Et]=!0,o.onload=o.onerror=function(){Nt(o)}),Mt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Qt(r)+`"][href="`+Qt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=w({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Mt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=jt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=w({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Mt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=jt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=w({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Mt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=jt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=w({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Mt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=z.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=jt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=jt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=jt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href="`+Qt(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Et]){r.loading=1;return}}else t=e.createElement(`link`),t[Et]=!0,t.onload=t.onerror=Nt.bind(null,t),np(t,`link`,n),Mt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+Qt(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Qt(n.href)+`"]`);if(r)return t.instance=r,Mt(r),r;var a=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Mt(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,Mt(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),Mt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,Mt(a),a):(r=n,(a=vm.get(o))&&(r=w({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Mt(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Tt]||a[vt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Mt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Mt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:j,Provider:null,Consumer:null,_currentValue:fe,_currentValue2:fe,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ct(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ct(0),this.hiddenUpdates=ct(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=wi(3,null,null,t),e.current=a,a.stateNode=e,t=wa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},oo(a),e}function uh(e){return e?(e=Si,e):Si}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=co(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=lo(e,r,t),n!==null&&(Md(n,e,t),uo(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=yi(e,67108864);t!==null&&Md(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=kd();t=pt(t);var n=yi(e,t);n!==null&&Md(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=L.T;L.T=null;var a=R.p;try{R.p=2,yh(e,t,n,r)}finally{R.p=a,L.T=i}}function vh(e,t,n,r){var i=L.T;L.T=null;var a=R.p;try{R.p=8,yh(e,t,n,r)}finally{R.p=a,L.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Gf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=kt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=nt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-B(o);s.entanglements[1]|=c,o&=~c}Tf(a),!(Yu&6)&&(md=Le()+500,Ef(0,!1))}}break;case 31:case 13:s=yi(a,2),s!==null&&Md(s,a,2),Ld(),ph(a,2)}if(a=bh(r),a===null&&Gf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Gf(e,t,r,null,n)}}function bh(e){return e=mn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=Ot(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Re()){case ze:return 2;case Be:return 8;case Ve:case He:return 32;case Ue:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=kt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=Ot(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,gt(e.priority,function(){hh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,gt(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);pn=r,n.target.dispatchEvent(r),pn=null}else return t=kt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=kt(n);a!==null&&(e.splice(t,3),t-=3,Js(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[yt]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[yt]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dh(n,kd(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Ld(),t[bt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=ht();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.0`)throw Error(i(527,Kh,`19.3.0`));R.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:L,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{qe=Jh.inject(qh),Je=Jh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=vc,s=yc,c=bc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,o,s,c,Uh),e[bt]=t.current,Uf(e),new Wh(t)}})),Qs=t(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Zs()}))();function $s({choice:e,onChoose:t,onRefresh:n,onSetupCredentials:r}){let[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(``),c=e.models.filter(e=>`${e.label??e.id} ${e.provider}`.toLowerCase().includes(o.toLowerCase()));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{children:`Your prompt is saved. Choose a model on this machine to send it. No message has been sent yet.`}),e.error&&(0,K.jsx)(`p`,{role:`alert`,children:e.error}),(0,K.jsx)(`button`,{type:`button`,className:`btn primary session-launch-action`,disabled:e.loading||e.selecting||!t,onClick:()=>a(!0),children:e.loading?`Loading models…`:e.selecting?`Selecting model…`:`Choose model and send`}),i&&(0,K.jsxs)(ot,{title:`Choose a model`,onClose:()=>a(!1),size:`large`,autoFocusSearch:!1,children:[(0,K.jsx)(`p`,{children:`Selecting a model sends your saved first message.`}),(0,K.jsx)(`input`,{className:`picker-search`,"aria-label":`Search models`,placeholder:`Search models…`,value:o,onChange:e=>s(e.target.value)}),(0,K.jsxs)(`div`,{className:`picker-list`,children:[c.map(n=>(0,K.jsx)(lt,{title:n.label||n.id,meta:`${n.provider}${e.current?.id===n.id&&e.current.provider===n.provider?` · Default on this machine`:``}`,onClick:()=>{a(!1),t?.(n)}},`${n.provider}:${n.id}`)),!!e.models.length&&!c.length&&(0,K.jsx)(`p`,{className:`picker-empty`,children:`No models match your search.`}),!e.models.length&&(0,K.jsx)(`p`,{className:`picker-empty`,children:e.error||`No connected models are available. Set up model credentials, then refresh.`})]}),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:n,children:`Refresh models`}),!e.models.length&&!e.error&&r&&(0,K.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>{r()},children:`Set up model credentials`})]})]})}var ec=[{id:`account`,label:`Checking account and provider access`},{id:`capacity`,label:`Reserving Bivy Cloud capacity`},{id:`machine`,label:`Creating the isolated Machine`},{id:`service`,label:`Starting the secure Bivy service`},{id:`credentials`,label:`Loading encrypted credentials`},{id:`repository`,label:`Preparing the repository`,skippedLabel:`No repository selected`},{id:`agent`,label:`Starting the agent and session`},{id:`message`,label:`Delivering your first message`}];function tc(e,t){let n=Math.max(0,Math.floor((t-e)/1e3)),r=Math.floor(n/60),i=n%60;return r?`${r}:${String(i).padStart(2,`0`)}`:`${i}s`}function nc({progress:e,onSetupCredentials:t,onRetryLaunch:n,onRetryFreshMachine:r,onChooseModel:i,onRefreshModels:a}){let o=e.modelChoice,s=e.checkpoints.account?.errorCode===`managed_credentials_required`,c=e.checkpoints.machine?.state===`done`?r:n,l=e.checkpoints.machine?.state===`done`?`Retry on a new Cloud Machine`:`Retry this launch`,u=e.firstResponseAt??e.failedAt,[d,f]=(0,G.useState)(()=>u??Date.now()),[p,m]=(0,G.useState)(!1);(0,G.useEffect)(()=>{if(u){f(u);return}let e=window.setInterval(()=>f(Date.now()),1e3);return()=>window.clearInterval(e)},[u]);let h=tc(e.startedAt,u??d),g=e.firstResponseAt?`Agent responded in ${h}`:e.failedAt?`Startup failed after ${h}`:o?o.loading?`Loading models from this machine`:o.selecting?`Confirming model selection`:`Choose a model before your first message`:e.checkpoints.message?.state===`done`?`Waiting for agent response · ${h} elapsed`:`Starting Bivy Cloud · ${h} elapsed`;return(0,K.jsxs)(`section`,{className:`session-launch-progress`,"aria-label":`Bivy Cloud startup progress`,children:[(0,K.jsx)(`div`,{className:`session-launch-progress-title`,"aria-live":`polite`,children:g}),o&&(0,K.jsx)($s,{choice:o,onChoose:i,onRefresh:a,onSetupCredentials:t}),(0,K.jsx)(`ol`,{className:`session-launch-checkpoints`,children:ec.map(({id:t,label:n,skippedLabel:r})=>{let i=e.checkpoints[t],a=e.failedAt&&i?.state===`active`?`waiting`:i?.state??`waiting`,o=a===`skipped`&&r?r:n;return(0,K.jsxs)(`li`,{className:`session-launch-checkpoint state-${a}`,children:[(0,K.jsx)(`span`,{className:`session-launch-checkpoint-mark`,"aria-hidden":`true`,children:a===`done`?`✓`:a===`failed`?`!`:a===`skipped`?`–`:a===`active`?(0,K.jsx)(Ct,{size:`xs`}):`○`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`session-launch-checkpoint-label`,children:o}),a===`failed`&&i?.error&&(0,K.jsx)(`span`,{className:`session-launch-checkpoint-error`,children:i.error})]}),(0,K.jsxs)(`span`,{className:`sr-only`,children:[` — `,a]})]},t)})}),e.failedAt&&s&&t&&(0,K.jsx)(`button`,{type:`button`,className:`btn primary session-launch-action`,disabled:p,onClick:()=>{m(!0),t().finally(()=>m(!1))},children:p?`Opening setup…`:`Set up model credentials`}),e.failedAt&&!s&&c&&(0,K.jsx)(`button`,{type:`button`,className:`btn primary session-launch-action`,disabled:p,onClick:()=>{m(!0),c().finally(()=>m(!1))},children:p?`Retrying…`:l})]})}var rc=8e3;function ic({approval:e,onResolve:t}){let[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(!1),c=tn(e),l=typeof e.rememberKey==`string`&&e.rememberKey?e.rememberKey:null,u=c.canRemember&&l!==null,d=(0,G.useRef)(null),f=(0,G.useRef)(null);(0,G.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let p=()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>a(!0),rc)},m=(n,i=!1)=>{d.current={approved:n,remember:i},r(!0),a(!1),t(e.id,n,i),p()},h=()=>{d.current&&(a(!1),t(e.id,d.current.approved,d.current.remember),p())},g=c.severity===`critical`?`Permanent`:c.severity===`high`?`High risk`:c.severity===`medium`?`Medium risk`:`Low risk`,_=c.severity===`critical`||c.severity===`high`?`danger`:c.severity===`medium`?`warn`:`accent`;return(0,K.jsxs)(`div`,{id:`attention-${encodeURIComponent(e.id)}`,className:`card approval-card sev-${c.severity}${n?` pending`:``}`,"data-tone":c.severity===`critical`?`danger`:`accent`,"data-attention-card":!0,tabIndex:-1,children:[(0,K.jsxs)(`div`,{className:`approval-head`,children:[(0,K.jsx)(`span`,{className:`approval-title`,children:c.title}),(0,K.jsx)(Te,{tone:_,variant:`soft`,upper:!0,children:g})]}),(0,K.jsx)(`div`,{className:`approval-consequence`,children:c.consequence}),typeof e.reason==`string`&&e.reason&&(0,K.jsx)(`div`,{className:`approval-reason`,children:e.reason}),c.command&&(0,K.jsx)(`pre`,{className:`approval-command`,children:c.command}),c.fields.length>0&&(0,K.jsx)(`div`,{className:`approval-fields`,children:c.fields.map(([e,t])=>(0,K.jsxs)(`div`,{className:`approval-field`,children:[(0,K.jsx)(`div`,{className:`approval-field-label`,children:e}),(0,K.jsx)(`div`,{className:`approval-field-value`,children:t})]},e))}),(0,K.jsxs)(`button`,{type:`button`,className:`approval-raw-toggle`,onClick:()=>s(e=>!e),children:[o?`Hide`:`Show`,` raw tool input`]}),o&&(0,K.jsx)(`pre`,{className:`approval-summary`,children:c.rawInput}),n?(0,K.jsxs)(`div`,{className:`approval-waiting`,children:[`Waiting for the machine to apply your choice…`,i&&(0,K.jsxs)(`div`,{className:`approval-stalled`,children:[(0,K.jsx)(`span`,{children:`This is taking longer than expected.`}),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:h,children:`Retry`})]})]}):(0,K.jsxs)(`div`,{className:`approval-actions`,children:[(0,K.jsx)(`button`,{className:`btn danger-ghost`,onClick:()=>m(!1),children:`Reject`}),u&&(0,K.jsxs)(`button`,{className:`btn ghost`,onClick:()=>m(!0,!0),title:`Approve, and allow “${l}” without asking until this session closes`,children:[`Allow “`,l,`” this session`]}),(0,K.jsx)(`button`,{className:`btn primary`,onClick:()=>m(!0),children:c.severity===`critical`?`Approve destructive action`:`Approve once`})]})]})}function ac({approvals:e,onResolve:t}){return e.length===0?null:(0,K.jsx)(`div`,{className:`approval-stack`,children:e.map(e=>(0,K.jsx)(ic,{approval:e,onResolve:t},e.id))})}var oc=8e3;function sc({request:e,onAnswer:t,onCancel:n}){let[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1),s=(0,G.useRef)(null),c=(0,G.useRef)(null);(0,G.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let l=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>o(!0),oc)},[u,d]=(0,G.useState)({}),[f,p]=(0,G.useState)(()=>Object.fromEntries(e.questions.map((e,t)=>[t,e.options.length===0]))),[m,h]=(0,G.useState)({}),g=(e,t,n)=>{d(r=>{let i=r[e]||[];if(!n)return{...r,[e]:i[0]===t?[]:[t]};let a=i.includes(t);return{...r,[e]:a?i.filter(e=>e!==t):[...i,t]}}),n||p(t=>({...t,[e]:!1}))},_=(e,t)=>{p(n=>{let r=!n[e];return r&&!t&&d(t=>({...t,[e]:[]})),{...n,[e]:r}})},v=e=>(u[e]||[]).length>0||!!f[e]&&(m[e]||``).trim().length>0,y=e.questions.every((e,t)=>v(t)),b=()=>{let t={};return e.questions.forEach((e,n)=>{let r=[...u[n]||[]];if(f[n]){let e=(m[n]||``).trim();e&&r.push(e)}t[e.question]=r.join(`, `)}),t};return(0,K.jsxs)(`div`,{id:`attention-${encodeURIComponent(e.id)}`,className:`card question-card`,"data-tone":`accent`,"data-attention-card":!0,tabIndex:-1,children:[e.questions.map((e,t)=>{let n=u[t]||[];return(0,K.jsxs)(`div`,{className:`question-item`,children:[(0,K.jsx)(`div`,{className:`question-head`,children:(0,K.jsx)(Te,{tone:`accent`,variant:`soft`,upper:!0,children:e.header})}),(0,K.jsx)(`div`,{className:`question-text`,children:e.question}),(0,K.jsxs)(`div`,{className:`question-options`,children:[e.options.map(i=>(0,K.jsxs)(`button`,{type:`button`,className:`question-option${n.includes(i.label)?` selected`:``}`,onClick:()=>g(t,i.label,e.multiSelect),disabled:r,title:i.description,children:[(0,K.jsx)(`span`,{className:`question-option-label`,children:i.label}),i.description&&(0,K.jsx)(`span`,{className:`question-option-desc`,children:i.description})]},i.label)),e.options.length>0&&(0,K.jsxs)(`button`,{type:`button`,className:`question-option${f[t]?` selected`:``}`,onClick:()=>_(t,e.multiSelect),disabled:r,children:[(0,K.jsx)(`span`,{className:`question-option-label`,children:`Other`}),(0,K.jsx)(`span`,{className:`question-option-desc`,children:`Write your own answer`})]}),f[t]&&(0,K.jsx)(`textarea`,{className:`field question-other-input`,value:m[t]||``,onChange:e=>h(n=>({...n,[t]:e.target.value})),placeholder:`Type your answer…`,"aria-label":e.question,rows:2,autoFocus:e.options.length>0,disabled:r})]})]},t)}),r?(0,K.jsxs)(`div`,{className:`approval-waiting`,children:[`Sending your answer…`,a&&(0,K.jsxs)(`div`,{className:`approval-stalled`,children:[(0,K.jsx)(`span`,{children:`This is taking longer than expected.`}),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>{o(!1),c.current===`skip`?n(e.id,e.sessionId):t(e.id,e.sessionId,b()),l()},children:`Retry`})]})]}):(0,K.jsxs)(`div`,{className:`approval-actions`,children:[(0,K.jsx)(`button`,{className:`btn danger-ghost`,onClick:()=>{c.current=`skip`,i(!0),o(!1),n(e.id,e.sessionId),l()},children:`Skip`}),(0,K.jsxs)(`button`,{className:`btn primary`,onClick:()=>{c.current=`answer`,i(!0),o(!1),t(e.id,e.sessionId,b()),l()},disabled:!y,children:[`Send answer`,e.questions.length>1?`s`:``]})]})]})}function cc({questions:e,onAnswer:t,onCancel:n}){return e.length===0?null:(0,K.jsx)(`div`,{className:`approval-stack`,children:e.map(e=>(0,K.jsx)(sc,{request:e,onAnswer:t,onCancel:n},e.id))})}function lc({attention:e,onResolve:t}){let[n,r]=(0,G.useState)(null),i=n=>{r(n),t(e.sessionId,n)};return(0,K.jsxs)(`div`,{id:`attention-${encodeURIComponent(e.sessionId)}`,className:`card question-card turn-attention-card`,"data-tone":`warn`,"data-attention-card":!0,tabIndex:-1,role:`alert`,children:[(0,K.jsxs)(`div`,{className:`question-item`,children:[(0,K.jsx)(`div`,{className:`question-head`,children:(0,K.jsx)(Te,{tone:`warn`,variant:`soft`,upper:!0,children:`Turn may be stuck`})}),(0,K.jsx)(`div`,{className:`question-text`,children:e.message}),(0,K.jsx)(`div`,{className:`question-option-desc`,children:`Bivy has not stopped the agent. The normal turn time limit is still active.`})]}),(0,K.jsxs)(`div`,{className:`approval-actions`,children:[(0,K.jsx)(`button`,{className:`btn danger-ghost`,onClick:()=>i(`stop`),disabled:n!==null,children:n===`stop`?`Stopping…`:`Stop turn`}),(0,K.jsx)(`button`,{className:`btn primary`,onClick:()=>i(`continue`),disabled:n!==null,children:n===`continue`?`Continuing…`:`Keep waiting`})]})]})}var uc=`false`,dc=`false`,fc=uc===`true`,pc=dc===`true`;function mc(e={}){let{immediate:t=!1,onNeedReload:n,onNeedRefresh:r,onOfflineReady:i,onRegistered:a,onRegisteredSW:o,onRegisterError:s}=e,c,l,u,d=async(e=!0)=>{await l,fc||u?.()};async function f(){if(`serviceWorker`in navigator){if(c=await C(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bd17z0YL.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{s?.(e)}),!c)return;if(u=()=>{c?.messageSkipWaiting()},!pc){if(fc)c.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(n?n():window.location.reload())}),c.addEventListener(`installed`,e=>{e.isUpdate||i?.()});else{let e=!1,t=()=>{e=!0,c?.addEventListener(`controlling`,e=>{e.isUpdate&&(n?n():window.location.reload())}),r?.()};c.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&i?.():n.isExternal?t():!e&&i?.():n.isUpdate||i?.()}),c.addEventListener(`waiting`,t)}}c.register({immediate:t}).then(e=>{o?o(`/sw.js`,e):a?.(e)}).catch(e=>{s?.(e)})}}return l=f(),d}async function hc(e,t=15e3){let n=e?.waiting;n&&n.state!==`activated`&&await new Promise((e,r)=>{let i=t=>{clearTimeout(o),n.removeEventListener(`statechange`,a),t?r(t):e()},a=()=>{n.state===`activated`?i():n.state===`redundant`&&i(Error(`The update was replaced. Please try Reload again.`))},o=setTimeout(()=>i(Error(`The update did not activate. Please try Reload again.`)),t);n.addEventListener(`statechange`,a);try{n.postMessage({type:`SKIP_WAITING`}),a()}catch(e){i(e instanceof Error?e:Error(String(e)))}})}var gc=new Set,_c=!1;function vc(){n||mc({immediate:!0,onNeedReload(){},onNeedRefresh(){_c=!0,R(!0);for(let e of gc)e(!0)}})}function yc(e){return gc.add(e),_c&&e(!0),()=>gc.delete(e)}async function bc(){if(n||!Ee())return!1;let e=await navigator.serviceWorker?.getRegistration();return!Ee()||(await hc(e),!Ee())?!1:(window.location.reload(),!0)}function xc({tone:e,className:t=``,children:n,...r}){return(0,K.jsx)(`div`,{className:`toast${t?` ${t}`:``}`,"data-tone":e,...r,children:n})}function Sc({tone:e,children:t}){return(0,K.jsx)(`span`,{className:`status-icon`,"data-tone":e,"aria-hidden":!0,children:t})}function Cc(){let[e,t]=(0,G.useState)(!1),[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(null),o=(0,G.useSyncExternalStore)(Pe,Me);if((0,G.useEffect)(()=>yc(t),[]),!e)return null;let s=Be(o);return(0,K.jsxs)(xc,{tone:`accent`,className:`update-toast`,role:`status`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:`A Bivy update is ready.`}),` `,s.length?`Reload is available after ${s.join(`, `)}.`:`Draft text and attachment names are stored in this browser; cached transcripts remain when browser storage is available. File contents must be re-selected.`]}),i&&(0,K.jsx)(`span`,{role:`alert`,children:i}),(0,K.jsxs)(`div`,{className:`update-toast-actions`,children:[(0,K.jsx)(`button`,{className:`btn ghost`,onClick:()=>t(!1),disabled:n,children:`Later`}),(0,K.jsx)(`button`,{className:`btn primary`,onClick:async()=>{if(!n){r(!0),a(null);try{await bc()}catch(e){a(e instanceof Error?e.message:`Update failed. Please try Reload again.`)}finally{r(!1)}}},disabled:n||s.length>0,"aria-disabled":n||s.length>0,children:n?`Updating…`:`Reload`})]})]})}function wc({setupRequired:e,passwordConfigured:t}){let[n,r]=(0,G.useState)(e&&!t),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(``);async function m(e){if(e.preventDefault(),!u){if(p(``),n&&o!==c){p(`Passwords do not match.`);return}d(!0);try{let e=await fetch(`/auth/owner/${n?`setup`:`login`}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({password:o,...n?{setupToken:i}:{}}),signal:AbortSignal.timeout(2e4)}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||`Could not sign in. Please try again.`);if(typeof t.token!=`string`||!t.token)throw Error(`The server did not return a sign-in token.`);typeof t.relayUrl==`string`&&(z.local.relay=t.relayUrl),a(``),s(``),l(``),await z.completeSignIn(t.token)}catch(e){p(e instanceof Error?e.message:`Could not reach your server. Try again.`)}finally{d(!1)}}}return(0,K.jsxs)(`section`,{"aria-labelledby":`owner-sign-in-heading`,children:[(0,K.jsx)(`h2`,{id:`owner-sign-in-heading`,children:n?`Set up owner access`:`Owner sign-in`}),n&&(0,K.jsx)(`p`,{className:`muted`,children:`Choose a password to sign in without an email provider.`}),(0,K.jsxs)(`form`,{className:`setup-email`,onSubmit:m,"aria-busy":u,children:[n&&(0,K.jsxs)(`div`,{className:`settings-field`,children:[(0,K.jsx)(`label`,{className:`field-label`,htmlFor:`owner-secret`,children:`Setup secret`}),(0,K.jsx)(`input`,{id:`owner-secret`,className:`field`,type:`password`,autoComplete:`off`,value:i,onChange:e=>a(e.target.value),required:!0,maxLength:256,disabled:u,"aria-describedby":`owner-secret-help`}),(0,K.jsx)(`span`,{className:`muted`,id:`owner-secret-help`,children:`SELF_HOST_SETUP_TOKEN from your deployment settings. Keep it private.`})]}),(0,K.jsxs)(`div`,{className:`settings-field`,children:[(0,K.jsx)(`label`,{className:`field-label`,htmlFor:`owner-password`,children:n?`New password`:`Password`}),(0,K.jsx)(`input`,{id:`owner-password`,className:`field`,type:`password`,autoComplete:n?`new-password`:`current-password`,value:o,onChange:e=>s(e.target.value),minLength:12,maxLength:256,required:!0,disabled:u,"aria-describedby":n?`owner-password-help`:void 0}),n&&(0,K.jsx)(`span`,{className:`muted`,id:`owner-password-help`,children:`At least 12 characters. Save it in your password manager.`})]}),n&&(0,K.jsxs)(`div`,{className:`settings-field`,children:[(0,K.jsx)(`label`,{className:`field-label`,htmlFor:`owner-confirmation`,children:`Confirm password`}),(0,K.jsx)(`input`,{id:`owner-confirmation`,className:`field`,type:`password`,autoComplete:`new-password`,value:c,onChange:e=>l(e.target.value),required:!0,maxLength:256,disabled:u})]}),f&&(0,K.jsx)(`p`,{className:`setup-error`,role:`alert`,children:f}),f&&n&&(0,K.jsx)(`button`,{type:`button`,className:`btn link`,onClick:()=>location.reload(),children:`Reload sign-in options`}),(0,K.jsx)(`button`,{className:`btn primary block`,type:`submit`,disabled:u||!o||n&&(!i||!c),children:u?`Signing in…`:n?`Save password and continue`:`Sign in as owner`})]}),t&&(0,K.jsxs)(`details`,{className:`setup-note muted`,children:[(0,K.jsx)(`summary`,{className:`btn link`,children:`Forgot your password?`}),(0,K.jsx)(`p`,{className:`muted`,children:`Generate a new random SELF_HOST_SETUP_TOKEN in your deployment settings, redeploy, then reload this page. Old setup secrets cannot be reused. Resetting revokes existing account sign-ins.`}),e&&(0,K.jsx)(`button`,{type:`button`,className:`btn link`,disabled:u,onClick:()=>{r(!n),p(``),s(``),l(``),a(``)},children:n?`Back to password sign-in`:`Reset owner password`})]})]})}function Tc({className:e}){return(0,K.jsxs)(`svg`,{className:e,viewBox:`0 0 32 32`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:[(0,K.jsx)(`path`,{d:`M23.5 4 L24.45 7.05 L27.5 8 L24.45 8.95 L23.5 12 L22.55 8.95 L19.5 8 L22.55 7.05 Z`,fill:`var(--accent)`}),(0,K.jsx)(`path`,{d:`M28 11.4 L28.35 12.55 L29.5 12.9 L28.35 13.25 L28 14.4 L27.65 13.25 L26.5 12.9 L27.65 12.55 Z`,fill:`var(--accent)`,opacity:`.8`}),(0,K.jsx)(`path`,{d:`M3 25.5 L11.5 11 L16.5 19.5 L20 14 L29 25.5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,K.jsx)(`path`,{d:`M3 25.5 H29`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,opacity:`.35`})]})}function Ec({onDismiss:e}={}){let t=u(),[r,i]=(0,G.useState)(null),[a,c]=(0,G.useState)(``),[l,d]=(0,G.useState)(0);(0,G.useEffect)(()=>{let e=new AbortController,n=setTimeout(()=>e.abort(),1e4),r=!0;return c(``),fetch(`${t}/auth/owner/status`,{signal:e.signal}).then(async e=>{if(e.status===404||e.ok&&!e.headers.get(`content-type`)?.includes(`application/json`))return{enabled:!1,passwordConfigured:!1,setupRequired:!1,github:!0,email:!0};if(!e.ok)throw Error(`Could not load sign-in options.`);let t=await e.json();if(typeof t.enabled!=`boolean`||typeof t.github!=`boolean`||typeof t.email!=`boolean`)throw Error(`Invalid sign-in configuration from server.`);return t}).then(e=>{r&&i(T(e))}).catch(()=>{r&&c(`Could not reach your server. Check the connection and try again.`)}).finally(()=>clearTimeout(n)),()=>{r=!1,e.abort(),clearTimeout(n)}},[t,l]);let f=s.signInFlow===`device`||n||Ne(),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(null),[x,S]=(0,G.useState)(!1),[C,w]=(0,G.useState)(null),[E,D]=(0,G.useState)(null);(0,G.useEffect)(()=>{let e=``;try{let t=new URLSearchParams(location.search);if(e=(t.get(`authError`)||``).trim(),e){t.delete(`authError`);let e=t.toString();history.replaceState(null,``,location.pathname+(e?`?${e}`:``)+location.hash)}}catch{}e&&D({"github-email":`GitHub didn't share a verified email, so we couldn't sign you in. Add and verify an email on your GitHub account, or use email sign-in below.`,"github-config":`Couldn't complete GitHub sign-in due to a server issue. Please try again in a moment.`,expired:`That sign-in request was invalid or expired. Please try again.`}[e]||`Sign-in failed. Please try again.`)},[]);let[O,k]=(0,G.useState)(null),[A,ee]=(0,G.useState)(!1),j=(0,G.useRef)(!1),[te,M]=(0,G.useState)(!1),N=(0,G.useRef)(null);(0,G.useEffect)(()=>()=>{j.current=!0,N.current&&(N.current.cancelled=!0)},[]);function P(){j.current=!0,S(!1),w(null),k(null)}function ne(){N.current&&(N.current.cancelled=!0),N.current=null,M(!1),g(null),b(null)}async function F(e,t){let n=Date.now()+e.expiresInMs;try{for(;!t.cancelled&&Date.now()<n;){if(await new Promise(t=>setTimeout(t,e.intervalMs)),t.cancelled)return;if(Date.now()>=n)break;let r;try{r=await _e(z.local,e.deviceId,e.deviceSecret)}catch{continue}if(t.cancelled)return;if(r.status===`complete`){await z.completeSignIn(r.token,()=>!t.cancelled);return}if(r.status===`expired`||r.status===`error`)throw Error(r.error||`That sign-in link expired. Please request a new one.`)}if(!t.cancelled)throw Error(`Sign-in timed out. Please request a new link.`)}catch(e){t.cancelled||(D(e instanceof Error?e.message:`Sign-in failed.`),M(!1))}finally{N.current===t&&(N.current=null)}}async function I(e){if(e&&!_){D(null),v(!0),g({text:`Sending…`});try{if(f){N.current&&(N.current.cancelled=!0);let t={cancelled:!1};N.current=t;let n=await Fe(z.local,e);if(t.cancelled)return;n.devLink?g({text:`Dev link:`,href:n.devLink}):g({text:`Check your email — we sent a sign-in link to ${e}. Open it on this device and you'll be signed in here automatically.`}),b(e),M(!0),F(n,t);return}let n=await fetch(`${t}/auth/magic-link/start`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e})}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r?.error||`Could not send sign-in link.`);r?.devLink?g({text:`Dev link:`,href:r.devLink}):g({text:`Check your email — we sent a sign-in link to ${e}.`}),b(e)}catch(e){g({text:e instanceof Error?e.message:`Could not send sign-in link.`}),b(null),M(!1)}finally{v(!1)}}}function re(e){e.preventDefault(),I(p.trim())}async function ie(){if(x)return;w(null),D(null),S(!0),k(null),j.current=!1;let e=n?null:window.open(``,`_blank`);try{let t=await Ve(z.local);if(j.current)return;k(t.authorizeUrl),n?await o(t.authorizeUrl):e?e.location.href=t.authorizeUrl:window.open(t.authorizeUrl,`_blank`,`noopener`);let r=Date.now()+t.expiresInMs;for(;!j.current&&Date.now()<r;){if(await new Promise(e=>setTimeout(e,t.intervalMs)),j.current)return;let n=await _e(z.local,t.deviceId,t.deviceSecret);if(n.status===`complete`){try{e?.close()}catch{}await z.completeSignIn(n.token,()=>!j.current);return}if(n.status===`expired`||n.status===`error`)throw Error(n.error||`Sign-in expired. Please try again.`)}if(!j.current)throw Error(`Sign-in timed out. Please try again.`)}catch(t){try{e?.close()}catch{}j.current||w(t instanceof Error?t.message:`GitHub sign-in failed.`)}finally{j.current||(S(!1),k(null))}}return(0,K.jsx)(`div`,{className:`setup`,children:(0,K.jsxs)(`div`,{className:`card setup-card`,children:[e&&(0,K.jsx)(`button`,{type:`button`,className:`btn link setup-back`,onClick:e,children:`‹ Back`}),(0,K.jsx)(Tc,{className:`setup-logo`}),(0,K.jsx)(`h1`,{children:`Bivy`}),(0,K.jsx)(`p`,{children:s.signInDescription??(r?.enabled?`Your self-hosted Bivy workspace.`:`Run Claude Code, Codex, or another coding agent on a Machine you control — then continue it from your browser or phone.`)}),!r&&!a&&(0,K.jsx)(`p`,{className:`muted`,role:`status`,children:`Loading sign-in options…`}),a&&(0,K.jsxs)(`div`,{className:`setup-error`,role:`alert`,children:[(0,K.jsx)(`p`,{children:a}),(0,K.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>d(e=>e+1),children:`Retry`})]}),r?.enabled&&(0,K.jsx)(wc,{setupRequired:r.setupRequired,passwordConfigured:r.passwordConfigured}),r&&!r.enabled&&!r.github&&!r.email&&(0,K.jsx)(`p`,{className:`muted`,children:s.unavailableSignInMessage??`No browser sign-in method is configured. Use your private server-shell sign-in link, or configure SELF_HOST_SETUP_TOKEN in your deployment settings.`}),E&&(0,K.jsx)(`div`,{className:`setup-error`,role:`alert`,children:E}),r?.github&&(0,K.jsxs)(K.Fragment,{children:[r.enabled&&(0,K.jsx)(`div`,{className:`setup-or`,children:`or`}),f?(0,K.jsx)(`button`,{type:`button`,className:`btn primary block`,onClick:ie,disabled:x,children:x?`Waiting for GitHub…`:`Continue with GitHub`}):(0,K.jsx)(`a`,{className:`btn primary block`,href:`${t}/auth/github/start?return=${encodeURIComponent(location.pathname)}`,onClick:()=>{D(null),ee(!0)},children:A?`Redirecting…`:`Continue with GitHub`}),x&&(0,K.jsxs)(`div`,{className:`setup-note muted`,children:[(0,K.jsx)(`p`,{children:`Finish signing in on the GitHub tab, then return here — this completes automatically.`}),O&&(0,K.jsxs)(`p`,{children:[`Tab didn't open?`,` `,(0,K.jsx)(`a`,{href:O,target:`_blank`,rel:`noopener`,children:`Open GitHub sign-in`})]}),(0,K.jsx)(`button`,{type:`button`,className:`btn link`,onClick:P,children:`Cancel`})]}),C&&(0,K.jsx)(`p`,{className:`setup-note muted`,children:C})]}),r?.email&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`setup-or`,children:r.enabled||r.github?`or with email`:`Sign in with email`}),(0,K.jsxs)(`form`,{className:`setup-email`,onSubmit:re,children:[(0,K.jsx)(`input`,{className:`field`,type:`email`,inputMode:`email`,autoComplete:`email`,placeholder:`you@example.com`,"aria-label":`Email address`,value:p,onChange:e=>m(e.target.value),required:!0}),(0,K.jsx)(`button`,{className:!r?.enabled&&!r?.github?`btn primary`:`btn`,type:`submit`,disabled:_||te||!p.trim(),children:te?`Waiting for link…`:`Continue with email`})]}),h&&(0,K.jsxs)(`p`,{className:`setup-note muted`,children:[h.text,` `,h.href&&(0,K.jsx)(`a`,{href:h.href,onClick:n?e=>{e.preventDefault(),o(h.href).catch(()=>D(`Could not open the sign-in link.`))}:void 0,children:h.href})]}),te&&(0,K.jsxs)(`p`,{className:`setup-note muted`,children:[`Keep this window open — signing you in automatically once you tap the link.`,` `,(0,K.jsx)(`button`,{type:`button`,className:`btn link`,onClick:ne,children:`Cancel`})]}),y&&!_&&(0,K.jsxs)(`p`,{className:`setup-note muted`,children:[`Didn't get it? Check your spam folder, or`,` `,(0,K.jsx)(`button`,{type:`button`,className:`btn link`,onClick:()=>void I(y),children:`resend the link`}),`. You can also edit the address above and send again.`]})]}),r&&!r.enabled&&(r.github||r.email)&&(0,K.jsxs)(`p`,{className:`setup-foot muted`,children:[`By continuing, you agree to the `,(0,K.jsx)(`a`,{href:`https://bivy.sh/terms.html`,children:`Terms`}),` and acknowledge the`,` `,(0,K.jsx)(`a`,{href:`https://bivy.sh/privacy.html`,children:`Privacy Policy`}),`.`]})]})})}function Dc(){let{connection:{nodes:e,currentNodeId:t,status:n},activeSession:{activeSessionId:r},sessionIndex:{sessions:i},draft:a}=je(),o=Re(),s=oe&&o,[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)([]),[f,p]=(0,G.useState)([]),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(!1),v=(0,G.useRef)(null);rt(()=>l(!1),c);let y=n===`reconnecting`||n===`connecting`;(0,G.useEffect)(()=>{if(!c)return;s&&(z.listEphemeralConfigs().then(e=>d(e.filter(e=>!!ue(e.provider)))).catch(()=>{}),z.listHostedMachines().then(p).catch(()=>{}));let e=e=>{v.current&&!v.current.contains(e.target)&&l(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[c,s]);let b=i.find(e=>e.sessionId===r),x=b?.nodeId||t,S=e.find(e=>e.id===x),C=b?.pendingLaunch?b.pendingNodeName:void 0,w=s&&!r?a.ephemeralConfig:null,T=S?.name?.replace(/^Hosted\s+/i,``)||x||`Machine`,E=w?w.name:C||(S?.id.startsWith(`eph-`)?`${T} — running`:T),D=!w&&S?.online,O=e.filter(e=>!e.id.startsWith(`eph-`)),k=(0,G.useMemo)(()=>f.filter(t=>t.purpose===`interactive`&&t.desiredState!==`deleted`&&t.nodeId&&e.some(e=>e.id===t.nodeId)),[f,e]),A=e=>{let t=(u.find(t=>t.id===e.setupId)?.name||e.name||`Bivy Cloud`).replace(/^Hosted\s+/i,``),n=Date.parse(e.createdAt);return!e.ttlMinutes||!Number.isFinite(n)?`${t} — running`:`${t} — running · ${Math.max(0,Math.ceil((n+e.ttlMinutes*6e4-Date.now())/6e4))} min remaining`},ee=!!r;return(0,K.jsxs)(`div`,{className:`node-switcher`,ref:v,children:[(0,K.jsxs)(`button`,{className:`node-switcher-btn${ee?` locked`:``}`,onClick:t=>{t.stopPropagation(),!ee&&(e.length===0&&z.refreshNodes(),l(e=>!e))},"aria-haspopup":ee?void 0:`menu`,"aria-expanded":ee?void 0:c,"aria-label":ee?`Session machine: ${E}`:void 0,children:[y?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ct,{size:`xs`}),(0,K.jsx)(`span`,{className:`sr-only`,children:`Reconnecting — `})]}):(0,K.jsx)(Ot,{status:D?`online`:`idle`,label:`${D?`Online`:`Offline`} — `}),(0,K.jsx)(`span`,{className:`node-switcher-name`,children:E}),!ee&&(0,K.jsx)(`span`,{className:`node-switcher-caret`,children:`▾`})]}),c&&!ee&&(0,K.jsxs)(`div`,{className:`menu node-menu`,role:`menu`,children:[y&&(0,K.jsxs)(`div`,{className:`node-menu-status`,role:`status`,children:[(0,K.jsx)(Ct,{size:`xs`}),`Reconnecting…`]}),(0,K.jsx)(`div`,{className:`node-menu-head`,children:`Your machines`}),O.length===0&&(0,K.jsx)(`div`,{className:`node-menu-empty`,children:`No other machines`}),O.map(e=>(0,K.jsx)(`div`,{className:`node-menu-row`,children:(0,K.jsxs)(`button`,{className:`menu-item node-menu-item${e.id===t?` active`:``}`,role:`menuitem`,onClick:()=>{l(!1),z.switchNode(e.id)},children:[(0,K.jsx)(Ot,{status:e.online?`online`:`idle`,label:`${e.online?`Online`:`Offline`} — `}),(0,K.jsx)(`span`,{className:`node-menu-name`,children:e.name||e.id}),e.id===t&&(0,K.jsx)(`span`,{className:`node-menu-check`,children:`✓`})]})},e.id)),s&&k.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`node-menu-head`,children:`Running Cloud machines`}),k.map(n=>{let r=e.find(e=>e.id===n.nodeId);return(0,K.jsxs)(`button`,{className:`menu-item node-menu-item${n.nodeId===t&&!w?` active`:``}`,role:`menuitem`,onClick:()=>{n.nodeId&&(l(!1),z.switchNode(n.nodeId))},children:[(0,K.jsx)(Ot,{status:r?.online?`online`:`idle`,label:`${r?.online?`Online`:`Offline`} — `}),(0,K.jsx)(`span`,{className:`node-menu-name`,children:A(n)}),n.nodeId===t&&!w&&(0,K.jsx)(`span`,{className:`node-menu-check`,children:`✓`})]},n.id)})]}),s&&u.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`node-menu-head`,children:`Start a new Cloud machine`}),u.map(e=>{let t=e.id===w?.id,n=e.computeSource===`managed`?`Start a new ${e.name} Machine`:e.name;return(0,K.jsxs)(`button`,{className:`menu-item node-menu-item${t?` active`:``}`,role:`menuitem`,onClick:()=>{l(!1),z.pickDraftEphemeralRunner(e)},children:[(0,K.jsx)(Ot,{status:`idle`,label:t?`Selected — `:`Available — `}),(0,K.jsx)(`span`,{className:`node-menu-name`,children:n}),(0,K.jsx)(Te,{children:e.provider}),t&&(0,K.jsx)(`span`,{className:`node-menu-check`,children:`✓`})]},e.id)})]}),(0,K.jsx)(`div`,{className:`node-menu-sep`}),(0,K.jsxs)(`button`,{className:`menu-item node-menu-item`,role:`menuitem`,onClick:()=>{l(!1),h(!0)},children:[(0,K.jsx)(`span`,{className:`node-menu-glyph`,children:`+`}),(0,K.jsx)(`span`,{className:`node-menu-name`,children:`Add a Machine…`})]}),(0,K.jsx)(`div`,{className:`node-menu-sep`}),(0,K.jsx)(`button`,{className:`menu-item node-menu-item danger`,role:`menuitem`,onClick:()=>{l(!1),_(!0)},children:`Sign out`})]}),g&&(0,K.jsx)(B,{title:`Sign out?`,message:`Sign out of Bivy on this device?`,confirmLabel:`Sign out`,danger:!0,onCancel:()=>_(!1),onConfirm:()=>{_(!1),z.signOut()}}),m&&(0,K.jsx)(Tr,{onClose:()=>h(!1)})]})}function Oc(){let{connection:{status:e}}=je(),[t,n]=(0,G.useState)(!1),[r,i]=(0,G.useState)(null),a=(0,G.useRef)(null);rt(()=>n(!1),t),(0,G.useEffect)(()=>{e===`online`&&z.listTailnetMachines().then(i).catch(()=>i([]))},[e,t]),(0,G.useEffect)(()=>{if(!t)return;let e=e=>{a.current&&!a.current.contains(e.target)&&n(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[t]);let o=r?.find(e=>e.self),s=r?.filter(e=>!e.self)??[],c=e===`online`;return(0,K.jsxs)(`div`,{className:`node-switcher`,ref:a,children:[(0,K.jsxs)(`button`,{className:`node-switcher-btn`,"aria-haspopup":`menu`,"aria-expanded":t,onClick:e=>{e.stopPropagation(),n(e=>!e)},children:[(0,K.jsx)(Ot,{status:c?`online`:`idle`,label:`${c?`Online`:`Offline`} — `}),(0,K.jsx)(`span`,{className:`node-switcher-name`,children:o?.name||location.hostname.split(`.`)[0]}),(0,K.jsx)(`span`,{className:`node-switcher-caret`,children:`▾`})]}),t&&(0,K.jsxs)(`div`,{className:`menu node-menu`,role:`menu`,children:[(0,K.jsx)(`div`,{className:`node-menu-head`,children:`Your machines`}),r===null&&(0,K.jsxs)(`div`,{className:`node-menu-status`,role:`status`,children:[(0,K.jsx)(Ct,{size:`xs`}),`Looking…`]}),o&&(0,K.jsx)(`div`,{className:`node-menu-row`,children:(0,K.jsxs)(`span`,{className:`menu-item node-menu-item active`,role:`menuitem`,"aria-current":`true`,children:[(0,K.jsx)(Ot,{status:`online`,label:`Online — `}),(0,K.jsx)(`span`,{className:`node-menu-name`,children:o.name}),(0,K.jsx)(`span`,{className:`node-menu-check`,children:`✓`})]})}),s.map(e=>(0,K.jsx)(`div`,{className:`node-menu-row`,children:(0,K.jsxs)(`a`,{className:`menu-item node-menu-item`,role:`menuitem`,href:e.url,children:[(0,K.jsx)(Ot,{status:`online`,label:`Online — `}),(0,K.jsx)(`span`,{className:`node-menu-name`,children:e.name})]})},e.url)),r!==null&&s.length===0&&(0,K.jsxs)(`div`,{className:`node-menu-empty`,children:[`No other machines yet. Run `,(0,K.jsx)(`code`,{children:`bivy tailscale`}),` on another machine and it shows up here.`]})]})]})}var kc=new Set;function Ac(){for(let e of kc)e()}function jc(e){return e.kind===`library`?e.view:null}var Mc=jc(se());typeof window<`u`&&window.addEventListener(`popstate`,()=>{Mc=jc(se()),Ac()});function Nc(e){return kc.add(e),()=>kc.delete(e)}function Pc(){return Mc}function Fc(e){Ie({kind:`library`,view:e},{replace:Mc!==null}),Mc=e,Ac()}function Ic(e){Ie(e,{replace:!0}),Mc=null,Ac()}var Lc=new Set;function Rc(){for(let e of Lc)e()}function zc(e){return e.kind===`run`?{runId:e.id}:null}var Bc=zc(se());typeof window<`u`&&window.addEventListener(`popstate`,()=>{Bc=zc(se()),Rc()});function Vc(e){return Lc.add(e),()=>Lc.delete(e)}function Hc(){return Bc}function Uc(e){Ie({kind:`run`,id:e}),Bc={runId:e},Rc()}function Wc(e){Ie(e,{replace:!0}),Bc=null,Rc()}var Gc={autonomous:`Autonomous`,risky:`Ask before risky actions`,always:`Ask before every action`,never:`Never ask`},Kc={"read-only":`Read only`,"workspace-write":`Workspace write`,"danger-full-access":`Full access`},qc={queued:`Queued`,running:`Running`,waiting:`Waiting`,needs_attention:`Needs attention`,finished:`Finished`},Jc={queued:`idle`,running:`working`,waiting:`idle`,needs_attention:`needs-action`,finished:`idle`};function Yc(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Xc(e){if(!e)return``;let t=(e.inputTokens??0)+(e.outputTokens??0);return[t?`${t.toLocaleString()} tokens`:``,typeof e.costUsd==`number`?`$${e.costUsd.toFixed(4)}`:``].filter(Boolean).join(` · `)}function Zc(e){if(typeof e!=`number`||e<0)return``;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}function Qc({k:e,children:t}){return t==null||t===!1||t===``?null:(0,K.jsxs)(`div`,{className:`run-sheet-row`,children:[(0,K.jsx)(`span`,{className:`k`,children:e}),(0,K.jsx)(`span`,{className:`v`,children:t})]})}function $c(e){return!!(e.branch||e.commit||e.pullRequest||e.checkpoint||e.artifact)}function el({runId:e,load:t,onCancel:n,onRetry:r,onClose:i,onOpenSession:a,onReauthenticate:o,resolveMachineName:s,isSessionResolvable:c,onReceiptReviewed:l}){let[u,d]=(0,G.useState)(`loading`),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(``),[b,x]=(0,G.useState)(!1),S=(0,G.useRef)(!1),C=(0,G.useRef)({value:0}),w=(0,G.useRef)(t);w.current=t;let T=(0,G.useCallback)(async(t={})=>{let n=++C.current.value;try{let r=await w.current(e);if(n!==C.current.value)return;if(r===null){if(t.keepPrevious){h(!0);return}p(null),d(`not_found`);return}p(r),d(`ready`),h(!1)}catch(e){if(n!==C.current.value)return;if((e instanceof P?e.reason:`error`)===`unauthorized`){d(`unauthorized`);return}if(t.keepPrevious){h(!0);return}d(`offline`)}},[e]);(0,G.useEffect)(()=>{S.current=!1,d(`loading`),p(null),h(!1),T();let e=C.current;return()=>{e.value++}},[e,T]);let E=(0,G.useMemo)(()=>f?Le(f,{resolveMachineName:s}):null,[f,s]),D=E?.lifecycle;(0,G.useEffect)(()=>{if(u!==`ready`||!D||D===`finished`||g)return;let e=!1,t,n=async()=>{await T({keepPrevious:!0}),e||(t=setTimeout(n,5e3))};return t=setTimeout(n,5e3),()=>{e=!0,clearTimeout(t)}},[u,D,g,T]),(0,G.useEffect)(()=>{u===`ready`&&E&&!S.current&&(S.current=!0,l?.())},[l,E,u]);let O=(0,G.useCallback)(async()=>{if(n){_(`cancel`),y(``);try{await n(e),await T({keepPrevious:!0})}catch(e){y(e instanceof Error?e.message:`Could not cancel this Run.`)}finally{_(null)}}},[n,e,T]),k=(0,G.useCallback)(async()=>{if(r){_(`retry`),y(``);try{await r(e),await T({keepPrevious:!0})}catch(e){y(e instanceof Error?e.message:`Could not retry this Run.`)}finally{_(null)}}},[r,e,T]),A=(0,G.useCallback)(async(e,t,n)=>{if(o){_(`reauthenticate`),y(``);try{await o(e,t,n)}catch(e){y(e instanceof Error?e.message:`Could not open model sign-in.`)}finally{_(null)}}},[o]);return(0,K.jsxs)(`div`,{className:`automations-view run-details`,role:`dialog`,"aria-modal":`true`,"aria-label":`Run details`,children:[(0,K.jsxs)(`header`,{className:`automations-view-head`,children:[(0,K.jsxs)(`div`,{className:`automations-view-head-text`,children:[(0,K.jsx)(`h1`,{className:`automations-view-heading`,children:`Run details`}),(0,K.jsx)(`p`,{className:`automations-view-sub`,children:`What this Run did, where it ran, and what remains unknown.`})]}),(0,K.jsx)(`div`,{className:`automations-view-head-actions`,children:(0,K.jsxs)(`button`,{type:`button`,className:`btn ghost icon run-details-close`,onClick:i,title:`Back`,"aria-label":`Close run details`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`‹`}),(0,K.jsx)(`span`,{children:`Back`})]})})]}),(0,K.jsxs)(`div`,{className:`automations-view-body run-details-body`,children:[u===`loading`&&(0,K.jsx)(`div`,{className:`run-details-state`,role:`status`,children:`Loading this Run…`}),u===`offline`&&(0,K.jsxs)(`div`,{className:`banner`,"data-tone":`warn`,role:`alert`,children:[(0,K.jsxs)(`div`,{className:`banner-text`,children:[(0,K.jsx)(`strong`,{children:`Can't reach this Run right now`}),(0,K.jsx)(`span`,{children:`You appear to be offline. This Run is safe on the control plane; reconnect to see its current state.`})]}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:()=>T(),children:`Retry`})]}),u===`unauthorized`&&(0,K.jsxs)(`div`,{className:`banner`,"data-tone":`warn`,role:`alert`,children:[(0,K.jsxs)(`div`,{className:`banner-text`,children:[(0,K.jsx)(`strong`,{children:`Sign in to view this Run`}),(0,K.jsx)(`span`,{children:`Your session isn't authorized. Sign in again to open this Run.`})]}),(0,K.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:()=>window.location.assign(`/`),children:`Sign in`})]}),u===`not_found`&&(0,K.jsxs)(`div`,{className:`run-details-state`,role:`status`,children:[(0,K.jsx)(`strong`,{children:`Run not found`}),(0,K.jsx)(`p`,{children:`This Run doesn't exist or isn't available on your account.`})]}),u===`ready`&&E&&(0,K.jsx)(tl,{run:E,stale:m,busyAction:g,actionError:v,onCancel:n?()=>x(!0):void 0,onRetry:r?k:void 0,onRefresh:()=>T(),onOpenSession:a,onReauthenticate:o?A:void 0,isSessionResolvable:c})]}),b&&(0,K.jsx)(B,{title:`Cancel run?`,message:`The agent may take a moment to stop. This page will refresh from the durable run record.`,confirmLabel:`Cancel run`,danger:!0,onCancel:()=>x(!1),onConfirm:()=>{x(!1),O()}})]})}function tl({run:e,stale:t,busyAction:n,actionError:r,onCancel:a,onRetry:o,onRefresh:s,onOpenSession:c,onReauthenticate:l,isSessionResolvable:u}){let d=!!a&&e.actions.some(e=>e.kind===`cancel`),f=!!o&&e.actions.some(e=>e.kind===`retry`),p=e.actions.some(e=>e.kind===`inspect_checks`),m=e.actions.some(e=>e.kind===`review_session`),h=e.actions.find(e=>e.kind===`reauthenticate`&&e.provider),g=!!e.sessionId&&!!c&&(u?u(e.sessionId):!1),_=[e.requested.runtimeId,e.requested.model].filter(Boolean).join(` · `),v=e.timestamps.startedAt??e.timestamps.claimedAt,y=(0,G.useMemo)(()=>{try{return dn(e,new Date().toISOString())}catch{return null}},[e]),b=(0,G.useRef)(null),x=(0,G.useCallback)(async()=>{l&&h?.provider&&await l(h.provider,e.machine?.id,e.failureSummary||`Authentication failed`)},[l,h,e.failureSummary,e.machine?.id]),S=(0,G.useCallback)(()=>{if(!y)return;let e=new Blob([`${fn(y)}\n`],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${y.receiptId}.json`,n.click(),URL.revokeObjectURL(t)},[y]);return(0,K.jsxs)(K.Fragment,{children:[t&&(0,K.jsxs)(`div`,{className:`banner`,"data-tone":`warn`,role:`status`,children:[(0,K.jsxs)(`div`,{className:`banner-text`,children:[(0,K.jsx)(`strong`,{children:`Showing the last known state`}),(0,K.jsx)(`span`,{children:`This Run couldn't be refreshed just now.`})]}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:s,children:`Refresh`})]}),(0,K.jsx)(`div`,{className:`run-details-title`,children:e.title}),(0,K.jsxs)(`div`,{className:`run-sheet-status`,role:`status`,children:[(0,K.jsx)(Ot,{status:Jc[e.lifecycle]}),qc[e.lifecycle],e.outcome.terminal&&(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(Te,{tone:e.outcome.tone===`success`?`ok`:e.outcome.tone===`warning`?`warn`:e.outcome.tone===`danger`?`danger`:void 0,children:e.outcome.label})]}),e.attempt>1&&(0,K.jsxs)(`span`,{className:`run-details-attempt`,children:[` · attempt `,e.attempt]})]}),e.lifecycle===`needs_attention`&&(0,K.jsx)(`div`,{className:`banner`,"data-tone":`warn`,role:`status`,children:(0,K.jsxs)(`div`,{className:`banner-text`,children:[(0,K.jsx)(`strong`,{children:`Needs attention`}),(0,K.jsx)(`span`,{children:`This Run is waiting on a person before it can continue.`})]})}),e.failureSummary&&(0,K.jsx)(`div`,{className:`run-sheet-failure`,children:e.failureSummary}),(0,K.jsxs)(`div`,{className:`run-sheet-rows`,children:[(0,K.jsxs)(Qc,{k:`Source`,children:[e.source.kind,e.source.reference?` · ${e.source.reference}`:``]}),(0,K.jsx)(Qc,{k:`Started`,children:[Yc(v),Yc(e.timestamps.completedAt)?`→ ${Yc(e.timestamps.completedAt)}`:``].filter(Boolean).join(` `)}),(0,K.jsx)(Qc,{k:`Duration`,children:Zc(e.durationMs)}),(0,K.jsx)(Qc,{k:`Machine`,children:e.machine?e.machine.name||e.machine.id:`Not reported`}),(0,K.jsx)(Qc,{k:`Session`,children:e.sessionId?g?(0,K.jsx)(`button`,{type:`button`,className:`btn link`,onClick:()=>c(e.sessionId),children:`Open Session`}):(0,K.jsx)(`span`,{className:`run-details-muted`,children:`Correlated Session isn't available here`}):(0,K.jsx)(`span`,{className:`run-details-muted`,children:`Not correlated`})}),_&&(0,K.jsx)(Qc,{k:`Ran on`,children:_}),e.requested.approvalMode&&(0,K.jsx)(Qc,{k:`Approvals`,children:Gc[e.requested.approvalMode]??e.requested.approvalMode}),e.requested.sandbox&&(0,K.jsx)(Qc,{k:`Sandbox`,children:Kc[e.requested.sandbox]??e.requested.sandbox}),(0,K.jsxs)(Qc,{k:`Attempt`,children:[e.attempt,e.maxAttempts?` of ${e.maxAttempts}`:``,e.attemptReason?` · ${e.attemptReason}`:``]}),(0,K.jsx)(Qc,{k:`Usage / cost`,children:Xc(e.usage)||`Not reported by the provider`}),(0,K.jsx)(Qc,{k:`Notification`,children:e.notification?`${e.notification.status.replace(`_`,` `)}${e.notification.channel?` · ${e.notification.channel}`:``}${e.notification.reason?` · ${e.notification.reason}`:``}`:`Not reported`}),(0,K.jsx)(Qc,{k:`Next action`,children:e.nextAction?.label??`No operator action available`})]}),e.timeline.length>0&&(0,K.jsxs)(`section`,{className:`run-timeline`,"aria-labelledby":`run-timeline-heading`,children:[(0,K.jsx)(`h2`,{id:`run-timeline-heading`,children:`Lifecycle`}),(0,K.jsx)(`ol`,{children:e.timeline.map((e,t)=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`run-timeline-dot`,"aria-hidden":!0}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:e.stage.replaceAll(`_`,` `)}),(0,K.jsxs)(`span`,{children:[Yc(e.at),e.attempt?` · attempt ${e.attempt}`:``]}),(0,K.jsx)(`p`,{children:e.reasonCode?i(e.summary):e.summary}),e.evidenceRef&&(0,K.jsx)(`code`,{children:e.evidenceRef})]})]},`${e.stage}-${e.at}-${t}`))})]}),e.checks.length>0&&(0,K.jsx)(`div`,{className:`run-sheet-checks`,ref:b,tabIndex:-1,children:e.checks.map((e,t)=>(0,K.jsxs)(Te,{tone:e.status===`passed`?`ok`:e.status===`failed`?`danger`:void 0,children:[e.name,` `,e.status===`passed`?`✓`:e.status===`failed`?`✗`:`–`]},`${e.name}-${t}`))}),$c(e.references)&&(0,K.jsxs)(`div`,{className:`run-sheet-rows`,children:[e.references.pullRequest&&(0,K.jsx)(Qc,{k:`Pull request`,children:(0,K.jsx)(`a`,{href:e.references.pullRequest,target:`_blank`,rel:`noopener`,children:`Open pull request`})}),e.references.branch&&(0,K.jsx)(Qc,{k:`Branch`,children:(0,K.jsx)(`code`,{children:e.references.branch})}),e.references.commit&&(0,K.jsx)(Qc,{k:`Commit`,children:(0,K.jsx)(`code`,{children:e.references.commit.slice(0,12)})}),e.references.checkpoint&&(0,K.jsx)(Qc,{k:`Checkpoint`,children:(0,K.jsx)(`code`,{children:e.references.checkpoint})}),e.references.artifact&&(0,K.jsx)(Qc,{k:`Artifact`,children:(0,K.jsx)(`a`,{href:e.references.artifact,target:`_blank`,rel:`noopener`,children:`View artifact`})})]}),e.operationalReferences.length>0&&(0,K.jsx)(`div`,{className:`run-sheet-rows`,children:e.operationalReferences.map((e,t)=>(0,K.jsx)(Qc,{k:e.kind[0].toUpperCase()+e.kind.slice(1),children:e.url?(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener`,children:e.ref}):(0,K.jsx)(`code`,{children:e.ref})},`${e.kind}-${e.ref}-${t}`))}),y&&(0,K.jsxs)(`div`,{className:`run-sheet-rows run-details-receipt`,children:[(0,K.jsxs)(`div`,{className:`run-sheet-row`,children:[(0,K.jsx)(`span`,{className:`k`,children:`Receipt`}),(0,K.jsxs)(`span`,{className:`v`,children:[y.completeness===`complete`?`Complete`:`Partial · ${y.missingEvidence.length} evidence gap${y.missingEvidence.length===1?``:`s`}`,` `,(0,K.jsx)(`button`,{type:`button`,className:`btn link`,onClick:S,children:`Export JSON`})]})]}),y.observationLimitations.slice(0,3).map(e=>(0,K.jsxs)(`div`,{className:`run-sheet-row`,children:[(0,K.jsx)(`span`,{className:`k`,children:`Limitation`}),(0,K.jsx)(`span`,{className:`v run-details-muted`,children:e.message})]},e.code))]}),r&&(0,K.jsx)(`div`,{className:`run-sheet-failure`,role:`alert`,children:r}),(d||f||p||m&&g||h&&l)&&(0,K.jsxs)(`div`,{className:`run-sheet-recovery`,role:`group`,"aria-label":`Run actions`,children:[p&&(0,K.jsx)(`button`,{type:`button`,className:`btn sm primary recover-checks`,onClick:()=>{b.current?.scrollIntoView({behavior:`smooth`,block:`center`}),b.current?.focus()},children:`Review failed checks`}),h&&l&&(0,K.jsx)(`button`,{type:`button`,className:`btn sm primary recover-auth`,disabled:n!==null,onClick:()=>void x(),children:n===`reauthenticate`?`Connecting…`:h.label}),m&&g&&(0,K.jsx)(`button`,{type:`button`,className:`btn sm primary recover-review`,onClick:()=>c(e.sessionId),children:`Review Session`}),f&&(0,K.jsx)(`button`,{type:`button`,className:`btn sm primary recover-retry`,disabled:n!==null,onClick:o,children:n===`retry`?`Retrying…`:`Retry Run`}),d&&(0,K.jsx)(`button`,{type:`button`,className:`btn sm recover-cancel`,disabled:n!==null,onClick:a,children:n===`cancel`?`Cancelling…`:`Cancel Run`})]})]})}function nl(e){return JSON.stringify([String(e.provider),String(e.id)])}function rl({sessionId:e,intent:t=`fork`,onClose:n}){let{connection:{nodes:r,currentNodeId:i},catalogs:{runtimes:a,models:o,currentModel:s},activeSession:{activeSessionId:c,activeRuntimeId:l},sessionIndex:{sessions:u}}=je(),d=c===e&&l?l:u.find(t=>t.sessionId===e)?.runtimeId??null,[f,p]=(0,G.useState)(()=>{if(t!==`move`)return i??``;let e=r.filter(e=>e.id!==i);return(e.find(e=>e.online)??e[0])?.id??i??``}),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(d),[v,y]=(0,G.useState)(s),[b,x]=(0,G.useState)(!1),[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{g==null&&d&&_(d)},[g,d]),(0,G.useEffect)(()=>{v==null&&s&&y(s)},[v,s]),(0,G.useEffect)(()=>{z.listEphemeralConfigs().then(e=>h(e.find(e=>e.computeSource===`managed`)??null)).catch(()=>h(null))},[]);let E=f===`__managed__`,D=E||!!i&&f!==i,O=b?S:D,k=!g||g===d,[A,ee]=(0,G.useState)(null),[j,te]=(0,G.useState)(``);(0,G.useEffect)(()=>{if(te(``),k||!g||D)return;let e=!0;return z.modelsForRuntime(g).then(t=>{e&&ee({agentId:g,models:t.filter(e=>e.configured!==!1)})}),()=>{e=!1}},[g,k,D]);let M=!k&&A?.agentId===g?A.models:null,N=M?.find(e=>nl(e)===j),P=(0,G.useMemo)(()=>D?a:a.filter(e=>e.id===d||String(e.status||`available`)===`available`),[D,a,d]),ne=(0,G.useMemo)(()=>{let e=[...r];return i&&!e.some(e=>e.id===i)&&e.unshift({id:i,name:`This machine`,online:!0}),e},[r,i]);function F(t){T(`working`),z.forkSession(e,{destNodeId:D&&!E?f:void 0,managedConfigId:E?m?.id:void 0,agentId:g??void 0,sourceAgentId:d??void 0,model:k?v?{provider:String(v.provider),id:String(v.id)}:void 0:N?{provider:String(N.provider),id:String(N.id)}:void 0,retireSource:O},()=>new Promise(e=>t(e))).then(e=>{let t=e.missing.map(e=>e.detail||e.label).find(Boolean);t&&z.store.setNotice(`Fork created. ${t}`)}).catch(e=>{z.store.setError(e instanceof Error?e.message:String(e))})}let I=w===`working`,re=v&&(o.find(e=>nl(e)===nl(v))??o.find(e=>e.id===v.id)),ie=re?nl(re):``;return(0,K.jsx)(ot,{title:O?`Move session`:`Fork session`,onClose:n,autoFocusSearch:!1,children:e=>(0,K.jsxs)(K.Fragment,{children:[(ne.length>1||m)&&(0,K.jsxs)(`div`,{className:`picker-section fork-select-field`,children:[(0,K.jsx)(`label`,{htmlFor:`fork-destination-node`,children:`Destination machine`}),(0,K.jsxs)(`select`,{id:`fork-destination-node`,value:f,disabled:I,onChange:e=>{let t=e.target.value;p(t),b||C(!!i&&t!==i)},children:[ne.map(e=>(0,K.jsxs)(`option`,{value:e.id,children:[e.name||e.id,` (`,e.id===i?`current`:e.online?`online`:`offline`,`)`]},e.id)),m&&(0,K.jsxs)(`option`,{value:`__managed__`,children:[m.name||`Bivy Cloud`,` (managed · starts on demand)`]})]})]}),(0,K.jsxs)(`div`,{className:`picker-section fork-select-field`,children:[(0,K.jsx)(`label`,{htmlFor:`fork-agent`,children:`Agent`}),(0,K.jsx)(`select`,{id:`fork-agent`,value:g??``,disabled:I,onChange:e=>_(e.target.value),children:P.map(e=>(0,K.jsxs)(`option`,{value:e.id,children:[e.displayName||e.name||e.id,e.id===d?` (current)`:``]},e.id))})]}),k&&o.length>0&&(0,K.jsxs)(`div`,{className:`picker-section fork-select-field`,children:[(0,K.jsx)(`label`,{htmlFor:`fork-model`,children:`Model`}),(0,K.jsxs)(`select`,{id:`fork-model`,value:ie,disabled:I,onChange:e=>{let t=o.find(t=>nl(t)===e.target.value);t&&y(t)},children:[!ie&&(0,K.jsx)(`option`,{value:``,children:`Keep the session’s model`}),o.map(e=>(0,K.jsx)(`option`,{value:nl(e),children:String(e.name||e.id)},nl(e)))]})]}),!k&&!D&&(0,K.jsxs)(`div`,{className:`picker-section fork-select-field`,children:[(0,K.jsx)(`label`,{htmlFor:`fork-target-model`,children:`Model`}),(0,K.jsxs)(`select`,{id:`fork-target-model`,value:j,disabled:I||!M,onChange:e=>te(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:M?`The agent’s default model`:`Loading models…`}),M?.map(e=>(0,K.jsxs)(`option`,{value:nl(e),children:[String(e.name||e.id),e.provider?` \u00b7 ${String(e.provider)}`:``]},nl(e)))]})]}),D&&O&&(0,K.jsx)(`p`,{className:`picker-section fork-note`,children:`Carries the conversation, its branch and any uncommitted changes. The session here is retired once it’s running on the other machine; if the changes are too large to carry, nothing moves.`}),(0,K.jsx)(`div`,{className:`picker-section`,children:(0,K.jsxs)(`label`,{className:`fork-toggle`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:O,disabled:I,onChange:e=>{x(!0),C(e.target.checked)}}),(0,K.jsx)(`span`,{children:`Retire the original after moving (uncheck to keep both)`})]})}),(0,K.jsx)(`div`,{className:`picker-section`,children:(0,K.jsx)(`button`,{className:`btn primary fork-submit`,onClick:()=>F(e),disabled:I,"aria-busy":I,children:I?`Forking…`:O?`Move session`:`Create fork`})})]})})}var il=2e4;function al({sessionId:e,name:t,onCancel:n}){let[r,i]=(0,G.useState)(!1),a=(0,G.useRef)(null);rt(n),(0,G.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]);let o=(0,G.useId)();return(0,Eo.createPortal)((0,K.jsxs)(`div`,{className:`app-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":o,children:[(0,K.jsx)(`div`,{className:`app-dialog-backdrop`,onClick:n}),(0,K.jsxs)(`div`,{className:`app-dialog-body`,children:[(0,K.jsx)(`h3`,{id:o,children:`Continue in terminal locally`}),(0,K.jsxs)(`p`,{children:[`Run this in a terminal on any machine with the bivy CLI to pick up “`,t,`” outside the web app:`]}),(0,K.jsxs)(`div`,{className:`repo-connect-command resume-command`,children:[(0,K.jsx)(`code`,{children:`bivy resume ${e}`}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost${r?` is-copied`:``}`,onClick:async()=>{await nt(`bivy resume ${e}`)&&(i(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(!1),1800))},"aria-label":r?`Command copied`:`Copy resume command`,children:r?`Copied`:`Copy`})]}),(0,K.jsx)(`p`,{className:`repo-connect-alt`,children:`It resumes the same conversation — saved sessions relaunch via the agent’s native resume where supported, otherwise it opens the session here in the web app.`}),(0,K.jsx)(`div`,{className:`app-dialog-actions`,children:(0,K.jsx)(`button`,{className:`btn`,onClick:n,children:`Close`})})]})]}),document.body)}function ol({sessionId:e,name:t,isRepo:n,node:r,agent:i,workspace:a,worktree:o,branch:s,sessionFile:c,auditHealth:l,eventLogHealth:d,onBrowseFiles:f}){let[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(!1),[C,w]=(0,G.useState)(!1),{presentation:{prResult:T,error:E}}=je(),D=(0,G.useRef)(null),O=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!p)return;let e=e=>{O.current&&!O.current.contains(e.target)&&m(!1)},t=e=>{e.key===`Escape`&&m(!1)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,t)}},[p]),(0,G.useEffect)(()=>{C&&(w(!1),m(!1))},[T,E]),(0,G.useEffect)(()=>()=>{D.current&&clearTimeout(D.current)},[]);let k=()=>m(!1);return(0,K.jsxs)(`div`,{className:`session-actions-wrap`,ref:O,children:[(0,K.jsx)(`button`,{className:`session-actions-btn`,"aria-label":`Session actions`,"aria-haspopup":`menu`,"aria-expanded":p,onClick:e=>{e.stopPropagation(),m(e=>!e)},children:`⋯`}),h&&(0,K.jsx)(st,{title:`Rename session`,initialValue:t,onCancel:()=>g(!1),onSave:t=>{z.renameSession(e,t),g(!1)}}),y&&(0,K.jsx)(rl,{sessionId:e,onClose:()=>b(!1)}),x&&(0,K.jsx)(al,{sessionId:e,name:t,onCancel:()=>S(!1)}),_&&(0,K.jsx)(B,{title:`Delete session?`,message:`Delete “${t}”? This can't be undone.`,confirmLabel:`Delete`,danger:!0,onCancel:()=>v(!1),onConfirm:()=>{z.deleteSession(e),v(!1)}}),p&&(0,K.jsxs)(`div`,{className:`menu session-actions-menu`,role:`menu`,children:[l&&([`corrupt`,`unreadable`].includes(l.storage)||l.writes===`degraded`)&&(0,K.jsxs)(`div`,{className:`session-actions-audit-warning`,role:`status`,children:[(0,K.jsx)(`strong`,{children:`Audit evidence degraded`}),(0,K.jsx)(`span`,{children:l.writes===`degraded`?`${l.failedWrites} audit write${l.failedWrites===1?``:`s`} failed.`:`Audit storage is ${l.storage}.`})]}),d?.state===`degraded`&&(0,K.jsxs)(`div`,{className:`session-actions-audit-warning`,role:`status`,children:[(0,K.jsx)(`strong`,{children:`Session history persistence degraded`}),(0,K.jsxs)(`span`,{children:[`The last `,d.operation??`storage`,` operation failed. History may be incomplete.`]})]}),f&&(0,K.jsx)(`button`,{className:`menu-item session-actions-item`,role:`menuitem`,onClick:()=>{k(),f()},disabled:C,children:`Browse files`}),(0,K.jsx)(`button`,{className:`menu-item session-actions-item`,role:`menuitem`,onClick:async()=>{k();let t=`${u()}${j({kind:`session`,id:e})}`;await nt(ct({url:t,sessionId:e,node:r,agent:i,workspace:a,worktree:o,branch:s,sessionFile:c}))?z.store.setNotice(`Session reference copied`):z.store.setError(`Couldn't copy the session reference`)},disabled:C,children:`Copy session reference`}),(0,K.jsx)(`button`,{className:`menu-item session-actions-item`,role:`menuitem`,onClick:()=>{k(),g(!0)},disabled:C,children:`Rename`}),(0,K.jsx)(`button`,{className:`menu-item session-actions-item`,role:`menuitem`,onClick:()=>{k(),b(!0)},disabled:C,children:`Fork / move…`}),(0,K.jsx)(`button`,{className:`menu-item session-actions-item`,role:`menuitem`,onClick:()=>{k(),S(!0)},disabled:C,title:"Copy a `bivy resume` command to run on your own machine",children:`Continue in terminal locally…`}),n&&(0,K.jsx)(`button`,{className:`menu-item session-actions-item`,role:`menuitem`,onClick:()=>{w(!0),z.refreshPrStatus(e),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{w(!1),m(!1)},il)},disabled:C,children:C?`Checking GitHub status…`:`Update GitHub status`}),(0,K.jsx)(`button`,{className:`menu-item session-actions-item danger`,role:`menuitem`,onClick:()=>{k(),v(!0)},disabled:C,children:`Delete`})]})]})}function sl({sessionId:e,sessionName:t,nodeLabel:n,online:r,onOpenTerminal:i,onUseChat:a,children:o}){let s=Ss(e),c=s?.driver?.via===`terminal`&&s.driver.id!==fe().id?s.driver:void 0;return(0,K.jsxs)(`div`,{className:`tui-locked`,children:[(0,K.jsxs)(`div`,{className:`card tui-locked-card`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(`span`,{className:`tui-locked-icon`,"aria-hidden":!0,children:(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`26`,height:`26`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,K.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,K.jsx)(`path`,{d:`m7 9 3 3-3 3`}),(0,K.jsx)(`path`,{d:`M13 15h4`})]})}),(0,K.jsx)(`h2`,{className:`tui-locked-title`,children:`This session is running in the terminal.`}),(0,K.jsxs)(`p`,{className:`tui-locked-sub`,children:[(0,K.jsxs)(`span`,{className:`tui-locked-name`,children:[`“`,t,`”`]}),` is open in the interactive terminal`,n?(0,K.jsxs)(K.Fragment,{children:[` `,`on `,(0,K.jsx)(`span`,{className:`tui-locked-node`,children:n})]}):null,`. Chat is paused while it’s open — open the terminal to watch it`,a?`, or take it over to message it here`:``,`.`]}),(0,K.jsxs)(`div`,{className:`tui-locked-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn`,onClick:i,disabled:!r,children:`Open terminal`}),a&&(0,K.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:a,disabled:!r,children:`Use chat`})]}),c&&(0,K.jsxs)(`p`,{className:`tui-locked-hint`,children:[`Last input from `,c.label,` · `,wt(c.at)]}),!r&&(0,K.jsxs)(`p`,{className:`tui-locked-hint`,children:[`Reconnect to the machine to open the terminal`,a?` or take over in chat`:``,`.`]})]}),o]})}function cl(e){return`Pull request${e.number?` #${e.number}`:``} (${e.state===`merged`?`merged`:e.state===`closed`?`closed`:`open`})`}function ll(e){let t=[];e.issueUrl&&t.push({label:`Open issue`,url:e.issueUrl});for(let n of e.prs)t.push({label:cl(n),url:n.url});return e.branch&&e.repo&&t.push({label:`${e.repo} · ${e.branch}`,url:`https://github.com/${e.repo}/tree/${encodeURIComponent(e.branch)}`}),t}function ul(){return(0,K.jsx)(`svg`,{className:`gh-icon`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z`})})}function dl({gh:e}){let[t,n]=(0,G.useState)(!1),r=ll(e);if(r.length===0)return null;let i=ie(e.prs),a=i?`pr`:e.issueUrl?`issue`:`branch`,o=i?.state===`merged`?`merged`:i?.state===`open`?`ok`:a===`issue`?`accent`:void 0,s=e.repo?e.repo.split(`/`).pop()||e.repo:null,c=e.branch?s?`${s} · ${e.branch}`:e.branch:`branch`,l=i?i.state===`merged`?`Merged`:i.state===`closed`?`Closed`:`PR`:a===`issue`?`Issue`:c;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{className:`badge github-pill`,"data-tone":o,"data-variant":`outline`,onClick:()=>n(!0),title:`GitHub context`,children:[(0,K.jsx)(ul,{}),(0,K.jsx)(`span`,{className:`gh-text`,children:l})]}),t&&(0,K.jsx)(ot,{variant:`action`,ariaLabel:`GitHub actions`,title:(0,K.jsxs)(`span`,{className:`run-sheet-title`,children:[(0,K.jsx)(`span`,{className:`gh-head-mark`,"aria-hidden":!0,children:(0,K.jsx)(ul,{})}),`GitHub`]}),onClose:()=>n(!1),autoFocusSearch:!1,children:r.map(e=>(0,K.jsxs)(`a`,{className:`sheet-action gh-link`,href:e.url,target:`_blank`,rel:`noopener`,onClick:()=>n(!1),children:[(0,K.jsx)(ul,{}),(0,K.jsx)(`span`,{children:e.label})]},e.url))})]})}var fl={fix:`Fix`,retry:`Retry checks`,fork:`Fork`};function pl(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:` · resets ${t.toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}`}var ml={autonomous:`Autonomous`,risky:`Ask before risky actions`,always:`Ask before every action`,never:`Never ask`},hl={"read-only":`Read only`,"workspace-write":`Workspace write`,"danger-full-access":`Full access`};function gl(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function _l(e){return e>0&&e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function vl(e){return new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}).format(e)}var yl={open:`Open`,merged:`Merged`,closed:`Closed`};function bl(e){let t=[];e.issueUrl&&t.push({label:`Open issue`,url:e.issueUrl});for(let n of e.prs)t.push({label:`Pull request${n.number?` #${n.number}`:``}`,detail:yl[n.state]??n.state,url:n.url});return e.branch&&e.repo&&t.push({label:`${e.repo} · ${e.branch}`,url:`https://github.com/${e.repo}/tree/${encodeURIComponent(e.branch)}`}),t}function xl({item:e}){let t=e.checks??[];return t.length===0?null:(0,K.jsx)(`div`,{className:`run-sheet-checks`,children:t.map((e,t)=>(0,K.jsxs)(Te,{tone:e.status===`passed`?`ok`:e.status===`failed`?`danger`:void 0,children:[e.name,` `,e.status===`passed`?`✓`:e.status===`failed`?`✗`:`–`]},`${e.name}-${t}`))})}function Y({k:e,children:t}){return t==null||t===!1||t===``?null:(0,K.jsxs)(`div`,{className:`run-sheet-row`,children:[(0,K.jsx)(`span`,{className:`k`,children:e}),(0,K.jsx)(`span`,{className:`v`,children:t})]})}function Sl({source:e,statusClass:t,statusLabel:n,gh:r,evidence:a,finishedAt:o,usage:s,forkedFrom:c,delegatedFrom:l,filesEdited:u,onOpenChanges:d,artifactsCount:f,onOpenArtifacts:p,onRecover:m,onOpenRun:h,anchorId:g}){let[_,v]=(0,G.useState)(!1),y=bl(r),b=kn(e.kind),x=n===`Open`?`Open on machine`:n,S=a?ee(a):null,C=a?Nn(a):null,w=a?Pn(a):null,T=typeof o==`number`?gl(o):``,E=a?.attempt??0,D=a?Fn(a):null,O=a?In(a):null,k=a&&m?Rn(a):[],A=[a?.runtimeId,a?.model].filter(Boolean).join(` · `),j=a?.output?.failure,te=c?c.name||`session ${c.sessionId.slice(0,8)}`:null,M=s?.tokens?.total??0,N=typeof s?.costUsd==`number`,P=[...s?.plan?.windows??[]].sort((e,t)=>(t.utilizationPct??0)-(e.utilizationPct??0)),ne=N||M>0||P.length>0,F=u&&u>0?`${u} file${u===1?``:`s`} edited`:null,I=f&&f>0?`${f} artifact${f===1?``:`s`}`:null;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{id:g,className:`run-pill src-${e.kind} ${t}`,onClick:()=>v(!0),title:[e.label,n,F].filter(Boolean).join(` · `),children:[e.automation&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(jn,{kind:e.kind,size:`sm`}),(0,K.jsx)(`span`,{className:`run-pill-label`,children:b})]}),(0,K.jsxs)(`span`,{className:`run-pill-stat`,children:[(0,K.jsx)(Ot,{status:t}),n]}),(0,K.jsx)(Kn,{prs:r.prs}),F&&(0,K.jsx)(`span`,{className:`run-pill-files`,children:F})]}),_&&(0,K.jsx)(ot,{variant:`action`,ariaLabel:e.label,title:(0,K.jsxs)(`span`,{className:`run-sheet-title`,children:[(0,K.jsx)(jn,{kind:e.kind,size:`sm`}),e.label]}),onClose:()=>v(!1),autoFocusSearch:!1,children:e=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`run-sheet-status`,children:[(0,K.jsx)(Ot,{status:t}),x]}),j&&(0,K.jsx)(`div`,{className:`run-sheet-failure`,children:j}),c&&(0,K.jsx)(`div`,{className:`run-sheet-rows`,children:(0,K.jsx)(Y,{k:`Forked from`,children:c.openable?(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost`,onClick:()=>z.openSessionOnNode(c.sessionId,void 0,c.nodeId),children:te}):te})}),l&&(0,K.jsx)(`div`,{className:`run-sheet-rows`,children:(0,K.jsx)(Y,{k:`Delegated from`,children:(0,K.jsxs)(`button`,{type:`button`,className:`btn sm ghost`,onClick:()=>z.openSessionOnNode(l.sessionId,void 0,l.nodeId),children:[l.title||`session ${l.sessionId.slice(0,8)}`,l.machine?` · ${l.machine}`:``]})})}),(T||w)&&(0,K.jsx)(`div`,{className:`run-sheet-rows`,children:(0,K.jsx)(Y,{k:`Finished`,children:[T||null,w?`ran ${w}`:null].filter(Boolean).join(` · `)})}),a&&(0,K.jsxs)(`div`,{className:`run-sheet-rows`,children:[S&&(0,K.jsx)(Y,{k:`Outcome`,children:(0,K.jsx)(Te,{tone:S.tone===`success`?`ok`:S.tone===`warning`?`warn`:S.tone===`danger`?`danger`:void 0,children:S.label})}),O?.url&&(0,K.jsx)(Y,{k:`Artifact`,children:(0,K.jsx)(`a`,{href:O.url,target:`_blank`,rel:`noopener`,children:O.label})}),C&&(0,K.jsx)(Y,{k:`Checks`,children:(0,K.jsx)(xl,{item:a})}),E>1&&(0,K.jsx)(Y,{k:`Attempts`,children:D?`${E} · ${D}`:String(E)}),a.routingReason&&(0,K.jsx)(Y,{k:`Routing`,children:i(a.routingReason)}),a.output?.branch&&(0,K.jsx)(Y,{k:`Branch`,children:(0,K.jsx)(`code`,{children:a.output.branch})}),a.output?.commit&&(0,K.jsx)(Y,{k:`Commit`,children:(0,K.jsx)(`code`,{children:a.output.commit.slice(0,12)})}),A&&(0,K.jsx)(Y,{k:`Ran on`,children:A}),a.approvalMode&&(0,K.jsx)(Y,{k:`Approvals`,children:ml[a.approvalMode]??a.approvalMode}),a.sandbox&&(0,K.jsx)(Y,{k:`Sandbox`,children:hl[a.sandbox]??a.sandbox})]}),ne&&(0,K.jsxs)(`div`,{className:`run-sheet-rows`,children:[N&&(0,K.jsx)(Y,{k:`Cost`,children:(0,K.jsx)(`span`,{title:`$${s.costUsd.toFixed(4)}`,children:_l(s.costUsd)})}),M>0&&(0,K.jsx)(Y,{k:`Tokens`,children:(0,K.jsx)(`span`,{title:M.toLocaleString(),children:vl(M)})}),P.map(e=>(0,K.jsxs)(Y,{k:e.label,children:[typeof e.utilizationPct==`number`?`${Math.round(e.utilizationPct)}% used`:`usage unknown`,pl(e.resetsAt)]},e.label))]}),F&&d&&(0,K.jsxs)(`button`,{type:`button`,className:`sheet-action run-sheet-changes`,onClick:()=>e(d),children:[(0,K.jsx)(`span`,{className:`run-sheet-changes-icon`,"aria-hidden":!0,children:`◈`}),(0,K.jsx)(`span`,{children:F}),(0,K.jsx)(`span`,{className:`run-sheet-changes-hint`,children:`View diffs`})]}),I&&p&&(0,K.jsxs)(`button`,{type:`button`,className:`sheet-action run-sheet-changes`,onClick:()=>e(p),children:[(0,K.jsx)(`span`,{className:`run-sheet-changes-icon`,"aria-hidden":!0,children:`📎`}),(0,K.jsx)(`span`,{children:I}),(0,K.jsx)(`span`,{className:`run-sheet-changes-hint`,children:`View artifacts`})]}),y.map(e=>(0,K.jsxs)(`a`,{className:`sheet-action gh-link`,href:e.url,target:`_blank`,rel:`noopener`,onClick:()=>v(!1),children:[(0,K.jsx)(Wn,{}),(0,K.jsx)(`span`,{children:e.label}),e.detail&&(0,K.jsx)(`span`,{className:`run-sheet-changes-hint`,children:e.detail})]},e.url)),a?.output?.artifactUrl&&(0,K.jsx)(`a`,{className:`sheet-action`,href:a.output.artifactUrl,target:`_blank`,rel:`noopener`,onClick:()=>v(!1),children:`View artifact`}),a?.id&&h&&(0,K.jsxs)(`button`,{type:`button`,className:`sheet-action run-sheet-open-run`,onClick:()=>e(()=>h(a.id)),children:[(0,K.jsx)(`span`,{"aria-hidden":!0,children:`▸`}),(0,K.jsx)(`span`,{children:`Run details`})]}),k.length>0&&m&&(0,K.jsx)(`div`,{className:`run-sheet-recovery`,role:`group`,"aria-label":`Recover this run`,children:k.map(e=>(0,K.jsx)(`button`,{type:`button`,className:`btn small recover-${e}`,onClick:()=>{m(e),v(!1)},children:fl[e]},e))}),y.length===0&&!a&&!ne&&!c&&!l&&!F&&(0,K.jsx)(`div`,{className:`sheet-action-empty`,children:`This session has nothing to report yet.`})]})})]})}function Cl({apps:e,serverPorts:t,newNotes:n,onOpen:r}){let i=e>0?`${e} app${e===1?``:`s`}`:t.length===1?`Preview :${t[0]}`:t.length>1?`${t.length} servers`:null;if(!i)return null;let a=n>0?`${n} new note${n===1?``:`s`}`:null;return(0,K.jsxs)(`button`,{type:`button`,className:`run-pill apps-pill`,onClick:r,"aria-label":[`Open apps`,i,a].filter(Boolean).join(` · `),children:[(0,K.jsx)(Xe,{size:16}),(0,K.jsx)(`span`,{className:`run-pill-label`,children:i}),a&&(0,K.jsx)(Te,{tone:`unseen`,variant:`solid`,children:a})]})}function wl({entry:e,mode:t}){let[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(!1),o=(0,G.useMemo)(()=>{let t=0,n=0;for(let r of e.files){let e=xt(r);t+=e.added,n+=e.removed}return{added:t,removed:n}},[e.files]),s=(0,G.useMemo)(()=>Do(e.files.map(e=>({path:e.path,status:e.status,added:e.added,removed:e.removed}))),[e.files]),c=(0,G.useMemo)(()=>new Map(e.files.map(e=>[e.path,e])),[e.files]),l=e.files.length;return(0,K.jsxs)(`div`,{className:`session-changes-turn`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`session-changes-turn-head`,onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,K.jsx)(`span`,{className:`changes-chevron`,"aria-hidden":!0,children:n?`▾`:`▸`}),(0,K.jsxs)(`span`,{className:`session-changes-turn-title`,children:[l,` file`,l===1?``:`s`,` changed`,(o.added>0||o.removed>0)&&(0,K.jsxs)(`span`,{className:`changes-total`,children:[o.added>0&&(0,K.jsxs)(`span`,{className:`add`,children:[`+`,o.added]}),o.removed>0&&(0,K.jsxs)(`span`,{className:`del`,children:[`−`,o.removed]})]})]}),(0,K.jsx)(`span`,{className:`session-changes-turn-time`,children:wt(e.at)})]}),n&&(0,K.jsxs)(`div`,{className:`session-changes-turn-body`,children:[e.before&&(0,K.jsx)(`button`,{type:`button`,className:`btn danger-ghost changes-undo`,onClick:()=>{e.before&&(a(!0),z.rewind(e.before))},disabled:i,children:i?`Undoing…`:`Rewind to before this turn`}),(0,K.jsx)(`div`,{className:`changes-files`,children:s.map(e=>(0,K.jsx)(Et,{node:e,byPath:c,mode:t,depth:0},e.path))})]})]})}function Tl(e){let t=new Set;for(let n of e)for(let e of n.files)t.add(e.path);return t.size}function El({history:e,onClose:t,checks:n,docked:r,onComposerFilled:i}){let[a,o]=(0,G.useState)(`unified`),[s,c]=(0,G.useState)(!1),l=(0,G.useMemo)(()=>[...e].reverse(),[e]),u=(0,G.useMemo)(()=>Tl(e),[e]),d=l[0],f=(0,G.useMemo)(()=>{if(!d)return{added:0,removed:0};let e=0,t=0;for(let n of d.files){let r=xt(n);e+=r.added,t+=r.removed}return{added:e,removed:t}},[d]),p=()=>{d&&(z.prefillComposer(vt(d.files.map(e=>({...e,...xt(e)})),n)),r||t(),i?.())},m=()=>{d?.before&&(c(!0),z.rewind(d.before))},h=u>0?`${u} file${u===1?``:`s`} edited`:`Session changes`;return(0,K.jsxs)(Dr,{docked:r,title:h,onClose:t,autoFocusSearch:!1,headExtra:(0,K.jsxs)(`div`,{className:`changes-mode`,role:`group`,"aria-label":`Diff view mode`,children:[(0,K.jsx)(`button`,{type:`button`,className:a===`unified`?`active`:``,onClick:()=>o(`unified`),children:`Unified`}),(0,K.jsx)(`button`,{type:`button`,className:a===`split`?`active`:``,onClick:()=>o(`split`),children:`Split`})]}),children:[d&&(0,K.jsxs)(`div`,{className:`session-changes-toolbar`,children:[(0,K.jsxs)(`span`,{className:`session-changes-toolbar-meta`,children:[`Latest turn`,(f.added>0||f.removed>0)&&(0,K.jsxs)(`span`,{className:`changes-total`,children:[f.added>0&&(0,K.jsxs)(`span`,{className:`add`,children:[`+`,f.added]}),f.removed>0&&(0,K.jsxs)(`span`,{className:`del`,children:[`−`,f.removed]})]})]}),(0,K.jsxs)(`div`,{className:`session-changes-toolbar-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:p,children:`Review with agent`}),d.before&&(0,K.jsx)(`button`,{type:`button`,className:`btn sm danger-ghost`,onClick:m,disabled:s,children:s?`Undoing…`:`Undo turn`})]})]}),(0,K.jsxs)(`div`,{className:`session-changes-list`,children:[l.length===0&&(0,K.jsx)(`div`,{className:`changes-binary`,children:`No file changes yet this session.`}),l.map(e=>(0,K.jsx)(wl,{entry:e,mode:a},e.id))]})]})}var Dl=8;function Ol(e){return e.filter(e=>!e.pendingLaunch).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)).slice(0,Dl)}function kl(e){let t=e.replace(/\s+/g,` `).trim();return t.length>160?`${t.slice(0,159)}…`:t}function Al(e){let[t,n]=(0,G.useState)(new Map);return(0,G.useEffect)(()=>{let t=!0;return e?.().then(e=>{let r=new Map;for(let t of[...e.items].sort((e,t)=>t.createdAt-e.createdAt)){let e=t.views.find(e=>e.kind===`web`&&e.lastPath)??t.views.find(e=>e.kind===`web`);e&&!r.has(t.sessionId)&&r.set(t.sessionId,{name:t.name,path:e.kind===`web`?e.lastPath:void 0})}t&&n(r)},()=>{}),()=>{t=!1}},[e]),t}function jl({image:e}){let t=(0,G.useMemo)(()=>e.data?`data:${e.mimeType};base64,${e.data}`:``,[e]);return t?(0,K.jsx)(`img`,{className:`share-thumb`,src:t,alt:e.name}):null}function Ml({text:e,images:t=[],sessions:n,listApps:r,onDeliver:i}){let a=Ol(n),o=Al(r),s=(0,G.useRef)(!1),c=e=>{s.current||(s.current=!0,i(e,e?o.get(e.sessionId):void 0))},l=t.length?t.length===1?`screenshot`:`${t.length} images`:`text`;return(0,K.jsx)(ot,{title:t.length?`Send the ${l} to…`:`Send shared text to…`,ariaLabel:`Choose where to send the shared ${l}`,onClose:()=>c(null),autoFocusSearch:!1,children:(0,K.jsxs)(`div`,{className:`share-sheet`,children:[(t.length>0||e)&&(0,K.jsxs)(`figure`,{className:`share-shared`,children:[t.length>0&&(0,K.jsx)(`div`,{className:`share-thumbs`,children:t.map((e,t)=>(0,K.jsx)(jl,{image:e},t))}),e&&(0,K.jsxs)(`figcaption`,{className:`muted small`,children:[`“`,kl(e),`”`]})]}),(0,K.jsxs)(`div`,{className:`share-dests`,role:`list`,"aria-label":`Destinations`,children:[(0,K.jsx)(`button`,{type:`button`,role:`listitem`,className:`share-dest`,onClick:()=>c(null),children:(0,K.jsx)(ti,{tile:(0,K.jsx)(We,{size:18}),name:`New session`,meta:`Start fresh with what you shared`})}),a.map(e=>{let t=o.get(e.sessionId),n=[e.agentName,e.branch].filter(Boolean).join(` · `);return(0,K.jsx)(`button`,{type:`button`,role:`listitem`,className:`share-dest`,onClick:()=>c(e),children:(0,K.jsx)(ti,{tile:t?ei(t.name):(0,K.jsx)(Ze,{size:18}),name:e.name,meta:t?`${t.name} preview${t.path&&t.path!==`/`?` · ${t.path}`:``}`:n||void 0,detail:t&&n?(0,K.jsx)(`span`,{className:`app-row-meta`,children:n}):void 0})},e.sessionId)})]})]})})}var Nl=`bivy-share-inbox`,Pl=/^[a-f0-9]{32}$/,Fl=(e,t)=>`/__share-inbox/${e}/${t}`;function Il(e){let t=new Uint8Array(e),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}async function Ll(e,t=globalThis.caches){if(!Pl.test(e)||!t)return null;let n=await t.open(Nl),r=await n.match(Fl(e,`meta`)).then(e=>e?.json()).catch(()=>void 0);if(!r)return null;let i=[];for(let[t,a]of r.files.entries()){let r=await n.match(Fl(e,t));if(!r)continue;let o=Il(await r.arrayBuffer());i.push({kind:`image`,name:a.name,mimeType:a.type,size:a.size,data:o})}let a=[r.title.trim(),r.text.trim()];return r.url&&!a.some(e=>e.includes(r.url))&&a.push(r.url.trim()),{text:a.filter(Boolean).join(`
|
|
23
|
-
`),attachments:i}}async function Rl(e,t=globalThis.caches){if(!Pl.test(e)||!t)return;let n=await t.open(Nl);for(let t of await n.keys())new URL(t.url).pathname.startsWith(`/__share-inbox/${e}/`)&&await n.delete(t)}function zl(){let{connection:e,activeSession:t}=je(),[n]=(0,G.useState)(x),[r,i]=(0,G.useState)(n?`Opening your app preview…`:null),a=!!n&&e.status===`online`&&t.activeSessionId===n?.sessionId;return(0,G.useEffect)(()=>{n&&a&&(v(),z.appCommand(`apps.open`,n.sessionId,{appId:n.appId,viewId:n.viewId,direct:!0}).then(e=>{let t=e,r=t.kind===`web`?new URL(t.url):null;if(!r||r.protocol!==`https:`||r.origin===location.origin)throw Error(`Unexpected preview link.`);location.replace(`${r.href}~${encodeURIComponent(n.path)}`)}).catch(e=>i(`Couldn’t reopen the preview: ${e instanceof Error?e.message:`try again from Apps`}.`)))},[n,a]),r}function Bl({progress:e,onClose:t}){let n=(0,G.useRef)(null),r=(0,G.useId)(),i=(0,G.useId)(),a=e.status===`working`;return rt(()=>{a||t()}),(0,G.useEffect)(()=>{let e=n.current;return e.showModal(),()=>e.close()},[]),(0,Eo.createPortal)((0,K.jsxs)(`dialog`,{ref:n,tabIndex:-1,className:`app-dialog-body fork-progress-dialog`,"aria-labelledby":r,"aria-describedby":i,onKeyDown:e=>{a&&e.key===`Tab`&&(e.preventDefault(),n.current?.focus())},onCancel:e=>{e.preventDefault(),a||t()},children:[(0,K.jsxs)(`h3`,{id:r,className:`run-sheet-title`,children:[a&&(0,K.jsx)(Ct,{size:`sm`}),a?`Forking session`:`Fork needs attention`]}),(0,K.jsx)(`p`,{id:i,role:a?`status`:`alert`,children:e.message}),a?(0,K.jsx)(`p`,{children:`You’ll be taken to the new session when it’s ready.`}):(0,K.jsx)(`div`,{className:`app-dialog-actions`,children:(0,K.jsx)(`button`,{className:`btn primary`,onClick:t,children:`Close`})})]}),document.body)}var Vl={added:`New`,modified:`Modified`,deleted:`Deleted`},Hl={added:`+`,modified:`~`,deleted:`−`},Ul={ts:`typescript`,tsx:`typescript`,mts:`typescript`,cts:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,css:`css`,scss:`scss`,less:`less`,html:`xml`,htm:`xml`,xml:`xml`,svg:`xml`,vue:`xml`,md:`markdown`,mdx:`markdown`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,h:`c`,cc:`cpp`,cpp:`cpp`,hpp:`cpp`,cs:`csharp`,php:`php`,pl:`perl`,lua:`lua`,r:`r`,sql:`sql`,graphql:`graphql`,sh:`bash`,bash:`bash`,zsh:`bash`,yml:`yaml`,yaml:`yaml`,toml:`ini`,ini:`ini`,diff:`diff`,patch:`diff`,mk:`makefile`},Wl={Makefile:`makefile`,Dockerfile:`dockerfile`,".bashrc":`bash`,".zshrc":`bash`};function Gl(e){let t=e.slice(e.lastIndexOf(`/`)+1);if(Wl[t])return Wl[t];let n=t.lastIndexOf(`.`);return n>0?Ul[t.slice(n+1).toLowerCase()]:void 0}function Kl(e,t){return t?e.filter(e=>e.status||e.changed):e}var ql=new Map,Jl=e=>e instanceof Error?e.message:String(e);function Yl({status:e}){return e?(0,K.jsxs)(`span`,{className:`files-mark`,"data-status":e,title:Vl[e],children:[(0,K.jsx)(`span`,{"aria-hidden":!0,children:Hl[e]}),(0,K.jsx)(`span`,{className:`sr-only`,children:Vl[e]})]}):(0,K.jsx)(`span`,{className:`files-mark`,"aria-hidden":!0})}function Xl({sessionId:e,path:t,reloadKey:n,onBack:r}){let[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(!1),u=(0,G.useRef)(null);(0,G.useEffect)(()=>{let n=!1;return s(null),z.fileCommand(`files.read`,e,t).then(e=>{n||a(e.file)}).catch(e=>{n||(a(null),s(Jl(e)))}),()=>{n=!0}},[e,t,n]);let d=i?.kind===`text`?i.content:null,f=d!==null&&d.length<=2e5;(0,G.useLayoutEffect)(()=>{let e=u.current;e&&d!==null&&(e.textContent=d,delete e.dataset.highlighted,f&&ia(e.parentElement?.parentElement??null))},[d,f]);let p=(0,G.useMemo)(()=>d===null?0:d.split(`
|
|
24
|
-
`).length-+!!d.endsWith(`
|
|
25
|
-
`),[d]),m=i?.kind===`image`?`data:${i.mimeType};base64,${i.data}`:null,h=async()=>{await nt(t)&&(l(!0),setTimeout(()=>l(!1),1500))},g=Gl(t);return(0,K.jsxs)(`div`,{className:`files-viewer`,children:[(0,K.jsxs)(`div`,{className:`files-viewer-head`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn ghost icon`,onClick:r,"aria-label":`Back to files`,title:`Back to files`,children:(0,K.jsx)(Qe,{size:18})}),(0,K.jsx)(`span`,{className:`files-viewer-path`,title:t,children:t}),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost icon`,onClick:()=>void h(),"aria-label":c?`Path copied`:`Copy path`,title:c?`Copied`:`Copy path`,children:(0,K.jsx)(et,{size:16})})]}),i&&(0,K.jsxs)(`div`,{className:`files-viewer-meta`,children:[i.status&&(0,K.jsx)(Te,{tone:i.status===`deleted`?`danger`:i.status===`added`?`ok`:`accent`,variant:`soft`,children:Vl[i.status]}),(0,K.jsx)(`span`,{children:Oo(i.size)}),d!==null&&(0,K.jsxs)(`span`,{children:[p,` line`,p===1?``:`s`]}),i.mtime>0&&(0,K.jsxs)(`span`,{children:[`Saved `,wt(i.mtime)]})]}),!i&&!o&&(0,K.jsxs)(`div`,{className:`apps-state`,role:`status`,children:[(0,K.jsx)(Ct,{size:`sm`}),(0,K.jsx)(`span`,{children:`Opening…`})]}),o&&(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:o}),i?.kind===`text`&&i.truncated&&(0,K.jsxs)(`div`,{className:`banner inline`,"data-tone":`warn`,role:`status`,children:[`Showing the first `,Oo(i.content.length),` of this file.`]}),i?.kind===`text`&&(i.content.length===0?(0,K.jsx)(`div`,{className:`changes-binary`,children:`Empty file.`}):(0,K.jsxs)(`div`,{className:`files-code`,tabIndex:0,"aria-label":`Contents of ${t}`,children:[(0,K.jsx)(`pre`,{className:`files-gutter`,"aria-hidden":!0,children:Array.from({length:p},(e,t)=>t+1).join(`
|
|
26
|
-
`)}),(0,K.jsx)(`pre`,{className:`files-source`,children:(0,K.jsx)(`code`,{ref:u,className:g?`language-${g}`:`nohighlight`})})]})),m&&(0,K.jsx)(`div`,{className:`files-image`,children:(0,K.jsx)(`img`,{src:m,alt:t})}),i?.kind===`binary`&&(0,K.jsx)(`div`,{className:`changes-binary`,children:`Binary file — not shown.`}),i?.kind===`too-large`&&(0,K.jsx)(`div`,{className:`changes-binary`,children:`Too large to show here.`})]})}function Zl({path:e,depth:t,folders:n,expanded:r,changedOnly:i,onToggle:a,onOpen:o}){let s=n.get(e),c={paddingLeft:`calc(${t} * var(--space-4) + var(--space-1))`};if(!s||s.status===`loading`)return(0,K.jsxs)(`div`,{className:`files-row files-row-note`,style:c,role:`status`,children:[(0,K.jsx)(Ct,{size:`xs`}),(0,K.jsx)(`span`,{children:`Loading…`})]});if(s.status===`error`)return(0,K.jsx)(`div`,{className:`files-row files-row-note files-row-error`,style:c,role:`alert`,children:s.error});let l=Kl(s.listing.entries,i);return l.length===0?(0,K.jsx)(`div`,{className:`files-row files-row-note`,style:c,children:i?`No uncommitted changes here.`:`Empty folder.`}):(0,K.jsxs)(K.Fragment,{children:[l.map(e=>{let s=e.type===`dir`&&r.has(e.path);return(0,K.jsxs)(`div`,{role:`none`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`files-row`,style:c,"data-status":e.status,onClick:()=>e.type===`dir`?a(e.path):o(e.path),"aria-expanded":e.type===`dir`?s:void 0,disabled:e.status===`deleted`,title:e.status===`deleted`?`${e.path} — deleted`:e.path,children:[(0,K.jsx)(`span`,{className:`changes-chevron`,"aria-hidden":!0,children:e.type===`dir`?s?`▾`:`▸`:``}),(0,K.jsxs)(`span`,{className:`files-name`,children:[e.name,e.type===`dir`?`/`:``]}),e.symlink&&(0,K.jsx)(`span`,{className:`files-meta`,children:`link`}),e.type===`dir`&&e.changed?(0,K.jsxs)(`span`,{className:`files-meta files-changed`,children:[e.changed,` changed`]}):null,e.type===`file`&&(0,K.jsx)(Yl,{status:e.status})]}),s&&(0,K.jsx)(Zl,{path:e.path,depth:t+1,folders:n,expanded:r,changedOnly:i,onToggle:a,onOpen:o})]},e.path)}),s.listing.entries.length>=2e3&&(0,K.jsx)(`div`,{className:`files-row files-row-note`,style:c,children:`Showing the first 2000 entries.`})]})}function Ql({sessionId:e,onClose:t,docked:n,refreshKey:r=0}){let i=ql.get(e),[a,o]=(0,G.useState)(()=>new Set(i?.expanded??[])),[s,c]=(0,G.useState)(i?.open??null),[l,u]=(0,G.useState)(i?.changedOnly??!1),[d,f]=(0,G.useState)(new Map),[p,m]=(0,G.useState)(0),[h,g]=(0,G.useState)(!1);(0,G.useEffect)(()=>{ql.set(e,{expanded:[...a],open:s,changedOnly:l})},[e,a,s,l]);let _=(0,G.useCallback)((t,n=!1)=>(n||f(e=>new Map(e).set(t,{status:`loading`})),z.fileCommand(`files.list`,e,t).then(e=>f(n=>new Map(n).set(t,{status:`ready`,listing:e}))).catch(e=>f(n=>new Map(n).set(t,{status:`error`,error:Jl(e)})))),[e]),v=(0,G.useRef)(!0);(0,G.useEffect)(()=>{let e=!v.current;v.current=!1,g(!0),Promise.all([``,...a].map(t=>_(t,e))).finally(()=>g(!1))},[_,r,p]);let y=e=>{let t=new Set(a);t.has(e)?t.delete(e):(t.add(e),d.get(e)?.status!==`ready`&&_(e)),o(t)},b=d.get(``),x=b?.status===`ready`&&b.listing.git,S=b?.status===`ready`?b.listing.entries.reduce((e,t)=>e+(t.changed??+!!t.status),0):0;return(0,K.jsx)(Dr,{docked:n,title:`Files`,ariaLabel:`Workspace files`,onClose:t,autoFocusSearch:!1,size:`large`,headExtra:(0,K.jsx)(`button`,{type:`button`,className:`btn ghost icon`,onClick:()=>m(e=>e+1),"aria-label":`Refresh files`,title:`Refresh`,children:h&&b?.status===`ready`?(0,K.jsx)(Ct,{size:`xs`}):(0,K.jsx)(Ue,{size:18})}),children:s?(0,K.jsx)(Xl,{sessionId:e,path:s,reloadKey:r+p,onBack:()=>c(null)}):(0,K.jsxs)(`div`,{className:`files-browser`,children:[x&&(0,K.jsxs)(`div`,{className:`files-toolbar`,children:[(0,K.jsx)(`span`,{className:`files-toolbar-meta`,children:S===0?`No uncommitted changes`:`${S} uncommitted change${S===1?``:`s`}`}),(0,K.jsxs)(`div`,{className:`changes-mode`,role:`group`,"aria-label":`Which files to show`,children:[(0,K.jsx)(`button`,{type:`button`,className:l?``:`active`,"aria-pressed":!l,onClick:()=>u(!1),children:`All`}),(0,K.jsx)(`button`,{type:`button`,className:l?`active`:``,"aria-pressed":l,onClick:()=>u(!0),children:`Changed`})]})]}),(0,K.jsx)(`div`,{className:`files-tree`,role:`group`,"aria-label":`Workspace files`,children:(0,K.jsx)(Zl,{path:``,depth:0,folders:d,expanded:a,changedOnly:l,onToggle:y,onOpen:c})})]})})}var $l=1e4,X={published:null,offers:[],noteTimes:[]};function eu(e,t){let{connection:n}=je(),r=n.status===`online`,i=`${n.currentNodeId??``}:${e??``}`,[a,o]=(0,G.useState)({key:``,...X});return(0,G.useEffect)(()=>{if(!e||!r)return;let n=!0,a=0,s=()=>{let t=++a,r=z.appCommand(`apps.offers`,e).then(e=>e.offers??[],()=>[]),s=z.appCommand(`apps.list`,e).then(e=>e.apps??null,()=>null);Promise.all([s,r]).then(([e,r])=>{let s=(e??[]).flatMap(e=>e.views.flatMap(e=>e.kind===`web`?(e.notes??[]).map(e=>e.at):[]));n&&t===a&&o({key:i,published:e?.length??null,offers:r,noteTimes:s})})};s();let c=t?setInterval(s,$l):void 0,l=()=>{document.visibilityState===`visible`&&s()};document.addEventListener(`visibilitychange`,l);let u=z.onAppsChanged(t=>{t===e&&s()});return()=>{n=!1,c&&clearInterval(c),document.removeEventListener(`visibilitychange`,l),u()}},[i,e,r,t]),r&&a.key===i?a:X}function tu(e){return Math.min(3e4,Math.max(6e3,e.trim().length*45))}function nu(){let{presentation:{error:e,errorActions:t}}=je(),[n,r]=(0,G.useState)(!1),[o,s]=(0,G.useState)(null);if((0,G.useEffect)(()=>{if(r(!1),!e||c()&&t.length>0)return;let n=setTimeout(()=>z.store.setError(``),tu(e));return()=>clearTimeout(n)},[e,t]),!e)return null;let l=!c()&&t.length>0?a():i(e.trim()),u=l.includes(`
|
|
27
|
-
`)||l.length>240;return(0,K.jsxs)(xc,{tone:`danger`,className:`error-toast${n?` expanded`:``}`,role:`alert`,children:[(0,K.jsx)(Sc,{tone:`danger`,children:`!`}),(0,K.jsxs)(`div`,{className:`error-toast-content`,children:[(0,K.jsx)(`span`,{className:`error-toast-text`,children:l}),u&&(0,K.jsx)(`button`,{className:`error-toast-details`,type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,children:n?`Hide details`:`Show details`}),c()&&t.length>0&&(0,K.jsx)(`div`,{className:`error-toast-actions`,children:t.map(e=>(0,K.jsx)(`button`,{className:`btn small${e.kind===`primary`?` primary`:``}`,type:`button`,disabled:o!==null,onClick:()=>{s(e.id),z.invokeAccountExtensionAction(e.id).then(async({url:e})=>{e?await h(e):z.store.setError(``)}).catch(e=>z.store.setError(e instanceof Error?e.message:String(e))).finally(()=>s(null))},children:o===e.id?`Opening…`:e.label},e.id))})]}),(0,K.jsx)(`button`,{className:`error-toast-close`,onClick:()=>z.store.setError(``),"aria-label":`Dismiss`,children:`×`})]})}function ru(e){return Math.min(3e4,Math.max(6e3,e.trim().length*45))}function iu(){let{presentation:{notice:e}}=je();return(0,G.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>z.store.setNotice(``),ru(e));return()=>clearTimeout(t)},[e]),e?(0,K.jsxs)(xc,{tone:`ok`,className:`notice-toast`,role:`status`,children:[(0,K.jsx)(Sc,{tone:`ok`,children:`✓`}),(0,K.jsx)(`span`,{className:`notice-toast-text`,children:e.trim()}),(0,K.jsx)(`button`,{className:`notice-toast-close`,onClick:()=>z.store.setNotice(``),"aria-label":`Dismiss`,children:`×`})]}):null}function au({onClose:e,firstRun:t=!1}){let[n,r]=(0,G.useState)([]),[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(!1),c=()=>z.listEphemeralKeys().then(r).catch(()=>{}),l=D.find(e=>e.id===`fly`)??D[0],u=D.filter(e=>e.id!==l?.id);(0,G.useEffect)(()=>{c()},[]);let d=D.find(e=>e.id===i);return(0,K.jsx)(ot,{title:d?d.name:`Connect a cloud provider`,onClose:e,headExtra:i?(0,K.jsx)(`button`,{className:`sheet-back`,onClick:()=>a(null),"aria-label":`Back`,children:`‹`}):void 0,children:i?(0,K.jsx)(ou,{providerId:i,onKeysChanged:c,onDone:e}):(0,K.jsxs)(`div`,{className:`picker-list`,children:[(0,K.jsx)(`p`,{className:`muted settings-intro`,children:t?`Connect your own cloud account to run agents on temporary servers. Pick a provider, paste a token, and you're ready — your first message launches the machine.`:`Pick a provider and paste a token. Connecting one adds an isolated machine profile you can pick in the machine menu.`}),l&&(()=>{let e=n.find(e=>e.id===l.id);return(0,K.jsx)(lt,{title:`${l.name} · Recommended`,meta:l.blurb,right:e?.configured?(0,K.jsx)(Te,{tone:`ok`,children:`Connected`}):(0,K.jsx)(Te,{children:`Stable`}),onClick:()=>a(l.id)},l.id)})(),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost block`,"aria-expanded":o,onClick:()=>s(e=>!e),children:o?`Hide other cloud providers`:`Other cloud providers`}),o&&u.map(e=>{let t=n.find(t=>t.id===e.id);return(0,K.jsx)(lt,{title:e.name,meta:e.blurb,right:t?.configured?(0,K.jsx)(Te,{tone:`ok`,children:`Connected`}):e.hostedOnly?(0,K.jsx)(Te,{tone:`accent`,children:`Server-managed`}):(0,K.jsx)(Te,{children:`Available`}),onClick:()=>a(e.id)},e.id)})]})})}function ou({providerId:e,onKeysChanged:t,onDone:n}){let r=D.find(t=>t.id===e),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(()=>z.getDeviceVaultSyncState());return(0,G.useEffect)(()=>{z.getEphemeralToken(e).then(e=>s(!!e)).catch(()=>{}),y(z.getDeviceVaultSyncState())},[e]),r.hostedOnly?(0,K.jsxs)(`div`,{className:`settings-form`,children:[(0,K.jsx)(Te,{tone:`accent`,children:`Server-managed provider`}),(0,K.jsxs)(`p`,{className:`muted`,children:[r.name,` must be managed by Bivy's server so the machine is always deleted and billing stops.`]}),(0,K.jsx)(`p`,{className:`muted small`,children:`Add it in Settings → Cloud machine profiles, then turn on “Run automations while I'm offline” inside the profile.`})]}):(0,K.jsxs)(`div`,{className:`settings-form`,children:[o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(Te,{tone:`ok`,children:[`✓ `,r.name,` connected`]}),(0,K.jsx)(`p`,{className:`muted small`,children:`Your cloud profile is ready. Pick it and send your first message; Bivy starts the machine automatically. Adjust its region, size, or lifetime in Settings → Cloud machine profiles.`}),v.phase!==`idle`&&(0,K.jsxs)(Te,{role:`status`,tone:v.phase===`failed`?`danger`:v.phase===`synced`?`ok`:void 0,children:[v.phase===`failed`?`Credential sync pending: ${v.failure??`retry needed`}`:v.phase===`synced`?`Credentials synced`:`Credential sync pending`,v.phase===`failed`&&(0,K.jsx)(`button`,{className:`btn ghost`,onClick:()=>z.syncDeviceVault().then(()=>y(z.getDeviceVaultSyncState())).catch(()=>y(z.getDeviceVaultSyncState())),children:`Retry`})]}),(0,K.jsxs)(`div`,{className:`row-actions`,children:[(0,K.jsx)(`button`,{className:`btn primary`,disabled:u||r.hostedOnly,onClick:async()=>{if(!u){d(!0),p(null);try{let t=await z.defaultEphemeralRunner(e);t&&_(t)}catch(e){p(String(e.message||e))}finally{d(!1)}}},children:u?`…`:r.hostedOnly?`Device launch unavailable`:`Use this profile`}),(0,K.jsx)(`button`,{className:`btn danger-ghost`,onClick:()=>h({title:`Remove provider token?`,message:`Forget the ${r.name} token on this device?`,action:()=>z.removeEphemeralToken(e).then(()=>{s(!1),t()})}),children:`Remove token`})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`muted`,children:r.blurb}),(0,K.jsx)(`ol`,{className:`eph-steps`,children:r.steps.map((e,t)=>(0,K.jsx)(`li`,{children:e},t))}),(0,K.jsx)(`div`,{className:`row-actions`,children:r.links.map(e=>(0,K.jsx)(`a`,{className:`btn ghost`,href:e.url,target:`_blank`,rel:`noopener`,children:e.label},e.url))}),(0,K.jsx)(`label`,{className:`field-label`,children:r.tokenLabel}),(0,K.jsx)(`input`,{className:`picker-search`,type:`password`,value:i,onChange:e=>a(e.target.value),placeholder:`Paste token`}),(0,K.jsx)(`button`,{className:`btn primary`,disabled:!i.trim()||c,onClick:async()=>{if(!c){l(!0),p(null);try{let n=await z.connectEphemeralProvider(e,i.trim());a(``),s(!0),t(),y(z.getDeviceVaultSyncState()),n&&_(n)}catch(e){p(String(e.message||e))}finally{l(!1)}}},children:c?`Connecting…`:`Connect`}),(0,K.jsx)(`p`,{className:`muted small`,children:`The token is end-to-end encrypted in your key vault, synced to your signed-in devices, and sent only to the selected provider. To run automations while you're offline, opt in from the profile in Settings → Cloud machine profiles — it reuses this token, nothing to paste twice.`})]}),g&&(()=>{let e=le(g.provider),t=e?.sizes.find(e=>e.id===g.size),i=de(t,g.ttlMinutes,e?.currency),a=g.region||e?.defaultRegion||`provider default`,o=g.teardownOnAgentFinish?`It will be destroyed when the agent finishes; the TTL remains a backstop.`:`It will remain billable until its ${g.ttlMinutes??`provider-default`}-minute TTL or manual teardown.`;return(0,K.jsx)(B,{title:`Use this billable machine profile?`,message:`${r.name} will launch an isolated machine in ${a}${t?` (${t.label})`:``} when you send your first message. ${i||`The provider's live rate applies.`} ${o}`,confirmLabel:`Use profile`,onCancel:()=>_(null),onConfirm:()=>{z.pickDraftEphemeralRunner(g),_(null),n()}})})(),m&&(0,K.jsx)(B,{title:m.title,message:m.message,confirmLabel:`Remove`,danger:!0,onCancel:()=>h(null),onConfirm:()=>{m.action(),h(null)}}),f&&(0,K.jsx)(Te,{tone:`danger`,children:f})]})}function su({state:e}){let t=e.presentation.needsModelAuth;if(!t||t.nodeId!==e.connection.currentNodeId)return null;let n=e.catalogs.providers.find(e=>e.id===t.provider)?.name||t.provider,r=!!t.reason;return(0,K.jsx)(ot,{title:`Sign in to your model`,onClose:()=>z.dismissModelAuthPrompt(),children:(0,K.jsxs)(`div`,{className:`settings-form`,children:[(0,K.jsx)(`p`,{className:`muted settings-intro`,children:r?`Your agent couldn't reach ${n} — its credential is missing or expired. Sign in again to keep going.`:`This temporary Machine needs a model before it can run your task. Sign in once with ${n}. The credential is encrypted for reuse by future isolated Machines; on Bivy Cloud this optional unattended path uses hosted credential custody.`}),(0,K.jsx)(Ft,{state:e,providerId:t.provider,apiKeyProvider:xe(t.provider)})]})})}function cu(e){return[`I'm new to Bivy. My app runs with \`${e.command}\` on port ${e.port}; I want to open it in a preview and mark what's wrong.`,`Publish it with \`bivy app publish\` so the preview shows your edits: if you're working in the folder it already runs in, publish port ${e.port}; otherwise have Bivy run it from your folder on a free port (a "start" command in the manifest).`,`Don't change anything else yet; once it's published, reply in one short line that it's ready.`,"When my marks arrive, fix them and check your fix. Then make a share link with `bivy app share` and send it to me with `bivy notify`, so it reaches my phone if I've closed the app."].join(`
|
|
28
|
-
`)}var lu=[`I'm new to Bivy. Make one small, useful change in this workspace that I'd keep: a few minutes of work, not a chore like running the tests. If the workspace is empty, build something small I can open.`,"Pick it yourself. If you really need a decision from me, ask with `bivy ask`.","If it's something I can see, run it and publish a preview with `bivy app publish`.","Last step, always: send me the result in one line with `bivy notify`, since I may have closed the app. Keep replies short, I'm probably on my phone."].join(`
|
|
29
|
-
`),uu=4e3,du=e=>e.split(/[\\/]/).filter(Boolean).pop()||e;function fu({machineName:e,onOpenApp:t,onFirstChange:n}){let r=e||`your machine`,[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1);(0,G.useEffect)(()=>{let e=!0,t=setTimeout(()=>{e&&a(e=>e??[])},uu);return z.appCommand(`apps.offers`,void 0).then(t=>{let n=t.offers??[];e&&a(e=>e??n.filter(e=>typeof e.project==`string`))},()=>{e&&a([])}),z.direct||z.pushStatus().then(t=>{e&&s(t.supported&&!t.subscribed&&t.permission!==`denied`)},()=>{}),()=>{e=!1,clearTimeout(t)}},[]);let u=async e=>{l(!0),o&&await z.enablePush().catch(()=>{}),e()},[d,...f]=i??[];return(0,K.jsxs)(`section`,{className:`card readiness`,"aria-labelledby":`get-started-title`,"aria-busy":i===null,children:[(0,K.jsx)(`p`,{className:`readiness-passed`,role:`status`,children:`✓ Setup complete`}),i===null?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h2`,{id:`get-started-title`,className:`card-title`,children:`Your agent's first task`}),(0,K.jsxs)(`p`,{className:`card-sub get-started-scan`,role:`status`,children:[(0,K.jsx)(Ct,{size:`xs`}),`Looking for apps running on `,r,`…`]})]}):d?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`h2`,{id:`get-started-title`,className:`card-title`,children:[`Mark what's wrong in `,du(d.project)]}),(0,K.jsxs)(`p`,{className:`card-sub`,children:[`It's running on `,r,`. The agent opens it here, you tap what's off, and it fixes it and sends you a link to share. It keeps working when you close this app.`]}),(0,K.jsxs)(`p`,{className:`get-started-app card-sub`,children:[(0,K.jsx)(`code`,{children:d.command}),` · port `,d.port]}),(0,K.jsxs)(`div`,{className:`get-started-actions`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`btn sm primary`,disabled:c,onClick:()=>void u(()=>t(d)),children:[`Open `,du(d.project),` and mark what's wrong`]}),(0,K.jsx)(`span`,{className:`card-sub`,children:`or type your own task below`})]}),f.length>0&&(0,K.jsxs)(`div`,{className:`get-started-more`,role:`group`,"aria-label":`Other running apps`,children:[(0,K.jsx)(`span`,{className:`card-sub`,children:`Also running:`}),f.slice(0,3).map(e=>(0,K.jsxs)(`button`,{type:`button`,className:`btn sm ghost`,disabled:c,onClick:()=>void u(()=>t(e)),"aria-label":`Open ${du(e.project)} on port ${e.port} and mark what's wrong`,children:[du(e.project),` · `,e.port]},e.port))]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h2`,{id:`get-started-title`,className:`card-title`,children:`Give your agent a first task`}),(0,K.jsxs)(`p`,{className:`card-sub`,children:[`It runs on `,r,` and keeps working when you close this app. It'll make one small, useful change here and tell your phone when it's done.`]}),(0,K.jsxs)(`div`,{className:`get-started-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn sm primary`,disabled:c,onClick:()=>void u(n),children:`Make one small improvement`}),(0,K.jsx)(`span`,{className:`card-sub`,children:`or type your own task below`})]})]})]})}var pu=`bivy:notify-offer`;function mu({working:e,machineName:t,onOpenChange:n}){let[r,i]=(0,G.useState)(()=>localStorage.getItem(pu)===`done`),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null);(0,G.useEffect)(()=>{if(r||a||!e||z.direct)return;let t=!0;return z.pushStatus().then(e=>{t&&o(e.supported&&!e.subscribed&&e.permission!==`denied`)}).catch(()=>{}),()=>{t=!1}},[r,a,e]),(0,G.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>i(!0),5e3);return()=>clearTimeout(e)},[l]);let p=!r&&a;(0,G.useEffect)(()=>n?.(p),[p]);let m=()=>{localStorage.setItem(pu,`done`),i(!0)},h=async()=>{c(!0),f(null);try{await z.enablePush(),localStorage.setItem(pu,`done`),u(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}};return p?l?(0,K.jsx)(`section`,{className:`card next-step`,"aria-label":`Notifications`,children:(0,K.jsx)(`p`,{className:`next-step-ok`,role:`status`,children:`✓ Notifications are on. You can close the app; Bivy will let you know.`})}):(0,K.jsxs)(`section`,{className:`card next-step`,"aria-labelledby":`notify-offer-title`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{id:`notify-offer-title`,children:`Get a notification when it's done?`}),(0,K.jsxs)(`p`,{children:[`The agent keeps working on `,t||`your machine`,` if you close this app. Bivy can tell you when it finishes or needs you.`]}),d&&(0,K.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:d})]}),(0,K.jsxs)(`div`,{className:`next-step-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn sm primary`,disabled:s,onClick:()=>void h(),children:s?`Turning on…`:`Turn on notifications`}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost`,disabled:s,onClick:m,children:`Not now`})]})]}):null}function hu({nodes:e,ephemeralEnabled:t,onPickNode:n,onEphemeral:r,onRefresh:i}){let a=e.filter(e=>!e.id.startsWith(`eph-`)),[o,s]=(0,G.useState)(null),c=(0,G.useRef)(a.length===0),l=(0,G.useRef)(!1);return(0,G.useEffect)(()=>{let t=o??(c.current&&e.length===1?e[0]?.id:void 0),r=e.find(e=>e.id===t&&e.online&&!e.id.startsWith(`eph-`));r&&!l.current&&(l.current=!0,n(r.id))},[e,o,n]),(0,K.jsxs)(`section`,{className:`connect-runner`,"aria-labelledby":`connect-runner-title`,children:[(0,K.jsxs)(`div`,{className:`connect-hero compact`,children:[(0,K.jsx)(`h2`,{className:`connect-title`,id:`connect-runner-title`,children:a.length>0?`Choose a Machine`:`Connect a Machine`}),(0,K.jsx)(`p`,{className:`connect-sub`,children:a.length>0?`Pick an online machine to start, or add another machine.`:t?`Use a machine with your real repository, services, and warm caches, or launch an isolated machine. Any hosted credential custody is disclosed before enablement.`:`Your agents run here, using your existing environment. Keep your repositories, tools, and agent logins.`})]}),(0,K.jsxs)(`div`,{className:`connect-waiting`,role:`status`,children:[(0,K.jsx)(Ct,{size:`sm`}),(0,K.jsx)(`span`,{className:`connect-waiting-text`,children:a.length>0?`Checking for connected machines automatically…`:`Waiting for your machine. This page updates automatically.`}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost`,onClick:i,children:`Check now`})]}),a.length>0&&(0,K.jsxs)(`div`,{className:`connect-nodes`,children:[(0,K.jsx)(`div`,{className:`connect-nodes-head`,children:`Your machines`}),(0,K.jsx)(`div`,{className:`connect-nodes-list`,children:a.map(e=>(0,K.jsxs)(`button`,{type:`button`,className:`connect-node`,onClick:()=>n(e.id),title:e.online?`Start on this Machine`:`This Machine is offline — selecting it will try to reconnect`,children:[(0,K.jsx)(Ot,{status:e.online?`online`:`idle`}),(0,K.jsx)(`span`,{className:`connect-node-name`,children:e.name||e.id}),(0,K.jsx)(`span`,{className:`connect-node-status${e.online?` is-online`:``}`,children:e.online?`Online`:`Offline`}),(0,K.jsx)(`svg`,{className:`connect-node-caret`,viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:(0,K.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]},e.id))})]}),(0,K.jsxs)(`div`,{className:`connect-options`,children:[(0,K.jsx)(`div`,{className:`connect-option machine-install-card`,children:(0,K.jsx)(wr,{onEnrolled:s})}),t&&(0,K.jsxs)(`div`,{className:`connect-option`,children:[(0,K.jsxs)(`div`,{className:`connect-option-head`,children:[(0,K.jsx)(`span`,{className:`connect-option-badge`,"aria-hidden":!0,children:(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,K.jsx)(`path`,{d:`M17.5 19a4.5 4.5 0 0 0 .5-8.97A6 6 0 0 0 6.34 9.2 4 4 0 0 0 7 17`}),(0,K.jsx)(`path`,{d:`M12 12v6m0 0-2.5-2.5M12 18l2.5-2.5`})]})}),(0,K.jsxs)(`div`,{className:`connect-option-copy`,children:[(0,K.jsx)(`h3`,{children:`Launch an isolated Machine`}),(0,K.jsx)(`p`,{children:`Fastest if you don't want to install locally. Start with the recommended cloud, review its estimated cost and teardown policy, then launch explicitly with your first task. Bivy adds no fee.`})]})]}),(0,K.jsx)(`button`,{type:`button`,className:`btn primary connect-option-cta`,onClick:r,children:`Launch isolated Machine`})]})]}),(0,K.jsx)(`p`,{className:`connect-sub`,children:`Next: choose a repository, send your first task, and review the result right here.`})]})}function gu({status:e,hasCachedTranscript:t,machineName:r}){let i=(0,G.useSyncExternalStore)(Pe,Me),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(()=>typeof navigator<`u`&&!navigator.onLine);(0,G.useEffect)(()=>{let e=()=>c(!0),t=()=>c(!1);return window.addEventListener(`offline`,e),window.addEventListener(`online`,t),()=>{window.removeEventListener(`offline`,e),window.removeEventListener(`online`,t)}},[]);let l=pe(s?`offline`:e,t,i,r),u=l.kind!==`live-control`,d=!n&&i.installChoice!==null&&!i.standalone;return!u&&!d?null:(0,K.jsxs)(K.Fragment,{children:[u&&(0,K.jsx)(`aside`,{className:`pwa-lifecycle`,"aria-label":`App availability`,children:(0,K.jsxs)(`div`,{className:`pwa-lifecycle-copy`,"data-availability":l.kind,children:[(0,K.jsx)(`strong`,{children:l.label}),(0,K.jsx)(`span`,{children:l.detail})]})}),d&&(0,K.jsxs)(`aside`,{className:`pwa-install`,"aria-label":`Install Bivy`,children:[(0,K.jsx)(`button`,{type:`button`,className:`pwa-install-dismiss`,onClick:Se,"aria-label":`Dismiss install suggestion`,title:`Don't show again`,children:`×`}),(0,K.jsxs)(`div`,{className:`pwa-install-copy`,children:[(0,K.jsx)(`strong`,{children:`Install Bivy`}),(0,K.jsx)(`span`,{children:`Open Bivy in a dedicated window and return to this device more reliably.`})]}),(0,K.jsx)(`div`,{className:`pwa-install-actions`,children:i.installChoice===`native`?(0,K.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>void De(),children:`Install`}):(0,K.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>o(e=>!e),children:`How to install`})}),a&&i.installChoice===`ios`&&(0,K.jsxs)(`p`,{role:`status`,children:[`In Safari, tap Share, then `,(0,K.jsx)(`strong`,{children:`Add to Home Screen`}),`, then Add. Other iOS browsers cannot install Bivy directly.`]}),a&&i.installChoice===`safari`&&(0,K.jsxs)(`p`,{role:`status`,children:[`On macOS Sonoma or later, choose `,(0,K.jsx)(`strong`,{children:`File → Add to Dock`}),` in Safari 17 or later. Older macOS Safari versions cannot install Bivy as a web app.`]})]})]})}function _u(e,t=document,n=window){let r=()=>{t.visibilityState===`visible`&&e()};return t.addEventListener(`visibilitychange`,r),n.addEventListener(`pageshow`,r),n.addEventListener(`focus`,r),()=>{t.removeEventListener(`visibilitychange`,r),n.removeEventListener(`pageshow`,r),n.removeEventListener(`focus`,r)}}function vu({onOpen:e,onClose:t,isOpen:n,maxWidth:r=720,edge:i=28,threshold:a=60}){let o=(0,G.useRef)(e),s=(0,G.useRef)(t);o.current=e,s.current=t,(0,G.useEffect)(()=>{let e=0,t=0,c=!1,l=!1,u=!1,d=a=>{if(u=!1,a.touches.length!==1||window.innerWidth>r){c=!1;return}let o=a.touches[0];if(!o){c=!1;return}e=o.clientX,t=o.clientY,l=e<=i,c=l||n},f=r=>{if(!c||r.touches.length!==1)return;let i=r.touches[0];if(!i)return;let a=i.clientX-e,o=i.clientY-t;if(!u){if(Math.abs(o)>Math.abs(a)&&Math.abs(o)>6){c=!1;return}Math.abs(a)>Math.abs(o)&&Math.abs(a)>2&&(!n&&l||n&&a<0)&&(u=!0)}u&&r.cancelable&&r.preventDefault()},p=r=>{if(!c)return;c=!1,u=!1;let i=r.changedTouches[0];if(!i)return;let d=i.clientX-e,f=i.clientY-t;Math.abs(d)<=Math.abs(f)||Math.abs(d)<a||(!n&&l&&d>0?o.current():n&&d<0&&s.current())};return window.addEventListener(`touchstart`,d,{passive:!0}),window.addEventListener(`touchmove`,f,{passive:!1}),window.addEventListener(`touchend`,p,{passive:!0}),()=>{window.removeEventListener(`touchstart`,d),window.removeEventListener(`touchmove`,f),window.removeEventListener(`touchend`,p)}},[n,r,i,a])}var yu={chat:{label:`Chat`,Icon:Ze},terminal:{label:`Terminal`,Icon:it},changes:{label:`Changes`,Icon:Ye}};function bu({views:e,value:t,onChange:n,changes:r=0}){let i=(0,G.useRef)([]),a=(t,r)=>{let a=t.key===`ArrowRight`?1:t.key===`ArrowLeft`?-1:0;if(!a)return;t.preventDefault();let o=(r+a+e.length)%e.length,s=e[o];s&&(n(s),i.current[o]?.focus())};return(0,K.jsx)(`div`,{className:`segmented session-view-toggle`,role:`radiogroup`,"aria-label":`Session view`,children:e.map((e,o)=>{let{label:s,Icon:c}=yu[e],l=e===`changes`&&r>0?r:null;return(0,K.jsxs)(`button`,{ref:e=>{i.current[o]=e},type:`button`,role:`radio`,className:`seg-btn`,"aria-checked":t===e,tabIndex:t===e?0:-1,onClick:()=>n(e),onKeyDown:e=>a(e,o),"aria-label":l?`${s}, ${l} file${l===1?``:`s`}`:s,title:s,children:[(0,K.jsx)(c,{size:14,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`session-view-label`,children:s}),l&&(0,K.jsx)(`span`,{className:`seg-count`,"aria-hidden":`true`,children:l})]},e)})})}var xu=`bivy.sessionView`,Su=50;function Cu(e){try{let t=JSON.parse(e.getItem(xu)||`{}`);return t&&typeof t==`object`?t:{}}catch{return{}}}function wu(e,t){return t&&Cu(e)[t]===`terminal`?`terminal`:`chat`}function Tu(e,t,n){let r=Cu(e);delete r[t],n!==`chat`&&(r[t]=n);let i=Object.keys(r);for(let e of i.slice(0,Math.max(0,i.length-Su)))delete r[e];try{e.setItem(xu,JSON.stringify(r))}catch{}}function Eu({tabs:e,active:t,onSelect:n,onClose:r,children:i}){let a=(0,G.useRef)([]),o=(t,r)=>{let i=t.key===`ArrowRight`?1:t.key===`ArrowLeft`?-1:0;if(!i)return;t.preventDefault();let o=(r+i+e.length)%e.length,s=e[o];s&&(n(s.id),a.current[o]?.focus())};return(0,K.jsxs)(`aside`,{className:`side-pane`,"aria-label":`Session details`,children:[(0,K.jsxs)(`div`,{className:`side-pane-head`,children:[(0,K.jsx)(`div`,{className:`segmented side-pane-tabs`,role:`tablist`,"aria-label":`Session details`,children:e.map((e,r)=>(0,K.jsxs)(`button`,{ref:e=>{a.current[r]=e},type:`button`,role:`tab`,id:`side-pane-tab-${e.id}`,"aria-controls":`side-pane-body`,"aria-selected":t===e.id,tabIndex:t===e.id?0:-1,className:`seg-btn side-pane-tab`,onClick:()=>n(e.id),onKeyDown:e=>o(e,r),children:[e.label,e.count?(0,K.jsx)(`span`,{className:`seg-count`,children:e.count}):null]},e.id))}),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost icon side-pane-close`,onClick:r,"aria-label":`Hide side pane`,title:`Hide side pane`,children:(0,K.jsx)(tt,{size:18})})]}),(0,K.jsx)(`div`,{className:`side-pane-body`,id:`side-pane-body`,role:`tabpanel`,"aria-labelledby":`side-pane-tab-${t}`,children:i})]})}var Du=`(min-width: 1200px)`,Ou=`bivy.sidePane`,ku=new Set([`changes`,`files`,`apps`,`artifacts`,`terminal`]);function Au(){try{let e=localStorage.getItem(Ou);return e&&ku.has(e)?e:null}catch{return null}}function ju(){let e=Ko(Du),[t,n]=(0,G.useState)(Au),r=(0,G.useCallback)(e=>{n(e);try{e?localStorage.setItem(Ou,e):localStorage.removeItem(Ou)}catch{}},[]);return{wide:e,tab:t,setTab:r,show:(0,G.useCallback)(t=>e?(r(t),!0):!1,[e,r])}}var Mu=(0,G.lazy)(()=>C(()=>import(`./Terminal-DUFzWYWz.js`).then(e=>({default:e.TerminalOverlay})),__vite__mapDeps([22,1,23,3,4,24,25,26,27,28]))),Nu=(0,G.lazy)(()=>C(()=>import(`./ReadinessChecklist-Bbgq2GQ8.js`).then(e=>({default:e.ReadinessChecklist})),__vite__mapDeps([29,24,1]))),Pu=(0,G.lazy)(()=>C(()=>import(`./Settings-ykv3LJak.js`).then(e=>({default:e.Settings})),__vite__mapDeps([30,3,4,23,1,24,25,31]))),Fu=(0,G.lazy)(()=>C(()=>import(`./AutomationsView-BJrM6yqr.js`).then(e=>({default:e.AutomationsView})),__vite__mapDeps([32,1,3,4,23,24,25]))),Iu=(0,G.lazy)(()=>C(()=>import(`./LibraryView-Jz-F19Hx.js`).then(e=>({default:e.LibraryView})),__vite__mapDeps([33,23,1,3,4,24,25,26,27]))),Lu=`a[href],button:not(:disabled),textarea:not(:disabled),input:not(:disabled),select:not(:disabled),[tabindex]:not([tabindex="-1"])`;function Ru(e,t){return t?e.needsAction||e.status===`needs_action`?t.question_asked||t.approval_requested:e.status===`failed`?t.session_error:bn(e)?t.session_done:!1:!0}function zu(){let e=je(),t=zl(),n=(0,G.useSyncExternalStore)(Uo,Vo),r=(0,G.useSyncExternalStore)(Uo,Wo),[i,a]=(0,G.useState)(!1),o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(null),[u,f]=(0,G.useState)(()=>localStorage.getItem(`bivy:automation-next-step`)===`done`),p=(0,G.useSyncExternalStore)(kt,jt),h=(0,G.useSyncExternalStore)(sr,cr),g=(0,G.useSyncExternalStore)(Nc,Pc),_=(0,G.useSyncExternalStore)(Vc,Hc),v=e.presentation.githubApp?.returning;(0,G.useEffect)(()=>{v&&lr({setup:`github`})},[v]);let b=Re(),x=oe&&b,[C,w]=(0,G.useState)(!1),[T,E]=(0,G.useState)(!1);(0,G.useEffect)(()=>E(!1),[e.activeSession.activeSessionId]);let[D,ee]=(0,G.useState)(!1),[j,te]=(0,G.useState)(!1),[M,N]=(0,G.useState)(null);(0,G.useEffect)(()=>$r(N),[]);let P=ju(),ne=P.show;(0,G.useEffect)(()=>{M&&ne(`apps`)},[M,ne]),(0,G.useEffect)(()=>N(null),[e.activeSession.activeSessionId]);let F=(0,G.useRef)(!1);(0,G.useEffect)(()=>{let t=e.activeSession.activeSessionId;if(!F.current||!t)return;F.current=!1;let n=!1;return z.onAppsChanged(e=>{n||e!==t||z.appCommand(`apps.list`,t).then(e=>{let r=e.apps.find(e=>e.views.some(e=>e.kind===`web`)),i=r?.views.find(e=>e.kind===`web`);!n&&r&&i&&(n=!0,N({sessionId:t,appId:r.id,openView:{viewId:i.id}}))},()=>{})})},[e.activeSession.activeSessionId]);let[I,re]=(0,G.useState)(!1),[ie,ae]=(0,G.useState)(()=>l(sessionStorage)),se=(0,G.useCallback)(()=>z.listMachineApps(),[]),[le,ue]=(0,G.useState)(null);(0,G.useEffect)(()=>{let e=y(sessionStorage);e&&Ll(e).then(t=>{t?ue({id:e,items:t}):m(sessionStorage)},()=>m(sessionStorage))},[]);let[de,R]=(0,G.useState)(null);(0,G.useEffect)(()=>{if(!de||(e.activeSession.activeSessionId??null)!==de.sessionId)return;let t=0,n,r=()=>{z.prefillComposer(de.text,de.attachments)?(Rl(de.inbox),R(null)):++t<50&&(n=setTimeout(r,100))};return n=setTimeout(r,0),()=>clearTimeout(n)},[de,e.activeSession.activeSessionId]);let fe=(0,G.useMemo)(()=>gn(e.activeSession.transcript),[e.activeSession.transcript]),pe=(0,G.useMemo)(()=>_n(e.activeSession.transcript),[e.activeSession.transcript]),me=e.sessionIndex.sessions.find(t=>t.sessionId===e.activeSession.activeSessionId),he=eu(me?.sessionId,me?vn(me)===`working`:!1),_e=Xr(me?.sessionId,he.noteTimes),[be,xe]=(0,G.useState)(!1),[Se,Ce]=(0,G.useState)(null),[Te,Ee]=(0,G.useState)(!1),[De,Me]=(0,G.useState)(!1),[Ne,Pe]=(0,G.useState)(null),[Fe,Ie]=(0,G.useState)(!1),[Le,ze]=(0,G.useState)(null),[Be,Ve]=(0,G.useState)(()=>new Set),He=(0,G.useCallback)(()=>{!z.direct&&e.connection.signedIn&&z.fetchGithubQueue().then(ze).catch(()=>{})},[e.connection.signedIn]);(0,G.useEffect)(()=>{if(z.direct||!e.connection.signedIn)return;let t=He;t();let n=_u(t),r=setInterval(()=>{document.visibilityState!==`hidden`&&t()},3e4);return()=>{clearInterval(r),n()}},[He,e.connection.signedIn]),(0,G.useEffect)(()=>{!z.direct&&e.connection.signedIn&&z.getNotificationPreferences().then(Go).catch(()=>{})},[e.connection.signedIn]);let Ue=(0,G.useMemo)(()=>Mn(Le),[Le]),We=(0,G.useMemo)(()=>wn(Le),[Le]),Ge=(0,G.useMemo)(()=>e.sessionIndex.sessions.filter(e=>xn(e)>0),[e.sessionIndex.sessions]),Ke=(0,G.useMemo)(()=>n?Ge.filter(e=>Ru(e,r)).length:0,[n,Ge,r]),qe=Ge.some(e=>!Be.has(e.sessionId)),Ye=(0,G.useCallback)(()=>{a(!0),Ve(new Set(Ge.map(e=>e.sessionId)))},[Ge]),B=(0,G.useCallback)(()=>a(!1),[]);(0,G.useEffect)(()=>{let e=Ge.length,t=Ke;document.title=e>0?`(${e}) Bivy`:`Bivy`;let n=navigator,r=()=>{(t>0?n.setAppBadge?.(t):n.clearAppBadge?.())?.catch(()=>{})};r();let i=_u(r);return()=>{i(),document.title=`Bivy`}},[Ke,Ge.length]);let Xe=!z.direct&&e.connection.signedIn&&!e.connection.currentNodeId;(0,G.useEffect)(()=>{if(!Xe)return;let e=()=>{document.visibilityState!==`hidden`&&z.refreshNodes()};e();let t=setInterval(e,4e3),n=_u(e);return()=>{clearInterval(t),n()}},[Xe]);let[Ze,Qe]=(0,G.useState)(()=>localStorage.getItem(`bivy.focusView`)===`1`),$e=(0,G.useCallback)(()=>{Qe(e=>{let t=!e;return localStorage.setItem(`bivy.focusView`,t?`1`:`0`),t})},[]),et=e.connection.status===`online`;(0,G.useEffect)(()=>ve(e.activeSession.working),[e.activeSession.working]),(0,G.useEffect)(()=>{et&&Ae()},[et]);let nt=Object.values(e.sessionIndex.followupsBySession).reduce((e,t)=>e+t.length,0);(0,G.useEffect)(()=>ye(nt),[nt]);let it=(0,G.useMemo)(()=>k({direct:z.direct,signedIn:e.connection.signedIn,status:e.connection.status,runtimes:e.catalogs.runtimes,readiness:e.catalogs.activationReadiness}),[e.catalogs.activationReadiness,e.catalogs.runtimes,e.connection.signedIn,e.connection.status]),at=e.activeSession.transcript.some(e=>e.role===`assistant`&&!!e.text&&!e.tool);(0,G.useEffect)(()=>{at&&e.activeSession.activeSessionId&&!u&&localStorage.setItem(`bivy:automation-next-step`,`done`)},[at,e.activeSession.activeSessionId,u]);let[ot,st]=(0,G.useState)(!1),ct=(0,G.useRef)(!1);et&&(ct.current=!0);let lt=e.connection.status===`reconnecting`||ct.current&&(e.connection.status===`connecting`||e.connection.status===`linking`||e.connection.status===`pairing`),ut=!!(e.activeSession.activeSessionId&&e.sessionIndex.tuiSessions.includes(e.activeSession.activeSessionId)),V=e.sessionIndex.sessions.find(t=>t.sessionId===e.activeSession.activeSessionId),dt=V?.runtimeId??e.activeSession.activeRuntimeId,ft=e.catalogs.runtimes.find(e=>e.id===dt)?.capabilities,pt=et&&!!ft?.interactiveTui,mt=e.activeSession.activeSessionId,[ht,gt]=(0,G.useState)(()=>({id:mt,view:wu(sessionStorage,mt)})),_t=ht.view;ht.id!==mt&&(_t=wu(sessionStorage,mt),gt({id:mt,view:_t}));let vt=(0,G.useCallback)(t=>{mt&&Tu(sessionStorage,mt,t),t===`chat`&&mt&&e.sessionIndex.tuiSessions.includes(mt)&&z.closeSessionTui(mt),gt({id:mt,view:t})},[mt,e.sessionIndex.tuiSessions]),yt=!!mt&&pt&&!Ne,bt=yt&&_t===`terminal`,xt=z.direct&&O(`directNode`,!1),St=!z.direct&&!z.solo||xt,wt=(et||lt||z.isCurrentNodeResumable()||!!e.draft.ephemeralConfig)&&!ut;vu({isOpen:i,onOpen:Ye,onClose:B,maxWidth:900}),rt(B,i),(0,G.useEffect)(()=>{if(!i)return;let e=o.current,t=s.current,n=c.current;t?.setAttribute(`inert`,``);let r=()=>e?Array.from(e.querySelectorAll(Lu)):[],a=requestAnimationFrame(()=>{(e?.querySelector(`.sidebar-close`)??e)?.focus()}),l=t=>{if(t.key!==`Tab`)return;let n=r();if(!n.length)return;let i=n[0],a=n[n.length-1],o=document.activeElement;t.shiftKey&&(o===i||!e?.contains(o))?(t.preventDefault(),a.focus()):!t.shiftKey&&(o===a||!e?.contains(o))&&(t.preventDefault(),i.focus())};return window.addEventListener(`keydown`,l),()=>{cancelAnimationFrame(a),window.removeEventListener(`keydown`,l),t?.removeAttribute(`inert`),n?.focus()}},[i]);let Tt=(0,G.useCallback)((t,n)=>{if(t.startsWith(`connect-provider:`)){let n=t.slice(17),r=e.connection.currentNodeId;n&&r&&z.store.setNeedsModelAuth({nodeId:r,provider:n});return}if(t===`fix-auth`||t.startsWith(`fix-auth:`)){let n=t.startsWith(`fix-auth:`)?t.slice(9):``,r=e.connection.currentNodeId;n&&r?z.store.setNeedsModelAuth({nodeId:r,provider:n}):Mt(`providers`);return}if(t===`retry-auth`){z.sendPrompt(`Continue — your previous request failed to authenticate. Pick up exactly where you left off.`);return}if(t.startsWith(`retry-at-reset:`)){z.setLimitRetry(!0);return}switch(t){case`/new`:z.newSession();break;case`fork`:re(!0);break;case`cancel-resume`:z.setLimitRetry(!1);break;case`/resume`:z.sendPrompt(`Please continue — your previous turn was interrupted by a restart before it finished. Pick up exactly where you left off and finish what you were doing.`)}},[e.connection.currentNodeId]),Et=(0,G.useMemo)(()=>{let t=e.activeSession.activeRuntimeId??e.catalogs.selectedAgentId,n=e.catalogs.currentModel?.provider,r=ce(t,typeof n==`string`?n:void 0);return r?`fix-auth:${r}`:`fix-auth`},[e.activeSession.activeRuntimeId,e.catalogs.selectedAgentId,e.catalogs.currentModel]),Dt=(0,G.useCallback)(()=>{if(a(!1),!z.direct&&e.connection.nodes.length===0&&z.refreshNodes(),z.direct||e.connection.nodes.length<=1){Ce(null),Ee(!0),Me(!1),xe(!0);return}Ie(!0)},[e.connection.nodes]),Pt=(0,G.useCallback)(t=>{Ie(!1),!z.direct&&t!==e.connection.currentNodeId&&z.switchNode(t),Ce(null),Ee(!0),Me(!1),xe(!0),a(!1)},[e.connection.currentNodeId]),Ft=(0,G.useCallback)((t,n,r,i)=>{let o=()=>{(!r||z.isCurrentSessionTarget(r,i))&&(Pe({termId:t,nodeId:n}),xe(!1),Ce(null),Ee(!1),Me(!1))};if(a(!1),!z.direct&&n&&n!==e.connection.currentNodeId){z.connectToNode(n).then(o).catch(e=>{(!r||z.isCurrentSessionTarget(r,i))&&z.store.setError(e instanceof Error?e.message:String(e))});return}o()},[e.connection.currentNodeId]),It=(0,G.useCallback)((t,n,r)=>{let i=()=>{z.isCurrentSessionTarget(t,r)&&(Pe(null),Ce(t),Ee(!0),Me(!1),xe(!0))};if(a(!1),!z.direct&&n&&n!==e.connection.currentNodeId){z.connectToNode(n).then(i).catch(e=>{z.store.setError(e instanceof Error?e.message:String(e))});return}i()},[e.connection.currentNodeId]),Lt=(0,G.useCallback)(()=>{Ne&&(Ce(Ne.termId),Ee(!1),Me(!1),xe(!0))},[Ne]),Rt=(0,G.useCallback)(()=>{if(!Ne)return;let e=Ne;Pe(null);let t=z.onTerminal(n=>{let r=n;r.type===`terminal.takeover.result`&&r.termId===e.termId&&(t(),r.ok||Pe(e))});z.sendTerminal({kind:`terminal.takeover`,termId:e.termId})},[Ne]);(0,G.useEffect)(()=>{Ne&&(e.sessionIndex.runTerminals.some(e=>e.termId===Ne.termId)||Pe(null))},[Ne,e.sessionIndex.runTerminals]);let zt=(0,G.useCallback)(()=>{Ce(null),Ee(!1),Me(!0),xe(!0)},[]),Bt=(0,G.useCallback)(()=>{e.activeSession.activeSessionId&&z.closeSessionTui(e.activeSession.activeSessionId)},[e.activeSession.activeSessionId]);(0,G.useEffect)(()=>{let t=new URLSearchParams(location.search).get(`review`);t&&e.activeSession.activeSessionId&&Xi(e.activeSession.activeSessionId,{reviewId:t})},[e.activeSession.activeSessionId]),(0,G.useEffect)(()=>{let t=new URLSearchParams(location.search),n=t.get(`review`);if(!n||!e.activeSession.activeSessionId||e.connection.status!==`online`)return;let r=e.activeSession.transcript.find(e=>e.review?.id===n)?.review;r&&(t.delete(`review`),history.replaceState(history.state,``,`${location.pathname}${t.size?`?${t}`:``}${location.hash}`),N({sessionId:r.sessionId,appId:r.appId,openView:{viewId:r.viewId,path:r.path}}))},[e.activeSession.activeSessionId,e.activeSession.transcript,e.connection.status]),(0,G.useEffect)(()=>{let t=new URLSearchParams(location.search),n=t.get(`apps`);n&&e.activeSession.activeSessionId&&(t.delete(`apps`),history.replaceState(history.state,``,`${location.pathname}${t.size?`?${t}`:``}${location.hash}`),/^[a-f0-9]{32}$/.test(n)&&N({sessionId:e.activeSession.activeSessionId,appId:n}))},[e.activeSession.activeSessionId]),(0,G.useEffect)(()=>{let t=new URLSearchParams(location.search),n=e.activeSession.activeSessionId;t.get(`show`)===`1`&&n&&e.connection.status===`online`&&(t.delete(`show`),history.replaceState(history.state,``,`${location.pathname}${t.size?`?${t}`:``}${location.hash}`),z.appCommand(`apps.showMe`,n).catch(e=>z.store.setError(e instanceof Error?e.message:`Couldn't show the app`)))},[e.activeSession.activeSessionId,e.connection.status]),(0,G.useEffect)(()=>{let t=new URLSearchParams(location.search).get(`attention`);if(!t||!e.activeSession.activeSessionId)return;let n=document.getElementById(`attention-${encodeURIComponent(t)}`);n&&(n.scrollIntoView({block:`center`}),n.setAttribute(`tabindex`,`-1`),n.focus({preventScroll:!0}))},[e.activeSession.activeSessionId,e.activeSession.approvals,e.activeSession.questions,e.activeSession.turnAttentions]);let Vt=e.activeSession.approvals.filter(t=>!t.sessionId||t.sessionId===e.activeSession.activeSessionId),H=e.activeSession.questions.filter(t=>!t.sessionId||t.sessionId===e.activeSession.activeSessionId),Ht=e.activeSession.turnAttentions.find(t=>t.sessionId===e.activeSession.activeSessionId),Ut=Vt.length+H.length+ +!!Ht;(0,G.useEffect)(()=>{Ut>0&&E(!1)},[Ut]);let Wt=(0,G.useRef)(null),Gt=[Vt[0]?.id,H[0]?.id,Ht?.sessionId].filter(Boolean).join(`:`);(0,G.useEffect)(()=>{Gt&&requestAnimationFrame(()=>Wt.current?.querySelector(`[data-attention-card]`)?.focus())},[Gt]);let Kt=!z.direct&&!z.solo&&!e.connection.signedIn,qt=(0,G.useSyncExternalStore)(gr,_r),Jt=!z.direct&&e.connection.signedIn&&!e.connection.currentNodeId;if(Kt||qt)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ec,{onDismiss:Kt?void 0:yr}),(0,K.jsxs)(`div`,{className:`toast-stack`,children:[(0,K.jsx)(iu,{}),(0,K.jsx)(Cc,{})]})]});let Yt=V?We.get(V.sessionId)??On(V.source):null,Xt=V?.forkedFrom?(()=>{let t=e.sessionIndex.sessions.find(e=>e.sessionId===V.forkedFrom);return{sessionId:V.forkedFrom,name:t?.name,nodeId:t?.nodeId,openable:!!t}})():void 0,Zt=V?.nodeId||e.connection.currentNodeId||void 0,Qt=e.connection.nodes.find(e=>e.id===Zt),$t=Qt?`${Qt.name||Qt.id} (${Qt.id})`:Zt,en=!!(V?.source&&String(V.source).startsWith(`repo:`)),tn=P.wide&&V&&!Jt?P.tab:null,nn=Tl(e.activeSession.changesHistory),rn=!P.wide&&!!V&&!Jt&&nn>0&&!Ne,an=rn&&T,on=()=>{P.show(`changes`)||E(!0)},U=[...yt?[`chat`,`terminal`]:rn?[`chat`]:[],...rn?[`changes`]:[]],W=e=>{E(e===`changes`),e!==`changes`&&vt(e)},sn=()=>{P.show(`artifacts`)||ee(!0)};return(0,K.jsxs)(`div`,{className:`app${tn?` has-pane`:``}`,children:[(0,K.jsxs)(`div`,{ref:o,className:`sidebar${i?` open`:``}`,role:i?`dialog`:`complementary`,"aria-modal":i?`true`:void 0,"aria-label":`Sessions and workspace`,tabIndex:i?-1:void 0,children:[(0,K.jsxs)(`div`,{className:`sidebar-head`,children:[(0,K.jsx)(`span`,{className:`brand`,children:`Bivy`}),(0,K.jsx)(`div`,{className:`sidebar-head-actions`,children:(0,K.jsx)(`button`,{className:`btn ghost icon only-mobile sidebar-close`,onClick:B,"aria-label":`Close sessions`,children:(0,K.jsx)(tt,{})})})]}),(0,K.jsx)(er,{runEvidence:Ue,sessionSources:We,automationsActive:!!h,onOpenTerminal:Dt,terminalDisabled:!et,onOpenAutomations:()=>{lr(),B()},libraryActive:g,onOpenLibrary:e=>{Fc(e),B()},onPick:(t,n,r)=>{let i=z.selectSessionTarget(t);Pe(null),B();let a=e.sessionIndex.sessions.find(e=>e.sessionId===t);if(a&&Dn(a)){It(t,r,i);return}if(a&&En(a)){z.findLiveRunTerminal(t,r).then(e=>{z.isCurrentSessionTarget(t,i)&&(e?Ft(e.termId,e.nodeId??r,t,i):z.openSessionOnNode(t,n,r))}).catch(e=>{z.isCurrentSessionTarget(t,i)&&z.store.setError(e instanceof Error?e.message:String(e))});return}z.openSessionOnNode(t,n,r)},onPickTerminal:Ft}),(0,K.jsxs)(`div`,{className:`sidebar-foot`,children:[(0,K.jsxs)(`button`,{className:`btn primary new-session-btn`,onClick:()=>{Pe(null),z.newSession(),B()},children:[(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,K.jsx)(`path`,{d:`M12 20h9`}),(0,K.jsx)(`path`,{d:`M16.4 3.6a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),(0,K.jsx)(`span`,{children:`New session`})]}),(0,K.jsx)(`button`,{className:`btn icon settings-gear`,onClick:()=>{Mt(),B()},title:`Settings`,"aria-label":`Settings`,children:(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,K.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z`})]})})]})]}),i&&(0,K.jsx)(`div`,{className:`scrim`,onClick:B}),(0,K.jsxs)(`main`,{ref:s,className:`main${Jt?` needs-node`:``}${an?` changes-section`:``}`,children:[(0,K.jsxs)(`header`,{className:`topbar`,children:[(0,K.jsxs)(`button`,{ref:c,className:`btn ghost icon only-mobile burger-btn`,onClick:Ye,"aria-label":qe?`Open sessions — something needs your attention`:`Open sessions`,children:[`☰`,qe&&(0,K.jsx)(`span`,{className:`attn-indicator`,"aria-hidden":!0,children:(0,K.jsx)(Ot,{status:`needs-action`})})]}),(0,K.jsxs)(`div`,{className:`topbar-title`,children:[(0,K.jsx)(`div`,{className:`topbar-title-row`,children:(0,K.jsx)(`h1`,{className:`title`,title:Jt?`Connect a Machine`:e.activeSession.activeTitle,children:Jt?`Connect a Machine`:e.activeSession.activeTitle})}),(St||U.length>1)&&(0,K.jsxs)(`div`,{className:`topbar-subline`,children:[St&&(xt?(0,K.jsx)(Oc,{}):(0,K.jsx)(Dc,{})),U.length>1&&(0,K.jsx)(bu,{views:U,value:an?`changes`:yt?_t:`chat`,onChange:W,changes:nn})]})]}),(0,K.jsxs)(`div`,{className:`topbar-actions`,children:[P.wide&&V&&!Jt&&(0,K.jsx)(`button`,{className:`btn ghost icon side-pane-toggle`,onClick:()=>P.setTab(tn?null:`changes`),"aria-pressed":!!tn,"aria-label":tn?`Hide side pane`:`Show changes, files, apps, artifacts and terminal`,title:tn?`Hide side pane`:`Show changes, files, apps, artifacts and terminal`,children:(0,K.jsx)(Je,{size:18})}),e.activeSession.activeSessionId&&!bt&&!an&&(0,K.jsxs)(`button`,{className:`btn ghost focus-view-btn`,onClick:$e,title:Ze?`Focus view on — show full transcript`:`Focus view — show only prompts and final answers`,"aria-label":Ze?`Show full transcript`:`Show only prompts and final answers`,"aria-pressed":Ze,children:[Ze?(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,K.jsx)(`path`,{d:`M9.88 9.88a3 3 0 1 0 4.24 4.24`}),(0,K.jsx)(`path`,{d:`M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68`}),(0,K.jsx)(`path`,{d:`M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61`}),(0,K.jsx)(`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`})]}):(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,K.jsx)(`path`,{d:`M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7z`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),(0,K.jsx)(`span`,{className:`focus-view-label`,children:Ze?`Focused`:`Focus`})]}),e.activeSession.activeSessionId&&(0,K.jsx)(ol,{sessionId:e.activeSession.activeSessionId,name:e.activeSession.activeTitle,isRepo:en,node:$t,agent:V?.agentName||V?.runtimeId,workspace:V?.workspace,worktree:V?.worktree,branch:V?.branch,sessionFile:V?.path,auditHealth:V?.auditHealth,eventLogHealth:V?.eventLogHealth,onBrowseFiles:V&&!Jt?()=>{P.show(`files`)||te(!0)}:void 0})]})]}),(e.connection.status===`pairing`||e.connection.status===`linking`)&&(0,K.jsxs)(`div`,{className:`banner`,"data-tone":`neutral`,role:`status`,children:[(0,K.jsx)(Ct,{size:`xs`}),`Linking this device…`]}),e.connection.nodeUpdate&&!V?.pendingLaunch&&(0,K.jsxs)(`div`,{className:`banner`,"data-tone":`accent`,role:`status`,children:[(0,K.jsxs)(`span`,{className:`banner-text`,children:[`This machine runs Bivy `,e.connection.nodeUpdate.current,` — `,e.connection.nodeUpdate.latest,` is available.`]}),(0,K.jsx)(`button`,{className:`btn sm primary banner-action`,onClick:()=>z.updateNode(),disabled:e.connection.nodeUpdating,children:e.connection.nodeUpdating?`Updating…`:`Update this machine`})]}),!Jt&&!e.draft.ephemeralConfig&&!e.activeSession.activeSessionId&&e.activeSession.transcript.length===0&&e.sessionIndex.sessions.length===0&&(0,K.jsx)(G.Suspense,{fallback:null,children:it.activated?(0,K.jsx)(fu,{machineName:e.connection.nodes.find(t=>t.id===e.connection.currentNodeId)?.name||void 0,onOpenApp:e=>{F.current=!0,ve(!0),z.sendPrompt(cu(e),void 0,{workspace:e.project,repo:void 0,branch:void 0})},onFirstChange:()=>{ve(!0),z.sendPrompt(lu)}}):(0,K.jsx)(Nu,{activation:it,onRemediate:{connect_machine:()=>document.querySelector(`.node-switcher-btn`)?.click(),install_agent:()=>document.querySelector(`.agent-pill`)?.click(),authenticate_credential:()=>document.querySelector(`.model-pill`)?.click(),grant_repository:()=>document.querySelector(`.repo-pill`)?.click()}})}),Jt&&(0,K.jsx)(`div`,{className:`connect-runner-scroll`,children:(0,K.jsx)(hu,{nodes:e.connection.nodes,ephemeralEnabled:!1,onPickNode:e=>z.switchNode(e),onEphemeral:()=>w(!0),onRefresh:()=>z.refreshNodes()})}),Ne&&!be?(()=>{let t=e.sessionIndex.runTerminals.find(e=>e.termId===Ne.termId),n=t?.name||t?.label||t?.agent||`Terminal session`,r=e.connection.nodes.find(e=>e.id===(t?.nodeId||Ne.nodeId)),i=!!t?.sessionId||Js(t?.agent,e.catalogs.runtimes),a=t?.sessionId||Ne.termId,o=e.activeSession.questions.filter(e=>e.sessionId===a);return(0,K.jsx)(sl,{sessionId:t?.sessionId,sessionName:n,nodeLabel:r?.name,online:e.connection.status!==`offline`,onOpenTerminal:Lt,onUseChat:i?Rt:void 0,children:o.length>0&&(0,K.jsx)(`div`,{className:`tui-locked-attention`,role:`region`,"aria-live":`polite`,"aria-label":`Agent needs your response`,children:(0,K.jsx)(cc,{questions:o,onAnswer:(e,t,n)=>z.answerQuestion(e,t,n),onCancel:(e,t)=>z.cancelQuestion(e,t)})})})})():bt?(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Mu,{embedded:!0,tui:!0,sessionId:mt,onClose:()=>vt(`chat`)},mt)}):ut?(0,K.jsx)(sl,{sessionId:e.activeSession.activeSessionId??void 0,sessionName:e.activeSession.activeTitle,nodeLabel:Qt?.name,online:e.connection.status!==`offline`,onOpenTerminal:zt,onUseChat:Bt}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(qa,{entries:e.activeSession.transcript,working:e.activeSession.working,workingLabel:e.activeSession.workingLabel,draftRoute:!e.activeSession.activeSessionId,greeting:e.sessionIndex.sessions.length>0?`What should we work on?`:void 0,opening:e.activeSession.opening,sessionKey:e.activeSession.activeSessionId,focusView:Ze,onAction:Tt,authAction:Et,header:V?.launchProgress?(0,K.jsx)(nc,{progress:V.launchProgress,onChooseModel:e=>z.chooseLaunchModel(V.sessionId,e),onRefreshModels:()=>z.refreshLaunchModels(V.sessionId),onSetupCredentials:async()=>{try{await z.setupManagedCredentials()}catch(e){z.store.setError(e instanceof Error?e.message:String(e))}},onRetryLaunch:V.pendingLaunch?async()=>{try{await z.retryPendingLaunch(V.sessionId)}catch(e){z.store.setError(e instanceof Error?e.message:String(e))}}:void 0,onRetryFreshMachine:V.pendingLaunch?async()=>{try{await z.retryPendingLaunchOnFreshMachine(V.sessionId)}catch(e){z.store.setError(e instanceof Error?e.message:String(e))}}:void 0}):void 0,footer:(0,K.jsxs)(`div`,{className:`attention-footer`,ref:Wt,role:`region`,"aria-live":`polite`,"aria-label":`Agent needs your response`,children:[(0,K.jsx)(ac,{approvals:Vt,onResolve:(e,t,n)=>z.resolveApproval(e,t,n)}),(0,K.jsx)(cc,{questions:H,onAnswer:(e,t,n)=>z.answerQuestion(e,t,n),onCancel:(e,t)=>z.cancelQuestion(e,t)}),Ht&&(0,K.jsx)(lc,{attention:Ht,onResolve:(e,t)=>z.resolveTurnAttention(e,t)})]})}),V&&(0,K.jsx)(mu,{working:e.activeSession.working,machineName:Qt?.name||void 0,onOpenChange:st}),at&&V&&!u&&!ot&&(0,K.jsxs)(`section`,{className:`card next-step`,"aria-label":`Next step`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:`Make this repeatable`}),(0,K.jsx)(`p`,{children:`Create an automation to run work without you.`})]}),(0,K.jsxs)(`div`,{className:`next-step-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn sm primary`,onClick:()=>{localStorage.setItem(`bivy:automation-next-step`,`done`),f(!0),lr()},children:`Open Automations`}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm ghost`,"aria-label":`Dismiss`,onClick:()=>{localStorage.setItem(`bivy:automation-next-step`,`done`),f(!0)},children:`Dismiss`})]})]}),j&&!P.wide&&V&&(0,K.jsx)(Ql,{sessionId:V.sessionId,refreshKey:e.activeSession.changesHistory.length,onClose:()=>te(!1)}),D&&!P.wide&&(0,K.jsx)(J,{artifacts:fe,onClose:()=>ee(!1)}),M&&!P.wide&&M.sessionId===V?.sessionId&&(0,K.jsx)(wo,{...M,onClose:()=>N(null)},`${M.sessionId}:${M.appId??``}:${M.openView?.viewId??``}:${M.openView?.scenario??``}`),I&&V&&(0,K.jsx)(rl,{sessionId:V.sessionId,onClose:()=>re(!1)}),(0,K.jsxs)(`div`,{className:`composer-gh`,children:[V&&Yt?(0,K.jsx)(Sl,{anchorId:`attention-${V.sessionId}`,source:Yt,statusClass:vn(V),statusLabel:Sn(V),gh:e.activeSession.github,evidence:Ue.get(V.sessionId),finishedAt:V.finishedAt,usage:e.activeSession.usage,forkedFrom:Xt,delegatedFrom:V?.delegatedFrom,filesEdited:Tl(e.activeSession.changesHistory),onOpenChanges:on,artifactsCount:fe.length,onOpenArtifacts:sn,onOpenRun:e=>Uc(e),onRecover:e=>{let t=V.sessionId,n=Ue.get(t),r=n?Ln(n):[];if(e===`fork`){z.forkSession(t);return}if(e===`fix`){z.sendPrompt(r.length?`The deterministic checks failed (${r.join(`, `)}). Please investigate the failures and fix them, then confirm the checks pass.`:`This run did not finish cleanly. Please investigate what went wrong and fix it.`);return}z.sendPrompt(r.length?`Please re-run the ${r.join(`, `)} check(s) and address anything that still fails.`:`Please re-run the project checks and address anything that fails.`)}}):(0,K.jsx)(dl,{gh:e.activeSession.github}),V&&(0,K.jsx)(Cl,{apps:he.published??pe.length,serverPorts:he.offers.map(e=>e.port),newNotes:_e,onOpen:()=>{P.show(`apps`)||N({sessionId:V.sessionId})}})]}),(0,K.jsx)(gu,{status:e.connection.status,hasCachedTranscript:e.activeSession.transcript.length>0,machineName:Qt?.name||void 0}),(0,K.jsx)(qs,{state:e,disabled:!wt,disabledHint:e.connection.status===`offline`?Qt?.name?`${Qt.name} is offline — run \`bivy status\` there`:"Machine offline — run `bivy status` on it":Qt?.name?`Connecting to ${Qt.name}…`:`Connecting…`,working:e.activeSession.working,onSend:(t,n)=>{e.connection.status!==`online`&&ge(),ve(!0),z.sendPrompt(t,n)},onAbort:()=>z.abort(),onError:e=>z.store.setError(e)})]}),an&&(0,K.jsx)(`div`,{className:`main-changes`,children:(0,K.jsx)(El,{docked:!0,history:e.activeSession.changesHistory,checks:V?Ue.get(V.sessionId)?.checks?.map(e=>({name:e.name,status:e.status})):void 0,onClose:()=>E(!1),onComposerFilled:()=>E(!1)})})]}),tn&&V&&(0,K.jsxs)(Eu,{tabs:[{id:`changes`,label:`Changes`,count:nn},{id:`files`,label:`Files`},{id:`apps`,label:`Apps`,count:he.published??pe.length},{id:`artifacts`,label:`Artifacts`,count:fe.length},{id:`terminal`,label:`Terminal`}],active:tn,onSelect:e=>{N(null),P.setTab(e)},onClose:()=>P.setTab(null),children:[tn===`changes`&&(0,K.jsx)(El,{docked:!0,history:e.activeSession.changesHistory,checks:Ue.get(V.sessionId)?.checks?.map(e=>({name:e.name,status:e.status})),onClose:()=>P.setTab(null)}),tn===`files`&&(0,K.jsx)(Ql,{docked:!0,sessionId:V.sessionId,refreshKey:e.activeSession.changesHistory.length,onClose:()=>P.setTab(null)},V.sessionId),tn===`apps`&&(()=>{let e=M?.sessionId===V.sessionId?M:{sessionId:V.sessionId};return(0,K.jsx)(wo,{docked:!0,...e,onClose:()=>N(null)},`${e.sessionId}:${e.appId??``}:${e.openView?.viewId??``}:${e.openView?.scenario??``}`)})(),tn===`artifacts`&&(0,K.jsx)(J,{docked:!0,artifacts:fe,onClose:()=>P.setTab(null)}),tn===`terminal`&&(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Mu,{embedded:!0,sessionId:V.sessionId,onClose:()=>P.setTab(`changes`)},V.sessionId)})]}),h&&(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Fu,{state:e,section:h.section,onSectionChange:ur,githubQueue:Le,onRefreshGithubQueue:He,onOpenRun:t=>{fr(e.activeSession.activeSessionId?{kind:`session`,id:e.activeSession.activeSessionId}:{kind:`new`}),Uc(t)},onClose:()=>fr(e.activeSession.activeSessionId?{kind:`session`,id:e.activeSession.activeSessionId}:{kind:`new`}),onOpenSession:t=>{let n=e.sessionIndex.sessions.find(e=>e.sessionId===t);z.openSessionOnNode(t,n?.path,n?.nodeId),fr({kind:`session`,id:t}),B()}})}),g&&(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Iu,{view:g,onClose:()=>Ic(e.activeSession.activeSessionId?{kind:`session`,id:e.activeSession.activeSessionId}:{kind:`new`}),onShowInChat:(t,n,r)=>{Xi(t,n),Ic({kind:`session`,id:t});let i=e.sessionIndex.sessions.filter(e=>e.sessionId===t),a=i.find(e=>e.nodeId===r)??i[0];z.openSessionOnNode(t,a?.path,r??a?.nodeId),B()}})}),_&&(0,K.jsx)(el,{runId:_.runId,load:e=>ke(z.local,e),onCancel:async e=>{await L(z.local,e),He()},onRetry:async e=>{await we(z.local,e),He()},onReauthenticate:async(t,n,r)=>{let i=n||e.connection.currentNodeId;if(!i)throw Error(`The Machine for this Run is not available.`);await z.connectToNode(i),z.store.setNeedsModelAuth({nodeId:i,provider:t,reason:r})},resolveMachineName:t=>e.connection.nodes.find(e=>e.id===t)?.name||void 0,isSessionResolvable:t=>e.sessionIndex.sessions.some(e=>e.sessionId===t),onReceiptReviewed:()=>{Oe(z.local,`receipt_reviewed`,matchMedia(`(max-width: 700px)`).matches?`mobile`:`desktop`).catch(()=>{})},onOpenSession:t=>{let n=e.sessionIndex.sessions.find(e=>e.sessionId===t);z.openSessionOnNode(t,n?.path,n?.nodeId),Wc({kind:`session`,id:t}),B()},onClose:()=>Wc(e.activeSession.activeSessionId?{kind:`session`,id:e.activeSession.activeSessionId}:{kind:`new`})}),p&&(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Pu,{state:e,view:p.view,onViewChange:At,onImported:e=>{Nt({kind:`session`,id:e}),B()},onRedirectToAutomations:t=>{Nt(e.activeSession.activeSessionId?{kind:`session`,id:e.activeSession.activeSessionId}:{kind:`new`}),t===`github`||t===`linear`||t===`slack`?lr({setup:t}):t===`queue`||t===`rulesets`?lr({section:t===`queue`?`runs`:t}):lr(),B()},onClose:()=>Nt(e.activeSession.activeSessionId?{kind:`session`,id:e.activeSession.activeSessionId}:{kind:`new`})})}),C&&x&&(0,K.jsx)(au,{onClose:()=>w(!1),firstRun:Jt}),e.presentation.forkProgress&&(0,K.jsx)(Bl,{progress:e.presentation.forkProgress,onClose:()=>z.store.setForkProgress(null)}),e.presentation.needsModelAuth&&(0,K.jsx)(su,{state:e}),Fe&&(0,K.jsx)(ls,{state:e,currentNodeId:e.connection.currentNodeId,onPick:Pt,onClose:()=>Ie(!1)}),be&&(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Mu,{sessionId:Te?null:e.activeSession.activeSessionId,attachTermId:Se,standalone:Te,tui:De,onClose:()=>{xe(!1),Ce(null),Ee(!1),Me(!1)}})}),t&&(0,K.jsx)(`div`,{className:`banner`,"data-tone":`accent`,role:`status`,children:t}),(ie||le)&&(0,K.jsx)(Ml,{text:[le?.items.text,ie].filter(Boolean).join(`
|
|
30
|
-
|
|
31
|
-
`),images:le?.items.attachments,sessions:e.sessionIndex.sessions,listApps:se,onDeliver:(t,n)=>{let r=le,i=[S(r?.items.attachments.length??0,n),r?.items.text,ie].filter(Boolean).join(`
|
|
32
|
-
|
|
33
|
-
`);if(ae(null),ue(null),m(sessionStorage),r?.items.attachments.length){R({sessionId:t?.sessionId??null,text:i,attachments:r.items.attachments,inbox:r.id}),t?A(()=>z.openSessionOnNode(t.sessionId,t.path,t.nodeId)):e.activeSession.activeSessionId&&A(()=>z.newSession());return}t?(d(localStorage,t.sessionId,i),A(()=>z.openSessionOnNode(t.sessionId,t.path,t.nodeId))):e.activeSession.activeSessionId?(d(localStorage,null,i),A(()=>z.newSession())):z.prefillComposer(i)||d(localStorage,null,i)}}),(0,K.jsxs)(`div`,{className:`toast-stack`,children:[(0,K.jsx)(iu,{}),(0,K.jsx)(nu,{}),(0,K.jsx)(Cc,{})]})]})}var Bu=class extends G.Component{state={error:null,retryKey:0};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`Unhandled render error:`,e,t.componentStack)}retry=()=>{this.setState(e=>({error:null,retryKey:e.retryKey+1}))};render(){let{error:e,retryKey:t}=this.state;return e?(0,K.jsxs)(`div`,{className:`error-boundary`,role:`alert`,children:[(0,K.jsx)(`h1`,{children:`Something went wrong`}),(0,K.jsx)(`p`,{children:`The app hit an unexpected error. Reloading usually fixes it.`}),(0,K.jsx)(`pre`,{className:`error-boundary__detail`,children:e.message}),(0,K.jsxs)(`div`,{className:`error-boundary__actions`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:this.retry,children:`Try again`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`Reload`})]})]}):(0,K.jsx)(G.Fragment,{children:this.props.children},t)}};function Vu(){let e=typeof window<`u`?window.visualViewport:void 0,t=document.documentElement,n=()=>{let n=e?.height??window.innerHeight,r=e?.offsetTop??0;t.style.setProperty(`--app-h`,`${Math.round(n)}px`),t.style.setProperty(`--app-top`,`${Math.round(r)}px`);let i=Math.max(0,Math.round((window.innerHeight||n)-n-r));t.style.setProperty(`--keyboard-h`,`${i}px`)};n(),e?(e.addEventListener(`resize`,n),e.addEventListener(`scroll`,n)):(window.addEventListener(`resize`,n),window.addEventListener(`orientationchange`,n))}async function Hu(){try{let e=navigator?.storage;return e?.persist?typeof e.persisted==`function`&&await e.persisted()?!0:await e.persist():!1}catch{return!1}}var Uu=e({});_(),Vu(),n||Hu(),n||me();var Wu=document.getElementById(`root`);Wu&&(0,Qs.createRoot)(Wu).render((0,K.jsx)(G.StrictMode,{children:(0,K.jsx)(Bu,{children:(0,K.jsx)(zu,{})})})),z.connect(),z.installLifecycleHandlers(),r(e=>z.store.setError(e)),vc();export{On as A,vr as C,Un as D,Kn as E,Cn as M,Jn as O,Tr as S,tr as T,ga as _,Vo as a,Pr as b,Uo as c,jo as d,wo as f,ha as g,ma as h,Ko as i,yn as j,qn as k,Mo as l,pa as m,Js as n,Ho as o,Ja as p,Hs as r,Go as s,Uu as t,Oo as u,ti as v,dr as w,Fr as x,ei as y};
|