frizz-server 0.15.62 → 0.15.64
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/dist/claude-agent-broker.js +16723 -17586
- package/dist/dev-child.js +23003 -20453
- package/package.json +1 -1
- package/runtime/cc-worker/hooks/deny-ask.mjs +1 -1
- package/runtime/cc-worker/lib/frizz-tools.mjs +370 -58
- package/web-dist/assets/{abnfDiagram-VCTEODGH-B23viQiP.js → abnfDiagram-VCTEODGH-D5EqHQdx.js} +1 -1
- package/web-dist/assets/architecture-7GRP2DOG-CPrgjw61.js +1 -0
- package/web-dist/assets/{architectureDiagram-5GKGNRK7-D8USefah.js → architectureDiagram-5GKGNRK7-gq825RUa.js} +1 -1
- package/web-dist/assets/{blockDiagram-I7D4REHJ-BtjLcrYi.js → blockDiagram-I7D4REHJ-C3kbcova.js} +1 -1
- package/web-dist/assets/{c4Diagram-7LVT6UL2-F76BIBsA.js → c4Diagram-7LVT6UL2-DSdiPLXk.js} +1 -1
- package/web-dist/assets/channel-c26qxF0z.js +1 -0
- package/web-dist/assets/{chunk-2E4U76K2-CU1HWazS.js → chunk-2E4U76K2-BVgft5ii.js} +1 -1
- package/web-dist/assets/{chunk-4HAMMTFA-UxW05P_i.js → chunk-4HAMMTFA-zVCpOazU.js} +1 -1
- package/web-dist/assets/{chunk-75Z2AOVW-hVVY0e1L.js → chunk-75Z2AOVW-KVNTSyn6.js} +1 -1
- package/web-dist/assets/{chunk-CLGD4ZFX-C1O2SPPZ.js → chunk-CLGD4ZFX-DaCd56Bs.js} +1 -1
- package/web-dist/assets/{chunk-DU6HZSFF-mBBDvwET.js → chunk-DU6HZSFF-Dltf3cFo.js} +1 -1
- package/web-dist/assets/{chunk-F27PBJKO-YFj-bXUU.js → chunk-F27PBJKO-HNYY-fg6.js} +1 -1
- package/web-dist/assets/{chunk-GMAD6QVW-DEtmMJEi.js → chunk-GMAD6QVW-B1qwCavq.js} +1 -1
- package/web-dist/assets/{chunk-GVQU2GXP-CJ12GvUv.js → chunk-GVQU2GXP-0tGYVw7V.js} +1 -1
- package/web-dist/assets/{chunk-IMKFNOWR-BWv1ipDL.js → chunk-IMKFNOWR-xV54i1G0.js} +1 -1
- package/web-dist/assets/{chunk-L3NEJ4N5-CUhs1eCv.js → chunk-L3NEJ4N5-DeTgpeAQ.js} +1 -1
- package/web-dist/assets/{chunk-OSK3NFVY-wJEfgmTH.js → chunk-OSK3NFVY-CDvPPEY9.js} +1 -1
- package/web-dist/assets/{chunk-P2QGCYS3-DUXmdiIi.js → chunk-P2QGCYS3-BFxT0iW2.js} +1 -1
- package/web-dist/assets/{chunk-POPQ4Y6H-DWV_sMOc.js → chunk-POPQ4Y6H-g4jad-CP.js} +1 -1
- package/web-dist/assets/{chunk-PWAF6VOD-CI718SMM.js → chunk-PWAF6VOD-DxDAJOIK.js} +1 -1
- package/web-dist/assets/{chunk-SHT3W25Y-DnZEwNll.js → chunk-SHT3W25Y-CWehUFxT.js} +1 -1
- package/web-dist/assets/{chunk-SVP7TREG-DXl-FEaS.js → chunk-SVP7TREG-6Wvgv7qH.js} +1 -1
- package/web-dist/assets/{chunk-TICWLB2K-DzrPNrL4.js → chunk-TICWLB2K-hqgNuTQA.js} +1 -1
- package/web-dist/assets/{chunk-TLUHSLCS-cWeDLf7m.js → chunk-TLUHSLCS-CwXYeqEB.js} +2 -2
- package/web-dist/assets/classDiagram-ZZMXUADV-CW3HOlqk.js +1 -0
- package/web-dist/assets/classDiagram-v2-VYDZK3BY-CW3HOlqk.js +1 -0
- package/web-dist/assets/{cynefin-OW5HDTMX-CGivvV6j.js → cynefin-OW5HDTMX-XWQcd7FR.js} +1 -1
- package/web-dist/assets/{cynefinDiagram-5FMLGOSQ-DA6ojANA.js → cynefinDiagram-5FMLGOSQ-BhLkDCGl.js} +1 -1
- package/web-dist/assets/{dagre-GXQ25YYZ-BxTkg-lK.js → dagre-GXQ25YYZ-CEoBRa9n.js} +1 -1
- package/web-dist/assets/{diagram-S7CK7UJ4-C8Hpstlc.js → diagram-S7CK7UJ4-DHk02-f8.js} +1 -1
- package/web-dist/assets/{diagram-UQ7AKVKN-BDm_PZpG.js → diagram-UQ7AKVKN-CrtOBX4M.js} +1 -1
- package/web-dist/assets/{diagram-VSXAHHWV-RArgMOsc.js → diagram-VSXAHHWV-BQlVmaCU.js} +1 -1
- package/web-dist/assets/{diagram-VX7I27RA-DSU_8ZkT.js → diagram-VX7I27RA-Br3LNVAh.js} +1 -1
- package/web-dist/assets/{diagram-Z3DM3KII-BPbq1Sjk.js → diagram-Z3DM3KII-DO8RnVJu.js} +1 -1
- package/web-dist/assets/{ebnfDiagram-PWID7BFC-CxJgw_Ch.js → ebnfDiagram-PWID7BFC-DPJHGedI.js} +1 -1
- package/web-dist/assets/{erDiagram-RLTQ6QDP-C4Axha71.js → erDiagram-RLTQ6QDP-aVp1cHLr.js} +1 -1
- package/web-dist/assets/eventmodeling-NTZA5JFV-BPWcI0I_.js +1 -0
- package/web-dist/assets/flowDiagram-HODETNUW-yGIuO3Wj.js +1 -0
- package/web-dist/assets/{ganttDiagram-EL5Y4UJY-B0nxZ4Xc.js → ganttDiagram-EL5Y4UJY-hGh2T28b.js} +1 -1
- package/web-dist/assets/{gitGraph-4MIJSDKK--aikGW2W.js → gitGraph-4MIJSDKK-BP-Alggb.js} +1 -1
- package/web-dist/assets/{gitGraphDiagram-WWUBYQGX-BooAol-_.js → gitGraphDiagram-WWUBYQGX-BEPvlTMD.js} +1 -1
- package/web-dist/assets/index-D4bBjzdK.js +262 -0
- package/web-dist/assets/index-DjVez4iB.css +2 -0
- package/web-dist/assets/{info-A6RAGUB7-pI1TzLwA.js → info-A6RAGUB7--TsjfXti.js} +1 -1
- package/web-dist/assets/{infoDiagram-27XIBGKW-M-kZYy18.js → infoDiagram-27XIBGKW-B_gxNeQz.js} +1 -1
- package/web-dist/assets/{ishikawaDiagram-5VMMS53U-DF0j9Mru.js → ishikawaDiagram-5VMMS53U-CsBNJzZc.js} +1 -1
- package/web-dist/assets/{journeyDiagram-3NMN7TZE-CuJaKMi7.js → journeyDiagram-3NMN7TZE-CbaAx84c.js} +1 -1
- package/web-dist/assets/{kanban-definition-UXKFOSKX-BW_bR4jD.js → kanban-definition-UXKFOSKX-Qnp78nfx.js} +1 -1
- package/web-dist/assets/{line-C4nu-MyE.js → line-BJrSvIrG.js} +1 -1
- package/web-dist/assets/{mermaid-parser.core-D4YANiO2.js → mermaid-parser.core-CpqT4SIU.js} +3 -3
- package/web-dist/assets/{mermaid.core-B0rUdjKb.js → mermaid.core-B1c_wthC.js} +3 -3
- package/web-dist/assets/{mindmap-definition-YA3MSWOX-C-oMLpqe.js → mindmap-definition-YA3MSWOX-DVVk9yW1.js} +1 -1
- package/web-dist/assets/{packet-AYTQ26CC-C6UAHcr2.js → packet-AYTQ26CC-iZErOx2H.js} +1 -1
- package/web-dist/assets/{pegDiagram-XKGWAZYB-5jrVGkld.js → pegDiagram-XKGWAZYB-Da5p8rFF.js} +1 -1
- package/web-dist/assets/{pie-WAS4IAKB-D4F4ioaC.js → pie-WAS4IAKB-DA7GELw3.js} +1 -1
- package/web-dist/assets/{pieDiagram-E7YTZNPT-hglGp1tZ.js → pieDiagram-E7YTZNPT-BZ9ObHqc.js} +1 -1
- package/web-dist/assets/{quadrantDiagram-AXDQQJYC-LXRcDHFO.js → quadrantDiagram-AXDQQJYC-9azv0gR1.js} +1 -1
- package/web-dist/assets/{radar-RG4KPBEZ-CTLrr81C.js → radar-RG4KPBEZ-BX9sHDPS.js} +1 -1
- package/web-dist/assets/{railroad-74A4TZTK-D4i0I4m9.js → railroad-74A4TZTK-Brs7_Tyl.js} +1 -1
- package/web-dist/assets/railroad-abnf-HS5TGJTU-BeJB0nBn.js +1 -0
- package/web-dist/assets/railroad-ebnf-LZEXJU2U-BpiILSS0.js +1 -0
- package/web-dist/assets/railroad-peg-WCYAUIDC-Bm6eAoYO.js +1 -0
- package/web-dist/assets/{railroadDiagram-O6MQD6OU-u1yMp_hI.js → railroadDiagram-O6MQD6OU-DRhzaWFO.js} +1 -1
- package/web-dist/assets/{requirementDiagram-BXWQKSXE-7ISLLKF3.js → requirementDiagram-BXWQKSXE-CQcrIknF.js} +1 -1
- package/web-dist/assets/{sankeyDiagram-P5KCCOFB-BnK6rnjU.js → sankeyDiagram-P5KCCOFB-DkUbT70z.js} +1 -1
- package/web-dist/assets/{sequenceDiagram-WJ2MYXX4-CnuvmaQF.js → sequenceDiagram-WJ2MYXX4-BqKV7sY4.js} +1 -1
- package/web-dist/assets/{stateDiagram-D77RDMKH-Bj9ZPcRt.js → stateDiagram-D77RDMKH-CPiwkHGu.js} +1 -1
- package/web-dist/assets/stateDiagram-v2-MP3YSRHH-Cg2HXf9n.js +1 -0
- package/web-dist/assets/{swimlanes-42K2YHIH-COI9EGIy.js → swimlanes-42K2YHIH-CP-V5WFz.js} +1 -1
- package/web-dist/assets/swimlanesDiagram-VR7AAH4N-DGdb-xhi.js +8 -0
- package/web-dist/assets/threadSurfaces-dttA_8fg.js +140 -0
- package/web-dist/assets/{timeline-definition-24CTP7MA-L1aCW1vQ.js → timeline-definition-24CTP7MA-DKY-PWS4.js} +1 -1
- package/web-dist/assets/{treeView-Q6P3EWNA-DePmdkjB.js → treeView-Q6P3EWNA-Gk9FLh78.js} +1 -1
- package/web-dist/assets/{treemap-WGGIJYW6-DOlGwmCm.js → treemap-WGGIJYW6-BYnxP1dg.js} +1 -1
- package/web-dist/assets/{vennDiagram-4TSXK5OY-BCEFsIii.js → vennDiagram-4TSXK5OY-CQCcg6lv.js} +1 -1
- package/web-dist/assets/{wardley-WFR3VGLG-CLVY7mnX.js → wardley-WFR3VGLG-m7RO5npi.js} +1 -1
- package/web-dist/assets/{wardleyDiagram-VM6X3IG4-DYVUsvla.js → wardleyDiagram-VM6X3IG4-f0WZbMup.js} +1 -1
- package/web-dist/assets/{xychartDiagram-S5SC5T6Z-D86vmsc2.js → xychartDiagram-S5SC5T6Z-C4OuY-EY.js} +1 -1
- package/web-dist/index.html +2 -2
- package/web-dist/assets/architecture-7GRP2DOG-CNcdaCCI.js +0 -1
- package/web-dist/assets/channel-Ba68GPpA.js +0 -1
- package/web-dist/assets/classDiagram-ZZMXUADV-BIl8IrqN.js +0 -1
- package/web-dist/assets/classDiagram-v2-VYDZK3BY-BIl8IrqN.js +0 -1
- package/web-dist/assets/eventmodeling-NTZA5JFV-Cye0HMxq.js +0 -1
- package/web-dist/assets/flowDiagram-HODETNUW-D-RU7U_9.js +0 -1
- package/web-dist/assets/index-BytW7hzV.css +0 -2
- package/web-dist/assets/index-OwSaXs6C.js +0 -264
- package/web-dist/assets/railroad-abnf-HS5TGJTU-CCyFeptO.js +0 -1
- package/web-dist/assets/railroad-ebnf-LZEXJU2U-Dt3_mZmI.js +0 -1
- package/web-dist/assets/railroad-peg-WCYAUIDC-BEn1Og7V.js +0 -1
- package/web-dist/assets/stateDiagram-v2-MP3YSRHH-DlEsfbG-.js +0 -1
- package/web-dist/assets/swimlanesDiagram-VR7AAH4N-DBboc6Jp.js +0 -8
- package/web-dist/assets/threadSurfaces-Bxomexi7.js +0 -141
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-B1c_wthC.js","assets/index-D4bBjzdK.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/index-DjVez4iB.css","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-C4XfhTaE.js","assets/chunk-DU6HZSFF-Dltf3cFo.js","assets/chunk-75Z2AOVW-KVNTSyn6.js","assets/dist-DoH_9pyS.js","assets/chunk-CLGD4ZFX-DaCd56Bs.js","assets/chunk-PWAF6VOD-DxDAJOIK.js","assets/chunk-GMAD6QVW-B1qwCavq.js","assets/chunk-P2QGCYS3-BFxT0iW2.js","assets/chunk-4HAMMTFA-zVCpOazU.js","assets/rough.esm-CSKSodPl.js","assets/chunk-GVQU2GXP-0tGYVw7V.js","assets/chunk-OSK3NFVY-CDvPPEY9.js","assets/line-BJrSvIrG.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-L3NEJ4N5-DeTgpeAQ.js","assets/chunk-TLUHSLCS-CwXYeqEB.js","assets/chunk-2E4U76K2-BVgft5ii.js","assets/graphlib-B8gBHxth.js","assets/chunk-LNGE3PJU-DNNNwF8Y.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,t}from"./rolldown-runtime-Bh1tDfsg.js";import{$ as n,$a as r,$c as i,$i as a,$n as o,$o as s,$r as c,$s as l,$t as u,A as d,Aa as f,Ac as p,Ai as m,An as h,Ao as g,Ar as _,As as v,At as y,B as b,Ba as x,Bc as S,Bi as C,Bn as w,Bo as T,Br as E,Bs as D,Bt as O,C as k,Ca as A,Cc as j,Ci as M,Cn as N,Co as P,Cr as F,Cs as I,Ct as L,D as R,Da as ee,Dc as te,Di as ne,Dn as re,Do as ie,Dr as z,Ds as B,Dt as ae,E as oe,Ea as se,Ec as ce,Ei as le,En as ue,Eo as de,Er as fe,Es as pe,Et as me,F as he,Fa as ge,Fc as _e,Fi as ve,Fn as ye,Fo as be,Fr as xe,Fs as Se,Ft as Ce,G as we,Ga as Te,Gc as Ee,Gi as De,Gn as Oe,Go as ke,Gr as Ae,Gs as je,Gt as Me,H as Ne,Ha as Pe,Hc as Fe,Hi as Ie,Hn as Le,Ho as Re,Hr as ze,Hs as Be,Ht as Ve,I as He,Ia as Ue,Ic as We,Ii as Ge,In as Ke,Io as qe,Ir as Je,Is as Ye,It as Xe,J as Ze,Ja as Qe,Jc as $e,Ji as et,Jn as tt,Jo as nt,Jr as rt,Js as it,Jt as at,K as ot,Ka as st,Kc as ct,Ki as lt,Kn as ut,Ko as dt,Kr as ft,Ks as pt,Kt as mt,L as ht,La as gt,Lc as _t,Li as vt,Ln as yt,Lo as bt,Lr as xt,Ls as St,Lt as Ct,M as wt,Ma as Tt,Mc as Et,Mi as Dt,Mn as Ot,Mo as kt,Mr as At,Ms as jt,Mt,N as Nt,Na as Pt,Nc as Ft,Ni as It,Nn as Lt,No as Rt,Nr as zt,Ns as Bt,Nt as Vt,O as Ht,Oa as Ut,Oc as Wt,Oi as Gt,On as Kt,Oo as qt,Or as Jt,Os as Yt,Ot as Xt,P as Zt,Pa as Qt,Pc as $t,Pi as en,Pn as tn,Po as nn,Pr as rn,Ps as an,Pt as on,Q as sn,Qa as cn,Qc as ln,Qi as un,Qn as dn,Qo as fn,Qr as pn,Qs as mn,Qt as hn,R as gn,Ra as _n,Rc as vn,Ri as yn,Rn as bn,Ro as xn,Rr as Sn,Rs as Cn,Rt as wn,S as Tn,Sa as En,Sc as Dn,Si as On,Sn as kn,So as An,Sr as jn,Ss as Mn,St as Nn,T as Pn,Ta as Fn,Tc as In,Ti as Ln,Tn as Rn,To as zn,Tr as Bn,Ts as Vn,Tt as Hn,U as Un,Ua as Wn,Uc as Gn,Ui as Kn,Un as qn,Uo as Jn,Ur as Yn,Us as Xn,Ut as Zn,V as Qn,Va as $n,Vc as er,Vi as tr,Vn as nr,Vo as rr,Vr as ir,Vs as ar,Vt as or,W as sr,Wa as cr,Wc as lr,Wi as ur,Wn as dr,Wo as fr,Wr as pr,Ws as mr,Wt as hr,X as gr,Xa as _r,Xc as vr,Xi as yr,Xn as br,Xo as xr,Xr as Sr,Xs as Cr,Xt as wr,Y as Tr,Ya as Er,Yc as Dr,Yi as Or,Yn as kr,Yo as V,Yr as Ar,Ys as jr,Yt as Mr,Z as Nr,Za as Pr,Zc as Fr,Zi as Ir,Zn as Lr,Zo as Rr,Zr as zr,Zs as Br,Zt as Vr,_ as Hr,_a as Ur,_c as Wr,_i as Gr,_l as Kr,_n as qr,_o as Jr,_r as Yr,_s as Xr,_t as Zr,a as Qr,aa as $r,ac as ei,ai as ti,al as ni,an as ri,ao as ii,ar as H,as as ai,at as oi,b as si,ba as ci,bc as li,bi as ui,bn as di,bo as fi,br as pi,bs as mi,bt as hi,c as gi,ca as _i,cc as vi,ci as yi,cl as bi,cn as xi,co as Si,cr as Ci,cs as wi,ct as Ti,d as Ei,da as Di,dc as Oi,di as ki,dl as Ai,dn as ji,do as Mi,dr as Ni,ds as Pi,dt as Fi,ea as Ii,ei as Li,el as Ri,en as zi,eo as Bi,er as Vi,es as Hi,et as Ui,f as Wi,fa as Gi,fc as Ki,fi as qi,fl as Ji,fn as Yi,fo as Xi,fr as Zi,fs as Qi,ft as $i,g as ea,ga as ta,gc as na,gi as ra,gl as ia,gn as aa,go as oa,gr as sa,gs as ca,gt as la,h as ua,ha as da,hc as fa,hi as pa,hl as ma,hn as ha,ho as ga,hr as _a,hs as U,ht as va,i as ya,ia as ba,ic as xa,ii as Sa,il as Ca,in as wa,io as Ta,ir as Ea,is as Da,it as Oa,j as ka,ja as Aa,jc as ja,ji as Ma,jn as Na,jo as Pa,jr as Fa,js as Ia,jt as La,k as Ra,ka as za,kc as Ba,ki as Va,kn as Ha,ko as Ua,kr as Wa,ks as W,kt as Ga,l as Ka,la as qa,lc as Ja,li as Ya,ll as Xa,ln as Za,lo as Qa,lr as $a,ls as eo,lt as to,m as no,ma as ro,mc as io,mi as ao,ml as oo,mn as so,mo as co,mr as lo,ms as uo,mt as fo,n as po,na as mo,ni as ho,nl as go,nn as _o,no as vo,nr as yo,ns as bo,nt as xo,o as So,oa as Co,oc as wo,oi as To,ol as Eo,on as Do,oo as Oo,or as G,os as ko,ot as Ao,p as jo,pa as Mo,pc as No,pi as Po,pl as Fo,pn as Io,po as Lo,pr as Ro,ps as K,pt as zo,q as Bo,qa as Vo,qc as Ho,qi as Uo,qn as Wo,qo as Go,qr as Ko,qs as qo,qt as Jo,r as Yo,ra as Xo,rc as Zo,ri as Qo,rl as $o,rn as es,ro as ts,rr as ns,rs,rt as is,s as as,sa as os,sc as ss,si as cs,sn as ls,so as us,sr as ds,ss as fs,st as ps,t as ms,ta as hs,ti as gs,tl as _s,tn as vs,to as ys,tr as bs,ts as xs,tt as Ss,u as Cs,ua as ws,uc as Ts,ui as Es,ul as Ds,un as Os,uo as ks,ur as As,us as js,ut as Ms,v as Ns,va as Ps,vc as Fs,vi as Is,vl as Ls,vn as Rs,vo as zs,vr as Bs,vs as Vs,vt as Hs,w as Us,wa as Ws,wc as Gs,wi as Ks,wn as qs,wo as Js,wr as Ys,ws as Xs,wt as Zs,x as Qs,xa as $s,xc as ec,xi as tc,xn as nc,xo as rc,xr as ic,xs as ac,xt as oc,y as sc,ya as cc,yc as lc,yi as uc,yn as dc,yo as fc,yr as pc,ys as mc,yt as hc,z as gc,za as _c,zc as vc,zi as yc,zn as bc,zo as xc,zr as Sc,zs as Cc,zt as wc}from"./index-D4bBjzdK.js";var Tc=V(`alarm-clock-off`,[[`path`,{d:`M6.87 6.87a8 8 0 1 0 11.26 11.26`,key:`3on8tj`}],[`path`,{d:`M19.9 14.25a8 8 0 0 0-9.15-9.15`,key:`15ghsc`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.26 18.67 4 21`,key:`yzmioq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M4 4 2 6`,key:`1ycko6`}]]),Ec=V(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Dc=V(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Oc=V(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),kc=V(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Ac=V(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),jc=V(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Mc=V(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Nc=V(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Pc=V(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Fc=V(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ic=V(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Lc=V(`file-diff`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),Rc=V(`file-minus`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}]]),zc=V(`file-plus`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Bc=V(`file`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Vc=V(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Hc=V(`git-branch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),Uc=V(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Wc=V(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),Gc=V(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),Kc=V(`list-checks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),qc=V(`list-todo`,[[`rect`,{x:`3`,y:`5`,width:`6`,height:`6`,rx:`1`,key:`1defrl`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),Jc=V(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Yc=V(`message-circle-off`,[[`path`,{d:`M20.5 14.9A9 9 0 0 0 9.1 3.5`,key:`1iebmn`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5.6 5.6C3 8.3 2.2 12.5 4 16l-2 6 6-2c3.4 1.8 7.6 1.1 10.3-1.7`,key:`1ov8ce`}]]),Xc=V(`message-square-code`,[[`path`,{d:`M10 7.5 8 10l2 2.5`,key:`xb17xw`}],[`path`,{d:`m14 7.5 2 2.5-2 2.5`,key:`5rap1v`}],[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Zc=V(`message-square-plus`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}]]),Qc=V(`messages-square`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),$c=V(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),el=V(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),tl=V(`package-check`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),nl=V(`play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),rl=V(`repeat`,[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]),il=V(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),al=V(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ol=V(`signpost`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z`,key:`gqqp9m`}]]),sl=V(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),cl=V(`square-dot`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),ll=V(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),ul=V(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),dl=V(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),fl=V(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),pl=V(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),q=e(Ls(),1),ml=e(Kr(),1);function hl(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var gl=hl();function _l(e){gl=e}var vl={exec:()=>null};function J(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(yl.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var yl={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},bl=/^(?:[ \t]*(?:\n|$))+/,xl=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Sl=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Cl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,wl=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Tl=/(?:[*+-]|\d{1,9}[.)])/,El=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Dl=J(El).replace(/bull/g,Tl).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Ol=J(El).replace(/bull/g,Tl).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),kl=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Al=/^[^\n]+/,jl=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ml=J(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,jl).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Nl=J(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Tl).getRegex(),Pl=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Fl=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Il=J(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Fl).replace(`tag`,Pl).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ll=J(kl).replace(`hr`,Cl).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Pl).getRegex(),Rl={blockquote:J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Ll).getRegex(),code:xl,def:Ml,fences:Sl,heading:wl,hr:Cl,html:Il,lheading:Dl,list:Nl,newline:bl,paragraph:Ll,table:vl,text:Al},zl=J(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Cl).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Pl).getRegex(),Bl={...Rl,lheading:Ol,table:zl,paragraph:J(kl).replace(`hr`,Cl).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,zl).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Pl).getRegex()},Vl={...Rl,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Fl).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:vl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(kl).replace(`hr`,Cl).replace(`heading`,` *#{1,6} *[^
|
|
3
|
+
]`).replace(`lheading`,Dl).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Hl=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ul=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Wl=/^( {2,}|\\)\n(?!\s*$)/,Gl=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Kl=/[\p{P}\p{S}]/u,ql=/[\s\p{P}\p{S}]/u,Jl=/[^\s\p{P}\p{S}]/u,Yl=J(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ql).getRegex(),Xl=/(?!~)[\p{P}\p{S}]/u,Zl=/(?!~)[\s\p{P}\p{S}]/u,Ql=/(?:[^\s\p{P}\p{S}]|~)/u,$l=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,eu=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,tu=J(eu,`u`).replace(/punct/g,Kl).getRegex(),nu=J(eu,`u`).replace(/punct/g,Xl).getRegex(),ru=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,iu=J(ru,`gu`).replace(/notPunctSpace/g,Jl).replace(/punctSpace/g,ql).replace(/punct/g,Kl).getRegex(),au=J(ru,`gu`).replace(/notPunctSpace/g,Ql).replace(/punctSpace/g,Zl).replace(/punct/g,Xl).getRegex(),ou=J(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Jl).replace(/punctSpace/g,ql).replace(/punct/g,Kl).getRegex(),su=J(/\\(punct)/,`gu`).replace(/punct/g,Kl).getRegex(),cu=J(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),lu=J(Fl).replace(`(?:-->|$)`,`-->`).getRegex(),uu=J(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,lu).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),du=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,fu=J(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,du).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),pu=J(/^!?\[(label)\]\[(ref)\]/).replace(`label`,du).replace(`ref`,jl).getRegex(),mu=J(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,jl).getRegex(),hu={_backpedal:vl,anyPunctuation:su,autolink:cu,blockSkip:$l,br:Wl,code:Ul,del:vl,emStrongLDelim:tu,emStrongRDelimAst:iu,emStrongRDelimUnd:ou,escape:Hl,link:fu,nolink:mu,punctuation:Yl,reflink:pu,reflinkSearch:J(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,pu).replace(`nolink`,mu).getRegex(),tag:uu,text:Gl,url:vl},gu={...hu,link:J(/^!?\[(label)\]\((.*?)\)/).replace(`label`,du).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,du).getRegex()},_u={...hu,emStrongRDelimAst:au,emStrongLDelim:nu,url:J(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,`i`).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},vu={..._u,br:J(Wl).replace(`{2,}`,`*`).getRegex(),text:J(_u.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},yu={normal:Rl,gfm:Bl,pedantic:Vl},bu={normal:hu,gfm:_u,breaks:vu,pedantic:gu},xu={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Su=e=>xu[e];function Cu(e,t){if(t){if(yl.escapeTest.test(e))return e.replace(yl.escapeReplace,Su)}else if(yl.escapeTestNoEncode.test(e))return e.replace(yl.escapeReplaceNoEncode,Su);return e}function wu(e){try{e=encodeURI(e).replace(yl.percentDecode,`%`)}catch{return null}return e}function Tu(e,t){let n=e.replace(yl.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(yl.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(yl.slashPipe,`|`);return n}function Eu(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Du(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ou(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function ku(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
4
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
5
|
+
`)}var Au=class{options;rules;lexer;constructor(e){this.options=e||gl}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:Eu(e,`
|
|
6
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=ku(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Eu(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Eu(t[0],`
|
|
7
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Eu(t[0],`
|
|
8
|
+
`).split(`
|
|
9
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
10
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
11
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
12
|
+
${s}`:s,r=r?`${r}
|
|
13
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
14
|
+
`+e.join(`
|
|
15
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
16
|
+
`+e.join(`
|
|
17
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
18
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
|
|
19
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
|
|
20
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
21
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
|
|
22
|
+
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
23
|
+
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
24
|
+
`+l}!u&&!l.trim()&&(u=!0),r+=f+`
|
|
25
|
+
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Tu(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
26
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Tu(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
27
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Eu(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Du(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Ou(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Ou(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&!(r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},ju=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||gl,this.options.tokenizer=this.options.tokenizer||new Au,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:yl,block:yu.normal,inline:bu.normal};this.options.pedantic?(t.block=yu.pedantic,t.inline=bu.pedantic):this.options.gfm&&(t.block=yu.gfm,this.options.breaks?t.inline=bu.breaks:t.inline=bu.gfm),this.tokenizer.rules=t}static get rules(){return{block:yu,inline:bu}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(yl.carriageReturn,`
|
|
28
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(yl.tabCharGlobal,` `).replace(yl.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
29
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
30
|
+
`+r.raw,n.text+=`
|
|
31
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
32
|
+
`+r.raw,n.text+=`
|
|
33
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=`
|
|
34
|
+
`+r.raw,a.text+=`
|
|
35
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=`
|
|
36
|
+
`+r.raw,n.text+=`
|
|
37
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,a)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},Mu=class{options;parser;constructor(e){this.options=e||gl}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(yl.notSpaceStart)?.[0],i=e.replace(yl.endingNewline,``)+`
|
|
38
|
+
`;return r?`<pre><code class="language-`+Cu(r)+`">`+(n?i:Cu(i,!0))+`</code></pre>
|
|
39
|
+
`:`<pre><code>`+(n?i:Cu(i,!0))+`</code></pre>
|
|
40
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
41
|
+
${this.parser.parse(e)}</blockquote>
|
|
42
|
+
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
43
|
+
`}hr(e){return`<hr>
|
|
44
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
45
|
+
`+r+`</`+i+`>
|
|
46
|
+
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+Cu(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
47
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
48
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
49
|
+
<thead>
|
|
50
|
+
`+t+`</thead>
|
|
51
|
+
`+r+`</table>
|
|
52
|
+
`}tablerow({text:e}){return`<tr>
|
|
53
|
+
${e}</tr>
|
|
54
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
55
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Cu(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=wu(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Cu(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=wu(e);if(i===null)return Cu(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${Cu(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Cu(e.text)}},Nu=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},Pu=class e{options;renderer;textRenderer;constructor(e){this.options=e||gl,this.options.renderer=this.options.renderer||new Mu,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Nu}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
|
|
56
|
+
`+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Fu=class{options;block;constructor(e){this.options=e||gl}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?ju.lex:ju.lexInline}provideParser(){return this.block?Pu.parse:Pu.parseInline}},Iu=class{defaults=hl();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Pu;Renderer=Mu;TextRenderer=Nu;Lexer=ju;Tokenizer=Au;Hooks=Fu;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Mu(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Au(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Fu;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Fu.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ju.lex(e,t??this.defaults)}parser(e,t){return Pu.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?ju.lex:ju.lexInline,s=i.hooks?i.hooks.provideParser():e?Pu.parse:Pu.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
57
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Cu(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Lu=new Iu;function Y(e,t){return Lu.parse(e,t)}Y.options=Y.setOptions=function(e){return Lu.setOptions(e),Y.defaults=Lu.defaults,_l(Y.defaults),Y},Y.getDefaults=hl,Y.defaults=gl,Y.use=function(...e){return Lu.use(...e),Y.defaults=Lu.defaults,_l(Y.defaults),Y},Y.walkTokens=function(e,t){return Lu.walkTokens(e,t)},Y.parseInline=Lu.parseInline,Y.Parser=Pu,Y.parser=Pu.parse,Y.Renderer=Mu,Y.TextRenderer=Nu,Y.Lexer=ju,Y.lexer=ju.lex,Y.Tokenizer=Au,Y.Hooks=Fu,Y.parse=Y,Y.options,Y.setOptions,Y.use,Y.walkTokens,Y.parseInline,Pu.parse,ju.lex;var Ru=e(t(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),R=I(`/\\*`,`\\*/`),ee=I(`#`,`$`),te=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:{scope:`number`,begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:R,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:{scope:`number`,begin:O,relevance:0},C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:ee,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:D,relevance:0},NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:{scope:`title`,begin:T,relevance:0},UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:E,relevance:0}});function ne(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function re(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ie(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=ne,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function z(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function B(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function ae(e,t){e.relevance===void 0&&(e.relevance=1)}var oe=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},se=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],ce=`keyword`;function le(e,t,n=ce){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,le(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,ue(n[0],n[1])]})}}function ue(e,t){return t?Number(t):+!de(e)}function de(e){return se.includes(e.toLowerCase())}var fe={},pe=e=>{console.error(e)},me=(e,...t)=>{console.log(`WARN: ${e}`,...t)},he=(e,t)=>{fe[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),fe[`${e}/${t}`]=!0)},ge=Error();function _e(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function ve(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw pe(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),ge;if(typeof e.beginScope!=`object`||e.beginScope===null)throw pe(`beginScope must be object`),ge;_e(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function ye(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw pe(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),ge;if(typeof e.endScope!=`object`||e.endScope===null)throw pe(`endScope must be object`),ge;_e(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function be(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function xe(e){be(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),ve(e),ye(e)}function Se(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(C(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[re,B,xe,oe].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[ie,z,ae].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=le(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return we(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function Ce(e){return e?e.endsWithParent||Ce(e.starts):!1}function we(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Ce(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Te=`11.11.1`,Ee=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},De=i,Oe=a,ke=Symbol(`nomatch`),Ae=7,je=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(me(s.replace(`{}`,n[1])),me(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(he(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),he(`10.7.0`,`Please use highlight(code, options) instead.
|
|
58
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};ee(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,ee(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=Ae&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(R=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return ke;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==ke)return e}if(r.type===`illegal`&&a===``)return P+=`
|
|
59
|
+
`,1;if(L>1e5&&L>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw pe(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=Se(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,F=0,I=0,L=0,R=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){L++,R?R=!1:A.matcher.considerAll(),A.matcher.lastIndex=I;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(I,e.index),e);I=e.index+t}E(n.substring(I))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:F,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:De(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:I,context:n.slice(I-100,I+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:De(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:De(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(F).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(ee(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new Ee(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),ee(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=Oe(l,e)}let E=()=>{k(),he(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),he(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(pe(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)pe(e);else throw e;i=c}i.name||=n,t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function F(e){let t=N(e);return t&&!t.disableAutodetect}function I(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function L(e){I(e),a.push(e)}function R(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function ee(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function ne(e){return he(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),he(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:ne,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:F,inherit:Oe,addPlugin:L,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Te,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in te)typeof te[e]==`object`&&n(te[e]);return Object.assign(e,te),e},Me=je({});Me.newInstance=()=>je({}),t.exports=Me,Me.HighlightJS=Me,Me.default=Me}))()).default;function zu(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(${[`fish`,`bash`,`zsh`,`sh`,`csh`,`ksh`,`tcsh`,`dash`,`scsh`].join(`|`)})`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}var Bu=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Vu=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),Hu=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),Uu=[...Vu,...Hu],Wu=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),Gu=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),Ku=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),qu=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function Ju(e){let t=e.regex,n=Bu(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i=/@-?\w[\w]*(-\w+)*/,a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:`CSS`,case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:`from to`},classNameAliases:{keyframePosition:`selector-tag`},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:`selector-id`,begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:`selector-class`,begin:`\\.[a-zA-Z-][a-zA-Z0-9_-]*`,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,variants:[{begin:`:(`+Gu.join(`|`)+`)`},{begin:`:(:)?(`+Ku.join(`|`)+`)`}]},n.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+qu.join(`|`)+`)\\b`},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:`url data-uri`},contains:[...a,{className:`string`,begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:`[{;]`,relevance:0,illegal:/:/,contains:[{className:`keyword`,begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:Wu.join(` `)},contains:[{begin:/[a-z-]+(?=:)/,className:`attribute`},...a,n.CSS_NUMBER_MODE]}]},{className:`selector-tag`,begin:`\\b(`+Uu.join(`|`)+`)\\b`}]}}function Yu(e){let t=e.regex;return{name:`Diff`,aliases:[`patch`],contains:[{className:`meta`,relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:`comment`,variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:`addition`,begin:/^\+/,end:/$/},{className:`deletion`,begin:/^-/,end:/$/},{className:`addition`,begin:/^!/,end:/$/}]}}var Xu=`[A-Za-z$_][0-9A-Za-z$_]*`,Zu=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),Qu=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],$u=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),ed=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],td=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],nd=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],rd=[].concat(td,$u,ed);function id(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=Xu,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:Xu,keyword:Zu,literal:Qu,built_in:rd,"variable.language":nd},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...$u,...ed]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...td,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function ad(e){let t={className:`attr`,begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:`punctuation`,relevance:0},r=[`true`,`false`,`null`],i={scope:`literal`,beginKeywords:r.join(` `)};return{name:`JSON`,aliases:[`jsonc`],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}function od(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={begin:`^[-\\*]{3,}`,end:`$`},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,r,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function sd(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}function cd(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:`title.function.invoke`,relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o=`abstract.as.async.await.become.box.break.const.continue.crate.do.dyn.else.enum.extern.false.final.fn.for.if.impl.in.let.loop.macro.match.mod.move.mut.override.priv.pub.ref.return.self.Self.static.struct.super.trait.true.try.type.typeof.union.unsafe.unsized.use.virtual.where.while.yield`.split(`.`),s=[`true`,`false`,`Some`,`None`,`Ok`,`Err`],c=`drop .Copy.Send.Sized.Sync.Drop.Fn.FnMut.FnOnce.ToOwned.Clone.Debug.PartialEq.PartialOrd.Eq.Ord.AsRef.AsMut.Into.From.Default.Iterator.Extend.IntoIterator.DoubleEndedIterator.ExactSizeIterator.SliceConcatExt.ToString.assert!.assert_eq!.bitflags!.bytes!.cfg!.col!.concat!.concat_idents!.debug_assert!.debug_assert_eq!.env!.eprintln!.panic!.file!.format!.format_args!.include_bytes!.include_str!.line!.local_data_key!.module_path!.option_env!.print!.println!.select!.stringify!.try!.unimplemented!.unreachable!.vec!.write!.writeln!.macro_rules!.assert_ne!.debug_assert_ne!`.split(`.`),l=[`i8`,`i16`,`i32`,`i64`,`i128`,`isize`,`u8`,`u16`,`u32`,`u64`,`u128`,`usize`,`f32`,`f64`,`str`,`char`,`bool`,`Box`,`Option`,`Result`,`String`,`Vec`];return{name:`Rust`,aliases:[`rs`],keywords:{$pattern:e.IDENT_RE+`!?`,type:l,keyword:o,literal:s,built_in:c},illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:`symbol`,begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:`string`,variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:`char.escape`,match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:`number`,variants:[{begin:`\\b0b([01_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b0o([0-7_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b0x([A-Fa-f0-9_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)([ui](8|16|32|64|128|size)|f(32|64))?`}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:`keyword`,3:`title.function`}},{className:`meta`,begin:`#!?\\[`,end:`\\]`,contains:[{className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:`keyword`,3:`keyword`,4:`variable`}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:`keyword`,3:`variable`,5:`keyword`}},{begin:[/type/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:e.IDENT_RE+`::`,keywords:{keyword:`Self`,built_in:c,type:l}},{className:`punctuation`,begin:`->`},a]}}function ld(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}var ud=`[A-Za-z$_][0-9A-Za-z$_]*`,dd=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),fd=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],pd=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),md=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],hd=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],gd=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],_d=[].concat(hd,pd,md);function vd(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=ud,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:ud,keyword:dd,literal:fd,built_in:_d,"variable.language":gd},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...pd,...md]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...hd,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function yd(e){let t=e.regex,n=vd(e),r=ud,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:ud,keyword:dd.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:fd,built_in:_d.concat(i),"variable.language":gd},l={className:`meta`,begin:`@[A-Za-z$_][0-9A-Za-z$_]*`},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function bd(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function xd(e){let t=`true false yes no null`,n={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},a={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),s={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},c={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},l={begin:/\{/,end:/\}/,contains:[c],illegal:`\\n`,relevance:0},u={begin:`\\[`,end:`\\]`,contains:[c],illegal:`\\n`,relevance:0},d=[n,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!<[\\w#;/?:@&=+$,.~*'()[\\]]+>`},{className:`type`,begin:`![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},s,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},l,u,i,a],f=[...d];return f.pop(),f.push(o),c.contains=f,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:d}}var Sd=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`],Cd=Object.freeze({bold:!1,dim:!1,italic:!1,underline:!1,inverse:!1,hidden:!1,strike:!1}),wd=`ansi-esc`,Td=/^(?:color:#[0-9a-f]{6}(?:;background-color:#[0-9a-f]{6})?|background-color:#[0-9a-f]{6})$/,Ed=String.raw`(?:\x1b|�|\\x1[bB]|\\u001[bB]|\\033|\\e|\^\[)`,Dd=new RegExp(Ed,`g`),Od=/\[([0-?]{0,64})[ -/]{0,8}([@-~])/y,kd=new RegExp(String.raw`\][^\n]{0,2048}?(?:${Ed}\\\\?|\x07|�|\\a|\\x07|\\007|\\u0007)`,`y`),Ad=/[()][0-9A-Za-z]/y;function jd(e){let t=``,n={...Cd},r=``,i=0,a=n=>{if(n<=i)return;let a=Rd(e.slice(i,n));t+=r?`${r}${a}</span>`:a};Dd.lastIndex=0;for(let o=Dd.exec(e);o;o=Dd.exec(e)){let s=o.index,c=s+o[0].length,l=-1,u;for(let t of[Od,kd,Ad]){t.lastIndex=c;let n=t.exec(e);if(n){l=c+n[0].length,t===Od&&n[2]===`m`&&(u=n[1]);break}}l<0&&o[0]===`\x1B`&&(l=c),!(l<0)&&(a(s),t+=`<span class="${wd}">${Rd(e.slice(s,l))}</span>`,u!==void 0&&(n=Md(n,u),r=Ld(n)),i=l,Dd.lastIndex=l)}return a(e.length),t}function Md(e,t){if(!/^[0-9:;]*$/.test(t))return e;let n={...e},r=t===``?[`0`]:t.split(`;`);for(let e=0;e<r.length;e++){let[t,...i]=r[e].split(`:`),a=t===``?0:Number(t);if(a===38||a===48||a===58){let t;if(i.length>0)t=Nd(i[0],i[0]===`2`&&i.length>4?i.slice(2,5):i.slice(1));else{let n=r[e+1],i=n===`5`?1:n===`2`?3:0;t=Nd(n,r.slice(e+2,e+2+i)),e+=1+i}t&&a===38&&(n.fg=t),t&&a===48&&(n.bg=t);continue}a===0?Object.assign(n,Cd,{fg:void 0,bg:void 0}):a===1?n.bold=!0:a===2?n.dim=!0:a===3?n.italic=!0:a===4?n.underline=i[0]!==`0`:a===7?n.inverse=!0:a===8?n.hidden=!0:a===9?n.strike=!0:a===21?n.underline=!0:a===22?n.bold=n.dim=!1:a===23?n.italic=!1:a===24?n.underline=!1:a===27?n.inverse=!1:a===28?n.hidden=!1:a===29?n.strike=!1:a>=30&&a<=37?n.fg={index:a-30}:a===39?n.fg=void 0:a>=40&&a<=47?n.bg={index:a-40}:a===49?n.bg=void 0:a>=90&&a<=97?n.fg={index:a-90+8}:a>=100&&a<=107&&(n.bg={index:a-100+8})}return n}function Nd(e,t){let n=t.map(e=>e===``?NaN:Number(e));if(n.every(e=>Number.isInteger(e)&&e>=0&&e<=255)){if(e===`5`&&n.length===1)return Pd(n[0]);if(e===`2`&&n.length===3)return{hex:Fd(n[0],n[1],n[2])}}}function Pd(e){if(e<16)return{index:e};if(e>=232){let t=8+(e-232)*10;return{hex:Fd(t,t,t)}}let t=e=>e===0?0:55+e*40,n=e-16;return{hex:Fd(t(Math.floor(n/36)),t(Math.floor(n/6)%6),t(n%6))}}function Fd(...e){return`#${e.map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function Id(e){return e<8?Sd[e]:`bright-${Sd[e-8]}`}function Ld(e){let t=e.inverse?e.bg:e.fg,n=e.inverse?e.fg:e.bg,r=[],i=[];return t&&`index`in t?r.push(`ansi-fg-${Id(t.index)}`):t?i.push(`color:${t.hex}`):e.inverse&&r.push(`ansi-fg-inverse`),n&&`index`in n?r.push(`ansi-bg-${Id(n.index)}`):n?i.push(`background-color:${n.hex}`):e.inverse&&r.push(`ansi-bg-inverse`),e.bold&&r.push(`ansi-bold`),e.dim&&r.push(`ansi-dim`),e.italic&&r.push(`ansi-italic`),e.underline&&r.push(`ansi-underline`),e.strike&&r.push(`ansi-strike`),e.hidden&&r.push(`ansi-hidden`),r.length===0&&i.length===0?``:`<span${r.length?` class="${r.join(` `)}"`:``}${i.length?` style="${i.join(`;`)}"`:``}>`}function Rd(e){return e.replace(/[&<>"']/g,e=>e===`&`?`&`:e===`<`?`<`:e===`>`?`>`:e===`"`?`"`:`'`)}var zd={bash:zu,css:Ju,diff:Yu,javascript:id,json:ad,markdown:od,python:sd,rust:cd,sql:ld,typescript:yd,xml:bd,yaml:xd};for(let[e,t]of Object.entries(zd))Ru.registerLanguage(e,t);function Bd(e,t){if(t===`plaintext`)return Us(e);if(t===`ansi`)return jd(e);try{return Ru.highlight(e,{language:t,ignoreIllegals:!0}).value}catch{return Us(e)}}function Vd(e,t,n=t){return`<code class="hljs language-${n}">${Bd(`${e.replace(/\n$/,``)}\n`,t)}</code>`}var Hd=`<button type="button" class="${Tn}" title="${k}"></button>`;function Ud(e,t){let n=Pn(t);return`<span class="${Qs}"><pre>${Vd(e,n,/^\s*(lightbox|mermaid)\s*$/i.exec(t??``)?.[1].toLowerCase()??n)}</pre>${Hd}</span>\n`}var Wd=/<span\b[^>]*>|<\/span>|\n|[^<\n]+|</g;function Gd(e){let t=[],n=[],r=``;for(let[i]of e.matchAll(Wd))i===`
|
|
60
|
+
`?(t.push(r+`</span>`.repeat(n.length)),r=n.join(``)):i===`</span>`?(n.pop(),r+=i):(i.startsWith(`<span`)&&n.push(i),r+=i);return t.push(r+`</span>`.repeat(n.length)),t}var Kd=/^(\s*\d+\t)([\s\S]*)$/,qd=/^\s*\d+$/;function Jd(e){let t=0,n=0,r=0;for(let i of e)i.trim()&&(t++,Kd.test(i)?(n++,r++):qd.test(i)&&n++);return t>0&&n===t&&r>0}function Yd(e){return e.replace(/[&<>"']/g,e=>e===`&`?`&`:e===`<`?`<`:e===`>`?`>`:e===`"`?`"`:`'`)}var Xd=`frizz-code-gutter`;function Zd(e,t){let n=e.split(`
|
|
61
|
+
`);if(!Jd(n))return Bd(e,t);let r=[],i=[];for(let e of n){let t=Kd.exec(e);t?(r.push(t[1]),i.push(t[2])):e.trim()&&qd.test(e)?(r.push(e),i.push(``)):(r.push(``),i.push(e))}let a=Gd(Bd(i.join(`
|
|
62
|
+
`),t));return r.map((e,t)=>(e?`<span class="${Xd}">${Yd(e)}</span>`:``)+(a[t]??``)).join(`
|
|
63
|
+
`)}var Qd=`md-diff-row`,$d=/(?:^|\s)lang(?:uage)?\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"']+))/i;function ef(e){let t=(e??``).trim(),n=t.split(/\s+/,1)[0].toLowerCase(),r=$d.exec(t.slice(n.length)),i=r&&(r[1]??r[2]??r[3]).trim().toLowerCase()||null;if(n===`diff`||n===`patch`)return{declared:i};let a=/^(.+)-diff$/.exec(n)??/^diff-(.+)$/.exec(n);return a?{declared:a[1]}:null}var tf=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,nf=/^(?:index [0-9a-f]+\.\.[0-9a-f]+|(?:new|deleted) file mode |(?:old|new) mode |(?:dis)?similarity index |(?:rename|copy) (?:from|to) |Binary files )/;function rf(e){let t=[],n=!1,r=0,i=0,a=null,o=null;for(let s=0;s<e.length;s++){let c=e[s];if(/^diff (?:--git|--cc|--combined|-\S+) /.test(c)||/^Index: /.test(c)){t.push({kind:`file`,raw:c}),n=!0,r=i=0,a=o=null;continue}if(c.startsWith(`@@`)){let e=tf.exec(c);t.push({kind:`hunk`,raw:c}),n=!1,a=e?Number(e[1]):null,o=e?Number(e[3]):null,r=e?Number(e[2]??1):0,i=e?Number(e[4]??1):0;continue}if(n&&nf.test(c)){t.push({kind:/^index /.test(c)?`file`:`meta`,raw:c});continue}if(r===0&&i===0&&c.startsWith(`--- `)&&e[s+1]?.startsWith(`+++ `)){t.push({kind:`file`,raw:c},{kind:`file`,raw:e[s+1]}),s++,n=!0,a=o=null;continue}n=!1,c.startsWith(`\\ `)?t.push({kind:`meta`,raw:c}):c.startsWith(`+`)?(t.push({kind:`add`,raw:c,line:o??void 0}),o!==null&&o++,i>0&&i--):c.startsWith(`-`)?(t.push({kind:`del`,raw:c,line:a??void 0}),a!==null&&a++,r>0&&r--):(t.push({kind:`ctx`,raw:c,line:o??void 0}),a!==null&&a++,o!==null&&o++,r>0&&r--,i>0&&i--)}return t}function af(e){let t=e.slice(4).split(` `,1)[0].trim().replace(/^[ab]\//,``);return t&&t!==`/dev/null`?t:null}function of(e){let t=[];for(let n=0;n<e.length;n++){if(e[n].kind!==`file`||!e[n].raw.startsWith(`--- `))continue;let r=e[n+1],i=(r?.raw.startsWith(`+++ `)?af(r.raw):null)??af(e[n].raw);i&&t.push(i)}return t}var sf=e=>e.map(Us);function cf(e,t){return e.length===0?[]:t===`plaintext`||t===`ansi`?sf(e):Gd(Bd(e.join(`
|
|
64
|
+
`),t))}function lf(e,t={}){let n=e.replace(/\n$/,``).split(`
|
|
65
|
+
`),r=rf(n),i=of(r),a=oe(t.label),o=t.declared?Pn(t.declared):a===`plaintext`?oe(i[0]):a,s=r.some(e=>e.kind===`hunk`)||!r.some(e=>e.kind===`ctx`&&e.raw!==``&&!e.raw.startsWith(` `)),c=e=>e.kind===`ctx`&&!(s&&e.raw.startsWith(` `))?[``,e.raw]:[e.raw[0],e.raw.slice(1)],l=r.some(e=>e.line!==void 0),u=[],d=0,f=0,p=0;for(let e=0;e<r.length;){let t=r[e];if(t.kind===`hunk`||t.kind===`file`||t.kind===`meta`){u.push(`<span class="${Qd} md-diff-${t.kind}">${Us(t.raw)}\n</span>`),e++;continue}let n=e;for(;n<r.length&&(r[n].kind===`add`||r[n].kind===`del`||r[n].kind===`ctx`);)n++;let i=r.slice(e,n).map(e=>({row:e,parts:c(e)})),a=cf(i.filter(({row:e})=>e.kind!==`add`).map(({parts:e})=>e[1]),o),s=cf(i.filter(({row:e})=>e.kind!==`del`).map(({parts:e})=>e[1]),o),m=0,h=0;for(let{row:e,parts:[t]}of i){let n=e.kind===`del`?a[m]:s[h];e.kind!==`add`&&m++,e.kind!==`del`&&h++,e.kind===`add`&&d++,e.kind===`del`&&f++,e.line!==void 0&&(p=Math.max(p,e.line));let r=l?`<span class="md-diff-num"${e.line===void 0?``:` data-line="${e.line}"`}></span>`:``;u.push(`<span class="${Qd} md-diff-${e.kind}">${r}<span class="md-diff-sign">${Us(t)}</span><span class="md-diff-text">${n??``}\n</span></span>`)}e=n}return{html:u.join(``),additions:d,deletions:f,file:i.length===1?i[0]:null,digits:l?String(p).length:0,lines:n.length}}var uf=`md-line`,df=`is-marked`,ff=/\{\s*(\d[\d\s,–-]*)\}/;function pf(e){let t=ff.exec(e??``);if(!t)return null;let n=[];for(let e of t[1].split(/[\s,]+/)){let t=/^(\d{1,7})(?:[–-](\d{1,7}))?$/.exec(e);if(!t)continue;let r=Number(t[1]),i=t[2]===void 0?r:Number(t[2]);r>=1&&i>=r&&n.push([r,i])}return n.length>0?n:null}function mf(e,t){return e.some(([e,n])=>t>=e&&t<=n)}function hf(e,t){let n=Gd(e);return n.at(-1)?.replace(/<[^>]*>/g,``)===``&&n.pop(),n.map((e,n)=>`<span class="${uf}${mf(t,n+1)?` ${df}`:``}">${e}\n</span>`).join(``)}var gf=`md-code-frame`,_f=`md-code-lined`,vf=`md-diff`,yf=/^(?:lightbox|mermaid)$/i,bf=!0;function xf(e){let t=bf;bf=!1;try{return e()}finally{bf=t}}function Sf(e){if(e.label===void 0)return Pn(e.info);let t=si(e.info)?.language;return t?Pn(t):oe(e.label)}function Cf(e){let t=`${e.text.replace(/\n$/,``)}\n`,n=t.split(`
|
|
66
|
+
`).length-1,r=ef(e.info),i=r?null:pf(e.info),a=[],o,s;if(r){let t=lf(e.text,{declared:r.declared,label:e.label});o=`<code class="hljs language-diff">${t.html}</code>`,a.push(vf),t.digits>0&&a.push(`md-diff-n${Math.min(t.digits,6)}`),s={file:t.file,additions:t.additions,deletions:t.deletions}}else if(i){let n=Sf(e);o=`<code class="hljs language-${n}">${hf(Bd(t,n),i)}</code>`,a.push(_f)}else o=Vd(e.text,Sf(e));let c=!1;if(i)for(let e=25;e<=n&&!c;e++)c=mf(i,e);let l=bf&&e.closed&&n>40&&!c,u=l&&Qr(e.text);return l&&a.push(u?ya:`${ya} ${po}`),{code:o,classes:a,lines:n,long:l,open:u,diff:s}}var wf=28,Tf=e=>e.length>=wf?` title="${Us(e)}"`:``;function Ef({additions:e,deletions:t}){return e===0&&t===0?``:`<span class="md-diff-stat">`+(e>0?`<span class="md-diff-adds">+${e}</span>`:``)+(t>0?`<span class="md-diff-dels">−${t}</span>`:``)+`</span>`}var Df=e=>`<button type="button" class="${Yo}" aria-expanded="${e.open}">${So(e.lines,e.open)}</button>`;function Of(e){let t=e.length===1;if(t&&yf.test(e[0].info.trim().split(/\s+/,1)[0]))return Ud(e[0].text,e[0].closed?e[0].info:``);let n=e.map(Cf),r=t?e[0].label??n[0].diff?.file??void 0:void 0,i=!t||r!==void 0;if(!(i||n.some(e=>e.long))){let[{code:t,classes:r}]=n;return r.length===0?Ud(e[0].text,e[0].info):`<span class="${Qs}"><pre class="${r.join(` `)}">${t}</pre>${Hd}</span>\n`}let a=t?0:sc(e.map(e=>e.label??``)),o=``;t&&r!==void 0?(e[0].label===void 0&&n[0].classes.push(`md-diff-titled`),o=`<span class="${Wi}"><span class="${ea}"${Tf(r)}>${Us(r)}</span>${n[0].diff?Ef(n[0].diff):``}</span>`):t||(o=`<span class="${Wi}" role="tablist">`+e.map((e,t)=>{let n=t===a,r=e.label??``;return`<button type="button" class="${ua}${n?` ${no}`:``}" role="tab" aria-selected="${n}"${Tf(r)}>${Us(r)}</button>`}).join(``)+`</span>`);let s=n.map((e,n)=>{let r=[...i?[n===a?`${Ei} ${no}`:Ei]:[],...e.classes];return`<pre${r.length>0?` class="${r.join(` `)}"`:``}${t?``:` role="tabpanel"`}>${e.code}</pre>`+(e.long?Df(e):``)}).join(``);return`<span class="${Qs} ${gf}${i?` ${jo}`:``}">${o}${s}${Hd}</span>\n`}var kf={name:`codeTabs`,level:`block`,tokenizer(){},renderer(e){return Of(e.tabs)}},Af=/^[a-zA-Z]:\\(?!\\)/,jf=/(?<![A-Za-z0-9])[A-Za-z]:\\/,Mf=ju.rules.inline.normal.link;function Nf(e,t){let n=t.length;for(;n>0&&!/\s/.test(t[n-1]);)n--;n>0&&(e.inPath=!1,e.tail=``);let r=e.tail+t.slice(n);e.inPath||=jf.test(r),e.tail=r.slice(-3)}function Pf(e){if(!/^[a-zA-Z]:/.test(e.href))return;let t=Mf.exec(e.raw);if(!t)return;let n=t[2].trim();n.startsWith(`<`)&&n.endsWith(`>`)&&(n=n.slice(1,-1)),Af.test(n)&&(e.href=n)}function Ff(e){let t={inPath:!1,tail:``};for(let n=0;n<e.length;n++){let r=e[n];(r.type===`link`||r.type===`image`)&&Pf(r);let i=Ia(r);for(let e of i)Ff(e);if(r.type===`text`&&i.length===0){Nf(t,r.raw);continue}if(r.type===`escape`){Nf(t,r.raw),r.raw!==`\\\\`&&t.inPath&&(e[n]={type:`text`,raw:r.raw,text:r.raw});continue}t.inPath=!1,t.tail=``}}var If=`md-callout`,Lf=`md-callout-title`,Rf={note:`Note`,tip:`Tip`,important:`Important`,warning:`Warning`,caution:`Caution`},zf={info:`note`,hint:`tip`,attention:`warning`,danger:`caution`,error:`caution`};function Bf(e){let t=e.toLowerCase();return Object.hasOwn(Rf,t)?t:Object.hasOwn(zf,t)?zf[t]:null}var Vf=/^\[!([A-Za-z]+)\](?=[ \t]|\n|$)/;function Hf(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.type===`list`){for(let e of n.items)Hf(e.tokens);continue}if(n.type!==`blockquote`)continue;let r=n,i=Uf(r);i&&(e[t]=i),Hf(i?i.tokens:r.tokens)}}function Uf(e){let t=e.tokens.findIndex(e=>e.type!==`space`),n=e.tokens[t];if(n?.type!==`paragraph`)return null;let r=n,i=r.tokens,a=i[0];if(a?.type!==`text`)return null;let o=Vf.exec(a.text);if(!o||!a.raw.startsWith(o[0]))return null;let s=Bf(o[1]);if(!s)return null;let c=[],l=i.slice();for(l[0]=Wf(a,o[0].length);l.length>0;){let e=l[0];if(e.type===`br`){l.shift();break}if(e.type===`text`){let t=e.text.indexOf(`
|
|
67
|
+
`);if(t<0){c.push(l.shift());continue}c.push(Wf(e,0,t)),l[0]=Wf(e,t+1);break}if(e.raw.includes(`
|
|
68
|
+
`))break;c.push(l.shift())}Gf(c),Gf(l);let u=e.tokens.slice(t+1);if(l.length>0){let e=l.map(e=>e.raw).join(``);u.unshift({...r,raw:e,text:e,tokens:l})}return{type:`callout`,raw:e.raw,kind:s,titleTokens:Kf(c),tokens:u}}function Wf(e,t,n){return{...e,raw:e.raw.slice(t,n),text:e.text.slice(t,n)}}function Gf(e){for(let[t,n]of[[0,`trimStart`],[-1,`trimEnd`]])for(let r=e.at(t);r?.type===`text`;r=e.at(t)){let i=r,a={...i,raw:i.raw[n](),text:i.text[n]()};if(e.splice(t,1,...a.raw?[a]:[]),a.raw)break}}function Kf(e){return e.map(e=>{if(e.type===`html`)return{type:`text`,raw:e.raw,text:e.raw,escaped:!1};let t=e.tokens;return Array.isArray(t)?{...e,tokens:Kf(t)}:e})}var qf={name:`callout`,level:`block`,childTokens:[`titleTokens`,`tokens`],tokenizer(){},renderer(e){let{kind:t,titleTokens:n,tokens:r}=e;return`<blockquote class="${If} ${If}-${t}"><p class="${Lf}">${n.length>0?this.parser.parseInline(n):Rf[t]}</p>\n${this.parser.parse(r)}</blockquote>\n`}},X=ma();function Jf({caption:e,children:t}){return(0,X.jsxs)(`figure`,{className:Yf,children:[(0,X.jsx)(`div`,{className:Xf,children:t}),e]})}var Yf=`frizz-image-frame max-w-full`,Xf=`flex justify-center bg-panel-2 p-1.5`,Zf=`block max-h-[420px] max-w-full w-auto rounded-md object-contain`,Qf=/^(~~)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,$f={del(e){let t=Qf.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}},ep=/^:?-+:?$/,tp=/^ {0,3}$/,np=/^[ \t]*$/;function rp(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];i===`\\`&&r+1<e.length?(n+=i+e[r+1],r++):i===`|`?(t.push(n),n=``):n+=i}return t.push(n),t.length<4||!tp.test(t[0])||!np.test(t.at(-1))?null:t.slice(1,-1).map(e=>e.trim())}function ip(e){let t=[],n=0;for(let r of e.split(`
|
|
69
|
+
`)){let e=rp(r);if(!e)break;if(e.every(e=>ep.test(e)))return null;t.push(e),n+=r.length+1}return t.length<2?null:{raw:e.slice(0,Math.min(n,e.length)),rows:t}}var ap={name:`headerlessTable`,level:`block`,start(e){let t=0;for(let n of e.split(`
|
|
70
|
+
`)){if(n.includes(`|`)&&ip(e.slice(t)))return t;t+=n.length+1}},tokenizer(e){let t=ip(e);if(!t)return;let n=Math.max(...t.rows.map(e=>e.length)),r=t.rows.map(e=>Array.from({length:n},(t,n)=>({tokens:this.lexer.inline(e[n]??``)})));return{type:`headerlessTable`,raw:t.raw,rows:r}},renderer(e){return`<table>\n<tbody>${e.rows.map(e=>`<tr>${e.map(e=>`<td>${this.parser.parseInline(e.tokens)}</td>`).join(``)}</tr>`).join(`
|
|
71
|
+
`)}</tbody></table>\n`}},op=/^\[([ xX/\-?])\](?:[ \t]+|[ \t]*$)/,sp={" ":{className:``,label:`To do`},x:{className:`md-task-checked`,label:`Done`},"/":{className:`md-task-in-progress`,label:`In progress`},"-":{className:`md-task-cancelled`,label:`Cancelled`},"?":{className:`md-task-blocked`,label:`Blocked`}},cp={name:`frizzTaskStatus`,level:`inline`,tokenizer(){},renderer(e){let{status:t}=e,n=sp[t];return`<span class="md-task${n.className?` ${n.className}`:``}" title="${n.label}"></span>`}},lp={name:`frizzTaskText`,level:`inline`,tokenizer(){},renderer(e){return`<span class="md-task-text">${this.parser.parseInline(e.tokens)}</span>`}};function up(e){let t=e.tokens[0],n=t&&`tokens`in t?t.tokens:void 0;if(!Array.isArray(n)||n[0]?.type===`frizzTaskStatus`)return;let r,i;if(e.task)r=e.checked?`x`:` `,i=``,e.task=!1,e.checked=void 0;else{let t=op.exec(e.text);if(!t)return;let a=t[0].length,o=[];for(let e=0;e<n.length&&a>0;e++){let t=n[e];if(t.type!==`text`)return;let r=Math.min(a,t.raw.length);o.push({token:t,count:r}),a-=r}if(a>0)return;for(let{token:e,count:t}of o)e.raw=e.raw.slice(t),e.text=e.text.slice(t);for(let e=n.length-1;e>=0;e--)n[e].type===`text`&&!n[e].raw&&n.splice(e,1);e.text=e.text.slice(t[0].length),r=t[1]===`X`?`x`:t[1],i=t[0]}let a=n.splice(0,n.length);n.push({type:`frizzTaskStatus`,raw:i,status:r}),a.length&&n.push({type:`frizzTaskText`,raw:``,tokens:a})}var dp={breaks:!0,extensions:[ap,cp,lp,kf,qf],tokenizer:$f,hooks:{processAllTokens(e){return Ff(e),an(e),Hr(e),Hf(e),e}},walkTokens(e){e.type===`list_item`&&up(e)},renderer:{code:e=>Of([{info:e.lang??``,text:e.text,closed:Ns(e)}]),blockquote:Ka}},fp=new Iu(dp),pp=new Iu({...dp,breaks:!1});function mp(e,t){if(!e.trim())return``;let{result:n,quotes:r}=Cs(()=>St(t?.githubRepo,()=>t?.document?xf(()=>pp.parse(e,{async:!1})):fp.parse(e,{async:!1})));return Dp(n,{block:!0,baseDir:t?.baseDir,homeDir:t?.homeDir,project:t?.project,quotes:r})}function hp(e,t){if(!e.trim())return``;let{baseDir:n,homeDir:r,project:i,githubRepo:a}=t??{};return Dp(St(a,()=>fp.parseInline(e,{async:!1})),{baseDir:n,homeDir:r,project:i})}function gp(e){let t=e.match(/^?---\r?\n[\s\S]*?\r?\n---\r?\n?/);return t?e.slice(t[0].length):e}var _p=new Set(`h1.h2.h3.h4.h5.h6.p.br.hr.strong.em.del.code.pre.blockquote.ul.ol.li.a.img.button.table.thead.tbody.tr.th.td.span.details.summary.kbd.sub.sup.mark`.split(`.`)),vp=new Set([`href`,`src`,`alt`,`title`,`type`]),yp=RegExp(`^(?:hljs(?:-[a-z0-9_-]+)?|ansi-[a-z-]+|language-[a-z0-9-]+|md-task(?:-(?:checked|in-progress|cancelled|blocked|text))?|md-diff-(?:row|add|del|ctx|hunk|file|meta|num|sign|text|stat|adds|dels)|${[Qs,gf,jo,Wi,ea,uf,df].join(`|`)})$`),bp=(...e)=>RegExp(`^(?:${e.join(`|`)})$`),xp={code:yp,span:yp,pre:bp(Ei,no,_f,vf,`md-diff-titled`,`md-diff-n[1-6]`,ya,po),button:bp(Tn,Yo,ua,no),blockquote:bp(If,`${If}-[a-z]+`),p:bp(Lf)};function Sp(e,t,n){let r=xp[e];return t.split(/\s+/).filter(t=>r?.test(t)||e===`blockquote`&&gi(t,n)!==void 0).join(` `)}var Cp=new Set([`http:`,`https:`,`mailto:`]);function wp(e){try{return Cp.has(new URL(e,`http://frizz.invalid/`).protocol)}catch{return!1}}var Tp={details:{open:/^[^]*$/},ol:{start:/^\d{1,9}$/},span:{style:Td,role:/^tablist$/,"data-line":/^\d{1,9}$/},button:{role:/^tab$/,"aria-selected":/^(?:true|false)$/,"aria-expanded":/^(?:true|false)$/},pre:{role:/^tabpanel$/},th:{align:/^(?:left|center|right)$/},td:{align:/^(?:left|center|right)$/}},Ep=new Set([`script`,`style`,`textarea`,`title`,`xmp`,`iframe`,`frame`,`frameset`,`object`,`embed`,`applet`,`noscript`,`template`,`svg`,`math`]);function Dp(e,{block:t=!1,baseDir:n,homeDir:r,project:i,quotes:a}={}){let o=document.createElement(`template`);return o.innerHTML=e,Op(o.content,{block:t,baseDir:n,homeDir:r,project:i,quotes:a}),o.innerHTML}function Op(e,t){let{block:n}=t;for(let r of Array.from(e.children)){let e=r.tagName.toLowerCase();if(!_p.has(e)){Ep.has(e)?r.remove():jp(r,t);continue}(e===`a`||e===`img`)&&kp(r,e===`a`?`href`:`src`,t);let i;if(e===`a`){let e=pt(r.getAttribute(`href`),void 0,t.project);e&&r.setAttribute(`href`,e);let n=cr(r.getAttribute(`href`));if(n){let e=Wn(n);if(e)r.setAttribute(`href`,e),r.setAttribute(`title`,n.display),i=n.filePath;else{let e=n.filePath&&_c(n.filePath),i=document.createElement(`button`);for(i.type=`button`,i.className=`local-file-action`,i.title=e?`Read ${n.display}`:n.display,n.filePath&&(i.setAttribute(`data-local-path`,n.filePath),i.setAttribute(`draggable`,`true`));r.firstChild;)i.append(r.firstChild);r.replaceWith(i),Op(i,t);continue}}}if(e===`img`){let e=cr(r.getAttribute(`src`)),t=e&&Wn(e);if(!t){r.remove();continue}r.setAttribute(`src`,t),r.setAttribute(`title`,e.display),i=e.filePath,r.getAttribute(`alt`)||r.setAttribute(`alt`,e.display)}for(let n of Array.from(r.attributes)){let i=n.name.toLowerCase();if(i===`class`){let i=Sp(e,n.value,t.quotes);i?r.setAttribute(`class`,i):r.removeAttribute(n.name);continue}let a=Tp[e]?.[i];if(a){a.test(n.value)||r.removeAttribute(n.name);continue}if(!vp.has(i)){r.removeAttribute(n.name);continue}i===`href`&&!wp(n.value)&&r.removeAttribute(n.name)}if(i!==void 0&&(r.setAttribute(`data-local-path`,i),r.setAttribute(`data-local-image`,`true`)),e===`img`&&n&&Ap(r),e===`a`){r.setAttribute(`target`,`_blank`),r.setAttribute(`rel`,`noopener noreferrer`),r.removeAttribute(`data-gh-ref`);let e=jt(r.getAttribute(`href`));e&&r.setAttribute(`data-gh-ref`,e)}if(Op(r,t),e===`details`&&ms(r),e===`blockquote`){let e=gi(r.getAttribute(`class`)??``,t.quotes);e!==void 0&&as(r,e)}}}function kp(e,t,{baseDir:n,homeDir:r}){if(!n&&!r)return;let i=Te(e.getAttribute(t),n??``,r);i&&e.setAttribute(t,i)}function Ap(e){let t=e.ownerDocument,n=t.createElement(`span`);n.className=`${Yf} md-image-frame`;let r=t.createElement(`span`);r.className=Xf,e.replaceWith(n),n.append(r),r.append(e),e.setAttribute(`class`,Zf)}function jp(e,t){let n=e.ownerDocument.createDocumentFragment();for(;e.firstChild;)n.append(e.firstChild);Op(n,t),e.replaceWith(n)}function Mp(){let e=a(),t=(0,q.useCallback)(()=>Bt(e),[e]);return(0,q.useSyncExternalStore)(Ye,t,t)}function Np(){let e=a(),t=(0,q.useCallback)(()=>Vn(e),[e]);return(0,q.useSyncExternalStore)(pe,t,t)}function Pp(e,t){let n=Mp(),r=Np(),i=a(),{baseDir:o,asDocument:s}=t??{},c=o??r.dir,l=(0,q.useMemo)(()=>mp(e,{baseDir:c,homeDir:r.home,document:s,project:i,githubRepo:n}),[e,c,r.home,s,i,n]);return Fp(l),l}function Fp(e){let t=(0,q.useMemo)(()=>B(e),[e]);(0,q.useEffect)(()=>{t.length>0&&Yt(t)},[t])}function Ip(e){let t=Mp(),n=Np(),r=a(),i=(0,q.useMemo)(()=>hp(e,{baseDir:n.dir,homeDir:n.home,project:r,githubRepo:t}),[e,n.dir,n.home,r,t]);return Fp(i),i}var Lp=e=>new Set(e.split(/\s+/).filter(Boolean)),Rp=Lp(`
|
|
72
|
+
break case catch class const continue debugger default delete do else enum export extends
|
|
73
|
+
false finally for function if import in instanceof new null return super switch this throw
|
|
74
|
+
true try typeof var void while with yield async await let static get set of as from
|
|
75
|
+
interface type namespace declare readonly public private protected implements abstract
|
|
76
|
+
package struct func go defer chan map fn impl trait mut pub use mod match loop where
|
|
77
|
+
int long short float double char boolean byte final synchronized volatile transient native
|
|
78
|
+
`),zp=Lp(`
|
|
79
|
+
string number boolean object symbol bigint unknown any never void undefined
|
|
80
|
+
String Number Boolean Object Array Promise Map Set Record Partial
|
|
81
|
+
i8 i16 i32 i64 u8 u16 u32 u64 usize isize f32 f64 str Vec Option Result Box
|
|
82
|
+
int8 int16 int32 int64 uint float32 float64 error rune
|
|
83
|
+
`),Bp={typescript:{line:`//`,block:[`/*`,`*/`],quotes:[`"`,`'`,"`"],keywords:Rp,types:zp},javascript:{line:`//`,block:[`/*`,`*/`],quotes:[`"`,`'`,"`"],keywords:Rp,types:zp},go:{line:`//`,block:[`/*`,`*/`],quotes:[`"`,`'`,"`"],keywords:Rp,types:zp},rust:{line:`//`,block:[`/*`,`*/`],quotes:[`"`,`'`],keywords:Rp,types:zp},java:{line:`//`,block:[`/*`,`*/`],quotes:[`"`,`'`],keywords:Rp,types:zp},c:{line:`//`,block:[`/*`,`*/`],quotes:[`"`,`'`],keywords:Rp,types:zp},cpp:{line:`//`,block:[`/*`,`*/`],quotes:[`"`,`'`],keywords:Rp,types:zp},css:{line:null,block:[`/*`,`*/`],quotes:[`"`,`'`],keywords:Lp(`important media supports keyframes import from to`),types:new Set},json:{line:null,block:null,quotes:[`"`],keywords:Lp(`true false null`),types:new Set},python:{line:`#`,block:null,quotes:[`"`,`'`],keywords:Lp(`
|
|
84
|
+
def class return if elif else for while break continue pass import from as with try except
|
|
85
|
+
finally raise lambda yield global nonlocal del assert async await and or not in is None True
|
|
86
|
+
False self lambda`),types:Lp(`int float str bool list dict set tuple bytes object`)},shell:{line:`#`,block:null,quotes:[`"`,`'`],keywords:Lp(`if then else elif fi for while do done case esac in function return export local echo cd exit set unset source`),types:new Set},yaml:{line:`#`,block:null,quotes:[`"`,`'`],keywords:Lp(`true false null yes no on off ~`),types:new Set,lineStart:[{re:/^([ \t]*)(- +)?("[^"\n]*"|'[^'\n]*'|[A-Za-z_][\w.\-/]*)([ \t]*)(:)/,kinds:[`plain`,`punct`,`key`,`plain`,`punct`]}]},toml:{line:`#`,block:null,quotes:[`"`,`'`],keywords:Lp(`true false`),types:new Set,keyChars:`=`,lineStart:[{re:/^([ \t]*)(\[\[?[^\]\n]*\]\]?)/,kinds:[`plain`,`fn`]}]},html:{line:null,block:[`<!--`,`-->`],quotes:[`"`,`'`],keywords:new Set,types:new Set,keyChars:`=`,tagNames:!0}},Vp=(e,t)=>{let n=e.indexOf(`
|
|
87
|
+
`,t);return n===-1?e.length:n},Hp=(e,t)=>{let n=t;for(;n<e.length&&(e[n]===` `||e[n]===` `);)n++;return e[n]??``},Up=new Set(Object.keys(Bp)),Wp=e=>/[A-Za-z_$]/.test(e),Gp=e=>/[A-Za-z0-9_$]/.test(e),Kp=e=>e>=`0`&&e<=`9`,qp=new Set(`{}()[];,.`),Jp=new Set(`+-*/%=<>!&|^~?:@`);function Yp(e,t){let n=[],r=e.length,i=(e,t)=>e&&n.push({text:e,kind:t}),a=0;for(;a<r;){let n=e[a];if(t.lineStart&&(a===0||e[a-1]===`
|
|
88
|
+
`)){let n=!1;for(let r of t.lineStart){let t=r.re.exec(e.slice(a,Vp(e,a)));if(t){for(let e=1;e<t.length;e++)i(t[e]??``,r.kinds[e-1]??`plain`);a+=t[0].length,n=!0;break}}if(n)continue}if(t.block&&e.startsWith(t.block[0],a)){let n=e.indexOf(t.block[1],a+t.block[0].length),o=n===-1?r:n+t.block[1].length;i(e.slice(a,o),`com`),a=o;continue}if(t.line&&e.startsWith(t.line,a)){let t=e.indexOf(`
|
|
89
|
+
`,a);t===-1&&(t=r),i(e.slice(a,t),`com`),a=t;continue}if(t.quotes.includes(n)){let t=n==="`",o=a+1;for(;o<r;){if(e[o]===`\\`){o+=2;continue}if(e[o]===n){o++;break}if(e[o]===`
|
|
90
|
+
`&&!t)break;o++}i(e.slice(a,o),`str`),a=o;continue}if(Kp(n)){let t=a+1;for(;t<r&&/[0-9a-fA-FxXbBoO_.]/.test(e[t]);)t++;i(e.slice(a,t),`num`),a=t;continue}if(Wp(n)){let n=a+1;for(;n<r&&Gp(e[n]);)n++;let o=e.slice(a,n);i(o,t.keywords.has(o)?`kw`:t.types.has(o)?`type`:t.tagNames&&(e[a-1]===`<`||e[a-1]===`/`&&e[a-2]===`<`)?`kw`:t.keyChars&&t.keyChars.includes(Hp(e,n))?`key`:e[n]===`(`?`fn`:`plain`),a=n;continue}if(qp.has(n)){i(n,`punct`),a++;continue}if(Jp.has(n)){let t=a+1;for(;t<r&&Jp.has(e[t]);)t++;i(e.slice(a,t),`op`),a=t;continue}let o=a+1;for(;o<r&&!Wp(e[o])&&!Kp(e[o])&&!t.quotes.includes(e[o])&&!qp.has(e[o])&&!Jp.has(e[o])&&!(t.line&&e.startsWith(t.line,o));)o++;i(e.slice(a,o),`plain`),a=o}return n}function Xp(e){let t=[[]];for(let n of e){let e=n.text.split(`
|
|
91
|
+
`);for(let r=0;r<e.length;r++)r>0&&t.push([]),e[r]&&t[t.length-1].push({text:e[r],kind:n.kind})}return t}function Zp(e,t){if(e===``)return[];let n=Bp[t];return n?Xp(Yp(e,n)):e.split(`
|
|
92
|
+
`).map(e=>e?[{text:e,kind:`plain`}]:[])}var Qp={".ts":`typescript`,".tsx":`typescript`,".mts":`typescript`,".cts":`typescript`,".js":`javascript`,".jsx":`javascript`,".mjs":`javascript`,".cjs":`javascript`,".json":`json`,".jsonc":`json`,".css":`css`,".scss":`css`,".less":`css`,".py":`python`,".go":`go`,".rs":`rust`,".java":`java`,".c":`c`,".h":`c`,".cpp":`cpp`,".hpp":`cpp`,".cc":`cpp`,".sh":`shell`,".bash":`shell`,".zsh":`shell`,".yaml":`yaml`,".yml":`yaml`,".toml":`toml`,".html":`html`,".htm":`html`,".xml":`html`,".svg":`html`},$p={Dockerfile:`shell`,Makefile:`shell`,".gitignore":`shell`,".env":`shell`,".bashrc":`shell`,".zshrc":`shell`};function em(e){let t=ac(e),n=t.lastIndexOf(`.`),r=n>0?t.slice(n).toLowerCase():``,i=$p[t]??Qp[r]??`text`;return Up.has(i)?i:`text`}function tm(e,t,n){let r=e.length,i=t.length,a=Array.from({length:r+1},()=>new Uint32Array(i+1));for(let n=r-1;n>=0;n--)for(let r=i-1;r>=0;r--)a[n][r]=e[n]===t[r]?a[n+1][r+1]+1:Math.max(a[n+1][r],a[n][r+1]);let o=[],s=0,c=0;for(;s<r&&c<i;)e[s]===t[c]?(o.push({type:`eq`,a:n+s,b:n+c}),s++,c++):a[s+1][c]>=a[s][c+1]?(o.push({type:`del`,a:n+s,b:null}),s++):(o.push({type:`add`,a:null,b:n+c}),c++);for(;s<r;)o.push({type:`del`,a:n+s++,b:null});for(;c<i;)o.push({type:`add`,a:null,b:n+c++});return o}function nm(e,t){let n=e.length,r=t.length,i=0;for(;i<n&&i<r&&e[i]===t[i];)i++;let a=0;for(;a<n-i&&a<r-i&&e[n-1-a]===t[r-1-a];)a++;let o=[];for(let e=0;e<i;e++)o.push({type:`eq`,a:e,b:e});o.push(...tm(e.slice(i,n-a),t.slice(i,r-a),i));for(let e=0;e<a;e++)o.push({type:`eq`,a:n-a+e,b:r-a+e});return o}var rm=3,im=e=>e===``?[]:e.split(`
|
|
93
|
+
`);function am(e,t,n){return e.type===`del`?{type:`del`,oldLine:e.a+1,newLine:null,tokens:t[e.a]??[]}:e.type===`add`?{type:`add`,oldLine:null,newLine:e.b+1,tokens:n[e.b]??[]}:{type:`context`,oldLine:e.a+1,newLine:e.b+1,tokens:n[e.b]??[]}}function om(e){let t=[];for(let n=0;n<e.length;n++)e[n].type!==`context`&&t.push(n);if(t.length===0)return{hunks:[],collapsedAfter:e.length};let n=[],r=Math.max(0,t[0]-rm),i=-1;for(let a=0;a<t.length;a++){let o=t[a],s=t[a+1];i=Math.min(e.length-1,o+rm),!(s!==void 0&&s-o<=7)&&(n.push({collapsedBefore:r,lines:e.slice(r,i+1)}),s!==void 0&&(r=Math.max(i+1,s-rm)))}let a=n.length?n[n.length-1].collapsedBefore+n[n.length-1].lines.length:0;return{hunks:n,collapsedAfter:Math.max(0,e.length-a)}}function sm(e,t,n){let r=em(n),i=Zp(e,r),a=Zp(t,r),o=im(e),s=im(t),c=e===``?`added`:t===``?`deleted`:`modified`;if(c===`added`){let e=s.map((e,t)=>({type:`add`,oldLine:null,newLine:t+1,tokens:a[t]??[]}));return{file:n,lang:r,status:c,hunks:[{collapsedBefore:0,lines:e}],collapsedAfter:0,additions:e.length,deletions:0}}if(c===`deleted`){let e=o.map((e,t)=>({type:`del`,oldLine:t+1,newLine:null,tokens:i[t]??[]}));return{file:n,lang:r,status:c,hunks:[{collapsedBefore:0,lines:e}],collapsedAfter:0,additions:0,deletions:e.length}}let l=nm(o,s).map(e=>am(e,i,a)),u=l.filter(e=>e.type===`add`).length,d=l.filter(e=>e.type===`del`).length,{hunks:f,collapsedAfter:p}=om(l);return{file:n,lang:r,status:c,hunks:f,collapsedAfter:p,additions:u,deletions:d}}var cm=`flex min-w-0 items-baseline gap-2`,lm=`flex shrink-0 items-baseline gap-2`;function um(e){return e===`failed`||e===`cancelled`?e:void 0}function dm(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1;return{dir:e.slice(0,t),base:e.slice(t)}}var fm=`a, button, input, select, textarea, summary, label, [role="button"], [role="link"]`;function pm(e){let t=e;return typeof t?.closest==`function`&&t.closest(fm)!=null}function mm({children:e,className:t,controls:n,expanded:r,label:i,meta:a,onToggle:o}){function s(e){if(pm(e.target))return;let t=typeof window>`u`?null:window.getSelection();t&&!t.isCollapsed&&t.toString().trim()!==``||o()}return(0,q.createElement)(`div`,{className:`${t} w-full cursor-pointer text-left`,"data-expanded":r,onClick:s},(0,q.createElement)(`span`,{className:cm},e),(0,q.createElement)(`span`,{className:lm},a,(0,q.createElement)(`button`,{type:`button`,"data-tool-disclosure":!0,"aria-controls":n,"aria-expanded":r,"aria-label":i,title:i,onClick:o,className:`-my-1 -ml-1 inline-flex shrink-0 items-center justify-center rounded py-1 pl-1 text-muted outline-none transition-colors hover:text-fg/80 focus-visible:ring-1 focus-visible:ring-focus-ink-60`},(0,q.createElement)(fr,{"aria-hidden":!0,size:12,className:`frizz-tool-chevron${r?` rotate-90`:``}`}))))}function hm(e){let t=U.board?.projectDir;return t&&e.startsWith(t+`/`)?e.slice(t.length+1):e}function gm({path:e}){let{dir:t,base:n}=dm(e);return(0,X.jsxs)(`span`,{className:`frizz-tool-path`,children:[t&&(0,X.jsx)(`span`,{className:`frizz-tool-path-dir`,children:t}),(0,X.jsx)(`span`,{className:`frizz-tool-path-base`,children:n})]})}function _m({open:e=!1,shown:t=!0}){return t?(0,X.jsx)(fr,{"aria-hidden":`true`,size:12,className:`frizz-tool-chevron${e?` rotate-90`:``}`}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`w-3 shrink-0`})}function vm({path:e,className:t=``,children:n}){return(0,X.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),R(e)},...Ko(e),title:e,className:`font-mono-keep block max-w-full cursor-pointer truncate text-left hover:underline hover:text-fg/80 ${t}`,children:n??e})}function ym({edits:e,meta:t}){let n=(0,q.useId)(),r=e[0].file,i=(0,q.useMemo)(()=>e.map(e=>sm(e.old,e.new,e.file)),[e]),a=i.reduce((e,t)=>e+t.additions,0),o=i.reduce((e,t)=>e+t.deletions,0),[s,c]=(0,q.useState)(!1);return(0,X.jsxs)(`div`,{className:`frizz-diff`,"data-tool-node":`edit`,children:[(0,X.jsxs)(mm,{className:`frizz-diff-header`,controls:n,expanded:s,label:`${s?`Collapse`:`Expand`} Edit diff: ${r}`,onToggle:()=>c(!s),meta:t,children:[(0,X.jsx)(`span`,{className:`frizz-bash-label shrink-0`,children:`Edit`}),(0,X.jsx)(`span`,{className:`frizz-diff-file`,children:(0,X.jsx)(vm,{path:r,children:(0,X.jsx)(gm,{path:hm(r)})})}),(a>0||o>0)&&(0,X.jsxs)(`span`,{className:`frizz-diff-stat`,children:[a>0&&(0,X.jsxs)(`span`,{className:`frizz-diff-add`,children:[`+`,a]}),a>0&&o>0&&` `,o>0&&(0,X.jsxs)(`span`,{className:`frizz-diff-del`,children:[`−`,o]})]})]}),(0,X.jsx)(`div`,{id:n,className:`frizz-tool-body frizz-diff-body`,hidden:!s,children:s&&i.map((e,t)=>(0,X.jsx)(`div`,{className:t>0?`frizz-diff-editsep`:void 0,children:(0,X.jsx)(bm,{hunks:e.hunks,collapsedAfter:e.collapsedAfter})},t))})]})}function bm({hunks:e,collapsedAfter:t}){let n=0,r=[];return e.forEach((e,t)=>{let i=e.collapsedBefore-n;i>0&&r.push((0,X.jsx)(xm,{n:i},`s${t}`));for(let n of e.lines){let e=n.type===`del`?n.oldLine:n.newLine,i=n.type===`add`?`+`:n.type===`del`?`-`:` `;r.push((0,X.jsxs)(`div`,{className:`frizz-diff-line`,"data-type":n.type,children:[(0,X.jsx)(`span`,{className:`frizz-diff-gutter`,children:e}),(0,X.jsx)(`span`,{className:`frizz-diff-sign`,children:i}),(0,X.jsx)(`span`,{className:`frizz-diff-code`,children:n.tokens.map((e,t)=>(0,X.jsx)(`span`,{className:`ftk-${e.kind}`,children:e.text},t))})]},`${t}:${n.oldLine}:${n.newLine}`))}n=e.collapsedBefore+e.lines.length}),t>0&&r.push((0,X.jsx)(xm,{n:t},`safter`)),(0,X.jsx)(X.Fragment,{children:r})}function xm({n:e}){return(0,X.jsxs)(`div`,{className:`frizz-diff-sep`,children:[e,` unchanged line`,e===1?``:`s`]})}function Sm(e){return(0,q.useMemo)(()=>({__html:e}),[e])}var Cm=/^[\w.@+-]+\.[a-z][a-z0-9]{0,7}$/i,wm=/^(?:[A-Za-z]:\\|\\\\)?[\w.@+~-]+(?:\\[\w.@+~-]+)*(?::\d+(?::\d+)?)?$/;function Tm(e){let t=e.trim();return!t||t.length>1024||/\s/.test(t)||/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?!1:t===`~`||t.startsWith(`~/`)||t.startsWith(`/`)||t.includes(`/`)||t.includes(`\\`)&&wm.test(t)?!0:Cm.test(t)}var Em=/^(?:~(?:[\\/]|$)|\/|[A-Za-z]:[\\/]|\\\\)/;function Dm(e,t){return e?{key:`project:${e}`,apiFor:()=>v(e)}:mr(t)?{key:`console`,apiFor:e=>Em.test(e)?st(e):null}:{key:`page:${jr(t)??``}`,apiFor:()=>W}}var Om=new Map,km=(e,t)=>`${e.key}\n${t}`;function Am(e,t){return Om.get(km(e,t))}var jm=new Set,Mm=0,Nm=new Set,Pm=e=>(Nm.add(e),()=>{Nm.delete(e)}),Fm=()=>Mm,Im=128;async function Lm(e,t){let n=[...new Set(t)].filter(t=>!Om.has(km(e,t))&&!jm.has(km(e,t)));if(!n.length)return;for(let t of n)jm.add(km(e,t));let r=new Map;for(let t of n){let n=e.apiFor(t);r.set(n,[...r.get(n)??[],t])}let i=[];for(let[e,t]of r)for(let n=0;n<t.length;n+=Im)i.push({api:e,paths:t.slice(n,n+Im)});let a=await Promise.all(i.map(async({api:e,paths:t})=>{try{if(!e)throw Error(`no project to resolve against`);return(await e.resolveLocalPaths({paths:t})).resolved}catch{return t.map(e=>({input:e,path:null}))}})),o=!1;for(let t of a)for(let n of t){let t=km(e,n.input);Om.has(t)||(Om.set(t,n.path),o=!0)}for(let t of n)jm.delete(km(e,t));if(o){Mm+=1;for(let e of Nm)e()}}function Rm(e,t){e.setAttribute(`data-local-path`,t),e.setAttribute(`draggable`,`true`),e.setAttribute(`title`,`Open ${t}`),e.classList.add(`local-file-code`)}function zm(e,t){let n=(0,q.useSyncExternalStore)(Pm,Fm,Fm),r=a();(0,q.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=Dm(r),i=[];for(let e of t.querySelectorAll(`code`)){if(e.closest(`pre`)||e.closest(`a, [data-local-path]`))continue;let t=(e.textContent??``).trim();if(!Tm(t))continue;let r=Am(n,t);r===void 0?i.push(t):r&&Rm(e,r)}i.length&&Lm(n,i)},[e,t,n,r])}var Bm=0;function Vm(e,t,n,r,i){let[a,o]=(0,q.useState)([]),s=(0,q.useRef)(null);return(0,q.useLayoutEffect)(()=>{let c=e.current;if(s.current&&s.current.root===c&&s.current.html===t)return;s.current={root:c,html:t};let l=[...a],u=[];for(let e of c?.querySelectorAll(`pre > code.language-${n}`)??[]){let t=e.closest(`.md-code`)??e.parentElement,a=e.textContent??``,o=l.findIndex(e=>e.body===a),s;if(o>=0)s=l.splice(o,1)[0];else{let e=document.createElement(`div`);e.className=r,s={key:`${n}-${++Bm}`,host:e,body:a,value:i(a)}}t.replaceWith(s.host),u.push(s)}o(e=>e.length===0&&u.length===0?e:u)}),a}var Hm=`[overflow-wrap:anywhere]`,Um=`rounded-xl`,Wm=`rounded-b-[calc(var(--block-radius)_-_1px)]`,Gm={neutral:{border:`border-border-strong`,head:`text-fg`},attention:{border:`border-accent/45`,head:`text-accent`},caution:{border:`border-border-strong`,head:`text-attention`},risk:{border:`border-border-strong`,head:`text-danger`},danger:{border:`border-danger-fill/45`,head:`text-danger`}},Km=`card-icon-offset`;function qm(e,t){let n=(0,q.useRef)(null);return(0,q.useLayoutEffect)(()=>{let e=n.current;if(!e||typeof e.getBBox!=`function`)return;let r=e.getBBox(),i=e.viewBox.baseVal;if(!i||i.width===0||r.width===0)return;let a=Number(e.getAttribute(`stroke-width`))||0;if(t!==void 0&&r.height>0){let n=e.width.baseVal.value,o=a*n/i.width,s=e=>r.height*e/i.height+o,c=n;for(;s(c+2)<=t;)c+=2;let l=c>n;e.style.width=e.style.height=l?`${c}px`:``,e.style.marginBlock=l?`${(n-c)/2}px`:``,l&&(a=o*i.width/c),e.style.strokeWidth=l?String(a):``}let o=e.getBoundingClientRect().width/i.width,s=a/2;e.style.marginLeft=`${-Math.max(0,r.x-s-i.x)*o}px`,e.style.marginRight=`${-Math.max(0,i.x+i.width-(r.x+r.width)-s)*o}px`},[e,t]),n}function Jm({icon:e,className:t}){return(0,X.jsx)(e,{ref:qm(e),"aria-hidden":`true`,size:16,className:`shrink-0 ${Km} ${t}`})}function Ym({icon:e,label:t,head:n=Gm.neutral.head,aside:r}){return(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[e&&(0,X.jsx)(Jm,{icon:e,className:n}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 text-[16px] font-semibold leading-6 tracking-tight ${n}`,children:t}),r&&(0,X.jsx)(`span`,{className:`shrink-0 leading-6`,children:r})]})}var Xm=`flex min-w-0 items-center gap-[5px] text-[12px] font-medium leading-4`,Zm=12,Qm=Zm*22/24;function $m({icon:e,children:t,className:n=`text-muted`,evenInk:r=!1}){let i=qm(e,r?Qm:void 0);return(0,X.jsxs)(`span`,{"data-card-kind":!0,className:`${Xm} ${n}`,children:[e&&(0,X.jsx)(e,{ref:i,"aria-hidden":`true`,size:Zm,className:`shrink-0`}),(0,X.jsx)(`span`,{className:`min-w-0`,children:t})]})}function eh({icon:e,kind:t,kindClass:n,label:r,head:i,aside:a,ruled:o,evenInk:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)($m,{icon:e,className:n,evenInk:s,children:t}),a&&(0,X.jsx)(`span`,{className:`ml-auto flex shrink-0 items-center [--card-icon-offset:0px]`,children:a})]}),r!=null&&r!==!1&&(0,X.jsx)(`div`,{"data-card-title":!0,className:`min-w-0 text-[16px] font-semibold leading-6 tracking-tight ${i}`,children:r})]}),o&&(0,X.jsx)(`div`,{"aria-hidden":!0,"data-card-rule":!0,className:`-mx-4 mt-3.5 border-t border-border`})]})}function th({children:e,gap:t=`plain`}){return(0,X.jsx)(`div`,{className:`card-md ${t===`ruled`?`mt-3`:t===`band`?`mt-3.5`:`mt-1`} min-w-0 text-fg/75`,children:e})}function nh({tone:e=`neutral`,icon:t,kind:n,label:r,ruled:i,aside:a,children:o,className:s=``,surface:c=`inset`,...l}){let{border:u,head:d}=Gm[e],f=n!=null&&(i??o!=null);return(0,X.jsxs)(`div`,{...l,className:`min-w-0 ${Um} border ${c===`question`?`border-question-border bg-question`:`${u} bg-panel-2`} p-4 ${s}`,children:[n==null?(0,X.jsx)(Ym,{icon:t,label:r,head:d,aside:a}):(0,X.jsx)(eh,{icon:t,kind:n,kindClass:e===`neutral`?`text-muted`:d,label:r,head:e===`neutral`?d:Gm.neutral.head,aside:a,ruled:f,evenInk:c===`question`}),o!=null&&(0,X.jsx)(th,{gap:n==null?`plain`:f?`ruled`:`band`,children:o})]})}var rh=`block min-w-0 text-[13px] leading-5 text-fg/75`;function ih({children:e,className:t=``,...n}){return(0,X.jsx)(`div`,{...n,"data-card-actions":!0,className:`-mx-4 -mb-4 mt-3 flex flex-wrap items-center justify-start gap-x-2.5 gap-y-2 border-t border-border bg-fg/[0.03] px-4 py-2.5 ${Wm} ${t}`,children:e})}var ah=`min-w-0 flex-1 text-[11px] leading-snug text-muted-70`,oh=`text-accent underline underline-offset-2 decoration-accent/40 hover:decoration-accent`,sh=`bg-fg px-2.5 py-1 text-bg hover:opacity-90`,ch=`rounded-md`,lh=`flex shrink-0 items-center gap-1 ${ch} text-[11px] font-medium outline-none transition-colors focus-visible:ring-1 focus-visible:ring-focus-ink-60 pointer-coarse:min-h-9 pointer-coarse:rounded-lg pointer-coarse:px-3.5 pointer-coarse:text-[13px] ${sh}`;function uh(e,t){let n=Promise.resolve();function r(r){let i={...r,palette:{...r.palette}},a=n.then(async()=>{try{return await e(i)}finally{t(i.id)}});return n=a.then(()=>void 0,()=>void 0),a}return{enqueue:r}}function dh(e,t){let n=e[t];return typeof n==`string`&&n?n:void 0}function fh(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function ph(e,t){let n=dh(e,t);if(n)try{let e=new URL(n);return e.protocol===`https:`||e.protocol===`http:`?e.href:void 0}catch{return}}function mh({directive:e,icon:t,title:n,meta:r,children:i}){return(0,X.jsxs)(`section`,{"data-codex-directive":e.name,className:`min-w-0 ${Um} border border-border bg-panel-2/75 p-4`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted`,"aria-hidden":!0,children:t}),(0,X.jsx)(`div`,{className:`max-w-[calc(100%-1.5rem)] shrink-0 break-words text-[12px] font-medium leading-4 text-fg`,children:n}),r&&(0,X.jsx)(`div`,{className:`min-w-0 truncate text-[11px] font-normal leading-4 text-muted`,children:r})]}),i]})}function hh({children:e,mono:t=!1}){return(0,X.jsx)(`div`,{className:`ml-6 mt-1 break-words text-[11px] leading-4 text-muted${t?` font-mono-keep`:``}`,children:e})}function gh({directive:e}){let t=e.attrs,n=dh(t,`display_name`)??dh(t,`skill_name`)??`Artifact template`,r=dh(t,`artifact_kind`),i=dh(t,`skill_name`),a=dh(t,`skill_directory`),[o,s]=(0,q.useState)(!!a);return(0,X.jsxs)(mh,{directive:e,icon:(0,X.jsx)(Gc,{size:15}),title:n,meta:r?`${r} template`:`Template`,children:[i&&(0,X.jsx)(hh,{mono:!0,children:i.startsWith(`$`)?i:`$${i}`}),o&&a&&(0,X.jsx)(`img`,{src:Pe(`${a}/assets/preview.png`),alt:`${n} template preview`,loading:`lazy`,onError:()=>s(!1),className:`ml-6 mt-2 max-h-44 max-w-[calc(100%-1.5rem)] rounded-md border border-border object-contain`})]})}function _h({directive:e}){let t=e.attrs,n=dh(t,`file`),r=fh(t,`start`),i=fh(t,`end`)??r,a=fh(t,`priority`),o=n?`${n}${r?`:${r}${i&&i!==r?`-${i}`:``}`:``}`:`Code location unavailable`;return(0,X.jsxs)(mh,{directive:e,icon:(0,X.jsx)(Xc,{size:15}),title:dh(t,`title`)??`Review finding`,meta:a===void 0?void 0:`P${a}`,children:[dh(t,`body`)&&(0,X.jsx)(hh,{children:dh(t,`body`)}),n?(0,X.jsx)(`button`,{type:`button`,className:`local-file-action ml-6 mt-1 max-w-[calc(100%-1.5rem)] break-all text-left font-mono-keep text-[11px] leading-4 text-accent underline decoration-dotted underline-offset-2`,"data-local-path":n,draggable:!0,title:o,children:o}):(0,X.jsx)(hh,{mono:!0,children:o})]})}var vh={"git-stage":[tl,`Changes staged`],"git-commit":[kt,`Commit created`],"git-create-branch":[Hc,`Branch created`],"git-push":[dl,`Branch pushed`],"git-create-pr":[Ua,`Pull request created`]};function yh({directive:e}){let[t,n]=vh[e.name],r=dh(e.attrs,`branch`),i=ph(e.attrs,`url`),a=`${n}${e.attrs.isDraft===!0?` as draft`:``}`;return(0,X.jsx)(mh,{directive:e,icon:(0,X.jsx)(t,{size:15}),title:i?(0,X.jsx)(`a`,{className:`text-accent underline underline-offset-2`,href:i,target:`_blank`,rel:`noopener noreferrer`,children:a}):a,meta:r&&(0,X.jsx)(`span`,{className:`font-mono-keep`,children:r})})}function bh({directive:e}){let t=dh(e.attrs,`threadId`),n=dh(e.attrs,`pendingWorktreeId`);return(0,X.jsx)(mh,{directive:e,icon:(0,X.jsx)(el,{size:15}),title:n?`Thread setup queued`:`Thread created`,meta:(t||n)&&(0,X.jsx)(`span`,{className:`font-mono-keep`,children:t??n})})}function xh({directive:e}){let t=dh(e.attrs,`reason`);return(0,X.jsx)(mh,{directive:e,icon:(0,X.jsx)(Ec,{size:15}),title:`Archive suggested`,meta:t})}function Sh(e){if(typeof e!=`string`||!e)return;let t=e.match(/(?:^|;)INTERVAL=(\d+)(?:;|$)/)?.[1];return/(?:^|;)FREQ=HOURLY(?:;|$)/.test(e)?`Every ${t??`1`} hour${t===`1`||t===void 0?``:`s`}`:/(?:^|;)FREQ=WEEKLY(?:;|$)/.test(e)?`Weekly schedule`:`Custom schedule`}function Ch({directive:e}){let t=e.attrs,n=dh(t,`mode`),r=dh(t,`name`)??`Automation`,i=Sh(t.rrule),a=[r,n,dh(t,`status`),i].filter(Boolean).join(` · `);return(0,X.jsx)(mh,{directive:e,icon:(0,X.jsx)(Ac,{size:15}),title:`Automation suggested`,meta:a,children:dh(t,`prompt`)&&(0,X.jsx)(hh,{children:dh(t,`prompt`)})})}function wh({directive:e}){return e.name===`artifact-template`?(0,X.jsx)(gh,{directive:e}):e.name===`code-comment`?(0,X.jsx)(_h,{directive:e}):e.name.startsWith(`git-`)?(0,X.jsx)(yh,{directive:e}):e.name===`created-thread`?(0,X.jsx)(bh,{directive:e}):e.name===`archive`||e.name===`archive-thread`?(0,X.jsx)(xh,{directive:e}):(0,X.jsx)(Ch,{directive:e})}var Th=0,Eh=Ss(()=>Mi(async()=>{let{default:e}=await import(`./mermaid.core-B1c_wthC.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24])).then(({default:e})=>e));function Dh(){let e=getComputedStyle(document.documentElement),t=t=>e.getPropertyValue(t).trim();return{background:t(`--color-panel-2`),primaryColor:t(`--color-panel-2`),primaryTextColor:t(`--color-fg`),primaryBorderColor:t(`--color-control-strong`),lineColor:t(`--color-muted`),secondaryColor:t(`--color-border`),tertiaryColor:t(`--color-bg`),fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`}}var Oh=uh(async e=>{let t=await Eh();return t.initialize({startOnLoad:!1,securityLevel:`strict`,theme:e.resolved===`dark`?`dark`:`base`,themeVariables:e.palette}),t.render(e.id,e.source)},e=>document.getElementById(`d${e}`)?.remove());function kh({source:e}){let t=(0,q.useId)(),{resolved:n}=(0,q.useSyncExternalStore)(Zt,Nt,Nt),[r,i]=(0,q.useState)({}),a=(0,q.useRef)(0),o=Sm(r.html??``);return(0,q.useEffect)(()=>{let r=!0,o=++a.current;if(i(e=>e.error?{html:e.html}:e),e.length>5e4)return i({error:`Diagram source exceeds the 50 KB rendering limit`}),()=>{r=!1};let s=`frizz-mermaid-${t.replace(/[^a-zA-Z0-9]/g,``)}-${++Th}`;return Oh.enqueue({id:s,source:e,resolved:n,palette:Dh()}).then(({svg:e})=>{r&&a.current===o&&i({html:e})}).catch(e=>{if(!r||a.current!==o)return;let t=e instanceof Error?e.message.split(/\n| for text:/,1)[0]:`Unknown diagram error`;i({error:t.slice(0,240)})}),()=>{r=!1}},[t,n,e]),r.error?(0,X.jsxs)(`section`,{"data-mermaid-state":`error`,className:`${Um} border border-border bg-panel-2/75 p-4`,children:[(0,X.jsx)(`div`,{className:`text-[12px] font-medium text-fg`,children:`Diagram unavailable`}),(0,X.jsx)(`div`,{className:`mt-1 text-[11px] text-muted`,children:r.error}),(0,X.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap rounded-md bg-bg p-2 font-mono-keep text-[11px] text-muted`,children:e})]}):r.html?(0,X.jsx)(`div`,{"data-mermaid-state":`ready`,className:`overflow-x-auto ${Um} border border-border bg-panel-2/75 p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:o}):(0,X.jsx)(`div`,{"data-mermaid-state":`loading`,role:`status`,"aria-label":`Rendering diagram`,className:`h-24 animate-pulse ${Um} bg-panel-2`})}var Ah=e=>e.replace(/\n$/,``);function jh(e,t){return Vm(e,t,`mermaid`,`md-mermaid`,Ah).map(({key:e,host:t,value:n})=>(0,ml.createPortal)((0,X.jsx)(kh,{source:n}),t,e))}function Mh(e,t,n){let r=e.length;if(r===0||!(t>0))return[];let{gap:i,target:a,maxHeight:o,maxPerRow:s}=n,c=(t,n)=>{let r=0;for(let i=t;i<n;i++)r+=e[i];return r},l=(e,n)=>Math.max(0,t-i*(n-e-1))/c(e,n),u=Array(r+1).fill(1/0),d=Array(r+1).fill(0);u[0]=0;for(let e=1;e<=r;e++)for(let t=1;t<=Math.min(s,e);t++){let n=e-t,r=u[n]+(l(n,e)-a)**2;r<u[e]&&(u[e]=r,d[e]=n)}let f=[];for(let e=r;e>0;e=d[e]){let n=d[e],r=l(n,e),a=Math.min(r,o);f.unshift({start:n,end:e,height:a,width:a<r?a*c(n,e)+i*(e-n-1):t})}return f}var Nh={scale:1,x:0,y:0},Ph=(e,t,n)=>Math.min(Math.max(e,t),n);function Fh(e,t,n,r,i){let a=t*n/2;return 2*a<=i-r?Ph(0,r+a,i-a):Ph(e,i-a,r+a)}function Ih(e,t){let n=Ph(e.scale,1,t.max);return n===1?Nh:{scale:n,x:Fh(e.x,t.width,n,t.left,t.right),y:Fh(e.y,t.height,n,t.top,t.bottom)}}function Lh(e,t,n,r){let i=Ph(e.scale*t,1,r.max),a=i/e.scale;return Ih({scale:i,x:n.x-(n.x-e.x)*a,y:n.y-(n.y-e.y)*a},r)}function Rh(e,t,n,r){return Ih({scale:e.scale,x:e.x+t,y:e.y+n},r)}function zh(e,t,n,r,i,a){let o=Ph(e.scale*(i/Math.max(n,1)),1,a.max),s=o/e.scale;return Ih({scale:o,x:r.x-(t.x-e.x)*s,y:r.y-(t.y-e.y)*s},a)}function Bh(e,t){return Ph(t/Math.max(e,1),2,4)}function Vh(e,t){return Ph(2*t/Math.max(e,1),4,12)}var Hh=6,Uh=420,Wh=16/10,Gh=.4,Kh=3,qh=(e,t,n)=>Math.min(Math.max(e,t),n),Jh=e=>qh(e/4,112,180);function Yh({entries:e,baseDir:t,framed:n=!0}){let r=Np(),i=(0,q.useMemo)(()=>t?{...r,dir:t}:r,[r,t]),a=(0,q.useMemo)(()=>e.map(e=>{let t=Gr(e.target,i);return{entry:e,path:t,label:pa(e,t)}}),[e,i]),[o,s]=(0,q.useState)({}),[c,l]=(0,q.useState)({}),[u,d]=(0,q.useState)(null),f=eg(u),p=a.filter(e=>e.path!==null&&!c[e.path]),m=a.filter(e=>!p.includes(e)),h=e=>qh(o[e.path]||Wh,Gh,Kh),g=Mh(p.map(h),f,{gap:Hh,target:Jh(f),maxHeight:Uh,maxPerRow:8}),_=a.some(e=>e.entry.caption),v=p.map(e=>ao(e.entry,e.path));if(p.length===0)return(0,X.jsx)(`div`,{"data-lightbox-gallery":!0,className:`flex flex-col gap-1`,children:m.map((e,t)=>(0,X.jsx)($h,{tile:e},t))});let y=(0,X.jsxs)(`div`,{ref:d,"data-lightbox-gallery":!0,className:`flex w-full min-w-0 flex-col gap-1.5`,children:[g.map(e=>(0,X.jsx)(`div`,{"data-lightbox-row":!0,className:`mx-auto flex max-w-full gap-1.5`,style:{width:e.width},children:p.slice(e.start,e.end).map((t,n)=>(0,X.jsx)(Zh,{tile:t,ratio:h(t),labelled:_,onOpen:()=>Da(v,e.start+n),onShape:e=>s(n=>n[t.path]===e?n:{...n,[t.path]:e}),onBroken:()=>l(e=>({...e,[t.path]:!0}))},e.start+n))},e.start)),m.map((e,t)=>(0,X.jsx)($h,{tile:e},t))]});return n?(0,X.jsx)(Jf,{children:y}):(0,X.jsx)(`div`,{className:Xf,children:y})}function Xh(e){return{flex:`${e} 1 0%`}}function Zh({tile:e,ratio:t,labelled:n,onOpen:r,onShape:i,onBroken:a}){let o=qi(e.path),s=(e,t)=>{e>0&&t>0&&i(e/t)};return(0,X.jsxs)(`button`,{type:`button`,"data-lightbox-tile":!0,"data-lightbox-video":o||void 0,onClick:r,"aria-label":`${o?`Play`:`View`} ${e.label}`,className:`group flex min-w-0 flex-col gap-1 rounded-md text-left outline-none focus-visible:ring-1 focus-visible:ring-focus-ink-60 focus-visible:ring-offset-2 focus-visible:ring-offset-panel-2 ${o?`cursor-pointer`:`cursor-zoom-in`}`,style:Xh(t),children:[(0,X.jsx)(`span`,{className:`relative block w-full overflow-hidden rounded-md`,style:{aspectRatio:t},children:o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`video`,{src:`${Pe(e.path)}#t=0.001`,preload:`metadata`,muted:!0,playsInline:!0,disablePictureInPicture:!0,tabIndex:-1,"aria-hidden":!0,onLoadedMetadata:e=>s(e.currentTarget.videoWidth,e.currentTarget.videoHeight),onError:a,className:`pointer-events-none block h-full w-full object-contain transition-[filter] group-hover:brightness-110`}),(0,X.jsx)(Qh,{})]}):(0,X.jsx)(`img`,{src:Pe(e.path),alt:n?``:e.label,draggable:!1,onLoad:e=>s(e.currentTarget.naturalWidth,e.currentTarget.naturalHeight),onError:a,className:`block h-full w-full object-contain transition-[filter] group-hover:brightness-110`})}),n&&(0,X.jsx)(`span`,{title:e.label,className:`block truncate font-sans text-[11px] leading-4 text-muted`,children:e.label})]})}function Qh(){return(0,X.jsx)(`span`,{"data-lightbox-play":!0,"aria-hidden":!0,className:`pointer-events-none absolute left-1/2 top-1/2 flex h-8 w-8 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-black/55 text-white/90 ring-1 ring-white/15 backdrop-blur-sm transition-colors group-hover:bg-black/70 group-hover:text-white`,children:(0,X.jsx)(nl,{size:14,strokeWidth:Dg,absoluteStrokeWidth:!0,fill:`currentColor`})})}function $h({tile:e}){return(0,X.jsx)(`div`,{"data-lightbox-missing":!0,className:`break-all font-mono-keep text-[12px] text-muted-70`,children:e.path??e.entry.target})}function eg(e){let[t,n]=(0,q.useState)(0);return(0,q.useLayoutEffect)(()=>{if(!e)return;n(e.clientWidth);let t=new ResizeObserver(([e])=>n(e.contentRect.width));return t.observe(e),()=>t.disconnect()},[e]),t}function tg(e){let[t,n]=(0,q.useState)(0);return(0,q.useLayoutEffect)(()=>{if(!e){n(0);return}let t=()=>n(e.getBoundingClientRect().height);t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[e]),t}function ng(e,t,n){return Vm(e,t,`lightbox`,`md-lightbox`,ra).map(({key:e,host:t,value:r})=>(0,ml.createPortal)((0,X.jsx)(Yh,{entries:r,baseDir:n}),t,e))}function rg(){let{lightbox:e}=Xa(U);return e?(0,X.jsx)(pc,{children:(0,X.jsx)(gg,{images:e.images,index:e.index})}):null}var ig={x:0,y:0},ag=e=>({path:e,zoom:Nh,pull:ig,animate:!1,max:1/0,panning:!1}),og={mouse:4,touch:10},sg=48,cg=96,lg=300,ug=40,dg=1.5,fg=1.1,pg=`transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1)`,mg=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2}),hg=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y);function gg({images:e,index:t}){s(Be(),!1,rs);let n=Fn(),r=(0,q.useRef)(document.activeElement instanceof HTMLElement?document.activeElement:null),i=(0,q.useRef)(null),a=(0,q.useRef)(null),[o,c]=(0,q.useState)(null),l=(0,q.useCallback)(e=>{a.current=e,c(e)},[]),u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=e[t],p=f?.path??``,m=qi(p),h=(0,q.useId)(),[g,_]=(0,q.useState)(null),v=tg(g),y=f?.caption?v:0,b=(0,q.useRef)(ag(p)),[x,S]=(0,q.useState)(b.current),C=()=>b.current.path===p?b.current:ag(p),w=e=>{let t={...C(),...e};b.current=t,S(t)},T=x.path===p?x:ag(p),E=(0,q.useRef)(new Map),D=(0,q.useRef)(`mouse`),O=(0,q.useRef)(null),k=(0,q.useRef)(!1),A=(0,q.useRef)(null),j=()=>{let e=u.current,t=a.current;if(!e||!t||!e.naturalWidth)return null;let n=e.getBoundingClientRect(),r=new DOMMatrixReadOnly(getComputedStyle(e).transform),i=n.width/r.a,o=n.height/r.d;if(!i||!o)return null;let s={x:n.left+n.width/2-r.e,y:n.top+n.height/2-r.f},c=t.getBoundingClientRect();return{centre:s,bounds:{width:i,height:o,left:c.left-s.x,right:c.right-s.x,top:c.top-s.y,bottom:c.bottom-s.y,max:Vh(i,e.naturalWidth)},detail:Bh(i,e.naturalWidth)}},M=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),N=(e,t)=>{let n=j();n&&w({zoom:e(C().zoom,n),animate:t,max:n.bounds.max})},P=e=>N((t,n)=>t.scale>1?Nh:Lh(Nh,n.detail,M(e,n.centre),n.bounds),!0),F=e=>N((t,n)=>Lh(t,e,{x:(n.bounds.left+n.bounds.right)/2,y:(n.bounds.top+n.bounds.bottom)/2},n.bounds),!0);if((0,q.useEffect)(()=>{if(!o)return;let e=e=>{let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?o.clientHeight:1;if(e.ctrlKey||e.metaKey){e.preventDefault();let n=Math.exp(qh(-e.deltaY*t*.01,-.5,.5));N((t,r)=>Lh(t,n,M({x:e.clientX,y:e.clientY},r.centre),r.bounds),!1)}else C().zoom.scale>1&&(e.preventDefault(),N((n,r)=>Rh(n,-e.deltaX*t,-e.deltaY*t,r.bounds),!1))},t=null,n=e=>{e.preventDefault();let n=e;if(e.type===`gesturestart`)t=C().zoom;else if(e.type===`gesturechange`&&t&&E.current.size===0){let e=t;N((t,r)=>Lh(e,n.scale,M({x:n.clientX,y:n.clientY},r.centre),r.bounds),!1)}},r=new ResizeObserver(()=>{C().zoom.scale>1&&N((e,t)=>Ih(e,t.bounds),!1)});o.addEventListener(`wheel`,e,{passive:!1});for(let e of[`gesturestart`,`gesturechange`,`gestureend`])o.addEventListener(e,n);return r.observe(o),()=>{o.removeEventListener(`wheel`,e);for(let e of[`gesturestart`,`gesturechange`,`gestureend`])o.removeEventListener(e,n);r.disconnect()}},[o,p]),!f)return null;let I=e.length>1,L=T.zoom.scale>1,ee=t=>{let n=!t.ctrlKey&&!t.metaKey&&!t.altKey;if(t.key===`ArrowLeft`)uo(-1);else if(t.key===`ArrowRight`)uo(1);else if(t.key===`Home`)uo(-e.length);else if(t.key===`End`)uo(e.length);else if(n&&(t.key===`+`||t.key===`=`))F(dg);else if(n&&(t.key===`-`||t.key===`_`))F(1/dg);else if(n&&t.key===`0`)w({zoom:Nh,animate:!0});else if(n&&t.key===` `&&m&&t.target!==d.current){let e=d.current;e?.paused?e.play().catch(()=>void 0):e?.pause()}else if(t.key===`Escape`)rs();else return;t.preventDefault(),t.stopPropagation()},te=e=>{e.target===e.currentTarget&&rs()},ne=e=>{if(!(e.pointerType===`mouse`&&e.button!==0)&&!e.target.closest(`button, video`)){if(E.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),E.current.size===1)D.current=e.pointerType,k.current=!1,O.current={kind:`press`,id:e.pointerId,x:e.clientX,y:e.clientY};else if(E.current.size===2){let e=j(),[t,n]=[...E.current.values()];k.current=!0,A.current=null,O.current=e?{kind:`pinch`,start:C().zoom,mid:M(mg(t,n),e.centre),distance:hg(t,n)}:null,C().pull!==ig&&w({pull:ig,animate:!0})}}},re=n=>{if(!E.current.has(n.pointerId))return;E.current.set(n.pointerId,{x:n.clientX,y:n.clientY});let r=O.current;if(r?.kind===`pinch`){let e=r,[t,n]=[...E.current.values()];N((r,i)=>zh(e.start,e.mid,e.distance,M(mg(t,n),i.centre),hg(t,n),i.bounds),!1);return}if(!(!r||r.id!==n.pointerId)){if(r.kind===`press`){if(Math.hypot(n.clientX-r.x,n.clientY-r.y)<(n.pointerType===`mouse`?og.mouse:og.touch))return;if(k.current=!0,A.current=null,C().zoom.scale>1)r={kind:`pan`,id:r.id,x:r.x,y:r.y};else if(n.pointerType!==`mouse`){let e=n.clientX-r.x,t=n.clientY-r.y;r={kind:`swipe`,id:r.id,x:r.x,y:r.y,axis:Math.abs(e)>Math.abs(t)?`x`:`y`}}else r=null;if(O.current=r,!r)return;a.current?.setPointerCapture(n.pointerId),r.kind===`pan`&&w({panning:!0})}if(r.kind===`pan`){let e=n.clientX-r.x,t=n.clientY-r.y;r.x=n.clientX,r.y=n.clientY,N((n,r)=>Rh(n,e,t,r.bounds),!1)}else if(r.kind===`swipe`){let i=n.clientX-r.x,a=n.clientY-r.y,o=i>0&&t===0||i<0&&t===e.length-1;w({pull:r.axis===`x`?{x:o?i/4:i,y:0}:{x:0,y:a},animate:!1})}}},ie=e=>{if(!E.current.delete(e.pointerId))return;let t=O.current;if(t?.kind===`pinch`){let[e]=[...E.current.entries()];C().zoom.scale<fg&&w({zoom:Nh,animate:!0}),O.current=e&&C().zoom.scale>1?{kind:`pan`,id:e[0],x:e[1].x,y:e[1].y}:null;return}if(!t||t.id!==e.pointerId)return;O.current=null;let n=e.type===`pointercancel`;if(t.kind===`pan`&&w({panning:!1}),t.kind===`swipe`){let r=e.clientX-t.x,i=e.clientY-t.y;if(w({pull:ig,animate:!0}),n)return;t.axis===`x`&&Math.abs(r)>sg?uo(r<0?1:-1):t.axis===`y`&&Math.abs(i)>cg&&rs();return}if(t.kind===`press`&&!n&&e.pointerType!==`mouse`){let t=A.current;t&&e.timeStamp-t.t<lg&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<ug?(A.current=null,k.current=!0,P({x:e.clientX,y:e.clientY})):A.current={t:e.timeStamp,x:e.clientX,y:e.clientY}}},z=e=>{if(k.current){k.current=!1;return}if(e.target.closest(`button, video, [data-lightbox-caption]`))return;let t=D.current===`mouse`;e.target===u.current?t&&P({x:e.clientX,y:e.clientY}):C().zoom.scale>1?t&&w({zoom:Nh,animate:!0}):rs()},B=1-Math.min(Math.abs(T.pull.y)/(cg*3),.6);return(0,X.jsx)(Uo,{open:!0,onOpenChange:e=>{e||rs()},children:(0,X.jsxs)(yr,{children:[(0,X.jsx)(Or,{className:`overlay-in fixed inset-0 ${Rr} bg-black/95 backdrop-blur-md`,style:{opacity:B}}),(0,X.jsxs)(et,{ref:i,"data-lightbox":!0,"aria-modal":`true`,"aria-describedby":f.caption?h:void 0,onEscapeKeyDown:pi,onOpenAutoFocus:e=>{e.preventDefault(),i.current?.focus({preventScroll:!0})},onCloseAutoFocus:e=>{e.preventDefault(),r.current?.isConnected&&r.current.focus({preventScroll:!0})},onKeyDown:ee,className:`overlay-in fixed inset-0 ${Rr} flex flex-col text-white outline-none`,children:[(0,X.jsxs)(`header`,{onClick:te,className:`flex shrink-0 items-center gap-3 pb-2 pl-[max(env(safe-area-inset-left),16px)] pr-[max(env(safe-area-inset-right),16px)] pt-[max(env(safe-area-inset-top),12px)]`,style:{opacity:B},children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(Ir,{className:`truncate text-[13px] font-medium leading-5 text-white/90 ${f.titled?``:`font-mono-keep`}`,children:f.label}),(0,X.jsx)(`div`,{className:`truncate text-left font-mono-keep text-[11px] leading-4 text-white/45 [direction:rtl]`,title:f.path,children:(0,X.jsx)(`bdi`,{children:Xs(f.path,n)})})]}),(0,X.jsxs)(`div`,{"data-lightbox-actions":!0,className:`-mr-1 flex shrink-0 items-center gap-0.5 pointer-coarse:-mr-3`,children:[I&&(0,X.jsxs)(`span`,{"data-lightbox-counter":!0,className:`mr-2.5 text-[12px] tabular-nums text-[#787a7d]`,children:[t+1,` / `,e.length]}),!m&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Eg,{label:`Zoom out`,onClick:()=>F(1/dg),disabled:!L,className:`pointer-coarse:hidden`,children:(0,X.jsx)(pl,{size:14,strokeWidth:2})}),(0,X.jsx)(Eg,{label:`Zoom in`,onClick:()=>F(dg),disabled:T.zoom.scale>=T.max-1e-6,className:`pointer-coarse:hidden`,children:(0,X.jsx)(fl,{size:14,strokeWidth:2})})]}),(0,X.jsx)(Eg,{label:`Download`,onClick:()=>_g(f),children:(0,X.jsx)(be,{size:14,strokeWidth:2,className:Tg})}),(0,X.jsx)(Eg,{label:m?`Open in default player`:`Open in default viewer`,onClick:()=>R(f.path,!0),children:(0,X.jsx)(Ic,{size:14,strokeWidth:2,className:Tg})}),(0,X.jsx)(Eg,{label:`Close`,onClick:rs,children:(0,X.jsx)(zs,{size:15,strokeWidth:2,className:Tg})})]})]}),(0,X.jsxs)(`div`,{ref:l,"data-lightbox-stage":!0,onClick:z,onPointerDown:ne,onPointerMove:re,onPointerUp:ie,onPointerCancel:ie,className:`relative flex min-h-0 flex-1 flex-col items-center justify-center overflow-hidden px-3 pb-[max(env(safe-area-inset-bottom),16px)] sm:px-16 ${L?T.panning?`cursor-grabbing`:`cursor-grab`:``}`,style:{touchAction:`none`},children:[m?(0,X.jsx)(xg,{image:f,view:T,reserve:y,videoRef:d},f.path):(0,X.jsx)(bg,{image:f,view:T,reserve:y,pictureRef:u},f.path),f.caption&&(0,X.jsx)(`p`,{ref:_,id:h,"data-lightbox-caption":!0,className:`max-w-2xl shrink-0 text-balance pt-3 text-center text-[13px] leading-5 text-white/75 ${L?`pointer-events-none`:``}`,style:{transform:`translate(${T.pull.x}px, ${T.pull.y}px)`,transition:`${T.animate?pg:`transform 0s`}, opacity 150ms ease-out`,opacity:L?0:B},children:f.caption}),I&&t>0&&(0,X.jsx)(Og,{side:`left`,onClick:()=>uo(-1)}),I&&t<e.length-1&&(0,X.jsx)(Og,{side:`right`,onClick:()=>uo(1)})]})]})]})})}function _g(e){let t=document.createElement(`a`);t.href=Pe(e.path),t.download=Po(e),document.body.append(t),t.click(),t.remove()}function vg({what:e,path:t}){return(0,X.jsxs)(`div`,{className:`pointer-events-none max-w-md text-center`,children:[(0,X.jsxs)(`div`,{className:`text-[13px] text-white/70`,children:[e,` unavailable`]}),(0,X.jsx)(`div`,{className:`mt-1 break-all font-mono-keep text-[11px] text-white/45`,children:t})]})}var yg=e=>e?`calc(100% - ${e}px)`:void 0;function bg({image:e,view:t,reserve:n,pictureRef:r}){let[i,a]=(0,q.useState)(!1);if(i)return(0,X.jsx)(vg,{what:`Image`,path:e.path});let{scale:o,x:s,y:c}=t.zoom;return(0,X.jsx)(`img`,{ref:r,src:Pe(e.path),alt:e.label,draggable:!1,onError:()=>a(!0),className:`block max-h-full max-w-full select-none object-contain ${o>1?``:`cursor-zoom-in`}`,style:{maxHeight:yg(n),transform:`translate(${s+t.pull.x}px, ${c+t.pull.y}px) scale(${o})`,transition:t.animate?pg:`none`,borderRadius:6/o,boxShadow:`0 0 0 ${1/o}px rgb(255 255 255 / 0.1)`}})}function xg({image:e,view:t,reserve:n,videoRef:r}){let[i,a]=(0,q.useState)(!1);return i?(0,X.jsx)(vg,{what:`Video`,path:e.path}):(0,X.jsx)(`video`,{ref:r,src:Pe(e.path),"aria-label":e.label,controls:!0,autoPlay:!0,playsInline:!0,preload:`auto`,onError:()=>a(!0),className:`block max-h-full max-w-full rounded-md bg-black`,style:{maxHeight:yg(n),transform:`translate(${t.pull.x}px, ${t.pull.y}px)`,transition:t.animate?pg:`none`,boxShadow:`0 0 0 1px rgb(255 255 255 / 0.1)`}})}var Sg=`icon-focus-outline text-[#787a7d] transition-colors hover:bg-white/[0.04] hover:text-[#e6e7e9]`,Cg=`cursor-default text-[#303132]`,wg=`pointer-coarse:size-11 pointer-coarse:rounded-full pointer-coarse:text-[#cfd0d2]`,Tg=`pointer-coarse:size-[21px] pointer-coarse:[stroke-width:2.1]`;function Eg({label:e,onClick:t,disabled:n,className:r=``,children:i}){return(0,X.jsx)(Bs,{label:e,side:`bottom`,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":e,"aria-disabled":n||void 0,onClick:()=>{n||t()},className:`${Za} focus-visible:ring-1 focus-visible:ring-white/60 ${n?Cg:Sg} ${wg} ${r}`,children:i})})}var Dg=1.5;function Og({side:e,onClick:t}){return(0,X.jsx)(`button`,{type:`button`,"data-lightbox-page":e,"aria-label":e===`left`?`Previous image`:`Next image`,onClick:t,className:`absolute top-1/2 flex h-10 w-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/55 text-white/85 outline-none ring-1 ring-white/15 backdrop-blur-sm transition-colors hover:bg-black/75 hover:text-white focus-visible:ring-white/60 pointer-coarse:hidden ${e===`left`?`left-3`:`right-3`}`,children:(0,X.jsx)(e===`left`?jc:fr,{size:20,strokeWidth:Dg,absoluteStrokeWidth:!0})})}function kg({as:e=`div`,className:t,html:n}){let r=Sm(n),i=(0,q.useRef)(null);zm(i,n);let a=ng(i,n),o=jh(i,n);return(0,X.jsxs)(X.Fragment,{children:[(0,q.createElement)(e,{ref:i,className:t,dangerouslySetInnerHTML:r}),a,o]})}function Ag({text:e,language:t,className:n=``,...r}){let i=Sm((0,q.useMemo)(()=>Zd(e,t),[e,t]));return(0,X.jsx)(`pre`,{...r,className:`hljs ${n}`,dangerouslySetInnerHTML:i})}var jg=`Todos`,Mg={pending:{Icon:ul,className:`text-muted-50`},in_progress:{Icon:cl,className:`text-accent`},completed:{Icon:sl,className:`text-muted-75`}},Ng={pending:`text-fg/75`,in_progress:`text-fg`,completed:`text-muted-70`};function Pg({status:e}){let{Icon:t,className:n}=Mg[e];return(0,X.jsx)(t,{"aria-hidden":`true`,size:`1em`,strokeWidth:2,className:`frizz-todo-mark shrink-0 ${n}`})}var Fg={pending:`to do`,in_progress:`in progress`,completed:`done`};function Ig({todos:e,note:t,meta:n,node:r}){let[i,a]=(0,q.useState)(!1),o=(0,q.useId)(),s=e.filter(e=>e.status===`completed`).length,c=e.find(e=>e.status===`in_progress`),l=e.length>0||!!t,u=e.length>0?`${s}/${e.length}`:void 0,d=c?c.text:e.length===0?`empty`:void 0;return(0,X.jsxs)(`div`,{className:`frizz-bash`,"data-todo-card":!0,"data-tool-node":r,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l&&a(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":l?o:void 0,"aria-expanded":l?i:void 0,"aria-label":`${l?`${i?`Collapse`:`Expand`} `:``}${jg}${d?`: ${d}`:``}${u?` — ${s} of ${e.length} done`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-60`,children:[(0,X.jsxs)(`span`,{className:cm,children:[(0,X.jsx)(`span`,{className:`frizz-bash-label shrink-0`,children:jg}),d&&(0,X.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,title:d,"data-todo-headline":!0,children:[c&&(0,X.jsx)(Pg,{status:`in_progress`}),(0,X.jsx)(`span`,{className:`frizz-tool-detail`,children:d})]})]}),(0,X.jsxs)(`span`,{className:lm,children:[u&&(0,X.jsx)(`span`,{className:`tabular-nums text-[11.5px] leading-none text-faint`,title:`${s} of ${e.length} done`,children:u}),n,(0,X.jsx)(_m,{shown:l,open:i})]})]}),l&&(0,X.jsxs)(`div`,{id:o,className:`frizz-tool-body`,hidden:!i,children:[i&&e.length>0&&(0,X.jsx)(`ul`,{className:`frizz-todo-list`,children:e.map((e,t)=>(0,X.jsxs)(`li`,{className:`frizz-todo-row`,"data-current":e.status===`in_progress`?`true`:void 0,children:[(0,X.jsx)(Pg,{status:e.status}),(0,X.jsx)(`span`,{className:`min-w-0 ${Ng[e.status]}`,children:e.text}),(0,X.jsx)(`span`,{className:`sr-only`,children:` — ${Fg[e.status]}`})]},t))}),i&&t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`frizz-bash-output-label`,children:`Note`}),(0,X.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body`,children:t})]})]})]})}function Lg(e,t){return t===`done`?ct(e):Ee(e)}function Rg(e){let t=_s(e);if(!t)return e.trim()?[{kind:`prose`,text:e}]:[];let n=[],r=``,i=0;for(let a of Ri(e).filter(e=>e.start<=t.start)){r+=e.slice(i,a.start),i=a.end;let{body:o,hints:s}=Lg(a.raw,a.kind);if(a.start!==t.start){let e=a.kind===`awaiting`?Jo(o)??``:o;e.trim()&&(r+=`\n\n${e}\n\n`);continue}r.trim()&&n.push({kind:`prose`,text:r}),r=``,n.push({kind:`fence`,fenceKind:a.kind,body:o,hints:s})}return r+=e.slice(i),r.trim()&&n.push({kind:`prose`,text:r}),n}function zg(e,t){for(let n=Math.min(t,e.length)-1;n>=0;n--){let t=e[n];if(!(t.role!==`assistant`||t.kind===`event`)&&Rg(t.text).some(e=>e.kind===`fence`&&e.fenceKind===`awaiting`&&fa(e.hints)))return n}return-1}function Bg(e,t){let n=e?.lastFence;return!(!n||n.kind!==`done`||n.registered!==!0||t&&Rg(t).some(e=>e.kind===`fence`&&e.fenceKind===`done`))}var Vg=(e,t)=>[`registeredDone`,e,t.bodyElided??-1,t.body];function Hg(e){return e?.kind===`done`&&e.registered===!0&&e.bodyElided!==void 0}function Ug(e,t){return e!==void 0&&e.length===t.bodyElided&&i(e)===t.body}function Wg(e){let t=e?.lastFence,n=e?.id??``,r=(0,q.useRef)(void 0);t?.kind===`done`&&t.bodyElided===void 0&&(r.current={slug:n,body:t.body});let i=Hg(t)?t:void 0,a=i&&r.current?.slug===n&&Ug(r.current.body,i)?r.current.body:void 0,o=oo(),s=Fo({queryKey:i?Vg(n,i):[`registeredDone`,`none`],queryFn:async()=>(await W.threadRegisteredDone({slug:n})).body,enabled:i!==void 0&&a===void 0&&n!==``,staleTime:1/0,refetchOnWindowFocus:!1});if((0,q.useEffect)(()=>{i&&a!==void 0&&o.getQueryData(Vg(n,i))===void 0&&o.setQueryData(Vg(n,i),a)},[i,a,o,n]),t)return i?a===void 0?s.data===null||s.isError?t.body:s.data:a:t.body}function Gg(e,t,n){if(!e||e.kind!==`session`||e.foreign||e.runtime!==`turn-idle`&&e.runtime!==`exited`||e.needsYou!==!0||e.providerError)return!1;if(e.crashed===!0)return!0;if(e.lastFence||e.pendingQuestion||Fs(e)||e.answersInFlight||e.pendingAsk||e.pendingInteraction||e.awaitingBackground||e.limitPause||e.providerFault||!e.lastAssistantAt||t===void 0||Rg(t).some(e=>e.kind===`fence`))return!1;if(!Gn(e.spawnedAt)){let r=new Set((e.questions??[]).flatMap(e=>$o(e.spec).map(e=>e.toLowerCase()))),i=(e.closedQuestions??[]).filter(e=>!r.has(e.handle.toLowerCase()));return!wc(t,!0,i.length===0?n:new Set([...n??[],...i.map(e=>e.handle.toLowerCase())])).some(e=>e.kind===`question`)}return!Ce(t)}function Kg({thread:e}){return e.crashed===!0?(0,X.jsx)(nh,{"data-rested-card":`stalled`,icon:fc,label:`Stalled`,children:(0,X.jsx)(`p`,{className:rh,children:`The agent's process exited mid-turn. Retry, in the header, re-sends the last message.`})}):(0,X.jsx)(nh,{"data-rested-card":`bare`,icon:rr,label:`Rested without a sign-off`,children:(0,X.jsx)(`p`,{className:rh,children:`The worker stopped without a done card, a question or a registered wait. Frizz nudges it for one; a reply here also wakes it.`})})}function qg(e,t){return t!==void 0&&e.some(e=>e.providerError?.at===t.at&&e.providerError?.message===t.message&&e.providerError?.code===t.code)}function Jg({error:e,provider:t}){return(0,X.jsxs)(nh,{"data-codex-error":e.code??`unknown`,tone:e.retrying?`caution`:`danger`,icon:fc,label:e.retrying?`${t} retrying`:`${t} request failed`,children:[e.code&&(0,X.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75 font-mono [overflow-wrap:anywhere]`,children:e.code}),(0,X.jsx)(`p`,{className:`${rh} whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.message}),e.details&&(0,X.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.details})]})}function Yg(e){return e.role===`user`&&e.kind!==`event`&&e.kind!==`reasoning`}function Xg(e,t){for(let n=t+1;n<e.length;n++)if(Yg(e[n]))return n-1;return e.length-1}function Zg(e,t){let n=Date.parse(t),r=e.length-1;if(!Number.isFinite(n))return r;for(let t=0;t<e.length;t++){let r=e[t];if(!Yg(r))continue;let i=r.at?Date.parse(r.at):NaN;if(!(!Number.isFinite(i)||i<=n))return t-1}let i=r;for(;i>=0&&Yg(e[i])&&!(e[i].at&&Number.isFinite(Date.parse(e[i].at)));)i--;return i<0?r:i}function Qg(e){let t=new Map,n=-1;return e.forEach((e,r)=>{if(oc(e)&&(n=r),e.role!==`assistant`||!e.text)return;let i=i=>{let a=e.questionOwners?.get(i),o=a===void 0?i:$g(i,a),s=t.get(o);(s===void 0||s<n)&&t.set(o,r)};if(e.text.includes("```awaiting")){for(let t of Rg(e.text))if(!(t.kind!==`fence`||t.fenceKind!==`awaiting`))for(let e of ss(t.hints))i(e.toLowerCase())}for(let t of wn(e.text,e.refusedFences))i(t)}),t}var $g=(e,t)=>`${e}\u0000${t}`;function e_(e,t){let n,r=r=>{for(let i of t.id?[r.toLowerCase(),$g(r.toLowerCase(),t.id)]:[r.toLowerCase()]){let t=e.get(i);t!==void 0&&(n===void 0||t>n)&&(n=t)}};if(t.id&&r(t.id),t.spec)for(let e of $o(t.spec))r(e);return n}function t_(e,t,n={}){let r=new Map,i=n.claims===!1||t.length===0?void 0:Qg(e);for(let a of t){let t=Zg(e,a.askedAt),o=i?e_(i,a):void 0;if(o!==void 0&&o>t&&(t=Xg(e,o)),n.from!==void 0&&a.standing===!1&&t<n.from)continue;let s=r.get(t);s?s.push(a):r.set(t,[a])}return r}function n_(e,t){for(let n=t;n>=0;n--)if(r_(e[n]))return n+1;return 0}function r_(e){return e.role===`user`&&e.kind!==`event`&&e.kind!==`reasoning`}function i_(e,t){let n=new Map;for(let[r,i]of t_(e,t,{claims:!1}))for(let t=n_(e,r);t<e.length;t++){if(r_(e[t]))continue;let r=n.get(t);r?r.push(...i):n.set(t,[...i])}return n}var a_=12;function o_(e){return e.replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/[*_~`]/g,``).replace(/\s+/g,` `).trim().toLowerCase()}function s_(e){let t=e.indexOf(`?`);return t===-1?void 0:e.slice(0,t+1)}function c_(e,t){if(t.length===0)return!1;let n=o_(Ct(e,`question`).contextMd);if(n.length<a_)return!1;let r=s_(n);return t.some(({spec:e})=>{let t=o_(e.question);if(t.length<a_)return!1;if(n.includes(t)||t.startsWith(n))return!0;let i=s_(t);return i!==void 0&&i.length>=a_&&n.includes(i)?!0:r!==void 0&&r.length>=a_&&t.includes(r)})}function l_(e,t){return e.registeredId?t.find(t=>t.id.toLowerCase()===e.registeredId):t.find(t=>c_(e.text,[t]))}function u_(e){let t=[e.id.toLowerCase()];if(e.spec)for(let n of $o(e.spec))t.push(n.toLowerCase());else e.handle&&t.push(e.handle.toLowerCase());return t}function d_(e,t,n){let r=e.toLowerCase(),i=n?.get(r);if(i!==void 0){let e=t.find(e=>e.id===i);if(e)return e}return t.find(e=>u_(e).includes(r))}function f_(e,t){let n=m_(e.text,e.refusedFences);return n.length>0&&n.every(n=>d_(n,t,e.questionOwners)?.closed!==void 0)}function p_(e,t,n){let r=e.questionOwners?.get(t);return r===void 0||r===n}function m_(e,t){return ni(e)?[...h_(e),...wn(e,t)]:[]}function h_(e){return e.includes("```question")?or(e).flatMap(e=>e.kind===`question`&&e.registeredId&&e.text.trim()===``?[e.registeredId]:[]):[]}function g_(e,t){let n=new Map,r=new Set;if(t.length===0)return{placed:n,placedIds:r};let i=new Map,a=t=>{let n=i.get(t);if(n===void 0){let r=e[t];n=r.role===`assistant`&&r.text?m_(r.text,r.refusedFences):[],i.set(t,n)}return n};for(let[i,o]of t_(e,t))for(let t of o){let o=u_(t),s=[],c=!1;for(let n=n_(e,i);n<e.length;n++)oc(e[n])&&(c=!0),!r_(e[n])&&a(n).some(r=>o.includes(r)&&p_(e[n],r,t.id))&&(c&&(s=[]),s.push(n),c=!1);if(s.length===0)continue;let l=s.filter(t=>e[t].signOff===!0),u=l.length>0?l[l.length-1]:s[s.length-1],d=n.get(u);d?d.push(t):n.set(u,[t]),r.add(t.id)}return{placed:n,placedIds:r}}function __(e,t){if(t<=0)return e;let n=new Map,r=new Set;for(let[i,a]of e.placed)if(!(i<t)){n.set(i,a);for(let e of a)r.add(e.id)}return{placed:n,placedIds:r}}function v_(e,t){let n=new Set;for(let r of t.placed.keys())n.add(Xg(e,r));return n}function y_(e,t){if(t.length===0||e?.runtime!==`turn-idle`||e.lastFence?.kind!==`awaiting`)return!1;let n=Ts(e.lastFence.hints);return n.length===t.length&&n.every((e,n)=>e===t[n])}function b_(e){return e?.lastFence?.kind===`awaiting`&&Ts(e.lastFence.hints).length>0?!0:(e?.humanTodos??[]).some(e=>!e.done)}function x_(e,t){let n=e=>e.trim().replace(/\s+/g,` `);return n(e)===n(t)}var S_=Ds({}),C_=new Map,w_=5e3,T_=(e,t)=>`${e}\u0000${t}`;function E_(e){clearTimeout(C_.get(e)),C_.set(e,setTimeout(()=>D_(e),w_))}function D_(e){clearTimeout(C_.get(e)),C_.delete(e),delete S_[e]}function O_(e,t,n){let r=T_(e,t);clearTimeout(C_.get(r)),C_.delete(r),S_[r]={done:n},W.setHumanTodo({slug:e,id:t,done:n}).then(()=>E_(r),e=>{D_(r),K(`Couldn’t save that tick — ${e.message.slice(0,120)}`)})}function k_(e){let t=Xa(S_),n=e?.id,r=e?.humanTodos;return(0,q.useEffect)(()=>{if(n)for(let e of r??[]){let t=T_(n,e.id),r=S_[t];!r||r.done!==e.done||r.staged!==void 0&&r.staged!==e.staged||(r.reportedAt===void 0||(e.reportedAt??null)!==r.reportedWas)&&D_(t)}},[n,r]),e?(e.humanTodos??[]).map(n=>{let r=t[T_(e.id,n.id)];if(!r)return n;let i=r.staged??(r.done===n.done?n.staged:!n.staged);return{...n,done:r.done,staged:i,...r.reportedAt===void 0?{}:{reportedAt:r.reportedAt}}}):[]}function A_(e){return e.filter(e=>e.staged||!e.done)}function j_(e,t){let n=e.filter(e=>e.done).length,r=e.length===0?xa:`${xa} ${n} of ${e.length}:\n${e.map(e=>`- [${e.done?`x`:` `}] ${e.text}`).join(`
|
|
94
|
+
`)}`,i=t.trim();return i?`${r}\n\n${i}`:r}function M_(e){let t=Ho(Fr(e));return t?t.all?`all`:new Set(t.rows.filter(e=>e.done).map(e=>e.text)):null}function N_(e){let t=new Map;for(let n=0;n<e.length;n++){let r=e[n],i=r.role===`user`?M_(r.text):null;if(!i)continue;let a=P_(r.at);for(let r=n-1;r>=0;r--){let n=e[r];if(!(n.role!==`assistant`||n.kind===`event`||!n.text.trim())&&!(P_(n.at)>a&&a!==-1/0)){n.text.includes("```awaiting")&&!t.has(r)&&t.set(r,i);break}}}return t}var P_=e=>{let t=e?Date.parse(e):NaN;return Number.isFinite(t)?t:-1/0};function F_(e){let t=k_(e),n=t.some(e=>e.staged);return{staged:n,take:()=>{if(!e||!n)return null;let r=A_(t),i=r.map(t=>T_(e.id,t.id));return{todos:r.map(({id:e,done:t})=>({id:e,done:t})),compose:e=>j_(r,e),onOptimistic:()=>{let t=Date.now();r.forEach((n,r)=>{let a=e.humanTodos?.find(e=>e.id===n.id)?.reportedAt??null;clearTimeout(C_.get(i[r])),C_.delete(i[r]),S_[i[r]]={done:n.done,staged:!1,reportedAt:t,reportedWas:a}})},onSuccess:()=>i.forEach(e=>{S_[e]&&E_(e)}),onRollback:()=>i.forEach(D_)}}}}function I_(e,t=[],n=[]){let r=L_(e),i=r.filter(e=>e.kind===`github`),a=e.links??[];return{todos:e.humanTodos??[],agents:bc(e.subAgents??[],`card`),children:n,shells:Ke(e.bgShells??[],t),prs:i.filter(e=>e.subject!==`issue`),issues:i.filter(e=>e.subject===`issue`),commands:r.filter(e=>e.kind===`command`),timers:r.filter(e=>e.kind===`timer`),files:a.filter(e=>e.kind===`file`),links:a.filter(e=>e.kind===`link`)}}function L_(e){return!e||e.state===`archived`?[]:(e.watches??[]).filter(e=>e.state===`armed`)}function R_(e){let t=new Set(L_(e).filter(e=>e.kind===`shell`).map(e=>e.target));return e=>t.has(e.taskId??``)||t.has(e.id??``)||t.has(e.label)}var z_=`Watched — this thread wakes when it finishes`,B_=`icon-label-nudge`,V_=class{send=null;listeners=new Set;set(e){if(this.send===e)return;let t=this.send!==null;if(this.send=e,t!==(e!==null))for(let e of this.listeners)e()}run(){return this.send?(this.send(),!0):!1}present=()=>this.send!==null;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e))},H_=(0,q.createContext)(null),U_=(0,q.createContext)(null);function W_(){return(0,q.useState)(()=>new V_)[0]}function G_(e,t){let{stagedCount:n,takeAnswers:r}=t;return(0,q.useMemo)(()=>({composer:e,fencedCount:n,takeFenced:r}),[e,n,r])}function K_(e){return(0,q.useSyncExternalStore)(e.subscribe,e.present,J_)}var q_=()=>()=>{},J_=()=>!1;function Y_(){let e=(0,q.useContext)(U_);return(0,q.useSyncExternalStore)(e?.subscribe??q_,e?.present??J_,J_)}var X_=(0,q.createContext)(null),Z_=(0,q.createContext)(null),Q_=(0,q.createContext)(null),$_=/(^|[^\w/.@-])(https?:\/\/[^\s<>`]+|www\.[a-z0-9-]+(?:\.[a-z0-9-]+)+(?:[^\s<>`]*)?)/gi,ev=new Set([`.`,`,`,`:`,`;`,`!`,`?`,`*`,`_`,`~`,`'`,`"`]),tv={")":`(`,"]":`[`,"}":`{`};function nv(e){let t=e;for(;;){let e=t[t.length-1];if(e!==void 0&&ev.has(e)){t=t.slice(0,-1);continue}let n=e===void 0?void 0:tv[e];if(n){let r=0;for(let i of t)i===n?r++:i===e&&r--;if(r<0){t=t.slice(0,-1);continue}}break}return t}function rv(e,t,n){if(t===``)return;let r=0;for(let i of Se(t,n))i.start>r&&e.push({kind:`text`,text:t.slice(r,i.start)}),e.push({kind:`link`,text:i.text,href:i.href,title:i.title,ghRef:jt(i.href)}),r=i.start+i.text.length;r<t.length&&e.push({kind:`text`,text:t.slice(r)})}function iv(e,t){let n=[],r=0;$_.lastIndex=0;for(let i=$_.exec(e);i;i=$_.exec(e)){let[,a,o]=i,s=nv(o);if(/^https?:\/\/$/i.test(s)||s===``)continue;let c=i.index+a.length;$_.lastIndex=c+s.length;let l=/^www\./i.test(s)?`http://${s}`:s;c>r&&rv(n,e.slice(r,c),t),n.push({kind:`link`,text:s,href:l,ghRef:jt(l)}),r=c+s.length}return r<e.length&&rv(n,e.slice(r),t),n}function av({text:e}){let t=Mp(),n=(0,q.useMemo)(()=>iv(e,t),[e,t]),r=(0,q.useMemo)(()=>n.flatMap(e=>e.kind===`link`&&e.ghRef?[e.ghRef]:[]),[n]);return(0,q.useEffect)(()=>{r.length>0&&Yt(r)},[r]),(0,X.jsx)(X.Fragment,{children:n.map((e,t)=>e.kind===`text`?e.text:(0,X.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,title:e.title,"data-gh-ref":e.ghRef??void 0,className:`underline underline-offset-2`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:e.text},t))})}function ov({answers:e,queued:t,sourceId:n}){return(0,X.jsx)(sv,{label:`Answers`,queued:t,sourceId:n,"data-answers-card":!0,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-2.5`,children:Hn(e).map((e,t)=>(0,X.jsxs)(`div`,{"data-answer-id":e.handle,className:e.followUp?`ml-3 flex flex-col gap-1 border-l border-border pl-3`:`flex flex-col gap-1`,children:[e.question&&(0,X.jsx)(`div`,{title:e.question,className:`line-clamp-2 min-w-0 [overflow-wrap:anywhere] text-[11px] leading-snug text-muted`,children:e.question}),(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!e.question&&(0,X.jsx)(`span`,{className:`mt-1.5 shrink-0 text-[10px] uppercase tabular-nums tracking-wide text-muted-70`,children:e.n}),(0,X.jsx)(lv,{answer:e.answer})]})]},t))})})}function sv({label:e,queued:t,sourceId:n,children:r,...i}){return(0,X.jsx)(`div`,{...i,"data-frizz-msg":n,className:`self-end flex w-full max-w-[85%] flex-col items-end ${t?`opacity-50`:``}`,children:(0,X.jsxs)(`div`,{className:`w-full min-w-0 ${Um} rounded-br-sm border border-border-strong bg-elevated p-4`,children:[(0,X.jsx)(Ym,{icon:Kc,label:e}),(0,X.jsx)(th,{children:r})]})})}var cv=`min-w-0 [overflow-wrap:anywhere] rounded-md border border-border-strong border-l-2 border-l-accent/40 bg-bg/50 px-2.5 py-1.5 text-[12px] leading-snug text-fg`;function lv({answer:e}){let{picks:t,note:n}=y(e);return t.length===0?(0,X.jsx)(`span`,{className:`${cv} flex-1 whitespace-pre-wrap`,children:(0,X.jsx)(av,{text:e})}):(0,X.jsxs)(`div`,{className:`${cv} flex flex-1 flex-col`,children:[(0,X.jsx)(`ul`,{className:`flex flex-col gap-1`,children:t.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`mt-px flex h-3.5 w-3.5 shrink-0 self-start items-center justify-center rounded-[3px] border border-control-strong text-fg`,children:(0,X.jsx)(dt,{size:10,strokeWidth:3})}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,X.jsx)(av,{text:e})})]},t))}),n&&(0,X.jsx)(`div`,{className:`mt-1.5 whitespace-pre-wrap border-t border-border pt-1.5`,children:(0,X.jsx)(av,{text:n})})]})}var uv=`md-body ${Hm} mt-[var(--md-step)] first:mt-0`,dv=e=>!e.done||e.staged;function fv({steps:e,done:t}){let n=(0,q.useContext)(X_),r=Aa(n),i=(0,q.useMemo)(()=>n&&r?{id:n,humanTodos:r}:void 0,[n,r]),a=k_(i),o=e.map(e=>({step:e,todo:a.find(t=>x_(t.text,e.text))})),s=t?[...mv(a,o.map(({todo:e})=>e)),...o]:o,c=e=>(0,X.jsx)(`ul`,{className:`frizz-todos`,children:s.map(({step:n,todo:r},a)=>i&&r&&dv(r)?(0,X.jsx)(_v,{slug:i.id,todo:r,onTicked:e},a):(0,X.jsx)(gv,{step:n,done:r?.done===!0||t===`all`||t?.has(n.text)===!0},a))});return!i||!s.some(({todo:e})=>e&&dv(e))?(0,X.jsx)(`div`,{"data-awaiting-steps":!0,className:uv,children:c()}):(0,X.jsx)(bv,{thread:i,children:c})}function pv({rows:e,queued:t,sourceId:n}){return(0,X.jsx)(sv,{label:`Done ${e.filter(e=>e.done).length} of ${e.length}`,queued:t,sourceId:n,"data-steps-report":!0,children:(0,X.jsx)(`div`,{className:uv,children:(0,X.jsx)(`ul`,{className:`frizz-todos`,children:e.map((e,t)=>(0,X.jsx)(gv,{step:{text:e.text},done:e.done},t))})})})}function mv(e,t){let n=Math.max(...t.map(e=>e?.reportedAt??-1/0));return Number.isFinite(n)?e.filter(e=>e.reportedAt===n&&!t.some(t=>t?.id===e.id)).map(e=>({step:{text:e.text,...e.body?{body:e.body}:{}},todo:e})):[]}function hv({md:e}){return(0,X.jsx)(kg,{className:`md-body frizz-todo-body`,html:Pp(e)})}function gv({step:e,done:t}){let n=Pp(e.text),r=(0,q.useId)();return(0,X.jsxs)(`li`,{"data-human-todo":!0,"data-done":t,className:`frizz-todo`,children:[(0,X.jsx)(`span`,{role:`checkbox`,"aria-checked":t,"aria-disabled":`true`,"aria-labelledby":r,className:Tv(t,!1),children:t&&(0,X.jsx)(Ev,{})}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{id:r,children:(0,X.jsx)(kg,{className:`md-body frizz-todo-text`,html:n})}),e.body&&!t&&(0,X.jsx)(hv,{md:e.body})]})]})}function _v({slug:e,todo:t,onTicked:n}){let r=Pp(t.text),i=(0,q.useId)();return(0,X.jsxs)(`li`,{"data-human-todo":!0,"data-done":t.done,"data-staged":t.staged,className:`frizz-todo`,children:[(0,X.jsxs)(`span`,{className:Tv(t.done,t.staged),children:[t.done&&(0,X.jsx)(Ev,{}),(0,X.jsx)(`button`,{type:`button`,role:`checkbox`,"aria-checked":t.done,"aria-labelledby":i,onClick:r=>{O_(e,t.id,!t.done),n?.(r)},onMouseDown:e=>e.preventDefault(),className:`absolute -inset-[5px] rounded-md outline-none focus-visible:ring-1 focus-visible:ring-focus-ink-60 pointer-coarse:-inset-[10px]`})]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{id:i,children:(0,X.jsx)(kg,{className:`md-body frizz-todo-text`,html:r})}),t.body&&(!t.done||t.staged)&&(0,X.jsx)(hv,{md:t.body})]})]})}function vv({thread:e,sends:t}){let n=k_(e);return(0,X.jsxs)(`div`,{"data-human-todo-list":!0,className:uv,children:[(0,X.jsx)(`ul`,{className:`frizz-todos`,children:n.map(t=>(0,X.jsx)(_v,{slug:e.id,todo:t},t.id))}),t&&(0,X.jsx)(xv,{thread:e})]})}function yv({thread:e,onReplied:t,onReplyFailed:n}){let r=k_(e),[i,a]=(0,q.useState)(!1),o=r.filter(e=>!dv(e)),s=r.filter(dv);return r.length===0?null:(0,X.jsx)(bv,{thread:e,onReplied:t,onReplyFailed:n,children:t=>(0,X.jsxs)(X.Fragment,{children:[o.length>0&&(0,X.jsx)(`button`,{type:`button`,"data-todos-earlier":!0,"aria-expanded":i,onClick:()=>a(e=>!e),onMouseDown:e=>e.preventDefault(),className:`mb-2 block rounded text-[12px] leading-[18px] text-muted-70 outline-none hover:text-fg/85 focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:i?`Hide completed`:`Show ${o.length} completed`}),(0,X.jsxs)(`ul`,{className:`frizz-todos`,children:[i&&o.map(n=>(0,X.jsx)(_v,{slug:e.id,todo:n,onTicked:t},n.id)),s.map(n=>(0,X.jsx)(_v,{slug:e.id,todo:n,onTicked:t},n.id))]})]})})}function bv({thread:e,onReplied:t,onReplyFailed:n,children:r}){let{staged:i}=F_(e),a=(0,q.useContext)(H_),o=Y_(),s=Cv(e,t,n),l=(0,q.useRef)(null);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{ref:l,"data-awaiting-steps":!0,tabIndex:-1,onKeyDown:e=>{if(!i||!c({key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.nativeEvent.keyCode}))return;let t=e.target;t.closest(`a`)||t.closest(`button[aria-expanded]`)||t.closest(`button[role=checkbox]`)?.getAttribute(`aria-checked`)!==`false`&&(e.preventDefault(),e.stopPropagation(),a?.composer.run()||s())},className:`${uv} outline-none`,children:r(e=>{let t=document.activeElement;t!==e.currentTarget&&!wv(t)&&l.current?.focus()})}),!o&&(0,X.jsx)(Sv,{staged:i,send:s})]})}function xv({thread:e}){let{staged:t}=F_(e),n=Cv(e);return(0,X.jsx)(`button`,{type:`button`,"data-steps-send":!0,disabled:!t,onClick:n,className:`mt-3.5 flex h-[46px] w-full items-center justify-center rounded-xl bg-fg text-[15.5px] font-semibold text-bg outline-none disabled:opacity-45`,children:`Send`})}function Sv({staged:e,send:t}){return(0,X.jsx)(ih,{"data-awaiting-steps-reply":!0,children:(0,X.jsx)(`button`,{type:`button`,"data-steps-send":!0,disabled:!e,onClick:t,onMouseDown:e=>e.preventDefault(),className:`${lh} disabled:opacity-40`,children:`Send`})})}function Cv(e,t,n){let{take:r}=F_(e),i=hn(e.id);return()=>{let e=r();e&&i.submit(e.compose(``),{todos:e.todos,onOptimistic:()=>{e.onOptimistic(),t?.()},onSuccess:e.onSuccess,onRollback:()=>{e.onRollback(),n?.()}})}}function wv(e){return e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement||e instanceof HTMLElement&&e.isContentEditable}function Tv(e,t){return`frizz-todo-box border transition-colors ${e?t?`border-accent bg-accent-fill text-on-accent`:`border-control-strong text-fg`:`border-control-strong bg-panel`}`}function Ev(){return(0,X.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,X.jsx)(dt,{size:12,strokeWidth:3})})}function Dv(e){return(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).length}function Ov(e,t={}){let n=(e.subAgents??[]).filter(e=>li(e)&&e.state===`running`).length,r=(e.bgShells??[]).filter(e=>e.state===`running`).length,i=t.watchers===!1?0:Dv(e),a=[n>0?`${n} sub-agent${n===1?``:`s`}`:null,r>0?`${r} background shell${r===1?``:`s`}`:null,i>0?`${i} PR watcher${i===1?``:`s`}`:null].filter(e=>e!==null);return a.length===0?`0 background shells`:a.length===1?a[0]:`${a.slice(0,-1).join(`, `)} and ${a[a.length-1]}`}function kv(e){return(e.subAgents??[]).some(e=>li(e)&&e.state===`running`)}function Av(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length}function jv(e){return kv(e)||Av(e)>0}function Mv(e,t){return Ts(t).length>0?Me:Nv(e)?hr:Ve}function Nv(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length>0&&!kv(e)&&Dv(e)===0&&Pv(e).length===0&&Fv(e).length===0}function Pv(e){return(e.watches??[]).filter(e=>e.kind===`timer`&&e.state===`armed`)}function Fv(e){return(e.watches??[]).filter(e=>e.kind===`command`&&e.state===`armed`)}var Iv={id:``,subAgents:[],bgShells:[],watches:[]},Lv=[];function Rv(e,t){let n=new Set((e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).map(e=>e.target));return at(t).filter(e=>!n.has(e.ref))}function zv({watch:e}){return(0,q.useEffect)(()=>{e.url&&Yt([e.ref])},[e.url,e.ref]),e.url?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,"data-gh-ref":e.ref,className:`${oh} text-[12px]`,children:e.ref}):(0,X.jsx)(`span`,{className:`text-[12px] text-muted`,children:e.ref})}var Bv={mergeable:`no conflicts`,blocked:`merge blocked`,conflicting:`has conflicts`,unknown:null};function Vv(e){return e.state!==`open`||e.merge===`blocked`&&e.checks!==`passing`&&e.checks!==`none`?null:Bv[e.merge]}var Z=`shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`;function Hv({tone:e}){return(0,X.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 rounded-full border ${e} border-t-transparent motion-safe:animate-spin ${Z}`})}function Uv(){return(0,X.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 16 16`,width:12,height:12,fill:`none`,stroke:`currentColor`,overflow:`visible`,className:Z,style:{color:_.fgAttention},children:[(0,X.jsx)(`circle`,{cx:`8`,cy:`8`,r:`4`,fill:`currentColor`,stroke:`none`}),(0,X.jsxs)(`g`,{strokeWidth:`2`,className:`origin-center motion-safe:animate-spin`,children:[(0,X.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`,opacity:`0.25`}),(0,X.jsx)(`path`,{d:`M15 8A7 7 0 0 1 8 15`})]})]})}function Wv({status:e,now:t}){return e?e.state===`merged`?(0,X.jsx)(Pa,{size:12,className:Z,style:{color:_.fgDone}}):e.state===`closed`?(0,X.jsx)(g,{size:12,className:Z,style:{color:_.fgDanger}}):Wr(e,t)||e.newHeadSince?(0,X.jsx)(rr,{size:12,className:`${Z} text-muted-60`}):e.checks===`failing`?(0,X.jsx)(Fc,{size:12,className:Z,style:{color:_.fgDanger}}):e.checks===`passing`?(0,X.jsx)(Re,{size:12,className:Z,style:{color:_.fgSuccess}}):e.gated>0&&e.running===0?(0,X.jsx)(Pc,{size:12,className:Z,style:{color:_.fgAttention}}):e.checks===`running`?(0,X.jsx)(Uv,{}):(0,X.jsx)(rr,{size:12,className:`${Z} text-muted-60`}):(0,X.jsx)(rr,{size:12,className:`${Z} text-muted-60`})}function Gv(e){return[e.failed>0?`${e.failed} failing`:null,e.gated>0?`${e.gated} awaiting approval`:null,e.running>0?`${e.running} in progress`:null,e.passed>0?`${e.passed} successful`:null,e.skipped>0?`${e.skipped} skipped`:null].filter(e=>e!==null).join(`, `)}function Kv(e,t=Date.now()){if(!e)return`Checking…`;if(e.state===`merged`)return`Merged`;if(e.state===`closed`)return`Closed`;let n=e.head?lr(e.head):void 0,r=Gv(e),i=Vv(e),a=[e.newHeadSince?`Waiting for CI${n?` on ${n}`:``}`:r||`No checks`,i].filter(e=>e!==null).join(` · `),o=n&&!e.newHeadSince?` · on ${n}`:``;return Wr(e,t)?`Last read ${Ie(e.polledAt,t)}: ${a}${o}`:`${a}${o}`}function qv(e,t=Date.now()){if(!e)return`Checking…`;if(e.state===`open`&&e.failed===0&&!Wr(e,t)){if(e.merge===`conflicting`)return`conflicts`;if(e.merge===`blocked`&&e.checks===`passing`)return`blocked`}return Lt(e,t)}var Jv=`group relative flex items-baseline rounded-sm px-2 text-[12px] leading-5`,Yv=`ml-1.5 font-medium text-fg/90`,Xv=`${Yv} line-clamp-2 break-words`,Zv=`${Yv} min-w-0 flex-1 truncate`,Qv=`ml-3 min-w-0 truncate text-right text-muted-70`,$v=`min-w-1/2 flex-1`,ey=`outline-none after:absolute after:inset-0 after:rounded-sm focus-visible:after:ring-1 focus-visible:after:ring-fg/60`;function ty(){return(0,X.jsx)(fr,{size:13,"aria-hidden":!0,className:`${Z} pointer-events-none ml-[3px] -mr-[4px] text-muted-35 transition-colors group-hover:text-muted-70`})}function ny({mark:e,name:t,status:n,onOpen:r,onPrewarm:i,href:a,ghRef:o,title:s,testKind:c,testId:l,indent:u,dismiss:d,oneLine:f,dragPath:p}){let m=u!==void 0,h=f?`${Yv} truncate`:Xv,g=m?Zv:d?`${h} min-w-0`:`${h} ${$v}`,_=a?(0,X.jsx)(`a`,{href:a,target:`_blank`,rel:`noreferrer noopener`,title:s,"data-gh-ref":o,onMouseDown:e=>e.stopPropagation(),className:`${g} ${ey} group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):r?(0,X.jsx)(`button`,{type:`button`,onClick:r,onMouseDown:e=>e.stopPropagation(),...p?Ko(p):{},title:s,className:`${g} ${ey} text-left group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):(0,X.jsx)(`span`,{className:g,title:s,children:t}),v=!!(a||r),y=d&&(0,X.jsx)(`button`,{type:`button`,onClick:d.onDismiss,onMouseDown:e=>e.stopPropagation(),title:d.title,"aria-label":d.label,className:`relative ml-0.5 shrink-0 self-start mt-[2.5px] rounded-sm p-0.5 text-muted-45 outline-none transition-colors hover:text-fg focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:(0,X.jsx)(zs,{size:11})});return(0,X.jsxs)(`div`,{"data-wait-row":l,"data-wait-kind":c,onMouseEnter:i,onFocus:i,style:m?{paddingLeft:8+u}:void 0,className:`${Jv} ${v?`cursor-pointer transition-colors hover:bg-fg/[0.045]`:``}`,children:[(0,X.jsx)(`span`,{className:`flex shrink-0`,children:e}),y?(0,X.jsxs)(`span`,{className:`flex items-baseline ${$v}`,children:[_,y]}):_,(0,X.jsx)(`span`,{"data-wait-status":!0,className:Qv,children:n}),v?(0,X.jsx)(ty,{}):(0,X.jsx)(`span`,{"aria-hidden":!0,className:`w-3 shrink-0`})]})}function ry({status:e}){return e?e.state===`closed`?e.stateReason===`not_planned`||e.stateReason===`duplicate`?(0,X.jsx)(xn,{size:12,className:`${Z} text-muted`}):(0,X.jsx)(Re,{size:12,className:Z,style:{color:_.fgDone}}):(0,X.jsx)(T,{size:12,className:Z,style:{color:_.fgSuccess}}):(0,X.jsx)(rr,{size:12,className:`${Z} text-muted-60`})}function iy(e){if(!e)return`Checking…`;if(e.state===`closed`){let t=e.stateReason===`not_planned`?`not planned`:e.stateReason===`duplicate`?`duplicate`:null;return t?`Closed as ${t}`:`Closed`}return`Open · ${e.comments} comment${e.comments===1?``:`s`}`}function ay({watch:e}){if(e.subject===`issue`)return(0,X.jsx)(oy,{watch:e});let t=e.github,n=Mr(e.target),r=Wo();return(0,q.useEffect)(()=>{n&&Yt([e.target])},[n,e.target]),(0,X.jsx)(ny,{testKind:`github`,testId:e.target,mark:(0,X.jsx)(Wv,{status:t,now:r}),name:e.target,href:n??void 0,ghRef:n?e.target:void 0,title:n?`Open ${e.target} on GitHub — ${Kv(t,r)}`:e.target,status:t&&t.state===`open`&&t.failed>0&&n&&!Wr(t,r)?(0,X.jsx)(`a`,{href:`${n}/checks`,target:`_blank`,rel:`noreferrer noopener`,title:`View the failing checks on ${e.target}`,onMouseDown:e=>e.stopPropagation(),className:`relative underline underline-offset-2 ${Fa}`,children:qv(t,r)}):qv(t,r)})}function oy({watch:e}){let t=e.issue,n=Mr(e.target,`issue`);return(0,q.useEffect)(()=>{n&&Yt([e.target])},[n,e.target]),(0,X.jsx)(ny,{testKind:`github`,testId:`issue:${e.target}`,mark:(0,X.jsx)(ry,{status:t}),name:t?.title?`${e.target} ${t.title}`:e.target,href:n??void 0,ghRef:n?e.target:void 0,title:n?`Open ${e.target} on GitHub — ${iy(t)}`:e.target,status:t?ye(t):`Checking…`})}function sy(e,t){return(e.bgShells??[]).find(e=>e.id===t||e.taskId===t||e.label===t)}function cy(e){return(e.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`)}function ly({watch:e,thread:t,slug:n,now:r}){let i=sy(t,e.target);if(i)return(0,X.jsx)(dy,{shell:i,slug:n,now:r,testId:e.target});let a=en(e.createdAt,r);return(0,X.jsx)(ny,{testKind:`shell`,testId:e.target,mark:(0,X.jsx)(ll,{size:12,className:`${Z} text-shell`}),name:e.target,title:e.target,status:a})}function uy(e,t,n,r,i){if(!e||t&&n)return;let a=t?`running`:`settled`;return{onDismiss:e,title:aa[a],label:`${qr[a]} ${ha[r]}: ${i}`}}function dy({shell:e,slug:t,now:n,testId:r,onDismiss:i,watched:a}){let o=en(e.startedAt,n),s=e.state===`running`,c=e.id&&!e.outputUnavailable,l=s?`running for ${o}`:qs;return(0,X.jsx)(ny,{testKind:`shell`,testId:r??e.id??e.label,mark:(0,X.jsx)(ll,{size:12,className:`${Z} ${s?`text-shell`:`text-muted-60`}`}),name:e.label,onOpen:c?()=>fs(t,e.id,{label:e.label,startedAt:e.startedAt,monitor:e.monitor}):void 0,title:[c?`${e.monitor?`Read this monitor's events`:`Read this shell's output`} — ${l}`:s?e.label:`${e.label} — ${l}`,a?z_:null].filter(Boolean).join(`
|
|
95
|
+
`),status:o,dismiss:uy(i,s,!!c,`SHELL`,e.label)})}function fy({watch:e,slug:t,now:n}){let r=py(e);return(0,X.jsx)(ny,{testKind:`timer`,testId:e.target,mark:(0,X.jsx)(bt,{size:12,className:`${Z} text-muted-60`}),name:r,oneLine:!0,title:my(e),status:hy(e,n),onOpen:()=>Pi(t,e.target,{label:r})})}function py(e){return e.timer?.description||e.timer?.prompt?.split(`
|
|
96
|
+
`)[0]?.trim()||e.target}function my(e){return[`Read this timer's prompt — ${py(e)}`,e.timer?.fireAt?`One-off timer, set for ${e.timer.fireAt}`:null].filter(Boolean).join(`
|
|
97
|
+
|
|
98
|
+
`)}function hy(e,t){let n=Date.parse(e.timer?.fireAt??``);return Number.isFinite(n)?n>t?`in ${vt(n-t)}`:`firing…`:`armed`}function gy(e){return e.trim().replace(/\s+/g,` `).replace(/(^|[\s'"=])\/(?:[^\s'"/]*\/){2,}(?=[^\s'"/])/g,`$1`)}function _y(e){return e.command?.description||e.command?.monitor?.description||gy(e.command?.command??e.target)}function vy({watch:e,slug:t,now:n}){let r=e.command?.monitor?P:An,i=_y(e);return(0,X.jsx)(ny,{testKind:`command`,testId:e.target,mark:(0,X.jsx)(r,{size:12,className:`${Z} text-muted-60`}),name:i,oneLine:!0,title:yy(e,n),status:by(e),onOpen:()=>eo(t,e.target,{label:i})})}function yy(e,t){let n=e.command,r=n?.monitor;if(n&&r){let e=r.lastEvent;return[n.command,`Kept running by Frizz; every line it prints wakes the thread.`,e?`${r.events} event${r.events===1?``:`s`} so far. The last, ${en(e.at,t)} ago:`:`No events yet.`,e?.text.trim()||null].filter(Boolean).join(`
|
|
99
|
+
|
|
100
|
+
`)}let i=n?.lastRun,a=n&&i?`${n.runs} check${n.runs===1?``:`s`} so far. The last, ${en(i.at,t)} ago, ${No(i)}.`:null;return[n?.command??e.target,n?`Re-run every ${n.every} until it exits 0.`:null,a,i?.output.trim()||null].filter(Boolean).join(`
|
|
101
|
+
|
|
102
|
+
`)}function by(e){let t=e.command?.monitor;return t?t.events===0?`running`:`${t.events} event${t.events===1?``:`s`}`:e.command?`every ${e.command.every}`:`armed`}function xy(e){return(e.subAgents??[]).filter(e=>li(e)&&e.state===`running`)}function Sy({agent:e,slug:t,now:n,onDismiss:r}){let i=en(e.startedAt,n),a=Vi(e.subagentType),o=e.state===`stale`;return(0,X.jsx)(ny,{testKind:`agent`,testId:e.id??e.label,mark:o?(0,X.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 p-[3px] ${Z}`,children:(0,X.jsx)(`span`,{className:N})}):(0,X.jsx)(Hv,{tone:`border-accent`}),name:e.label,onOpen:e.id?()=>js(t,e.id,{label:e.label,subagentType:e.subagentType,startedAt:e.startedAt}):void 0,title:e.id?`Open this sub-agent${a?` (${a})`:``} — ${o?Rn:`working for ${i}`}`:e.label,status:i,dismiss:uy(r,e.state===`running`,!!e.id,`AGENT`,e.label)})}function Cy({child:e,now:t}){let n=io(e),r=us(e),i=en(Oo(e),t),a=r===`running`?(0,X.jsx)(Hv,{tone:`border-accent`}):(0,X.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 p-[3px] ${Z}`,children:(0,X.jsx)(`span`,{className:r===`stale`?N:nc})}),o=Si(e),s=e.needsYou?ue:r===`running`?i:r===`stale`?`stale`:o?Ha:`rested`;return(0,X.jsx)(ny,{testKind:`thread`,testId:e.id,mark:a,name:n,onOpen:()=>ai(e.id),title:`Open child thread — ${r===`running`?`working for ${i}`:r===`stale`?Kt:e.needsYou?ue:o?h:re}`,status:s})}function wy(e,t,n){let r=new Set(n.map(e=>e.target)),i=[];for(let n of t){if(n.kind!==`shell`)continue;let t=n.value.trim();if(!t||r.has(t))continue;let a=sy(e,t);!a||a.state!==`running`||(r.add(t),i.push({id:`shell:${e.id}:${t}`,kind:`shell`,target:t,state:`armed`,createdAt:a.startedAt}))}return i}function Ty(e,t={}){let n=(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`),r=n.filter(e=>e.subject!==`issue`),i=n.filter(e=>e.subject===`issue`),a=cy(e),o=[...a,...wy(e,t.hints??[],a)],s=xy(e),c=new Set((t.hints??[]).filter(e=>e.kind===`thread`).map(e=>e.value));return{prs:r,issues:i,shells:o,agents:s,children:(t.childThreads??[]).filter(e=>us(e)===`running`||c.has(e.id)),timers:Pv(e),commands:Fv(e)}}function Ey(e,t,n={}){let{prs:r,issues:i,shells:a,agents:o,children:s,timers:c,commands:l}=Ty(e,n);return[{head:`Sub-agents`,rows:o.map(n=>(0,X.jsx)(Sy,{agent:n,slug:e.id,now:t},n.id??n.label))},{head:`Child threads`,rows:s.map(e=>(0,X.jsx)(Cy,{child:e,now:t},e.id))},{head:`Background shells`,rows:a.map(n=>(0,X.jsx)(ly,{watch:n,thread:e,slug:e.id,now:t},n.id))},{head:`Pull requests`,rows:r.map(e=>(0,X.jsx)(ay,{watch:e},e.id))},{head:`Issues`,rows:i.map(e=>(0,X.jsx)(ay,{watch:e},e.id))},{head:`Monitors`,rows:l.map(n=>(0,X.jsx)(vy,{watch:n,slug:e.id,now:t},n.id))},{head:`Timers`,rows:c.map(n=>(0,X.jsx)(fy,{watch:n,slug:e.id,now:t},n.id))}].filter(e=>e.rows.length>0)}function Dy({group:e,first:t}){let n=`px-2 text-[10.5px] uppercase tracking-wide text-muted-45 ${t?``:`mt-4`}`;return e.onToggle?(0,X.jsxs)(`button`,{type:`button`,title:e.title,onClick:e.onToggle,"aria-expanded":!e.collapsed,onMouseDown:e=>e.stopPropagation(),className:`${n} flex items-baseline rounded-sm text-left transition-colors hover:text-muted-80`,children:[(0,X.jsx)(`span`,{children:e.head}),e.count!==void 0&&(0,X.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.count}),(0,X.jsx)(fr,{size:10,"aria-hidden":!0,className:`${Z} ml-[5px] transition-transform ${e.collapsed?``:`rotate-90`}`})]}):(0,X.jsx)(`div`,{className:n,title:e.title,children:e.head})}function Oy({groups:e,divider:t}){return e.length===0?null:(0,X.jsxs)(X.Fragment,{children:[t&&(0,X.jsx)(`div`,{"aria-hidden":!0,className:`-mx-4 mt-3 border-t border-border`}),(0,X.jsx)(`div`,{className:`-mx-2 mt-3 flex flex-col gap-y-px`,children:e.map((e,t)=>(0,X.jsxs)(q.Fragment,{children:[(0,X.jsx)(Dy,{group:e,first:t===0}),!e.collapsed&&e.rows]},e.head))})]})}function ky(e){return e?.lastFence?.kind===`awaiting`&&mt(e.lastFence.hints)?!1:e?.awaitingBackground===!0&&e.runtime===`turn-idle`&&e.bgSnoozed!==!0}var Ay=`Hides card until new activity is detected`;function jy({thread:e,onSnooze:t,onSnoozeFailed:n}){let[r,i]=(0,q.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{i(!0),t?.(),W.snoozeAwaitingBackground({slug:e.id,sessionId:e.sessionId??``}).then(()=>K(`Snoozed until the background work returns`)).catch(e=>{n?.(),K(`Couldn’t snooze: ${e.message.slice(0,80)}`),i(!1)})},disabled:r,onMouseDown:e=>e.preventDefault(),title:Ay,className:`disabled:opacity-45 ${lh}`,children:[(0,X.jsx)(ie,{size:12,className:B_}),`Snooze`]}),(0,X.jsx)(`span`,{className:ah,children:Ay})]})}var My=`The agent parked it until it wakes`;function Ny(){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 py-1 text-[11px] font-medium text-muted`,children:[(0,X.jsx)(ie,{size:12,className:B_}),`Snoozed`]}),(0,X.jsx)(`span`,{className:ah,children:My})]})}function Py({thread:e,fence:t,onSnooze:n,onSnoozeFailed:r,onReplied:i,onReplyFailed:a,stepsDone:o}){let s=e??Iv,c=t??(e?.lastFence?.kind===`awaiting`?e.lastFence:void 0),l=c?.hints??Lv,u=Ts(l),d=wo(l),f=e!==void 0&&y_(e,u),p=kv(s),m=Jo(c?.body),h=Pp(m??``),g=Wo(),_=u.length===0,v=Ws(s.id),y=_?Ey(s,g,{hints:l,childThreads:v}):[],b=_?Rv(s,l):[],x=e!==void 0&&t===void 0&&u.length===0&&ky(e)&&sn(e).snooze,S=x&&e.waitStatus===`watching`,C=x&&!S;return(0,X.jsxs)(nh,{"data-awaiting-background":!0,icon:u.length>0?qc:Nv(s)?ll:ie,kind:Mv(s,l),label:d?(0,X.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:d}):null,children:[m?(0,X.jsx)(kg,{className:`md-body ${Hm}`,html:h}):y.length===0&&!jv(s)&&u.length===0?(0,X.jsx)(`p`,{className:rh,children:Zn}):null,u.length>0&&(f?(0,X.jsx)(yv,{thread:e,onReplied:i,onReplyFailed:a}):(0,X.jsx)(fv,{steps:Ja(l),done:o})),b.length>0&&(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:b.map(e=>(0,X.jsx)(zv,{watch:e},e.ref))}),_&&y.length===0&&jv(s)&&(0,X.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75`,children:p?(0,X.jsxs)(X.Fragment,{children:[`It’s awaiting the results from `,Ov(s,{watchers:!1}),` it dispatched. It returns to the queue on its own when the work comes back.`]}):(0,X.jsxs)(X.Fragment,{children:[Ov(s,{watchers:!1}),` `,Av(s)===1?`is`:`are`,` still running. It resumes on its own when`,` `,Av(s)===1?`it finishes`:`one of them finishes`,`.`]})}),(0,X.jsx)(Oy,{groups:y,divider:!!m}),C?(0,X.jsx)(ih,{"data-awaiting-snooze":!0,children:(0,X.jsx)(jy,{thread:e,onSnooze:n,onSnoozeFailed:r})}):S?(0,X.jsx)(ih,{"data-awaiting-parked":!0,children:(0,X.jsx)(Ny,{})}):null]})}function Fy(e){let t=e?Date.parse(e):NaN;return Number.isFinite(t)?t:null}function Iy(e,t){let n=Fy(e),r=Fy(t);return n===null||r===null?null:new Date(n).toDateString()!==new Date(r).toDateString()||r-n>=12e5?t:null}function Ly(e,t){let n=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();return Math.round((n(t)-n(e))/864e5)}function Ry(e,t=new Date,n){let r=new Date(Date.parse(e)),i=r.toLocaleTimeString(n,{hour:`numeric`,minute:`2-digit`}),a=Ly(r,t);return{day:a===0?`Today`:a===1?`Yesterday`:a>1&&a<7?r.toLocaleDateString(n,{weekday:`long`}):r.toLocaleDateString(n,r.getFullYear()===t.getFullYear()?{month:`short`,day:`numeric`}:{month:`short`,day:`numeric`,year:`numeric`}),time:i}}function zy(e,t=new Date,n){let r=Fy(e);if(r===null)return null;let i=new Date(r),a=i.toLocaleTimeString(n,{hour:`numeric`,minute:`2-digit`}),o=Ly(i,t);return`${o===0?`Today`:o===1?`Yesterday`:i.toLocaleDateString(n,i.getFullYear()===t.getFullYear()?{weekday:`long`,month:`long`,day:`numeric`}:{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})} at ${a}`}function Q({icon:e,children:t,sourceId:n,ariaLabel:r,marker:i,at:a,trailing:o,onClick:s,ariaExpanded:c,ariaControls:l}){let u=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:Vy}),(0,X.jsx)(By,{icon:e,at:a,trailing:o,children:t}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:Vy})]});return s?(0,X.jsx)(`button`,{type:`button`,"data-wake-divider":i,onClick:s,onMouseDown:e=>e.preventDefault(),"aria-label":r,"aria-expanded":c,"aria-controls":l,className:`group/wake @container/wake my-1 flex w-full items-center gap-3 rounded-sm text-left outline-none focus-visible:ring-1 focus-visible:ring-focus-ink-60 pointer-coarse:-my-0.5 pointer-coarse:py-1.5`,children:u}):(0,X.jsx)(`div`,{"data-frizz-msg":n,"data-wake-divider":i,className:`@container/wake my-1 flex items-center gap-3`,role:r?`separator`:void 0,"aria-label":r,children:u})}function By({icon:e,children:t,at:n,trailing:r}){return(0,X.jsxs)(`span`,{className:`petite-caps flex min-w-0 items-center gap-1 overflow-x-clip break-words text-center text-[12px] text-muted-70 transition-colors group-hover/wake:text-fg${r?` pr-px`:``}`,children:[e&&(0,X.jsx)(e,{"aria-hidden":`true`,size:12,className:`shrink-0 translate-y-[0.04em]`}),t,(0,X.jsx)(qy,{at:n}),r]})}var Vy=`h-px min-w-[50px] flex-1 bg-border/70 transition-colors group-hover/wake:bg-border`,Hy=`@max-[34rem]/wake:hidden`,Uy=`@min-[34rem]/wake:hidden`,Wy=`@max-[19.5rem]/wake:hidden`;function Gy({open:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50 ${Wy}`,children:`·`}),(0,X.jsxs)(`span`,{className:`shrink-0 ${Wy}`,children:[(0,X.jsx)(`span`,{className:Hy,children:`Click to `}),e?`collapse`:`expand`]})]})}function Ky({lead:e,title:t,tail:n,note:r}){return(0,X.jsxs)(X.Fragment,{children:[e&&(0,X.jsxs)(`span`,{className:`shrink-0 @max-[34rem]/wake:hidden`,children:[e,` `]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center`,title:t,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`«`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`»`})]}),n&&(0,X.jsxs)(`span`,{className:`shrink-0`,children:[` `,n]}),r&&(0,X.jsxs)(`span`,{className:`shrink-0 @max-[34rem]/wake:hidden`,children:[` `,r]})]})}function qy({at:e}){let t=Ie(e,Wo());return t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50`,children:`·`}),(0,X.jsx)(`span`,{title:zy(e)??void 0,className:`shrink-0 tabular-nums`,children:t})]}):null}var Jy=`shrink-0 translate-y-[0.04em]`;function Yy({bump:e,sourceId:t,at:n}){let r=e.kind===`schedule`;if(e.kind===`signoff`){let e=`Frizz asked for a sign-off`;return(0,X.jsx)(Q,{icon:ol,sourceId:t,marker:`rest`,ariaLabel:e,at:n,children:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,X.jsx)(`span`,{className:Hy,children:e}),(0,X.jsx)(`span`,{className:Uy,children:`Sign-off requested`})]})})}let i=r?`Goal${e.every?` · every ${e.every}`:``}`:`Goal · at rest`;return(0,X.jsx)(Q,{icon:r?fi:rl,sourceId:t,marker:r?`schedule`:`rest`,ariaLabel:i,at:n,children:(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:i})})}function Xy({h:e=14}){return(0,X.jsx)(`div`,{"aria-hidden":!0,className:`shrink-0`,style:{height:e}})}function Zy(e,t,n){return e===1?n?`New ${t} from @${n}`:`New ${t}`:`${e} new items`}var Qy=`rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`;function $y({steer:e,text:t,sourceId:n,at:r}){let i=p(t);if(i)return(0,X.jsx)(eb,{parts:i,sourceId:n,at:r});let a=vc(t);if(a)return(0,X.jsx)(Yy,{bump:a,sourceId:n,at:r});let o=S(t);if(o)return(0,X.jsx)(hb,{wake:o,sourceId:n,at:r});let s=er(t);if(s)return(0,X.jsx)(nb,{wake:s,sourceId:n});let c=Ba(t);if(c)return(0,X.jsx)(pb,{window:c.window,sourceId:n,at:r});let l=Wt(t);if(l)return(0,X.jsx)(mb,{capped:l.capped,to:l.to,sourceId:n,at:r});let u=Ft(t);if(u)return(0,X.jsx)(ib,{wake:u,sourceId:n,at:r});let d=$t(t);if(d)return(0,X.jsx)(ab,{watchRef:d.ref,sourceId:n,at:r});let f=_e(t);if(f)return(0,X.jsx)(ab,{watchRef:f.ref,sentence:`Not found — watcher ended`,sourceId:n,at:r});let m=Et(t);if(m)return(0,X.jsx)(lb,{kind:m.kind,sourceId:n,at:r});let h=In(t);if(h)return(0,X.jsx)(ub,{wake:h,sourceId:n,at:r});let g=ja(t);if(g)return(0,X.jsx)(db,{wake:g,sourceId:n,at:r});let _=te(t);if(_)return(0,X.jsx)(fb,{agents:_.agents,sourceId:n,at:r});let v=vn(t);if(v)return(0,X.jsx)(rb,{count:v.count,sourceId:n,at:r});let y=_t(t),b=We(t),x=e??ce(y||b?t.split(`
|
|
103
|
+
`).filter(e=>!_t(e)&&!We(e)).join(`
|
|
104
|
+
`):t);return!x&&!y&&!b?(0,X.jsx)(`div`,{"data-frizz-msg":n,"data-frizz-wake":!0,className:`min-w-0 max-w-[85%]`,children:(0,X.jsx)(nh,{icon:Oc,label:`Frizz`,children:(0,X.jsx)(tb,{text:$e(t)})})}):y||b?(0,X.jsxs)(`div`,{"data-frizz-wake":!0,className:`flex flex-col`,children:[y&&(0,X.jsx)(gb,{wake:y,sourceId:n,at:r}),b&&(0,X.jsxs)(X.Fragment,{children:[y&&(0,X.jsx)(Xy,{}),(0,X.jsx)(_b,{wake:b,sourceId:y?void 0:n,at:r})]}),x&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xy,{}),(0,X.jsx)(vb,{steer:x,text:t,at:r})]})]}):(0,X.jsx)(vb,{steer:x,text:t,sourceId:n,at:r})}function eb({parts:e,sourceId:t,at:n}){let r=e.map(e=>$e(e.body)).filter(e=>!j(e)&&!Dn(e));return r.length?(0,X.jsx)(`div`,{"data-frizz-wake":`merged`,className:`flex flex-col`,children:r.map((e,r)=>(0,X.jsxs)(q.Fragment,{children:[r>0&&(0,X.jsx)(Xy,{}),(0,X.jsx)($y,{text:e,sourceId:r===0?t:void 0,at:n})]},r))}):null}function tb({text:e}){let t=Pp(e),n=Sm(t),r=(0,q.useRef)(null),i=jh(r,t);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{ref:r,className:`md-body [overflow-wrap:anywhere]`,dangerouslySetInnerHTML:n}),i]})}function nb({wake:e,sourceId:t}){let[n,r]=(0,q.useState)(!1),i=(0,q.useId)();return(0,X.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,X.jsxs)(Q,{icon:nt,marker:`timer`,at:e.at,onClick:()=>r(e=>!e),ariaExpanded:n,ariaControls:i,ariaLabel:`${n?`Collapse`:`Expand`} the text this timer handed back`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`Timer`}),(0,X.jsx)(Gy,{open:n})]}),n&&(0,X.jsx)(`div`,{id:i,className:`mt-1.5 whitespace-pre-wrap border-l border-border/70 pl-3 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.prompt})]})}function rb({count:e,sourceId:t,at:n}){let r=`${e} question${e===1?``:`s`} cancelled`,i=` — the worker decides ${e===1?`it`:`them`} itself`;return(0,X.jsx)(Q,{icon:Yc,sourceId:t,marker:`event`,ariaLabel:`${r}${i}`,at:n,children:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r,(0,X.jsx)(`span`,{className:Hy,children:i})]})})}function ib({wake:e,sourceId:t,at:n}){let[r,i]=(0,q.useState)(!1),a=(0,q.useId)(),o=e.kind===`expired`?`Wait expired`:`Wait over`,s=e.kind===`expired`?` — nothing resolved`:` — its work finished`,c=(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[o,(0,X.jsx)(`span`,{className:Hy,children:s})]});return e.items.length?(0,X.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,X.jsxs)(Q,{icon:ie,marker:`event`,at:n,onClick:()=>i(e=>!e),ariaExpanded:r,ariaControls:a,ariaLabel:`${r?`Collapse`:`Expand`} what this wait named`,children:[c,(0,X.jsx)(Gy,{open:r})]}),r&&(0,X.jsx)(`div`,{id:a,className:`mt-1.5 whitespace-pre-wrap border-l border-border/70 pl-3 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.items.join(`
|
|
105
|
+
`)})]}):(0,X.jsx)(Q,{icon:ie,sourceId:t,marker:`event`,ariaLabel:`${o}${s}`,at:n,children:c})}function ab({watchRef:e,sentence:t=`Watcher expired`,sourceId:n,at:r}){let i=Mr(e);return(0,X.jsx)(Q,{icon:qt,sourceId:n,marker:`event`,ariaLabel:`${t} on ${e}`,at:r,children:(0,X.jsx)(ob,{sentence:t,children:i?(0,X.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:Qy,children:(0,X.jsx)(cb,{value:e})}):(0,X.jsx)(cb,{value:e})})})}function ob({sentence:e,children:t}){return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),(0,X.jsxs)(`span`,{className:`shrink-0 whitespace-pre`,children:[(0,X.jsx)(sb,{}),` `,t]})]})}function sb(){return(0,X.jsx)(`span`,{className:Hy,children:` on`})}function cb({value:e}){let t=e.lastIndexOf(`#`);return t<=0?(0,X.jsx)(X.Fragment,{children:e}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:Hy,children:e.slice(0,t)}),e.slice(t)]})}function lb({kind:e,sourceId:t,at:n}){let r=` on a ${e===`agent`?`sub-agent`:`background shell`}`;return(0,X.jsx)(Q,{icon:e===`agent`?kc:ll,sourceId:t,marker:`event`,ariaLabel:`Watch expired${r}`,at:n,children:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Watch expired`,(0,X.jsx)(`span`,{className:Hy,children:r})]})})}function ub({wake:e,sourceId:t,at:n}){let[r,i]=(0,q.useState)(!1),a=(0,q.useId)(),o=e.kind===`cancelled`?`stopped`:e.kind;return(0,X.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,X.jsxs)(Q,{icon:An,marker:`event`,at:n,onClick:()=>i(e=>!e),ariaExpanded:r,ariaControls:a,ariaLabel:`${r?`Collapse`:`Expand`} how this monitor ended`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate ${Uy}`,children:`${o.charAt(0).toUpperCase()}${o.slice(1)}`}),(0,X.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 ${Hy}`,children:(0,X.jsx)(Ky,{lead:`Monitor`,title:gy(e.command),tail:e.kind===`cancelled`?`stopped by Frizz`:o})}),(0,X.jsx)(Gy,{open:r})]}),r&&(0,X.jsxs)(`div`,{id:a,className:`mt-1.5 flex flex-col gap-1.5 border-l border-border/70 pl-3 text-[13px] text-muted [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`div`,{className:`whitespace-pre-wrap font-mono text-[12px]`,children:e.command}),(0,X.jsx)(`div`,{children:e.summary}),e.output!==void 0&&(0,X.jsx)(`div`,{className:`whitespace-pre-wrap font-mono text-[12px]`,children:e.output})]})]})}function db({wake:e,sourceId:t,at:n}){let[r,i]=(0,q.useState)(!1),a=(0,q.useId)(),o=`${e.count} line${e.count===1?``:`s`}`,s=e.kind===`event`?o:e.kind===`exited`?`Ended`:e.kind===`expired`?`Expired`:`Stopped`,c=e.kind===`event`?o:e.kind===`exited`?`ended`:e.kind===`expired`?`expired`:e.by===`human`?`stopped by you`:`stopped by Frizz`;return(0,X.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,X.jsxs)(Q,{icon:P,marker:`event`,at:n,onClick:()=>i(e=>!e),ariaExpanded:r,ariaControls:a,ariaLabel:`${r?`Collapse`:`Expand`} ${e.kind===`event`?`what this monitor printed`:`how this monitor ended`}`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate ${Uy}`,children:s}),(0,X.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 ${Hy}`,children:(0,X.jsx)(Ky,{lead:`Monitor`,title:e.label??gy(e.command??e.id),tail:c})}),(0,X.jsx)(Gy,{open:r})]}),r&&(0,X.jsxs)(`div`,{id:a,className:`mt-1.5 flex flex-col gap-1.5 border-l border-border/70 pl-3 text-[13px] text-muted [overflow-wrap:anywhere]`,children:[e.command!==void 0&&(0,X.jsx)(`div`,{className:`whitespace-pre-wrap font-mono text-[12px]`,children:e.command}),(0,X.jsx)(`div`,{children:e.summary}),e.output!==void 0&&(0,X.jsx)(`div`,{className:`whitespace-pre-wrap font-mono text-[12px]`,children:e.output})]})]})}function fb({agents:e,sourceId:t,at:n}){return(0,X.jsx)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:e.map((e,t)=>(0,X.jsxs)(q.Fragment,{children:[t>0&&(0,X.jsx)(Xy,{}),(0,X.jsx)(Q,{icon:kc,marker:`event`,ariaLabel:`Sub-agent ${e.label} stopped by the interrupt`,at:n,children:(0,X.jsx)(Ky,{lead:`Sub-agent`,title:e.label,tail:`stopped`,note:`by the interrupt`})})]},t))})}function pb({window:e,sourceId:t,at:n}){let r=e===`weekly`?`Weekly usage limit`:e===`session`?`Session usage limit`:`Usage limit`,i=`${r} reset — resuming`,a=e===`weekly`?`Weekly`:e===`session`?`Session`:null;return(0,X.jsx)(Q,{icon:ie,sourceId:t,marker:`limit-resume`,ariaLabel:i,at:n,children:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[a?(0,X.jsxs)(X.Fragment,{children:[a,(0,X.jsx)(`span`,{className:Hy,children:` usage`}),` limit`]}):r,` reset`,(0,X.jsx)(`span`,{className:Hy,children:` — resuming`})]})})}function mb({capped:e,to:t,sourceId:n,at:r}){return(0,X.jsx)(Q,{icon:ie,sourceId:n,marker:`limit-model-switch`,ariaLabel:`${e} limit — switched to ${t}`,at:r,children:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e,(0,X.jsx)(`span`,{className:Hy,children:` limit — switched to `}),(0,X.jsx)(`span`,{className:Uy,children:` → `}),t]})})}function hb({wake:e,sourceId:t,at:n}){let r=e.label.length>64?`${e.label.slice(0,63)}…`:e.label;return(0,X.jsx)(Q,{icon:ll,sourceId:t,marker:`event`,ariaLabel:`Background task «${r}» ${e.outcome}`,at:n,children:(0,X.jsx)(Ky,{lead:`Background task`,title:r,tail:e.outcome})})}function gb({wake:e,sourceId:t,at:n}){let r=Mr(e.ref),i=r?(0,X.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer noopener`,className:Qy,children:(0,X.jsx)(cb,{value:e.ref})}):(0,X.jsx)(`span`,{children:(0,X.jsx)(cb,{value:e.ref})}),a=e.kind===`ci`?e.verdict===`passing`?`passed`:e.verdict===`failing`?`failed`:`awaiting approval`:``,o=e.kind===`ci`?`CI ${a}`:`PR ${e.kind}`,s=e.kind===`ci`?e.verdict===`failing`&&e.failing.length?`: ${e.failing.join(`, `)}`:e.verdict===`gated`&&e.gating.length?`: ${e.gating.join(`, `)}`:``:``,c=e.kind===`ci`&&e.verdict!==`gated`&&e.commit?` at ${e.commit}`:``,l=e.kind===`ci`?e.verdict===`passing`&&e.passed!==void 0?`${e.passed} ${e.passed===1?`check`:`checks`} green${e.skipped?`, ${e.skipped} skipped`:``}`:e.verdict===`gated`?`${e.gated} ${e.gated===1?`workflow`:`workflows`} held`:null:null;return(0,X.jsxs)(Q,{icon:qt,sourceId:t,marker:`github`,at:n,ariaLabel:r?void 0:`${o} on ${e.ref}${c}${s}${l?` · ${l}`:``}`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[o,(0,X.jsx)(sb,{}),` `,i,c,s]}),l&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50 @max-[34rem]/wake:hidden`,children:`·`}),(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums @max-[34rem]/wake:hidden`,children:l})]})]})}function _b({wake:e,sourceId:t,at:n}){let r=Mr(e.ref),i=r?(0,X.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer noopener`,className:Qy,children:(0,X.jsx)(cb,{value:e.ref})}):(0,X.jsx)(`span`,{children:(0,X.jsx)(cb,{value:e.ref})});return(0,X.jsx)(Q,{icon:qt,sourceId:t,marker:`github`,at:n,ariaLabel:r?void 0:`PR updated on ${e.ref}: ${e.detail}`,children:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`PR updated`,(0,X.jsx)(sb,{}),` `,i,`: ${e.detail}`]})})}function vb({steer:e,text:t,sourceId:n,at:r}){let i=Mr(e.ref),a=e.items.length+e.omitted,o=ec(t),s=!o&&e.items.length===1&&e.omitted===0?e.items[0]:null,c=s?.url??i,l=o?`${a} ${a===1?`item`:`items`} already`:Zy(a,e.items[0]?.label??`item`,s?.actor),u=!o&&s?.actor&&l.endsWith(` from @${s.actor}`)?` from @${s.actor}`:``,d=!o&&l.startsWith(`New `)?`New `:``,f=c?(0,X.jsx)(`a`,{href:c,target:`_blank`,rel:`noreferrer noopener`,className:Qy,children:(0,X.jsx)(cb,{value:e.ref})}):(0,X.jsx)(`span`,{children:(0,X.jsx)(cb,{value:e.ref})});return(0,X.jsx)(Q,{icon:qt,sourceId:n,marker:`github`,at:s?.at??r,ariaLabel:c?void 0:`${l} on ${e.ref}`,children:(0,X.jsx)(ob,{sentence:(0,X.jsxs)(X.Fragment,{children:[d&&(0,X.jsx)(`span`,{className:`@max-[34rem]/wake:hidden`,children:d}),l.slice(d.length,l.length-u.length),u&&(0,X.jsx)(`span`,{className:`@max-[34rem]/wake:hidden`,children:u})]}),children:f})})}function yb(e){return e.replace(/\s+/g,` `).trim()}function bb(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&typeof t.sourceId==`string`&&typeof t.quote==`string`&&typeof t.text==`string`&&Number.isInteger(t.start)&&Number.isInteger(t.end)&&t.start>=0&&t.end>t.start}function xb(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(bb):[]}catch{return[]}}function Sb(e){return e.length?JSON.stringify(e):``}function Cb(e,t){let n=new Map;return t.forEach((e,t)=>{e.sourceId!==void 0&&!n.has(e.sourceId)&&n.set(e.sourceId,t)}),e.map((e,t)=>({comment:e,written:t,at:n.get(e.sourceId)??1/0})).sort((e,t)=>e.at-t.at||(e.at===1/0?e.written-t.written:e.comment.start-t.comment.start||e.written-t.written)).map(({comment:e})=>e)}var wb=/^Comments on your earlier messages \((\d+)\), each under the passage it is about:$/;function Tb(e){return`Comments on your earlier messages (${e}), each under the passage it is about:`}function Eb(e){return yb(e)?`> ${yb(e)}`:`>`}function Db(e){if(!e.length)return``;let t=e.map(e=>`${Eb(e.quote)}\n\n${e.text.trim()}`);return`${Tb(e.length)}\n\n${t.join(`
|
|
106
|
+
|
|
107
|
+
`)}`}function Ob(e,t){let n=Db(t);if(!n)return e;let{prose:r,attachments:i}=Es(e);return Ya(r.trim()?`${r.trimEnd()}\n\n${n}`:n,i.map(e=>e.path))}function kb(e){let t=e.split(`
|
|
108
|
+
`),n=-1,r=0;for(let e=t.length-1;e>=0;e--){let i=wb.exec(t[e]);if(i&&(e===0||t[e-1]===``)){n=e,r=Number(i[1]);break}}if(n<0||r<1)return null;let i=t.slice(0,n).join(`
|
|
109
|
+
`).trimEnd(),a=t.slice(n+1).join(`
|
|
110
|
+
`);if(!a.startsWith(`
|
|
111
|
+
> `)&&!a.startsWith(`
|
|
112
|
+
>
|
|
113
|
+
`))return null;let o=a.slice(1).split(/\n\n(?=>(?: |\n|$))/),s=[];for(let e of o){let t=e.split(`
|
|
114
|
+
`),n=0,r=[];for(;n<t.length&&t[n].startsWith(`>`);n++)r.push(t[n].replace(/^> ?/,``));if(t[n]!==``)return null;let i=t.slice(n+1).join(`
|
|
115
|
+
`).trim();if(!i)return null;s.push({quote:r.join(` `).trim(),text:i})}return s.length===r?{note:i,items:s}:null}var Ab=`data-commentable`,jb=`data-comment-ui`,Mb=`button, [aria-hidden="true"], [${jb}], .sr-only`;function Nb(e){let t=[],n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:t=>{let n=t.parentElement;return!n||!n.closest(`.md-body`)||!e.contains(n.closest(`.md-body`))||n.closest(Mb)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(let e=n.nextNode();e;e=n.nextNode())t.push(e);return t}function Pb(e){return Nb(e).map(e=>e.data).join(``)}function Fb(e,t){let n=0,r=-1,i=-1;for(let a of Nb(e)){let e=a.data.length;t.intersectsNode(a)&&(r<0&&(r=n+(t.startContainer===a?t.startOffset:0)),i=n+(t.endContainer===a?t.endOffset:e)),n+=e}return r<0||i<=r?null:[r,i]}function Ib(e,t,n){let r=0,i=!1,a=e.ownerDocument.createRange();for(let o of Nb(e)){let e=o.data.length;if(!i&&t<r+e&&(a.setStart(o,t-r),i=!0),i&&n<=r+e)return a.setEnd(o,n-r),a;r+=e}return null}function Lb(e,[t,n]){for(;t<n&&/\s/.test(e[t]);)t++;for(;n>t&&/\s/.test(e[n-1]);)n--;return[t,n]}function Rb(e,t,n=0){let r=yb(t);if(!r)return null;let i=[],a=``,o=!1;for(let t=0;t<e.length;t++){if(/\s/.test(e[t])){o=a.length>0;continue}o&&=(a+=` `,i.push(t-1),!1),a+=e[t],i.push(t)}let s=i.findIndex(e=>e>=n),c=s>=0?a.indexOf(r,s):-1;return c<0&&(c=a.indexOf(r)),c<0?null:[i[c],i[c+r.length-1]+1]}function zb(e,t){let n=Pb(e),r=[t.start,t.end];return(t.end>n.length||yb(n.slice(t.start,t.end))!==yb(t.quote))&&(r=Rb(n,t.quote,t.start)),r?Ib(e,r[0],r[1]):null}var Bb={id:null,pinned:!1},Vb=(0,q.createContext)(null),Hb=Vb.Provider;function Ub(){return(0,q.useContext)(Vb)}var Wb=0,Gb=()=>`c${Date.now().toString(36)}${(Wb++).toString(36)}${Math.random().toString(36).slice(2,6)}`;function Kb(e){let t=(0,q.useRef)(e);return t.current.length===e.length&&t.current.every((t,n)=>t===e[n])||(t.current=e),t.current}function qb(e,t){let n=As(),r=H.comments(n,e),[i]=Ci(r),a=(0,q.useMemo)(()=>xb(i),[i]),o=Kb((0,q.useMemo)(()=>Cb(a,t),[a,t])),s=(0,q.useRef)(t);s.current=t;let[c,l]=(0,q.useState)(Bb),[u,d]=(0,q.useState)(null),f=(0,q.useCallback)(e=>{G.set(r,Sb(e(xb(G.get(r)))))},[r]),p=(0,q.useRef)(o);p.current=o;let m=(0,q.useRef)(c);return m.current=c,(0,q.useMemo)(()=>({comments:o,add:e=>f(t=>[...t,{...e,id:Gb()}]),update:(e,t)=>f(n=>n.map(n=>n.id===e?{...n,text:t}:n)),remove:e=>{f(t=>t.filter(t=>t.id!==e)),l(t=>t.id===e?Bb:t)},clear:()=>{G.clear(r),l(Bb)},take:()=>{let e=Cb(xb(G.get(r)),s.current);return G.clear(r),l(Bb),e},restore:e=>f(t=>[...e.filter(e=>!t.some(t=>t.id===e.id)),...t]),focus:c,setFocus:l,nav:e=>{let t=p.current;if(!t.length)return;let n=t.findIndex(e=>e.id===m.current.id),r=t[n<0?e>0?0:t.length-1:(n+e+t.length)%t.length];l({id:r.id,pinned:!0}),d(e=>({seq:(e?.seq??0)+1,id:r.id}))},revealQuote:e=>d(t=>({seq:(t?.seq??0)+1,quote:e})),reveal:u}),[o,c,u,f,r])}var Jb=typeof CSS<`u`&&`highlights`in CSS&&typeof Highlight<`u`,Yb=new Map;function Xb(){if(!Jb)return;let e=[...Yb.values()],t=new Highlight(...e.flatMap(e=>e.soft)),n=new Highlight(...e.flatMap(e=>e.active));n.priority=1,CSS.highlights.set(`frizz-comment`,t),CSS.highlights.set(`frizz-comment-active`,n)}function Zb(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function Qb(e,t){return e.querySelector(`[${Ab}][data-frizz-msg="${CSS.escape(t)}"]`)}function $b(e){let t=window.getSelection();if(!t||t.isCollapsed||!t.rangeCount)return null;let n=t.getRangeAt(0),r=Zb(n.startContainer)?.closest(`[${Ab}]`);if(!r||!e.contains(r)||Zb(n.startContainer)?.closest(`[data-comment-ui]`))return null;let i=r.getAttribute(`data-frizz-msg`);if(!i)return null;let a=Zb(n.endContainer)?.closest(`[${Ab}]`);if(a&&a!==r&&Fb(a,n))return null;let o=Fb(r,n);if(!o)return null;let s=Pb(r),[c,l]=Lb(s,o);return l<=c?null:{sourceId:i,start:c,end:l,quote:yb(s.slice(c,l))}}function ex(e){let t=(0,q.useRef)(e);t.current=e;let[n]=(0,q.useState)(()=>({current:{getBoundingClientRect:()=>t.current()?.getBoundingClientRect()??new DOMRect,get contextElement(){return Zb(t.current()?.startContainer??null)??void 0}}}));return n}var tx=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,nx=180,rx=1600,ix=300,ax=16,ox=6,sx=20.5;function cx(e){return tx?`below`:window.innerWidth-12-(e.getBoundingClientRect().right+ax)>=ix?`margin`:`below`}function lx(e,t){let n=e.getClientRects()[0]??e.getBoundingClientRect(),r=n.top+n.height/2-sx,i=t.getBoundingClientRect().right-1;return new DOMRect(n.left,r,Math.max(1,i-n.left),n.bottom-r)}function ux(e,t){let n=(0,q.useRef)({root:e,read:t});n.current={root:e,read:t};let[r]=(0,q.useState)(()=>{let e={placement:`below`,current:{getBoundingClientRect:()=>{let t=n.current.read();return t?e.placement===`margin`&&n.current.root?lx(t,n.current.root):t.getBoundingClientRect():new DOMRect},get contextElement(){return Zb(n.current.read()?.startContainer??null)??void 0}}};return e});return r}function dx(e){let t=[...e].sort((e,t)=>e[0]-t[0]||e[1]-t[1]),n=(e,t,n)=>(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0]),r=e=>{let t=[];for(let r of e){for(;t.length>=2&&n(t[t.length-2],t[t.length-1],r)<=0;)t.pop();t.push(r)}return t.pop(),t};return[...r(t),...r([...t].reverse())]}function fx(e,t,n){let r=dx(n.flatMap(e=>[[e.left-2,e.top-2],[e.right+2,e.top-2],[e.right+2,e.bottom+2],[e.left-2,e.bottom+2]]));if(r.length<3)return!1;for(let n=0;n<r.length;n++){let[i,a]=r[n],[o,s]=r[(n+1)%r.length];if((o-i)*(t-a)-(s-a)*(e-i)<0)return!1}return!0}function px({root:e}){let t=Ub(),[n]=(0,q.useState)(()=>Symbol(`transcript-comments`)),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(null),d=(0,q.useRef)(new Map),f=(0,q.useRef)(null),p=(0,q.useRef)(null),m=(0,q.useRef)(void 0),h=(0,q.useRef)(!1),g=t?.comments,_=t?.focus??Bb,v=!!(e&&t&&(g.length>0||s||l)),y=(0,q.useCallback)(()=>{if(!e||!t)return;let r=new Map,i=[],a=[];for(let n of t.comments){let t=Qb(e,n.sourceId),o=t&&zb(t,n);o&&(r.set(n.id,o),(n.id===_.id?a:i).push(o))}if(d.current=r,f.current=null,s){let t=Qb(e,s.sourceId),n=t&&Ib(t,s.start,s.end);n&&(f.current=n,a.push(n))}l&&a.push(l),Yb.set(n,{soft:i,active:a}),Xb()},[e,t,_.id,s,l,n]);(0,q.useLayoutEffect)(y,[y]),(0,q.useEffect)(()=>()=>{Yb.delete(n),Xb()},[n]),(0,q.useEffect)(()=>{if(!v||!e)return;let t=0,n=new MutationObserver(()=>{t||=requestAnimationFrame(()=>{t=0,y()})});return n.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{n.disconnect(),cancelAnimationFrame(t)}},[v,e,y]),(0,q.useEffect)(()=>{if(!e||!t)return;let n=()=>{let t=$b(e);p.current=t?window.getSelection().getRangeAt(0).cloneRange():null,i(e=>e&&t&&e.sourceId===t.sourceId&&e.start===t.start&&e.end===t.end?e:t)},r=t=>{t.button===0&&e.contains(t.target)&&o(!0)},a=()=>{o(!1),n()};return document.addEventListener(`selectionchange`,n),document.addEventListener(`pointerdown`,r,!0),document.addEventListener(`pointerup`,a,!0),()=>{document.removeEventListener(`selectionchange`,n),document.removeEventListener(`pointerdown`,r,!0),document.removeEventListener(`pointerup`,a,!0)}},[e,t]);let b=(0,q.useCallback)(e=>{c(e),i(null),t?.setFocus(Bb),window.getSelection()?.removeAllRanges()},[t]);(0,q.useEffect)(()=>{if(!e||!t)return;let n=t=>{if(t.key.toLowerCase()!==`i`||!(t.metaKey||t.ctrlKey)||t.shiftKey||t.altKey)return;let n=$b(e);n&&(t.preventDefault(),t.stopPropagation(),b(n))};return document.addEventListener(`keydown`,n,!0),()=>document.removeEventListener(`keydown`,n,!0)},[e,t,b]);let x=(0,q.useCallback)((e,t)=>{for(let[n,r]of d.current)for(let i of r.getClientRects())if(e>=i.left-1&&e<=i.right+1&&t>=i.top-1&&t<=i.bottom+1)return n;return null},[]),S=t?.setFocus,C=(0,q.useRef)(_);C.current=_;let w=(0,q.useRef)(null),T=(0,q.useCallback)(()=>{clearTimeout(m.current),m.current=setTimeout(()=>{!C.current.pinned&&!w.current?.matches(`:hover`)&&S?.(Bb)},nx)},[S]),E=(0,q.useCallback)(()=>clearTimeout(m.current),[]);(0,q.useEffect)(()=>()=>clearTimeout(m.current),[]);let D=!!g?.length;(0,q.useEffect)(()=>{if(!e||!S||!D||s)return;let t=0,n=null,r=r=>{n=r,!t&&(t=requestAnimationFrame(()=>{if(t=0,!n||n.buttons)return;let r=e.contains(n.target)?x(n.clientX,n.clientY):null;if(e.toggleAttribute(`data-comment-hover`,r!==null),r){E(),!C.current.pinned&&C.current.id!==r&&S({id:r,pinned:!1});return}let i=C.current;if(!i.id||i.pinned)return;let a=d.current.get(i.id)?.getBoundingClientRect(),o=w.current?.getBoundingClientRect();a&&o&&fx(n.clientX,n.clientY,[a,o])?E():T()}))},i=t=>{t.relatedTarget||(e.removeAttribute(`data-comment-hover`),C.current.id&&!C.current.pinned&&T())},a=e=>{if(window.getSelection()?.isCollapsed===!1||h.current)return;let t=x(e.clientX,e.clientY);t&&S({id:t,pinned:!0})};return document.addEventListener(`pointermove`,r,{passive:!0}),document.addEventListener(`pointerout`,i),e.addEventListener(`click`,a),()=>{cancelAnimationFrame(t),e.removeAttribute(`data-comment-hover`),document.removeEventListener(`pointermove`,r),document.removeEventListener(`pointerout`,i),e.removeEventListener(`click`,a)}},[e,S,D,s,x,E,T]);let O=t?.reveal;(0,q.useEffect)(()=>{if(!O||!e)return;let t=null;if(`id`in O)t=d.current.get(O.id)??null;else{let n=[...e.querySelectorAll(`[${Ab}]`)].reverse();for(let e of n){let n=Rb(Pb(e),O.quote);if(t=n&&Ib(e,n[0],n[1]),t)break}t&&u(t)}Zb(t?.startContainer??null)?.scrollIntoView({block:`center`,behavior:`smooth`})},[O?.seq]),(0,q.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>u(null),rx);return()=>clearTimeout(e)},[l]);let k=ex(()=>p.current),A=ux(e,()=>f.current),j=ux(e,()=>_.id?d.current.get(_.id)??null:null),M=!!(s||_.id),[,N]=(0,q.useState)(0);if((0,q.useEffect)(()=>{if(!M)return;let e=()=>N(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[M]),!t||!e)return null;let P=_.id&&!s?t.comments.find(e=>e.id===_.id):void 0,F=cx(e);A.placement=F,j.placement=F;let I={side:F===`margin`?`right`:`bottom`,align:`start`,sideOffset:F===`margin`?17:ox,updatePositionStrategy:`always`,className:`w-[min(300px,calc(100vw-24px))] px-3 py-2.5`,"data-comment-placement":F,[jb]:``,onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{h.current&&e.preventDefault()}},L=e=>{h.current=e};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(z,{open:!!(r&&!a&&!s),onOpenChange:e=>{e||i(null)},children:[(0,X.jsx)(Jt,{virtualRef:k}),(0,X.jsx)(Wa,{side:tx?`bottom`:`top`,sideOffset:tx?12:6,updatePositionStrategy:`always`,hideWhenDetached:!0,className:`p-0.5`,"data-comment-button":``,[jb]:``,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),children:(0,X.jsxs)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),r&&b(r)},onClick:e=>{e.detail===0&&r&&b(r)},className:`flex items-baseline gap-1.5 rounded-md font-medium text-fg/90 outline-none transition-colors hover:bg-panel-2 focus-visible:bg-panel-2 ${tx?`px-3 py-2 text-[14px]`:`px-2 py-1 text-[12px]`}`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`relative block h-[1em] w-[1em] shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`,children:(0,X.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,X.jsx)(Zc,{className:`h-[1.1em] w-[1.1em]`,strokeWidth:2})})}),`Comment`,!tx&&(0,X.jsx)(`kbd`,{className:`ml-1 font-sans text-[10.5px] font-normal text-muted-60`,children:`⌘I`})]})})]}),(0,X.jsxs)(z,{open:!!s,onOpenChange:e=>{e||c(null)},children:[(0,X.jsx)(Jt,{virtualRef:A}),s&&(0,X.jsx)(Wa,{...I,"data-comment-editor":``,children:(0,X.jsx)(hx,{saved:``,onDirty:L,onSave:e=>{t.add({sourceId:s.sourceId,start:s.start,end:s.end,quote:s.quote,text:e}),c(null)},onCancel:()=>c(null)},`${s.sourceId}:${s.start}:${s.end}`)})]}),(0,X.jsxs)(z,{open:!!P,onOpenChange:e=>{e||t.setFocus(Bb)},children:[(0,X.jsx)(Jt,{virtualRef:j}),P&&(0,X.jsx)(Wa,{...I,ref:w,hideWhenDetached:!0,"data-comment-popover":P.id,onOpenAutoFocus:e=>e.preventDefault(),children:(0,X.jsx)(hx,{saved:P.text,onDirty:L,onEngage:()=>t.setFocus({id:P.id,pinned:!0}),onSave:e=>{t.update(P.id,e),t.setFocus(Bb)},onCancel:()=>t.setFocus(Bb),onDelete:()=>t.remove(P.id)},P.id)})]})]})}var mx=`flex h-5 w-3.5 items-center justify-center rounded text-muted-60 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:bg-panel-2`;function hx({saved:e,onSave:t,onCancel:n,onDelete:r,onDirty:i,onEngage:a}){let o=!r,[s,l]=(0,q.useState)(e),u=s.trim(),d=u!==e.trim();(0,q.useEffect)(()=>(i(d),()=>i(!1)),[d,i]);let f=(0,q.useRef)(null);(0,q.useLayoutEffect)(()=>{let e=f.current;e&&(e.style.height=`0px`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[s]),(0,q.useEffect)(()=>{let e=f.current;!e||!o||(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[]);let p=()=>{u&&d&&t(u)};return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`textarea`,{ref:f,value:s,rows:1,"aria-label":o?`Comment on this passage`:`Comment`,placeholder:o?`Comment on this passage…`:void 0,"data-1p-ignore":!0,onFocus:a,onChange:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),c({key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.nativeEvent.keyCode})&&(e.preventDefault(),p())},className:`block max-h-[220px] w-full resize-none bg-transparent text-[13px] leading-[19px] text-fg outline-none [overflow-wrap:anywhere] placeholder:text-muted ${o?`min-h-[38px]`:``}`}),(0,X.jsx)(`div`,{className:`-mx-3 -mb-2.5 mt-2.5 flex items-center justify-end gap-1 rounded-b-[7px] border-t border-border bg-fg/[0.03] px-3 py-[7px]`,children:o||d?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,className:gx,children:`Cancel`}),(0,X.jsx)(`button`,{type:`button`,disabled:!u||!d,onClick:p,className:`rounded-md bg-fg px-2.5 py-1 text-[12px] font-medium text-bg outline-none transition-opacity hover:opacity-90 focus-visible:ring-1 focus-visible:ring-focus-ink-60 disabled:opacity-30`,children:o?`Add comment`:`Save`})]}):(0,X.jsx)(`button`,{type:`button`,onClick:r,className:gx,children:`Delete`})})]})}var gx=`rounded-md px-2 py-1 text-[12px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:bg-panel-2`;function _x(){let e=Ub(),[t,n]=(0,q.useState)(!1),r=e?.comments.length??0;return(0,q.useEffect)(()=>{r===0&&n(!1)},[r]),!e||r===0?null:(0,X.jsxs)(`span`,{"data-pending-comments":r,className:`mr-auto flex min-w-0 items-baseline text-[11.5px] text-attention`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>e.nav(1),onMouseDown:e=>e.preventDefault(),className:`flex shrink-0 items-baseline gap-1.5 whitespace-nowrap rounded-md px-1.5 py-0.5 outline-none transition-colors hover:bg-panel-2 focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`relative block h-[1em] w-[1em] shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`,children:(0,X.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,X.jsx)(zn,{className:`h-[1em] w-[1em]`,strokeWidth:2.2})})}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`font-medium tabular-nums`,children:r}),` comment`,r===1?``:`s`]})]}),t?(0,X.jsxs)(`span`,{className:`flex shrink-0 items-baseline gap-1 whitespace-nowrap pl-1 text-muted-70`,children:[`Discard `,r===1?`it`:`all ${r}`,`?`,(0,X.jsx)(`button`,{type:`button`,onClick:()=>e.clear(),className:`rounded-md px-1.5 py-0.5 font-medium text-danger outline-none hover:bg-panel-2 focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:`Discard`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>n(!1),className:`rounded-md px-1.5 py-0.5 outline-none hover:bg-panel-2 hover:text-fg/85 focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:`Keep`})]}):(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center self-center text-muted-60`,children:[(0,X.jsx)(`button`,{type:`button`,title:`Previous comment`,"aria-label":`Previous comment`,onMouseDown:e=>e.preventDefault(),onClick:()=>e.nav(-1),className:mx,children:(0,X.jsx)(Jn,{size:12,strokeWidth:2})}),(0,X.jsx)(`button`,{type:`button`,title:`Next comment`,"aria-label":`Next comment`,onMouseDown:e=>e.preventDefault(),onClick:()=>e.nav(1),className:mx,children:(0,X.jsx)(ke,{size:12,strokeWidth:2})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>n(!0),className:`ml-0.5 rounded-md px-1.5 py-0.5 text-[11.5px] outline-none transition-colors hover:bg-panel-2 hover:text-fg/85 focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:`Discard`})]})]})}function vx({items:e,divided:t}){let n=Ub();return(0,X.jsx)(`div`,{"data-sent-comments":e.length,className:`flex flex-col gap-2.5 whitespace-normal ${t?`mt-2.5 border-t border-bg/15 pt-2.5`:``}`,children:e.map((e,t)=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`button`,{type:`button`,title:n?`Show this passage`:void 0,disabled:!n,onClick:t=>{t.stopPropagation(),n?.revealQuote(e.quote)},onKeyDown:e=>e.stopPropagation(),className:`line-clamp-2 block border-l-2 border-bg/25 pl-2 text-left text-[12px] leading-[17px] text-user-bubble-fg/60 outline-none transition-colors enabled:hover:border-bg/50 enabled:hover:text-user-bubble-fg/85 focus-visible:border-bg/60`,children:e.quote}),(0,X.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap`,children:e.text})]},t))})}function yx(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`&&e[t].kind!==`event`)return t;return-1}function bx(e){return e.sourceId??`legacy-${kx(e.text)}`}function xx(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.kind===`event`||n.kind===`reasoning`)&&n.role===`assistant`&&n.text.trim())return t}return-1}var Sx=e=>or(e).filter(e=>e.kind===`question`).map(e=>e.kind===`question`?Ct(e.text,e.questionKind,e.danger):Ct(``,`question`));function Cx(){let e=new Set;return(t,n)=>{let r=bx(t);return e.has(r)&&(r=`${r}#${n}`),e.add(r),r}}function wx(e){let t=xx(e),n=Cx(),r=[];for(let i=0;i<e.length;i++){let a=e[i];if(a.kind===`event`||a.kind===`reasoning`||a.role!==`assistant`||!a.text.trim()||!a.text.includes("```question"))continue;let o=Sx(a.text);o.length>0&&r.push({idx:i,identity:n(a,i),blocks:o,isLive:i===t})}return r}function Tx(e){let{answered:t,live:n}=e;return t.length>0&&t.every(e=>e.isLive)&&n?`Answers:\n${n.numbered.map(({n:e,a:t})=>`${e}. ${lc(t)}`).join(`
|
|
116
|
+
`)}`:`${Br}\n${t.map((e,t)=>`${t+1}. “${e.question}” → ${lc(e.answer)}`).join(`
|
|
117
|
+
`)}`}function Ex(e,t,n,r={}){let i=hn(e),[a,o]=(0,q.useState)({}),s=(0,q.useMemo)(()=>wx(t),[t]),c=(0,q.useMemo)(()=>{for(let e=t.length-1;e>=0;e--)if(!(t[e].kind===`event`||t[e].kind===`reasoning`)&&t[e].role===`assistant`&&t[e].text.trim())return t[e]},[t]),l=As(),u=Ni(e),d=(0,q.useCallback)((t,n)=>H.answer(l,e,u,t,n),[l,e,u]),f=(0,q.useMemo)(()=>s.flatMap(e=>e.blocks.map((t,n)=>d(e.identity,n))),[s,d]),p=$a(f),m=(0,q.useRef)(n);m.current=n;let h=(0,q.useRef)(r.onSendFailed);h.current=r.onSendFailed;let g=(0,q.useCallback)((e,t)=>({...a[`${e}::${t}`]??{chosen:null,text:``},text:p.get(d(e,t))??``}),[a,p,d]),_=(0,q.useMemo)(()=>{let e=new Map;for(let t of s)e.set(t.identity,t);return e},[s]),v=(0,q.useCallback)((e,t,n)=>{let r=_.get(e)?.blocks[t],i=`${e}::${t}`;o(e=>{let t=e[i]??{chosen:null,text:``};if(r?.kind===`multi`){let r=new Set(t.chosenSet??[]);return r.has(n)?r.delete(n):r.add(n),{...e,[i]:{chosen:null,text:t.text,chosenSet:[...r].sort((e,t)=>e-t)}}}return{...e,[i]:{chosen:t.chosen===n?null:n,text:t.text}}})},[_]),y=(0,q.useCallback)((e,t,n)=>{let r=_.get(e)?.blocks[t];G.set(d(e,t),n),o(i=>{let a=`${e}::${t}`,o=i[a]??{chosen:null,text:``};return r?.kind===`multi`?{...i,[a]:{chosen:null,text:n,chosenSet:o.chosenSet??[]}}:{...i,[a]:{chosen:null,text:n}}})},[_,d]),b=s.reduce((e,t)=>e+t.blocks.filter((e,n)=>Vt(e,g(t.identity,n))!==``).length,0),x=b>0,S=(0,q.useCallback)((e,t={})=>{i.submit(e,{...t,onRollback:e=>{t.onRollback?.(e),h.current?.()}})&&m.current?.()},[i]),C=(0,q.useCallback)(e=>{let t=e?s.filter(t=>t.identity===e):s,n=e?t.flatMap(e=>e.blocks.map((t,n)=>d(e.identity,n))):f,r=t.flatMap(e=>e.blocks.map((t,n)=>`${e.identity}::${n}`)),i=(e,t)=>Vt(e.blocks[t],g(e.identity,t)),c=t.flatMap(e=>e.blocks.map((t,n)=>({ask:e,bi:n,question:Ox(t),answer:i(e,n)})).filter(e=>e.answer!==``));if(c.length===0)return null;let l=t.find(e=>e.isLive),u=Tx({answered:c.map(e=>({isLive:e.ask.isLive,question:e.question,answer:e.answer})),live:l&&{numbered:l.blocks.map((e,t)=>({n:t+1,a:i(l,t)})).filter(({a:e})=>e!==``)}}),p=a,m=n.map(e=>[e,G.get(e)]);return{wire:u,onOptimistic:()=>{n.forEach(e=>G.clear(e)),o(e=>{let t={...e};for(let e of r)delete t[e];return t})},onRollback:()=>{o(e=>{let t={...e};for(let e of r)p[e]?t[e]=p[e]:delete t[e];return t}),m.forEach(([e,t])=>{t&&!G.get(e)&&G.set(e,t)})}}},[a,s,g,f,d]),w=(0,q.useCallback)(()=>C(),[C]),T=r.composer,E=(0,q.useCallback)(e=>{if(T?.run())return;let t=C(typeof e==`string`?e:void 0);t&&S(t.wire,{onOptimistic:t.onOptimistic,onRollback:t.onRollback})},[T,C,S]),D=(0,q.useCallback)(e=>{let t=_.get(bx(e));if(t)return{answerFor:e=>g(t.identity,e),onChip:(e,n)=>v(t.identity,e,n),onText:(e,n)=>y(t.identity,e,n),onSubmit:()=>E(t.identity),anyAnswered:t.blocks.some((e,n)=>Vt(e,g(t.identity,n))!==``),sending:i.pending}},[_,g,v,y,E,i.pending]);return{liveMsg:c,answering:(0,q.useMemo)(()=>c?D(c):void 0,[c,D]),answeringForMessage:D,anyAnswered:x,sending:i.pending,sendAnswers:E,sendMessage:S,stagedCount:b,takeAnswers:w}}function Dx(e){let t=e.split(`
|
|
118
|
+
`).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>120?`${t.slice(0,117)}…`:t}function Ox(e){return Dx(e.contextMd)||Dx(e.options.join(` / `))||`earlier question`}function kx(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0).toString(36)}function Ax(e){let t=new Set,n=new Set;for(let r of e)for(let e of r.tools)e.agentId&&(t.add(e.agentId),e.agentStatus&&n.add(e.agentId));return{launched:t,finished:n}}function jx(e,t,n){if(n.length===0)return{agents:e,key:void 0};let{launched:r,finished:i}=Ax(n),a=new Set(t.flatMap(e=>e.id?[e.id]:[])),o=new Set(e.flatMap(e=>e.id?[e.id]:[])),s=e.filter(e=>e.id&&!a.has(e.id)&&!r.has(e.id)),c=t.filter(e=>e.id&&!o.has(e.id)&&r.has(e.id)&&!i.has(e.id));if(s.length===0&&c.length===0)return{agents:e,key:void 0};let l=[...s.map(e=>`+${e.id}`),...c.map(e=>`-${e.id}`)].join(` `);return{agents:[...e.filter(e=>!s.includes(e)),...c],key:l}}function Mx(e,t){let n=(0,q.useRef)(void 0),[r,i]=(0,q.useState)(void 0),a=e?.subAgents??[],o=n.current===void 0?{agents:a,key:void 0}:jx(a,n.current,t),s=o.key;(0,q.useEffect)(()=>{if(s===void 0)return;let e=setTimeout(()=>i(s),mo);return()=>clearTimeout(e)},[s]);let c=s!==void 0&&r!==s?o.agents:a;return(0,q.useEffect)(()=>{n.current=c},[c]),!e||c===a?e:{...e,subAgents:[...c]}}function Nx(e,t,n){return e===t||n(e,t)?e:t}function Px(e,t){let n=(0,q.useRef)(e);return n.current=t(n.current,e),n.current}function Fx(e,t){return Px(e,(e,n)=>Nx(e,n,t))}function Ix(e,t,n){if(e===t)return e;let r=e.size!==t.size,i=new Map;for(let[a,o]of t){let t=e.get(a),s=e.has(a)&&n(t,o);s||(r=!0),i.set(a,s?t:o)}return r?i:e}function Lx(e,t){return Ix(e,t,Rx)}function Rx(e,t){return!e||!t?e===t:e.length===t.length&&e.every((e,n)=>Object.is(e,t[n]))}function zx(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!la(n))return n.kind===`event`&&n.boundary===`rest`?n.sourceId??`rest@${n.at??t}`:void 0}}function Bx(e,t,n){if(!e||e.runtime!==`running`&&e.runtime!==`spawning`)return;let r=zx(t);return r!==void 0&&r!==n?r:void 0}function Vx(e,t){let n=(0,q.useRef)(null),[r,i]=(0,q.useState)(void 0),a=n.current&&n.current.messages.length>0?Bx(e,t,n.current.restKey):void 0;(0,q.useEffect)(()=>{if(a===void 0)return;let e=setTimeout(()=>i(a),400);return()=>clearTimeout(e)},[a]);let o=a!==void 0&&r!==a?n.current.messages:t;return(0,q.useEffect)(()=>{n.current?.messages!==o&&(n.current={messages:o,restKey:zx(o)})},[o]),o}var Hx=e=>(e??``).replace(/\s+/g,` `).trim();function Ux(e,t){let n=Ts(t.hints),r=Ts(e.hints);if(n.length>0){let e=new Set(r.map(Hx));return n.every(t=>e.has(Hx(t)))}if(r.length>0)return!1;let i=Hx(wo(t.hints)),a=Hx(Jo(t.body));return!i&&!a?!1:i===Hx(wo(e.hints))&&a===Hx(Jo(e.body))}function Wx(e,t,n){let r=new Set;if(!n)return r;for(let i=Math.min(t,e.length)-1;i>=0;i--){let t=e[i];if(oc(t))break;if(t.role!==`assistant`||t.kind||!t.text.includes("```awaiting"))continue;let a=Rg(t.text).filter(e=>e.kind===`fence`&&e.fenceKind===`awaiting`);a.length>0&&a.every(e=>e.kind===`fence`&&Ux(n,e))&&r.add(i)}return r}function Gx(e,t,n=!0){return e.held>0&&n?`release`:e.steered>0&&t?`interrupt`:null}function Kx(e){if(!e)return!1;let t=Xr(U.board,e);return Oi(t?.backend).interrupt&&t?.runtime===`running`}function qx(e){return Oi(e?Xr(U.board,e)?.backend:void 0).steer}function Jx(e){return(0,q.useSyncExternalStore)(e=>Ai(U,e),()=>qx(e),()=>!0)}function Yx(e){return(0,q.useSyncExternalStore)(e=>Ai(U,e),()=>Kx(e),()=>!1)}var Xx=new Set,Zx=new Set;function Qx(e,t){if(t!==Xx.has(e)){t?Xx.add(e):Xx.delete(e);for(let e of Zx)e()}}function $x(e){return(0,q.useSyncExternalStore)((0,q.useCallback)(e=>(Zx.add(e),()=>Zx.delete(e)),[]),()=>e?Xx.has(e):!1,()=>!1)}function eS(e,t){let n=Gx(t,Kx(e),qx(e));if(!n)return!1;if(Xx.has(e))return!0;let r=Xr(U.board,e)?.sessionId;if(!r)return K(`This thread has no live session to send to`),!0;Qx(e,!0);let i=n===`release`;return W.deliverQueuedNow({slug:e,sessionId:r,...i?{releaseOnly:!0}:{}}).then(t=>{Qx(e,!1),i?t.released||K(t.reason??`That message could not be sent now`):!t.interrupted&&!t.released&&K(t.reason??`That message could not be pushed through`)},t=>{Qx(e,!1);let n=(t instanceof Error?t.message:String(t)).slice(0,160);K(i?`Couldn't send it now — ${n}`:`Couldn't push it through — ${n}`)}),!0}var tS=`input, textarea, select, [contenteditable]:not([contenteditable='false'])`;function nS(e,t){if(e.defaultPrevented||e.repeat||!pn(e))return!1;let n=e.target;if(!(n instanceof Element)||!t.contains(n))return!1;let r=n.closest(tS);return r?r instanceof HTMLTextAreaElement&&r.closest(`[data-thread-composer-box]`)!==null&&r.value.trim()===``:!0}var rS=new Set;function iS(e){if(e.defaultPrevented||e.repeat||!pn(e))return;let t=document.activeElement;if(t&&t!==document.body&&t!==document.documentElement)return;let n=[...rS],r=Vs();(r?n.find(e=>e.slug===r):new Set(n.map(e=>e.slug)).size===1?n[0]:void 0)?.press()&&e.preventDefault()}function aS(e,t){let n=(0,q.useRef)(t);return n.current=t,(0,q.useEffect)(()=>{let t={slug:e,press:()=>eS(e,n.current)};return rS.size===0&&window.addEventListener(`keydown`,iS),rS.add(t),()=>{rS.delete(t),rS.size===0&&window.removeEventListener(`keydown`,iS)}},[e]),(0,q.useCallback)(t=>{nS(t.nativeEvent,t.currentTarget)&&eS(e,n.current)&&t.preventDefault()},[e])}function oS(e,t){for(let n=0;n<e.length;n++){let r=e[n].at?Date.parse(e[n].at):NaN;if(Number.isFinite(r)&&r>t)return n}return e.length}function sS(e,t){let n=t;for(;n>0&&e[n].kind===`event`;)n--;return n}function cS(e){let t=e.findIndex(e=>e.queued===!0);return t<0?e.length:t}function lS(e,t){let n=new Map,r=new Map;if(t.length===0||e.length===0)return{placed:n,anchored:r};let i=new Map;for(let e of t){let t=e.pending?`pending`:e.settledAt,n=i.get(t);n?n.push(e):i.set(t,[e])}let a=(e,t,n)=>{let r=e.get(t);r?r.push(...n):e.set(t,[...n])};for(let[t,o]of i){let i=t===`pending`?1/0:Date.parse(t),s=Number.isFinite(i)?oS(e,i):cS(e);if(s===0)continue;let c=e.slice(0,s),l=g_(c,o);for(let[e,t]of l.placed)a(n,e,t);let u=o.filter(e=>!l.placedIds.has(e.id));for(let[e,t]of t_(c,u))e<0||a(r,sS(c,e),t)}let o=(e,t)=>Date.parse(e.askedAt)-Date.parse(t.askedAt);for(let e of n.values())e.sort(o);for(let e of r.values())e.sort(o);return{placed:n,anchored:r}}var uS=e=>e.role===`user`&&!e.queued,dS=e=>e.wake===!0&&e.text.trimStart().startsWith(`**This message is from frizz, not from the human.**`);function fS(e,t){let n=e.length-1;for(;n>t&&e[n].signOff!==!0;)n--;if(n<=t)return[];let r=[n];for(;;){let i=n-1;for(;i>t&&!uS(e[i])&&e[i].boundary!==`rest`&&e[i].signOff!==!0;)i--;if(i>t&&e[i].signOff===!0){r.push(i),n=i;continue}for(;i>t&&!uS(e[i]);)i--;if(i<=t||!dS(e[i]))break;let a=i-1;for(;a>t&&e[a].signOff!==!0&&!uS(e[a]);)a--;if(a<=t||e[a].signOff!==!0)break;r.push(a),n=a}return r.reverse()}function pS(e,t,n){let r=new Set(fS(e,t)),i=[];for(let a=Math.max(t+1,0);a<e.length;a++)e[a].signOff===!0&&(!r.has(a)&&n?.(a)||i.push(a));return i}var mS=e=>Rg(e.text).some(e=>e.kind===`fence`&&e.fenceKind===`done`);function hS(e,t,n){if(t<0||!mS(e[t]))return-1;let r=fS(e,n).at(-1);return r!==void 0&&r<t&&mS(e[r])?r:t}function gS(e){return e.status===`pending`&&e.backgroundState===`background`}function _S(e){let t=[];for(let n of e)for(let e of n.tools)gS(e)&&n.at&&t.push({label:e.desc??e.detail??e.command??`Background command`,startedAt:n.at,state:`running`,...e.shellId?{launchId:e.shellId}:{},...e.command?{command:e.command}:{}});return t}function vS(e){return e.map(e=>{if(!e.tools.some(gS))return e;let t=e.tools.filter(e=>!gS(e)),n=e.parts?.map(e=>e.kind===`tools`?{...e,tools:e.tools.filter(e=>!gS(e))}:e).filter(e=>e.kind!==`tools`||e.tools.length>0);return{...e,tools:t,parts:n}})}var yS=2e3;function bS(e,t){if(!e.spec.handle)return!1;let n=Date.parse(e.askedAt);if(!Number.isFinite(n))return!1;let r;for(let i=t.length-1;i>=0;i--){let a=t[i],o=a.at?Date.parse(a.at):NaN;if(Number.isFinite(o)&&o>=n)return!1;if(a.role===`assistant`&&a.text&&ni(a.text)){r??=u_(e);for(let e of go(a.text))if(e.read.form!==`invalid`&&r.includes(e.read.id.toLowerCase()))return!1}if(Number.isFinite(o))break}return!0}function xS(e,t,n,r){let i,a=new Set;for(let o of e){if(!bS(o,t)){n.delete(o.id);continue}let e=n.get(o.id)??r;n.set(o.id,e);let s=e+yS;r>=s||(a.add(o.id),i=i===void 0?s:Math.min(i,s))}if(n.size>a.size){let t=new Set(e.map(e=>e.id));for(let e of n.keys())t.has(e)||n.delete(e)}return a.size===0?{shown:e}:{shown:e.filter(e=>!a.has(e.id)),wakeAt:i}}function SS(e,t){let n=-1;if(!Number.isFinite(t))return n;for(let r=0;r<e.length;r++){let i=e[r];if(i.kind===`event`||i.kind===`reasoning`)continue;let a=i.at?Date.parse(i.at):NaN;Number.isFinite(a)&&a<=t&&(n=r)}return n}function CS(e,t,n=[]){let r=new Map;if(!t?.length||e.length===0)return r;let i=new Map,a=t=>{let n=i.get(t);if(!n){n=new Set;let r=e[t].text;if(e[t].role===`assistant`&&r&&ni(r))for(let e of go(r))e.read.form!==`invalid`&&n.add(e.read.id.toLowerCase());i.set(t,n)}return n};for(let i of t){if(!i.id)continue;let t=i.id.toLowerCase(),o=SS(e,Date.parse(i.at));if(o<0||!a(o).has(t)||n.some(n=>u_(n).includes(t)&&SS(e,Date.parse(n.askedAt))===o))continue;let s=r.get(o);s||r.set(o,s=new Map),s.set(t,[...s.get(t)??[],...i.faults])}return r}var wS=new WeakMap;function TS(e,t,n=[]){let r=CS(e,t,n);return r.size===0?e:e.map((e,t)=>{let n=r.get(t);if(!n)return e;let i=[...n].map(([e,t])=>`${e}\u0000${t.join(`\0`)}`).sort().join(`
|
|
119
|
+
`),a=wS.get(e);if(a?.key===i)return a.message;let o={...e,refusedFences:new Set(n.keys()),refusedReasons:n};return wS.set(e,{key:i,message:o}),o})}function ES(e){return e?.length?e.map(e=>`${e.at}|${e.id??``}|${e.faults.join(`\0`)}`).join(`
|
|
120
|
+
`):``}function DS(e){let t=e?.find(e=>e.trim());if(!t)return;let n=t.indexOf(` — `);return n!==-1&&/^`[^`]*`$/.test(t.slice(0,n).trim())&&(n=t.indexOf(` — `,n+3)),(n===-1?t:t.slice(0,n)).trim().replace(/[.;:]+$/,``)}function OS(e,t){let n=new Map;if(t.length<2||e.length===0)return n;let r=new Map,i=new Set;for(let e of t)if(!i.has(e.id)){i.add(e.id);for(let t of u_(e)){let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[...r].filter(([,e])=>e.length>1);if(a.length===0)return n;let o=a.map(([t,n])=>({name:t,rows:n.map(t=>({id:t.id,askedMs:Date.parse(t.askedAt),at:SS(e,Date.parse(t.askedAt))})).sort((e,t)=>e.askedMs-t.askedMs)}));return e.forEach((e,t)=>{if(e.role!==`assistant`||!e.text||!(ni(e.text)||e.text.includes("```awaiting")))return;let r=e.text.toLowerCase();for(let{name:e,rows:i}of o){if(!r.includes(e))continue;let a;for(let e of i)e.at<=t&&(a=e.id);if(a===void 0)continue;let o=n.get(t);o||n.set(t,o=new Map),o.set(e,a)}}),n}var kS=new WeakMap;function AS(e,t){let n=OS(e,t);return n.size===0?e:e.map((e,t)=>{let r=n.get(t);if(!r)return e;let i=[...r].map(([e,t])=>`${e}\u0000${t}`).sort().join(`
|
|
121
|
+
`),a=kS.get(e);if(a?.key===i)return a.message;let o={...e,questionOwners:r};return kS.set(e,{key:i,message:o}),o})}function jS(e,t){let n=t.description?.trim(),r=n&&!n.includes(`
|
|
122
|
+
`)?n:void 0,i=[r?void 0:n,t.preview?.trim()].filter(Boolean).join(`
|
|
123
|
+
|
|
124
|
+
`)||void 0;return{line:`${Xe(e)} ${t.label}${r?` — ${r}`:``}`,...i?{body:i}:{}}}var MS=`root`;function NS(e,t,n){return`${e}/${t}.${n}`}function PS(e){let t=e.options??[],n=t.map((e,t)=>jS(t,e));return{question:{kind:e.kind,danger:e.danger===!0,...e.secret?{secret:!0}:{},contextMd:e.question,...e.context?.trim()?{detailMd:e.context.trim()}:{},options:n.map(e=>e.line),recommendedIdxs:t.flatMap((e,t)=>e.recommended?[t]:[]),...n.some(e=>e.body)?{optionBodies:n.map(e=>e.body)}:{}},optionLabels:t.map(e=>e.label)}}function FS(e){return e.secret||e.danger||!e.options?.length?!0:e.options.some(e=>e.followUps?.some(FS))}function IS(e,t){return!t||e.kind===`multi`?null:t.chosen}function LS(e,t){let n=[],r=(e,i,a)=>{let{question:o,optionLabels:s}=PS(e);n.push({path:i,spec:e,question:o,optionLabels:s,depth:a});let c=IS(e,t.get(i));c!==null&&(e.options?.[c]?.followUps??[]).forEach((e,t)=>r(e,NS(i,c,t),a+1))};return r(e,MS,1),n}function RS(e,t){return t?t.text.trim()?!0:e.kind===`multi`?(t.chosenSet??[]).length>0:t.chosen!==null:!1}function zS(e,t){if(!RS(e.spec,t.get(`root`)))return;let n=(r,i)=>{let a=t.get(i),o=(r.options??[]).map(e=>e.label),s=IS(r,a),c=r.kind===`multi`?(a?.chosenSet??[]).slice().sort((e,t)=>e-t).flatMap(e=>o[e]===void 0?[]:[o[e]]):s===null?[]:[o[s]].filter(e=>e!==void 0),l=r.kind===`multi`||s===null?a?.text.trim():void 0,u=s===null?[]:(r.options?.[s]?.followUps??[]).map((e,t)=>n(e,NS(i,s,t)));return{questionId:e.id,question:r.question,chosen:c,...l?{text:l}:{},...u.length>0?{followUps:u}:{}}};return n(e.spec,MS)}function BS(e,t){let n=[],r=(e,t,i,a)=>{let o=e.options??[],{question:s}=PS(e),c=[],l=[];for(let e of t.chosen){let t=o.findIndex(t=>t.label===e);t===-1?l.push(e):c.includes(t)||c.push(t)}c.sort((e,t)=>e-t);let u=[l.join(`, `),t.text?.trim()].filter(Boolean).join(` — `)||void 0;if(n.push({path:i,question:{...s,options:c.map(e=>s.options[e]),recommendedIdxs:c.flatMap((e,t)=>s.recommendedIdxs.includes(e)?[t]:[]),...s.optionBodies?{optionBodies:c.map(e=>s.optionBodies[e])}:{}},settled:{chosenIdxs:c.map((e,t)=>t),...u?{text:u}:{}},depth:a}),e.kind===`multi`||c.length!==1)return;let d=c[0];(o[d]?.followUps??[]).forEach((e,n)=>{let o=t.followUps?.[n];o&&r(e,o,NS(i,d,n),a+1)})};return r(e,t,MS,1),n}function VS(e,t){let n=e.options??[];if(t.chosen===null&&t.chosenSet.length===0)return``;let r=e=>n[e]?{index:e,label:n[e].label}:null;return JSON.stringify({chosen:t.chosen===null?null:r(t.chosen),chosenSet:t.chosenSet.flatMap(e=>{let t=r(e);return t?[t]:[]})})}function HS(e,t){let n={chosen:null,chosenSet:[]};if(!t)return n;try{let r=JSON.parse(t);if(!r||typeof r!=`object`)return n;let{chosen:i,chosenSet:a}=r;if(!Array.isArray(a))return n;let o=e.options??[],s=e=>{if(!e||typeof e!=`object`)return null;let{index:t,label:n}=e;return typeof t==`number`&&Number.isInteger(t)&&t>=0&&typeof n==`string`&&o[t]?.label===n?t:null},c=new Set(a.map(s).filter(e=>e!==null));return e.kind===`multi`?{chosen:null,chosenSet:o.flatMap((e,t)=>c.has(t)?[t]:[])}:{chosen:s(i),chosenSet:[]}}catch{return n}}function US(e,t){let[n,...r]=t.split(`/`);if(n!==`root`)return;let i=e;for(let e of r){if(!/^\d+\.\d+$/.test(e))return;let[t,n]=e.split(`.`).map(Number);i=i?.options?.[t]?.followUps?.[n]}return i}function WS(e,t){return GS.has(e.key)?`keep`:e.repeat||e.defaultPrevented||!c(e)||t.keepsOwnEnter||t.surfaceGone?`spend`:`send`}var GS=new Set([`Shift`,`Control`,`Alt`,`Meta`,`CapsLock`,`Fn`]),KS=[`input`,`textarea`,`select`,`[contenteditable]:not([contenteditable='false'])`,`button`,`a[href]`,`summary`,`[role=button]`,`[role=link]`,`[role=menuitem]`,`[role=option]`,`[role=checkbox]`,`[role=radio]`,`[role=switch]`,`[role=tab]`,`[data-question-grid]`,`[data-awaiting-steps]`].join(`, `);function qS(e){return!(e instanceof Element)||e===document.body||e===document.documentElement?!1:e.closest(KS)!==null}var JS=null;function YS(e){if(!JS)return;let t=JS,n=WS(e,{keepsOwnEnter:qS(e.target),surfaceGone:t.surface!==null&&!t.surface.isConnected});n!==`keep`&&(JS=null,n===`send`&&(e.preventDefault(),t.submit()))}function XS(){JS=null}var ZS=!1;function QS(e,t){JS={submit:e,surface:t?.closest(`[data-thread-surface]`)??null},!(ZS||typeof window>`u`)&&(ZS=!0,window.addEventListener(`keydown`,YS,!0),window.addEventListener(`pointerdown`,XS,!0))}function $S({className:e}){return(0,X.jsxs)(`div`,{className:`flex items-baseline gap-[0.3em] ${e}`,children:[(0,X.jsx)(Jc,{"aria-hidden":!0,strokeWidth:2.25,className:`size-[0.9em] shrink-0 self-baseline translate-y-[calc(0.45em_-_0.5cap)]`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 text-pretty`,children:`Value stored only in memory. It will not show up in transcripts.`})]})}function eC({raw:e,question:t,questionKind:n,danger:r,interactive:i,aside:a,label:o,settled:s,pending:l}){let u=(0,q.useMemo)(()=>t??Ct(e??``,n??`question`,r),[t,e,n,r]),d=Pp(u.contextMd),f=Pp(u.detailMd??``),p=Pp(u.trailingMd??``),m=u.recommendedIdxs,h=Ip(u.recommendation??``),g=u.kind===`multi`,_=u.danger,v=i?.answer.chosen??null,y=i?.answer.chosenSet??[],b=i?.answer.text??``,x=(0,q.useRef)(null),S=(0,q.useRef)(null),C=(0,q.useRef)(i?.onSubmit);C.current=i?.onSubmit;let w=(0,q.useId)();(0,q.useLayoutEffect)(()=>{let e=x.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[b]);let T=_?fc:u.secret?Uc:g?Kc:xc,E=o??(u.secret?`Secret`:g?`Select multiple`:`Question`);return(0,X.jsxs)(nh,{tone:_?`risk`:`neutral`,surface:`question`,icon:T,kind:E,label:null,aside:a,children:[d&&(0,X.jsx)(`div`,{id:w,className:`text-fg`,children:(0,X.jsx)(kg,{className:`md-body`,html:d})}),u.detailMd&&(0,X.jsx)(`div`,{"data-question-context":!0,className:d?`mt-[13px]`:void 0,children:(0,X.jsx)(kg,{className:`md-body`,html:f})}),(u.options.length>0||i||l)&&(0,X.jsxs)(`div`,{ref:S,tabIndex:-1,onKeyDown:e=>{!i||e.target!==e.currentTarget||c({key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.nativeEvent.keyCode})&&(e.preventDefault(),e.stopPropagation(),i.onSubmit())},"data-question-grid":!0,role:`group`,"aria-labelledby":d?w:void 0,"aria-label":d?void 0:E,className:`mt-2 grid grid-cols-1 gap-1.5 outline-none`,children:[u.options.map((e,t)=>(0,X.jsxs)(q.Fragment,{children:[u.optionHeadings?.[t]&&(0,X.jsx)(tC,{md:u.optionHeadings[t]}),(0,X.jsx)(nC,{label:e,index:t,bodyMd:u.optionBodies?.[t],multi:g,recommended:m.includes(t),recTitle:m[0]===t?u.recommendedNote:void 0,selected:g?y.includes(t):v===t,settledPick:s?.chosenIdxs.includes(t)??!1,disabled:!i,onClick:n=>{if(!i)return;let r=g?y.includes(t):v===t;n>1&&r||i.onChip(t,e),QS(()=>C.current?.(),S.current),!(g&&x.current&&document.activeElement===x.current)&&S.current?.focus()}})]},t)),i&&!i.optionsOnly&&(0,X.jsxs)(`div`,{className:`relative col-span-full${u.options.length>0?` flex items-baseline`:``}`,children:[u.options.length>0&&(0,X.jsx)(`span`,{className:`pointer-events-none relative ml-[13px] -mr-[29px] flex`,children:(0,X.jsx)(iC,{id:Xe(u.options.length).slice(0,-1),live:!0})}),u.secret?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`password`,"data-secret-answer":!0,"data-surface":`questionAnswer`,"data-claims-escape":!0,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"aria-label":`Secret value`,value:b,onChange:e=>i.onText(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`){e.preventDefault(),S.current?.focus();return}e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),i.onSubmit())},placeholder:`Paste the value…`,className:`block w-full rounded-md border py-1.5 pl-3 pr-3 text-[12px] leading-snug text-fg/90 outline-none placeholder:text-muted-80 transition-colors ${b.trim()?`border-selection-border bg-selection`:`border-border bg-transparent hover:bg-panel-2 focus:border-accent`}`}),(0,X.jsx)($S,{className:`mt-2 text-[11px] leading-snug text-muted`})]}):(0,X.jsx)(`textarea`,{ref:x,"data-1p-ignore":!0,rows:1,"data-surface":`questionAnswer`,"data-claims-escape":!0,value:b,onChange:e=>i.onText(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`){e.preventDefault(),S.current?.focus();return}c({key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.nativeEvent.keyCode})&&(e.preventDefault(),i.onSubmit())},onFocus:()=>{!g&&v!==null&&i.onText(b)},placeholder:g?`Add a note…`:u.options.length?`Something else…`:`Type your answer…`,className:`block w-full min-w-0 flex-1 resize-none overflow-hidden rounded-md border py-1.5 pr-3 ${u.options.length>0?rC:`pl-3`} text-[12px] leading-snug text-fg/90 outline-none placeholder:text-muted-80 transition-colors ${b.trim()&&(g||v===null)?`border-selection-border bg-selection`:`border-border bg-transparent hover:bg-panel-2 focus:border-accent`}`})]}),!i&&l&&(0,X.jsx)(`div`,{"data-question-pending-text":!0,className:`relative col-span-full`,children:u.secret?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`password`,disabled:!0,tabIndex:-1,"aria-hidden":!0,placeholder:`Paste the value…`,className:`block w-full rounded-md border border-border bg-transparent py-1.5 pl-3 pr-3 text-[12px] leading-snug text-fg/90 outline-none placeholder:text-muted-80`}),(0,X.jsx)($S,{className:`mt-2 text-[11px] leading-snug text-muted`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`textarea`,{ref:x,"data-1p-ignore":!0,rows:1,disabled:!0,tabIndex:-1,"aria-hidden":!0,placeholder:u.options.length>0?void 0:`Type your answer…`,className:`block w-full min-w-0 resize-none overflow-hidden rounded-md border border-border bg-transparent px-3 py-1.5 text-[12px] leading-snug outline-none placeholder:text-muted-80`}),u.options.length>0&&(0,X.jsxs)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 flex items-baseline border border-transparent py-1.5 pr-3 text-[12px] leading-snug text-muted-80`,children:[(0,X.jsx)(`span`,{className:`ml-3 mr-2 flex`,children:(0,X.jsx)(iC,{id:Xe(u.options.length).slice(0,-1)})}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:g?`Add a note…`:`Something else…`})]})]})})]}),s?.text&&(0,X.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap [overflow-wrap:anywhere] rounded-md border border-border-strong border-l-2 border-l-accent/40 bg-bg/50 py-1.5 pl-[11px] pr-3 text-[12px] leading-snug text-fg`,children:u.secret?`••••••••••••`:s.text}),s&&s.chosenIdxs.length===0&&!s.text&&(0,X.jsx)(`div`,{className:`mt-2 text-[11px] text-muted-70`,children:`Not answered`}),u.trailingMd&&(0,X.jsx)(`div`,{"data-question-note":!0,className:`mt-2 text-muted-70`,children:(0,X.jsx)(kg,{className:`md-body`,html:p})}),u.recommendation&&m.length===0&&(0,X.jsx)(kg,{className:`md-inline mt-1.5 text-[11px] text-muted-70`,html:h})]})}function tC({md:e}){return(0,X.jsx)(`div`,{className:`mt-1 text-fg`,children:(0,X.jsx)(kg,{className:`md-body`,html:Ip(e.split(`
|
|
125
|
+
`).join(` `))})})}function nC({label:e,index:t,bodyMd:n,selected:r,settledPick:i,disabled:a,multi:o,recommended:s,recTitle:c,onClick:l}){let u=O(e),d=u.id??Xe(t).slice(0,-1),f=Ip(u.rest),p=Pp(n??``),m=(0,q.useId)();return(0,X.jsxs)(`div`,{"data-question-option":!0,title:c,onClick:e=>{a||e.target.closest(`a, button, summary, img[data-local-path], .local-file-action, .local-file-code`)||window.getSelection()?.toString()||l(e.detail)},className:`relative flex items-baseline gap-2 rounded-md border px-3 py-1.5 text-[12px] leading-snug transition-colors ${r?`border-selection-border bg-selection text-fg`:i?`border-border-strong border-l-2 border-l-accent/40 bg-bg/50 pl-[11px] text-fg`:a?`border-border text-muted-80`:`border-border text-fg/90 hover:bg-elevated`}`,children:[(0,X.jsx)(`button`,{type:`button`,disabled:a,"aria-labelledby":m,"aria-pressed":r||i,onClick:e=>l(e.detail),onMouseDown:e=>e.preventDefault(),className:`absolute inset-0 rounded-md outline-none`}),(0,X.jsx)(iC,{id:d,live:!a,selected:r}),o&&(0,X.jsx)(`span`,{"aria-hidden":!0,className:`mt-px flex h-3.5 w-3.5 shrink-0 self-start items-center justify-center rounded-[3px] border ${r?`border-accent bg-accent-fill text-on-accent`:i?`border-control-strong text-fg`:`border-control-strong`}`,children:(r||i)&&(0,X.jsx)(dt,{size:10,strokeWidth:3})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{id:m,children:[s&&(0,X.jsx)(`span`,{className:`pointer-events-none float-right ml-2 mt-px rounded-full border border-border-strong px-1.5 py-px text-[9.5px] leading-none uppercase tracking-wide text-muted`,children:`Recommended`}),(0,X.jsx)(kg,{as:`span`,className:`md-inline`,html:f})]}),n!==void 0&&(0,X.jsx)(kg,{className:`md-body mt-1.5 opacity-90`,html:p})]})]})}var rC=`pl-9`;function iC({id:e,live:t=!1,selected:n=!1}){return(0,X.jsxs)(`span`,{"aria-hidden":!0,className:`flex w-4 shrink-0 justify-end whitespace-nowrap text-[11px] transition-colors ${n&&t?`text-fg`:`text-muted`}`,children:[e,`.`]})}var aC=(0,q.createContext)(null);function oC(){return(0,q.useContext)(aC)}function sC({questions:e}){let t=oC();return e.length===0?null:(0,X.jsx)(`div`,{"data-compact-questions":!0,className:`min-w-0 overflow-hidden rounded-[12px] border border-border-strong bg-panel pb-2.5 text-[14px] leading-5`,children:e.map((e,n)=>(0,X.jsx)(`div`,{"data-question-id":e.id,onClick:t?.open?n=>{n.target.closest(`a, button`)||t.open?.(e.id)}:void 0,className:`${n>0?`mt-2.5 border-t border-border`:``}${t?.open?` cursor-pointer`:``}`,children:(0,X.jsx)(cC,{q:e,n:t?.numberOf(e.id)??n+1})},e.id))})}function cC({q:e,n:t}){let n=Pp(e.spec.question),r=e.spec.options??[],i=ui();return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex gap-2 px-3.5 pb-1 pt-[11px] font-semibold`,children:[(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums text-accent`,children:t}),(0,X.jsx)(kg,{className:`min-w-0 flex-1 ${lC}`,html:n})]}),r.map((e,t)=>(0,X.jsxs)(`div`,{"data-compact-option":!0,className:`flex gap-2 py-0.5 pl-[30px] pr-3.5 text-muted`,children:[(0,X.jsx)(`span`,{className:`w-3 shrink-0 font-bold`,children:Xe(t).slice(0,-1)}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(dC,{md:e.label}),e.recommended&&(0,X.jsx)(`span`,{className:`ml-1 text-[11px] font-semibold leading-none text-accent`,children:`RECOMMENDED`})]})]},t)),i&&FS(e.spec)&&(0,X.jsxs)(Is,{className:`px-3.5 pt-1 text-[13px] text-muted`,children:[`This question has to be answered on `,i,`.`]})]})}var lC=`md-inline break-words [&_p+*]:mt-2 [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_li+li]:mt-1 [&_pre]:[white-space:var(--code-wrap,pre-wrap)] [&_pre]:overflow-x-auto [&_pre]:text-[0.85em] [&_code]:text-[0.9em] [&_a]:underline`;function uC({count:e,onAnswer:t,onReply:n}){return(0,X.jsxs)(X.Fragment,{children:[n&&(0,X.jsx)(`button`,{type:`button`,"data-phone-answer-reply":!0,onClick:n,"aria-label":`Write a reply instead`,title:`Write a reply instead`,className:`flex size-[42px] shrink-0 items-center justify-center rounded-full border border-border-strong bg-panel text-fg active:bg-hover`,children:(0,X.jsx)(Wc,{"aria-hidden":!0,size:19,strokeWidth:1.8})}),(0,X.jsx)(`button`,{type:`button`,"data-phone-answer-open":!0,onClick:t,className:`flex h-[42px] min-w-0 flex-1 items-center justify-center rounded-full bg-fg px-4 text-[15px] font-semibold text-bg active:opacity-90`,children:e>1?`Answer ${e} questions`:`Answer`})]})}function dC({md:e}){return(0,X.jsx)(kg,{as:`span`,className:`md-inline`,html:Ip(e)})}function fC(e){let t=e instanceof Error?e.message:`The answer could not be sent.`;return t.length>240?`${t.slice(0,239)}…`:t}var pC=(0,q.createContext)(null);function mC(e){let t=e?.id,n=e?.questions??[],r=As(),i=ui(),[a,o]=(0,q.useState)(()=>new Map),[s,c]=(0,q.useState)(),l=(0,q.useContext)(Z_),u=(0,q.useContext)(H_),d=$a((0,q.useMemo)(()=>t?n.flatMap(e=>e.spec.secret?[]:HC(e).flatMap(n=>[H.question(r,t,e.id,n),H.questionPick(r,t,e.id,n)])):[],[r,t,n])),f=(e,n)=>{if(e.spec.secret)return{chosen:null,chosenSet:[],text:a.get(e.id)??``};let i=US(e.spec,n),o=i?HS(i,t?d.get(H.questionPick(r,t,e.id,n))??``:``):void 0;return{chosen:o?.chosen??null,chosenSet:o?.chosenSet??[],text:(t?d.get(H.question(r,t,e.id,n)):void 0)??``}},p=e=>new Map(HC(e).map(t=>[t,f(e,t)])),m=n.flatMap(e=>{let t=zS(e,p(e));return t?[{q:e,answer:t}]:[]}),h=m.map(e=>e.answer),g=oo(),_=Ji({mutationFn:async e=>W.answerQuestions({slug:t,answers:e.answers}),onSuccess:(e,t)=>{for(let n of e.answered){o(e=>{if(!e.has(n))return e;let t=new Map(e);return t.delete(n),t});for(let e of t.drafts.find(e=>e.id===n)?.keys??[])G.clear(e)}},onError:e=>{l?.cancel(),t&&Xo(t),c(fC(e))},onSettled:()=>{t&&g.invalidateQueries({queryKey:gC(t)})}}),v=Ji({mutationFn:async e=>W.dismissQuestions({slug:t,ids:[e]}),onError:e=>c(fC(e))}),y=e=>e.map(({q:e,answer:t})=>e.spec.secret?{...t,text:`(secret sent)`}:t),b=(e,t)=>{let n=gC(e);g.cancelQueries({queryKey:n});let r=new Date().toISOString(),i=new Set(t.map(e=>e.q.id));ba(e,[...i]);let a=y(t);g.setQueryData(n,e=>({closed:e?.closed??[],questions:[...(e?.questions??[]).filter(e=>!i.has(e.id)),...t.map(({q:e},t)=>({id:e.id,spec:e.spec,askedAt:e.askedAt,settledAt:r,pending:!0,answer:a[t]}))]}))},x=(e,t)=>t.map(({q:t})=>({id:t.id,keys:t.spec.secret?[]:HC(t).flatMap(n=>[H.question(r,e,t.id,n),H.questionPick(r,e,t.id,n)])})),S=()=>{!t||h.length===0||_.isPending||(c(void 0),(l?.sent??l?.dismiss)?.(),$r(t),b(t,m),_.mutate({answers:h,drafts:x(t,m)}))},C=()=>{if(!t||h.length===0)return null;let e=m,n=x(t,e),r=()=>void g.invalidateQueries({queryKey:gC(t)}),i=()=>{o(t=>{if(!e.some(({q:e})=>t.has(e.id)))return t;let n=new Map(t);for(let{q:t}of e)n.delete(t.id);return n});for(let e of n)for(let t of e.keys)G.clear(t)};return{answers:h,display:y(e).map((t,n)=>Gs(t,e[n].q.spec,e[n].q.handle)),onOptimistic:()=>{c(void 0),b(t,e)},onSuccess:()=>{i(),r()},onRollback:e=>{e&&i(),r()}}},w=()=>{u?.composer.run()||S()};return{slug:t,answerFor:f,answersOf:p,onChip:(e,n,i,a)=>{let o=US(e.spec,n);if(!t||!o||e.spec.secret||!o.options?.[a])return;let s=H.questionPick(r,t,e.id,n),c=HS(o,G.get(s)),l=i?{...c,chosenSet:c.chosenSet.includes(a)?c.chosenSet.filter(e=>e!==a):[...c.chosenSet,a]}:{...c,chosen:c.chosen===a?null:a};G.set(s,VS(o,l))},onText:(e,n,a,s)=>{if(!(!t||i)){if(e.spec.secret){o(t=>t.get(e.id)===s?t:new Map(t).set(e.id,s));return}G.set(H.question(r,t,e.id,n),s),a||G.clear(H.questionPick(r,t,e.id,n))}},dismiss:e=>v.mutate(e),dismissing:v.isPending,submit:()=>w(),take:C,staged:h.length,sending:_.isPending,error:s,readAndAnswerHost:i}}var hC=[],gC=e=>[`settledQuestions`,e],_C=[],vC=e=>e.questions,yC=e=>e.closed;function bC(e,t){return Fo({queryKey:gC(e??``),queryFn:async()=>{let t=await W.threadSettledQuestions({slug:e});return{questions:t.questions,closed:t.closed??[]}},enabled:!!e,refetchOnWindowFocus:!1,select:t})}function xC(e){let t=e?.id,n=oo(),r=bC(t,vC),i=(e?.questions??[]).map(e=>e.id).join(` `),a=(0,q.useRef)(i);return(0,q.useEffect)(()=>{let e=a.current;if(a.current=i,!t||e===i)return;let r=new Set(i.split(` `));e.split(` `).some(e=>e&&!r.has(e))&&n.invalidateQueries({queryKey:gC(t)})},[i,n,t]),r.data??hC}function SC(e){return bC(e?.id,yC).data??_C}var CC=[];function wC(e,t){let n=e?.questions??CC;if(t.length===0||n.length===0)return n;let r=new Set(t.map(e=>e.id));return n.some(e=>r.has(e.id))?n.filter(e=>!r.has(e.id)):n}function TC({s:e,copy:t}){let n=(0,q.useMemo)(()=>BS(e.spec,e.answer),[e.spec,e.answer]),r=e=>(0,X.jsx)(eC,{question:e.question,label:e.depth>1?`Follow-up`:void 0,settled:e.settled},e.path),i=n.slice(1);return(0,X.jsxs)(`article`,{...t?{"data-question-copy":e.id}:{"data-question-id":e.id},"data-settled-question":!0,"aria-label":`Answered question`,className:`flex min-w-0 flex-col gap-2 opacity-60`,children:[r(n[0]),i.length>0&&(0,X.jsx)(`div`,{className:`ml-3 flex flex-col gap-2 border-l border-border pl-3`,children:i.map(e=>(0,X.jsx)(`div`,{className:e.depth>2?`ml-3 border-l border-border pl-3`:void 0,children:r(e)},e.path))})]})}function EC({questions:e,className:t=``}){return e.length===0?null:(0,X.jsx)(`section`,{"data-settled-questions":!0,"aria-label":`${e.length} answered question${e.length===1?``:`s`}`,className:`flex min-w-0 flex-col gap-3 ${t}`,children:e.map(e=>(0,X.jsx)(TC,{s:e},e.id))})}function DC(e){return`settledAt`in e?e:void 0}function OC(e,t,n,r,i=_C){let a=r?.closedQuestions,o=(0,q.useMemo)(()=>{let e=new Map(i.map(e=>[e.id,e.spec]));return(a??[]).map(t=>({id:t.id,handle:t.handle,closed:t.state,asked:e.get(t.id)}))},[a?.length?a.map(e=>`${e.id}:${e.state}`).join(` `):``,i]);return(0,q.useMemo)(()=>e?void 0:[...t,...n,...o],[e,t,n,o])}function kC(e,t){let n=(0,q.useRef)(new Map),[,r]=(0,q.useState)(0),{shown:i,wakeAt:a}=xS(e,t,n.current,Date.now());return(0,q.useEffect)(()=>{if(a===void 0)return;let e=setTimeout(()=>r(e=>e+1),Math.max(0,a-Date.now()));return()=>clearTimeout(e)},[a]),(0,q.useMemo)(()=>i,[e,i===e?``:e.filter(e=>!i.includes(e)).map(e=>e.id).join(` `)])}function AC(e,t,n,r){let i=t?.questionFaults,a=(0,q.useMemo)(()=>i,[ES(i)]),o=t?.closedQuestions,s=(0,q.useMemo)(()=>a?.length?[...n,...r,...o??[]]:[],[a,n,r,o]);return(0,q.useMemo)(()=>a?.length?TS(e,a,s):e,[e,a,s])}function jC(e,t,n,r){let i=t?.closedQuestions,a=(0,q.useMemo)(()=>[...n,...r,...i??[]],[n,r,i?.length?i.map(e=>e.id).join(` `):``]);return(0,q.useMemo)(()=>AS(e,a),[e,a])}function MC({spec:e}){let t=(0,q.useMemo)(()=>PS(e).question,[e]);return(0,X.jsx)(`article`,{"data-question-fence":e.handle,"data-question-unregistered":!0,className:`flex min-w-0 flex-col gap-2`,children:(0,X.jsx)(eC,{question:t,pending:!0})})}function NC({spec:e,state:t,copyOf:n}){let r=(0,q.useMemo)(()=>PS(e).question,[e]);return(0,X.jsx)(`article`,{...n?{"data-question-copy":n}:{"data-question-fence":e.handle},"data-question-closed":t,"aria-label":t===`dismissed`?`Dismissed question`:`Withdrawn question`,className:`flex min-w-0 flex-col gap-2 opacity-60`,children:(0,X.jsx)(eC,{question:r,label:t===`dismissed`?`Question dismissed`:`Question withdrawn`,settled:PC})})}var PC={chosenIdxs:[]};function FC({spec:e,reasons:t,unread:n}){let r=(0,q.useMemo)(()=>PS(e).question,[e]);return(0,X.jsx)(LC,{reasons:t,...n?{"data-question-invalid":e.handle}:{"data-question-refused-ask":e.handle},children:(0,X.jsx)(`div`,{className:`opacity-60`,children:(0,X.jsx)(eC,{question:r})})})}function IC({faults:e,children:t}){return(0,X.jsx)(LC,{reasons:e,"data-question-invalid":``,children:t})}function LC({reasons:e,children:t,...n}){let r=DS(e),i=Ip(r?`Question not asked: ${r}.`:`Question not asked.`);return(0,X.jsxs)(`div`,{...n,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,X.jsx)(`p`,{"data-question-not-asked":!0,className:`text-[13px] leading-snug text-muted`,children:(0,X.jsx)(kg,{as:`span`,className:`md-inline`,html:i})}),t]})}function RC({id:e,closed:t}){return(0,X.jsxs)(`p`,{"data-question-refused":e,className:`md-inline text-[13px] leading-snug text-muted`,children:[`Refers to `,(0,X.jsx)(`code`,{children:e}),`, `,t===`withdrawn`?`a question the worker withdrew`:t===`dismissed`?`a question that was dismissed`:`a question this thread never asked`,`.`]})}function zC({thread:e,children:t}){let n=mC(e);return(0,X.jsx)(pC.Provider,{value:n,children:t})}function BC({q:e,answering:t}){let n=(0,q.useContext)(pC),r=oC(),i=t??n;if(!i||!i.slug)return null;if(r)return(0,X.jsx)(sC,{questions:[e]});if(i.readAndAnswerHost&&FS(e.spec))return(0,X.jsxs)(`article`,{"data-question-id":e.id,className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsx)(eC,{question:PS(e.spec).question}),(0,X.jsxs)(Is,{className:`text-[12px] text-muted`,children:[`This question has to be answered on `,i.readAndAnswerHost,`.`]})]});let a=LS(e.spec,i.answersOf(e)),o=t=>(0,X.jsx)(eC,{question:t.question,label:t.depth>1?`Follow-up`:void 0,aside:t.depth===1&&!e.spec.danger&&!i.readAndAnswerHost?(0,X.jsx)(`button`,{type:`button`,"data-dismiss-question":!0,"aria-label":`Dismiss this question`,title:`Dismiss — the worker decides it itself`,disabled:i.dismissing,onClick:()=>i.dismiss(e.id),className:`icon-focus-outline card-icon-offset -mx-2 -my-1 flex rounded-md p-1 text-muted-70 outline-none transition-colors hover:bg-hover-strong hover:text-fg disabled:opacity-40`,children:(0,X.jsx)(zs,{size:16})}):void 0,interactive:{answer:i.answerFor(e,t.path),onChip:n=>i.onChip(e,t.path,t.spec.kind===`multi`,n),onText:n=>i.onText(e,t.path,t.spec.kind===`multi`,n),onSubmit:i.submit,...i.readAndAnswerHost?{optionsOnly:!0}:{}}},t.path),s=a.slice(1);return(0,X.jsxs)(`article`,{"data-question-id":e.id,className:`flex min-w-0 flex-col gap-2`,children:[o(a[0]),s.length>0&&(0,X.jsx)(`div`,{className:`ml-3 flex flex-col gap-2 border-l border-border pl-3`,children:s.map(e=>(0,X.jsx)(`div`,{className:e.depth>2?`ml-3 border-l border-border pl-3`:void 0,children:o(e)},e.path))})]})}function VC({thread:e,questions:t,inFlight:n=null,showSend:r=!1,className:i=``}){let a=e?.id,o=t??e?.questions??[],s=(0,q.useContext)(pC),c=mC(s?void 0:e),l=s??c,u=oC(),d=Y_(),f=r&&!d;return!a||o.length===0&&(!f||u)?!a||!n?.length?null:(0,X.jsx)(`section`,{"data-answers-in-flight":!0,"aria-label":`Your answer, on its way to the worker`,className:`flex min-w-0 flex-col items-end ${i}`,children:(0,X.jsx)(ov,{answers:n,queued:!0})}):u?(0,X.jsxs)(`section`,{"data-registered-questions":!0,"aria-label":`${o.length} question${o.length===1?``:`s`} waiting for an answer`,className:`flex min-w-0 flex-col gap-3 ${i}`,children:[(0,X.jsx)(sC,{questions:o}),l.error&&(0,X.jsx)(`div`,{role:`alert`,className:`break-words text-[13px] leading-snug text-danger-soft`,children:l.error}),l.sending&&(0,X.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-[13px] leading-snug text-muted`,children:`Sending…`})]}):(0,X.jsxs)(`section`,{"data-registered-questions":!0,"aria-label":o.length>0?`${o.length} question${o.length===1?``:`s`} waiting for an answer`:`Send the answers above`,className:`flex min-w-0 flex-col gap-3 ${i}`,children:[o.map(e=>(0,X.jsx)(BC,{q:e,answering:l},e.id)),l.error&&(0,X.jsx)(`div`,{role:`alert`,className:`break-words text-[11px] leading-snug text-danger-soft`,children:l.error}),l.sending&&(0,X.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-[11px] leading-snug text-muted`,children:`Sending…`}),!d&&(0,X.jsx)(`div`,{className:`flex justify-start`,children:(0,X.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:l.staged===0||l.sending,onClick:l.submit,onMouseDown:e=>e.preventDefault(),className:`button-outline rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-all hover:opacity-90 active:scale-95 disabled:opacity-30 disabled:hover:opacity-30`,children:`Send answers`})})]})}function HC(e){let t=[],n=(e,r)=>{t.push(r),e.options?.forEach((e,t)=>{e.followUps?.forEach((e,i)=>n(e,`${r}/${t}.${i}`))})};return n(e.spec,MS),t}function UC(e,t){let n=xC(e);Wg(e);let r=(0,q.useMemo)(()=>wC(e,n),[e,n]),i=Vx(e,t),a=(0,q.useMemo)(()=>_S(i),[i]),o=(0,q.useMemo)(()=>vS(i),[i]),s=kC(r,i);return{messages:WC(jC(AC(o,e,s,n),e,s,n),e),openQuestions:s,settledQuestions:n,transcriptShells:a}}function WC(e,t){let n=t?.runtime===`running`||t?.runtime===`spawning`;return(0,q.useMemo)(()=>{if(n)return e;let t=L(e),r=pS(e,t);if(r.length===0)return e;let i=new Set(fS(e,t)),a=[...e];for(let e of r)a[e]={...a[e],keptSignOff:i.has(e)?`newest`:`earlier`};return a},[e,n])}var GC=(0,q.createContext)(null),KC=(0,q.createContext)(null);function qC(){let e=(0,q.useContext)(GC);if(!e)throw Error(`A thread's prompt box must be rendered inside a <ThreadSurface>`);return e}function JC(){let e=(0,q.useContext)(KC);if(!e)throw Error(`A thread's transcript must be rendered inside a <ThreadSurface>`);return e}function YC(e){let t=(0,q.useContext)(KC)?.opsThread;return t&&t.id===e.id?t:e}var XC=(e,t)=>e===t||e!==`all`&&t!==`all`&&e.size===t.size&&[...e].every(e=>t.has(e)),ZC=(e,t)=>Ix(e,t,XC);function QC(e,t={}){let{slug:n,thread:r,messages:i}=e,a=Px(e.openQuestions,ia),o=Px(e.settledQuestions,ia),{exit:s}=t,c=W_(),l=K_(c),u=Ex(n,i,s?()=>{if(s.sent){s.sent();return}document.activeElement?.blur(),s.dismiss()}:void 0,{onSendFailed:s?.cancel,composer:c}),{stagedCount:d,takeAnswers:f,answeringForMessage:p}=u,m=G_(c,{stagedCount:d,takeAnswers:f}),h=r?.runtime===`running`||r?.runtime===`spawning`,g=(0,q.useMemo)(()=>yx(i),[i]),_=h?i.length:g,v=(0,q.useMemo)(()=>r?.heldHandoff?zg(i,_):-1,[r?.heldHandoff,i,_]),y=ky(r),b=y&&r?.lastFence?.kind===`awaiting`?r.lastFence:void 0,x=(0,q.useMemo)(()=>Wx(i,_,b),[i,_,b]),S=(0,q.useMemo)(()=>h?-1:hS(i,g,L(i)),[h,i,g]),C=Gn(r?.spawnedAt),w=Fx(OC(C,a,o,r,SC(r)),Rx),T=Px((0,q.useMemo)(()=>i_(i,a),[i,a]),Lx),E=(0,q.useMemo)(()=>g_(i,a),[i,a]),D=Px(E.placed,Lx),O=(0,q.useMemo)(()=>({...E,placed:D}),[E,D]),k=(0,q.useMemo)(()=>lS(i,o),[i,o]),A=Px(k.placed,Lx),j=(0,q.useMemo)(()=>({...k,placed:A}),[k,A]),M=Px((0,q.useMemo)(()=>Xt(i),[i]),ia),N=Px((0,q.useMemo)(()=>N_(i),[i]),ZC),P=(0,q.useMemo)(()=>La(i,r?.answersInFlight),[i,r?.answersInFlight]),F=Mx(r,i),I=(0,q.useMemo)(()=>Zr(i),[i]),R=(0,q.useMemo)(()=>({held:I.held,steered:I.steered}),[I.held,I.steered]),ee=qb(n,i),te=(0,q.useMemo)(()=>({thread:r,messages:i,running:h,lastAgentIdx:g,awaitingCut:_,heldIdx:v,restingShown:y,restated:x,hidesAwaiting:e=>[_>=0&&e<_&&e!==v,e===g&&y||x.has(e)],doneIdx:S,stepsDone:N,openQuestions:a,fencesLive:C,fenceQuestions:w,shadowedByMessage:T,placement:O,settledPlacement:j,paired:M,inFlightAnswers:P,answeringForMessage:p,opsThread:F}),[r,i,h,g,_,v,y,x,S,N,a,C,w,T,O,j,M,P,p,F]),ne=Ae(),re=pr(e=>ne.give(e)),ie=(0,q.useMemo)(()=>({fileDrop:{over:re.over,intake:ne}}),[re.over,ne]),z=s?.dismiss,B=s?.cancel,ae=s?.sent,oe=(0,q.useMemo)(()=>z&&B?{dismiss:z,cancel:B,sent:ae}:null,[z,B,ae]);return{slug:n,answering:u,transcript:te,promptBoxSends:l,fileOver:re.over,queuedRun:R,comments:ee,exit:oe,sendScope:m,zone:re.handlers,box:ie}}function $C({surface:e,children:t,...n}){let r=b(),i=aS(e.slug,e.queuedRun),a=e.zone,[o,s]=(0,q.useState)(null),c=n.ref,l=(0,q.useCallback)(e=>{s(e),typeof c==`function`?c(e):c&&(c.current=e)},[c]);return(0,q.useEffect)(()=>{if(r)return r.current=a,()=>{r.current===a&&(r.current=null)}}),(0,X.jsx)(X_.Provider,{value:e.slug,children:(0,X.jsx)(Z_.Provider,{value:e.exit,children:(0,X.jsx)(H_.Provider,{value:e.sendScope,children:(0,X.jsx)(U_.Provider,{value:e.sendScope.composer,children:(0,X.jsx)(zC,{thread:e.transcript.thread,children:(0,X.jsx)(KC.Provider,{value:e.transcript,children:(0,X.jsx)(Q_.Provider,{value:e.queuedRun,children:(0,X.jsx)(GC.Provider,{value:e.box,children:(0,X.jsx)(Hb,{value:e.comments,children:(0,X.jsxs)(`div`,{...n,...r?null:a,"data-thread-surface":e.slug,ref:l,onKeyDown:e=>{n.onKeyDown?.(e),i(e)},children:[t,(0,X.jsx)(px,{root:o})]})})})})})})})})})})}function ew({blocks:e,answering:t,onClose:n}){let[r,i]=(0,q.useState)(0),[a,o]=(0,q.useState)(!1);(0,q.useEffect)(()=>{let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]),(0,q.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),n())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[n]);let s=e[Math.min(r,e.length-1)];if(!s)return null;let c=r>=e.length-1;return(0,X.jsxs)(he,{"data-mobile-answer-sheet":!0,label:`Answer questions`,className:`fixed inset-0 ${fn} flex flex-col justify-end`,children:[(0,X.jsx)(`button`,{"aria-label":`Close`,onClick:n,className:`absolute inset-0 bg-scrim-50 transition-opacity duration-200 ${a?`opacity-100`:`opacity-0`}`}),(0,X.jsxs)(`div`,{className:`relative flex max-h-[86%] flex-col overflow-hidden rounded-t-[14px] border-t border-border-strong bg-panel pb-[env(safe-area-inset-bottom)] shadow-[0_-20px_60px_-10px_var(--sheet-shadow)] transition-transform duration-200 ease-out motion-reduce:transition-none ${a?`translate-y-0`:`translate-y-full`}`,children:[(0,X.jsx)(`div`,{className:`mx-auto mt-[6px] h-[5px] w-[36px] shrink-0 rounded-full bg-muted/35`}),(0,X.jsxs)(`div`,{className:`flex h-[48px] shrink-0 items-center gap-2 border-b border-border/70 px-3`,children:[(0,X.jsx)(`button`,{onClick:n,className:`flex h-[44px] items-center px-2 text-[16px] text-fg/85`,children:`Cancel`}),(0,X.jsx)(`span`,{className:`flex-1 text-center text-[15px] font-semibold tracking-[-0.01em] text-fg`,children:e.length>1?`Question ${r+1} of ${e.length}`:`Question`}),(0,X.jsx)(`span`,{className:`flex h-[44px] w-[44px] items-center justify-center`,children:(0,X.jsx)(zs,{size:19,className:`opacity-0`,"aria-hidden":!0})})]}),(0,X.jsx)(`div`,{"data-mobile-answer-body":!0,className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:(0,X.jsx)(eC,{raw:s.raw,questionKind:s.kind,danger:s.danger,interactive:{answer:t.answerFor(s.bi),onChip:(e,n)=>t.onChip(s.bi,e,n),onText:e=>t.onText(s.bi,e),onSubmit:()=>c?l():i(e=>e+1)}},s.bi)}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-3 border-t border-border/70 px-4 pb-[30px] pt-3`,children:[e.length>1?(0,X.jsx)(`div`,{className:`flex items-center gap-1.5`,children:e.map((e,t)=>(0,X.jsx)(`span`,{className:`size-[6px] rounded-full ${t===r?`bg-accent`:`bg-muted/35`}`},e.bi))}):null,(0,X.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[r>0?(0,X.jsx)(`button`,{onClick:()=>i(e=>e-1),className:`flex h-[50px] shrink-0 items-center justify-center rounded-[14px] border border-border-strong bg-elevated px-5 text-[17px] text-fg active:bg-panel-2`,children:`Back`}):null,(0,X.jsx)(`button`,{onClick:()=>c?l():i(e=>e+1),disabled:c?!t.anyAnswered||t.sending:!1,className:`button-outline flex h-[50px] flex-1 items-center justify-center rounded-[14px] bg-accent-fill px-5 text-[17px] font-semibold text-on-accent transition-[filter,opacity] active:brightness-90 disabled:opacity-40`,children:c?t.sending?`Sending…`:`Send answers`:`Continue`})]})]})]})]});function l(){t.onSubmit(),n()}}var tw=(e,t)=>`${e}|${t}`;function nw(e,t){return e.flatMap(e=>LS(e.spec,t(e)).map(t=>({key:tw(e.id,t.path),q:e,path:t.path,spec:t.spec,depth:t.depth})))}function rw(e,t,n,r){return iw(nw(e,e=>{let i=t(e);if(e.id!==n.q.id)return i;let a=i.get(n.path)??{chosen:null,chosenSet:[],text:``};return new Map(i).set(n.path,{...a,chosen:r})}),n.key)}function iw(e,t){let n=e.findIndex(e=>e.key===t);return n===-1?null:e[n+1]?.key??null}function aw(e,t){return e.find(e=>!RS(e.spec,t(e.q).get(e.path)))?.key??null}var ow=`••••••••`;function sw(e,t){if(!t||!RS(e,t))return null;if(e.secret)return ow;let n=(e.options??[]).map(e=>cw(e.label)),r=t.text.trim();return e.kind===`multi`?[(t.chosenSet??[]).slice().sort((e,t)=>e-t).flatMap(e=>n[e]===void 0?[]:[n[e]]).join(`, `),r].filter(Boolean).join(` — `):t.chosen!==null&&n[t.chosen]!==void 0?n[t.chosen]:r||null}function cw(e){return e.replace(/[`*_~]/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\s+/g,` `).trim()}function lw(e){let t=e?.trim();return t&&!t.includes(`
|
|
126
|
+
`)?t:void 0}function uw({title:e,onRequestClose:t,children:n,footer:r,className:i=``,dataAttr:a}){let[o,s]=(0,q.useState)(!1),c=(0,q.useRef)(null);(0,q.useEffect)(()=>{let e=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(e)},[]);let l=a?{[a]:``}:{};return(0,X.jsx)(Uo,{open:!0,onOpenChange:e=>{e||t()},children:(0,X.jsxs)(yr,{children:[(0,X.jsx)(Or,{className:`fixed inset-0 ${fn} bg-scrim-50 transition-opacity duration-200 motion-reduce:transition-none ${o?`opacity-100`:`opacity-0`}`}),(0,X.jsxs)(et,{ref:c,...l,"aria-describedby":void 0,onOpenAutoFocus:e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})},onEscapeKeyDown:pi,className:`fixed inset-x-0 bottom-0 ${fn} flex max-h-[86%] flex-col overflow-hidden rounded-t-[14px] border-t border-border-strong bg-panel pb-[calc(14px+env(safe-area-inset-bottom))] shadow-[0_-20px_60px_-10px_var(--sheet-shadow)] outline-none transition-transform duration-200 ease-out motion-reduce:transition-none ${o?`translate-y-0`:`translate-y-full`} ${i}`,children:[(0,X.jsx)(Ir,{className:`sr-only`,children:e}),(0,X.jsx)(`div`,{"aria-hidden":!0,className:`mx-auto mt-[6px] mb-[6px] h-[5px] w-[36px] shrink-0 rounded-full bg-muted/35`}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:n}),r]})]})})}function dw({questions:e,startAt:t,onClose:n}){let r=(0,q.useContext)(pC),i=Hi(n),a=r?nw(e,r.answersOf):[],[o,s]=(0,q.useState)(()=>r?a.find(e=>e.q.id===t)?.key??aw(a,r.answersOf):null),[c,l]=(0,q.useState)(!1),u=e.length===0;if((0,q.useEffect)(()=>{u&&i()},[u,i]),!r||!r.slug||u)return null;let d=o===null?-1:a.findIndex(e=>e.key===o),f=d===-1?void 0:a[d],p=e=>{l(!1),s(e)},m=f?d:a.length,h=(0,X.jsx)(`span`,{"aria-hidden":!0,className:`flex gap-[5px]`,children:Array.from({length:a.length+1},(e,t)=>(0,X.jsx)(`i`,{className:`size-[6px] rounded-full ${t<=m?`bg-fg`:`bg-border-strong`}`},t))});return(0,X.jsxs)(uw,{title:f?`Question ${d+1} of ${a.length}`:`Review your answers`,onRequestClose:()=>i(),dataAttr:`data-answer-sheet`,footer:f?(0,X.jsx)(yw,{a:r,step:f,first:d===0,writing:c,onBack:()=>p(a[d-1]?.key??f.key),onNext:()=>p(iw(a,f.key))}):(0,X.jsx)(xw,{a:r,onSent:()=>i()}),children:[(0,X.jsxs)(`div`,{"data-answer-step":f?f.key:`review`,className:`flex items-center gap-2 px-[18px] pb-1 text-[12.5px] text-muted`,children:[h,(0,X.jsxs)(`span`,{children:[f?`Question ${d+1} of ${a.length}`:`Review`,f&&f.depth>1&&` · follow-up`,f?.spec.danger&&(0,X.jsx)(`span`,{className:`text-danger-soft`,children:` · destructive`})]})]}),f?(0,X.jsx)(fw,{a:r,step:f,writing:c,onWrite:()=>l(!0),onPick:t=>{let n=rw(e,r.answersOf,f,t);r.answerFor(f.q,f.path).chosen!==t&&r.onChip(f.q,f.path,!1,t),p(n)}},f.key):(0,X.jsx)(bw,{a:r,steps:a,onChange:e=>p(e)})]})}function fw({a:e,step:t,writing:n,onWrite:r,onPick:i}){let a=Pp(t.spec.question),o=Pp(t.spec.context?.trim()??``),s=e.answerFor(t.q,t.path),c=t.spec.options??[],l=t.spec.kind===`multi`,u=!e.readAndAnswerHost&&(c.length===0||n||!l&&s.chosen===null&&s.text.trim()!==``);return(0,X.jsxs)(`div`,{"data-answer-question":!0,children:[(0,X.jsx)(kg,{className:`px-[18px] pb-3 pt-1 text-[17px] font-semibold leading-[23px] text-fg ${lC}`,html:a}),o&&(0,X.jsx)(`div`,{"data-question-context":!0,className:`card-md min-w-0 overflow-x-auto px-[18px] pb-3 text-fg/75`,children:(0,X.jsx)(kg,{className:`md-body`,html:o})}),c.length>0&&(0,X.jsxs)(`div`,{role:l?`group`:`radiogroup`,className:`border-b border-border`,children:[c.map((n,r)=>(0,X.jsx)(mw,{option:n,multi:l,on:l?(s.chosenSet??[]).includes(r):s.chosen===r,onClick:()=>l?e.onChip(t.q,t.path,!0,r):i(r)},r)),!u&&!e.readAndAnswerHost&&(0,X.jsxs)(`button`,{type:`button`,"data-answer-write":!0,onClick:r,className:`${pw} text-left`,children:[(0,X.jsx)(gw,{multi:l,on:!1,dashed:!0}),(0,X.jsx)(`span`,{className:`text-[15.5px] font-medium leading-[21px] text-muted`,children:l?`Add a note…`:`Write a different answer…`})]})]}),u&&t.spec.secret&&(0,X.jsx)(vw,{a:e,step:t,text:s.text}),u&&!t.spec.secret&&(0,X.jsx)(_w,{a:e,step:t,autoFocus:n,placeholder:c.length===0?`Type your answer…`:l?`Add a note…`:`Write a different answer…`})]})}var pw=`flex w-full items-start gap-3 border-t border-border px-[18px] py-3 outline-none active:bg-hover focus-visible:bg-hover`;function mw({option:e,multi:t,on:n,onClick:r}){let i=lw(e.description),a=[i?void 0:e.description?.trim(),e.preview?.trim()].filter(Boolean).join(`
|
|
127
|
+
|
|
128
|
+
`);return(0,X.jsxs)(`button`,{type:`button`,role:t?`checkbox`:`radio`,"aria-checked":n,"data-answer-option":!0,"data-on":n||void 0,onClick:e=>{e.target.closest(`[data-lightbox-tile], img[data-local-path]`)||r()},className:`${pw} text-left`,children:[(0,X.jsx)(gw,{multi:t,on:n}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`span`,{className:`block text-[15.5px] font-medium leading-[21px] text-fg`,children:[(0,X.jsx)(dC,{md:e.label}),e.recommended&&(0,X.jsx)(`span`,{className:`ml-1.5 text-[11px] font-bold leading-none tracking-[0.02em] text-accent`,children:`RECOMMENDED`})]}),i&&(0,X.jsx)(`span`,{className:`mt-px block text-[13px] leading-[18px] text-muted`,children:i}),a&&(0,X.jsx)(hw,{md:a})]})]})}function hw({md:e}){return(0,X.jsx)(`div`,{className:`card-md mt-1 text-muted`,children:(0,X.jsx)(kg,{className:`md-body`,html:Pp(e)})})}function gw({multi:e,on:t,dashed:n=!1}){return(0,X.jsx)(`span`,{"aria-hidden":!0,className:`mt-[0.5px] flex size-5 shrink-0 items-center justify-center border-[1.5px] ${e?`rounded-[5px]`:`rounded-full`} ${n?`border-dashed`:``} ${t?e?`border-fg bg-fg text-bg`:`border-fg`:`border-border-strong`}`,children:t&&(e?(0,X.jsx)(dt,{size:14,strokeWidth:3}):(0,X.jsx)(`span`,{className:`size-2.5 rounded-full bg-fg`}))})}function _w({a:e,step:t,autoFocus:n,placeholder:r}){let i=(0,q.useRef)(null),a=e.answerFor(t.q,t.path).text,o=t.spec.kind===`multi`;return(0,q.useLayoutEffect)(()=>{let e=i.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[a]),(0,q.useEffect)(()=>{n&&i.current?.focus()},[n]),(0,X.jsx)(`div`,{className:`px-[18px] ${(t.spec.options??[]).length===0?``:`pt-3`}`,children:(0,X.jsx)(`textarea`,{ref:i,"data-answer-text":!0,"data-1p-ignore":!0,"data-claims-escape":!0,rows:(t.spec.options??[]).length===0?3:1,value:a,placeholder:r,onChange:n=>e.onText(t.q,t.path,o,n.target.value),onFocus:()=>{o||e.onText(t.q,t.path,!1,a)},className:`block max-h-[40vh] w-full resize-none overflow-y-auto rounded-[12px] border border-border-strong bg-bg px-3 py-[11px] text-[16px] leading-[22px] text-fg outline-none placeholder:text-faint focus:border-fg/40`})})}function vw({a:e,step:t,text:n}){return(0,X.jsxs)(`div`,{className:`px-[18px]`,children:[(0,X.jsx)(`input`,{type:`password`,"data-answer-text":!0,"data-secret-answer":!0,"data-claims-escape":!0,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"aria-label":`Secret value`,value:n,placeholder:`Paste the value…`,onChange:n=>e.onText(t.q,t.path,!1,n.target.value),className:`block w-full rounded-[12px] border border-border-strong bg-bg px-3 py-[11px] text-[16px] leading-[22px] text-fg outline-none placeholder:text-faint focus:border-fg/40`}),(0,X.jsx)($S,{className:`mt-2 text-[13px] leading-[18px] text-muted`})]})}function yw({a:e,step:t,first:n,writing:r,onBack:i,onNext:a}){let o=e.answerFor(t.q,t.path),s=RS(t.spec,o),c=t.spec.options??[],l=t.spec.kind!==`multi`&&o.chosen===null&&o.text.trim()!==``,u=t.spec.kind===`multi`||c.length===0||r||l;return(0,X.jsxs)(Tw,{children:[(0,X.jsx)(`button`,{type:`button`,"data-answer-back":!0,disabled:n,onClick:i,className:`${Sw} ${Cw} disabled:opacity-35`,children:`Back`}),(0,X.jsx)(`span`,{className:`flex-1`}),!(u&&s)&&(0,X.jsx)(`button`,{type:`button`,"data-answer-skip":!0,onClick:a,className:`${Sw} ${Cw}`,children:s?`Next`:`Skip`}),u&&(0,X.jsx)(`button`,{type:`button`,"data-answer-continue":!0,disabled:!s,onClick:a,className:`${Sw} ${ww} px-6 disabled:opacity-35`,children:`Continue`})]})}function bw({a:e,steps:t,onChange:n}){let r=t.map(t=>({s:t,said:sw(t.spec,e.answerFor(t.q,t.path))})),i=r.filter(e=>e.said!==null).length;return(0,X.jsxs)(`div`,{"data-answer-review":!0,children:[(0,X.jsx)(`div`,{className:`px-[18px] pb-3 pt-1 text-[17px] font-semibold leading-[23px] text-fg`,children:i===0?`No answers yet`:`${i} answer${i===1?``:`s`}`}),(0,X.jsx)(`div`,{className:`border-b border-border`,children:r.map(({s:e,said:t})=>(0,X.jsxs)(`button`,{type:`button`,"data-answer-change":e.key,onClick:()=>n(e.key),className:`block w-full border-t border-border px-[18px] py-2.5 text-left outline-none active:bg-hover focus-visible:bg-hover`,children:[(0,X.jsx)(`span`,{className:`line-clamp-2 block text-[13px] leading-[18px] text-muted`,children:Ew(e.spec.question)}),(0,X.jsxs)(`span`,{className:`mt-0.5 flex items-baseline justify-between gap-2.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 break-words text-[15.5px] leading-[21px] ${t===null?`text-muted`:`font-medium text-fg`}`,children:t??`Skipped`}),(0,X.jsx)(`span`,{className:`shrink-0 text-[13.5px] text-muted`,children:`Change`})]})]},e.key))})]})}function xw({a:e,onSent:t}){return(0,X.jsx)(Tw,{children:(0,X.jsx)(`button`,{type:`button`,"data-answer-send":!0,disabled:e.staged===0||e.sending,onClick:()=>{e.submit(),t()},className:`${Sw} ${ww} flex-1 disabled:opacity-35`,children:e.sending?`Sending…`:e.staged===1?`Send answer`:`Send answers`})})}var Sw=`flex h-[46px] shrink-0 items-center justify-center rounded-[12px] text-[15.5px] font-semibold outline-none`,Cw=`px-[18px] text-muted active:bg-hover focus-visible:bg-hover`,ww=`bg-fg text-bg active:opacity-90`;function Tw({children:e}){let t=(0,q.useRef)(null),[n,r]=(0,q.useState)(!1);(0,q.useEffect)(()=>{let e=0,n=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e=document.activeElement;r((e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement)&&t.current?.parentElement?.contains(e)===!0)})};return n(),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{cancelAnimationFrame(e),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]);let i=ft(t,n);return(0,X.jsxs)(`div`,{ref:t,"data-answer-footer":!0,className:`shrink-0`,children:[(0,X.jsx)(`div`,{className:`flex items-center gap-2.5 px-[18px] pt-3.5`,children:e}),i>0&&(0,X.jsx)(`div`,{"aria-hidden":!0,style:{height:i}})]})}function Ew(e){return cw(e.trim().split(/\n\s*\n/)[0]??``)}function Dw(e){return(0,q.useSyncExternalStore)(e=>Ai(U,e),()=>e?Ow(e)!==`codex`:!1,()=>!1)}function Ow(e){return Xr(U.board,e)?.backend}function kw(e,t,n,r){let i=H.followUp(e,t,n);return ds(i,r),i}function Aw(e){if(!(typeof document>`u`)){for(let t=e;t;t=t.parentElement){let e=t.querySelector(`[data-thread-composer-box] textarea`);if(e){e.focus(),e.setSelectionRange(e.value.length,e.value.length);return}}document.getElementById(`followup-input`)?.focus()}}function jw(e){let t=oo(),n=As(),[r,i]=(0,q.useState)(!1);return{unqueue:(0,q.useCallback)(a=>{if(!e||r)return;let o=Xr(U.board,e)?.sessionId;if(!o){K(`This thread has no live session to unqueue from`);return}i(!0),W.unqueueFollowUp({slug:e,sessionId:o,deliveryId:a.deliveryId}).then(r=>{if(i(!1),!r.unqueued){K(r.reason??`That message could not be taken back`);return}ci(t,e,a.rawText,a.deliveryId),kw(n,e,o,a.text),Aw(a.from)},e=>{i(!1),K(`Couldn't unqueue — ${(e instanceof Error?e.message:String(e)).slice(0,160)}`)})},[r,n,t,e]),pending:r}}function Mw(e){let t=oo(),n=As(),[r,i]=(0,q.useState)(!1),a=(0,q.useCallback)(n=>{!e||r||Vr(t,e,n.text,{supersedes:n.deliveryId,failureToast:e=>`Retry failed — ${e.slice(0,160)}`})},[r,t,e]),o=(0,q.useCallback)(async t=>{if(!e)return!1;i(!0);try{return await W.dismissFailedFollowUp({slug:e,deliveryId:t}),!0}catch(e){return K(`Couldn't dismiss — ${(e instanceof Error?e.message:String(e)).slice(0,160)}`),!1}finally{i(!1)}},[e]);return{retry:a,edit:(0,q.useCallback)(t=>{!e||r||(kw(n,e,Xr(U.board,e)?.sessionId,t.text),Aw(t.from),o(t.deliveryId))},[o,r,n,e]),dismiss:(0,q.useCallback)(t=>{!e||r||o(t.deliveryId)},[o,r,e]),pending:r}}var Nw=new Map;function Pw(e,t){let n=(Nw.get(e)??[]).filter(e=>e.deliveryId!==t.deliveryId);n.push(t),Nw.set(e,n.slice(-8))}var Fw=e=>e.replace(/\s+/g,` `).trim();function Iw(e,t){let n=Nw.get(e);if(!n?.length)return;let r=Fw(t);for(let t=n.length-1;t>=0;t--){let i=Fw(n[t].text);if(!i||!r.includes(i))continue;let[a]=n.splice(t,1);return n.length||Nw.delete(e),a.deliveryId}}function Lw(e){return e.project?`${it(e.project)}/thread/${e.slug}`:je(`/thread/${e.slug}`)}function Rw({peer:e,text:t,queued:n,sourceId:r,at:i}){let[a,o]=(0,q.useState)(!1),s=(0,q.useId)(),c=e.thread,l=Tt(c&&!c.project?c.slug:void 0),u=l?io(l):c?.title,d=Pp(t),f=Sm(d),p=(0,q.useRef)(null),m=jh(p,d),h=(0,q.useRef)(null),g=(0,q.useRef)(!1),_=()=>{g.current=document.activeElement===h.current,o(e=>!e)};(0,q.useLayoutEffect)(()=>{g.current&&(g.current=!1,h.current?.focus())},[a]);let v=e=>{e.target.closest(`a, button`)||_()},y=e=>e.preventDefault(),b=c?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`shrink-0 ${Hy}`,children:`Message from `}),(0,X.jsx)(`a`,{href:Lw(c),"data-session-peer-link":!0,title:`Open the thread that sent this`,onMouseDown:y,className:`min-w-0 truncate [font-variant-caps:normal] ${Qy}`,children:u})]}):(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name?`Message from session ${e.name}`:`Message from another session`}),x=(0,X.jsx)(`button`,{ref:h,type:`button`,"data-session-message-toggle":!0,onClick:_,onMouseDown:y,"aria-expanded":a,"aria-controls":s,"aria-label":a?`Collapse the message`:`Expand the message`,className:`shrink-0 rounded-sm outline-none focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:(0,X.jsx)(fr,{"aria-hidden":`true`,size:12,className:`${Jy} ${a?`-mx-[0.15em] rotate-90`:`-mx-[0.275em]`}`})});return(0,X.jsx)(`div`,{"data-frizz-msg":r,"data-session-message":!0,className:`flex flex-col ${n?`opacity-50`:``}`,children:a?(0,X.jsxs)(`fieldset`,{className:`@container/wake my-1 min-w-0 rounded-xl border border-border/70 px-4 pb-3.5 pt-1 transition-colors has-[>legend:hover]:border-border`,children:[(0,X.jsx)(`legend`,{onClick:v,onMouseDown:y,className:`group/wake mx-auto max-w-[calc(100%-66px)] cursor-pointer px-3`,children:(0,X.jsx)(By,{icon:Qc,at:i,trailing:x,children:b})}),(0,X.jsxs)(`div`,{id:s,className:`card-md text-fg/85`,children:[(0,X.jsx)(`div`,{ref:p,className:`md-body [overflow-wrap:anywhere]`,dangerouslySetInnerHTML:f}),m]})]}):(0,X.jsx)(`div`,{onClick:v,onMouseDown:y,className:`group/wake cursor-pointer`,children:(0,X.jsx)(Q,{icon:Qc,marker:`session-message`,at:i,trailing:x,children:b})})})}function zw(e){return e.role===`assistant`&&!e.kind&&e.text.trim()!==``&&Rg(e.text).some(e=>e.kind===`prose`)}function Bw(e,t){let n=e.length>0&&!oc(e[0])?[-1]:[];e.forEach((e,t)=>{oc(e)&&n.push(t)});let r=[];return n.forEach((i,a)=>{let o=a+1<n.length?n[a+1]-1:e.length-1,s=pS(e.slice(0,o+1),i,t.closedOnly);if(s.length===0){if(a+1===n.length)return;let t=-1;if(i>=0){for(let n=i+1;n<=o;n++)if(zw(e[n])){t=n;break}}let s=t>=0?t+1:i+1;s<=o&&r.push({from:s,to:o,...t>=0?{lead:t}:{}});return}let c=-1;if(i>=0){for(let t=i+1;t<s[0];t++)if(zw(e[t])){c=t;break}}let l=c>=0?c+1:i+1;for(let[e,t]of s.entries())t>l&&r.push({from:l,to:t-1,...e===0&&c>=0?{lead:c}:{}}),l=t+1;!(t.running&&a===n.length-1)&&l<=o&&r.push({from:l,to:o})}),r}function Vw(e,t){let n=0,r=t.lead===void 0?0:e[t.lead].tools?.length??0;for(let i=t.from;i<=t.to;i++){let t=e[i];(t.role===`user`&&t.wake||t.boundary===`wake`)&&n++,r+=t.tools?.length??0}return{rounds:n,calls:r}}var Hw=/lightbox|!\[|\.(?:png|jpe?g|gif|webp)/i,Uw=/^\s{0,3}(`{3,}|~{3,})\s*lightbox\s*$/i,Ww=/!\[[^\]]*\]\(\s*[^\s)]/,Gw=/(`+)[\s\S]*?\1/g;function Kw(e){let t=Ca(e),n=e.split(`
|
|
129
|
+
`),r=0;for(let e=0;e<n.length;r+=n[e].length+1,e++){if(t(r))continue;let i=n[e],a=i.match(Uw);if(a){let t=RegExp(`^\\s{0,3}${a[1][0]==="`"?"`":`~`}{${a[1].length},}\\s*$`),r=e+1;for(;r<n.length&&!t.test(n[r]);)r++;if(r<n.length&&ra(n.slice(e+1,r).join(`
|
|
130
|
+
`)).length>0)return!0;continue}if(Ww.test(i.replace(Gw,``)))return!0}return!1}function qw(e){return ki(e).some(e=>e.kind===`image`||e.kind===`lightbox`||e.kind===`md`&&Kw(e.text))}function Jw(e){return e.role!==`assistant`||e.kind===`event`?!1:e.tools?.some(Ao)?!0:Hw.test(e.text)?Rg(e.text).some(e=>qw(e.kind===`prose`?e.text:e.body)):!1}function Yw(e,t,n){return{type:`frizz-inline-vis-theme`,requestId:e,colorScheme:t,vars:n}}function Xw(e,t){return typeof e==`object`&&!!e&&e.type===`frizz-inline-vis-applied`&&e.requestId===t}var Zw=new Set([`planning`,`planned`,`active`,`needs-human`,`blocked`]);function Qw(e){return!!(e&&e.kind===`legacy`&&!e.foreign&&e.runtime===`none`&&!e.sessionId&&!e.threadName&&!e.owner&&e.agents.length===0&&e.errors.length===0&&Zw.has(e.status))}function $w(e,t){return e.pending?`loading`:e.failed?`failed`:t.running?`starting`:e.expired?`expired`:t.adoptable?`adopt`:`empty`}function eT({retentionDays:e}){return(0,X.jsxs)(`div`,{"data-transcript-expired":!0,role:`status`,className:`max-w-[26rem] text-center`,children:[(0,X.jsx)(`p`,{children:`This conversation is no longer on disk.`}),(0,X.jsxs)(`p`,{className:`mt-1.5 text-[12px]`,children:[`Claude Code deletes a session's history `,e,` `,e===1?`day`:`days`,` after its last activity, and this thread has been idle longer than that. Raise `,(0,X.jsx)(`code`,{className:`font-mono-keep leading-none`,children:`cleanupPeriodDays`}),` in `,(0,X.jsx)(`code`,{className:`font-mono-keep leading-none`,children:`~/.claude/settings.json`}),` to keep other threads' history longer.`]})]})}var tT=`sticky top-0 z-10 flex min-w-0 shrink-0 items-center gap-2.5 border-b border-border bg-panel px-3 ${Jr} max-[640px]:h-auto max-[640px]:min-h-12 max-[640px]:flex-wrap max-[640px]:items-start max-[640px]:gap-y-2 max-[640px]:px-4 max-[640px]:py-2.5`,nT=`flex min-w-0 flex-1 items-center gap-2.5 pl-1 max-[640px]:basis-full`,rT=`flex shrink-0 items-center max-[640px]:w-full`;function iT(e){return e?.trim()?{kind:`profile-error`,message:`Profile controls unavailable: ${e.trim().slice(0,160)}`}:null}function aT(e){if(e.foreign)return`Read-only external thread`;if(e.permissionChangePending||e.permissionPending)return`A permission change is already in progress`;if(e.profileChangePending)return`A model and effort change is already in progress`;if(e.runtimeControlPending)return`Another runtime control is already in progress`;if(e.pendingAsk||e.runtime===`perm-prompt`)return`Resolve the open approval or question first`;if(e.backend===`codex`||e.backend===`acp`||e.backend===`opencode`||e.backend===`antigravity`)return null;let t=[...e.subAgents??[],...e.bgShells??[]].filter(e=>e.state===`running`||e.state===`stale`).length;return t>0?`Wait for ${t} unresolved background operation${t===1?``:`s`}`:e.runtime===`running`||e.runtime===`spawning`?`Wait for the current turn to finish`:null}function oT(e){return e.permissionChangePending===!0||e.permissionPending!==void 0||e.profileChangePending===!0||e.runtimeControlPending===!0}function sT(e,t){let n=t===`codex`?`Sandbox`:`Permissions`;return e===`applied`?`${n} applied to the live session`:e===`next-turn`?t===`codex`?`${n} applied — takes effect on the next turn`:t===`antigravity`?`${n} saved — Antigravity restarts to apply them`:`${n} saved — the worker restarts on the next turn`:`${n} saved for the next resume`}function cT(e,t,n,r){let i=e.find(e=>e.model===t),a=!!i,o=!!(i&&n&&i.efforts.includes(n)),s=a&&o;return{selectedProfile:i,modelKnown:a,effortKnown:o,profileKnown:s,modelSelectable:r||a,effortSelectable:!!i&&(r||s)}}function lT(e){let t=Tt(e),n=Fo({queryKey:[`threadProfileOptions`,e],queryFn:()=>W.threadProfileOptions({slug:e}),enabled:!!(t&&!t.foreign&&t.kind===`session`),staleTime:5e3}),r=Ji({mutationFn:t=>W.setThreadProfile({slug:e,model:t.model,...t.effort?{effort:t.effort}:{}})}),i=Ji({mutationFn:t=>W.setThreadPermission({slug:e,permissionMode:t})}),a=Ji({mutationFn:t=>W.upgradeThreadModel({slug:e,sessionId:t})}),o=r.isPending||i.isPending||a.isPending,s=t?.backend===`codex`?`codex`:t?.backend===`acp`?`acp`:t?.backend===`opencode`?`opencode`:t?.backend===`antigravity`?`antigravity`:`claude`,c=t?D(t.id):void 0,l=Fo({queryKey:un([`acpAgents`],c),queryFn:()=>v(c).acpAgents(),enabled:!!t&&s===`acp`}),u=ir(c,!!t&&s===`opencode`),d=Sc(c,!!t&&s===`antigravity`),f=s===`acp`?ei(t?.model?.trim()):void 0,p=E(c,f?[f]:[],f);if(!t||t.foreign||t.kind!==`session`)return{busy:o,footer:null,phoneTools:null,status:null};let h=o||oT(t),g=t.model?.trim(),_=t.effort?.trim(),y=s===`acp`?ei(g):void 0,b=r.isPending?r.variables:void 0,x=t.profilePendingModel??b?.model,S=t.profilePendingEffort??b?.effort,C=n.data?.options??[],{modelSelectable:w}=cT(C,g,_,t.runtime===`exited`),T=n.data!==void 0,O=l.data?.find(e=>e.id===y)?.label??y,k=[{id:s,label:s===`codex`?`Codex`:`Claude Code`,options:C}],A=iT(n.isError?n.error.message:void 0),j=t.permissionMode?It(t.permissionMode):`auto`,M=Ma.some(e=>e.value===j)?j:`auto`,N=i.isPending?i.variables:M,P=aT(t);function I(e){e!==M&&i.mutate(e,{onSuccess:e=>K(sT(e.effect,`claude`)),onError:e=>K(`Permission change failed: ${e.message.slice(0,120)}`)})}let L=s===`claude`?aT(t):null;function R(){t?.sessionId&&a.mutate(t.sessionId,{onSuccess:e=>K(`${e.label} from the next turn — the worker restarts then`),onError:e=>K(`Upgrade failed: ${e.message.slice(0,120)}`)})}function ee(e){r.mutate(e,{onSuccess:e=>K(s===`acp`?e.effect===`next-resume`?`Model saved for the next resume`:`Model applied`:s===`antigravity`?e.effect===`next-resume`?`Model and thinking level saved for the next resume`:`Model and thinking level applied to the session`:e.effect===`next-resume`?`Model and effort saved for the next resume`:`Model and effort applied`),onError:e=>K(`Profile change failed: ${e.message.slice(0,120)}`)})}let te=(0,X.jsxs)(X.Fragment,{children:[(s===`claude`||s===`codex`)&&(0,X.jsx)(_a,{groups:k,value:{provider:s,model:g,effort:_},pending:x||S?{provider:s,model:x,effort:S}:void 0,onValueChange:({model:e,effort:t})=>ee({model:e,effort:t}),placeholder:n.isPending?`Profile loading…`:`Profile unknown`,ariaLabel:`Thread model and effort`,menuAriaLabel:`Choose ${s===`codex`?`Codex`:`Claude Code`} model and effort`,title:w?t.runtime===`exited`?`Saved per thread and applied when this conversation resumes`:`Change this idle conversation's model and reasoning effort`:`The current live backend profile is unavailable; controls fail closed`,disabled:h||!T||!w||n.isError,compact:!0,side:`top`,className:`max-w-[20rem]`,runningModelLabel:t.runningModelLabel,upgrade:t.modelUpgrade&&t.runningModelLabel?{latest:t.modelUpgrade.label,staged:t.modelUpgrade.staged,blockedReason:L,pending:a.isPending,onUpgrade:R}:void 0}),s===`acp`&&y&&g&&(0,X.jsx)(_a,{groups:[rn({agent:{id:y,label:O??y},models:p.models[y],loading:p.loading[y]??!1,saved:g,onRequestOptions:()=>p.request(y)})],value:xe(g),pending:x?xe(x):void 0,onValueChange:e=>ee({model:e.model,effort:``}),ariaLabel:`Thread model and effort`,menuAriaLabel:`Choose ${O??y} model`,title:`This thread's ${O??y} model`,disabled:h,compact:!0,side:`top`,className:`max-w-[20rem]`}),s===`opencode`&&(0,X.jsx)(_a,{groups:[Je({models:u.models,loading:u.loading,saved:g,onRequestOptions:u.request})],value:xt(g),pending:x?xt(x):void 0,onValueChange:e=>ee({model:Sn(e),effort:``}),ariaLabel:`Thread model and effort`,menuAriaLabel:`Choose OpenCode model and effort`,title:`This thread's OpenCode model and reasoning level`,disabled:h,compact:!0,side:`top`,className:`max-w-[20rem]`}),s===`antigravity`&&(0,X.jsx)(_a,{groups:[At({models:d.models,loading:d.loading,saved:{model:g,effort:_},onRequestOptions:d.request})],value:zt(g,_),pending:x?zt(x,S):void 0,onValueChange:e=>ee({model:e.model,effort:e.effort}),ariaLabel:`Thread model and effort`,menuAriaLabel:`Choose Antigravity model and thinking level`,title:`This thread's Antigravity model and thinking level`,disabled:h,compact:!0,side:`top`,className:`max-w-[20rem]`})]});return{busy:h,footer:(0,X.jsxs)(`div`,{"data-thread-composer-controls":!0,className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-x-1.5`,children:[(0,X.jsxs)(Yr,{children:[te,s===`claude`&&(0,X.jsx)(sa,{variant:`readout`,side:`top`,value:N,onValueChange:e=>I(e),options:Ma,ariaLabel:`Thread permission mode`,title:P?`${P} — changing permissions restarts this thread's worker process`:N===`bypassPermissions`?`Bypass: the worker never asks for approval. Changing this restarts the worker process; the conversation resumes from disk on the next turn.`:`Auto: risky actions raise an approval card here. Changing this restarts the worker process; the conversation resumes from disk on the next turn.`,disabled:h||P!==null,className:`shrink-0`}),s===`opencode`&&(0,X.jsx)(sa,{variant:`readout`,side:`top`,value:i.isPending?i.variables:t.permissionMode??`auto`,onValueChange:e=>{i.mutate(e,{onSuccess:()=>K(`Permissions applied to the session`),onError:e=>K(`Permission change failed: ${e.message.slice(0,120)}`)})},options:Dt,ariaLabel:`Thread permission mode`,title:`Applied to the session at once, and to its sub-agents.`,disabled:h,className:`shrink-0`}),s===`antigravity`&&(0,X.jsx)(sa,{variant:`readout`,side:`top`,value:i.isPending?i.variables:t.permissionMode??`bypassPermissions`,onValueChange:e=>{i.mutate(e,{onSuccess:e=>K(sT(e.effect,`antigravity`)),onError:e=>K(`Permission change failed: ${e.message.slice(0,120)}`)})},options:m,ariaLabel:`Thread permission mode`,title:`Ask, Accept edits, Auto and Plan apply to the session at once. A move to or from Bypass restarts Antigravity, after any turn that is running.`,disabled:h,className:`shrink-0`})]}),(0,X.jsx)(F,{gauge:s===`acp`||s===`opencode`?void 0:{backend:s,model:g},mcp:{slug:e},side:`top`})]}),x&&S&&s!==`antigravity`&&(0,X.jsxs)(`span`,{className:`min-w-0 truncate text-[9px] text-muted-50`,children:[`→ `,x,` · `,S,` pending`]})]}),phoneTools:te,status:A?(0,X.jsx)(`div`,{"data-thread-control-error":``,className:`px-1 pt-1 text-[9.5px] leading-tight text-muted-65`,children:A.message}):null}}function uT({hold:e,phone:t=!1}){let n=Nr(e);return(0,X.jsxs)(`div`,{"data-completion-hold":!0,className:`flex flex-col gap-3 p-4 leading-relaxed text-muted ${t?`text-[14px]`:`text-[12.5px]`}`,children:[(0,X.jsx)(`p`,{children:n.lead}),n.rows.length>0&&(0,X.jsxs)(`div`,{"data-completion-hold-rows":!0,className:`flex min-w-0 flex-col rounded-lg border border-border bg-bg/40 py-1 pr-[3px] leading-normal`,children:[n.rows.map((e,t)=>(0,X.jsx)(Io,{kind:e.kind,label:e.label,state:e.state,startedAt:e.startedAt,density:`panel`},`${e.kind}-${e.label}-${t}`)),n.overflow>0&&(0,X.jsxs)(`div`,{className:`py-1 pr-2.5 pl-[calc(0.625rem+1em+8px)] text-[12px] text-muted-60`,children:[`+`,n.overflow,` more`]})]}),(0,X.jsx)(`p`,{children:n.trailer})]})}function dT({thread:e,compact:t}){let[n,r]=(0,q.useState)(!1),[i,a]=(0,q.useState)(null);async function o(t){r(!0),t&&a(null);let n=await Tr(e,{terminateLive:t});n.kind===`needs-confirmation`&&a({hold:n.hold}),n.kind!==`done`&&r(!1)}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,"data-phone-done":!0,onMouseDown:e=>e.preventDefault(),onClick:()=>void o(!1),disabled:n,"aria-label":`Mark as done`,className:`flex shrink-0 items-center justify-center gap-1 rounded-full bg-fg font-semibold text-bg disabled:opacity-45 ${t?`relative h-[36px] pl-[11px] pr-[14px] text-[14px] after:absolute after:inset-x-0 after:-inset-y-[4px] after:content-['']`:`h-[42px] pl-[13px] pr-[16px] text-[15px]`}`,children:[n&&!i?(0,X.jsx)(de,{"aria-hidden":!0,size:t?15:17,className:`animate-spin`}):(0,X.jsx)(dt,{"aria-hidden":!0,size:t?15:17,strokeWidth:2.6,className:`translate-y-[0.1em]`}),`Done`]}),(0,X.jsx)(wt,{open:i!==null,onOpenChange:e=>{!e&&!n&&a(null)},title:i?.hold?.cutOff?`Mark an unfinished thread done?`:`End this session?`,className:`w-[390px] max-w-[92vw]`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>a(null),className:`button-outline h-[40px] rounded-md px-4 pb-0.5 text-[14px] text-muted outline-none disabled:opacity-45`,children:`Cancel`}),(0,X.jsxs)(`button`,{type:`button`,"data-phone-done-confirm":!0,"data-dialog-default":!0,disabled:n,onClick:()=>void o(!0),className:`button-outline flex h-[40px] items-center gap-1.5 rounded-md bg-fg px-4 pb-0.5 text-[14px] font-medium text-bg outline-none disabled:opacity-45`,children:[n&&(0,X.jsx)(de,{size:14,className:`animate-spin`}),`Mark as done`]})]}),children:(0,X.jsx)(uT,{hold:i?.hold,phone:!0})})]})}var fT={sm:{track:`h-[16px] w-[28px]`,thumb:`size-[12px]`,travel:`translate-x-[12px]`,onCap:`translate-y-[calc(6px_-_0.5cap)]`},md:{track:`h-[20px] w-[34px]`,thumb:`size-[16px]`,travel:`translate-x-[14px]`,onCap:`translate-y-[calc(8px_-_0.5cap)]`}};function pT({checked:e,onChange:t,disabled:n,label:r,size:i=`sm`,testId:a}){let o=fT[i];return(0,X.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":r,disabled:n,"data-switch":a,"data-state":e?`checked`:`unchecked`,onMouseDown:e=>e.preventDefault(),onClick:()=>t(!e),className:`inline-flex shrink-0 cursor-pointer items-center self-baseline rounded-full p-[2px] outline-none transition-colors focus-visible:ring-1 focus-visible:ring-focus-ink-60 disabled:cursor-default disabled:opacity-45 ${o.track} ${o.onCap} ${e?`bg-fg`:`bg-border hover:bg-border-strong`}`,children:(0,X.jsx)(`span`,{className:`pointer-events-none block rounded-full transition-transform duration-150 ease-out ${o.thumb} ${e?`bg-bg ${o.travel}`:`translate-x-0 bg-muted/70`}`})})}function mT({size:e=12,viewBox:t=`0 0 24 24`,strokeWidth:n=2,className:r=``}){return(0,X.jsxs)(`svg`,{width:e,height:e,viewBox:t,fill:`none`,stroke:`currentColor`,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,className:r,"aria-hidden":`true`,children:[(0,X.jsx)(`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,X.jsx)(`path`,{d:`M12 7a5 5 0 1 0 5 5`}),(0,X.jsx)(`path`,{d:`M13 3.055a9 9 0 1 0 7.941 7.945`}),(0,X.jsx)(`path`,{d:`M15 6v3h3l3 -3h-3v-3l-3 3`}),(0,X.jsx)(`path`,{d:`M15 9l-3 3`})]})}function hT({thread:e}){let[t,n]=(0,q.useState)(`closed`),r=(0,q.useRef)(null),i=(0,q.useRef)(void 0);(0,q.useEffect)(()=>()=>clearTimeout(i.current),[]);let a=t!==`closed`,[o,s]=(0,q.useState)(null);(0,q.useLayoutEffect)(()=>{if(!a)return;let e=r.current?.closest(`[role="dialog"], main`);if(!e){s(null);return}let t=e.getBoundingClientRect().left+e.clientLeft,n=r.current?.closest(`[data-composer-box]`)?.getBoundingClientRect(),i=r.current?.getBoundingClientRect();s({surface:e,left:Math.max(12,n?n.left-t:0),right:Math.max(12,n?t+e.clientWidth-n.right:0),width:rt(n?.width??e.clientWidth,gT),toBoxEnd:n&&i?n.right-i.right:0})},[a]);let c=o?{collisionBoundary:o.surface,collisionPadding:{top:12,bottom:12,left:o.left,right:o.right}}:{},l=e.recurringPrompt,u=l?.stopHook===!0||l?.heartbeat===!0||l?.postCompaction===!0;function d(){clearTimeout(i.current),i.current=setTimeout(()=>n(e=>e===`closed`?`preview`:e),_T)}function f(){clearTimeout(i.current),n(e=>e===`preview`?`closed`:e)}let p=e=>{r.current?.contains(e.detail.originalEvent.target)&&e.preventDefault()};return(0,X.jsxs)(z,{open:t!==`closed`,onOpenChange:e=>{e||(clearTimeout(i.current),n(`closed`))},children:[(0,X.jsx)(Jt,{asChild:!0,children:(0,X.jsx)(`button`,{ref:r,type:`button`,"data-recurring-prompt":!0,"data-recurring-prompt-on":u?`true`:`false`,"aria-label":u?`Goal (on)`:`Goal`,"aria-haspopup":`dialog`,"aria-expanded":t===`full`,onClick:()=>{clearTimeout(i.current),n(e=>e===`full`?`closed`:`full`)},onPointerEnter:e=>{e.pointerType===`mouse`&&d()},onPointerLeave:e=>{e.pointerType===`mouse`&&f()},onFocus:()=>n(e=>e===`closed`?`preview`:e),onBlur:f,className:`group/goal icon-focus-outline flex ${Sr} items-center justify-center outline-none transition-[color,background-color] hover:bg-hover-strong`,children:(0,X.jsx)(mT,{...Ar,className:u?`text-attention-90`:`text-muted group-hover/goal:text-fg group-focus-visible/goal:text-fg`})})}),t===`preview`?(0,X.jsx)(Wa,{side:`top`,align:`end`,...c,"data-recurring-preview":!0,onPointerDownOutside:p,className:`pointer-events-none max-w-[min(22rem,calc(100vw-1.5rem))] p-2.5 text-[11px] leading-snug text-fg`,onOpenAutoFocus:e=>e.preventDefault(),children:(0,X.jsx)(vT,{armed:l})}):(0,X.jsx)(Wa,{side:`top`,align:`end`,...c,className:`w-[min(46rem,calc(100vw-1.5rem))] p-3 text-[11px] leading-relaxed text-fg`,style:o?{width:o.width}:void 0,alignOffset:o?-o.toBoxEnd:0,onPointerDownOutside:p,onEscapeKeyDown:e=>{document.querySelector(`[data-slash-menu]`)?e.preventDefault():e.stopPropagation()},onOpenAutoFocus:e=>e.preventDefault(),onDragOver:e=>e.stopPropagation(),onDragLeave:e=>e.stopPropagation(),onDrop:e=>{e.stopPropagation(),e.dataTransfer.files.length>0&&e.preventDefault()},children:(0,X.jsx)(OT,{thread:e,armed:l,close:()=>n(`closed`)})})]})}var gT=736,_T=260;function vT({armed:e}){let t=e?.prompt?.trim(),n=e?DT({stopHook:e.stopHook===!0,heartbeat:e.heartbeat===!0,postCompaction:e.postCompaction===!0,seconds:e.intervalSeconds??xT}):[];return(0,X.jsxs)(`div`,{"data-recurring-preview-body":!0,children:[(0,X.jsxs)(`div`,{className:`mb-1 flex items-baseline gap-2`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Goal`}),(0,X.jsx)(`span`,{className:`text-muted-70`,children:n.length>0?`sent ${n.join(`, `)}`:t?`no trigger is on`:`not set`})]}),(0,X.jsx)(`p`,{className:`line-clamp-4 whitespace-pre-wrap ${t?`text-fg/90`:`text-muted`}`,children:t||`Click to write what this thread is trying to achieve.`})]})}var yT=1,bT=1440,xT=600;function ST(e,t){if(e===String(Math.round(t/60)))return t;let n=Math.round(Number(e));return Number.isFinite(n)&&n>0?Math.min(bT,Math.max(yT,n))*60:t}var CT=null;function wT(e){return{prompt:e.text.trim(),stopHook:e.stopHook,heartbeat:e.heartbeat,postCompaction:e.postCompaction,seconds:e.seconds}}function TT(e,t){return(e.text.trim()||null)===(t.prompt||null)&&e.stopHook===t.stopHook&&e.heartbeat===t.heartbeat&&e.postCompaction===t.postCompaction&&e.seconds===t.seconds}function ET(e,t){return!e.archived&&!t}function DT(e){return[e.stopHook?`at every rest`:null,e.heartbeat?`every ${Math.round(e.seconds/60)}m`:null,e.postCompaction?`after every compaction`:null].filter(e=>e!==null)}function OT({thread:e,armed:t,close:n,heading:r=!0}){let i=ET(e,t)?mn:``,a=CT?.slug===e.id?CT.draft:null,[o,s]=(0,q.useState)(a?.text??t?.prompt??i),[u,d]=(0,q.useState)(a?.stopHook??t?.stopHook??!1),[f,p]=(0,q.useState)(a?.heartbeat??t?.heartbeat??!1),[m,h]=(0,q.useState)(a?.postCompaction??t?.postCompaction??!1),[g,_]=(0,q.useState)(a?.seconds??t?.intervalSeconds??xT),v=u||f||m,[y,b]=(0,q.useState)(String(Math.round((a?.seconds??t?.intervalSeconds??xT)/60))),x=(0,q.useRef)(null),[S,C]=(0,q.useState)(!1),w=Yn({text:o,setText:s,textareaRef:x,suggest:(0,q.useMemo)(()=>()=>lt(e.id),[e.id]),active:S}),T=(0,q.useRef)({prompt:t?.prompt??i,stopHook:t?.stopHook??!1,heartbeat:t?.heartbeat??!1,postCompaction:t?.postCompaction??!1,seconds:t?.intervalSeconds??xT}),E=e=>({text:o,stopHook:u,heartbeat:f,postCompaction:m,seconds:ST(y,g),...e}),D=(0,q.useRef)(E());D.current=E(),(0,q.useEffect)(()=>()=>{let n=D.current;if(TT(n,T.current)){CT?.slug===e.id&&(CT=null);return}if(n.text.trim()===``&&!t){CT={slug:e.id,draft:n};return}k(n)},[]);let O=(0,q.useRef)(Promise.resolve(!0));function k(t){let n=O.current.catch(()=>!1).then(async()=>{let n=await A(t);return n?CT?.slug===e.id&&(CT=null):CT={slug:e.id,draft:t},n});return O.current=n,n}async function A(t){let n=t.text.trim()||null;if(TT(t,T.current))return!0;try{await W.setThreadRecurringPrompt({slug:e.id,sessionId:e.sessionId??``,prompt:n,stopHook:t.stopHook,heartbeat:t.heartbeat,postCompaction:t.postCompaction,...n===null?{}:{intervalSeconds:t.seconds}}),T.current={...wT(t),prompt:n??``};let r=DT(t);K(n===null?`Goal cleared`:r.length===0?`Goal saved — no trigger is on, so nothing is sent`:`Goal: sent ${r.join(`, `)}`)}catch(e){return K((e instanceof Error?e.message:`Could not save the recurring prompt`).slice(0,100)),!1}return!0}function j(){if(TT(E(),T.current)||o.trim()===``&&!t){n();return}k(E()).then(e=>{e&&n()})}function M(){let e=ST(y,g);b(String(Math.round(e/60))),_(e)}let N=[{at:t?.lastRestFiredAt,how:`at rest`},{at:t?.lastScheduleFiredAt,how:`on schedule`},{at:t?.lastCompactFiredAt,how:`after a compaction`}].filter(e=>e.at!==void 0),P=N.reduce((e,t)=>e&&Date.parse(e.at)>=Date.parse(t.at)?e:t,void 0),F=P===void 0?null:N.length>1?`Last sent ${Ge(P.at)}`:`Last sent ${P.how} ${Ge(P.at)}`;return(0,X.jsxs)(`section`,{"data-recurring-panel":!0,children:[r?(0,X.jsxs)(`div`,{className:`mb-2 flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Goal`}),F&&(0,X.jsx)(`span`,{className:`ml-auto truncate text-muted-55`,children:F})]}):F?(0,X.jsx)(`div`,{className:`mb-2 truncate text-muted-55`,children:F}):null,(0,X.jsxs)(`div`,{className:`relative`,children:[w.menu,(0,X.jsx)(`textarea`,{ref:x,"data-recurring-text":!0,"data-1p-ignore":!0,value:o,maxLength:l,onChange:e=>{w.noteCaret(e.target),s(e.target.value)},onSelect:e=>w.noteCaret(e.currentTarget),onFocus:()=>C(!0),onBlur:()=>C(!1),onKeyDown:e=>{w.onKeyDown(e)||c({key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.nativeEvent.keyCode})&&(e.preventDefault(),j())},placeholder:`What is this thread trying to achieve?`,className:`field-sizing-content max-h-[28vh] min-h-[4rem] w-full resize-none overflow-y-auto rounded-md border border-border bg-bg px-2 py-1.5 text-[12px] leading-snug outline-none placeholder:text-muted-50 focus:border-border-strong ${v?`text-fg`:`text-muted`}`})]}),(0,X.jsxs)(`div`,{className:`mt-3 grid grid-cols-[auto_auto_1fr] items-baseline gap-x-2.5 gap-y-2`,children:[(0,X.jsx)(pT,{testId:`stop-hook`,label:`Stop hook`,checked:u,onChange:e=>{d(e),e&&!o.trim()&&requestAnimationFrame(()=>x.current?.focus())}}),(0,X.jsx)(`span`,{className:`font-medium ${u?`text-fg`:`text-muted`}`,children:`Stop hook`}),(0,X.jsx)(`span`,{className:`text-muted`,children:`every rest — unless it signed off or parked on a wait`}),(0,X.jsx)(pT,{testId:`heartbeat`,label:`Heartbeat`,checked:f,onChange:e=>{p(e),e&&!o.trim()&&requestAnimationFrame(()=>x.current?.focus())}}),(0,X.jsx)(`span`,{className:`font-medium ${f?`text-fg`:`text-muted`}`,children:`Heartbeat`}),f?(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted`,children:[`every`,(0,X.jsx)(`input`,{type:`number`,"data-recurring-minutes":!0,inputMode:`numeric`,min:yT,max:bT,value:y,onChange:e=>b(e.target.value),onBlur:M,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),M())},"aria-label":`Heartbeat interval in minutes`,className:`w-[4.5ch] rounded-md border border-border bg-bg px-1 py-[3px] text-center text-[11px] leading-none tabular-nums text-fg outline-none focus:border-border-strong disabled:opacity-45 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`}),`min, even mid-turn`]}):(0,X.jsx)(`span`,{className:`text-muted`,children:`on a clock, even mid-turn`}),(0,X.jsx)(pT,{testId:`post-compaction`,label:`Compaction`,checked:m,onChange:e=>{h(e),e&&!o.trim()&&requestAnimationFrame(()=>x.current?.focus())}}),(0,X.jsx)(`span`,{className:`font-medium ${m?`text-fg`:`text-muted`}`,children:`Compaction`}),(0,X.jsx)(`span`,{className:`text-muted`,children:`when the context is summarized away — link the doc to re-read`})]})]})}var kT=`frizz:send-mode`;function AT(){try{return localStorage.getItem(kT)===`queue`?`queue`:`steer`}catch{return`steer`}}var jT=Ds({mode:typeof window>`u`?`steer`:AT()});typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===kT||e.key===null)&&(jT.mode=AT())});function MT(e){jT.mode!==e&&(jT.mode=e);try{e===`steer`?localStorage.removeItem(kT):localStorage.setItem(kT,e)}catch{}}function NT(){return Xa(jT).mode}function PT(e){if(e.staged>0)return e.staged===1?`Add a note to send with your answer…`:`Add a note to send with your ${e.staged} answers…`;let t=e.comments??0;return t>0?t===1?`Add a note to send with your comment…`:`Add a note to send with your ${t} comments…`:e.openQuestions?`Or skip the questions and reply…`:e.running&&e.steerable===!1?`Queue a message for when this turn ends…`:e.running&&e.mode===`queue`?`Queue a message for when the agent rests…`:`Reply to the agent…`}function FT({className:e,above:t,phoneBarOverride:n,phoneChrome:r,readAndAnswerHost:i}){let a=(0,q.useContext)(pC),o=Be(),s=r??o;return(0,X.jsxs)(`div`,{"data-thread-composer-box":IT,"data-remote-composer":!0,"data-thread-action-bar":``,className:s?`flex flex-col gap-2 px-3 py-2.5`:e,children:[t,s&&n&&(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:n({editReply:()=>{}})}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 ${s?``:`px-3 py-2`}`,children:[(0,X.jsx)(uc,{host:i}),!s&&(a?.staged??0)>0&&(0,X.jsx)(`button`,{type:`button`,"data-remote-send-answers":!0,disabled:a.sending,onClick:a.submit,className:`shrink-0 rounded-md bg-fg px-3 py-1.5 text-[13px] font-medium text-bg outline-none disabled:opacity-40`,children:a.sending?`Sending…`:`Send answers`})]})]})}var IT=`chatComposer`;function LT(e){let t=ui();return t?(0,X.jsx)(FT,{...e,readAndAnswerHost:t}):(0,X.jsx)(RT,{...e})}function RT({slug:e,className:t,id:n,above:r,phoneBarOverride:i,phoneChrome:a}){let{fileDrop:o}=qC(),s=Xa(U),c=Tt(e),l=(0,q.useContext)(pC),u=(0,q.useContext)(H_),d=(0,q.useContext)(Z_),f=F_(c),p=Ub(),m=p?.comments.length??0,h=(l?.staged??0)+(u?.fencedCount??0)+ +!!f.staged,g=h+m,_=c?.runtime===`running`,v=(0,q.useContext)(Q_)?.held??0,y=_||v>0,{steer:b}=Oi(c?.backend),x=NT(),S=b?x:`queue`,C=c?.foreign?`Send a message to take over this session…`:PT({staged:h,comments:m,openQuestions:!!c?.pendingQuestion||(c?Fs(c):!1),running:y,mode:S,steerable:b}),w=As(),T=H.followUp(w,e,c?.sessionId),[E,D,O]=Ci(T),k=lT(e),A=hn(e),[j,M]=(0,q.useState)(null),N=(0,q.useMemo)(()=>()=>lt(e),[e]),[P,F]=(0,q.useState)(null),I=s.composerContext[e],L=(0,q.useMemo)(()=>I?.map(e=>e.token)??[],[I]);(0,q.useEffect)(()=>{let t=U.composerContext[e];if(!t?.length)return;let{prose:n}=Es(E),r=t.filter(e=>ho(n,e.token));r.length!==t.length&&(U.composerContext[e]=r)},[e,E,I]);let R=zr(c),ee=Be(),te=a??ee,ne=c?.runtime===`running`||c?.runtime===`spawning`,re=b_(c),ie=c?sn(c).archive&&!ne&&!re:!1,z=c&&c.kind===`session`&&c.foreign!==!0?(0,X.jsx)(hT,{thread:c}):void 0;function B(t=!1){let n=E.trim(),r=te?null:l?.take()??null,i=te?null:u?.takeFenced()??null,a=te?null:f.take(),o=(p?.comments.length??0)>0;if(!n&&!r&&!i&&!a&&!o)return;let s=o?null:Bn(n);if(s){if(O(),c?.backend===`acp`){K(`An ACP agent signs in through its own CLI — Frizz holds no account for it`);return}if(c?.backend===`opencode`){K("OpenCode signs in through its own CLI: run `opencode auth login`");return}if(c?.backend===`antigravity`){K("Antigravity signs in through its own CLI: run `agy` and sign in there");return}let e=c?.backend===`codex`?`codex`:`claude`;s===`login`?M(e):F(e);return}let m=ca(e),h=p?.take()??[],g=Ob(n,h),_=g?Li(g,m,w):``,v=a?a.compose(_):_,x=i?vr(i.wire,v):v,C=r?vr(Fe(r.display),x):x,D={onOptimistic:()=>{O(),r?.onOptimistic(),i?.onOptimistic(),a?.onOptimistic()},onSuccess:()=>{r?.onSuccess(),a?.onSuccess()},...r?{answers:r.answers,displayText:C}:{},...a?{todos:a.todos}:{},...S===`queue`&&!t&&(y||c?.deliveryInFlight===!0)?{hold:!0}:{},...b?{}:{failureToast:e=>`Send failed — ${e.slice(0,160)}`},supersedes:Iw(T,x),onRollback:t=>{ds(T,E),Qi(e,m),h.length&&p?.restore(h),Pw(T,{...t,text:E}),r?.onRollback(t.kept),i?.onRollback(),a?.onRollback()}};A.submit(x,{...D,interrupt:t}),d?.sent?.()}let ae=(0,q.useRef)(B);ae.current=B;let oe=te?void 0:u?.composer;return(0,q.useEffect)(()=>oe?(oe.set(()=>ae.current()),()=>oe.set(null)):void 0,[oe]),te?(0,X.jsxs)(`div`,{"data-thread-composer-box":IT,"data-thread-action-bar":``,"data-phone-thread-bar":``,children:[m>0&&(0,X.jsxs)(`div`,{className:`-mb-1 flex h-8 items-baseline px-2.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-[calc(16px_+_0.5cap)] w-0 shrink-0`}),(0,X.jsx)(_x,{})]}),(0,X.jsx)(ze,{contextTokens:L,id:n,surface:IT,value:E,onChange:D,onSubmit:()=>B(),onInterruptSubmit:R?()=>B(!0):void 0,slashSuggest:N,placeholder:c?.foreign?C:ne?b?`Steer…`:`Queue…`:`Reply…`,busy:k.busy,fileDrop:o,phone:{layout:`bar`,tools:k.phoneTools,idlePrimary:ie&&c?e=>(0,X.jsx)(dT,{thread:c,compact:e}):void 0,override:i,onLongPressSend:R?()=>B(!0):void 0}}),k.status,j&&(0,X.jsx)(Ro,{backend:j,onClose:()=>M(null),onAuthed:()=>M(null)}),P&&(0,X.jsx)(Zi,{backend:P,onClose:()=>F(null)})]}):(0,X.jsxs)(`div`,{"data-thread-composer-box":IT,"data-thread-action-bar":``,className:t,children:[r,(0,X.jsx)(ze,{contextTokens:L,id:n,surface:IT,value:E,onChange:D,onSubmit:()=>B(),onInterruptSubmit:R?()=>B(!0):void 0,slashSuggest:N,placeholder:C,busy:k.busy,footer:k.footer,railLead:z,fileDrop:o,send:c?.foreign?void 0:{mode:S,onMode:MT,running:y,staged:g,steerable:b}}),k.status,j&&(0,X.jsx)(Ro,{backend:j,onClose:()=>M(null),onAuthed:()=>M(null)}),P&&(0,X.jsx)(Zi,{backend:P,onClose:()=>F(null)})]})}function zT({slug:e,above:t,phoneBarOverride:n,phoneChrome:r}){return Tt(e)?(0,X.jsx)(LT,{slug:e,id:`followup-input`,className:`shrink-0 px-3 py-3`,above:t,phoneBarOverride:n,phoneChrome:r}):null}var BT=24,VT=2;function HT(e,t,n,r,i,a){return(n-e)*(a-t)-(r-t)*(i-e)}function UT(e,t){return e.y>=t.bottom?[t.left,t.bottom,t.right,t.bottom]:e.y<=t.top?[t.left,t.top,t.right,t.top]:e.x<=t.left?[t.left,t.top,t.left,t.bottom]:e.x>=t.right?[t.right,t.top,t.right,t.bottom]:null}function WT(e,t,n){if(Math.hypot(t.x-e.x,t.y-e.y)<VT)return!1;if(t.x>=n.left&&t.x<=n.right&&t.y>=n.top&&t.y<=n.bottom)return!0;let r=UT(e,n);if(!r)return!1;let[i,a,o,s]=r,c=HT(e.x,e.y,i,a,t.x,t.y),l=HT(i,a,o,s,t.x,t.y),u=HT(o,s,e.x,e.y,t.x,t.y);return!((c<0||l<0||u<0)&&(c>0||l>0||u>0))}function GT(e,t){let n=e.filter(e=>t.at-e.at<=150),r=e[e.length-1];return n.length>0?[...n,t]:r?[r,t]:[t]}function KT(e,t,n){let r=e[e.length-1];if(!r||e.length<2||t-r.at>250)return!1;let i=e[0];for(let t=e.length-2;t>=0;t--){let n=e[t];if(Math.hypot(r.x-n.x,r.y-n.y)>=BT){i=n;break}}return WT(i,r,n)}function qT(e,t=[],n=[]){let{todos:r,agents:i,children:a,shells:o,prs:s,issues:c,commands:l,timers:u,files:d,links:f}=I_(e,t,n),p=r.filter(e=>!e.done).length;return[{key:`todo`,n:e.runtime===`turn-idle`&&e.lastFence?.kind===`awaiting`&&Ts(e.lastFence.hints).length>0?0:p||r.length,one:p?`to-do`:`to-do done`,many:p?`to-dos`:`to-dos done`,states:[]},{key:`agent`,n:i.length,one:`agent`,many:`agents`,states:i.map(e=>e.state)},{key:`child`,n:a.length,one:`child thread`,many:`child threads`,states:a.map(us)},{key:`shell`,n:o.length,one:`shell`,many:`shells`,states:o.map(e=>e.state)},{key:`pr`,n:s.length,one:`PR`,many:`PRs`,states:[`running`]},{key:`issue`,n:c.length,one:`issue`,many:`issues`,states:[`running`]},{key:`command`,n:l.length,one:`monitor`,many:`monitors`,states:[`running`]},{key:`timer`,n:u.length,one:`timer`,many:`timers`,states:[`running`]},{key:`file`,n:d.length,one:`file`,many:`files`,states:[]},{key:`link`,n:f.length,one:`link`,many:`links`,states:[]}].filter(e=>e.n>0)}function JT({slug:e,subAgents:t,className:n=`px-1 pt-1.5`,density:r=`card`}){let i=bc(t,`card`);return i.length===0?null:(0,X.jsx)(`div`,{"data-queue-subagents":!0,className:`flex min-w-0 flex-col ${r===`panel`?``:`gap-0.5`} ${n}`,children:i.map((t,n)=>(0,X.jsx)(Io,{kind:`AGENT`,label:t.label,state:t.state,density:r,depth:t.depth,startedAt:t.startedAt,parentSlug:e,onOpen:t.id?()=>js(e,t.id,{label:t.label,subagentType:t.subagentType,startedAt:t.startedAt}):void 0,onDismiss:Do(e,t)},t.id??`${t.startedAt}-${n}`))})}var YT=300,XT=50,ZT=480,QT=12,$T=6,eE={todo:`What this thread needs a person to do`,agent:`Sub-agents running for this thread`,child:`Child threads this thread started`,shell:`Background shells running for this thread`,pr:`Pull requests this thread is watching`,issue:`Issues this thread is watching`,command:`Monitors this thread is waiting on`,timer:`Timers this thread has set`,file:`Files saved for this thread`,link:`Links saved for this thread`};function tE({thread:e,transcriptShells:t=[],only:n}){let r=YC(e),i=Ws(r.id),[a,o]=(0,q.useState)(null),s=(0,q.useRef)(void 0),c=(0,q.useRef)(void 0);(0,q.useEffect)(()=>()=>{clearTimeout(s.current),clearTimeout(c.current)},[]);let l=qT(r,t,i).filter(e=>!n||n.includes(e.key)),{prs:u,issues:f}=I_(r),p=[...u,...f].flatMap(e=>Mr(e.target)?[e.target]:[]).join(` `);(0,q.useEffect)(()=>{p&&Yt(p.split(` `))},[p]);let m=(0,q.useRef)(null),h=(0,q.useRef)([]),g=a!==null,_=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!g){_.current=null;return}let e=e=>{h.current=GT(h.current,{x:e.clientX,y:e.clientY,at:performance.now()})};return document.addEventListener(`pointermove`,e,{capture:!0,passive:!0}),()=>{document.removeEventListener(`pointermove`,e,{capture:!0}),h.current=[]}},[g]);let v=(0,q.useRef)(null),y=(0,q.useCallback)(e=>{e&&(v.current=e)},[]),b=()=>{let e=v.current?.isConnected?v.current.getBoundingClientRect():void 0;return!!e&&KT(h.current,performance.now(),e)},x=()=>{let e=document.querySelector(`[${d}]`),t=e?.getAttribute(d);return!!t&&e.matches(`:hover`)&&!!v.current?.querySelector(`[data-gh-ref="${CSS.escape(t)}"]`)},S=a!==null&&!l.some(e=>e.key===a);(0,q.useEffect)(()=>{S&&(clearTimeout(s.current),clearTimeout(c.current),o(null))},[S]);let C=Ub()?.comments.length??0;if(l.length===0&&C===0)return null;let w=e=>{clearTimeout(s.current),clearTimeout(c.current),o(e)},T=e=>{if(clearTimeout(s.current),clearTimeout(c.current),a===null||a===e||!b()){o(e);return}c.current=setTimeout(()=>T(e),XT)},E=()=>{clearTimeout(s.current),clearTimeout(c.current)},D=()=>{clearTimeout(s.current),clearTimeout(c.current);let e=()=>{b()||x()?s.current=setTimeout(e,XT):o(null)};s.current=setTimeout(e,YT)};return(0,X.jsxs)(`div`,{"data-queue-ops-summary":!0,ref:m,className:`-mt-3 flex h-8 min-w-0 items-baseline justify-end text-[11.5px]`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-[calc(16px_+_0.5cap)] w-0 shrink-0`}),(0,X.jsx)(_x,{}),l.map(e=>(0,X.jsx)(nE,{group:e,line:m,open:a===e.key,onOpen:()=>w(e.key),onHover:t=>{h.current=GT(h.current,{x:t.clientX,y:t.clientY,at:performance.now()}),T(e.key)},onHoverPanel:E,onCloseSoon:D,registerPanel:y,caretAt:_,onOpenChange:t=>t?w(e.key):o(t=>t===e.key?null:t),children:e.key===`todo`?(0,X.jsx)(`div`,{className:`px-2 py-1.5`,children:(0,X.jsx)(vv,{thread:r})}):e.key===`agent`?(0,X.jsx)(JT,{slug:r.id,subAgents:r.subAgents??[],className:``,density:`panel`}):e.key===`child`?(0,X.jsx)(`div`,{"data-queue-child-threads":!0,className:`flex min-w-0 flex-col`,children:(0,X.jsx)(Yi,{parent:r.id,childThreads:i,density:`panel`})}):e.key===`command`||e.key===`timer`?(0,X.jsx)(oE,{thread:r,kind:e.key}):(0,X.jsx)(SA,{slug:r.id,includeAgents:!1,only:e.key,transcriptShells:t,className:``,density:`panel`})},e.key))]})}function nE({group:e,line:t,open:n,onOpen:r,onHover:i,onHoverPanel:a,onCloseSoon:o,registerPanel:s,caretAt:c,onOpenChange:l,children:u}){let d=(0,q.useRef)(null),f=(0,q.useRef)(null),[p]=(0,q.useState)(()=>({current:{getBoundingClientRect:()=>t.current?.getBoundingClientRect()??new DOMRect,get contextElement(){return t.current??void 0}}})),m=e.n===1?e.one:e.many,h=()=>{r(),requestAnimationFrame(()=>f.current?.querySelector(`button, a[href], [tabindex]:not([tabindex='-1'])`)?.focus())};return(0,X.jsxs)(z,{open:n,onOpenChange:l,children:[(0,X.jsx)(Jt,{virtualRef:p}),(0,X.jsxs)(`button`,{type:`button`,"data-ops-count":e.key,"aria-label":`${e.n} ${m} — show ${e.n===1?`it`:`them`}`,"aria-haspopup":`dialog`,"aria-expanded":n,onMouseEnter:i,onMouseLeave:o,onFocus:r,ref:d,onClick:e=>{e.stopPropagation(),e.detail===0?h():r()},onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),h())},onMouseDown:e=>e.preventDefault(),className:`flex shrink-0 items-baseline gap-1.5 whitespace-nowrap rounded-md px-1.5 py-0.5 outline-none transition-colors focus-visible:ring-1 focus-visible:ring-focus-ink-60 ${n?`bg-panel-2 text-fg/85`:`text-muted-70 hover:bg-panel-2 hover:text-fg/85`}`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`relative block h-[1em] w-[1em] shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`,children:(0,X.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,X.jsx)(iE,{kind:e.key,states:e.states})})}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`tabular-nums text-fg/85`,children:e.n}),` `,m]})]}),(0,X.jsxs)(Wa,{side:`top`,align:`end`,sideOffset:0,"data-queue-ops-panel":e.key,"aria-label":eE[e.key],onMouseEnter:a,onMouseLeave:o,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{t.current?.contains(e.target)&&e.preventDefault()},onEscapeKeyDown:e=>{e.stopPropagation(),f.current?.contains(document.activeElement)&&d.current?.focus()},ref:e=>{f.current=e,s(e)},onClick:e=>e.stopPropagation(),className:`group/panel relative flex max-w-[calc(100vw-1.5rem)] flex-col p-1 before:absolute before:inset-x-0 before:top-full before:h-1.5 before:content-[''] data-[side=bottom]:before:top-auto data-[side=bottom]:before:bottom-full`,style:n?{width:rt(t.current?.getBoundingClientRect().width??ZT,ZT)}:void 0,children:[(0,X.jsx)(`div`,{className:`max-h-[min(20rem,50vh)] overflow-y-auto scrollbar-none`,children:u}),(0,X.jsx)(rE,{count:d,line:t,caretAt:c})]})]})}function rE({count:e,line:t,caretAt:n}){let r=()=>{let n=t.current?.getBoundingClientRect(),r=e.current?.getBoundingClientRect();return n&&r?n.right-(r.left+r.width/2)-QT/2-1:0},[i,a]=(0,q.useState)(()=>n.current??r());return(0,q.useEffect)(()=>{let e=r();n.current=e;let t=requestAnimationFrame(()=>a(e));return()=>cancelAnimationFrame(t)}),(0,X.jsxs)(`svg`,{"aria-hidden":!0,"data-queue-ops-caret":!0,width:QT,height:$T,viewBox:`0 0 ${QT} ${$T}`,style:{right:i},className:`pointer-events-none absolute top-full transition-[right] duration-100 ease-out motion-reduce:transition-none group-data-[side=bottom]/panel:top-auto group-data-[side=bottom]/panel:bottom-full group-data-[side=bottom]/panel:rotate-180`,children:[(0,X.jsx)(`path`,{d:`M1 0 L6 5 L11 0 Z`,className:`fill-elevated`}),(0,X.jsx)(`path`,{d:`M.5 .75 L5.5 5.1 Q6 5.5 6.5 5.1 L11.5 .75`,fill:`none`,strokeLinejoin:`round`,className:`stroke-border`})]})}function iE({kind:e,states:t}){switch(e){case`todo`:return(0,X.jsx)(qc,{"aria-hidden":!0,className:`h-[1em] w-[1em] text-muted-45`});case`agent`:case`child`:return(0,X.jsx)(aE,{hue:`agent`,states:t});case`shell`:return(0,X.jsx)(aE,{hue:`shell`,states:t});case`pr`:case`issue`:return(0,X.jsx)(aE,{hue:`github`,states:t});case`command`:case`timer`:return(0,X.jsx)(aE,{hue:`github`,states:t});case`file`:return(0,X.jsx)(Rt,{"aria-hidden":!0,className:`h-[1em] w-[1em] text-muted-45`});case`link`:return(0,X.jsx)(Ic,{"aria-hidden":!0,className:`h-[1em] w-[1em] text-muted-45`})}}function aE({hue:e,states:t}){return t.some(dr)?(0,X.jsx)(ut,{hue:e}):(0,X.jsx)(`span`,{className:t.includes(`rested`)?nc:N})}function oE({thread:e,kind:t}){let n=Wo(),{commands:r,timers:i}=I_(e);return(0,X.jsx)(`div`,{className:`flex flex-col`,children:t===`timer`?i.map(t=>(0,X.jsx)(Io,{kind:`TIMER`,label:py(t),state:`running`,density:`panel`,counter:hy(t,n),title:my(t),onOpen:()=>Pi(e.id,t.target,{label:py(t)})},t.id)):r.map(t=>(0,X.jsx)(Io,{kind:`COMMAND`,label:_y(t),state:`running`,density:`panel`,startedAt:t.createdAt,counter:by(t),title:yy(t,n),onOpen:()=>eo(e.id,t.target,{label:_y(t)})},t.id))})}function sE(e,t){return new Promise(n=>{Vr(e,t,`Your worker process was restarted so it picks up frizz's current tooling (hooks and worker contract). Re-read whatever you left in your scratch directory, then continue exactly where you left off.`,{freshProcess:!0,onSuccess:()=>{K(`Restarting worker…`),n()},onRollback:()=>n(),failureToast:e=>`Restart failed: ${e.slice(0,80)}`})||n()})}function cE(){return ur(tc().data??null)}function lE(e,t){return!t||e.kind!==`session`||e.foreign||e.backend===`codex`||e.backend===`acp`||e.backend===`opencode`||e.backend===`antigravity`?!1:e.runtime!==`exited`}function uE({thread:e,onSnoozed:t}){let[n,r]=(0,q.useState)(!1),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(``),_=(0,q.useId)(),v=(0,q.useId)(),y=(0,q.useId)(),b=na(e),x=e.snoozePrompt?.trim(),S=(0,q.useMemo)(()=>ro(new Date(Date.now()+6e4)),[l]),C=(0,q.useMemo)(()=>ws.map(e=>{let t=Mo(ta(e.value));return e.value===`tomorrow`?{value:e.value,label:`Tomorrow`,wake:t.replace(/^Tomorrow at /,``)}:{value:e.value,label:e.label,wake:t}}),[n]),w=(0,q.useMemo)(()=>Di(e),[n,e.runtime,e.wakesOnItsOwn]),T=!b&&Gi(e),E=!!b||T,D=b?x?`Bumps ${Mo(b)}`:`Snoozed until ${Mo(b)}`:T?`Snoozed until activity`:null,O=D?x?`${D}\n${x}`:D:`Snooze`;async function k(){s(!0);try{await W.snoozeAwaitingBackground({slug:e.id,sessionId:e.sessionId??``}),K(`Snoozed until activity`),t?.()}catch(e){K((e instanceof Error?e.message:`Snooze failed`).slice(0,100))}finally{s(!1)}}async function A(n,r=null){s(!0);try{await W.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:n,prompt:n?r:null}),n?(K(`${r?`Bump scheduled`:`Snoozed`} · ${Mo(n)}`),t?.()):K(`Snooze cleared`),u(!1),g(``)}catch(e){let t=e instanceof Error?e.message:`Snooze failed`;K(t.slice(0,100)),g(t)}finally{s(!1)}}function j(){f(ro(new Date(b??ta(`1d`)))),m(e.snoozePrompt??``),g(``),u(!0)}function M(){let e=da(d);if(!e.ok){g(e.message);return}let t=p.trim();if(t.length>4e3){g(`Prompt is too long (${t.length}/${Zo})`);return}A(e.until,t||null)}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(vs,{open:n,onOpenChange:e=>{r(e),e||a(!0)},children:[(0,X.jsx)(Bs,{label:O,multiline:!!x,disabled:n||i,children:(0,X.jsx)(ri,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,disabled:o,"data-snooze-menu":!0,"data-snoozed":E?`true`:`false`,"aria-label":D??`Snooze`,"aria-description":b&&x?x:void 0,onMouseDown:e=>e.preventDefault(),onBlur:()=>a(!1),onPointerLeave:()=>a(!1),className:`${E?xi.replace(/(^| )text-muted( |$)/,`$1text-attention-90$2`):xi} ${n?`bg-panel-2`:``}`,children:o?(0,X.jsx)(de,{size:14,strokeWidth:2,className:`animate-spin`}):(0,X.jsx)(nt,{size:14,strokeWidth:2})})})}),(0,X.jsxs)(_o,{align:`end`,children:[(0,X.jsx)(`div`,{className:`px-2.5 pb-1 pt-1.5 text-[11px] text-muted-60`,children:D??`Snooze`}),E&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(es,{onSelect:()=>void A(null),icon:(0,X.jsx)(Tc,{size:12}),children:`Wake now`}),(0,X.jsx)(wa,{})]}),C.map(e=>(0,X.jsx)(es,{onSelect:()=>void A(ta(e.value)),icon:(0,X.jsx)(nt,{size:12}),children:(0,X.jsxs)(`span`,{"data-snooze-preset":e.value,className:`flex min-w-0 flex-1 items-center justify-between gap-6`,children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(`span`,{className:`text-[10.5px] text-muted-55`,children:e.wake})]})},e.value)),(0,X.jsx)(es,{onSelect:()=>void k(),disabled:!w.enabled,children:(0,X.jsx)(Bs,{label:w.enabled?``:w.reason,side:`left`,disabled:w.enabled,children:(0,X.jsxs)(`span`,{"data-snooze-activity":!0,className:`-mx-2.5 -my-1.5 flex min-w-0 flex-1 items-center gap-2 px-2.5 py-1.5`,children:[(0,X.jsx)(`span`,{className:`flex w-3.5 shrink-0 items-center justify-center`,children:(0,X.jsx)(nt,{size:12})}),(0,X.jsx)(`span`,{children:`Until activity`})]})})}),(0,X.jsx)(wa,{}),(0,X.jsx)(es,{onSelect:j,children:`Custom time & prompt…`})]})]}),(0,X.jsx)(wt,{open:l,onOpenChange:e=>{o||u(e)},title:`Snooze thread`,className:`w-[360px] max-w-[92vw]`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>u(!1),className:`button-outline rounded-md px-3 py-1.5 text-[12px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-45`,children:`Cancel`}),(0,X.jsxs)(`button`,{type:`submit`,form:y,"data-dialog-default":!0,disabled:o,className:`button-outline flex items-center gap-1.5 rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-opacity hover:opacity-90 disabled:opacity-45`,children:[o&&(0,X.jsx)(de,{size:12,className:`animate-spin`}),p.trim()?`Snooze & bump`:`Snooze`]})]}),children:(0,X.jsxs)(`form`,{id:y,className:`flex flex-col gap-2.5 p-4`,onSubmit:e=>{e.preventDefault(),M()},children:[(0,X.jsx)(`label`,{htmlFor:_,className:`text-[11px] font-medium text-muted`,children:`Wake at this local time`}),(0,X.jsx)(`input`,{id:_,type:`datetime-local`,required:!0,min:S,value:d,onChange:e=>{f(e.target.value),g(``)},className:`w-full rounded-md border border-border bg-bg px-2.5 py-2 text-[13px] text-fg outline-none focus:border-accent`}),(0,X.jsx)(`p`,{className:`text-[10.5px] text-muted-65`,children:`Stored as an exact instant; shown here in your browser’s local time zone.`}),(0,X.jsxs)(`label`,{htmlFor:v,className:`mt-1 text-[11px] font-medium text-muted`,children:[`Then send this prompt `,(0,X.jsx)(`span`,{className:`font-normal text-muted-55`,children:`(optional)`})]}),(0,X.jsx)(`textarea`,{id:v,"data-1p-ignore":!0,autoFocus:!0,rows:3,maxLength:Zo,placeholder:`e.g. Check whether CI went green and land it if so.`,value:p,onChange:e=>{m(e.target.value),g(``)},onKeyDown:e=>{c({key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.nativeEvent.keyCode})&&(e.preventDefault(),M())},className:`w-full resize-y rounded-md border border-border bg-bg px-2.5 py-2 text-[13px] leading-5 text-fg outline-none placeholder:text-muted-40 focus:border-accent`}),(0,X.jsx)(`p`,{className:`min-h-4 text-[10.5px] text-muted-65`,children:p.trim()?`frizz will resume this thread with the prompt at the wake time.`:`Leave empty to just bring the card back to your queue.`}),h&&(0,X.jsx)(`p`,{role:`alert`,className:`text-[11px] text-danger`,children:h})]})})]})}function dE({thread:e,onArchived:t,onDismissCancel:n,onSnoozed:r}){let i=sn(e);return i.lifecycle?(0,X.jsxs)(`span`,{"data-thread-lifecycle":!0,role:`group`,"aria-label":`Thread lifecycle actions`,className:`flex shrink-0 items-center gap-0.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,"data-lifecycle-rule":!0,className:`mx-2.5 h-4 w-px shrink-0 bg-border`}),i.done?(0,X.jsx)(fE,{}):(0,X.jsxs)(X.Fragment,{children:[i.snooze&&(0,X.jsx)(uE,{thread:e,onSnoozed:r}),(0,X.jsx)(mE,{thread:e,onArchived:t,onDismissCancel:n,iconOnly:!0})]})]}):null}function fE(){return(0,X.jsx)(pE,{"data-thread-done":``,check:!0,tooltip:`Marked done — send a message to reopen it`,children:`Done`})}function pE({check:e=!1,tooltip:t,children:n,...r}){return(0,X.jsx)(Bs,{label:t,children:(0,X.jsxs)(`span`,{...r,"aria-label":t,className:`flex h-7 items-center gap-1 rounded-md px-2 text-[12px] font-medium text-muted`,children:[e&&(0,X.jsx)(dt,{size:12}),n]})})}function mE({thread:e,onArchived:t,onDismissCancel:n,className:r=`rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] text-fg/80 hover:bg-panel-2 hover:text-fg`,iconClassName:i=``,iconSize:a=12,iconOnly:o=!1}){let s=`Mark as done`,[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(void 0),[m,h]=(0,q.useState)(!1),g=(0,q.useRef)(void 0),_=(r,i)=>{let a=g.current;l(!0),i&&t?.(),(r||gr(e))&&hs(e.id),W.completeThread({slug:e.id,sessionId:e.sessionId??``,terminateLive:r,...a===!1?{leavePinned:!0}:{}}).then(r=>{if(r.needsConfirmation){Ii(e.id),i&&n?.(),p(r.hold),d(!0),l(!1);return}d(!1),Bo(`Done`,e,a),i||t?.()}).catch(t=>{Ii(e.id),i&&n?.(),K(`Couldn’t finish: ${t.message.slice(0,80)}`),l(!1)})},v=!!t&&!!n&&gr(e),y=()=>{g.current=void 0,ot(e)&&!e.leavePinned?h(!0):_(!1,v)};return(0,X.jsxs)(X.Fragment,{children:[o?(0,X.jsx)(Bs,{label:s,children:(0,X.jsx)(`button`,{type:`button`,onClick:y,disabled:c,"aria-label":s,onMouseDown:e=>e.preventDefault(),className:xi,children:(0,X.jsx)(dt,{size:15,strokeWidth:2})})}):(0,X.jsxs)(`button`,{type:`button`,onClick:y,disabled:c,"aria-label":s,title:s,onMouseDown:e=>e.preventDefault(),className:`flex items-center gap-1 font-medium outline-none transition-colors focus-visible:ring-1 focus-visible:ring-focus-ink-60 disabled:opacity-45 ${r}`,children:[(0,X.jsx)(dt,{size:a,className:i}),s]}),(0,X.jsx)(wt,{open:u,onOpenChange:e=>{c||d(e)},title:f?.cutOff?`Mark an unfinished thread done?`:`End this session?`,className:`w-[390px] max-w-[92vw]`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{type:`button`,disabled:c,onClick:()=>d(!1),className:`button-outline rounded-md px-3 py-1.5 text-[12px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-45`,children:`Cancel`}),(0,X.jsxs)(`button`,{type:`button`,"data-dialog-default":!0,disabled:c,onClick:()=>_(!0,!1),className:`button-outline flex items-center gap-1.5 rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-opacity hover:opacity-90 disabled:opacity-45`,children:[c&&(0,X.jsx)(de,{size:12,className:`animate-spin`}),`Mark as done`]})]}),children:(0,X.jsx)(uT,{hold:f})}),(0,X.jsx)(hE,{open:m,onOpenChange:h,onAnswer:e=>{g.current=e,h(!1),_(!1,v)}})]})}function hE({open:e,onOpenChange:t,onAnswer:n}){let r=`button-outline rounded-md px-3 py-1.5 text-[12px] outline-none focus-visible:ring-1 focus-visible:ring-focus-ink-60`;return(0,X.jsx)(wt,{open:e,onOpenChange:t,title:`Unpin this thread too?`,className:`w-[340px] max-w-[92vw]`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{type:`button`,"data-unpin-ask":`keep`,onClick:()=>n(!1),className:`${r} text-fg/80 transition-colors hover:bg-panel-2 hover:text-fg`,children:`Leave pinned`}),(0,X.jsx)(`button`,{type:`button`,"data-dialog-default":!0,"data-unpin-ask":`unpin`,onClick:()=>n(!0),className:`${r} bg-fg font-medium text-bg transition-opacity hover:opacity-90`,children:`Unpin`})]})})}function gE({slug:e,onClose:t,onArchived:n,initialView:r=`actions`}){let i=Xa(U),a=Xr(i.board,e),[s,c]=(0,q.useState)(r),l=Hi(t);(0,q.useEffect)(()=>{i.board&&!a&&l()},[i.board,a,l]);let u=o(a);return a?(0,X.jsx)(uw,{title:`Thread actions: ${u}`,onRequestClose:()=>l(),dataAttr:`data-thread-actions-sheet`,children:s===`actions`?(0,X.jsx)(_E,{thread:a,title:u,setView:c,dismiss:l,onArchived:n}):s===`snooze`?(0,X.jsx)(yE,{thread:a,back:()=>c(`actions`),custom:()=>c(`snooze-custom`),dismiss:l}):s===`snooze-custom`?(0,X.jsx)(bE,{thread:a,back:()=>c(`snooze`),dismiss:l}):s===`goal`?(0,X.jsx)(xE,{thread:a,back:()=>c(`actions`)}):s===`todos`?(0,X.jsx)(SE,{thread:a,back:()=>c(`actions`)}):s===`files`?(0,X.jsx)(CE,{thread:a,back:r===`files`?void 0:()=>c(`actions`),dismiss:l}):(0,X.jsx)(EE,{thread:a,back:()=>c(`actions`),dismiss:l})}):null}function _E({thread:e,title:t,setView:n,dismiss:r,onArchived:i}){let a=oo(),o=cE(),s=Xa(qa).snoozePreset,c=sn(e),l=e.kind===`session`&&e.foreign!==!0,u=na(e),d=e.recurringPrompt?.stopHook===!0||e.recurringPrompt?.heartbeat===!0||e.recurringPrompt?.postCompaction===!0,f=e.links??[],p=e.humanTodos??[],m=e.runtime===`running`||e.runtime===`spawning`,h=l&&ks(e),g=lE(e,o),_=DE(e),v=[M(e.context),_].filter(Boolean).join(` · `);return(0,X.jsxs)(`div`,{"data-thread-actions-list":!0,children:[(0,X.jsx)(AE,{children:t}),c.snooze&&(0,X.jsx)(kE,{data:`snooze`,icon:(0,X.jsx)(nt,{size:19}),label:`Snooze`,value:u?Mo(u):Ur(s),chevron:!0,onClick:()=>n(`snooze`)}),l&&(0,X.jsx)(kE,{data:`goal`,icon:(0,X.jsx)(mT,{size:19,className:d?`text-attention-90`:void 0}),label:`Goal`,value:d?`on`:`off`,chevron:!0,onClick:()=>n(`goal`)}),p.length>0&&(0,X.jsx)(kE,{data:`todos`,icon:(0,X.jsx)(qc,{size:19}),label:`To-do`,value:String(p.filter(e=>!e.done).length),chevron:!0,onClick:()=>n(`todos`)}),f.length>0&&(0,X.jsx)(kE,{data:`files`,icon:(0,X.jsx)(Rt,{size:19}),label:`Files and links`,value:String(f.length),chevron:!0,onClick:()=>n(`files`)}),m&&c.archive&&(0,X.jsx)(mE,{thread:e,iconSize:19,iconClassName:`shrink-0 text-muted`,onArchived:()=>r(i),className:`${OE} !gap-[14px] !font-normal`}),(0,X.jsx)(`div`,{className:`my-1 h-px bg-border`}),l&&(0,X.jsx)(kE,{data:`rename`,icon:(0,X.jsx)(Js,{size:19}),label:`Rename`,onClick:()=>n(`rename`)}),(0,X.jsx)(kE,{data:`copy-link`,icon:(0,X.jsx)(qe,{size:19}),label:`Copy link`,onClick:()=>{let t=new URL(Cc(e.id),location.origin).href;r(()=>{lo(t).then(()=>K(`Link copied`)).catch(e=>K(`Couldn’t copy: ${e.message.slice(0,80)}`))})}}),h&&(0,X.jsx)(kE,{data:`retry`,icon:(0,X.jsx)(rc,{size:19}),label:`Retry`,onClick:()=>r(()=>void wr(a,e.id))}),g&&(0,X.jsx)(kE,{data:`restart-worker`,icon:(0,X.jsx)(An,{size:19}),label:`Restart worker`,onClick:()=>r(()=>void sE(a,e.id))}),v&&(0,X.jsx)(`div`,{"data-thread-actions-foot":!0,className:`px-[18px] pt-2.5 text-[12.5px] leading-[17px] text-muted`,children:v})]})}function vE(e,t){let[n,r]=(0,q.useState)(!1),[i,a]=(0,q.useState)(``);async function o(n,i=null){r(!0),a(``);try{await W.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:n,prompt:n?i:null}),t(()=>K(n?`${i?`Bump scheduled`:`Snoozed`} · ${Mo(n)}`:`Snooze cleared`))}catch(e){let t=e instanceof Error?e.message:`Snooze failed`;K(t.slice(0,100)),a(t)}finally{r(!1)}}return{busy:n,error:i,setError:a,apply:o}}function yE({thread:e,back:t,custom:n,dismiss:r}){let i=Xa(qa).snoozePreset,a=na(e),{busy:o,apply:s}=vE(e,r),c=e=>{qa.snoozePreset=e,s(ta(e))};return(0,X.jsxs)(`div`,{"data-thread-actions-snooze":!0,children:[(0,X.jsx)(jE,{back:t,children:`Snooze`}),a&&(0,X.jsxs)(`p`,{className:`px-[18px] pb-2 text-[13px] text-muted`,children:[`Snoozed until `,Mo(a).replace(/^(Today|Tomorrow)/,e=>e.toLowerCase())]}),ws.map(e=>(0,X.jsx)(kE,{data:`snooze-${e.value}`,disabled:o,icon:(0,X.jsx)(nt,{size:19}),label:e.label,value:e.detail,trailing:e.value===i?(0,X.jsx)(dt,{size:16,className:`text-fg/80`}):(0,X.jsx)(`span`,{className:`w-4`}),onClick:()=>c(e.value)},e.value)),(0,X.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,X.jsx)(kE,{data:`snooze-custom`,disabled:o,icon:(0,X.jsx)(Js,{size:19}),label:`Custom time & prompt…`,chevron:!0,onClick:n}),a&&(0,X.jsx)(kE,{data:`snooze-wake`,disabled:o,icon:(0,X.jsx)(rc,{size:19}),label:`Wake now`,onClick:()=>void s(null)})]})}function bE({thread:e,back:t,dismiss:n}){let r=Xa(qa).snoozePreset,i=na(e),{busy:a,error:o,setError:s,apply:c}=vE(e,n),[l,u]=(0,q.useState)(()=>ro(new Date(i??ta(r)))),[d,f]=(0,q.useState)(e.snoozePrompt??``),p=(0,q.useMemo)(()=>ro(new Date(Date.now()+6e4)),[]),m=(0,q.useId)(),h=(0,q.useId)(),g=()=>{let e=da(l);if(!e.ok)return s(e.message);let t=d.trim();if(t.length>4e3)return s(`Prompt is too long (${t.length}/${Zo})`);c(e.until,t||null)};return(0,X.jsxs)(`form`,{"data-thread-actions-snooze-custom":!0,className:`flex flex-col`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,X.jsx)(jE,{back:t,children:`Custom snooze`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 px-[18px]`,children:[(0,X.jsx)(`label`,{htmlFor:m,className:`text-[13px] font-medium text-muted`,children:`Wake at this local time`}),(0,X.jsx)(`input`,{id:m,type:`datetime-local`,required:!0,min:p,value:l,onChange:e=>{u(e.target.value),s(``)},className:`h-11 w-full rounded-lg border border-border bg-bg px-3 text-[16px] text-fg outline-none focus:border-border-strong`}),(0,X.jsxs)(`label`,{htmlFor:h,className:`mt-2 text-[13px] font-medium text-muted`,children:[`Then send this prompt `,(0,X.jsx)(`span`,{className:`font-normal text-muted-70`,children:`(optional)`})]}),(0,X.jsx)(`textarea`,{id:h,"data-1p-ignore":!0,rows:3,maxLength:Zo,placeholder:`e.g. Check whether CI went green and land it if so.`,value:d,onChange:e=>{f(e.target.value),s(``)},className:`w-full resize-none rounded-lg border border-border bg-bg px-3 py-2 text-[16px] leading-[22px] text-fg outline-none placeholder:text-muted-50 focus:border-border-strong`}),(0,X.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:d.trim()?`Frizz will resume this thread with the prompt at the wake time.`:`Leave it empty to just bring the thread back to your queue.`}),o&&(0,X.jsx)(`p`,{role:`alert`,className:`text-[13px] text-danger`,children:o}),(0,X.jsxs)(`button`,{type:`submit`,disabled:a,className:`mt-1 flex h-[46px] items-center justify-center gap-2 rounded-xl bg-fg text-[15.5px] font-semibold text-bg outline-none disabled:opacity-45`,children:[a&&(0,X.jsx)(de,{size:16,className:`animate-spin`}),d.trim()?`Snooze and bump`:`Snooze`]})]})]})}function xE({thread:e,back:t}){return(0,X.jsxs)(`div`,{"data-thread-actions-goal":!0,children:[(0,X.jsx)(jE,{back:t,children:`Goal`}),(0,X.jsx)(`div`,{className:`px-[18px] text-[13.5px] leading-relaxed text-fg [&_input]:!text-[16px] [&_textarea]:!min-h-[6rem] [&_textarea]:!text-[16px] [&_textarea]:!leading-[22px]`,children:(0,X.jsx)(OT,{thread:e,armed:e.recurringPrompt,close:t,heading:!1})})]})}function SE({thread:e,back:t}){return(0,X.jsxs)(`div`,{"data-thread-actions-todos":!0,children:[(0,X.jsx)(jE,{back:t,count:(e.humanTodos??[]).filter(e=>!e.done).length,children:`To-do`}),(0,X.jsx)(`div`,{className:`px-[18px] pb-3 text-[14px] leading-[21px]`,children:(0,X.jsx)(vv,{thread:e,sends:!0})})]})}function CE({thread:e,back:t,dismiss:n}){let r=[...e.links??[]].reverse();return(0,X.jsxs)(`div`,{"data-thread-actions-files":!0,children:[t?(0,X.jsx)(jE,{back:t,count:r.length,children:`Files and links`}):(0,X.jsx)(AE,{count:r.length,children:`Files and links`}),r.length===0&&(0,X.jsx)(`p`,{className:`px-[18px] pb-2 text-[14px] text-muted`,children:`Nothing registered yet.`}),r.map(e=>(0,X.jsx)(wE,{link:e,dismiss:n},e.id))]})}function wE({link:e,dismiss:t}){let n=e.kind===`link`,r=n&&le(e.target),i=Xa(U).board?.projectDir,a=n?r?`${Ks(e.target)} — not reachable from this phone`:Ks(e.target):TE(e.target,i),o=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`flex h-[21px] w-[19px] shrink-0 items-center justify-center text-muted`,children:n?(0,X.jsx)(Ic,{size:19}):(0,X.jsx)(Rt,{size:19})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{"data-link-label":!0,className:`block truncate text-[15.5px] leading-[21px] text-fg`,children:e.label}),(0,X.jsx)(`span`,{"data-link-destination":!0,className:`block truncate text-[12.5px] leading-[17px] text-muted`,children:a})]}),!r&&(0,X.jsx)(fr,{size:15,className:`shrink-0 self-center text-muted-70`})]}),s=`flex min-h-[56px] w-full items-start gap-[14px] px-[18px] py-[9px] text-left outline-none focus-visible:bg-hover`;return r?(0,X.jsx)(`div`,{"data-thread-link":e.id,"data-link-unreachable":!0,title:e.target,className:s,children:o}):n?(0,X.jsx)(`a`,{"data-thread-link":e.id,title:e.target,href:e.target,target:`_blank`,rel:`noopener noreferrer`,className:`${s} active:bg-hover`,onClick:()=>t(),children:o}):(0,X.jsx)(`button`,{type:`button`,"data-thread-link":e.id,title:e.target,className:`${s} active:bg-hover`,onClick:()=>t(()=>R(e.target)),children:o})}function TE(e,t){if(t&&e.startsWith(`${t.replace(/\/+$/,``)}/`))return e.slice(t.replace(/\/+$/,``).length+1);let n=e.split(`/`).filter(Boolean);return n.length>2?`…/${n.slice(-2).join(`/`)}`:e}function EE({thread:e,back:t,dismiss:n}){let r=o(e),[i,a]=(0,q.useState)(()=>br(r,e.id)),s=(0,q.useRef)(null),c=Ji({mutationFn:()=>W.aiRenameThread({slug:e.id})}),l=kr(e);(0,q.useEffect)(()=>{let e=requestAnimationFrame(()=>{s.current?.focus(),s.current?.select()});return()=>cancelAnimationFrame(e)},[]);let u=()=>{let a=Lr(i,r);if(!a)return t();let o=dn(e.id,a);n(),o.then(()=>K(`Thread renamed`),e=>K(e instanceof Error?e.message:`Could not rename thread`))};return(0,X.jsxs)(`form`,{"data-thread-actions-rename":!0,onSubmit:e=>{e.preventDefault(),u()},children:[(0,X.jsx)(jE,{back:t,children:`Rename`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 px-[18px]`,children:[(0,X.jsx)(`input`,{ref:s,"aria-label":`Thread title`,value:i,maxLength:200,onChange:e=>a(e.target.value),"data-claims-escape":!0,className:`h-11 w-full rounded-lg border border-border bg-bg px-3 text-[16px] text-fg outline-none focus:border-border-strong`}),(0,X.jsx)(`button`,{type:`submit`,className:`flex h-[46px] items-center justify-center rounded-xl bg-fg text-[15.5px] font-semibold text-bg outline-none`,children:`Save`})]}),l.show&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`mt-3 mb-1 h-px bg-border`}),(0,X.jsx)(kE,{data:`ai-rename`,disabled:c.isPending,icon:c.isPending?(0,X.jsx)(de,{size:19,className:`animate-spin`}):(0,X.jsx)(il,{size:19}),label:c.isPending?`Claude is naming it…`:`Rename with Claude`,onClick:()=>{if(!l.enabled)return K(l.label);c.mutate(void 0,{onSuccess:({title:e})=>n(()=>K(`Renamed to “${e}”`)),onError:e=>K(e instanceof Error?e.message:`Could not rename with Claude`,{duration:7e3})})}})]})]})}function DE(e){let t=!!(e&&!e.foreign&&e.kind===`session`),n=ui(),r=Fo({queryKey:[`threadProfileOptions`,e?.id??``],queryFn:()=>W.threadProfileOptions({slug:e.id}),enabled:t&&!n,staleTime:5e3}),i=e?.backend===`antigravity`,a=Sc(e?D(e.id):void 0,t&&i&&!n);if(!e)return null;let o=e.model?.trim(),s=e.effort?.trim();if(!o&&!s&&!e.runningModelLabel)return null;let c=ic(i?[At({models:a.models,loading:a.loading,saved:{model:o,effort:s}})]:[{id:e.backend??`claude`,label:``,options:r.data?.options??[]}],i?zt(o,s):{model:o,effort:s},``,e.runningModelLabel);return[[c.name,c.edition].filter(Boolean).join(` `)||null,Ln(c.effort)].filter(Boolean).join(` · `)||null}var OE=`flex min-h-[50px] w-full items-center gap-[14px] px-[18px] text-left text-[15.5px] leading-[21px] text-fg outline-none transition-colors active:bg-hover focus-visible:bg-hover disabled:opacity-45`;function kE({icon:e,label:t,value:n,chevron:r,trailing:i,onClick:a,disabled:o,data:s}){return(0,X.jsxs)(`button`,{type:`button`,"data-thread-action":s,disabled:o,onClick:a,className:OE,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`flex w-[19px] shrink-0 items-center justify-center text-muted`,children:e}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),(n||r||i)&&(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 text-[14px] text-muted`,children:[n,r&&(0,X.jsx)(fr,{size:15,className:`text-muted-70`}),i]})]})}function AE({children:e,count:t}){return(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2 px-[18px] pb-2.5 pt-1`,children:[(0,X.jsx)(`span`,{"data-thread-actions-title":!0,className:`min-w-0 flex-1 truncate text-[16px] font-semibold leading-[22px]`,children:e}),t!==void 0&&(0,X.jsx)(`span`,{className:`shrink-0 text-[12.5px] text-muted`,children:t})]})}function jE({children:e,back:t,count:n}){return(0,X.jsxs)(`div`,{className:`flex items-center gap-0.5 pb-1 pl-[6px] pr-[18px]`,children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":`Back`,onClick:t,className:`flex size-11 shrink-0 items-center justify-center rounded-full text-fg/85 outline-none active:bg-hover focus-visible:bg-hover`,children:(0,X.jsx)(jc,{size:21})}),(0,X.jsx)(`span`,{"data-thread-actions-title":!0,className:`min-w-0 flex-1 truncate text-[16px] font-semibold leading-[22px]`,children:e}),n!==void 0&&(0,X.jsx)(`span`,{className:`shrink-0 text-[12.5px] text-muted`,children:n})]})}function ME({slug:e,onClose:t}){let n=Tt(e),r=o(n),[i,a]=(0,q.useState)(!1),s=Wo(),c=Qt(e,{poll:n?.runtime===`running`||n?.runtime===`spawning`}),l=(0,q.useMemo)(()=>Va(c.data?.messages??[]),[c.data]),d=DE(n),f=n?D(n.id):void 0,p=Qe(f!==void 0).bySlug.get(f??``);if(!n)return null;let m=Gt(n),h=ne(n,m,l,s);return(0,X.jsxs)(`header`,{"data-thread-header":!0,"data-mobile-thread-header":!0,className:`flex min-h-14 shrink-0 items-center gap-0.5 border-b border-border bg-panel py-1 pl-1 pr-[5px]`,children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":`Back`,"data-mobile-thread-back":!0,onClick:()=>{ys()?history.back():t()},className:`flex size-11 shrink-0 items-center justify-center rounded-full text-fg/90 outline-none active:bg-hover focus-visible:bg-hover`,children:(0,X.jsx)(Go,{size:21,strokeWidth:2.1})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 pl-0.5 leading-[1.25]`,children:[(0,X.jsx)(`div`,{"data-mobile-thread-title":!0,className:`truncate text-[16.5px] font-semibold tracking-[-0.01em]`,title:r,children:r}),(0,X.jsxs)(`div`,{"data-mobile-thread-subtitle":!0,"data-state":m,className:`truncate text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{className:m===`needs-you`?`font-semibold text-accent`:m===`working`?`font-semibold text-live`:``,children:On[m]}),h&&(0,X.jsxs)(X.Fragment,{children:[` · `,h]}),f&&(0,X.jsxs)(X.Fragment,{children:[` · `,(0,X.jsxs)(`span`,{"data-mobile-thread-project":f,className:`font-medium text-fg/80`,children:[p?(0,X.jsx)(`span`,{className:`mr-[5px] inline-block align-[-0.14em]`,children:(0,X.jsx)(u,{project:p,size:13})}):null,p?.name??f]})]}),d&&(0,X.jsxs)(X.Fragment,{children:[` · `,d]})]})]}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Thread actions`,"aria-haspopup":`dialog`,"aria-expanded":i,"data-mobile-thread-more":!0,onClick:()=>a(!0),className:`flex size-11 shrink-0 items-center justify-center rounded-full text-fg/90 outline-none active:bg-hover focus-visible:bg-hover`,children:(0,X.jsx)(nn,{size:21,strokeWidth:2.1})}),i&&(0,X.jsx)(gE,{slug:e,onClose:()=>a(!1),onArchived:()=>Ze(e)})]})}function NE({thread:e}){let t=oo(),[n,r]=(0,q.useState)(!1);return lE(e,cE())?(0,X.jsx)(Bs,{label:`Restart worker — same conversation, fresh process on current tooling`,side:`top`,children:(0,X.jsx)(`button`,{type:`button`,disabled:n,"aria-label":`Restart worker`,onMouseDown:e=>e.preventDefault(),onClick:()=>{r(!0),sE(t,e.id).finally(()=>r(!1))},className:`${xi} mr-[2px]`,children:n?(0,X.jsx)(de,{size:14,strokeWidth:2,className:`animate-spin`}):(0,X.jsx)(An,{size:14,strokeWidth:2})})}):null}function PE(e){return Os(e)??ts(`/`)}function FE(e){Ta(PE(e),{viewTransition:!mi()})}function IE({slug:e,label:t=`Exit fullscreen`}){let n=ko()?vo(e):PE(e);function r(t){if(Cn(t)){if(t.preventDefault(),ko()){ii(!1);return}FE(e)}}return(0,X.jsx)(Bs,{label:t,children:(0,X.jsx)(`a`,{href:n,"aria-label":t,"data-standalone-return":!0,onMouseDown:e=>e.preventDefault(),onClick:r,className:xi,children:(0,X.jsx)($c,{size:14})})})}function LE({thread:e,expand:t,collapse:n,onDoc:r,onDone:i,onCollapse:a,collapsed:o,doneBusy:s,onStatusMutate:c,onStatusApplied:l,onStatusFailed:u}){let d=e.kind===`session`;return(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[a&&(0,X.jsx)(zE,{label:o?`Expand`:`Collapse`,icon:o?Nc:Mc,size:13,onClick:a}),(0,X.jsx)(NE,{thread:e}),r&&(0,X.jsx)(zE,{label:`Frizz document`,icon:Rt,size:14,onClick:r}),t&&(0,X.jsx)(ls,{slug:e.id}),n&&(0,X.jsx)(IE,{slug:e.id}),d?ks(e)?(0,X.jsx)(RE,{slug:e.id}):null:(0,X.jsx)(`div`,{className:`ml-1`,children:(0,X.jsx)(zi,{slug:e.id,onDone:i,doneBusy:s,onMutateStart:c,onApplied:l,onFailed:u})})]})}function RE({slug:e}){let t=oo(),[n,r]=(0,q.useState)(!1);return(0,X.jsx)(Bs,{label:`Retry — resume this session where it left off`,children:(0,X.jsxs)(`button`,{onClick:()=>{r(!0),wr(t,e).finally(()=>r(!1))},disabled:n,"aria-label":`Retry exited session`,"data-header-pill":!0,onMouseDown:e=>e.preventDefault(),className:`ml-1 flex items-center gap-1.5 rounded-md border border-accent/45 bg-accent/10 px-2.5 py-1 text-[12px] font-medium text-accent outline-none transition-colors hover:bg-accent/15 disabled:opacity-50`,children:[n?(0,X.jsx)(de,{size:12,className:`animate-spin`}):(0,X.jsx)(rc,{size:12}),`Retry`]})})}function zE({label:e,icon:t,size:n,busy:r,...i}){return(0,X.jsx)(Bs,{label:e,children:(0,X.jsx)(`button`,{...i,"aria-label":e,onMouseDown:e=>e.preventDefault(),className:xi,children:r?(0,X.jsx)(de,{size:n,strokeWidth:2,className:`animate-spin`}):(0,X.jsx)(t,{size:n,strokeWidth:2})})})}var BE=1.25,VE=7.5-BE/2,HE=2*Math.PI*VE;function UE(e,t){return Math.max(0,Math.min(100,Math.floor(e/t*100)))}var WE=150;function GE(e){return!!e.context&&e.context.window>0}function KE({thread:e}){let t=e.context;if(!t||!GE(e))return null;let n=ZE(e,t.tokens);return(0,X.jsx)(qE,{context:t,action:Dr(e)?t=>(0,X.jsx)(QE,{thread:e,compacting:n,onRequested:t}):void 0})}function qE({context:e,action:t}){let[n,r]=(0,q.useState)(!1),i=(0,q.useRef)(void 0),a=(0,q.useRef)(null),o=(0,q.useRef)(null);if((0,q.useEffect)(()=>()=>clearTimeout(i.current),[]),!(e.window>0))return null;let s=()=>{clearTimeout(i.current),r(!0)},c=()=>{clearTimeout(i.current),i.current=setTimeout(()=>r(!1),WE)},l=e=>{a.current?.contains(e.target)&&e.preventDefault()},u=UE(e.tokens,e.window),d=Math.max(0,Math.min(1,e.tokens/e.window)),f=`Context ${u}% full`,p=`${e.tokens.toLocaleString()} of ${e.window.toLocaleString()} tokens`;return(0,X.jsxs)(z,{open:n,onOpenChange:r,children:[(0,X.jsx)(Jt,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-context-meter":!0,"data-context-percent":u,"aria-label":`${f}\n${p}`,"aria-haspopup":`dialog`,"aria-expanded":n,onMouseEnter:s,onMouseLeave:c,onFocus:s,ref:a,onClick:e=>{e.stopPropagation(),s(),e.detail===0&&requestAnimationFrame(()=>o.current?.querySelector(`button:not(:disabled)`)?.focus())},className:`flex shrink-0 items-baseline gap-1 rounded-sm outline-none transition-colors hover:text-fg/85 focus-visible:ring-1 focus-visible:ring-focus-ink-60 ${n?`text-fg/85`:``}`,children:[(0,X.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:`-mt-[1em] h-[1.05em] w-[1.05em] shrink-0 self-baseline translate-y-[calc(0.525em_-_0.5cap)]`,"aria-hidden":!0,children:[(0,X.jsx)(`circle`,{cx:`8`,cy:`8`,r:VE,fill:`none`,stroke:`currentColor`,strokeOpacity:.3,strokeWidth:BE}),(0,X.jsx)(`circle`,{cx:`8`,cy:`8`,r:VE,fill:`none`,stroke:`currentColor`,strokeWidth:BE,strokeDasharray:`${HE*d} ${HE}`,transform:`rotate(-90 8 8)`})]}),(0,X.jsxs)(`span`,{children:[u,`% context`]})]})}),(0,X.jsxs)(Wa,{side:`bottom`,align:`start`,sideOffset:5,ref:o,"data-context-panel":!0,"aria-label":f,onInteractOutside:e=>l({target:e.detail.originalEvent.target,preventDefault:()=>e.preventDefault()}),onMouseEnter:s,onMouseLeave:c,onOpenAutoFocus:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),className:`flex w-max max-w-[min(22rem,calc(100vw-1.5rem))] flex-col gap-2 px-3 py-2 text-[11px] leading-relaxed text-fg`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:f}),(0,X.jsx)(`span`,{className:`text-muted`,children:p})]}),t?.(()=>r(!1))]})]})}function JE(e){return e.runtime===`running`||e.runtime===`spawning`||e.runtime===`perm-prompt`}var YE=new Map,XE=2*6e4;function ZE(e,t){let n=e.sessionId;if(!n)return!1;let r=YE.get(n);return r?!JE(e)&&(r.tokens!==t||e.lastActivityAt!==r.activity)||Date.now()-r.at>XE?(YE.delete(n),!1):!0:!1}function QE({thread:e,compacting:t,onRequested:n}){let[r,i]=(0,q.useState)(!1),a=e.context?.tokens??0,o=JE(e)&&!t;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-compact-now":!0,disabled:o||r||t||!e.sessionId,onClick:()=>{let t=e.sessionId;t&&(i(!0),W.compactThread({slug:e.id,sessionId:t}).then(()=>{YE.set(t,{tokens:a,activity:e.lastActivityAt,at:Date.now()}),K(`Compacting context`),n()}).catch(e=>K(`Couldn’t compact: ${e.message.slice(0,80)}`)).finally(()=>i(!1)))},onMouseDown:e=>e.preventDefault(),className:`flex items-center justify-center gap-1 rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] font-medium text-fg/80 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60 disabled:opacity-45 disabled:hover:bg-panel-2/60 disabled:hover:text-fg/80`,children:[(r||t)&&(0,X.jsx)(de,{size:12,className:`animate-spin`}),t?`Compacting…`:`Compact now`]}),o&&(0,X.jsx)(`span`,{className:`text-muted`,children:`Available once the current turn ends`})]})}function $E({thread:e}){let t=D(e.id);return(0,X.jsx)(eD,{"data-thread-header-facts":``,lead:t?(0,X.jsx)(tD,{slug:t}):null,lastActiveAt:Qa(e),fallbackAt:e.spawnedAt,reading:GE(e)?(0,X.jsx)(KE,{thread:e}):null})}function eD({lead:e,lastActiveAt:t,fallbackAt:n,reading:r,...i}){return(0,X.jsxs)(`div`,{...i,className:`mt-0.5 flex min-w-0 items-center gap-1.5 text-[11px] leading-tight text-muted-75 empty:hidden`,children:[e?(0,X.jsxs)(X.Fragment,{children:[e,(0,X.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-muted-45`,children:`·`})]}):null,(0,X.jsx)(gn,{at:t,fallbackAt:n,className:`min-w-0 truncate`}),r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`hidden shrink-0 text-muted-45 [time+&]:inline`,children:`·`}),r]}):null]})}function tD({slug:e}){let t=Fo({queryKey:[`projectsList`],queryFn:()=>W.projectsList()}).data?.find(t=>t.slug===e),n=t?.name??e,r=it(e);function i(e){e.stopPropagation(),Cn(e)&&(e.preventDefault(),Ta(r))}return(0,X.jsxs)(`a`,{href:r,"data-thread-project":e,title:`Open ${n}`,onClick:i,className:`flex min-w-0 shrink-0 items-center gap-1.5 rounded-sm font-medium text-fg/80 no-underline outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:[t?(0,X.jsx)(u,{project:t,size:14}):null,(0,X.jsx)(`span`,{className:`truncate`,children:n})]})}function nD({thread:e,hidden:t=!1}){let n=Ji({mutationFn:()=>W.aiRenameThread({slug:e.id}),onSuccess:({title:e})=>K(`Renamed to “${e}”`),onError:e=>K(e instanceof Error?e.message:`Could not rename with Claude`,{duration:7e3})}),r=kr(e);if(!r.show||t)return null;let i=n.isPending?`Claude is generating a title…`:n.error instanceof Error?n.error.message:r.label,a=n.isPending||!!n.error;return(0,X.jsx)(Bs,{label:i,children:(0,X.jsx)(`button`,{type:`button`,"data-ai-rename":!0,"aria-label":n.isPending?`Renaming with Claude`:r.label,"aria-busy":n.isPending,"aria-disabled":!r.enabled,onMouseDown:e=>e.preventDefault(),onClick:()=>{if(!n.isPending){if(!r.enabled){K(r.label);return}n.reset(),n.mutate()}},className:`title-refresh-offset -mx-[7px] -my-3 flex h-6 w-6 shrink-0 items-center justify-center rounded-md outline-none transition-[color,background-color,opacity] focus-visible:opacity-100 group-hover/thread-title:opacity-100 ${a?`opacity-100`:`opacity-0`} ${n.error?`text-danger hover:bg-danger-fill/10`:r.enabled?`text-muted hover:bg-hover-strong hover:text-fg`:`cursor-not-allowed text-muted-50 hover:bg-hover-strong`}`,children:n.isPending?(0,X.jsx)(de,{size:12,className:`animate-spin`}):(0,X.jsx)(il,{size:12})})})}function rD({thread:e,className:t=``}){let n=tt(e),{shown:r}=n;return(0,X.jsxs)(`div`,{className:`group/thread-title flex min-w-0 items-center gap-2`,children:[n.editing?(0,X.jsx)(`input`,{...n.editorProps,className:`min-w-0 flex-1 -mx-1.5 -my-px rounded-md border border-border bg-elevated px-1.5 py-0 font-semibold text-[15px] text-fg outline-none focus:border-accent ${t}`}):n.canRename?(0,X.jsx)(`button`,{type:`button`,title:`Edit title`,"aria-label":`Edit thread title: ${r}`,disabled:n.pending,onClick:n.start,className:`min-w-0 max-w-full shrink truncate rounded px-0.5 -mx-0.5 font-semibold text-[15px] text-left outline-none transition-colors hover:bg-panel-2 focus-visible:ring-1 focus-visible:ring-focus-ink-60 disabled:cursor-not-allowed disabled:opacity-40 ${t}`,children:r}):(0,X.jsx)(`div`,{className:`min-w-0 max-w-full shrink truncate px-0.5 -mx-0.5 font-semibold text-[15px] ${t}`,title:r,children:r}),(0,X.jsx)(nD,{thread:e,hidden:n.editing})]})}function iD(e){if(e.kind!==void 0||e.role!==`assistant`||e.text.trim())return;let t=e.parts??[],n=t.length>0?t.length===1&&t[0].kind===`tools`?t[0].tools:[]:e.tools??[],r=n.length===1?n[0]:void 0;return r?.agentCompletion?r:void 0}var aD={completed:`finished`,killed:`stopped`,failed:`failed`};function oD(e){let t=aD[e.agentStatus??`completed`],n=e.agentElapsedMs===void 0?void 0:yc(e.agentElapsedMs);return{outcome:t,tail:`${t}${n?` · ${n}`:``}`}}var sD=e=>e===void 0?void 0:tr(e),cD=e=>{if(e!==void 0)return yc(e)||void 0};function lD(e){let{agentStatus:t,agentElapsedMs:n,liveState:r,liveElapsedMs:i,status:a,durationMs:o}=e;if(t){let e=t===`killed`,r=t===`failed`,i=sD(n);return{label:t===`completed`?void 0:aD[t],duration:cD(n),tone:r?`failed`:`muted`,title:`${e?`Stopped`:r?`Failed`:`Ran for`}${e||r?` after`:``} ${i??`an unknown time`}`}}if(r){let e=sD(i);return{label:void 0,duration:cD(i),tone:`muted`,title:r===`running`?`Working for ${e??`an unknown time`}`:`Dispatched ${e??`an unknown time`} ago`}}if(a===`pending`||a!==`failed`&&a!==`cancelled`)return null;let s=a===`failed`,c=a===`cancelled`,l=sD(o);return{label:c?aD.killed:s?aD.failed:void 0,duration:cD(o),tone:s?`failed`:`muted`,title:`${c?`Stopped after`:s?`Failed after`:`Ran for`} ${l??`an unknown time`}`}}var uD=`group flex min-w-0 items-baseline gap-1.5 rounded-sm text-left text-[11.5px] outline-none focus-visible:ring-1 focus-visible:ring-focus-ink-60`,dD=`${dc} -mt-[1em] self-baseline`,fD=`h-[1em] w-[1em] shrink-0 translate-y-[calc(0.5em_-_0.5cap)] text-muted-45`,pD=`group flex min-w-0 items-baseline gap-2 ${Na} text-left outline-none transition-colors hover:bg-hover-strong focus-visible:bg-hover-strong`;function mD({links:e}){return(0,X.jsx)(`div`,{"data-thread-links":!0,"aria-label":`Registered links`,className:`flex min-w-0 flex-col`,children:e.map(e=>{let t=e.kind===`link`,n=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:Ot,children:(0,X.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,X.jsx)(t?Ic:Rt,{"aria-hidden":!0,className:`h-[1em] w-[1em] text-muted-60`})})}),(0,X.jsx)(`span`,{"data-link-label":!0,className:`min-w-0 shrink truncate text-fg/85 group-hover:text-fg`,children:e.label}),(0,X.jsx)(`span`,{"data-link-destination":!0,className:`font-mono-keep min-w-0 flex-1 truncate text-right text-[10.5px] text-muted-50`,children:t?e.target:e.target.split(`/`).pop()})]});return t?(0,X.jsx)(`a`,{"data-thread-link":e.id,href:e.target,target:`_blank`,rel:`noopener noreferrer`,title:e.target,className:pD,onClick:e=>e.stopPropagation(),children:n},e.id):(0,X.jsx)(`button`,{"data-thread-link":e.id,type:`button`,title:e.target,className:`${pD} cursor-pointer`,onClick:t=>{t.stopPropagation(),R(e.target)},...Ko(e.target),children:n},e.id)})})}function hD({links:e,panel:t=!1}){return e.length?t?(0,X.jsx)(mD,{links:e}):(0,X.jsx)(`div`,{"data-thread-links":!0,"aria-label":`Registered links`,className:`mt-2 flex min-w-0 flex-col gap-0.5 border-t border-border pt-1.5`,children:e.map(e=>{let t=e.kind===`link`,n=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:so,children:`⤷`}),(0,X.jsx)(`span`,{className:dD,children:(0,X.jsx)(t?Ic:Rt,{"aria-hidden":!0,className:fD})}),(0,X.jsx)(`span`,{"data-link-kind":!0,className:Rs,children:t?`Link`:`File`}),(0,X.jsx)(`span`,{"data-link-label":!0,className:`min-w-0 flex-1 truncate text-muted-70 group-hover:text-fg/80 group-hover:underline`,children:e.label}),t&&(0,X.jsx)(`span`,{"data-link-destination":!0,className:`font-mono-keep ml-auto -mb-[0.5em] max-w-[45%] min-w-0 truncate text-right text-[10px] text-muted-45`,children:e.target})]});return t?(0,X.jsx)(`a`,{"data-thread-link":e.id,href:e.target,target:`_blank`,rel:`noopener noreferrer`,title:e.target,className:uD,onClick:e=>e.stopPropagation(),children:n},e.id):(0,X.jsx)(`button`,{"data-thread-link":e.id,type:`button`,title:e.target,className:`${uD} cursor-pointer`,onClick:t=>{t.stopPropagation(),R(e.target)},...Ko(e.target),children:n},e.id)})}):null}var gD=`text-[14px] leading-5 text-muted`,_D=`size-[1em] shrink-0 self-baseline -mt-[calc(1em_-_1cap)] translate-y-[calc(0.5em_-_0.5cap)] text-muted-70 transition-transform group-hover:text-fg`;function vD(e){return`${_D} ${e?`-mx-[0.208em] rotate-90`:`-mx-[0.333em]`}`}var $=q.createElement;function yD({payload:e}){return e.kind===`command-approval`?$(q.Fragment,null,$(`div`,{className:`text-[12px] text-muted`},`Command`),$(`div`,{className:`mt-0.5 break-words text-[13px] font-medium text-fg`},e.command.summary),e.command.workingDirectoryLabel?$(`div`,{className:`mt-1 break-all text-[10.5px] text-muted-70`},`Working directory: `,e.command.workingDirectoryLabel):null,$(bD,{label:`Redacted command preview`,text:e.command.preview}),e.command.actions?$(xD,{actions:e.command.actions}):null,e.capabilities?$(CD,{capabilities:e.capabilities}):null):e.kind===`file-approval`?$(q.Fragment,null,$(`div`,{className:`text-[12px] text-muted`},DD(e.operation)),$(`div`,{className:`mt-0.5 break-all font-mono-keep text-[12px] text-fg`},e.pathLabel),e.destinationLabel?$(`div`,{className:`mt-1 break-all font-mono-keep text-[11px] text-muted`},`→ `,e.destinationLabel):null,e.grantRootLabel?$(`section`,{"aria-label":`Requested session write root`,className:`mt-2.5 min-w-0 rounded-md border border-attention/35 bg-attention-fill/[0.06] px-2.5 py-2`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-attention-soft-80`},`Requested session write root`),$(`div`,{className:`mt-1 min-w-0 break-all font-mono-keep text-[10.5px] text-fg/85`},e.grantRootLabel),e.scopeLabel?$(`div`,{className:`mt-1.5 whitespace-pre-wrap break-words text-[10.5px] leading-snug text-attention-soft-75`},e.scopeLabel):null):null,e.diffPreview?$(bD,{label:`Plain-text diff preview`,text:e.diffPreview}):null,e.changes?$(SD,{changes:e.changes}):null):$(q.Fragment,null,e.preview?$(`pre`,{className:`max-h-64 max-w-full min-w-0 overflow-auto rounded-md border border-border/70 bg-bg/40 px-2.5 py-2 whitespace-pre-wrap break-words font-mono-keep text-[11.5px] leading-relaxed text-fg/90`},e.promptLabel?$(`span`,{className:`text-shell/90`},e.promptLabel):null,e.promptLabel?$(`span`,{className:`text-accent`},` ❯ `):null,e.preview):null,e.resourceLabel?$(`div`,{className:`mt-1 break-all text-[11px] text-muted`},`Resource: `,e.resourceLabel):null,e.workingDirectoryLabel?$(`div`,{className:`mt-1.5 break-all text-[10.5px] text-muted-70`},`Working directory: `,e.workingDirectoryLabel):null,e.scopeLabel?$(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-[11px] leading-snug text-muted`},e.scopeLabel):null,e.capabilities?$(CD,{capabilities:e.capabilities}):null)}function bD({label:e,text:t}){return $(`details`,{className:`mt-2.5 min-w-0 rounded-md border border-border/70 bg-bg/35`,open:t.length<1200},$(`summary`,{className:`cursor-pointer px-2.5 py-2 text-[10.5px] text-muted outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-50`},e),$(`pre`,{className:`max-h-64 max-w-full min-w-0 overflow-auto border-t border-border/60 px-2.5 py-2 whitespace-pre-wrap break-words font-mono-keep text-[11px] leading-relaxed text-fg/80`},t))}function xD({actions:e}){return $(`section`,{"aria-label":`Parsed command actions`,className:`mt-3 min-w-0`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-muted-75`},`Parsed actions`),$(`ul`,{className:`mt-1.5 flex min-w-0 flex-col gap-2`},e.map((e,t)=>$(`li`,{key:t,className:`min-w-0 rounded-md border border-border/65 bg-bg/25 px-2.5 py-2`},$(`div`,{className:`text-[11px] font-medium text-fg/90`},ED(e.kind)),e.resourceLabel?$(`div`,{className:`mt-0.5 break-all font-mono-keep text-[10.5px] text-muted`},e.resourceLabel):null,e.queryLabel?$(`div`,{className:`mt-0.5 break-all text-[10.5px] text-muted`},`Query: `,e.queryLabel):null,$(bD,{label:`${ED(e.kind)} command detail`,text:e.commandPreview})))))}function SD({changes:e}){return $(`section`,{"aria-label":`Affected file changes`,className:`mt-3 min-w-0`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-muted-75`},`Affected changes`),$(`ol`,{className:`mt-1.5 flex min-w-0 flex-col gap-2`},e.map((e,t)=>$(`li`,{key:t,className:`min-w-0 rounded-md border border-border/65 bg-bg/25 px-2.5 py-2`},$(`div`,{className:`text-[11px] font-medium text-fg/90`},DD(e.operation)),$(`div`,{className:`mt-0.5 break-all font-mono-keep text-[10.5px] text-fg/80`},e.pathLabel),e.destinationLabel?$(`div`,{className:`mt-0.5 min-w-0 break-all font-mono-keep text-[10.5px] text-muted`},`→ `,e.destinationLabel):null,e.diffPreview?$(bD,{label:`${DD(e.operation)} plain-text diff`,text:e.diffPreview}):null))))}function CD({capabilities:e}){return $(`section`,{"aria-label":`Requested capabilities`,className:`mt-3 min-w-0`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-muted-75`},`Requested capabilities`),$(`ul`,{className:`mt-1.5 flex min-w-0 flex-col gap-2`},e.map((e,t)=>$(`li`,{key:t,className:`min-w-0 rounded-md border border-border/65 bg-bg/25 px-2.5 py-2`},$(wD,{capability:e})))))}function wD({capability:e}){if(e.kind===`network`){let t=e.enabled===!0?`Enable network access`:e.enabled===!1?`Disable network access`:`Network access request`;return $(q.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},t),e.hosts.length>0?$(TD,{label:`Hosts and protocols`,values:e.hosts}):null)}if(e.kind===`filesystem`){let t=e.access===`read`?`Read filesystem paths`:e.access===`write`?`Write filesystem paths`:`Deny filesystem paths`;return $(q.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},t),$(TD,{label:`Paths`,values:e.resources}))}return e.kind===`glob-scan`?$(q.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},`Filesystem glob scanning`),$(`div`,{className:`mt-0.5 text-[10.5px] text-muted`},`Maximum depth: `,String(e.depth))):e.kind===`exec-policy`?$(q.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},`Future command policy amendment`),$(TD,{label:`Command prefix tokens`,values:e.prefixes})):$(q.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},e.access===`allow`?`Allow future network hosts`:`Deny future network hosts`),$(TD,{label:`Hosts`,values:e.hosts}))}function TD({label:e,values:t}){return $(`div`,{className:`mt-1 min-w-0`},$(`div`,{className:`sr-only`},e),$(`ul`,{"aria-label":e,className:`flex min-w-0 flex-col gap-0.5`},t.map((e,t)=>$(`li`,{key:t,className:`min-w-0 break-all font-mono-keep text-[10.5px] text-muted`},e))))}function ED(e){switch(e){case`read`:return`Read a file`;case`list-files`:return`List files`;case`search`:return`Search files`;case`unknown`:return`Unclassified command`}}function DD(e){switch(e){case`read`:return`Read file`;case`create`:return`Create file`;case`write`:return`Modify file`;case`move`:return`Move file`;case`delete`:return`Delete file`;case`execute`:return`Execute file`;case`other`:return`File operation`}}function OD(e){return e===`sending`?{actionsEnabled:!1,status:`Sending to runtime…`}:e===`reconnect-required`?{actionsEnabled:!1,status:`Runtime reconnect required before this request can be answered.`}:{actionsEnabled:!0}}var kD={semantic:`approve`,label:`Approve once`,order:10,tone:`primary`,durable:!1,scope:`Applies only to this request.`},AD={semantic:`approve`,label:`Approve for session`,order:20,tone:`primary`,durable:!0,scope:`Persists for later matching requests in this thread session.`},jD={semantic:`approve`,label:`Grant for turn`,order:10,tone:`primary`,durable:!1,scope:`Applies to this turn only.`},MD={semantic:`approve`,label:`Grant for session`,order:20,tone:`primary`,durable:!0,scope:`Persists until this thread session ends.`},ND={semantic:`deny`,label:`Deny`,order:70,tone:`danger`,durable:!1,scope:`Rejects this request.`},PD={semantic:`decline`,label:`Decline`,order:70,tone:`danger`,durable:!1,scope:`Declines this request.`},FD={semantic:`cancel`,label:`Cancel request`,order:80,tone:`neutral`,durable:!1,scope:`Cancels this pending request.`};function ID(e,t){let{id:n,semantic:r}=t;if(e.kind===`command-approval`||e.kind===`file-approval`)return(n===`accept`||n===`approve-once`)&&r===`approve`?kD:n===`acceptForSession`&&r===`approve`?AD:(n===`decline`||n===`deny`)&&r===`deny`?ND:n===`cancel`&&r===`cancel`?FD:void 0;if(e.kind===`permission-approval`)return n===`grant-turn`&&r===`approve`?jD:n===`grant-session`&&r===`approve`?MD:(n===`deny`||n===`decline`)&&r===`deny`?ND:n===`cancel`&&r===`cancel`?FD:void 0;if(e.kind===`mcp-elicitation-form`||e.kind===`mcp-elicitation-url`)return n===`accept`&&r===`accept`?{semantic:`accept`,label:e.kind===`mcp-elicitation-form`?`Submit`:`Continue`,order:10,tone:`primary`,durable:!1,scope:`Applies only to this request.`}:n===`decline`&&r===`decline`?PD:n===`cancel`&&r===`cancel`?FD:void 0;if(n===`answer`&&r===`answer`)return{semantic:`answer`,label:`Send answer`,order:10,tone:`primary`,durable:!1,scope:`Sends these answers to this request only.`};if(n===`decline`&&r===`decline`)return PD;if(n===`cancel`&&r===`cancel`)return FD}function LD(e){let t=t=>e.payload.kind===`mcp-elicitation-form`&&t===`accept`||e.payload.kind===`agent-question`&&t===`answer`;return e.allowedDecisions.flatMap(n=>{let r=ID(e.payload,n);return r?[{...r,id:n.id,semantic:n.semantic,requiresValues:t(n.semantic)}]:[]}).sort((e,t)=>e.order-t.order||e.id.localeCompare(t.id))}function RD(e){switch(e){case`claude`:return`Claude`;case`codex`:return`Codex`;case`acp`:return`ACP agent`;case`opencode`:return`OpenCode`;case`antigravity`:return`Antigravity`;case`frizz`:return`Frizz`}}function zD(e){switch(e){case`runtime`:return`Runtime`;case`agent`:return`Agent`;case`tool`:return`Tool`;case`mcp-server`:return`MCP server`;case`frizz`:return`Frizz`}}function BD(e,t){let n=e.options.findIndex(e=>JSON.stringify(e.value)===JSON.stringify(t));return n<0?``:String(n)}function VD(e){let t=Object.create(null);for(let n of e)if(n.input===`text`||n.input===`multiline`)t[n.id]=n.default??``;else if(n.input===`number`||n.input===`integer`)t[n.id]=n.default===void 0?``:String(n.default);else if(n.input===`boolean`)t[n.id]=n.default??!1;else if(n.input===`select`)t[n.id]=n.default===void 0?``:BD(n,n.default);else if(n.input===`multi-select`){let e=new Set(n.default??[]);t[n.id]=n.options.flatMap((t,n)=>e.has(t.value)?[String(n)]:[])}return t}function HD(e,t,n){let r=Object.create(null);for(let t of Object.keys(e))r[t]=e[t];return r[t]=n,r}function UD(e,t){if(e.some(e=>e.secret))return{errors:{},formError:`Secret responses cannot be sent through this Frizz connection.`};let n=Object.create(null),r={};for(let i of e){let e=t[i.id],a;if(i.input===`text`||i.input===`multiline`){let t=typeof e==`string`?e:``;if(!i.required&&t===``)continue;i.required&&t===``?r[i.id]=`This field is required.`:a=t}else if(i.input===`number`||i.input===`integer`){let t=typeof e==`string`?e.trim():``;if(!i.required&&t===``)continue;if(t===``)r[i.id]=`This field is required.`;else{let e=Number(t);Number.isFinite(e)?a=e:r[i.id]=`Enter a valid number.`}}else if(i.input===`boolean`)a=e===!0;else if(i.input===`select`){let t=typeof e==`string`&&/^\d+$/.test(e)?Number(e):-1;if(t<0||t>=i.options.length)if(i.required)r[i.id]=`Choose an option.`;else continue;else a=i.options[t].value}else if(i.input===`multi-select`){let t=(Array.isArray(e)?e:[]).flatMap(e=>/^\d+$/.test(e)?[Number(e)]:[]);if(t.some(e=>e<0||e>=i.options.length))r[i.id]=`Choose only advertised options.`;else if(i.required&&t.length===0)r[i.id]=`Choose at least one option.`;else if(t.length>0)a=t.map(e=>i.options[e].value);else continue}if(a!==void 0&&!r[i.id]){let e=bi(i,a);e?r[i.id]=`Value ${e}.`:n[i.id]=a}}if(Object.keys(r).length>0)return{errors:r};let i=Eo.safeParse(n);return i.success?{errors:r,values:i.data}:{errors:r,formError:`The response is too large or contains invalid values.`}}function WD(e,t){return JSON.stringify([e,t??null])}function GD(e,t){let n=e??t;if(!n)return null;let r=e&&(e.input===`select`||e.input===`multi-select`)?e.options:[];return{question:{kind:e?.input===`multi-select`?`multi`:`question`,danger:!1,contextMd:n.description??n.label,options:r.map((e,t)=>`${Xe(t)} ${e.label}`),recommendedIdxs:[]},...e?{optionFieldId:e.id}:{},optionValues:r.map(e=>e.value),...t?{notesFieldId:t.id}:{}}}function KD(e){if(e.payload.kind!==`agent-question`)return null;let t=e.payload.fields,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.secret)return null;if(r.id.endsWith(`_notes`))continue;let i=t[e+1],a=i&&i.id===`${r.id}_notes`?i:void 0;if(r.input===`select`||r.input===`multi-select`){let e=GD(r,a);if(!e)return null;n.push(e)}else if(r.input===`text`||r.input===`multiline`){let e=GD(void 0,r);if(!e)return null;n.push(e)}else return null}return n.length>0?n:null}function qD(e,t){let n=[],r;if(t){let i=e.multiSelect?t.split(`, `):[t];e.options.forEach((e,t)=>{i.includes(e.label)&&n.push(t)}),n.length===0&&(r=t)}return{question:{kind:e.multiSelect?`multi`:`question`,danger:!1,contextMd:e.question,options:e.options.map((e,t)=>`${Xe(t)} ${e.label}${e.description?` — ${e.description}`:``}`),recommendedIdxs:[]},chosenIdxs:n,text:r}}function JD(e,t){let n={};return e.forEach((e,r)=>{let i=t[r];if(!i)return;let a=i.text.trim();if(e.question.kind===`multi`){let t=(i.chosenSet??[]).slice().sort((e,t)=>e-t).flatMap(t=>{let n=e.optionValues[t];return n===void 0?[]:[n]});e.optionFieldId&&t.length>0&&(n[e.optionFieldId]=t),e.notesFieldId&&a&&(n[e.notesFieldId]=a);return}let o=i.chosen;if(e.optionFieldId&&o!==null&&e.optionValues[o]!==void 0){n[e.optionFieldId]=e.optionValues[o];return}a&&e.notesFieldId&&(n[e.notesFieldId]=a)}),Object.keys(n).length>0?n:void 0}function YD(e){let t=e instanceof Error?e.message:`The request could not be updated.`;return t.length>240?`${t.slice(0,239)}…`:t}function XD(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`frizz-response-${Date.now()}-${Math.random().toString(36).slice(2)}`}function ZD({thread:e,className:t=``,autoFocusFirst:n=!1}){let r=cc(e),i=Ut(e),a=(0,q.useMemo)(()=>[...i.data?.interactions??[]].sort((e,t)=>e.createdAt.localeCompare(t.createdAt)||e.id.localeCompare(t.id)),[i.data?.interactions]);return r?i.isError&&a.length===0?(0,X.jsxs)(`div`,{"data-interactions-error":!0,role:`alert`,className:`${Um} border border-attention-fill/35 bg-attention-fill/[0.07] p-4 text-[12px] text-attention-soft ${t}`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:`Pending requests could not be loaded.`}),(0,X.jsx)(`div`,{className:`mt-1 break-words text-attention-soft-75`,children:YD(i.error)}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>void i.refetch(),className:`mt-2 rounded-md border border-attention/40 px-2 py-1 text-[11px] hover:bg-attention-fill/10`,children:`Try again`})]}):a.length===0?null:(0,X.jsx)(`section`,{"data-typed-interactions":!0,"aria-label":`${a.length} pending request${a.length===1?``:`s`}`,className:`flex min-w-0 flex-col gap-3 ${t}`,children:a.map((e,t)=>(0,X.jsx)($D,{record:e,autoFocus:n&&t===0,siblings:a},e.id))}):null}function QD({record:e,questions:t,autoFocus:n,siblings:i}){let a=oo(),o=ui(),s=rO(e,i),c=(0,q.useRef)(null),l=(0,q.useRef)(new Map),u=As(),d=OD(e.delivery?.effect),f=(0,q.useMemo)(()=>LD(e).find(e=>e.semantic===`answer`),[e]),p=$a(t.flatMap(t=>t.notesFieldId?[H.interaction(u,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId)]:[])),[m,h]=(0,q.useState)(()=>t.map(()=>({chosen:null,chosenSet:[]}))),g=t.map((t,n)=>({chosen:m[n]?.chosen??null,chosenSet:m[n]?.chosenSet??[],text:t.notesFieldId?p.get(H.interaction(u,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId))??``:``})),_=JD(t,g),[v,y]=(0,q.useState)(),[b,x]=(0,q.useState)(!1);(0,q.useEffect)(()=>{if(!n)return;let e=document.activeElement;e&&e!==document.body||requestAnimationFrame(()=>c.current?.focus())},[n,e.id]);let S=Ji({mutationFn:async t=>W.interactionResolve({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id,sessionEpoch:e.owner.sessionEpoch,capabilityRevision:e.owner.capabilityRevision,expectedRecordRevision:e.recordRevision,responseId:t.responseId,decisionId:t.decisionId,values:t.values}),onSuccess:t=>{x(!0),Bi(a,t.interaction),a.invalidateQueries({queryKey:r(e.owner.threadSlug,e.owner.sessionId)}),a.invalidateQueries({queryKey:cn(e.owner.threadSlug,e.owner.sessionId,e.id)})},onError:t=>{Pr(a,e),s.rollback(),y(YD(t)),W.interactionGet({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id}).then(({interaction:t})=>{Bi(a,t),a.setQueryData(cn(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t}),a.invalidateQueries({queryKey:r(e.owner.threadSlug,e.owner.sessionId),exact:!0})}).catch(()=>{})}}),C=()=>{if(!f||!_||S.isPending||b||!d.actionsEnabled)return;y(void 0);let e=WD(f.id,_),t=l.current.get(e)??XD();l.current.set(e,t),s.release(!0),S.mutate({decisionId:f.id,values:_,responseId:t})},w=(t,n)=>{t.notesFieldId&&G.set(H.interaction(u,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId),n)};return(0,X.jsxs)(`article`,{ref:c,tabIndex:-1,"data-interaction-id":e.id,"data-interaction-kind":e.payload.kind,"data-interaction-question":`native`,"data-delivery-effect":e.delivery?.effect,className:`flex min-w-0 flex-col gap-2 outline-none`,children:[t.map((e,t)=>(0,X.jsx)(eC,{question:e.question,interactive:d.actionsEnabled&&!b?{answer:g[t],onChip:n=>{h(r=>r.map((r,i)=>{if(i!==t)return r;if(e.question.kind===`multi`){let e=r.chosenSet.includes(n)?r.chosenSet.filter(e=>e!==n):[...r.chosenSet,n];return{...r,chosenSet:e}}return{...r,chosen:r.chosen===n?null:n}}))},onText:n=>{w(e,n),e.question.kind!==`multi`&&h(e=>e[t]?.chosen===null||e[t]===void 0?e:e.map((e,n)=>n===t?{...e,chosen:null}:e))},onSubmit:C}:void 0},e.optionFieldId??e.notesFieldId??t)),v&&(0,X.jsx)(`div`,{role:`alert`,className:`break-words text-[11px] leading-snug text-danger-soft`,children:v}),(d.status||S.isPending||b)&&(0,X.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-[11px] leading-snug text-muted`,children:d.status??(b?`Answer sent.`:`Sending…`)}),o&&(0,X.jsxs)(Is,{className:`text-[12px] text-muted`,children:[`This has to be answered on `,o,`.`]}),d.actionsEnabled&&!b&&!o&&(0,X.jsx)(`div`,{className:`flex justify-start`,children:(0,X.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:!_||S.isPending,onClick:C,onMouseDown:e=>e.preventDefault(),className:`button-outline rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-all hover:opacity-90 active:scale-95 disabled:opacity-30 disabled:hover:opacity-30`,children:`Send answers`})})]})}function $D({record:e,autoFocus:t=!1,siblings:n}){let r=(0,q.useMemo)(()=>KD(e),[e]),i=n??[e];return r?(0,X.jsx)(QD,{record:e,questions:r,autoFocus:t,siblings:i}):(0,X.jsx)(iO,{record:e,autoFocus:t,siblings:i})}function eO(e){return e.semantic!==`cancel`}var tO=new Set,nO=new Set;function rO(e,t){let n=(0,q.useContext)(Z_),r=e.owner.threadSlug;return{release:i=>{tO.add(e.id),i&&t.every(t=>t.id===e.id||tO.has(t.id)||t.delivery?.effect===`sending`)&&(nO.add(r),$r(r),(n?.sent??n?.dismiss)?.())},rollback:()=>{tO.delete(e.id),nO.delete(r)&&(Xo(r),n?.cancel())}}}function iO({record:e,autoFocus:t=!1,siblings:n}){let i=oo(),a=ui(),o=rO(e,n),s=(0,q.useId)(),l=(0,q.useRef)(null),u=(0,q.useRef)(new Map),d=e.payload.kind===`mcp-elicitation-form`||e.payload.kind===`agent-question`?e.payload.fields:[],f=d.some(e=>e.secret),p=As(),m=d.filter(e=>!e.secret&&(e.input===`text`||e.input===`multiline`)).map(t=>H.interaction(p,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.id)),h=$a(m),[g,_]=(0,q.useState)(()=>VD(d)),v=(0,q.useMemo)(()=>{let t={...g};return d.forEach(n=>{if(!n.secret&&(n.input===`text`||n.input===`multiline`)){let r=H.interaction(p,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,n.id);t[n.id]=h.get(r)??``}}),t},[d,g,h,p,e.id,e.owner]),[y,b]=(0,q.useState)({}),[x,S]=(0,q.useState)(),[C,w]=(0,q.useState)(),[T,E]=(0,q.useState)(!1),[D,O]=(0,q.useState)(),[k,A]=(0,q.useState)(!1),j=OD(e.delivery?.effect),M=(0,q.useMemo)(()=>LD(e),[e]).filter(e=>!(f&&e.requiresValues)),N=e.allowedDecisions.length-M.length,P=(0,q.useCallback)(t=>{for(let n of d)if(!n.secret&&(n.input===`text`||n.input===`multiline`)){let r=t[n.id];typeof r==`string`&&G.set(H.interaction(p,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,n.id),r)}_(t)},[d,p,e.id,e.owner]);(0,q.useEffect)(()=>{if(!t)return;let e=document.activeElement;e&&e!==document.body||requestAnimationFrame(()=>l.current?.focus())},[t,e.id]),(0,q.useEffect)(()=>{j.actionsEnabled||(O(void 0),A(!1))},[j.actionsEnabled]);let F=Ji({mutationFn:async({decision:t,values:n,responseId:r})=>{if(t.semantic===`cancel`&&e.provider.kind===`frizz`){let t=await W.interactionCancel({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id,sessionEpoch:e.owner.sessionEpoch,capabilityRevision:e.owner.capabilityRevision,expectedRecordRevision:e.recordRevision});return{effect:t.effect,interaction:t.interaction,waitingForProvider:!1}}let i=await W.interactionResolve({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id,sessionEpoch:e.owner.sessionEpoch,capabilityRevision:e.owner.capabilityRevision,expectedRecordRevision:e.recordRevision,responseId:r,decisionId:t.id,...n===void 0?{}:{values:n}});return{effect:i.effect,interaction:i.interaction,waitingForProvider:i.interaction.delivery?.effect===`sending`||i.effect===`queued`||i.effect===`already-queued`}},onSuccess:(t,n)=>{t.waitingForProvider||u.current.delete(WD(n.decision.id,n.values)),S(void 0),O(void 0),A(!1),E(!0),m.forEach(e=>G.clear(e)),w(t.waitingForProvider?`Response sent. Waiting for the provider to acknowledge it…`:`Request completed.`),Bi(i,t.interaction),i.setQueryData(cn(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t.interaction}),i.invalidateQueries({queryKey:r(e.owner.threadSlug,e.owner.sessionId),exact:!0}),t.waitingForProvider&&window.setTimeout(()=>{i.invalidateQueries({queryKey:r(e.owner.threadSlug,e.owner.sessionId),exact:!0})},1e3)},onError:t=>{w(void 0),o.rollback(),S(YD(t)),Pr(i,e),W.interactionGet({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id}).then(({interaction:t})=>{Bi(i,t),i.setQueryData(cn(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t}),t.delivery?.effect===`sending`?(S(void 0),w(void 0),E(!0)):t.delivery?.effect===`reconnect-required`?(S(void 0),w(void 0)):(t.lifecycle!==`pending`||t.recordRevision!==e.recordRevision)&&(S(void 0),w(t.lifecycle===`expired`?`This request expired.`:`This request changed in another client.`),i.invalidateQueries({queryKey:r(e.owner.threadSlug,e.owner.sessionId),exact:!0})),i.invalidateQueries({queryKey:r(e.owner.threadSlug,e.owner.sessionId),exact:!0})}).catch(()=>{})}});function I(e){if(!e.requiresValues){b({});return}let t=UD(d,v);return b(t.errors),t.formError?(S(t.formError),null):t.values?t.values:null}function L(e,t=!1){if(!j.actionsEnabled||F.isPending||T)return;S(void 0);let n=I(e);if(n===null)return;if(e.durable&&!t){O(e),A(!1);return}let r=WD(e.id,n),i=u.current.get(r)??XD();u.current.set(r,i),o.release(eO(e)),F.mutate({decision:e,values:n,responseId:i})}let R=M.find(e=>e.requiresValues&&e.tone===`primary`);function ee(e){e.preventDefault(),j.actionsEnabled&&R&&L(R)}return(0,X.jsxs)(`article`,{ref:l,tabIndex:-1,"aria-labelledby":s,"data-interaction-id":e.id,"data-interaction-kind":e.payload.kind,"data-delivery-effect":e.delivery?.effect,className:`min-w-0 ${Um} border border-question-border bg-question outline-none focus-visible:ring-2 focus-visible:ring-focus-accent-60`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 border-b border-question-border px-4 py-3`,children:[(0,X.jsx)(al,{"aria-hidden":`true`,size:16,className:`shrink-0 text-accent`}),(0,X.jsx)(`h3`,{id:s,className:`min-w-0 flex-1 break-words text-[14px] font-semibold leading-snug text-fg`,children:e.payload.title})]}),(0,X.jsx)(`form`,{onSubmit:ee,onKeyDown:e=>{e.target instanceof HTMLButtonElement||c({key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.nativeEvent.keyCode})&&(e.preventDefault(),j.actionsEnabled&&R&&L(R))},className:`min-w-0 px-4 py-3.5`,noValidate:!0,children:(0,X.jsxs)(`fieldset`,{disabled:!j.actionsEnabled,className:`min-w-0 border-0 p-0`,children:[(0,X.jsx)(`legend`,{className:`sr-only`,children:`Interaction request`}),(0,X.jsx)(oO,{record:e,instanceId:s,draft:v,setDraft:P,errors:y,autoFocus:t}),f&&(0,X.jsxs)(`div`,{"data-secret-fallback":!0,className:`mt-3 rounded-md border border-attention-fill/35 bg-attention-fill/[0.07] p-3 text-[12px] leading-snug text-attention-soft-90`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(Uc,{"aria-hidden":`true`,size:14,className:`mt-0.5 shrink-0`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`font-medium`,children:`Secret input is unavailable in this page.`}),(0,X.jsx)(`div`,{className:`mt-1 text-attention-soft-70`,children:`Frizz will not persist or send secret values through the current RPC.`})]})]}),(0,X.jsx)(`div`,{className:`mt-2 font-medium`,children:`Use the provider's trusted secret-input flow. The thread terminal cannot answer this typed request.`})]}),N>0&&(0,X.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-md border border-attention-fill/25 bg-attention-fill/[0.05] px-3 py-2 text-[11px] leading-snug text-attention-soft-75`,children:[(0,X.jsx)(fc,{"aria-hidden":`true`,size:13,className:`mt-0.5 shrink-0`}),(0,X.jsxs)(`span`,{children:[N===1?`One advertised choice`:`${N} advertised choices`,` cannot be safely labeled or delivered in Frizz and is not shown.`]})]}),D&&(0,X.jsxs)(`div`,{"data-durable-confirmation":!0,role:`group`,"aria-label":`Confirm ${D.label}`,className:`mt-3 rounded-md border border-attention/45 bg-attention-fill/[0.08] p-3`,children:[(0,X.jsx)(`div`,{className:`text-[12px] font-semibold text-attention-soft`,children:`This approval persists beyond the current request.`}),(0,X.jsx)(`div`,{className:`mt-1 text-[11px] leading-snug text-attention-soft-75`,children:D.scope}),(0,X.jsxs)(`label`,{className:`mt-2.5 flex cursor-pointer items-start gap-2 text-[11px] leading-snug text-fg/85`,children:[(0,X.jsx)(`input`,{type:`checkbox`,autoFocus:!0,checked:k,onChange:e=>A(e.target.checked),className:`mt-0.5 accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:`I understand this may authorize later matching actions in this session.`})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-start gap-2`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>{O(void 0),A(!1)},className:`rounded-md border border-border px-2.5 py-1.5 text-[11px] text-muted hover:bg-panel-2 hover:text-fg`,children:`Back`}),(0,X.jsxs)(`button`,{type:`button`,disabled:!k||F.isPending,onClick:()=>L(D,!0),className:`rounded-md border border-attention/50 bg-attention-fill/15 px-2.5 py-1.5 text-[11px] font-semibold text-attention-faint hover:bg-attention-fill/25 disabled:opacity-35`,children:[`Confirm `,D.label.toLowerCase()]})]})]}),x&&(0,X.jsx)(`div`,{role:`alert`,className:`mt-3 break-words text-[11px] leading-snug text-danger-soft`,children:x}),(j.status??C)&&(0,X.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`mt-3 text-[11px] leading-snug text-muted`,children:j.status??C}),a&&(0,X.jsxs)(Is,{className:`mt-3 text-[12px] text-muted`,children:[`This has to be answered on `,a,`.`]}),j.actionsEnabled&&!D&&!T&&M.length>0&&!a&&(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-start gap-2`,children:[M.map(e=>(0,X.jsxs)(`button`,{type:e===R?`submit`:`button`,"data-interaction-decision":e.id,disabled:F.isPending,"aria-describedby":e.durable?`${s}-scope-${e.id}`:void 0,onClick:e===R?void 0:()=>L(e),className:aO(e),children:[F.isPending?`Sending…`:e.label,e.durable&&(0,X.jsx)(`span`,{className:`sr-only`,children:`; persistent approval`})]},e.id)),M.filter(e=>e.durable).map(e=>(0,X.jsx)(`span`,{id:`${s}-scope-${e.id}`,className:`sr-only`,children:e.scope},`scope-${e.id}`))]}),!sO.has(e.payload.kind)&&(0,X.jsx)(uO,{record:e})]})})]})}function aO(e){let t=`rounded-md border px-2.5 py-1.5 text-[11px] font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-focus-ink-50 disabled:opacity-40`;return e.tone===`primary`?`${t} border-border-strong bg-panel-2 text-fg hover:bg-inset`:e.tone===`danger`?`${t} border-danger/35 bg-danger-fill/[0.07] text-danger-faint hover:bg-danger-fill/15`:`${t} border-border bg-panel text-muted hover:bg-panel-2 hover:text-fg`}function oO({record:e,instanceId:t,draft:n,setDraft:r,errors:i,autoFocus:a}){let o=e.payload,s=(e,t)=>r(HD(n,e,t)),c;return c=o.kind===`command-approval`||o.kind===`file-approval`||o.kind===`permission-approval`?(0,X.jsx)(yD,{payload:o}):o.kind===`mcp-elicitation-url`?(0,X.jsx)(lO,{url:o.url}):(0,X.jsx)(dO,{instanceId:t,fields:o.fields,draft:n,setValue:s,errors:i,autoFocus:a}),(0,X.jsxs)(X.Fragment,{children:[`message`in o&&o.message&&(0,X.jsx)(cO,{text:o.message}),(0,X.jsx)(`div`,{className:`message`in o&&o.message?`mt-3`:``,children:c})]})}var sO=new Set([`command-approval`,`file-approval`,`permission-approval`]);function cO({text:e}){return e.length>600||e.split(`
|
|
131
|
+
`).length>6?(0,X.jsxs)(`details`,{className:`rounded-md border border-border/70 bg-panel/60`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer px-2.5 py-2 text-[11px] text-muted outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-50`,children:`Request message`}),(0,X.jsx)(`div`,{className:`max-h-52 overflow-auto border-t border-border/60 px-2.5 py-2 whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})]}):(0,X.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})}function lO({url:e}){let t=Ra(e,location.href);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-[11px] font-medium text-fg`,children:`Open this page to continue`}),(0,X.jsx)(`code`,{className:`mt-1.5 block max-h-24 overflow-auto break-all rounded-md border border-border bg-bg/40 px-2.5 py-2 font-mono-keep text-[10.5px] text-fg/80`,children:e}),t?(0,X.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-border bg-panel px-2.5 py-1.5 text-[11px] font-medium text-fg hover:bg-panel-2`,children:[(0,X.jsx)(Ic,{"aria-hidden":`true`,size:12}),`Open page`]}):(0,X.jsx)(`div`,{role:`alert`,className:`mt-1.5 break-words text-[11px] text-danger-soft`,children:`This request did not provide a safe http(s) URL.`})]})}function uO({record:e}){return(0,X.jsxs)(`details`,{className:`mt-3 border-t border-border/50 pt-2 text-[10.5px] text-muted-70`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer w-fit outline-none hover:text-muted focus-visible:ring-1 focus-visible:ring-focus-ink-50`,children:`Request details`}),(0,X.jsxs)(`dl`,{className:`mt-2 grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:[(0,X.jsx)(`dt`,{children:`Provider`}),(0,X.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:RD(e.provider.kind)}),e.provider.name&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{children:`Reported name`}),(0,X.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.name})]}),e.provider.version&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{children:`Reported version`}),(0,X.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.version})]}),(0,X.jsx)(`dt`,{children:`Source`}),(0,X.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:zD(e.source.kind)}),e.source.label&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{children:`Reported source`}),(0,X.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.source.label})]}),(0,X.jsx)(`dt`,{children:`Scope`}),(0,X.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:`This thread · this request`}),e.expiresAt&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{children:`Expires`}),(0,X.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.expiresAt})]})]})]})}function dO({instanceId:e,fields:t,draft:n,setValue:r,errors:i,autoFocus:a}){let o=t.findIndex(e=>!e.secret);return(0,X.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,X.jsx)(`legend`,{className:`sr-only`,children:`Requested information`}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:t.map((t,s)=>(0,X.jsx)(fO,{instanceId:e,field:t,value:n[t.id],setValue:e=>r(t.id,e),error:i[t.id],autoFocus:a&&s===o},t.id))})]})}function fO({instanceId:e,field:t,value:n,setValue:r,error:i,autoFocus:a}){let o=`${e}-${t.id}`,s=t.description?`${o}-description`:void 0,c=i?`${o}-error`:void 0,l=[s,c].filter(Boolean).join(` `)||void 0,u=(0,X.jsxs)(X.Fragment,{children:[t.label,t.required&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`ml-0.5 text-accent`,children:`*`})]}),d=`mt-1 w-full min-w-0 rounded-md border border-border bg-bg/45 px-2.5 py-2 text-[12px] text-fg outline-none focus:border-accent focus:ring-1 focus:ring-focus-accent-40`,f;if(t.secret)f=(0,X.jsx)(`div`,{className:`mt-1 text-[11px] text-attention-soft-70`,children:`Use the secure fallback below.`});else if(t.input===`multiline`)f=(0,X.jsx)(`textarea`,{id:o,name:t.id,"data-1p-ignore":!0,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,rows:4,className:`${d} resize-y`});else if(t.input===`text`){let e=t.format===`email`?`email`:t.format===`uri`?`url`:t.format===`date`?`date`:`text`;f=(0,X.jsx)(`input`,{id:o,name:t.id,type:e,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,placeholder:t.format===`date-time`?`2026-07-13T12:00:00Z`:void 0,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d})}else if(t.input===`number`||t.input===`integer`)f=(0,X.jsx)(`input`,{id:o,name:t.id,type:`number`,step:t.input===`integer`?1:`any`,min:t.minimum,max:t.maximum,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d});else if(t.input===`boolean`)f=(0,X.jsxs)(`label`,{htmlFor:o,className:`mt-1 flex cursor-pointer items-center gap-2 rounded-md border border-border bg-bg/30 px-2.5 py-2 text-[12px] text-fg/85`,children:[(0,X.jsx)(`input`,{id:o,name:t.id,type:`checkbox`,checked:n===!0,onChange:e=>r(e.target.checked),"aria-describedby":l,autoFocus:a,className:`accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:u})]});else if(t.input===`select`)f=(0,X.jsxs)(`select`,{id:o,name:t.id,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d,children:[(0,X.jsx)(`option`,{value:``,children:`Choose an option…`}),t.options.map((e,t)=>(0,X.jsx)(`option`,{value:String(t),children:e.label},t))]});else if(t.input===`multi-select`){let e=Array.isArray(n)?n:[];f=(0,X.jsxs)(`fieldset`,{id:o,"aria-describedby":l,className:`mt-1 rounded-md border border-border bg-bg/30 px-2.5 py-2`,children:[(0,X.jsx)(`legend`,{className:`px-1 text-[11px] font-medium text-fg/85`,children:u}),(0,X.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.options.map((n,i)=>{let o=String(i);return(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-[12px] text-fg/85`,children:[(0,X.jsx)(`input`,{type:`checkbox`,name:t.id,value:o,checked:e.includes(o),onChange:t=>r(t.target.checked?[...e,o]:e.filter(e=>e!==o)),autoFocus:a&&i===0,className:`mt-0.5 accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:n.label})]},o)})})]})}return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[t.secret?(0,X.jsx)(`div`,{className:`text-[11px] font-medium text-fg/85`,children:u}):t.input!==`boolean`&&t.input!==`multi-select`?(0,X.jsx)(`label`,{htmlFor:o,className:`block text-[11px] font-medium text-fg/85`,children:u}):null,t.description&&(0,X.jsx)(`div`,{id:s,className:`mt-0.5 whitespace-pre-wrap break-words text-[10.5px] leading-snug text-muted`,children:t.description}),f,i&&(0,X.jsx)(`div`,{id:c,role:`alert`,className:`mt-1 text-[10.5px] text-danger-soft`,children:i})]})}function pO(e,t=Date.now()){return e!==void 0&&na(e,t)!==void 0}function mO(){let[e,t]=(0,q.useState)(()=>Date.now());return(0,q.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function hO({thread:e}){let t=mO(),[n,r]=(0,q.useState)(!1),i=na(e,t);if(!i)return null;let a=Date.parse(i),o=Mo(i,t).replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()),s=e.snoozePrompt?.trim();async function c(){r(!0);try{await W.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:null,prompt:null}),K(`Snooze cleared`)}catch(e){K((e instanceof Error?e.message:`Wake failed`).slice(0,100))}finally{r(!1)}}return(0,X.jsxs)(nh,{"data-snooze-card":!0,icon:nt,label:`Snoozed`,children:[(0,X.jsx)(`div`,{"data-snooze-countdown":!0,title:new Date(a).toLocaleString(),className:`text-[22px] font-semibold leading-8 tracking-tight text-fg tabular-nums`,children:yn(a-t)}),(0,X.jsx)(`p`,{className:rh,children:s?(0,X.jsxs)(X.Fragment,{children:[`Resumes `,o,` and sends: “`,Ps(s),`”`]}):(0,X.jsxs)(X.Fragment,{children:[`Returns to the queue `,o,`.`]})}),e.foreign!==!0&&(0,X.jsx)(ih,{children:(0,X.jsx)(`button`,{type:`button`,"data-snooze-wake-now":!0,disabled:n,onClick:()=>void c(),className:`${lh} disabled:cursor-not-allowed disabled:opacity-45`,children:`Wake now`})})]})}function gO(e){return e?.foreign&&e.pendingInteraction!==!0?e.pendingAsk:void 0}function _O(e,t){return e?.actionableInteraction===!0?!1:t||e?.runtime===`perm-prompt`}async function vO({slug:e,cursor:t,expectedKey:n,queryClient:r,refetch:i,beforePrepend:a}){let o=await W.threadTranscriptEarlier({slug:e,cursor:t}),s=r.getQueryData([`transcript`,e]);return!s?.transcriptKey||s.transcriptKey!==n||o.transcriptKey!==n?(await i(),K(`Transcript changed while loading history; refreshed the current session`),null):(a?.(o),r.setQueryData([`transcript`,e],Er(s,o)),o)}function yO(e){let t=Math.max(e.scrollHeight-e.clientHeight,0),n=t-e.scrollTop,r=e.scrollHeight!==e.previousScrollHeight||e.previousClientHeight!==void 0&&e.previousClientHeight>=0&&e.clientHeight!==e.previousClientHeight,i=r&&!e.readerMoved?e.following||n<=1:n<=4;return!i||!r||t<=0||n<=1?{following:i,scrollTop:null}:{following:i,scrollTop:t}}function bO(e){let t=e.scrollTop>640?!0:e.armed,n=t&&e.readerMoved&&e.scrollTop<=480&&e.hasEarlier&&!e.loading;return{armed:n?!1:t,shouldLoad:n}}function xO(e){return`legacy:${e.role}:${e.kind??`message`}:${e.at??``}:${e.text}`}function SO(e,t,n){let r=[],i=new Map,a=null;return e.forEach((e,o)=>{if(la(e)||t(e))return;let s=e.sourceId??xO(e),c=i.get(s)??0;i.set(s,c+1),r.push({key:c===0?s:`${s}:${c}`,message:e,messageIndex:o,gap:a===null?0:n(a,e)}),a=e}),r}function CO(e,t,n){let r=e[t];if(!r||r.kind!==`event`||r.boundary!==`rest`)return!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(!(la(t)||n(t)))return!!t.boundary||t.wake===!0||iD(t)!==void 0}return!0}function wO(e,t){let n=e.map(e=>e.message);return e.filter((e,r)=>!CO(n,r,t))}var TO=(0,q.createContext)(null);function EO(){let e=(0,q.useContext)(X_),t=(0,q.useContext)(TO);return e??t}function DO({slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r=!1,pane:i}){Tt(e);let a=Be()&&n!==void 0,{splitFileViewer:o}=Xa(U);return(0,X.jsx)(kO,{slug:e,phone:a,railBeside:(i?i.railBeside===!0:r)&&o,pane:i,header:a?(0,X.jsx)(ME,{slug:e,onClose:n}):(0,X.jsx)(qO,{slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r,pane:i})})}var OO=[`todo`];function kO({slug:e,phone:t=!1,railBeside:n=!1,header:r,pane:i}){let a=Tt(e),o=Qt(e,{poll:a?.runtime===`running`||a?.runtime===`spawning`}),s=oo(),c=(0,q.useRef)(!1),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),p=hc(e),m=o.isPending||a?.runtime===`running`||a?.runtime===`spawning`,h=o.isError||o.data?.hasEarlier===!0?void 0:p,g=(0,q.useMemo)(()=>hi(o.data?.messages??[],h,m),[o.data,h,m]),{messages:_,openQuestions:v,settledQuestions:y,transcriptShells:b}=UC(a,g),[x,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(void 0),[T,E]=(0,q.useState)(void 0);if(i?.queueWindow&&T===void 0&&_.length>0){let e=L(_);E(e>0?_[e]?.sourceId??null:null)}let D=T?Math.max(0,_.findIndex(e=>e.sourceId===T)):0,O=ui(),k=(0,q.useMemo)(()=>O?v.filter(e=>!FS(e.spec)):v,[O,v]),A=(0,q.useMemo)(()=>t?{numberOf:e=>v.findIndex(t=>t.id===e)+1,open:k.length>0?e=>{w(k.some(t=>t.id===e)?e:void 0),S(!0)}:void 0}:null,[t,v,k]),j=os()[e],M=(0,q.useMemo)(()=>Hs(_,j===void 0?void 0:new Date(j).toISOString()),[_,j]),N=(0,q.useMemo)(()=>yx(M),[M]),P=(0,q.useMemo)(()=>Co(a,M,N,j),[a,M,N,j]),F=_i(P,M),I=F?.runtime===`running`||F?.runtime===`spawning`,R=P===a?void 0:P?.lastUserAt,ee=QC({slug:e,thread:F,messages:_,openQuestions:v,settledQuestions:y},i?{exit:i.exit}:void 0),{inFlightAnswers:te}=ee.transcript,ne=(0,q.useRef)(null),[re,ie]=(0,q.useState)(null),z=g.length,B=$w({pending:o.isPending,failed:o.isError,expired:!!o.data?.expired},{running:I,adoptable:Qw(F)}),ae=(0,q.useCallback)(async()=>{if(c.current)return;let t=s.getQueryData([`transcript`,e]),n=t?.beforeCursor,r=t?.transcriptKey;if(!(!t?.hasEarlier||!n||!r)){c.current=!0,u(!0),f(null);try{await vO({slug:e,cursor:n,expectedKey:r,queryClient:s,refetch:()=>o.refetch()})}catch(e){let t=e instanceof Error?e.message:`Could not load earlier transcript history`;f(t)}finally{c.current=!1,u(!1)}}},[o,s,e]),oe=(0,q.useCallback)(()=>{if(D===0)return void ae();let e=_r(_,D);E(e!==null&&e>0?_[e]?.sourceId??null:null)},[ae,_,D]);return(0,X.jsxs)($C,{surface:ee,className:`flex-1 min-h-0 flex flex-col`,children:[r,(0,X.jsx)(aC.Provider,{value:A,children:(0,X.jsxs)(`div`,{"data-drawer-scroll-ready":o.isPending?`false`:`true`,className:`flex-1 min-h-0 flex flex-col overflow-hidden outline-none`,children:[(0,X.jsxs)(`div`,{className:`relative min-h-0 flex-1 flex flex-col`,children:[(0,X.jsx)(`div`,{ref:ne,"data-drawer-transcript-scroll":!0,"data-virtualized-transcript-scroll":!0,tabIndex:0,role:`region`,"aria-label":`Thread conversation`,"aria-busy":l?!0:void 0,className:`relative min-h-0 flex-1 overflow-y-auto pb-3 outline-none [overflow-anchor:none] focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-60`,children:z>0?(0,X.jsx)(GO,{slug:e,transcriptRef:ne,transcriptKey:o.data?.transcriptKey,messages:M,steerSince:R,transportFallback:o.transportFallback,isFetching:o.isFetching,refresh:()=>void o.refetch(),retryLiveUpdates:o.retryLiveUpdates,hasEarlier:o.data?.hasEarlier===!0,beforeCursor:o.data?.beforeCursor,loadingEarlier:l,earlierError:d,loadEarlier:oe,jumpOverlay:re,openAtRest:we(F),windowStart:D,sentAt:j}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ZD,{thread:F,className:`px-6 pt-5`,autoFocusFirst:!0}),(0,X.jsx)(VC,{thread:F,inFlight:te,className:`px-6 pt-5`}),o.transportFallback&&(0,X.jsx)(LO,{fallback:o.transportFallback,isFetching:o.isFetching,onRefresh:()=>void o.refetch(),onRetryLive:o.retryLiveUpdates,className:`mx-6 mt-3`}),(0,X.jsx)(`div`,{className:`flex min-h-full flex-col px-6 py-5`,children:(0,X.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted`,children:B===`loading`?(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(kA,{}),` Loading…`]}):B===`failed`?(0,X.jsx)(RO,{error:o.error,retry:()=>o.refetch()}):B===`starting`?(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(kA,{}),` Session starting…`]}):B===`expired`&&o.data?.expired?(0,X.jsx)(eT,{retentionDays:o.data.expired.retentionDays}):B===`adopt`?(0,X.jsxs)(`div`,{className:`text-center`,children:[(0,X.jsx)(`p`,{className:`mb-3`,children:`No session is attached to this thread yet.`}),(0,X.jsx)(`button`,{className:`btn-ghost border border-border text-[12px]`,onClick:()=>W.adoptThread({slug:e}).catch(()=>{}),children:`Start a session on this thread`})]}):`No conversation yet.`})})]})}),(0,X.jsx)(`div`,{ref:ie,"data-transcript-overlay":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-end p-4 [&>*]:pointer-events-auto`})]}),(0,X.jsx)(`div`,{"data-thread-chat-footer":!0,className:`z-10 shrink-0 border-t border-border/60 bg-panel ${t?``:`pb-[env(safe-area-inset-bottom)]`}`,children:(0,X.jsx)(zT,{slug:e,above:t||!F?void 0:(0,X.jsx)(tE,{thread:F,transcriptShells:b,only:n?OO:void 0}),phoneBarOverride:t&&k.length>0?e=>(0,X.jsx)(uC,{count:k.length,onAnswer:()=>{w(void 0),S(!0)},onReply:O?void 0:e.editReply}):void 0,phoneChrome:t})}),t&&x&&(0,X.jsx)(dw,{questions:k,startAt:C,onClose:()=>S(!1)})]})})]})}var AO=700,jO=`button, a[href], input, textarea, select, summary, label, [role='button'], [role='checkbox'], [role='radio'], [contenteditable='true']`;function MO(e){return e.target instanceof Element&&e.target.closest(jO)!==null}var NO=250,PO=900,FO=20,IO=(()=>{try{return localStorage.getItem(`frizz.debugScroll`)===`1`}catch{return!1}})();function LO({fallback:e,isFetching:t,onRefresh:n,onRetryLive:r,className:i=``}){return(0,X.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`flex flex-wrap items-center gap-2.5 ${Um} border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px] ${i}`,title:e.kind===`payload-too-large`?`Live payload ${e.actualBytes} bytes; socket limit ${e.maxBytes} bytes`:`Transcript read budget reached (${e.scope}); retry after about ${e.retryAfterMs}ms`,children:[(0,X.jsx)(fc,{size:13,className:`shrink-0 text-muted`}),(0,X.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,e.kind===`payload-too-large`?`The transcript is too large for push; it refreshes over HTTP each time the thread moves.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,X.jsx)(`button`,{type:`button`,disabled:t,onClick:n,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:t?`Refreshing…`:`Refresh once`}),(0,X.jsx)(`button`,{type:`button`,onClick:r,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]})}function RO({error:e,retry:t}){let[n,r]=(0,q.useState)(!1),i=(e instanceof Error?e.message:String(e??``)).slice(0,200);return(0,X.jsxs)(`div`,{"data-transcript-read-failed":!0,role:`status`,className:`text-center`,children:[(0,X.jsx)(`p`,{children:`Could not load this conversation.`}),i&&(0,X.jsx)(`p`,{className:`font-mono-keep mt-1.5 break-words text-[11.5px]`,children:i}),(0,X.jsx)(`button`,{type:`button`,disabled:n,className:`btn-ghost mt-3 border border-border text-[12px] disabled:opacity-40`,onClick:()=>{r(!0),t().finally(()=>r(!1))},children:n?`Retrying…`:`Retry`})]})}function zO({thread:e,showWorking:t,registeredDone:n,restedCard:r,errorVisible:i}){return e?.providerError?.retrying?`provider-error`:e?.providerFault&&!e.foreign?`provider-fault`:e?.limitPause&&!e.foreign?`limit-pause`:gO(e)?`pending-ask`:_O(e,t)?`working`:e?.providerError?i?null:`provider-error`:pO(e)?`snooze`:ky(e)?`resting`:n?`registered-done`:r?`rested`:null}function BO(e,t){return zO(e)===`working`?_k(t):14}function VO({state:e,slug:t,retryText:n,liveRuntimeStart:r,liveActivityLabel:i,liveToolRun:a,onRestingExit:o,onRestingExitFailed:s,onRestingReplied:c}){let l=e.thread;switch(zO(e)){case`provider-fault`:return(0,X.jsx)(yA,{slug:t,sessionId:l.sessionId,fault:l.providerFault,retryText:n});case`provider-error`:return(0,X.jsx)(lA,{error:l.providerError});case`limit-pause`:return(0,X.jsx)(bA,{slug:t,sessionId:l.sessionId,pause:l.limitPause});case`pending-ask`:return(0,X.jsx)(CA,{ask:gO(l)});case`working`:return(0,X.jsx)(AA,{since:l?.lastUserAt,startedAt:r,activityLabel:i,run:a});case`snooze`:return(0,X.jsx)(hO,{thread:l});case`resting`:return(0,X.jsx)(Py,{thread:l,onSnooze:o,onSnoozeFailed:s,onReplied:c??o,onReplyFailed:s});case`registered-done`:return(0,X.jsx)(HO,{thread:l});case`rested`:return(0,X.jsx)(Kg,{thread:l});default:return null}}function HO({thread:e}){let t=Wg(e);return t===void 0?null:(0,X.jsx)(vA,{fenceKind:`done`,body:t,hints:e.lastFence.hints})}function UO(e,t,n,r){let{thread:i,messages:a,running:o,lastAgentIdx:s}=e,c=za(),l=(0,q.useMemo)(()=>Nn(a),[a]);return(0,q.useMemo)(()=>{let e=s>=0?a[s]:void 0,u={thread:i,showWorking:o,registeredDone:Bg(i,e?.text),restedCard:Gg(i,e?.text,e?.refusedFences),errorVisible:qg(t.map(e=>e.message),i?.providerError)},d=zO(u),f=o?Fi(t):void 0;return{state:u,rung:d,shown:d!==null||!!i?.permPolicy,gap:BO(u,n.map(e=>e.message)),retryText:l>=0?a[l]?.text:void 0,liveRuntimeStart:o?uk(to(t),r):void 0,liveActivityLabel:f?va(f,c):void 0,liveToolRun:o?Ms(t):void 0}},[i,a,o,s,l,t,n,r,c])}function WO({tail:e}){let t=(0,q.useContext)(X_),n=(0,q.useContext)(Z_),r=e.state.thread;return!e.shown||!t?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xy,{h:e.gap}),(0,X.jsx)(VO,{state:e.state,slug:t,retryText:e.retryText,liveRuntimeStart:e.liveRuntimeStart,liveActivityLabel:e.liveActivityLabel,liveToolRun:e.liveToolRun,onRestingExit:n?.dismiss,onRestingExitFailed:n?.cancel,onRestingReplied:n?.sent}),r?.permPolicy?(0,X.jsx)(`div`,{className:e.rung===null?``:`mt-3`,children:(0,X.jsx)(xA,{policy:r.permPolicy,denies:r.permDenies})}):null]})}function GO({slug:e,transcriptRef:t,transcriptKey:n,messages:r,steerSince:i,transportFallback:a,isFetching:o,refresh:s,retryLiveUpdates:c,hasEarlier:l,beforeCursor:u,loadingEarlier:d,earlierError:f,loadEarlier:p,jumpOverlay:m,openAtRest:h=!1,windowStart:g=0,sentAt:_}){let v=JC(),{thread:y,running:b,lastAgentIdx:x,awaitingCut:S,restingShown:C,restated:w,heldIdx:T,doneIdx:E,paired:D,inFlightAnswers:O,settledPlacement:k,openQuestions:A}=v,j=(0,q.useMemo)(()=>__(v.placement,g),[v.placement,g]),M=(0,q.useMemo)(()=>{let e=is(r);return g>0?e.filter(e=>e.messageIndex>=g):e},[r,g]),N=(0,q.useMemo)(()=>{let e=b?oi(M):M;return wO(e,dk(e,S,C,T,w))},[M,b,S,C,T,w]),P=(0,q.useMemo)(()=>{let e=SO(N.map(e=>e.message),dk(N,S,C,T,w),sk);return e.map((t,n)=>({...t,messageIndex:N[t.messageIndex].messageIndex,restGap:ak(t.message,e[n+1]?.message)}))},[N,S,C,T,w]),F=UO(v,M,N,i),I=F.shown,L=(0,q.useMemo)(()=>{let e=[],t=new Map,n=r.length-1,i=e=>{let t=-1;for(let n=0;n<P.length&&!(P[n].messageIndex>e);n++)t=n;return t},a=A.filter(e=>!j.placedIds.has(e.id));for(let[o,s]of t_(r,a,{from:g})){if(o>=n){e.push(...s);continue}let r=i(o),a=t.get(r);a?a.push(...s):t.set(r,[...s])}let o=!1,s=new Set;for(let e of v_(r,j)){if(e>=n){o=!0;continue}let r=i(e);s.add(r),t.has(r)||t.set(r,[])}return{byRow:t,tail:e,tailSend:o,sendRows:s}},[P,r,A,j,g]),R=(0,q.useMemo)(()=>{let e=new Map;for(let[t,n]of k.anchored){let r=-1;for(let e=0;e<P.length&&!(P[e].messageIndex>t);e++)r=e;if(r<0)continue;let i=e.get(r);i?i.push(...n):e.set(r,[...n])}return e},[P,k.anchored]),ee=v.fenceQuestions,te=(0,q.useMemo)(()=>Bw(r,{running:b,closedOnly:ee?e=>f_(r[e],ee):void 0}),[r,b,ee]),ne=(0,q.useMemo)(()=>new Set(r.flatMap((e,t)=>Jw(e)?[t]:[])),[r]),[re,ie]=(0,q.useState)(()=>new Set),z=(0,q.useMemo)(()=>{let e=[{key:`head-anchor`,kind:`head-anchor`}];a&&e.push({key:`transport-fallback`,kind:`transport-fallback`}),(l||d||f||g>0)&&e.push({key:`earlier-history:${u??`complete`}`,kind:`earlier-history`});let t=L.byRow.get(-1);t&&e.push({key:`questions:head`,kind:`questions`,questions:t,send:L.sendRows.has(-1)});let n=(t,n,r=P[t].message)=>{let i=P[t];e.push({...i,message:r,gap:n,kind:`message`});let a=R.get(t);a&&e.push({key:`settled-questions:${i.key}`,kind:`settled-questions`,questions:a});let o=L.byRow.get(t);o&&e.push({key:`questions:${i.key}`,kind:`questions`,questions:o,send:L.sendRows.has(t)})},i=e=>L.byRow.has(e)||j.placed.has(P[e].messageIndex)||P[e].messageIndex===E||ne.has(P[e].messageIndex),o=new Map,s=new Set,c=0;for(let e=0;e<P.length;){let t=P[e].messageIndex;for(;c<te.length&&te[c].to<t;)c++;let n=te[c],r=e;if(n&&t>=n.from)for(;r<P.length&&P[r].messageIndex<=n.to&&!i(r);)r++;let a=n?.lead!==void 0&&e>0&&P[e-1].messageIndex===n.lead?e-1:-1,l=`fold:${P[e].key}`;if(r-e>=(a>=0?1:2)){if(!re.has(l)){let t=r<P.length&&P[r].messageIndex<=n.to?P[r].messageIndex-1:n.to;o.set(e,{end:r,key:l,range:n,to:t}),a>=0&&s.add(a)}e=r}else e++}let p=!1;for(let t=0;t<P.length;){let i=o.get(t);if(!i){let e=p?sk(Ok,P[t].message):P[t].gap,r=P[t].message;s.has(t)?n(t,e,{...r,tools:[],parts:(r.parts??[]).filter(e=>e.kind!==`tools`)}):n(t,e),p=!1,t++;continue}let a=Vw(r,{from:P[t].messageIndex,to:i.to,lead:s.has(t-1)?i.range.lead:void 0});e.push({key:i.key,kind:`fold`,...a,gap:t===0?0:sk(P[t-1].message,Ok)}),p=!0,t=i.end}e.push({key:`interactions`,kind:`interactions`}),I&&e.push({key:`runtime-status`,kind:`runtime-status`});let m=null;return r.forEach((t,n)=>{if(!la(t))return;let r=`queued:${t.deliveryId??t.sourceId??n}`,i=m?sk(m,t):I||P.length>0?14:0;e.push({key:r,kind:`queued`,message:t,messageIndex:n,gap:i}),m=t}),m&&e.push({key:`queued-send-now`,kind:`queued-send-now`}),e},[u,E,f,te,l,I,d,P,r,re,ne,j,L,R,a,g]),B=(0,q.useRef)(null),[ae,oe]=(0,q.useState)(h),se=e=>{let t=z[e];return t?t.kind===`head-anchor`||t.kind===`interactions`?1:t.kind===`queued-send-now`?22:t.kind===`earlier-history`?42:t.kind===`transport-fallback`?76:t.kind===`runtime-status`?54:t.kind===`questions`?220:t.kind===`settled-questions`?140:t.kind===`fold`?28+t.gap:t.kind===`message`?108+t.gap:82+t.gap:80},ce=ns({count:z.length,getScrollElement:()=>t.current,getItemKey:e=>z[e]?.key??e,estimateSize:se,initialOffset:()=>{if(!h||!n)return 0;let e=sr(z,r,x),t=e.steerLeads?-1:[e.steer,e.signOff,e.fallback].find(e=>e>=0)??-1,i=t<0?0:FO;for(let e=0;e<t;e++)i+=se(e);return i},overscan:8,rangeExtractor:e=>{let t=Ea(e),n=B.current?.rowKey,r=n?z.findIndex(e=>e.key===n):-1;if(r<0)return t;let i=[];for(let e=Math.max(0,r-2);e<=Math.min(z.length-1,r+24);e++)i.push(e);return[...new Set([...t,...i])].sort((e,t)=>e-t)},paddingStart:FO,paddingEnd:FO,anchorTo:`end`,scrollEndThreshold:ae?-1:4,scrollToFn:(e,{adjustments:t,behavior:n},r)=>{let i=r.scrollElement;i&&i.scrollTo({top:t===void 0?e:i.scrollTop+t,behavior:n})}}),[le,ue]=(0,q.useState)(!0),fe=(0,q.useRef)(!0),pe=(0,q.useRef)(-1),me=(0,q.useRef)(-1),he=(0,q.useRef)(0),ge=(0,q.useRef)(null),_e=(0,q.useRef)(!1),ve=(0,q.useRef)(!1),ye=(0,q.useRef)(!0),be=(0,q.useRef)(void 0),xe=(0,q.useRef)(null),Se=(0,q.useRef)(void 0),Ce=(0,q.useRef)(0),we=(0,q.useRef)(0),Te=(0,q.useCallback)(()=>{let e=t.current;if(e){let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-transcript-source-id]`)).find(e=>e.getBoundingClientRect().bottom>t+1),r=n?.dataset.transcriptRowKey;n&&r&&(B.current={rowKey:r,viewportTop:n.getBoundingClientRect().top-t})}p()},[p,t]),Ee=(0,q.useCallback)((e,n)=>{let r=t.current;if(!r)return;let i=Array.from(r.querySelectorAll(`[data-transcript-source-id]`)).find(t=>t.dataset.transcriptSourceId===e);i&&(r.scrollTop+=i.getBoundingClientRect().top-n)},[t]),De=(0,q.useRef)(z);(0,q.useLayoutEffect)(()=>{De.current=z});let Oe=(0,q.useRef)(null);(0,q.useLayoutEffect)(()=>{if(!n||z.length===0||be.current===n)return;be.current=n,_e.current=!1,ve.current=!1,ye.current=!0,cancelAnimationFrame(we.current),we.current=0;let i=ji(e)?.candidates.map(e=>({candidate:e,index:z.findIndex(t=>t.kind===`message`&&t.message.sourceId===e.sourceId)})).find(e=>e.index>=0),a=!i&&h?sr(z,r,x):null,o=e=>e!==void 0&&e>=0?z[e].key:void 0,s=o(a?.steer),c=o(a?.signOff),l=o(a?.fallback);if(a&&(s??c??l)!==void 0){fe.current=!1,_e.current=!0;let e=performance.now()+PO;Ce.current=e;let n=(e,t)=>{if(t===void 0)return;let n=e.querySelector(`[data-transcript-row-key="${CSS.escape(t)}"]`);return n?n.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop:null},r=e=>{let t=Un({steer:a.steerLeads?0:n(e,s),signOff:n(e,c),fallback:n(e,l),paneHeight:e.clientHeight}),r;if(`top`in t)r=t.top;else{let e=t.reach===`steer`?s:t.reach===`signOff`?c:l,n=De.current.findIndex(t=>t.key===e);r=n>=0?ce.getOffsetForIndex(n,`start`)?.[0]:void 0}r!==void 0&&Math.abs(e.scrollTop-r)>=.5&&(e.scrollTop=r),ue(e.scrollHeight-e.clientHeight-e.scrollTop<=4)},i=()=>{let n=t.current;if(performance.now()>=e||performance.now()<he.current){Ce.current===e&&(Ce.current=0),we.current=0,Oe.current=null,oe(!1),n&&n.scrollHeight-n.clientHeight-n.scrollTop<=4&&(fe.current=!0,pe.current=n.scrollHeight,ue(!0));return}n&&r(n),we.current=requestAnimationFrame(i)};Oe.current=()=>{let e=t.current;e&&r(e)},i();return}oe(!1),we.current=requestAnimationFrame(()=>{if(we.current=0,!i){ce.scrollToEnd({behavior:`instant`}),ue(!0),_e.current=!0;return}ce.scrollToIndex(i.index,{align:`start`,behavior:`instant`}),fe.current=!1,ue(!1),_e.current=!0;let e=performance.now()+NO;Ce.current=e;let t=()=>{if(performance.now()>=e||performance.now()<he.current){we.current=0;return}Ee(i.candidate.sourceId,i.candidate.screenTop),we.current=requestAnimationFrame(t)};t()})},[Ee,z.length,e,n,ce]),(0,q.useEffect)(()=>()=>cancelAnimationFrame(we.current),[]);let ke=(0,q.useRef)(_);(0,q.useEffect)(()=>{let e=_!==ke.current;ke.current=_;let n=t.current;!e||_===void 0||!n||(Ce.current=0,fe.current=!0,ue(!0),n.scrollTop=n.scrollHeight)},[_,t]);let Ae=(0,q.useCallback)(()=>{let e=t.current;if(!e)return null;let n=e.getBoundingClientRect().top,r=Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.getBoundingClientRect().bottom>n+1),i=r?.dataset.transcriptRowKey;return!r||!i?null:{rowKey:i,viewportTop:r.getBoundingClientRect().top-n}},[t]),je=(0,q.useCallback)(e=>{let n=t.current;if(!n)return;let r=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!r)return;let i=r.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=i-e.viewportTop},[t]),Me=P[0]?.key;(0,q.useLayoutEffect)(()=>{let e=Se.current;if(Se.current=Me,e===void 0||e===Me||!_e.current||fe.current||B.current)return;let t=xe.current;if(!t)return;je(t);let n=()=>{if(performance.now()<he.current)return;let e=xe.current;e&&je(e)},r=0,i=requestAnimationFrame(()=>{n(),r=requestAnimationFrame(n)});return()=>{cancelAnimationFrame(i),cancelAnimationFrame(r)}},[je,Me]);let Ne=(0,q.useCallback)(()=>{let e=t.current;if(!e||B.current||performance.now()<Ce.current)return;let n=yO({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,previousScrollHeight:pe.current,previousClientHeight:me.current,following:fe.current,readerMoved:performance.now()<he.current});if(fe.current=n.following,n.scrollTop!==null&&(e.scrollTop=n.scrollTop),pe.current=e.scrollHeight,me.current=e.clientHeight,ue(e=>e===n.following?e:n.following),IO&&!n.following&&performance.now()>=he.current){let t=xe.current,n=t&&Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.dataset.transcriptRowKey===t.rowKey);if(t&&n){let r=Math.round(n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.viewportTop);Math.abs(r)>2&&console.warn(`[frizz] transcript moved ${r}px under a still reader — row=${t.rowKey}`)}}xe.current=Ae()??xe.current},[Ae,t]),Pe=(0,q.useCallback)(e=>{let n=t.current,r=z.findIndex(t=>t.key===e),i=r>0?z[r-1].key:null,a=i?n?.querySelector(`[data-transcript-row-key="${CSS.escape(i)}"]`):null;if(n&&i&&a){let e={rowKey:i,viewportTop:a.getBoundingClientRect().top-n.getBoundingClientRect().top};fe.current=!1;let t=performance.now()+NO;Ce.current=t;let r=()=>{if(performance.now()>=t||performance.now()<he.current){Ce.current===t&&(Ce.current=0),Ne();return}je(e),requestAnimationFrame(r)};requestAnimationFrame(r)}ie(t=>new Set(t).add(e))},[je,z,Ne,t]);(0,q.useLayoutEffect)(()=>{let e=ge.current;if(!e)return;let t=new Map(ce.getVirtualItems().map(e=>[e.index,e.size])),n=[],r=0;for(let i of e.querySelectorAll(`:scope > [data-index]`)){let e=ce.indexFromElement(i),a=Math.round(i.getBoundingClientRect().height),o=t.get(e);e<0||o===void 0||o===a||(n.push({index:e,size:a}),r+=a-o)}if(n.length!==0){e.style.height=`${ce.getTotalSize()+r}px`;for(let{index:e,size:t}of n)ce.resizeItem(e,t)}}),(0,q.useLayoutEffect)(()=>{Oe.current?.()});let Fe=(0,q.useRef)(null);(0,q.useLayoutEffect)(()=>{let e=B.current,n=t.current;if(!e||!n||d)return;let r=()=>{let t=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!t){let t=z.findIndex(t=>t.key===e.rowKey),r=t>=0?ce.getOffsetForIndex(t,`start`)?.[0]:void 0;return r!==void 0&&(n.scrollTop=r-e.viewportTop),!1}let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top-e.viewportTop;return Math.abs(r)<.5?!0:(n.scrollTop+=r,!1)};if(r(),Fe.current?.anchor===e)return;let i=0,a=0,o=()=>{if(i=r()?i+1:0,a++,i>=2||a>=10){B.current===e&&(B.current=null),Fe.current=null;return}Fe.current&&(Fe.current.frame=requestAnimationFrame(o))};Fe.current={anchor:e,frame:requestAnimationFrame(o)}}),(0,q.useEffect)(()=>()=>{Fe.current&&cancelAnimationFrame(Fe.current.frame)},[]),(0,q.useLayoutEffect)(Ne),(0,q.useEffect)(()=>{let e=ge.current;if(!e)return;let n=new ResizeObserver(Ne);n.observe(e);let r=t.current;return r&&n.observe(r),()=>n.disconnect()},[Ne,t]),(0,q.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{Ne();let t=bO({armed:ye.current,scrollTop:e.scrollTop,readerMoved:_e.current&&ve.current,hasEarlier:l&&g===0,loading:d});ye.current=t.armed,t.shouldLoad&&Te()},r=()=>{ve.current=!0,he.current=performance.now()+AO,requestAnimationFrame(n)},i=t=>{![`ArrowUp`,`PageUp`,`Home`,` `].includes(t.key)||MO(t)||(e.scrollTop<=480&&(ye.current=!0),r())},a=t=>{t.deltaY<0&&e.scrollTop<=480&&(ye.current=!0),r()},o=t=>{t.type===`touchstart`&&MO(t)||(e.scrollTop<=480&&(ye.current=!0),r())},s=e=>{MO(e)||r()};e.addEventListener(`scroll`,n,{passive:!0}),e.addEventListener(`wheel`,a,{passive:!0}),e.addEventListener(`touchstart`,o,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`pointerdown`,s,{passive:!0}),e.addEventListener(`keydown`,i);let c=requestAnimationFrame(n);return()=>{cancelAnimationFrame(c),e.removeEventListener(`scroll`,n),e.removeEventListener(`wheel`,a),e.removeEventListener(`touchstart`,o),e.removeEventListener(`touchmove`,o),e.removeEventListener(`pointerdown`,s),e.removeEventListener(`keydown`,i)}},[l,d,Te,Ne,t,g]);let Ie=ce.getVirtualItems(),Le=ce.getTotalSize();return(0,X.jsxs)(`div`,{ref:ge,"data-virtualized-transcript":!0,"data-virtual-row-count":Ie.length,className:`relative w-full`,style:{height:Le},children:[Ie.map(e=>{let t=z[e.index];return t?(0,X.jsx)(`div`,{ref:ce.measureElement,"data-index":e.index,"data-transcript-row-key":t.key,"data-transcript-source-id":t.kind===`message`?t.message.sourceId:void 0,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${e.start}px)`},children:t.kind===`head-anchor`?null:t.kind===`interactions`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ZD,{thread:y,className:`px-6 pt-5`,autoFocusFirst:!0}),(0,X.jsx)(VC,{thread:y,questions:L.tail,inFlight:O,showSend:L.tailSend,className:`px-6 pt-5`})]}):t.kind===`questions`?(0,X.jsx)(VC,{thread:y,questions:t.questions,showSend:t.send,className:`px-6 pt-5`}):t.kind===`settled-questions`?(0,X.jsx)(EC,{questions:t.questions,className:`px-6 pt-5`}):t.kind===`transport-fallback`?a?(0,X.jsx)(`div`,{className:`px-6 pt-3`,children:(0,X.jsx)(LO,{fallback:a,isFetching:o,onRefresh:s,onRetryLive:c})}):null:t.kind===`earlier-history`?(0,X.jsx)(`div`,{className:`flex min-h-10 items-center justify-center px-6 text-[11px] text-muted`,role:`status`,children:f?(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2 text-center`,children:[(0,X.jsx)(`span`,{children:f}),(0,X.jsx)(`button`,{type:`button`,onClick:Te,className:`rounded-md border border-border px-2 py-1 text-fg/90 hover:bg-panel-2`,children:`Retry`})]}):d?(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(de,{size:12,className:`animate-spin`}),` Loading earlier messages…`]}):(0,X.jsx)(`button`,{type:`button`,"data-load-earlier":!0,onClick:Te,className:`button-outline rounded-md px-2 py-1 outline-none hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:`Load earlier messages`})}):t.kind===`message`?(0,X.jsx)(`div`,{className:`relative flex flex-col px-6`,style:{paddingTop:t.gap},children:t.restGap?(0,X.jsx)(ok,{rest:t.message,at:t.restGap}):(0,X.jsx)(sA,{m:t.message,index:t.messageIndex,showSendButton:!0})}):t.kind===`fold`?(0,X.jsx)(`div`,{className:`flex flex-col px-6`,style:{paddingTop:t.gap},children:(0,X.jsx)(Ek,{rounds:t.rounds,calls:t.calls,onExpand:()=>Pe(t.key)})}):t.kind===`runtime-status`?(0,X.jsx)(`div`,{className:`px-6`,children:(0,X.jsx)(WO,{tail:F})}):t.kind===`queued-send-now`?(0,X.jsx)(`div`,{className:`flex flex-col px-6`,children:(0,X.jsx)(rA,{})}):(0,X.jsx)(`div`,{className:`relative flex flex-col px-6`,style:{paddingTop:t.gap},children:(0,X.jsx)(cA,{m:t.message,paired:D[t.messageIndex]})})},t.key):null}),(0,X.jsx)(KO,{overlay:m,hidden:le,onJump:()=>ce.scrollToEnd({behavior:`smooth`})})]})}function KO({overlay:e,hidden:t,onJump:n}){return!e||t?null:(0,ml.createPortal)((0,X.jsxs)(`button`,{type:`button`,"data-jump-to-latest":!0,onClick:n,className:`flex items-center gap-1.5 rounded-full border border-border-strong bg-elevated px-3 py-1.5 text-[11px] font-medium text-fg shadow-lg shadow-shadow-ink/30 hover:bg-panel-2 pointer-coarse:min-h-9 pointer-coarse:px-3.5 pointer-coarse:text-[13px] pointer-coarse:active:bg-panel-2`,children:[(0,X.jsx)(Dc,{size:12,className:`pointer-coarse:size-[14px] pointer-coarse:-translate-y-[0.5px]`}),`Jump to latest`]}),e)}function qO({slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r=!1,pane:i}){let a=Tt(e),o=Ji({mutationFn:()=>W.markComplete({slug:e})}),s=gp(Fo({queryKey:[`threadBody`,e],queryFn:()=>W.threadBody({slug:e})}).data?.markdown??``).trim().length>0;return a?(0,X.jsxs)(`header`,{"data-thread-header":!0,className:tT,children:[(0,X.jsxs)(`div`,{className:nT,children:[n&&(0,X.jsx)(ga,{onClose:n}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 leading-tight`,children:[(0,X.jsx)(rD,{thread:a}),(0,X.jsx)($E,{thread:a})]})]}),(0,X.jsx)(`div`,{className:rT,children:(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,X.jsx)(LE,{thread:a,collapse:r,expand:!!n||i?.expand===!0,onDoc:s?()=>wi(`doc`,a.id):void 0,onDone:()=>o.mutate(void 0,{onSuccess:t??i?.exit.dismiss}),doneBusy:o.isPending,onStatusApplied:t}),(0,X.jsx)(dE,{thread:a,onArchived:t??i?.exit.dismiss,onDismissCancel:i?.exit.cancel,onSnoozed:t??i?.exit.dismiss})]})})]}):null}function JO(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||iD(e))return null;if(e.parts&&e.parts.length>0){for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`tools`?n.tools.length>0:n.text.trim())return n.kind===`tools`?n.tools:null}return null}return(e.tools?.length??0)>0&&!e.text.trim()?e.tools:null}function YO(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||iD(e))return null;if(e.parts&&e.parts.length>0){for(let t of e.parts)if(t.kind===`tools`?t.tools.length>0:t.text.trim())return t.kind===`tools`?t.tools:null;return null}return(e.tools?.length??0)>0?e.tools:null}function XO(e){return JO(e)!==null}function ZO(e){return YO(e)!==null}function QO(e){return e.kind===`event`&&!e.boundary||e.kind===`reasoning`}function $O(e){return QO(e)||XO(e)}function ek(e){return QO(e)||ZO(e)}function tk(e){if(QO(e))return!0;let t=JO(e);return t!==null&&!Ti(t[t.length-1])}function nk(e){if(QO(e))return!0;let t=YO(e);return t!==null&&!Ti(t[0])}function rk(e){let t=JO(e);return t!==null&&Ao(t[t.length-1])}function ik(e){let t=YO(e);return t!==null&&Ao(t[0])}function ak(e,t){return e.kind!==`event`||e.boundary!==`rest`||!t||!ck(t)?null:Iy(e.at,t.at)}function ok({rest:e,at:t}){let{day:n,time:r}=Ry(t),i=zy(e.at)?.replace(/^(Today|Yesterday)/,e=>e.toLowerCase());return(0,X.jsx)(`div`,{title:i?`Agent rested ${i}`:void 0,className:`contents`,children:(0,X.jsx)(Q,{sourceId:e.sourceId,marker:`rest-gap`,ariaLabel:`${n}, ${r}`,children:(0,X.jsxs)(`time`,{dateTime:t,className:`flex shrink-0 items-center gap-1 tabular-nums`,children:[(0,X.jsx)(`span`,{children:n}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`opacity-50`,children:`·`}),(0,X.jsx)(`span`,{children:r})]})})})}function sk(e,t){if(ck(e)&&ck(t))return 6;let n=rk(e)||ik(t),r=!n&&$O(e)&&ek(t)&&!(tk(e)&&nk(t));return(n?22:r?6:14)+(e.role===`user`&&t.role!==`user`?3:0)}function ck(e){return e.role!==`user`||e.kind===`event`||e.kind===`reasoning`||e.providerError||e.sessionPeer||e.peerFrom||e.agentInstruction?!1:!e.wake||ae(e)}function lk(e,t,n){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.every(r=>r.kind===`tools`?r.tools.length===0:pk(e,r.text,t,n)):(e.tools?.length??0)===0&&pk(e,e.text,t,n)}function uk(e,t){let n=Date.parse(e??``),r=Date.parse(t??``);return Number.isFinite(r)?Number.isFinite(n)&&n>=r?e:t:e}function dk(e,t,n=!1,r=-1,i=fk){let a=new WeakSet,o=new WeakSet;if(t>=0)for(let n of e)n.messageIndex<t&&n.messageIndex!==r&&a.add(n.message);if(t>=0&&n)for(let n of e)(n.messageIndex===t||i.has(n.messageIndex))&&o.add(n.message);return e=>lk(e,a.has(e),o.has(e))}var fk=new Set;function pk(e,t,n,r){return!e.fenceRefused&&!n&&!r?t.includes("```awaiting")?Rg(t).every(e=>e.kind===`fence`&&e.fenceKind===`awaiting`&&mt(e.hints)&&!Jo(e.body)):!t.trim():Rg(t).every(t=>t.kind===`fence`&&t.fenceKind===`awaiting`&&(e.fenceRefused||r||!(mk(t.hints)||hk(e,t))))}function mk(e){return Ts(e).length>0}function hk(e,t){return e.keptSignOff?e.keptSignOff===`newest`&&!(mt(t.hints)||gk(t.hints))||Jo(t.body)!==null:!1}function gk(e){let t=vi(e);return t===`working`||t===`watching`}function _k(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(la(n)||lk(n)))return rk(n)?22:$O(n)&&!tk(n)?6:14+(n.role===`user`?3:0)}return 0}function vk(e,t,n){let r=[],i=null;return e.forEach((e,a)=>{n?.(e,a)||lk(e)||(i!==null&&r.push((0,X.jsx)(Xy,{h:sk(i,e)},`s${a}`)),r.push(t(e,a)),i=e)}),r}function yk(e){let t=[];for(let n of e){if(n.kind===`text`){if(!n.text.trim())continue;t.push(n);continue}if(n.tools.length===0)continue;let e=t[t.length-1];e&&e.kind===`tools`?t[t.length-1]={kind:`tools`,tools:[...e.tools,...n.tools]}:t.push(n)}return t}function bk(e,t=14){let n=e.filter(e=>e!=null&&e!==!1),r=[];return n.forEach((e,n)=>{let i=n===0?0:typeof t==`number`?t:t(n);i>0&&r.push((0,X.jsx)(Xy,{h:i},`vs${n}`)),r.push(e)}),r}var xk={head:!1,tail:!1};function Sk(e,t){return n=>e[n-1]?.tail||e[n]?.head?22:t}function Ck(e){return{head:Ao(e[0]),tail:Ao(e[e.length-1])}}function wk(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.edit){let r=!!(n.input||n.output||n.status||n.exitCode!==void 0);e&&e.edits&&!r&&!e.input&&!e.output&&!e.status&&e.edits[0].file===n.edit.file?e.edits.push(n.edit):t.push({name:n.name,detail:n.detail,edits:[n.edit],input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}else n.command?t.push({name:n.name,detail:n.detail,command:n.command,desc:n.desc,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):n.outputImage?t.push({name:n.name,detail:n.detail,outputImage:n.outputImage,output:n.output??n.read,status:n.status,durationMs:n.durationMs,count:1}):n.read?t.push({name:n.name,detail:n.detail,read:n.read,status:n.status,durationMs:n.durationMs,count:1}):n.prompt||n.agentId?t.push({name:n.name,detail:n.detail,prompt:n.prompt,input:n.input,subagentType:n.subagentType,agentId:n.agentId,agentStatus:n.agentStatus,agentElapsedMs:n.agentElapsedMs,output:n.output,status:n.status,durationMs:n.durationMs,count:1}):n.sendTo!==void 0||n.sendBody!==void 0?t.push({name:n.name,detail:n.detail,sendTo:n.sendTo,sendSummary:n.sendSummary,sendBody:n.sendBody,sendType:n.sendType,sendDispatchId:n.sendDispatchId,sendTargetLabel:n.sendTargetLabel,status:n.status,durationMs:n.durationMs,count:1}):n.todos?t.push({name:n.name,detail:n.detail,todos:n.todos,input:n.input,status:n.status,durationMs:n.durationMs,count:1}):ps(n)?t.push({name:n.name,detail:n.detail,ask:n.ask,askAnswers:n.askAnswers,status:n.status,durationMs:n.durationMs,count:1}):n.sentImages||n.sentFiles?t.push({name:n.name,detail:n.detail,sentImages:n.sentImages,sentFiles:n.sentFiles,caption:n.caption,status:n.status,durationMs:n.durationMs,count:1}):n.input||n.output?t.push({name:n.name,detail:n.detail,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):e&&!e.edits&&!e.command&&!e.input&&!e.output&&!e.read&&!e.prompt&&!e.outputImage&&!e.sentImages&&!e.sentFiles&&e.sendTo===void 0&&e.sendBody===void 0&&e.name===n.name&&e.detail===n.detail&&e.status===n.status&&e.backgroundState===n.backgroundState&&e.exitCode===n.exitCode&&e.cwd===n.cwd&&e.sessionId===n.sessionId&&e.durationMs===n.durationMs?e.count++:t.push({name:n.name,detail:n.detail,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}return t}function Tk(e){return e.split(`__`).pop()||e}function Ek({rounds:e,calls:t,onExpand:n}){let r=e>0?`${e} more round${e===1?``:`s`}`:``,i=t>0?`${t} tool call${t===1?``:`s`}`:``;return(0,X.jsx)(Q,{icon:Dk,marker:`stretch-fold`,onClick:n,ariaLabel:`Expand ${[r,i].filter(Boolean).join(` and `)||`the work`} before the sign-off`,children:r||i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:r||i}),r&&i&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-50 @max-[34rem]/wake:hidden`,children:`·`}),(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums @max-[34rem]/wake:hidden`,children:i})]}),(0,X.jsx)(Gy,{})]}):(0,X.jsx)(`span`,{className:`shrink-0`,children:`Click to expand`})})}var Dk=(0,q.forwardRef)(({className:e,...t},n)=>(0,X.jsx)(Nc,{ref:n,...t,className:`${e??``} -mr-[1.5px]`})),Ok={role:`user`,wake:!0,text:``,tools:[],parts:[]};function kk({tools:e,at:t}){let[n,r]=(0,q.useState)(!1),i=(0,q.useId)(),a=e.reduce((e,t)=>e+t.count,0),o=zo(a,Oa(e));return(0,X.jsxs)(`div`,{"data-tool-activity":!0,"data-tool-activity-state":`settled`,className:`flex min-w-0 flex-col`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":i,"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} ${a} tool ${a===1?`call`:`calls`}: ${o}`,className:`group flex w-full min-w-0 items-baseline gap-1.5 rounded -my-0.5 py-0.5 text-left outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60 pointer-coarse:-my-1.5 pointer-coarse:py-1.5 ${gD}`,children:[(0,X.jsx)(`span`,{"data-tool-activity-label":!0,title:o,className:`min-w-0 truncate text-muted`,children:o}),(0,X.jsx)(fr,{"data-tool-activity-chevron":!0,"aria-hidden":`true`,size:13,className:vD(n)})]}),n&&(0,X.jsx)(`div`,{id:i,className:`mt-1.5 flex flex-col`,children:(0,X.jsx)(Ak,{tools:e,at:t})}),!n&&(0,X.jsx)(`div`,{id:i,hidden:!0})]})}function Ak({tools:e,at:t}){let n=(0,q.useContext)(X_)!==null,r=e=>!ps(e)&&!(n&&(e.sendTo!==void 0||e.sendBody!==void 0));return(0,X.jsx)(X.Fragment,{children:bk(e.map((e,n)=>(0,X.jsx)(Mk,{t:e,startedAt:t},n)),t=>Ao(e[t-1])||Ao(e[t])?22:r(e[t-1])&&r(e[t])?0:6)})}function jk({tools:e,at:t}){let n=[];for(let t of e){let e=Ti(t),r=n[n.length-1];r?.exceptional===e?r.tools.push(t):n.push({exceptional:e,tools:[t]})}return(0,X.jsx)(`div`,{className:`flex flex-col`,children:bk(n.map((e,n)=>e.exceptional?(0,X.jsx)(`div`,{className:`flex flex-col`,children:(0,X.jsx)(Ak,{tools:e.tools,at:t})},`exceptions-${n}`):(0,X.jsx)(kk,{tools:e.tools,at:t},`activity-${n}`)),Sk(n.map(e=>Ck(e.tools)),6))})}function Mk({t:e,startedAt:t}){let n=Oe(e,Tt((0,q.useContext)(X_))?.bgShells??[]);return e.edits&&e.status!==`failed`&&e.status!==`cancelled`?(0,X.jsx)(ym,{edits:e.edits,meta:(0,X.jsx)(Lk,{status:e.status,backgroundState:e.backgroundState,liveBackgroundState:n,exitCode:e.exitCode,durationMs:e.durationMs})}):e.command?(0,X.jsx)(Kk,{command:e.command,desc:e.desc??e.detail,literalDesc:e.desc===void 0,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:n,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t}):e.outputImage?(0,X.jsx)(Uk,{name:e.name,detail:e.detail,outputImage:e.outputImage,output:e.output,status:e.status,durationMs:e.durationMs}):e.read?(0,X.jsx)(Jk,{detail:e.detail,read:e.read,status:e.status,durationMs:e.durationMs}):e.prompt||e.agentId?(0,X.jsx)(Xk,{detail:e.detail,prompt:e.prompt,subagentType:e.subagentType,agentId:e.agentId,agentStatus:e.agentStatus,agentElapsedMs:e.agentElapsedMs,status:e.status,durationMs:e.durationMs}):e.sendTo!==void 0||e.sendBody!==void 0?(0,X.jsx)(Qk,{to:e.sendTo,summary:e.sendSummary,body:e.sendBody??``,type:e.sendType,dispatchId:e.sendDispatchId,targetLabel:e.sendTargetLabel,status:e.status,durationMs:e.durationMs,at:t}):e.sentImages||e.sentFiles?(0,X.jsx)(Wk,{images:e.sentImages??[],files:e.sentFiles??[],caption:e.caption,status:e.status,durationMs:e.durationMs}):e.todos?(0,X.jsx)(Ig,{todos:e.todos,note:e.input,node:um(e.status),meta:(0,X.jsx)(Lk,{status:e.status,durationMs:e.durationMs})}):ps(e)?(0,X.jsx)(Nk,{ask:e.ask??[],askAnswers:e.askAnswers}):e.input||e.output?(0,X.jsx)(Kk,{name:e.name,command:e.input??``,desc:e.detail,literalDesc:!0,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:n,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,inputLabel:`Input`,startedAt:t}):(0,X.jsx)(Hk,{name:e.name,detail:e.detail,count:e.count,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:n,exitCode:e.exitCode,cwd:e.cwd,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t})}function Nk({ask:e,askAnswers:t}){return(0,X.jsx)(`div`,{"data-settled-ask":!0,className:`flex flex-col gap-1.5`,children:e.map((e,n)=>{let r=qD(e,t?.[n]);return(0,X.jsx)(eC,{question:r.question,settled:{chosenIdxs:r.chosenIdxs,text:r.text}},n)})})}function Pk({tone:e,indicator:t,label:n,duration:r,title:i}){return(0,X.jsxs)(`span`,{className:`flex shrink-0 items-baseline gap-1 whitespace-nowrap text-[11.5px] leading-none tabular-nums ${e}`,title:i,"aria-label":i,children:[t,(0,X.jsx)(`span`,{children:[n,r].filter(Boolean).join(` · `)})]})}function Fk(e,t,n){let[r,i]=(0,q.useState)(()=>Date.now()),a=qn(e,t),o=nr(e,t,n,r);return(0,q.useEffect)(()=>{if(!a||o)return;let e=n?Date.parse(n):NaN;if(!Number.isFinite(e))return;let t=setTimeout(()=>i(Date.now()),Math.max(w-(Date.now()-e),0));return()=>clearTimeout(t)},[a,o,n]),o}function Ik({status:e,backgroundState:t,liveBackgroundState:n,startedAt:r}){let i=Fk(e,t,r),a=n===`running`?(0,X.jsx)(ut,{"aria-hidden":!0,hue:`shell`,"data-running-indicator":`tool-disclosure`}):n===`stale`?(0,X.jsx)(`span`,{className:N,title:qs}):Le(e,t)||i?(0,X.jsx)(ut,{"aria-hidden":!0,hue:`shell`,"data-running-indicator":`tool-disclosure`}):null;return a?(0,X.jsx)(`span`,{className:`frizz-tool-mark`,children:a}):null}function Lk({status:e,backgroundState:t,liveBackgroundState:n,exitCode:r,durationMs:i}){if(!e&&i===void 0)return null;let[a,o]=n===`running`?[`running`,`background running`]:n===`stale`?[`stale`,`background stale`]:e===`pending`?t===`unknown`?[`unknown`,`background / unknown`]:[`running`,t===`background`?`background running`:`running`]:e===`failed`?r===void 0?[`failed`,`failed`]:[`exit ${r}`,`exit ${r}`]:e===`cancelled`?[`cancelled`,`cancelled`]:e===`completed`?[void 0,`done`]:[void 0,void 0],s=i===void 0?void 0:tr(i);if(!a&&!s)return null;let c=[o,s].filter(Boolean).join(` · `);return(0,X.jsx)(Pk,{tone:e===`failed`?`frizz-tool-failed`:e===`cancelled`?`text-attention`:`text-faint`,title:c,label:a,duration:s})}function Rk(e,t,n){let r=t?Date.parse(t):NaN,i=e===`pending`&&Number.isFinite(r),[a,o]=(0,q.useState)(()=>Date.now());return(0,q.useEffect)(()=>{if(!i)return;let e=()=>o(Date.now()),t,n=setTimeout(()=>{e(),t=setInterval(e,1e3)},1e3-Date.now()%1e3);return()=>{clearTimeout(n),t&&clearInterval(t)}},[i,t]),i?Math.max(a-r,0):n}function zk(e,t,n){let r=t&&t!==U.board?.projectDir?`in ${hm(t)}`:void 0;return[e,t?r:n!==void 0&&!e?.includes(String(n))?`session ${n}`:void 0].filter(Boolean).join(` · `)||void 0}function Bk(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.includes(`…`)}function Vk({detail:e,shown:t=e}){return t?e&&Bk(e)?(0,X.jsx)(`span`,{className:`min-w-0`,children:(0,X.jsx)(vm,{path:e,children:(0,X.jsx)(gm,{path:hm(e)})})}):(0,X.jsx)(`span`,{className:`frizz-tool-detail frizz-tool-detail--mono`,title:t,children:hm(t)}):null}function Hk({name:e,detail:t,count:n,status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,cwd:s,sessionId:c,durationMs:l,startedAt:u}){let d=zk(t,s,c);return(0,X.jsx)(`div`,{className:`frizz-bash`,title:d,"data-tool-node":um(r),children:(0,X.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,X.jsxs)(`span`,{className:cm,children:[(0,X.jsx)(Ik,{status:r,backgroundState:i,liveBackgroundState:a,startedAt:u}),(0,X.jsx)(`span`,{className:`frizz-bash-label shrink-0`,children:Tk(e)}),(0,X.jsx)(Vk,{detail:t,shown:d})]}),(0,X.jsxs)(`span`,{className:lm,children:[(0,X.jsx)(Lk,{status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,durationMs:l}),n>1&&(0,X.jsxs)(`span`,{className:`tabular-nums text-[11.5px] leading-none text-faint`,children:[`×`,n]}),(0,X.jsx)(_m,{shown:!1})]})]})})}function Uk({name:e,detail:t,outputImage:n,output:r,status:i,durationMs:a}){let[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(!1),u=(0,q.useId)(),d=Tk(e),f=t?hm(t):void 0;return(0,X.jsxs)(`div`,{"data-tool-image":!0,className:`frizz-bash`,"data-tool-node":um(i),children:[(0,X.jsxs)(mm,{className:`frizz-bash-header`,controls:u,expanded:o,label:`${o?`Collapse`:`Expand`} ${d}${t?`: ${t}`:``}`,onToggle:()=>s(e=>!e),meta:(0,X.jsx)(Lk,{status:i,durationMs:a}),children:[(0,X.jsx)(`span`,{className:`frizz-bash-label shrink-0`,children:d}),(0,X.jsx)(Vk,{detail:t})]}),(0,X.jsx)(`div`,{id:u,className:`frizz-tool-body`,hidden:!o,children:o&&(0,X.jsxs)(X.Fragment,{children:[c?(0,X.jsx)(`div`,{className:`frizz-bash-body break-all text-muted-70`,children:n}):(0,X.jsx)(`div`,{className:`flex justify-center bg-panel-2 p-1.5`,children:(0,X.jsx)(`img`,{src:Pe(n),alt:f?`${d}: ${f}`:d,"data-local-path":n,"data-local-image":`true`,onError:()=>l(!0),className:`cursor-zoom-in block max-h-[420px] max-w-full w-auto rounded-md object-contain`})}),r&&(0,X.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body`,children:r})]})})]})}function Wk({images:e,files:t,caption:n,status:r,durationMs:i}){let[a,o]=(0,q.useState)(!0),s=(0,q.useId)(),c=(0,q.useMemo)(()=>e.map(e=>({target:e,title:n??`Delivered image`})),[e,n]),l=[e.length?`${e.length} image${e.length===1?``:`s`}`:``,t.length?`${t.length} file${t.length===1?``:`s`}`:``].filter(Boolean).join(` · `);return(0,X.jsxs)(`div`,{className:`frizz-bash`,"data-tool-node":um(r),children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":s,"aria-expanded":a,"aria-label":`${a?`Collapse`:`Expand`} files sent to you${l?`: ${l}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-60`,children:[(0,X.jsxs)(`span`,{className:cm,children:[(0,X.jsx)(`span`,{className:`frizz-bash-label shrink-0`,children:`Sent to you`}),l&&(0,X.jsx)(`span`,{className:`frizz-tool-detail`,children:l})]}),(0,X.jsxs)(`span`,{className:lm,children:[(0,X.jsx)(Lk,{status:r,durationMs:i}),(0,X.jsx)(_m,{open:a})]})]}),(0,X.jsx)(`div`,{id:s,className:`frizz-tool-body`,hidden:!a,children:a&&(0,X.jsxs)(X.Fragment,{children:[e.length>0&&(0,X.jsx)(Yh,{entries:c,framed:!1}),(t.length>0||n)&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-2.5 pb-2.5 pt-1.5`,children:[t.length>0&&(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,X.jsx)(pA,{path:e},`f${t}`))}),n&&(0,X.jsx)(`div`,{className:`max-w-[65%] font-sans text-[12px] leading-snug text-muted`,children:n})]})]})})]})}var Gk=16;function Kk({command:e,desc:t,literalDesc:n,output:r,name:i=`Bash`,status:a,backgroundState:o,liveBackgroundState:s,exitCode:c,sessionId:l,durationMs:u,inputLabel:d,startedAt:f}){let[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(!1),y=(0,q.useId)(),b=Rk(a,f,u),x=(0,q.useMemo)(()=>e.split(`
|
|
132
|
+
`).length,[e]),S=x>Gk,C=(0,q.useMemo)(()=>r?r.split(`
|
|
133
|
+
`).length:0,[r]),w=C>Gk,T=zk(t,void 0,l),E=!!(e||r);return(0,X.jsxs)(`div`,{className:`frizz-bash`,"data-tool-node":um(a),children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>E&&m(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":E?y:void 0,"aria-expanded":E?p:void 0,"aria-label":`${E?`${p?`Collapse`:`Expand`} `:``}${Tk(i)}${T?`: ${T}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-60`,children:[(0,X.jsxs)(`span`,{className:cm,children:[(0,X.jsx)(Ik,{status:a,backgroundState:o,liveBackgroundState:s,startedAt:f}),(0,X.jsx)(`span`,{className:`frizz-bash-label shrink-0`,children:Tk(i)}),(0,X.jsx)(`span`,{className:`frizz-tool-detail${n?` frizz-tool-detail--mono`:``}`,title:T,children:T??``})]}),(0,X.jsxs)(`span`,{className:lm,children:[(0,X.jsx)(Lk,{status:a,backgroundState:o,liveBackgroundState:s,exitCode:c,durationMs:b}),(0,X.jsx)(_m,{shown:E,open:p})]})]}),E&&(0,X.jsxs)(`div`,{id:y,className:`frizz-tool-body`,hidden:!p,children:[p&&e&&(0,X.jsxs)(X.Fragment,{children:[d&&(0,X.jsx)(`div`,{className:`frizz-bash-output-label`,children:d}),(0,X.jsx)(Ag,{text:e,language:d?`plaintext`:`bash`,className:`frizz-bash-body${d?``:` frizz-bash-command`}${S&&!h?` frizz-bash-clamp`:``}`}),S&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>g(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand px-2.5 pb-1.5`,children:h?`Collapse`:`Show all ${x} lines`})]}),p&&r&&(0,X.jsxs)(X.Fragment,{children:[d&&(0,X.jsx)(`div`,{className:`frizz-bash-output-label`,children:`Output`}),(0,X.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body${w&&!_?` frizz-bash-clamp`:``}`,children:r}),w&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>v(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand px-2.5 pb-1.5`,children:_?`Collapse`:`Show all ${C} lines`})]})]})]})}var qk=16;function Jk({detail:e,read:t,status:n,durationMs:r}){let[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=(0,q.useId)(),l=(0,q.useMemo)(()=>t.split(`
|
|
134
|
+
`).length,[t]),u=l>qk;return(0,X.jsxs)(`div`,{className:`frizz-bash`,"data-tool-node":um(n),children:[(0,X.jsxs)(mm,{className:`frizz-bash-header`,controls:c,expanded:i,label:`${i?`Collapse`:`Expand`} Read${e?`: ${e}`:``}`,onToggle:()=>a(e=>!e),meta:(0,X.jsx)(Lk,{status:n,durationMs:r}),children:[(0,X.jsx)(`span`,{className:`frizz-bash-label shrink-0`,children:`Read`}),(0,X.jsx)(Vk,{detail:e})]}),(0,X.jsx)(`div`,{id:c,className:`frizz-tool-body`,hidden:!i,children:i&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ag,{text:t,language:oe(e),className:`frizz-bash-body${u&&!o?` frizz-bash-clamp`:``}`}),u&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand px-2.5 pb-1.5`,children:o?`Collapse`:`Show all ${l} lines`})]})})]})}var Yk=16;function Xk({detail:e,prompt:t,subagentType:n,agentId:r,agentStatus:i,agentElapsedMs:a,status:o,durationMs:s}){let[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1),f=(0,q.useId)(),p=t||`Initial prompt unavailable.`,m=(0,q.useMemo)(()=>p?p.split(`
|
|
135
|
+
`).length:0,[p]),h=m>Yk,g=EO(),_=Tt(g),v=!i&&r?(_?.subAgents??[]).find(e=>e.id===r):void 0,y=v?.state===`running`,b=!!(g&&r),x=e??`sub-agent`,S=Vi(n),C=Wo(),w=lD({agentStatus:i,agentElapsedMs:a,liveState:v?.state,liveElapsedMs:v?.startedAt?Math.max(C-Date.parse(v.startedAt),0):void 0,status:o,durationMs:s}),T=y?(0,X.jsx)(ut,{"aria-hidden":!0,hue:`agent`,"data-running-indicator":`subagent-disclosure`}):v?.state===`stale`?(0,X.jsx)(`span`,{className:N,title:Rn}):v?.state===`rested`?(0,X.jsx)(`span`,{className:nc,title:kn}):null;function E(){!g||!r||js(g,r,{label:x,subagentType:n,startedAt:v?.startedAt})}return(0,X.jsxs)(`div`,{className:`frizz-bash`,"data-tool-node":w?.tone===`failed`?`failed`:void 0,children:[(0,X.jsxs)(mm,{className:`frizz-bash-header`,controls:f,expanded:c,label:`${c?`Collapse`:`Expand`} Agent dispatch: ${x}`,onToggle:()=>l(e=>!e),meta:(S||w)&&(0,X.jsxs)(`span`,{className:`flex shrink-0 items-baseline gap-2.5`,children:[S&&(0,X.jsx)(`span`,{"data-subagent-profile":!0,className:`shrink-0 whitespace-nowrap text-[11.5px] leading-none text-faint phone:hidden`,title:`Sub-agent profile: ${S}`,children:S}),w&&(0,X.jsx)(Pk,{tone:w.tone===`failed`?`frizz-tool-failed`:`text-faint`,title:w.title,label:w.label,duration:w.duration})]}),children:[T&&(0,X.jsx)(`span`,{className:`frizz-tool-mark`,children:T}),(0,X.jsx)(`span`,{className:`frizz-bash-label shrink-0`,children:`Agent`}),b?(0,X.jsx)(`button`,{type:`button`,"aria-label":`Open sub-agent transcript: ${x}`,title:`Open sub-agent transcript`,onClick:E,className:`frizz-tool-detail frizz-tool-drill min-w-[4rem] flex-1 text-left outline-none`,children:x}):(0,X.jsx)(`span`,{className:`frizz-tool-detail min-w-[4rem] flex-1`,title:x,children:x})]}),(0,X.jsx)(`div`,{id:f,className:`frizz-tool-body`,hidden:!c,children:c&&(0,X.jsxs)(X.Fragment,{children:[p&&(0,X.jsx)(`pre`,{className:`frizz-bash-body frizz-tool-prose${h&&!u?` frizz-bash-clamp`:``}`,children:p}),h&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>d(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand px-2.5 pb-1.5`,children:u?`Collapse`:`Show all ${m} lines`})]})})]})}function Zk(e,t){return t===`shutdown_request`?`Shutdown`:t===`codex_followup`?`Followed up`:e===`main`?`Reported`:`Steered`}function Qk({to:e,summary:t,body:n,type:r,dispatchId:i,targetLabel:a,status:o,durationMs:s,at:c}){return(0,q.useContext)(X_)===null?(0,X.jsx)(eA,{to:e,summary:t,body:n,type:r,status:o,durationMs:s}):(0,X.jsx)(EA,{to:e,type:r,dispatchId:i,targetLabel:a,at:c})}var $k=16;function eA({to:e,summary:t,body:n,type:r,status:i,durationMs:a}){let[o,s]=(0,q.useState)(!t),[c,l]=(0,q.useState)(!1),u=(0,q.useId)(),d=Pp(n),f=(0,q.useMemo)(()=>n.split(`
|
|
136
|
+
`).length,[n]),p=f>$k,m=!!n.trim(),h=Zk(e,r);return(0,X.jsxs)(`div`,{className:`frizz-bash`,"data-tool-node":um(i),children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":m?u:void 0,"aria-expanded":m?o:void 0,"aria-label":`${m?`${o?`Collapse`:`Expand`} `:``}${h}${e?` to ${e}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-focus-ink-60`,disabled:!m,children:[(0,X.jsxs)(`span`,{className:cm,children:[(0,X.jsx)(`span`,{className:`frizz-bash-label shrink-0`,children:h}),t&&(0,X.jsx)(`span`,{className:`frizz-tool-detail`,children:t})]}),(0,X.jsxs)(`span`,{className:lm,children:[(0,X.jsx)(Lk,{status:i,durationMs:a}),(0,X.jsx)(_m,{shown:m,open:o})]})]}),m&&(0,X.jsx)(`div`,{id:u,className:`frizz-tool-body`,hidden:!o,children:o&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`px-2.5 py-2${p&&!c?` frizz-bash-clamp`:``}`,children:(0,X.jsx)(kg,{className:`md-body`,html:d})}),p&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand px-2.5 pb-1.5`,children:c?`Collapse`:`Show all ${f} lines`})]})})]})}function tA({body:e,items:t}){let[n,r]=(0,q.useState)(null),i=(0,q.useMemo)(()=>new Map(t.map(e=>[e.token,e])),[t]),a=n===null?void 0:i.get(n);return(0,X.jsxs)(X.Fragment,{children:[(0,q.useMemo)(()=>To(e,[...i.keys()]),[e,i]).map((e,t)=>{let a=e.token?i.get(e.token):void 0;if(!a)return(0,X.jsx)(av,{text:e.text},t);let o=n===a.token;return(0,X.jsx)(`button`,{type:`button`,title:a.display,"aria-expanded":o,onClick:e=>{e.stopPropagation(),r(o?null:a.token)},onKeyDown:e=>e.stopPropagation(),className:`inline-flex max-w-56 items-baseline rounded border px-1 align-baseline font-mono-keep text-[11px] leading-snug transition-colors ${o?`border-bg/40 bg-bg/15`:`border-bg/25 bg-bg/[0.08] hover:bg-bg/15`}`,children:(0,X.jsx)(`span`,{className:`truncate`,children:cs(a.token)})},t)}),a&&(0,X.jsxs)(`span`,{className:`mt-2 block cursor-auto rounded-md border border-bg/20 bg-bg/[0.06] px-2 py-1.5`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(`span`,{className:`block truncate font-mono-keep text-[11px] text-user-bubble-fg/60`,children:[a.display,a.startLine===void 0?``:` · ${a.startLine===a.endLine?`line ${a.startLine}`:`lines ${a.startLine}-${a.endLine}`}`]}),(0,X.jsx)(`span`,{className:`mt-1 block max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono-keep text-[11.5px] leading-4 text-user-bubble-fg/80`,children:a.text})]})]})}function nA({deliveryId:e,text:t,rawText:n,error:r}){let i=(0,q.useContext)(X_),{retry:a,edit:o,dismiss:s,pending:c}=Mw(i),l=`rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] font-medium text-fg/80 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60 disabled:opacity-45 disabled:hover:bg-panel-2/60 disabled:hover:text-fg/80`;return(0,X.jsxs)(`div`,{"data-failed-send":e,className:`mt-1 flex flex-col items-end gap-1.5`,children:[(0,X.jsxs)(`div`,{role:`alert`,className:`text-left text-[12px] leading-snug text-danger-soft [overflow-wrap:anywhere]`,children:[`Not delivered`,r?` — ${r.split(`
|
|
137
|
+
`,1)[0]}`:``]}),i&&(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,className:l,disabled:c,title:`Send this message again`,onClick:()=>a({deliveryId:e,text:n}),children:`Retry`}),(0,X.jsx)(`button`,{type:`button`,className:l,disabled:c,title:`Put this message back in the prompt box`,onClick:n=>o({deliveryId:e,text:t,from:n.currentTarget}),children:`Edit`}),(0,X.jsx)(`button`,{type:`button`,className:l,disabled:c,title:`Discard this message`,onClick:()=>s({deliveryId:e}),children:`Dismiss`})]})]})}function rA(){let e=(0,q.useContext)(X_),t=(0,q.useContext)(Q_),n=Yx(e),r=Jx(e),i=$x(e);if(!e||!t)return null;let a=Gx(t,n,r);if(!a)return r||t.held+t.steered===0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xy,{h:6}),(0,X.jsx)(`div`,{"data-queued-waits-for-turn":!0,className:`flex items-baseline justify-end text-[11.5px] leading-[16px] text-muted`,children:`Waits for this turn to end`})]});let o=t.held>1?`Send the next one now — the agent reads it at its next step`:`Send it now — the agent reads it at its next step`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xy,{h:6}),(0,X.jsx)(`div`,{"data-queued-send-now":a,className:`flex items-baseline justify-end text-[11.5px] leading-[16px] text-muted`,children:(0,X.jsxs)(`button`,{type:`button`,"data-send-now":!0,onMouseDown:e=>e.preventDefault(),onClick:()=>eS(e,t),disabled:i,"aria-keyshortcuts":`Meta+Enter Control+Enter`,title:`${a===`release`?o:`Send now — the worker reads the queue immediately, and a command it is running carries on in the background`} (⌘⏎)`,className:`relative flex cursor-pointer items-baseline outline-none transition-colors duration-50 before:absolute before:-inset-x-2 before:-inset-y-1 before:content-[''] hover:text-fg focus-visible:text-fg disabled:cursor-default disabled:opacity-50`,children:[i?(0,X.jsx)(de,{"aria-hidden":!0,className:`mr-1 size-[1em] shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)] animate-spin`,strokeWidth:2.4}):(0,X.jsx)(`span`,{"aria-hidden":!0,className:`mr-[0.44em] shrink-0`,children:(0,X.jsx)(`kbd`,{className:`send-now-key`,children:`⌘⏎`})}),(0,X.jsx)(`span`,{className:`underline decoration-border underline-offset-2`,children:`Send now`})]})})]})}function iA({m:e,answers:t,note:n}){let r=(t,n)=>{if(!t)return null;let i=n<2?Ga(t):null;if(i)return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ov,{answers:i,queued:e.queued}),r(me(t),n+1)]});let a=aA(t);return a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(pv,{rows:a.rows,queued:e.queued}),a.note&&(0,X.jsx)(oA,{text:a.note,rawText:e.text,queued:e.queued})]}):(0,X.jsx)(oA,{text:t,rawText:e.text,queued:e.queued})};return(0,X.jsxs)(`div`,{"data-frizz-msg":e.sourceId,"data-answers-with-note":!0,className:`flex w-full flex-col gap-2 self-end`,children:[(0,X.jsx)(ov,{answers:t,queued:e.queued}),r(n,0)]})}function aA(e){let t=Ho(e);return t&&t.rows.length>0?t:null}function oA({text:e,rawText:t,queued:n,held:r,deliveryUnconfirmed:i,deliveryFailed:a,deliveryError:o,deliveryId:s,sourceId:c}){let l=(0,q.useContext)(X_),u=Dw(l),{unqueue:d,pending:f}=jw(l),p=!!(n&&s&&l&&(u||r)),{prose:m,attachments:h}=(0,q.useMemo)(()=>Es(e),[e]),g=(0,q.useMemo)(()=>ti(m),[m]),_=(0,q.useMemo)(()=>kb(g?g.body:m),[g,m]),v=_?_.note:g?g.body:m;return(0,X.jsxs)(`div`,{"data-frizz-msg":c,className:`self-end flex flex-col items-end gap-0.5 max-w-[85%]`,children:[m.trim()!==``&&(0,X.jsxs)(`div`,{...p?{role:`button`,tabIndex:0,"data-unqueue":s,"aria-label":`Unqueue this message and put it back in the prompt box`,title:f?`Taking it back…`:void 0,onClick:n=>d({deliveryId:s,text:e,rawText:t??e,from:n.currentTarget}),onKeyDown:n=>{n.key!==`Enter`&&n.key!==` `||(n.preventDefault(),d({deliveryId:s,text:e,rawText:t??e,from:n.currentTarget}))}}:{},className:`relative rounded-xl rounded-br-sm bg-user-bubble px-3.5 py-3 text-[14px] whitespace-pre-wrap [overflow-wrap:anywhere] text-user-bubble-fg ${n||a?`opacity-50`:``} ${p?`cursor-pointer transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg`:``} ${f?`!opacity-30`:``}`,children:[v.trim()!==``&&(g?(0,X.jsx)(tA,{body:v,items:g.items}):(0,X.jsx)(av,{text:v})),_&&(0,X.jsx)(vx,{items:_.items,divided:v.trim()!==``})]}),h.length>0&&(0,X.jsxs)(`div`,{className:`mt-1 flex flex-col items-end gap-1.5`,children:[h.filter(e=>e.kind===`image`).map((e,t)=>(0,X.jsx)(fA,{path:e.path,hideCaption:!0},`i${t}-${e.path}`)),h.some(e=>e.kind===`file`)&&(0,X.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:h.filter(e=>e.kind===`file`).map((e,t)=>(0,X.jsx)(pA,{path:e.path},`f${t}-${e.path}`))})]}),i&&(0,X.jsx)(`div`,{className:`text-[11px] text-attention-80`,children:`Delivery unconfirmed — no receipt from the worker`}),a&&s&&(0,X.jsx)(nA,{deliveryId:s,text:e,rawText:t??e,error:o}),p&&f&&(0,X.jsx)(`div`,{"aria-hidden":!0,className:`h-0 overflow-visible text-[11px] text-muted`,children:`Taking it back…`})]})}function sA({m:e,index:t,showSendButton:n}){let r=JC(),[i,a]=r.hidesAwaiting(t);return(0,X.jsx)(cA,{m:e,showSendButton:n,answering:r.fencesLive?r.answeringForMessage(e):void 0,paired:r.paired[t],staleAwaiting:i,doneLive:t===r.doneIdx,restingCardShown:a,stepsDone:r.stepsDone.get(t),shadowedBy:r.shadowedByMessage.get(t),placed:r.placement.placed.get(t),settledPlaced:r.settledPlacement.placed.get(t),fenceQuestions:r.fenceQuestions})}var cA=(0,q.memo)(function(e){return(0,X.jsx)(`div`,{title:(e.m.queued?null:zy(e.m.at))??void 0,className:`contents`,children:(0,X.jsx)(uA,{...e})})});function lA({error:e}){let t=(0,q.useContext)(X_);return(0,X.jsx)(Jg,{error:e,provider:(0,q.useSyncExternalStore)(e=>Ai(U,e),()=>{let e=t?Xr(U.board,t):void 0;return fe(e?.backend,e?.model)},()=>`Agent`)})}function uA({m:e,answering:t,paired:n,showSendButton:r,staleAwaiting:i,doneLive:a,shadowedBy:o,placed:s,settledPlaced:c,fenceQuestions:l,restingCardShown:u,stepsDone:d}){let f=Be(),[p,m]=(0,q.useState)(!1),h=Y_();if(e.providerError)return(0,X.jsx)(lA,{error:e.providerError});if(e.kind===`event`)return(0,X.jsx)(DA,{text:e.text,boundary:e.boundary,sourceId:e.sourceId,at:e.at});if(e.kind===`reasoning`)return(0,X.jsx)(OA,{text:e.text,sourceId:e.sourceId});let g=iD(e);if(g)return(0,X.jsx)(wA,{call:g,sourceId:e.sourceId,at:e.at});if(e.role===`user`){let t=Zs(e).replace(/\r\n?/g,`
|
|
138
|
+
`),r=n===void 0?Ga(t):n;if(e.deliveryState!==`failed`&&({text:t,answers:r}=Mt(t,r)),r&&e.deliveryState!==`failed`){let n=me(t);return!n&&e.deliveryState!==`held`?(0,X.jsx)(ov,{answers:r,queued:e.queued,sourceId:e.sourceId}):(0,X.jsx)(iA,{m:e,answers:r,note:n})}let i=e.deliveryState===`failed`?null:aA(t);return i&&!i.note?(0,X.jsx)(pv,{rows:i.rows,queued:e.queued,sourceId:e.sourceId}):i?(0,X.jsxs)(`div`,{"data-frizz-msg":e.sourceId,className:`flex w-full flex-col gap-2 self-end`,children:[(0,X.jsx)(pv,{rows:i.rows,queued:e.queued}),(0,X.jsx)(oA,{text:i.note,rawText:e.text,queued:e.queued})]}):e.wake?(0,X.jsx)($y,{steer:e.wakeSteer,text:t,sourceId:e.sourceId,at:e.at}):e.sessionPeer?(0,X.jsx)(Rw,{peer:e.sessionPeer,text:t,queued:e.queued,sourceId:e.sourceId,at:e.at}):e.peerFrom?(0,X.jsx)(TA,{from:e.peerFrom,unnamed:e.peerUnnamed,dispatchId:e.peerDispatchId,sourceId:e.sourceId,at:e.at}):(0,X.jsx)(oA,{text:t,rawText:e.text,queued:e.queued,held:e.deliveryState===`held`,deliveryUnconfirmed:e.deliveryState===`unconfirmed`,deliveryFailed:e.deliveryState===`failed`,deliveryError:e.deliveryError,deliveryId:e.deliveryId,sourceId:e.sourceId})}let _=[],v=[],y=(e,t=xk)=>{_.push(e),v.push(t)},b={n:-1},x=[],S=new Set,C,w=()=>C??=new Set(on(e.text,e.refusedFences)),T=(n,r)=>{for(let[p,m]of Rg(n).entries()){if(m.kind===`fence`){if(m.fenceKind===`awaiting`&&i&&!e.fenceRefused&&!u&&mk(m.hints)){y((0,X.jsx)(Py,{fence:{body:m.body,hints:m.hints},stepsDone:d},`${r}-f${p}`));continue}if(m.fenceKind===`awaiting`&&i&&!e.fenceRefused&&!u&&e.keptSignOff){if(e.keptSignOff===`earlier`||mt(m.hints)||gk(m.hints)){let e=Jo(m.body);e&&y((0,X.jsx)(dA,{md:e},`${r}-f${p}`))}else y((0,X.jsx)(Py,{fence:{body:m.body,hints:m.hints}},`${r}-f${p}`));continue}if(m.fenceKind===`awaiting`&&(e.fenceRefused||i||u))continue;if(m.fenceKind===`awaiting`&&mt(m.hints)){let e=Jo(m.body);e&&y((0,X.jsx)(dA,{md:e},`${r}-f${p}`));continue}y((0,X.jsx)(vA,{fenceKind:m.fenceKind,body:m.body,hints:m.hints,pastRest:a===void 0?i:!a},`${r}-f${p}`));continue}for(let[n,i]of wc(m.text,l!==void 0,e.refusedFences).entries()){if(i.kind===`prose`){for(let[e,t]of ki(i.text).entries()){let i=`${r}-${p}-p${n}-${e}`;y(t.kind===`image`?(0,X.jsx)(fA,{path:t.path},i):t.kind===`file`?(0,X.jsx)(pA,{path:t.path},i):t.kind===`visualization`?(0,X.jsx)(gA,{file:t.file},i):t.kind===`directive`?(0,X.jsx)(wh,{directive:t.directive},i):t.kind===`mermaid`?(0,X.jsx)(kh,{source:t.source},i):t.kind===`lightbox`?(0,X.jsx)(Yh,{entries:t.entries},i):(0,X.jsx)(dA,{md:t.text},i))}continue}if(i.kind===`refusedRef`){let t=d_(i.id,l??[],e.questionOwners)?.closed;y((0,X.jsx)(RC,{id:i.id,closed:t},`${r}-${p}-r${n}`));continue}if(i.kind===`refusedAsk`){y((0,X.jsx)(FC,{spec:i.spec,reasons:e.refusedReasons?.get(i.id.toLowerCase())},`${r}-${p}-x${n}`));continue}if(i.kind===`invalidFence`){y(i.draft?(0,X.jsx)(FC,{spec:i.draft,reasons:i.faults,unread:!0},`${r}-${p}-i${n}`):(0,X.jsx)(IC,{faults:i.faults,children:(0,X.jsx)(dA,{md:`<details>\n<summary>What the worker wrote</summary>\n\n${i.text}\n\n</details>`})},`${r}-${p}-i${n}`));continue}b.n+=1;let a=b.n;if(i.fence){let t=i.fence.form===`ask`?i.fence.when:void 0;if(t&&!w().has(t.parent.toLowerCase()))continue;let a=d_(t?t.parent:i.fence.id,l??[],e.questionOwners);if(a&&S.has(a.id))continue;if(a?.closed){let e=i.fence.form===`ask`&&!t?i.fence.spec:void 0,o=e??a.asked;o&&(S.add(a.id),y((0,X.jsx)(NC,{spec:o,state:a.closed,copyOf:e?void 0:a.id},`${r}-${p}-q${n}`)));continue}if(a){S.add(a.id);let e=s?.find(e=>e.id===a.id);if(e){y((0,X.jsx)(BC,{q:e},`${r}-${p}-q${n}`));continue}let t=c?.find(e=>e.id===a.id);if(t){y((0,X.jsx)(TC,{s:t},`${r}-${p}-q${n}`));continue}let i=DC(a);y(i?(0,X.jsx)(TC,{s:i,copy:!0},`${r}-${p}-q${n}`):(0,X.jsx)(BC,{q:a},`${r}-${p}-q${n}`));continue}i.fence.form===`ask`&&!t&&!S.has(`fence:${i.fence.id}`)&&(S.add(`fence:${i.fence.id}`),y((0,X.jsx)(MC,{spec:i.fence.spec},`${r}-${p}-q${n}`)));continue}let u=s&&i.registeredId?s.find(e=>e.id.toLowerCase()===i.registeredId):void 0;if(u&&!S.has(u.id)){S.add(u.id),y((0,X.jsx)(BC,{q:u},`${r}-${p}-q${n}`));continue}if(o&&l_(i,o)!==void 0)continue;let d=c&&i.registeredId?c.find(e=>e.id.toLowerCase()===i.registeredId):void 0;if(d&&!S.has(d.id)){S.add(d.id),y((0,X.jsx)(TC,{s:d},`${r}-${p}-q${n}`));continue}if(i.registeredId&&i.text.trim()===``)continue;t&&x.push({raw:i.text,kind:i.questionKind,danger:i.danger,bi:a});let m=t&&!f?{answer:t.answerFor(a),onChip:(e,n)=>t.onChip(a,e,n),onText:e=>t.onText(a,e),onSubmit:t.onSubmit}:void 0;y((0,X.jsx)(eC,{raw:i.text,questionKind:i.questionKind,danger:i.danger,interactive:m},`${r}-${p}-q${n}`))}}};if(e.parts&&e.parts.length>0)yk(e.parts).forEach((t,n)=>{if(t.kind===`tools`){let r=wk(t.tools);r.length&&y((0,X.jsx)(jk,{tools:r,at:e.at},`t${n}`),Ck(r))}else T(t.text,`x${n}`)});else{let t=wk(e.tools);t.length>0&&y((0,X.jsx)(jk,{tools:t,at:e.at},`tools`),Ck(t)),T(e.text,`leg`)}return _.length===0?null:(r&&t&&f&&x.length>0?y((0,X.jsx)(`div`,{className:`flex justify-start`,children:(0,X.jsx)(`button`,{type:`button`,"data-mobile-answer-open":!0,onClick:()=>m(!0),className:`button-outline flex h-[40px] items-center justify-center rounded-[12px] bg-accent-fill px-4 text-[15px] font-semibold text-on-accent active:brightness-90`,children:x.length>1?`Answer ${x.length} questions`:`Answer`})},`answer-open`)):r&&t&&x.length>0&&!h&&y((0,X.jsx)(`div`,{className:`flex justify-start`,children:(0,X.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:!t.anyAnswered||t.sending,onClick:t.onSubmit,onMouseDown:e=>e.preventDefault(),className:`button-outline rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-all hover:opacity-90 active:scale-95 disabled:opacity-30 disabled:hover:opacity-30`,children:`Send answers`})},`send-answers`)),(0,X.jsxs)(`div`,{"data-frizz-msg":e.sourceId,"data-commentable":``,className:`flex flex-col text-[13px] min-w-0`,children:[bk(_,Sk(v,14)),p&&t&&x.length>0?(0,X.jsx)(ew,{blocks:x,answering:t,onClose:()=>m(!1)}):null]}))}function dA({md:e,wrap:t}){let n=Pp(e);return n?(0,X.jsx)(kg,{className:`md-body${t?` ${Hm}`:``}`,html:n}):null}function fA({path:e,hideCaption:t,altText:n}){let[r,i]=(0,q.useState)(!1);if(r)return(0,X.jsx)(`div`,{className:`font-mono-keep text-[12px] text-muted-70 break-all`,children:e});let a=ac(e);return(0,X.jsx)(Jf,{caption:t?void 0:(0,X.jsx)(`figcaption`,{className:`bg-panel-2 px-2 pb-1.5 font-mono-keep text-[11px] text-muted-60 break-all`,children:a}),children:(0,X.jsx)(`img`,{src:Pe(e),alt:n??a,"data-local-path":e,"data-local-image":`true`,onError:()=>i(!0),className:`cursor-zoom-in ${Zf}`})})}function pA({path:e}){let t=ac(e);return(0,X.jsxs)(`button`,{type:`button`,className:`local-file-action inline-flex max-w-full items-center gap-1.5 ${Um} border border-border bg-panel-2 px-3 py-1.5 text-left align-top no-underline hover:border-accent`,"data-local-path":e,draggable:!0,title:e,children:[(0,X.jsx)(Rt,{size:14,strokeWidth:2,className:`shrink-0 text-muted`}),(0,X.jsx)(`span`,{className:`font-mono-keep truncate text-[12px] text-fg`,children:t})]})}var mA={"--background":`--color-bg`,"--foreground":`--color-fg`,"--card":`--color-panel-2`,"--card-foreground":`--color-fg`,"--popover":`--color-elevated`,"--popover-foreground":`--color-fg`,"--primary":`--color-fg`,"--primary-foreground":`--color-bg`,"--secondary":`--color-panel-2`,"--secondary-foreground":`--color-fg`,"--muted":`--color-panel-2`,"--muted-foreground":`--color-muted`,"--accent":`--color-border-strong`,"--accent-foreground":`--color-fg`,"--border":`--color-border-strong`,"--input":`--color-control-strong`,"--ring":`--color-accent`,"--destructive":`--viz-destructive`,"--viz-series-1":`--viz-series-1`,"--viz-series-2":`--viz-series-2`,"--viz-series-3":`--viz-series-3`,"--viz-series-4":`--viz-series-4`,"--viz-series-5":`--viz-series-5`,"--viz-series-6":`--viz-series-6`};function hA(e){let t=getComputedStyle(document.documentElement),n=Object.fromEntries(Object.entries(mA).map(([e,n])=>[e,t.getPropertyValue(n).trim()]));return n[`--font-size-base`]=getComputedStyle(document.body).fontSize,Yw(e,t.colorScheme===`light`?`light`:`dark`,n)}function gA({file:e}){let t=(0,q.useContext)(X_),n=(0,q.useRef)(null),[r,i]=(0,q.useState)(360),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(null),l=(0,q.useRef)(void 0),u=(0,q.useRef)(0),d=(0,q.useRef)(null),{resolved:f}=(0,q.useSyncExternalStore)(Zt,Nt,Nt),p=t?ar(t):null,m=t?`${p?qo(p.project):Xn()}/local-visualization?slug=${encodeURIComponent(p?.slug??t)}&file=${encodeURIComponent(e)}`:null;(0,q.useEffect)(()=>{if(!m){o(!1);return}let e=new AbortController;return o(null),c(null),d.current=null,window.clearTimeout(l.current),fetch(m,{method:`HEAD`,signal:e.signal}).then(t=>{e.signal.aborted||o(t.ok)}).catch(()=>{e.signal.aborted||o(!1)}),()=>e.abort()},[m]);let h=(0,q.useCallback)(()=>{if(!m||d.current!==m)return;let e=++u.current;n.current?.contentWindow?.postMessage(hA(e),`*`)},[m]);return(0,q.useEffect)(()=>{let e=e=>{if(e.source!==n.current?.contentWindow)return;if(e.data?.type===`frizz-inline-vis-ready`){h();return}if(Xw(e.data,u.current)&&m&&d.current===m){window.clearTimeout(l.current),c(m);return}if(e.data?.type!==`frizz-inline-vis-height`)return;let t=Number(e.data.height);Number.isFinite(t)&&i(Math.max(80,Math.min(2400,Math.ceil(t))))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[h,m]),(0,q.useEffect)(()=>{h()},[f,h]),(0,q.useEffect)(()=>()=>window.clearTimeout(l.current),[]),a===!1||!m?(0,X.jsxs)(`div`,{role:`status`,className:`${Um} border border-border bg-panel-2 px-4 py-2.5 text-[12px] text-muted`,children:[`Visualization unavailable: `,(0,X.jsx)(`span`,{className:`font-mono-keep break-all`,children:e})]}):a===null?(0,X.jsx)(`div`,{role:`status`,className:`h-20 animate-pulse ${Um} bg-panel-2`,"aria-label":`Loading ${e}`}):(0,X.jsx)(`iframe`,{ref:n,src:m,title:e.replace(/\.html$/,``).replaceAll(`-`,` `),sandbox:`allow-scripts`,onLoad:()=>{m&&(c(null),d.current=m,h(),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o(!1),5e3))},className:`block w-full border-0 bg-transparent`,style:{height:r,visibility:s===m?`visible`:`hidden`}})}function _A(e,t,n){return e?.kind===`awaiting`&&e.body===t&&JSON.stringify(e.hints)===JSON.stringify(n)}function vA({fenceKind:e,body:t,hints:n,pastRest:r}){let i=Pp(t),a=(0,q.useContext)(X_),o=(0,q.useContext)(Z_),s=Tt(a),c=s?sn(s):void 0,l=!!(s&&c?.archive),u=(0,q.useRef)(null);l&&s&&(u.current=s);let d=l&&s?s:u.current,f=Be();if(e===`done`){let e=wo(n),t=d&&!f&&!r?(0,X.jsx)(ih,{children:(0,X.jsx)(mE,{thread:d,className:`${ch} text-[11px] ${sh}`,iconClassName:B_,onArchived:o?.dismiss,onDismissCancel:o?.cancel})}):null;return(0,X.jsx)(nh,{icon:dt,kind:`Done`,label:e?(0,X.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e}):null,ruled:!!i,children:i||t?(0,X.jsxs)(X.Fragment,{children:[i&&(0,X.jsx)(kg,{className:`md-body`,html:i}),t]}):null})}return s&&ky(s)&&_A(s.lastFence,t,n)?null:(0,X.jsx)(Py,{thread:s,fence:{body:t,hints:n}})}function yA({slug:e,sessionId:t,fault:n,retryText:r}){let[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=oo(),l=Ys[n.backend],u=t=>{s(!0),Vr(c,e,t,{onSuccess:()=>{s(!1),K(`Retrying with the previous message…`)},onRollback:()=>s(!1),failureToast:e=>`Retry failed: ${e.slice(0,80)}`})||s(!1)};return(0,X.jsxs)(nh,{"data-provider-fault":!0,tone:`danger`,icon:Uc,label:`${l} sign-in required`,children:[(0,X.jsx)(`span`,{className:rh,children:`The provider rejected this session's credential. Sign in, then retry.`}),(0,X.jsxs)(ih,{children:[r?.trim()&&(0,X.jsx)(`button`,{onClick:()=>u(r),disabled:o,onMouseDown:e=>e.preventDefault(),className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-60`,children:`Retry`}),(0,X.jsx)(`button`,{onClick:()=>a(!0),onMouseDown:e=>e.preventDefault(),className:lh,children:`Sign in`})]}),i&&(0,X.jsx)(Ro,{backend:n.backend,onClose:()=>a(!1),onAuthed:()=>a(!1)})]})}function bA({slug:e,sessionId:t,pause:n}){let r=n.backend===`acp`?`The agent`:n.backend===`opencode`?`OpenCode`:n.backend===`antigravity`?`Antigravity`:Ys[n.backend],i=n.window===`weekly`?`weekly limit`:n.window===`session`?`5-hour limit`:`usage limit`,[a,o]=(0,q.useState)(!1),s=oo();return(0,X.jsxs)(nh,{"data-limit-pause":!0,tone:`caution`,icon:ie,label:`Paused by the ${r} ${i}`,children:[(0,X.jsx)(`span`,{className:rh,children:n.autoResume?n.resumesAt?`Continuing automatically at ${Kn(n.resumesAt)}.`:`Continuing automatically once the window resets.`:`Continue it whenever you have capacity again.`}),(0,X.jsx)(ih,{children:(0,X.jsx)(`button`,{onClick:()=>{o(!0),Vr(s,e,`Continue exactly where you left off.`,{onSuccess:()=>{o(!1),K(`Continuing…`)},onRollback:()=>o(!1),failureToast:e=>`Continue failed: ${e.slice(0,80)}`})||o(!1)},disabled:a,onMouseDown:e=>e.preventDefault(),className:`disabled:opacity-45 ${lh}`,children:`Continue now`})})]})}function xA({policy:e,denies:t}){let n=[e.tool,e.command].filter(Boolean).join(`: `);return(0,X.jsxs)(nh,{tone:`caution`,icon:fc,label:`Blocked by frizz's permission policy`,children:[n?(0,X.jsx)(`code`,{className:`mb-1.5 block min-w-0 break-all rounded bg-panel px-1.5 py-1 text-[11px] text-fg/85`,children:n}):null,(0,X.jsx)(`span`,{className:rh,children:e.reason}),(0,X.jsxs)(`span`,{className:`mt-1.5 block text-[11px] text-muted`,children:[`Rule `,(0,X.jsx)(`code`,{className:`rounded bg-panel px-1 py-0.5`,children:e.rule}),t&&t>1?` · ${t} denials this session`:``]})]})}function SA({slug:e,className:t=`px-4 pb-2 pt-1`,includeAgents:n=!0,only:r,transcriptShells:i=[],parentAgentId:a,density:o=`sheet`}){let s=Tt(e),c=s?.subAgents??[],l=n?a?tn(c,a):c:[],u=s&&!a?I_(s,i):void 0,d=r&&r!==`shell`?[]:a?[...i]:u?.shells??[],f=!u||r&&r!==`pr`&&r!==`issue`?[]:r===`pr`?u.prs:r===`issue`?u.issues:[...u.prs,...u.issues],p=u?r===`file`?u.files:r===`link`?u.links:r?[]:s?.links??[]:[],m=l.length+d.length+f.length,h=R_(s),[,g]=(0,q.useState)(0);(0,q.useEffect)(()=>{if(m===0)return;let e=setInterval(()=>g(e=>e+1),3e4);return()=>clearInterval(e)},[m]);let _=$s(e,d.flatMap(e=>e.id&&!e.outputUnavailable?[e.id]:[]));return m===0&&p.length===0?null:(0,X.jsxs)(`div`,{className:`flex flex-col ${o===`panel`?``:`gap-0.5`} ${t}`,"data-background-ops":!0,children:[bc(l,`sheet`).map((t,n)=>(0,X.jsx)(Io,{kind:`AGENT`,label:t.label,state:t.state,density:o,depth:t.displayDepth??t.depth,startedAt:t.startedAt,onOpen:t.id?()=>js(e,t.id,{label:t.label,subagentType:t.subagentType,startedAt:t.startedAt}):void 0,onDismiss:Do(e,t)},`a${n}`)),bc(d,`sheet`).map((t,n)=>(0,X.jsx)(Io,{kind:`SHELL`,label:t.label,state:t.state,density:o,startedAt:t.startedAt,counter:t.id?(t.monitor?yt:bn)(_.get(t.id)):void 0,counterTitle:t.monitor?`Events delivered so far — open the row to read them`:`Lines of output so far — open the row to read them`,onOpen:t.id&&!t.outputUnavailable?()=>fs(e,t.id,{label:t.label,startedAt:t.startedAt,monitor:t.monitor}):void 0,onDismiss:Do(e,t,`SHELL`),title:h(t)?`${t.label}\n${z_}`:void 0},`s${n}`)),f.map(e=>(0,X.jsx)(Io,{kind:`GITHUB`,label:e.target,state:`running`,density:o,startedAt:e.createdAt,counter:e.subject===`issue`?ye(e.issue):Lt(e.github),counterTone:e.github?.checks===`failing`&&!Wr(e.github,Date.now())?`danger`:void 0,counterTitle:e.subject===`issue`?e.issue?`${e.target} — ${iy(e.issue)}`:void 0:e.github?`${e.target} — ${Kv(e.github)}`:void 0,onOpen:()=>window.open(Mr(e.target,e.subject===`issue`?`issue`:`pull`)??`https://github.com/${e.target.replace(`#`,e.subject===`issue`?`/issues/`:`/pull/`)}`,`_blank`,`noreferrer,noopener`),ghRef:Mr(e.target,`issue`)?e.target:void 0},e.id)),(0,X.jsx)(hD,{links:p,panel:o===`panel`})]})}function CA({ask:e}){return(0,X.jsx)(nh,{tone:`attention`,icon:xc,label:`Waiting on your answer — in your external terminal`,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.header&&(0,X.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted-55`,children:e.header}),(0,X.jsx)(`div`,{className:`min-w-0 text-[12px] font-medium leading-5 text-fg`,children:e.question}),e.options.length>0&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.options.map((e,t)=>(0,X.jsxs)(`div`,{className:`rounded-md border border-border bg-elevated px-3 py-1.5 text-[12px] text-fg/80`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg/90`,children:e.label}),e.description&&(0,X.jsxs)(`span`,{className:`text-muted-70`,children:[` — `,e.description]})]},t)),e.multiSelect&&(0,X.jsx)(`div`,{className:`text-[10px] text-muted-50`,children:`select one or more`})]})]},t))})})}function wA({call:e,sourceId:t,at:n}){let r=EO(),i=e.detail??`sub-agent`,{outcome:a,tail:o}=oD(e),s=o.slice(a.length).trim(),c=!!(r&&e.agentId);return(0,X.jsxs)(Q,{icon:kc,sourceId:t,marker:`agent`,ariaLabel:c?void 0:`Sub-agent ${i} ${o}`,at:n,children:[(0,X.jsx)(`span`,{className:`shrink-0 ${Hy}`,children:`Sub-agent`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`«`}),c?(0,X.jsx)(`button`,{type:`button`,"data-subagent-completion-open":!0,title:di.AGENT,"aria-label":`${di.AGENT}: ${i}`,onClick:()=>js(r,e.agentId,{label:i,subagentType:e.subagentType}),onMouseDown:e=>e.preventDefault(),className:`min-w-0 truncate rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:i}):(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`»`})]}),(0,X.jsx)(`span`,{className:`shrink-0`,children:a}),s&&(0,X.jsx)(`span`,{className:`shrink-0 @max-[34rem]/wake:hidden`,children:s})]})}function TA({from:e,unnamed:t,dispatchId:n,sourceId:r,at:i}){let a=EO(),o=!!(a&&n),s=t?void 0:e,c=t&&e?`${di.AGENT} — ${e}`:di.AGENT;return s===void 0?(0,X.jsx)(Q,{icon:kc,sourceId:r,marker:`agent-report`,ariaLabel:o?void 0:`Sub-agent reported`,at:i,children:o?(0,X.jsx)(`button`,{type:`button`,"data-subagent-report-open":!0,title:c,"aria-label":`${di.AGENT}${e?`: ${e}`:``}`,onClick:()=>js(a,n,{label:`Sub-agent`,subagentType:e}),onMouseDown:e=>e.preventDefault(),className:`shrink-0 rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:`Sub-agent reported`}):(0,X.jsx)(`span`,{className:`shrink-0`,title:e||void 0,children:`Sub-agent reported`})}):(0,X.jsxs)(Q,{icon:kc,sourceId:r,marker:`agent-report`,ariaLabel:o?void 0:`Sub-agent ${s} reported`,at:i,children:[(0,X.jsx)(`span`,{className:`shrink-0 ${Hy}`,children:`Sub-agent`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`«`}),o?(0,X.jsx)(`button`,{type:`button`,"data-subagent-report-open":!0,title:di.AGENT,"aria-label":`${di.AGENT}: ${s}`,onClick:()=>js(a,n,{label:s,subagentType:e}),onMouseDown:e=>e.preventDefault(),className:`min-w-0 truncate rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:s}):(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`»`})]}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`reported`})]})}function EA({to:e,type:t,dispatchId:n,targetLabel:r,sourceId:i,at:a}){let o=EO(),s=Zk(e,t),c=e===`main`?void 0:r??e,l=!!(o&&n);return(0,X.jsxs)(Q,{icon:kc,sourceId:i,marker:`agent-steer`,ariaLabel:l?void 0:`${s}${c?` ${c}`:``}`,at:a,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:s}),c&&(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`«`}),l?(0,X.jsx)(`button`,{type:`button`,"data-subagent-steer-open":!0,title:di.AGENT,"aria-label":`${di.AGENT}: ${c}`,onClick:()=>js(o,n,{label:c}),onMouseDown:e=>e.preventDefault(),className:`min-w-0 truncate rounded-sm underline decoration-muted/30 underline-offset-2 outline-none transition-colors hover:text-fg hover:decoration-fg/60 focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:c}):(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:c}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`»`})]})]})}function DA({text:e,boundary:t,sourceId:n,at:r}){if(t){let i=t===`wake`?/^([^«]+?) «(.+)» ([^»(]+?)(?: (\([^»]*\)))?$/.exec(e):null;return(0,X.jsx)(Q,{icon:t===`wake`?ll:void 0,sourceId:n,marker:t===`rest`?`rest`:`event`,ariaLabel:e,at:r,children:i?(0,X.jsx)(Ky,{lead:i[1],title:i[2],tail:i[3],note:i[4]}):(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e})})}return(0,X.jsx)(`div`,{"data-frizz-msg":n,className:gD,children:e})}function OA({text:e,sourceId:t}){let[n,r]=(0,q.useState)(!1),i=(0,q.useId)();return(0,X.jsxs)(`div`,{"data-frizz-msg":t,className:`flex flex-col`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":i,"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} model reasoning`,className:`${gD} flex items-baseline gap-1.5 self-start rounded outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:[(0,X.jsx)(`span`,{children:`Reasoning`}),(0,X.jsx)(fr,{"aria-hidden":`true`,size:13,className:vD(n)})]}),n&&(0,X.jsx)(`div`,{id:i,className:`frizz-reasoning mt-1.5 ml-[5px] border-l border-border/70 pl-3`,children:(0,X.jsx)(dA,{md:e,wrap:!0})})]})}function kA(){return(0,X.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full border border-muted/70 border-t-transparent animate-spin`})}function AA({since:e,startedAt:t,activityLabel:n,run:r}){let[i]=(0,q.useState)(()=>Date.now()),a=(0,q.useMemo)(()=>{for(let n of[t,e]){let e=Date.parse(n??``);if(Number.isFinite(e)&&e<=Date.now())return e}return i},[t,e,i]),[o,s]=(0,q.useState)(()=>Date.now()),[c,l]=(0,q.useState)(!1),u=(0,q.useId)();(0,q.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]);let d=C(Math.max(0,o-a)),f=(0,q.useMemo)(()=>wk([...r?.tools??[]]),[r]),p=f.reduce((e,t)=>e+t.count,0),m=p>0,h=`group flex min-w-0 items-baseline justify-between gap-3 rounded text-left outline-none focus-visible:ring-1 focus-visible:ring-focus-ink-60 pointer-coarse:-my-1.5 pointer-coarse:py-1.5 ${gD}`,g=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate shimmer-text`,children:n??fo(p)}),m&&(0,X.jsx)(fr,{"data-working-chevron":!0,"aria-hidden":`true`,size:13,className:vD(c)})]}),(0,X.jsx)(`span`,{className:`shrink-0 whitespace-nowrap tabular-nums text-[12px] leading-none text-muted-60`,children:d})]});return(0,X.jsxs)(`div`,{"data-working-indicator":!0,"data-working-activity":n?`tool`:`generic`,className:`flex min-w-0 flex-col`,children:[m?(0,X.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":u,"aria-expanded":c,"aria-label":`${c?`Collapse`:`Expand`} ${p} tool ${p===1?`call`:`calls`}${n?`: ${n}`:``}`,className:`${h} w-full`,children:g}):(0,X.jsx)(`div`,{className:h,children:g}),m&&c&&(0,X.jsx)(`div`,{id:u,className:`mt-1.5 flex flex-col`,children:(0,X.jsx)(Ak,{tools:f,at:r?.at})}),m&&!c&&(0,X.jsx)(`div`,{id:u,hidden:!0})]})}function jA({label:e,stopping:t,onStop:n,...r}){return(0,X.jsx)(Bs,{label:e,children:(0,X.jsx)(`button`,{type:`button`,...r,"aria-label":e,disabled:t,onClick:n,onMouseDown:e=>e.preventDefault(),className:`${xi} relative pointer-coarse:after:absolute pointer-coarse:after:-inset-2 pointer-coarse:[&>svg]:size-[18px]`,children:t?(0,X.jsx)(de,{size:14,className:`animate-spin`}):(0,X.jsx)(dt,{size:15,strokeWidth:2})})})}function MA({id:e,slug:t,subId:n,label:r,subagentType:i,startedAt:a,depth:o,widthDepth:s}){let[c,l]=(0,q.useState)(!1),u=(0,q.useRef)(null),[d,p]=(0,q.useState)(!1),m=oo(),h=f(t,n),g=za(),_=(0,q.useMemo)(()=>h.data?.messages??[],[h.data]),v=h.data?.state,y=v===`running`,b=(0,q.useMemo)(()=>_S(_),[_]),x=(0,q.useMemo)(()=>vS(_),[_]),S=(0,q.useMemo)(()=>is(x),[x]),C=y?Ms(S):void 0,w=y?Fi(S):void 0,T=w?va(w,g):void 0,E=y?to(S):void 0,D=(0,q.useMemo)(()=>y?oi(S):S,[S,y]),O=y,k=h.isError||v===`gone`||_.length===0&&(v===`done`||v===`stale`);(0,q.useEffect)(()=>{let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>l(!0))});return()=>{cancelAnimationFrame(t),e&&cancelAnimationFrame(e)}},[]);let[A,j]=(0,q.useState)(null),M=(0,q.useRef)(!0);(0,q.useLayoutEffect)(()=>{let e=u.current;e&&A&&M.current&&e.scrollHeight-e.scrollTop-e.clientHeight>.5&&(e.scrollTop=e.scrollHeight)}),(0,q.useLayoutEffect)(()=>{let e=u.current;if(!e||!A)return;M.current=!0;let t=()=>{M.current&&(e.scrollTop=e.scrollHeight)},n=()=>{M.current=e.scrollHeight-e.scrollTop-e.clientHeight<160};e.addEventListener(`scroll`,n,{passive:!0});let r=new ResizeObserver(t);return r.observe(A),r.observe(e),t(),()=>{e.removeEventListener(`scroll`,n),r.disconnect()}},[A]);function N(){d||(p(!0),W.subAgentStop({slug:t,id:n}).then(({descendantsStopped:e,note:r})=>{r?K(`Sub-agent stopped. ${r}`,{duration:7e3}):K(e>0?`Sub-agent and ${e} descendant${e===1?``:`s`} stopped`:`Sub-agent stopped`),m.invalidateQueries({queryKey:[`subAgentTranscript`,t,n]})}).catch(e=>{K(e instanceof Error?e.message:`Could not stop this sub-agent`)}).finally(()=>p(!1)))}let P=h.data?.stoppable?(0,X.jsx)(jA,{"data-stop-subagent":``,label:`Stop sub-agent`,stopping:d,onStop:N}):h.data?.outcome?(0,X.jsx)(FA,{outcome:h.data.outcome,startedAt:h.data.startedAt??a,finishedAt:h.data.finishedAt}):null;return(0,X.jsx)(xr,{id:e,depth:o,widthDepth:s,children:e=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`header`,{"data-subagent-header":!0,className:`flex ${Jr} min-w-0 shrink-0 items-center gap-2.5 border-b border-border bg-panel px-3 ${Lo}`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2.5 pl-1 phone:gap-0.5 phone:pl-0`,children:[(0,X.jsx)(ga,{onClose:e}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 leading-tight`,children:[(0,X.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,X.jsx)(`div`,{className:`min-w-0 max-w-full shrink truncate px-0.5 -mx-0.5 font-semibold text-[15px] ${co}`,title:r,children:r})}),(0,X.jsx)(eD,{"data-subagent-header-facts":``,lastActiveAt:h.data?.lastActivityAt,fallbackAt:h.data?.startedAt??a,reading:h.data?.context?(0,X.jsx)(qE,{context:h.data.context}):null})]})]}),P&&(0,X.jsx)(`div`,{className:`flex shrink-0 items-center`,children:P})]}),(0,X.jsx)(`div`,{ref:u,className:`flex-1 min-h-0 overflow-y-auto`,children:k?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center px-8 text-center text-[13px] text-muted`,children:`Transcript unavailable (agent completed or cleaned up).`}):!c||h.isLoading||_.length===0?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,X.jsx)(`span`,{className:`block h-5 w-5 rounded-full border-2 border-muted/50 border-t-transparent animate-spin`})}):(0,X.jsx)(TO.Provider,{value:t,children:(0,X.jsxs)(`div`,{ref:j,"data-transcript-column":!0,className:`flex flex-col px-6 py-5`,children:[vk(D.map(e=>e.message),(e,t)=>(0,X.jsx)(cA,{m:e},t)),O&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xy,{h:_k(D.map(e=>e.message))}),(0,X.jsx)(AA,{since:a,startedAt:E,activityLabel:T,run:C})]})]})})}),(0,X.jsx)(NA,{slug:t,subId:n,subagentType:i,observedModel:h.data?.model,steerable:h.data?.steerable===!0,note:h.data?.steerNote??null,stoppable:h.data?.stoppable===!0,stopNote:h.data?.stopNote??null,stopping:d,ops:e=>(0,X.jsx)(SA,{slug:t,parentAgentId:n,transcriptShells:b,className:e})})]})})}function NA({slug:e,subId:t,subagentType:n,observedModel:r,steerable:i,note:a,stoppable:o,stopNote:s,stopping:c,ops:l}){let[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(!1),m=oo();function h(){let n=u.trim();!n||f||(p(!0),d(``),W.subAgentSteer({slug:e,id:t,message:n,deliveryId:crypto.randomUUID()}).then(()=>{m.invalidateQueries({queryKey:[`subAgentTranscript`,e,t]}),K(`Steer sent`)}).catch(e=>{d(n),K(e instanceof Error?e.message:`Could not steer this sub-agent`)}).finally(()=>p(!1)))}if(!i){let e=a??(o?null:s);return e?(0,X.jsxs)(`div`,{"data-subagent-steer-note":!0,className:`w-full shrink-0 border-t border-border bg-panel px-3 py-3`,children:[(0,X.jsx)(`div`,{className:`px-1 pb-2 text-[11.5px] text-muted-70`,children:e}),(0,X.jsx)(`div`,{className:`pl-1.5`,children:(0,X.jsx)(PA,{subagentType:n,observedModel:r})}),l?.(`px-1 pt-1.5 ops-column-optical-inset`)]}):(0,X.jsx)(X.Fragment,{children:l?.(`w-full shrink-0 border-t border-border bg-panel px-4 pb-2 pt-3`)})}return(0,X.jsxs)(`div`,{"data-subagent-steer":!0,className:`w-full shrink-0 border-t border-border bg-panel px-3 py-3`,children:[(0,X.jsx)(ze,{value:u,onChange:d,onSubmit:h,surface:`subAgentComposer`,placeholder:`Steer this sub-agent…`,busy:f||c,footer:(0,X.jsx)(PA,{subagentType:n,observedModel:r})}),!o&&s&&(0,X.jsx)(`div`,{className:`mt-2 px-1 text-[11.5px] text-muted-70`,children:s}),l?.(`px-1 pt-1.5 ops-column-optical-inset`)]})}function PA({subagentType:e,observedModel:t}){let n=bs(e,t),r=n?yo(n):`Profile unknown`;return(0,X.jsx)(`span`,{"data-subagent-profile":!0,"aria-label":`Sub-agent profile: ${r}`,title:n?r:`The provider did not report this sub-agent's model and effort`,className:`inline-flex h-6 min-w-0 max-w-[min(72%,20rem)] items-center rounded-md border border-border/50 bg-transparent px-1.5 text-muted ${jn}`,children:(0,X.jsx)(`span`,{className:`profile-grid-value relative -top-px min-w-0 truncate`,children:n&&n.verbatim===void 0?(0,X.jsxs)(X.Fragment,{children:[n.role&&`${n.role} · `,n.model,n.edition&&(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsx)(`span`,{className:`profile-grid-edition text-edition`,children:n.edition})]}),n.effort&&`${n.model?` › `:``}${n.effort}`]}):r})})}function FA({outcome:e,startedAt:t,finishedAt:n}){let r=aD[e],i=`${r[0].toUpperCase()}${r.slice(1)}`,a=t&&n?Date.parse(n)-Date.parse(t):NaN,o=Number.isFinite(a)&&a>=0?`${i} after ${yc(a)}`:i;return(0,X.jsx)(pE,{"data-subagent-outcome":e,check:e===`completed`,tooltip:o,children:i})}var IA=()=>De(void 0,`claude`);function LA({id:e,slug:t,title:n,depth:r,widthDepth:i}){let a=Fo({queryKey:[`threadBody`,t],queryFn:()=>W.threadBody({slug:t})}),o=Xa(U);(0,q.useEffect)(()=>{a.refetch()},[o.board]);let s=Qw(Xr(o.board,t)),c=As(),l=H.adopt(c,t),[u,d,f]=Ci(l),p=Ji({mutationFn:async e=>{await W.adoptThread({slug:t,message:e.trim()||void 0})},onSuccess:()=>{U.drawers.find(t=>t.id===e)?.closing||(U.drawers=U.drawers.map(t=>t.id===e?{...t,kind:`thread`}:t))},onError:(e,t)=>{G.get(l)||d(t),K(`Start failed: ${e.message.slice(0,80)}`)}}),m=Pp(gp(a.data?.markdown??``)),h=Sm(m),g=(0,q.useRef)(null),_=jh(g,m);return(0,X.jsx)(xr,{id:e,depth:r,widthDepth:i,widthOffset:1,subagentParent:t,children:e=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oa,{title:n,subtitle:`${t}.md`,onClose:e}),(0,X.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4`,children:a.isLoading?(0,X.jsx)(`div`,{className:`text-[13px] text-muted`,children:`Loading…`}):m?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{ref:g,className:`md-body`,dangerouslySetInnerHTML:h}),_]}):(0,X.jsx)(`div`,{className:`text-[13px] text-muted`,children:`No thread file found.`})}),s&&(0,X.jsxs)(`div`,{className:`shrink-0 border-t border-border/60 px-5 pb-4 pt-3`,children:[(0,X.jsx)(`p`,{className:`mb-2.5 text-[11.5px] text-muted-80`,children:`No session is attached to this thread yet. Send a message below to start one on this plan.`}),(0,X.jsx)(ze,{surface:`adoptComposer`,value:u,onChange:d,onSubmit:()=>{if(!u.trim()||p.isPending)return;let e=u;f(),K(`Starting thread…`,{spinner:!0,sticky:!0}),p.mutate(e)},placeholder:`Kick off work on this thread…`,slashSuggest:IA,minHeight:44,busy:p.isPending})]})]})})}function RA(e,t=0,n=new Date,r){if(e.length===0)return``;let i=e.map(e=>{let t=e.at?Date.parse(e.at):NaN;return Number.isFinite(t)?new Date(t).toLocaleTimeString(r,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}):``}),a=e.map(e=>e.at&&Number.isFinite(Date.parse(e.at))?Ry(e.at,n,r).day:``),o=Math.max(...i.map(e=>e.length)),s=a.some(e=>e&&e!==`Today`),c=[];t>0&&c.push(`${t} earlier event${t===1?` was`:`s were`} not kept.`,``);let l;return e.forEach((e,t)=>{s&&a[t]&&a[t]!==l&&(c.length>0&&c.push(``),c.push(a[t]),l=a[t]);let n=o>0?`${i[t].padStart(o)} `:``,r=` `.repeat(n.length),[u=``,...d]=e.text.split(`
|
|
139
|
+
`);c.push(n+u,...d.map(e=>r+e))}),c.join(`
|
|
140
|
+
`)}var zA=`text-[12px] font-medium text-muted-70`;function BA({label:e,aside:t,asideAlign:n=`end`,children:r,...i}){return(0,X.jsxs)(`section`,{...i,children:[(0,X.jsxs)(`div`,{className:`mb-1.5 flex h-5 items-center gap-2 ${n===`end`?`justify-between gap-3`:``}`,children:[(0,X.jsx)(`h2`,{className:zA,children:e}),t]}),r]})}var VA=`font-mono-keep overflow-x-auto whitespace-pre-wrap break-words ${Um} border border-border bg-bg/75 px-4 py-2.5 text-[12px] leading-relaxed text-fg/85`;function HA({id:e,slug:t,shellId:n,label:r,startedAt:i,monitor:a,depth:o,widthDepth:s}){let c=En(t,n),l=c.data?.state,[u,d]=(0,q.useState)(!1),f=oo(),p=c.data?.events,m=p!=null||a===!0,h=p?p.length+(c.data?.eventsDropped??0):0,g=p?`${h} event${h===1?``:`s`}`:``,_=ve(i),v=l===`running`?`running${_?` ${_}`:``}`:l===`done`?`finished`:l===`gone`?`unavailable`:``,y=m&&g&&l!==`gone`?[v,g].filter(Boolean).join(` · `):v,b=c.isError||l===`gone`,x=m?`Monitor`:`Background shell`;function S(){u||(d(!0),W.subAgentStop({slug:t,id:n}).then(({note:e})=>{e?K(`${x} stopped. ${e}`,{duration:7e3}):K(`${x} stopped — the worker was told`),f.invalidateQueries({queryKey:[`backgroundShellOutput`,t,n]})}).catch(e=>{K(e instanceof Error?e.message:`Could not stop this ${x.toLowerCase()}`)}).finally(()=>d(!1)))}return(0,X.jsx)(KA,{id:e,depth:o,widthDepth:s,kind:`background-shell`,title:m?`Monitor`:r,description:m?r:void 0,icon:m?(0,X.jsx)(P,{"aria-hidden":!0,size:14,className:`shrink-0 text-muted-60`}):(0,X.jsx)(ll,{"aria-hidden":!0,size:14,className:`shrink-0 text-muted-60`}),stateLabel:y,command:c.data?.command,output:p?RA(p,c.data?.eventsDropped??0):c.data?.output??``,outputHeading:m?`Events`:void 0,truncated:c.data?.truncated===!0,running:l===`running`,loading:c.isLoading,unavailable:b,unavailableText:m?`This monitor's events are no longer available.`:`Background shell output is no longer available.`,noCommandText:m?`Command unavailable for this monitor.`:`Command unavailable for this background operation.`,emptyText:m?l===`done`?`It delivered no events.`:`No events yet.`:l===`done`?`No output was captured.`:`No output yet.`,stop:!b&&c.data?.stoppable?{label:m?`Stop monitor`:`Stop shell`,stopping:u,onStop:S}:void 0,footer:!b&&!c.data?.stoppable&&l===`running`?c.data?.stopNote??void 0:void 0})}function UA({id:e,slug:t,monitorId:n,label:r,depth:i,widthDepth:a}){let o=ee(t,n),s=o.data,[c,l]=(0,q.useState)(!1),u=oo(),d=s?.check??null,f=s?`${s.events} event${s.events===1?``:`s`}`:``,p=d?`${d.runs} check${d.runs===1?``:`s`}`:``,m=ve(s?.startedAt??void 0),h=d?s?.state===`running`?[`every ${d.every}`,p].join(` · `):[s?.ended??`ended`,p].join(` · `):s?.state===`running`?[`running${m?` ${m}`:``}`,f].join(` · `):s?.state===`ended`?[s.ended??`ended`,f].join(` · `):s?.state===`gone`?`unavailable`:``,g=o.isError||s?.state===`gone`,_=d?.lastRun??null;function v(){c||(l(!0),W.stopMonitor({slug:t,id:n}).then(({stopped:e})=>{K(e?`Monitor stopped — the worker was told`:`This monitor had already ended`),u.invalidateQueries({queryKey:[`monitorOutput`,t,n]})}).catch(e=>{K(e instanceof Error?e.message:`Could not stop this monitor`)}).finally(()=>l(!1)))}return(0,X.jsx)(KA,{id:e,depth:i,widthDepth:a,kind:`monitor`,title:s&&!s.description?r:`Monitor`,description:s?.description||void 0,icon:d?(0,X.jsx)(An,{"aria-hidden":!0,size:14,className:`shrink-0 text-muted-60`}):(0,X.jsx)(P,{"aria-hidden":!0,size:14,className:`shrink-0 text-muted-60`}),stateLabel:h,command:s?.command,output:s?.output??``,truncated:s?.truncated===!0,running:!d&&s?.state===`running`,loading:o.isLoading,unavailable:g,unavailableText:`This monitor is no longer available.`,noCommandText:`Script unavailable for this monitor.`,emptyText:d?_?`It printed nothing.`:`No check has finished yet.`:s?.state===`ended`?`It printed nothing.`:`Nothing printed yet.`,outputHeading:d?`Last check`:void 0,intro:!s||g?void 0:d?s.state===`running`?`Frizz runs this every ${d.every} until it exits 0, then wakes the worker. It gives up ${WA(d.expiresAt)}.`:`Frizz ran this every ${d.every} until it exited 0, then woke the worker.`:`Frizz keeps this script running, and every line it prints wakes the worker.`,outputNote:_?`${GA(_)} · ${Ge(_.at)}`:void 0,stop:!g&&s?.stoppable?{label:`Stop monitor`,stopping:c,onStop:v}:void 0})}function WA(e){let t=new Date(e);if(!Number.isFinite(t.getTime()))return`when its time runs out`;let n=t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`});return t.toDateString()===new Date().toDateString()?`at ${n}`:`on ${t.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})} at ${n}`}function GA(e){return e.outcome===`exit`?e.exitCode===0?`passed`:`exited ${e.exitCode}`:e.outcome===`timeout`?`timed out`:e.outcome===`signal`?`killed by a signal`:`could not start`}function KA({id:e,depth:t,widthDepth:n,kind:r,title:i,icon:a,stateLabel:o,command:s,output:c,truncated:l,running:u,loading:d,unavailable:f,unavailableText:p,noCommandText:m,emptyText:h,outputHeading:g=`Output`,outputNote:_,description:v,intro:y,stop:b,footer:x}){let S=(0,q.useRef)(null),C=e=>({[`data-${r}-${e}`]:``});(0,q.useEffect)(()=>{let e=S.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<160&&(e.scrollTop=e.scrollHeight)},[c]);async function w(){if(s)try{await lo(s),K(`Command copied`)}catch{K(`Could not copy command`)}}return(0,X.jsx)(xr,{id:e,depth:t,widthDepth:n,children:e=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oa,{title:i,icon:a,meta:o?(0,X.jsx)(`span`,{className:`shrink-0 whitespace-nowrap text-[11.5px] text-muted-60`,children:o}):void 0,actions:b?(0,X.jsx)(`span`,{className:`-mr-1 flex shrink-0`,children:(0,X.jsx)(jA,{...C(`stop`),...r===`background-shell`?{"data-stop-background-shell":``}:{},label:b.label,stopping:b.stopping,onStop:b.onStop})}):void 0,onClose:e}),(0,X.jsx)(`div`,{ref:S,className:`min-h-0 flex-1 overflow-y-auto px-5 py-5`,children:f?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center px-8 text-center text-[13px] text-muted`,children:p}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[v&&(0,X.jsx)(BA,{label:`Description`,children:(0,X.jsx)(`p`,{...C(`description`),className:`text-[14px] leading-relaxed text-fg`,children:v})}),(0,X.jsxs)(BA,{label:`Command`,aside:s&&(0,X.jsxs)(`button`,{type:`button`,onClick:w,className:`button-outline flex items-center gap-1 rounded px-1.5 py-1 text-[10.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:[(0,X.jsx)(qe,{"aria-hidden":!0,size:11}),` Copy`]}),children:[s?(0,X.jsx)(Ag,{...C(`command`),text:s,language:`bash`,className:VA}):(0,X.jsx)(`pre`,{...C(`command`),className:VA,children:d?`Loading…`:m}),y&&(0,X.jsx)(`p`,{...C(`intro`),className:`mt-2 text-[12.5px] leading-relaxed text-muted-60`,children:y})]}),(0,X.jsx)(BA,{label:g,asideAlign:`inline`,aside:(u||_||l)&&(0,X.jsxs)(X.Fragment,{children:[u&&(0,X.jsx)(ut,{"aria-hidden":!0,hue:`shell`,"data-running-indicator":r===`monitor`?`monitor-drawer`:`shell-drawer`}),_&&(0,X.jsx)(`span`,{...C(`output-note`),className:`text-[12px] text-muted-60`,children:_}),l&&(0,X.jsx)(`span`,{className:`text-[12px] text-muted-50`,children:`Showing latest 512 KB`})]}),children:c?(0,X.jsx)(`pre`,{...C(`output`),className:`font-mono-keep min-h-40 whitespace-pre-wrap break-words ${Um} border border-border bg-inset px-4 py-3 text-[12px] leading-relaxed text-fg/85`,children:c}):(0,X.jsx)(`div`,{...C(`output`),className:`flex min-h-40 items-center justify-center ${Um} border border-border bg-inset px-4 text-center text-[12px] text-muted-60`,children:h})})]})}),x&&(0,X.jsx)(`footer`,{...C(`stop-note`),className:`w-full shrink-0 border-t border-border/70 bg-panel/95 px-4 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-[11.5px] text-muted-70`,children:x})]})})}function qA({id:e,slug:t,timerId:n,depth:r,widthDepth:i}){let a=Pt(t,n),o=a.data,s=Wo(),c=Sm(Pp(o?.prompt??``)),l=Date.parse(o?.fireAt??``),u=o?o.state===`armed`?l>s?`in ${vt(l-s)}`:`firing…`:o.state===`fired`?`fired ${Ge(o.settledAt??o.fireAt,s)}`:`cancelled`:``,d=a.isError||o===null;async function f(){if(o)try{await lo(o.prompt),K(`Prompt copied`)}catch{K(`Could not copy the prompt`)}}return(0,X.jsx)(xr,{id:e,depth:r,widthDepth:i,children:e=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oa,{title:`Timer`,icon:(0,X.jsx)(bt,{"aria-hidden":!0,size:14,className:`shrink-0 text-muted-60`}),meta:u?(0,X.jsx)(`span`,{"data-timer-state":!0,className:`shrink-0 whitespace-nowrap text-[11.5px] text-muted-60`,children:u}):void 0,onClose:e}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-5`,children:d?(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center px-8 text-center text-[13px] text-muted`,children:`This timer is no longer available.`}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[o?.description&&(0,X.jsx)(BA,{label:`Description`,children:(0,X.jsx)(`p`,{"data-timer-description":!0,className:`text-[14px] leading-relaxed text-fg`,children:o.description})}),(0,X.jsx)(`div`,{"data-timer-when":!0,className:`flex flex-wrap gap-x-12 gap-y-6`,children:o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(BA,{label:o.state===`fired`?`Fired`:o.state===`cancelled`?`Was due`:`Fires`,children:(0,X.jsx)(`p`,{className:JA,children:YA(l,s)})}),(0,X.jsx)(BA,{label:`Set`,children:(0,X.jsx)(`p`,{className:JA,children:Ge(o.createdAt,s)})}),o.state===`cancelled`&&o.settledAt?(0,X.jsx)(BA,{label:`Cancelled`,children:(0,X.jsx)(`p`,{className:JA,children:Ge(o.settledAt,s)})}):null]}):(0,X.jsx)(`p`,{className:`text-[13px] text-muted-60`,children:a.isLoading?`Loading…`:``})}),(0,X.jsx)(BA,{label:`Prompt`,aside:o&&(0,X.jsxs)(`button`,{type:`button`,onClick:f,className:`button-outline flex items-center gap-1 rounded px-1.5 py-1 text-[10.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,children:[(0,X.jsx)(qe,{"aria-hidden":!0,size:11}),` Copy`]}),children:o?(0,X.jsx)(`div`,{"data-timer-prompt":!0,className:`md-body ${Um} border border-border bg-inset px-4 py-3 text-[13px]`,dangerouslySetInnerHTML:c}):(0,X.jsx)(`div`,{"data-timer-prompt":!0,className:`${Um} border border-border bg-inset px-4 py-3 text-[12px] text-muted-60`,children:a.isLoading?`Loading…`:``})})]})})]})})}var JA=`text-[13px] text-fg/85`;function YA(e,t){if(!Number.isFinite(e))return``;let n=new Date(e),r=n.toDateString()===new Date(t).toDateString(),i=n.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`});return r?`today at ${i}`:Math.abs(e-t)<8640*6e4?`${n.toLocaleDateString(void 0,{weekday:`short`})} at ${i}`:`${n.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} at ${i}`}var XA=64,ZA=12,QA=XA-ZA-4,$A=16,ej=`#4a9eff`,tj,nj,rj=!1;function ij(){return tj??=[...document.querySelectorAll(`link[rel~="icon"]`)].map(e=>({link:e,href:e.getAttribute(`href`)??``,type:e.getAttribute(`type`),sizes:e.getAttribute(`sizes`)})),tj}function aj(e){let t=document.createElement(`canvas`);t.width=t.height=XA;let n=t.getContext(`2d`);return n.drawImage(e,0,0,XA,XA),n.globalCompositeOperation=`destination-out`,n.beginPath(),n.arc(QA,$A,16,0,Math.PI*2),n.fill(),n.globalCompositeOperation=`source-over`,n.fillStyle=ej,n.beginPath(),n.arc(QA,$A,ZA,0,Math.PI*2),n.fill(),t.toDataURL(`image/png`)}function oj(e){return nj??=new Promise((t,n)=>{let r=e.find(e=>e.type===`image/svg+xml`)??e[0];if(!r)return n(Error(`no favicon link`));let i=new Image;i.onload=()=>t(aj(i)),i.onerror=()=>n(Error(`favicon did not load`)),i.src=r.href}),nj}function sj(e){rj=e;let t=ij();if(!e){for(let{link:e,href:n,type:r,sizes:i}of t)e.href=n,r===null?e.removeAttribute(`type`):e.type=r,i===null?e.removeAttribute(`sizes`):e.setAttribute(`sizes`,i);return}oj(t).then(e=>{if(rj)for(let{link:n}of t)n.type=`image/png`,n.removeAttribute(`sizes`),n.href=e}).catch(()=>{nj=void 0})}var cj=new Map,lj=12;function uj(e,t){let n=cj.get(e);if(n&&n.raw===t)return n.html;let r=Zd(t,oe(e));if(cj.set(e,{raw:t,html:r}),cj.size>lj){let e=cj.keys().next();e.done||cj.delete(e.value)}return r}function dj(e){let t=globalThis.requestIdleCallback;t?t(e,{timeout:500}):setTimeout(e,0)}function fj(e,t){_n(t)||e.prefetchQuery(Ue(t)).then(()=>{let n=e.getQueryData(Ue(t).queryKey);!n?.markdown||n.binary||_c(t)||dj(()=>uj(n.path,n.markdown))}).catch(()=>{})}function pj(e){let t=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(e);return t?{front:t[1],body:e.slice(t[0].length)}:{front:null,body:e}}var mj={paddingBottom:`max(0.75rem, env(safe-area-inset-bottom))`};function hj({path:e}){return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>void gj(e),onMouseDown:e=>e.preventDefault(),className:`-mr-2.5 flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[12px] font-medium text-fg/80 outline-none transition-colors hover:bg-hover-strong hover:text-fg focus-visible:ring-1 focus-visible:ring-focus-ink-60`,title:`Open ${e} outside Frizz`,"aria-label":`Open`,children:[(0,X.jsx)(Ic,{size:12,"aria-hidden":`true`}),` Open`]})}function gj(e){return st(e).openLocalFile({path:e}).then(Ht).catch(e=>K(`Could not open local file: ${e.message.slice(0,100)}`))}function _j({path:e,revision:t,title:n}){return(0,X.jsx)(`iframe`,{"data-pdf-view":!0,src:`${Vo(e)}${t===void 0?``:`&v=${t}`}`,title:n,className:`block min-h-0 w-full flex-1 border-0`})}function vj({phone:e=!1}){return(0,X.jsxs)(`div`,{className:`text-[13px] text-muted`,children:[`This file isn’t text, so Frizz can’t show it.`,e?``:` Open sends it to its default app.`]})}function yj({source:e}){return(0,X.jsx)(Ag,{text:e,language:`yaml`,className:`mb-4 whitespace-pre-wrap break-words rounded-md border border-border/60 bg-panel-2/40 px-3 py-2 font-mono-keep text-[12px] leading-5 text-muted`})}function bj({id:e,path:t,title:n,depth:r,widthDepth:i}){let a=se(t),o=Fo({...Ue(t),refetchInterval:a?!1:ge}),s=o.data?.path??t,c=_c(t),l=x(t)&>(),{front:u,body:d}=pj(c?o.data?.markdown??``:``),f=$n(s),p=Pp(d,{baseDir:f,asDocument:!0}),m=Sm(p),h=(0,q.useRef)(null);zm(h,p);let g=ng(h,p,f),_=jh(h,p),v=Be(),y=Fn(),b=o.data?.markdown??``,S=Sm((0,q.useMemo)(()=>c?``:uj(s,b),[c,b,s]));return(0,X.jsx)(xr,{id:e,depth:r,widthDepth:i,children:e=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oa,{title:n,subtitle:Xs(s,y),subtitlePath:!0,onClose:e}),(0,X.jsxs)(`div`,{className:`flex-1 min-h-0 ${l&&o.data?`flex flex-col`:`overflow-y-auto px-5 py-4`}`,children:[l&&o.data?(0,X.jsx)(_j,{path:s,revision:o.data.modifiedAt,title:n}):o.isLoading?(0,X.jsx)(`div`,{className:`text-[13px] text-muted`,children:`Loading…`}):o.error?(0,X.jsxs)(`div`,{className:`text-[13px] text-danger-90`,children:[`Couldn’t read this file: `,o.error.message]}):o.data?.binary?(0,X.jsx)(vj,{phone:v}):c?p?(0,X.jsxs)(X.Fragment,{children:[u&&(0,X.jsx)(yj,{source:u}),(0,X.jsx)(`div`,{ref:h,className:`md-body`,dangerouslySetInnerHTML:m}),g,_,o.data?.truncated&&(0,X.jsxs)(`p`,{className:`mt-4 border-t border-border/60 pt-3 text-[12px] text-muted`,children:[`This file is too long to render in full — everything above the cut is shown.`,v?``:` Open it to read the rest.`]})]}):(0,X.jsx)(`div`,{className:`text-[13px] text-muted`,children:`This file is empty.`}):b?(0,X.jsx)(`pre`,{"data-file-source":!0,className:`hljs whitespace-pre-wrap break-words bg-transparent font-mono-keep text-[12px] leading-5 text-fg/90`,style:{tabSize:2},dangerouslySetInnerHTML:S}):(0,X.jsx)(`div`,{className:`text-[13px] text-muted`,children:`This file is empty.`}),!c&&!o.isLoading&&!o.error&&o.data?.truncated&&(0,X.jsx)(`p`,{className:`mt-4 border-t border-border/60 pt-3 text-[12px] text-muted`,children:`This file is too long to show in full — everything above the cut is shown.`})]}),v?(0,X.jsx)(`div`,{"aria-hidden":!0,className:`shrink-0`,style:{height:`env(safe-area-inset-bottom)`}}):(0,X.jsx)(`div`,{className:`shrink-0 flex items-center justify-end gap-1.5 border-t border-border/60 bg-panel px-5 pt-3`,style:mj,children:(0,X.jsx)(hj,{path:s})})]})})}function xj(e,t,n){let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=0;for(let e=r.nextNode();e;e=r.nextNode()){if(e===t)return i+n;i+=e.textContent?.length??0}if(t instanceof Element&&e.contains(t)){let n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=0;for(let e=n.nextNode();e;e=n.nextNode())(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING||t.contains(e))&&(r+=e.textContent?.length??0);return r}return null}function Sj(e,t){let n=1,r=Math.min(t,e.length);for(let t=0;t<r;t++)e.charCodeAt(t)===10&&n++;return n}function Cj({slug:e,path:t,active:n}){let r=_c(t),i=x(t)&>(),a=se(t),o=Fo({...Ue(t),refetchInterval:a?!1:ge}),s=o.data?.path??t,c=o.data?.markdown??``,{front:l,body:u}=pj(r?c:``),[d,f]=(0,q.useState)(r?`rendered`:`source`),p=$n(s),m=Pp(u,{baseDir:p,asDocument:!0}),h=Sm(m),g=Sm((0,q.useMemo)(()=>d===`source`?uj(s,c):``,[c,s,d])),_=(0,q.useRef)(null),v=(0,q.useRef)(null),y=(0,q.useRef)(null);zm(_,m);let b=ng(_,m,p),S=jh(_,m),C=ac(s),w=Fn(),T=As(),E=Ni(e);return(0,q.useEffect)(()=>{if(!n)return;let t=()=>document.querySelector(`[data-pane-thread] textarea, main[data-standalone-thread] textarea`);function r(e,t){return e?document.activeElement!==e&&e.selectionStart===0&&e.selectionEnd===0&&e.value.length>0?t.length:Math.min(e.selectionStart??t.length,t.length):t.length}function i(n){if(!(n.metaKey||n.ctrlKey)||n.altKey||n.shiftKey||n.key.toLowerCase()!==`i`)return;let i=y.current,a=window.getSelection(),o=a&&!a.isCollapsed&&a.rangeCount>0?a.getRangeAt(0):null,l=!!(i&&o&&i.contains(o.commonAncestorContainer)),u=l?a.toString():``;if(!l||!u.trim()){n.preventDefault(),n.stopPropagation();let e=t();if(!e)return;document.activeElement!==e&&e.selectionStart===0&&e.selectionEnd===0&&e.value.length>0&&e.setSelectionRange(e.value.length,e.value.length),e.focus();return}n.preventDefault(),n.stopPropagation();let d=null,f=v.current;if(f&&f.contains(o.commonAncestorContainer)){let e=xj(f,o.startContainer,o.startOffset),t=xj(f,o.endContainer,o.endOffset);e!==null&&t!==null&&(d={startLine:Sj(c,Math.min(e,t)),endLine:Sj(c,Math.max(0,Math.max(e,t)-1))})}else d=Sa(c,u);let p=t(),m=H.followUp(T,e,E),{prose:h,attachments:g}=Es(G.get(m)),_=yi(gs({path:s,...d??{}}),U.composerContext[e]??[],h),b=Qo(h,r(p,h),_);G.set(m,Ya(b.prose,g.map(e=>e.path))),xs(e,{token:_,path:s,text:u,...d??{}}),a.removeAllRanges(),requestAnimationFrame(()=>{let e=t();e&&(e.setSelectionRange(b.caret,b.caret),e.focus())})}return window.addEventListener(`keydown`,i,!0),()=>window.removeEventListener(`keydown`,i,!0)},[n,e,s,c,T,E]),(0,X.jsxs)(`div`,{ref:y,"data-file-viewer-panel":!0,className:`flex h-full min-h-0 flex-col`,children:[(0,X.jsx)(oa,{title:C,subtitle:Xs(s,w),subtitlePath:!0,onClose:bo,actions:r?(0,X.jsx)(`div`,{className:`-mr-0.5 flex shrink-0 items-center gap-0.5 text-[11px] font-medium`,role:`group`,"aria-label":`File view`,children:[`rendered`,`source`].map(e=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>f(e),"aria-pressed":d===e,className:`rounded px-2 py-0.5 transition-colors ${d===e?`bg-hover-strong text-fg`:`text-muted hover:text-fg`}`,children:e===`rendered`?`Rendered`:`Source`},e))}):null}),(0,X.jsxs)(`div`,{className:`flex-1 min-h-0 ${i&&o.data?`flex flex-col`:`overflow-y-auto px-5 py-4`}`,children:[i&&o.data?(0,X.jsx)(_j,{path:s,revision:o.data.modifiedAt,title:C}):o.isLoading?(0,X.jsx)(`div`,{className:`text-[13px] text-muted`,children:`Loading…`}):o.error?(0,X.jsxs)(`div`,{className:`text-[13px] text-danger-90`,children:[`Couldn’t read this file: `,o.error.message]}):o.data?.binary?(0,X.jsx)(vj,{}):d===`source`?c?(0,X.jsx)(`pre`,{ref:v,className:`hljs whitespace-pre-wrap break-words bg-transparent font-mono-keep text-[12px] leading-5 text-fg/90`,style:{tabSize:2},dangerouslySetInnerHTML:g}):(0,X.jsx)(`div`,{className:`text-[13px] text-muted`,children:`This file is empty.`}):m?(0,X.jsxs)(X.Fragment,{children:[l&&(0,X.jsx)(yj,{source:l}),(0,X.jsx)(`div`,{ref:_,className:`md-body`,dangerouslySetInnerHTML:h}),b,S]}):(0,X.jsx)(`div`,{className:`text-[13px] text-muted`,children:`This file is empty.`}),!o.isLoading&&!o.error&&o.data?.truncated&&(0,X.jsx)(`p`,{className:`mt-4 border-t border-border/60 pt-3 text-[12px] text-muted`,children:`This file is too long to render in full — everything above the cut is shown. Open it to read the rest.`})]}),(0,X.jsxs)(`div`,{className:`shrink-0 flex items-center justify-between gap-3 border-t border-border/60 bg-panel px-5 pt-3`,style:mj,children:[i||o.data?.binary?(0,X.jsx)(`span`,{}):(0,X.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted-70`,children:`Select text and press ⌘I to add it to the chat`}),(0,X.jsx)(hj,{path:s})]})]})}function wj(){return{dirs:new Map,files:new Map}}function Tj(e,t,n){let r=e.replace(/[\\/]+$/,``);if(t){let e=Mn(t,r);if(e!==null)return I(e)}if(n){let e=Mn(n,r);if(e!==null)return[`~`,...I(e)]}let i=I(r);return/^[\\/]/.test(r)?[`/`,...i]:i}var Ej=(e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`,numeric:!0});function Dj(e,t,n=``){let r=[];for(let i of[...e.dirs.keys()].sort(Ej)){let a=e.dirs.get(i),o=i;for(;a.files.size===0&&a.dirs.size===1;){let[e,t]=[...a.dirs.entries()][0];o=o===`/`?`/${e}`:`${o}/${e}`,a=t}let s=n===``||n===`/`?`${n}${o}`:`${n}/${o}`;r.push({kind:`dir`,name:o,path:s,depth:t,children:Dj(a,t+1,s)})}for(let n of[...e.files.keys()].sort(Ej))r.push({kind:`file`,name:n,depth:t,file:e.files.get(n)});return r}function Oj(e,t,n){let r=wj();for(let i of e){let e=Tj(i.path,t,n);if(e.length===0)continue;let a=r;for(let t of e.slice(0,-1)){let e=a.dirs.get(t);e||(e=wj(),a.dirs.set(t,e)),a=e}a.files.set(e[e.length-1],i)}return Dj(r,0)}function kj(e){let t=[],n=e=>{for(let r of e)t.push(r),r.kind===`dir`&&n(r.children)};return n(e),t}var Aj=/(?:^|[\s;&|(])(?:rm|mv|unlink|git\s+(?:rm|mv|clean|checkout|restore|reset|stash|apply))\b/;function jj(e){if(e.edit||e.edits?.length)return!0;let t=$i(e.name);return xo.has(t)?!0:t!==`bash`||!e.command?!1:Aj.test(e.command)||ln(e.command).length>0}function Mj(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n.tools??[];for(let e=r.length-1;e>=0;e--)if(jj(r[e]))return`${n.sourceId??n.at??`#${t}`}:${e}:${r[e].status??``}`}}var Nj=10;function Pj({name:e,depth:t}){return(0,X.jsxs)(`div`,{"data-file-dir":e,className:`flex items-baseline pr-2 text-[12px] leading-5 text-muted-70`,style:{paddingLeft:8+t*Nj},children:[(0,X.jsx)(`span`,{className:`flex shrink-0`,children:(0,X.jsx)(Vc,{size:12,className:`${Z} text-muted-45`})}),(0,X.jsx)(`span`,{className:`ml-[5px] min-w-0 truncate`,title:e,children:e})]})}function Fj({files:e}){let t=za(),n=Fn();return(0,X.jsx)(`div`,{"data-edited-file-tree":!0,className:`flex flex-col gap-y-px`,children:kj(Oj(e,t,n)).map(e=>e.kind===`dir`?(0,X.jsx)(Pj,{name:e.name,depth:e.depth},`d:${e.path}`):(0,X.jsx)(Bj,{file:e.file,name:e.name,depth:e.depth,homeDir:n},e.file.path))})}function Ij({changes:e}){let t=Fn(),n=kj(Oj(e.files,e.root,t)),r=e.error??(e.files.length===0?`No changes${e.base?` from ${e.base}`:``} yet`:void 0);return(0,X.jsxs)(`div`,{"data-worktree-changes":e.root,className:`flex flex-col gap-y-px`,children:[r&&(0,X.jsx)(`div`,{"data-worktree-note":!0,className:`pr-2 text-[12px] leading-5 text-muted-50`,style:{paddingLeft:8},children:r}),n.map(e=>e.kind===`dir`?(0,X.jsx)(Pj,{name:e.name,depth:e.depth},`d:${e.path}`):(0,X.jsx)(Bj,{file:e.file,name:e.name,depth:e.depth,homeDir:t,status:e.file.status},e.file.path)),e.truncated&&(0,X.jsxs)(`div`,{className:`pr-2 text-[12px] leading-5 text-muted-50`,style:{paddingLeft:8},children:[`Only the first `,e.files.length,` are listed`]})]})}function Lj({scratch:e}){let t=Fn(),n=kj(Oj(e.files,e.root,t));return(0,X.jsxs)(`div`,{"data-scratch-files":e.root,className:`flex flex-col gap-y-px`,children:[n.map(e=>e.kind===`dir`?(0,X.jsx)(Pj,{name:e.name,depth:e.depth},`d:${e.path}`):(0,X.jsx)(Bj,{file:e.file,name:e.name,depth:e.depth,homeDir:t,status:`listed`},e.file.path)),e.truncated&&(0,X.jsxs)(`div`,{className:`pr-2 text-[12px] leading-5 text-muted-50`,style:{paddingLeft:8},children:[`Only the first `,e.files.length,` are listed`]})]})}function Rj(e){let t=(e,t)=>I(e).slice(-t).join(`/`);return e.map(n=>{let r=t(n.root,1);return`Changes in ${e.some(e=>e!==n&&t(e.root,1)===r)?t(n.root,2):r}`})}var zj={added:zc,deleted:Rc,modified:Lc,listed:Bc};function Bj({file:e,name:t,depth:n,homeDir:r,status:i}){let a=zj[i??`modified`],o=i===`deleted`,s=oo();return(0,X.jsx)(ny,{testKind:`file`,testId:e.path,mark:(0,X.jsx)(a,{size:12,className:`${Z} -mr-[2px] text-muted-60`}),name:t,indent:n*Nj,onOpen:o?void 0:()=>R(e.path),dragPath:o?void 0:e.path,onPrewarm:o?void 0:()=>fj(s,e.path),title:o?`${Xs(e.path,r)} (deleted)`:Xs(e.path,r),status:(0,X.jsxs)(X.Fragment,{children:[(e.added??0)>0&&(0,X.jsxs)(`span`,{style:{color:_.fgSuccess},children:[`+`,e.added]}),(e.added??0)>0&&(e.removed??0)>0&&` `,(e.removed??0)>0&&(0,X.jsxs)(`span`,{style:{color:_.fgDanger},children:[`−`,e.removed]})]})})}function Vj({link:e}){let t=oo(),n=Fn();return e.kind===`link`?(0,X.jsx)(ny,{testKind:`link`,testId:e.id,mark:(0,X.jsx)(Ic,{size:12,className:`${Z} text-muted-60`}),name:e.label,href:e.target,title:e.target,status:Hj(e.target)}):(0,X.jsx)(ny,{testKind:`link`,testId:e.id,mark:(0,X.jsx)(Rt,{size:12,className:`${Z} text-muted-60`}),name:e.label,onOpen:()=>R(e.target),dragPath:e.target,onPrewarm:()=>fj(t,e.target),title:Xs(e.target,n),status:null})}function Hj(e){try{return new URL(e).host||e}catch{return e}}var Uj=1500;function Wj(e,t,n,r){let i=oo(),a=(0,q.useRef)({slug:e,loaded:t,changeKey:n,turnLive:r}),o=(0,q.useRef)(void 0);(0,q.useEffect)(()=>()=>clearTimeout(o.current),[e]),(0,q.useEffect)(()=>{let s=a.current;if(a.current={slug:e,loaded:t,changeKey:n,turnLive:r},s.slug!==e||!s.loaded)return;let c=n!==void 0&&n!==s.changeKey,l=s.turnLive&&!r;!c&&!l||(clearTimeout(o.current),o.current=setTimeout(()=>{i.refetchQueries({queryKey:[`transcript`,e],exact:!0,type:`active`})},Uj))},[i,e,t,n,r])}function Gj({thread:e,centred:t=!1}){let n=Wo(),r=Qt(e.id,{poll:!1}),i=r.data?.editedFiles??[],a=r.data?.worktreeChanges??[],o=r.data?.scratch,s=Rj(a),c=Fn(),l=(0,q.useMemo)(()=>Mj(r.data?.messages??[]),[r.data?.messages]);Wj(e.id,r.data!==void 0,l,e.runtime===`running`||e.runtime===`spawning`);let{agents:u,children:d,shells:f,prs:p,issues:m,commands:h,timers:g}=I_(e,(0,q.useMemo)(()=>_S(r.data?.messages??[]),[r.data?.messages]),Ws(e.id)),_=R_(e),v=u.filter(li),{railFilesCollapsed:y}=Xa(qa),b=[{head:`Sub-agents`,rows:v.map(t=>(0,X.jsx)(Sy,{agent:t,slug:e.id,now:n,onDismiss:Do(e.id,t)},t.id??t.label))},{head:`Child threads`,rows:d.map(e=>(0,X.jsx)(Cy,{child:e,now:n},e.id))},{head:`Background shells`,rows:f.map(t=>(0,X.jsx)(dy,{shell:t,slug:e.id,now:n,onDismiss:Do(e.id,t,`SHELL`),watched:_(t)},t.id??t.label))},{head:`Pull requests`,rows:p.map(e=>(0,X.jsx)(ay,{watch:e},e.id))},{head:`Issues`,rows:m.map(e=>(0,X.jsx)(ay,{watch:e},e.id))},{head:`Monitors`,rows:h.map(t=>(0,X.jsx)(vy,{watch:t,slug:e.id,now:n},t.id))},{head:`Timers`,rows:g.map(t=>(0,X.jsx)(fy,{watch:t,slug:e.id,now:n},t.id))},{head:`Files and links`,rows:(e.links??[]).map(e=>(0,X.jsx)(Vj,{link:e},e.id))},...a.map((e,t)=>({head:s[t],title:e.base?`${Xs(e.root,c)}\nCompared with ${e.base}`:Xs(e.root,c),rows:[(0,X.jsx)(Ij,{changes:e},e.root)],count:e.files.length,collapsed:y,onToggle:()=>qa.railFilesCollapsed=!qa.railFilesCollapsed})),{head:`Edited files`,rows:i.length>0?[(0,X.jsx)(Fj,{files:i},`tree`)]:[],count:i.length,collapsed:y,onToggle:()=>qa.railFilesCollapsed=!qa.railFilesCollapsed},{head:`Scratch files`,title:o?Xs(o.root,c):void 0,rows:o?[(0,X.jsx)(Lj,{scratch:o},`scratch`)]:[],count:o?.files.length??0,collapsed:y,onToggle:()=>qa.railFilesCollapsed=!qa.railFilesCollapsed}].filter(e=>e.rows.length>0);return(0,X.jsx)(`aside`,{"data-focus-rail":!0,"aria-label":`Thread activity`,className:`flex h-full shrink-0 flex-col overflow-y-auto px-4 [view-transition-name:thread-rail]`,style:{width:340},children:(0,X.jsx)(`div`,{className:b.length===0||t?`my-auto py-6`:`pb-6 pt-14`,children:b.length===0?(0,X.jsx)(`div`,{className:`text-[11.5px] text-muted-50`,children:`Nothing running, watched or edited yet.`}):(0,X.jsx)(Oy,{groups:b,divider:!1})})})}function Kj({slug:e}){let t=Xa(U),r=Be(),i=t.filePanels.some(e=>!e.closing),a=He[Xa(qa).threadWidth],o=A(),s=Tt(e),c=Cr(o,e,()=>s),l=c.kind===`found`?c.thread:void 0;o?.projectDir,(0,q.useEffect)(()=>{let e=window.matchMedia?.(`(min-width: ${mc}px)`);if(!e)return;let t=()=>{U.splitFileViewer=e.matches};return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),U.splitFileViewer=!1,U.filePanels=[]}},[]);let u=(0,q.useRef)(null),d=!t.splitFileViewer,f=c.kind===`found`;(0,q.useEffect)(()=>{if(!d||!f)return;let t=u.current?.querySelector(`[data-thread-chat-footer]`);if(t)return n(`thread-page:${e}`,t)},[d,f,e]);let p=l?.runtime===`turn-idle`||l?.runtime===`exited`||l?.runtime===`none`;(0,q.useEffect)(()=>{!l||!p||W.threadSeen({slug:e}).catch(()=>{})},[p,e,l?.lastActivityAt]),(0,q.useEffect)(()=>{let t=o?.projectLabel??o?.projectName,n=l?io(l):e;document.title=t?`${n} · ${t} — Frizz`:`${n} · Frizz`},[o?.projectLabel,o?.projectName,e,l]);let m=l!==void 0&&Ki(l);return(0,q.useEffect)(()=>(sj(m),()=>sj(!1)),[m]),(0,X.jsx)(pc,{children:(0,X.jsxs)(ka,{className:`h-dvh min-h-0 bg-bg text-sm text-fg`,children:[(0,X.jsx)(gc,{className:`h-full w-full overflow-hidden`,children:(0,X.jsxs)(`div`,{className:`flex h-full w-full justify-center transition-transform duration-200 ease-out motion-reduce:transition-none split:justify-start`,style:{...ht(a),transform:i?`translateX(calc(-1 * var(--full-gutter)))`:void 0},children:[(0,X.jsx)(`div`,{className:`hidden w-[var(--full-gutter)] shrink-0 split:block`,"aria-hidden":`true`}),(0,X.jsx)(`main`,{ref:u,"data-standalone-thread":!0,className:`flex h-full w-[var(--full-thread-narrow)] min-w-0 shrink-0 flex-col overflow-hidden border-border bg-panel phone:w-full phone:border-x-0! phone:pt-[env(safe-area-inset-top)] sm:border-x split:w-[var(--full-thread)] [view-transition-name:thread-chat]`,children:c.kind===`loading`?(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,role:`status`,"aria-label":`Loading thread`,children:(0,X.jsx)(`span`,{className:`block h-5 w-5 animate-spin rounded-full border-2 border-muted/50 border-t-transparent`})}):c.kind===`missing`?(0,X.jsx)(Qn,{slug:e}):(0,X.jsx)(Xi,{label:`this thread`,resetKeys:[e],children:(0,X.jsx)(Ui,{slug:e,showReturnToQueue:!0,onClose:r?()=>FE(e):void 0})})}),l?(0,X.jsx)(Xi,{label:`this thread's side pane`,resetKeys:[e],children:(0,X.jsx)(qj,{slug:e,thread:l})}):(0,X.jsx)(`div`,{className:`hidden w-[var(--full-pane)] shrink-0 split:block`,"aria-hidden":`true`})]})}),(0,X.jsx)(Ne,{onEscapeAtRest:()=>FE(e)})]})})}function qj({slug:e,thread:t,rail:n=!0,centredRail:r=!1}){let i=Xa(U);return(0,X.jsxs)(`div`,{"data-side-pane":!0,className:`relative hidden h-full w-[var(--full-pane)] min-h-0 min-w-0 shrink-0 grow-0 overflow-hidden split:block`,children:[n&&(0,X.jsx)(`div`,{inert:i.filePanels.length>0?!0:void 0,className:`h-full min-h-0`,children:(0,X.jsx)(Gj,{thread:t,centred:r})}),i.filePanels.map((t,n)=>(0,X.jsx)(Jj,{slug:e,path:t.path,closing:!!t.closing,active:n===i.filePanels.length-1&&!t.closing&&i.splitFileViewer},t.id))]})}function Jj({slug:e,path:t,closing:n,active:r}){let[i,a]=(0,q.useState)(!1),o=(0,q.useRef)(null);return(0,q.useLayoutEffect)(()=>{o.current?.getBoundingClientRect();let e=()=>a(!0),t=requestAnimationFrame(e),n=window.setTimeout(e,120);return()=>{cancelAnimationFrame(t),window.clearTimeout(n)}},[]),(0,q.useEffect)(()=>{r&&o.current?.focus({preventScroll:!0})},[r]),(0,X.jsx)(`aside`,{ref:o,tabIndex:-1,"data-file-viewer-slot":!0,"aria-hidden":!r,inert:!r,className:`absolute inset-0 outline-none transition-[translate,opacity] duration-200 ease-out motion-reduce:transition-none ${i&&!n?`translate-x-0 opacity-100`:`translate-x-full opacity-0`}`,children:(0,X.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-panel`,children:(0,X.jsx)(Cj,{slug:e,path:t,active:r})})})}export{HA as BackgroundShellSheet,rg as LightboxHost,bj as MarkdownDrawer,UA as MonitorSheet,qj as SidePane,Kj as StandaloneThreadPage,MA as SubAgentSheet,gE as ThreadActionsSheet,LA as ThreadDrawer,DO as ThreadView,qA as TimerSheet};
|